From 95d1ba5dc5752d79d7fd9d13fb4553df58b25392 Mon Sep 17 00:00:00 2001 From: cpw Date: Mon, 29 Feb 2016 19:43:05 -0500 Subject: [PATCH 001/243] Don't ignore rejects --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 850a6e9fac..aa408adefb 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,6 @@ /buildSrc #Patch rejects -*.rej /patches-/ # FML changelog From d29b9f8752466967870687ebebc355a5b9544005 Mon Sep 17 00:00:00 2001 From: cpw Date: Mon, 29 Feb 2016 21:37:08 -0500 Subject: [PATCH 002/243] Add in mcp named patches and use them. Initial 1.9 setup. --- build.gradle | 12 +- jsons/1.9-dev.json | 95 ++ jsons/1.9-rel.json | 146 ++ jsons/1.9.json | 218 +++ .../net/minecraft/block/Block.java.patch | 1338 +++++++++++++++++ .../minecraft/block/BlockBanner.java.patch | 54 + .../net/minecraft/block/BlockBush.java.patch | 66 + .../minecraft/block/BlockButton.java.patch | 12 + .../minecraft/block/BlockCactus.java.patch | 37 + .../net/minecraft/block/BlockChest.java.patch | 11 + .../net/minecraft/block/BlockCocoa.java.patch | 27 + .../net/minecraft/block/BlockCrops.java.patch | 77 + .../minecraft/block/BlockDeadBush.java.patch | 33 + .../net/minecraft/block/BlockDoor.java.patch | 20 + .../block/BlockDoublePlant.java.patch | 89 ++ .../minecraft/block/BlockDropper.java.patch | 11 + .../minecraft/block/BlockFalling.java.patch | 10 + .../minecraft/block/BlockFarmland.java.patch | 11 + .../net/minecraft/block/BlockFire.java.patch | 211 +++ .../minecraft/block/BlockFlowerPot.java.patch | 48 + .../net/minecraft/block/BlockGrass.java.patch | 29 + .../block/BlockHugeMushroom.java.patch | 23 + .../net/minecraft/block/BlockIce.java.patch | 35 + .../minecraft/block/BlockLadder.java.patch | 30 + .../minecraft/block/BlockLeaves.java.patch | 126 ++ .../net/minecraft/block/BlockLever.java.patch | 15 + .../net/minecraft/block/BlockLog.java.patch | 24 + .../block/BlockMobSpawner.java.patch | 19 + .../minecraft/block/BlockMushroom.java.patch | 11 + .../minecraft/block/BlockMycelium.java.patch | 20 + .../block/BlockNetherWart.java.patch | 49 + .../minecraft/block/BlockNewLeaf.java.patch | 24 + .../net/minecraft/block/BlockNote.java.patch | 23 + .../minecraft/block/BlockOldLeaf.java.patch | 21 + .../net/minecraft/block/BlockOre.java.patch | 51 + .../net/minecraft/block/BlockPane.java.patch | 41 + .../block/BlockPistonBase.java.patch | 31 + .../block/BlockPistonMoving.java.patch | 37 + .../minecraft/block/BlockPotato.java.patch | 25 + .../minecraft/block/BlockPumpkin.java.patch | 11 + .../minecraft/block/BlockQuartz.java.patch | 29 + .../minecraft/block/BlockRailBase.java.patch | 147 ++ .../block/BlockRedstoneComparator.java.patch | 24 + .../block/BlockRedstoneDiode.java.patch | 11 + .../block/BlockRedstoneOre.java.patch | 22 + .../block/BlockRedstoneWire.java.patch | 59 + .../net/minecraft/block/BlockReed.java.patch | 35 + .../block/BlockRotatedPillar.java.patch | 21 + .../minecraft/block/BlockSapling.java.patch | 10 + .../net/minecraft/block/BlockSkull.java.patch | 57 + .../net/minecraft/block/BlockSlab.java.patch | 38 + .../net/minecraft/block/BlockSnow.java.patch | 53 + .../minecraft/block/BlockStairs.java.patch | 22 + .../net/minecraft/block/BlockStem.java.patch | 42 + .../minecraft/block/BlockTallGrass.java.patch | 66 + .../net/minecraft/block/BlockTorch.java.patch | 38 + .../minecraft/block/BlockTrapDoor.java.patch | 43 + .../block/BlockTripWireHook.java.patch | 28 + .../net/minecraft/block/BlockVine.java.patch | 40 + .../BlockPistonStructureHelper.java.patch | 29 + .../block/state/BlockState.java.patch | 53 + .../block/state/BlockStateBase.java.patch | 12 + .../client/ClientBrandRetriever.java.patch | 10 + .../client/LoadingScreenRenderer.java.patch | 26 + .../net/minecraft/client/Minecraft.java.patch | 459 ++++++ .../client/audio/SoundManager.java.patch | 41 + .../entity/AbstractClientPlayer.java.patch | 10 + .../client/entity/EntityPlayerSP.java.patch | 71 + .../client/gui/FontRenderer.java.patch | 156 ++ .../minecraft/client/gui/GuiButton.java.patch | 22 + .../minecraft/client/gui/GuiChat.java.patch | 39 + .../client/gui/GuiCreateWorld.java.patch | 36 + .../client/gui/GuiIngameMenu.java.patch | 33 + .../client/gui/GuiMainMenu.java.patch | 42 + .../client/gui/GuiMultiplayer.java.patch | 19 + .../client/gui/GuiOverlayDebug.java.patch | 12 + .../minecraft/client/gui/GuiScreen.java.patch | 107 ++ .../client/gui/GuiSelectWorld.java.patch | 11 + .../client/gui/GuiSleepMP.java.patch | 11 + .../minecraft/client/gui/GuiSlot.java.patch | 39 + .../gui/GuiUtilRenderComponents.java.patch | 10 + .../gui/ServerListEntryNormal.java.patch | 23 + .../achievement/GuiAchievements.java.patch | 117 ++ .../gui/achievement/GuiStats.java.patch | 69 + .../gui/inventory/GuiContainer.java.patch | 70 + .../inventory/GuiContainerCreative.java.patch | 265 ++++ .../client/model/ModelBase.java.patch | 10 + .../client/model/ModelBox.java.patch | 18 + .../client/model/ModelRenderer.java.patch | 42 + .../model/PositionTextureVertex.java.patch | 13 + .../client/model/TexturedQuad.java.patch | 13 + .../ChunkProviderClient.java.patch | 10 + .../multiplayer/GuiConnecting.java.patch | 11 + .../multiplayer/PlayerControllerMP.java.patch | 87 ++ .../client/multiplayer/WorldClient.java.patch | 17 + .../NetHandlerHandshakeMemory.java.patch | 10 + .../network/NetHandlerLoginClient.java.patch | 14 + .../network/NetHandlerPlayClient.java.patch | 62 + .../client/network/OldServerPinger.java.patch | 10 + .../client/particle/EffectRenderer.java.patch | 33 + .../renderer/BlockModelRenderer.java.patch | 24 + .../renderer/BlockModelShapes.java.patch | 9 + .../BlockRendererDispatcher.java.patch | 49 + .../client/renderer/EntityRenderer.java.patch | 192 +++ .../InventoryEffectRenderer.java.patch | 33 + .../renderer/ItemModelMesher.java.patch | 14 + .../client/renderer/ItemRenderer.java.patch | 60 + .../client/renderer/OpenGlHelper.java.patch | 26 + .../client/renderer/RenderGlobal.java.patch | 152 ++ .../client/renderer/WorldRenderer.java.patch | 41 + .../WorldVertexBufferUploader.java.patch | 66 + .../renderer/block/model/BakedQuad.java.patch | 13 + .../block/model/FaceBakery.java.patch | 68 + .../model/ItemCameraTransforms.java.patch | 23 + .../block/model/ItemTransformVec3f.java.patch | 18 + .../model/ModelBlockDefinition.java.patch | 29 + .../block/statemap/StateMap.java.patch | 11 + .../renderer/chunk/RenderChunk.java.patch | 68 + .../entity/RenderEntityItem.java.patch | 74 + .../renderer/entity/RenderItem.java.patch | 90 ++ .../renderer/entity/RenderManager.java.patch | 27 + .../renderer/entity/RenderPlayer.java.patch | 18 + .../renderer/entity/RenderVillager.java.patch | 11 + .../entity/RendererLivingEntity.java.patch | 64 + .../entity/layers/LayerArmorBase.java.patch | 107 ++ .../entity/layers/LayerBipedArmor.java.patch | 13 + .../renderer/texture/Stitcher.java.patch | 37 + .../texture/TextureAtlasSprite.java.patch | 33 + .../texture/TextureManager.java.patch | 15 + .../renderer/texture/TextureMap.java.patch | 186 +++ .../renderer/texture/TextureUtil.java.patch | 15 + .../tileentity/RenderItemFrame.java.patch | 31 + .../TileEntityItemStackRenderer.java.patch | 10 + .../TileEntityPistonRenderer.java.patch | 15 + .../TileEntityRendererDispatcher.java.patch | 79 + .../TileEntitySpecialRenderer.java.patch | 9 + .../vertex/VertexFormatElement.java.patch | 21 + .../resources/AbstractResourcePack.java.patch | 11 + .../FallbackResourceManager.java.patch | 10 + .../resources/LanguageManager.java.patch | 10 + .../client/resources/Locale.java.patch | 11 + ...SimpleReloadableResourceManager.java.patch | 43 + .../resources/model/IBakedModel.java.patch | 9 + .../resources/model/ModelBakery.java.patch | 124 ++ .../resources/model/ModelManager.java.patch | 14 + .../resources/model/ModelRotation.java.patch | 21 + .../client/settings/GameSettings.java.patch | 10 + .../client/shader/Framebuffer.java.patch | 57 + .../minecraft/command/CommandBase.java.patch | 11 + .../command/CommandEnchant.java.patch | 11 + .../minecraft/command/CommandFill.java.patch | 28 + .../command/CommandHandler.java.patch | 28 + .../command/PlayerSelector.java.patch | 14 + .../command/server/CommandSetBlock.java.patch | 20 + .../server/CommandTestForBlock.java.patch | 11 + .../minecraft/crash/CrashReport.java.patch | 19 + .../crash/CrashReportCategory.java.patch | 16 + .../creativetab/CreativeTabs.java.patch | 106 ++ .../enchantment/Enchantment.java.patch | 66 + .../enchantment/EnchantmentHelper.java.patch | 41 + .../net/minecraft/entity/Entity.java.patch | 356 +++++ .../minecraft/entity/EntityAgeable.java.patch | 11 + .../minecraft/entity/EntityHanging.java.patch | 12 + .../minecraft/entity/EntityList.java.patch | 68 + .../minecraft/entity/EntityLiving.java.patch | 41 + .../entity/EntityLivingBase.java.patch | 220 +++ .../EntityMinecartCommandBlock.java.patch | 10 + .../EntitySpawnPlacementRegistry.java.patch | 15 + .../minecraft/entity/EntityTracker.java.patch | 35 + .../entity/EntityTrackerEntry.java.patch | 42 + .../ai/EntityAIAttackOnCollide.java.patch | 55 + .../entity/boss/EntityDragon.java.patch | 14 + .../entity/boss/EntityWither.java.patch | 11 + .../entity/boss/IBossDisplayData.java.patch | 10 + .../effect/EntityLightningBolt.java.patch | 12 + .../entity/item/EntityEnderPearl.java.patch | 25 + .../entity/item/EntityItem.java.patch | 114 ++ .../entity/item/EntityItemFrame.java.patch | 11 + .../entity/item/EntityMinecart.java.patch | 454 ++++++ .../item/EntityMinecartContainer.java.patch | 33 + .../item/EntityMinecartEmpty.java.patch | 10 + .../item/EntityMinecartFurnace.java.patch | 10 + .../item/EntityMinecartHopper.java.patch | 10 + .../entity/item/EntityXPOrb.java.patch | 10 + .../entity/monster/EntityEnderman.java.patch | 39 + .../entity/monster/EntityMagmaCube.java.patch | 10 + .../entity/monster/EntitySlime.java.patch | 35 + .../entity/monster/EntityZombie.java.patch | 60 + .../entity/passive/EntityHorse.java.patch | 10 + .../entity/passive/EntityMooshroom.java.patch | 62 + .../entity/passive/EntityOcelot.java.patch | 11 + .../entity/passive/EntitySheep.java.patch | 45 + .../entity/passive/EntityVillager.java.patch | 44 + .../entity/player/EntityPlayer.java.patch | 635 ++++++++ .../entity/player/EntityPlayerMP.java.patch | 90 ++ .../entity/player/InventoryPlayer.java.patch | 32 + .../projectile/EntityFishHook.java.patch | 22 + .../net/minecraft/init/Bootstrap.java.patch | 19 + .../minecraft/inventory/Container.java.patch | 11 + .../inventory/ContainerBeacon.java.patch | 11 + .../ContainerBrewingStand.java.patch | 29 + .../inventory/ContainerEnchantment.java.patch | 77 + .../inventory/ContainerPlayer.java.patch | 12 + .../inventory/ContainerRepair.java.patch | 47 + .../net/minecraft/inventory/Slot.java.patch | 75 + .../inventory/SlotCrafting.java.patch | 14 + .../inventory/SlotFurnaceOutput.java.patch | 11 + .../net/minecraft/item/Item.java.patch | 779 ++++++++++ .../net/minecraft/item/ItemArmor.java.patch | 47 + .../net/minecraft/item/ItemBlock.java.patch | 56 + .../net/minecraft/item/ItemBow.java.patch | 22 + .../net/minecraft/item/ItemBucket.java.patch | 12 + .../minecraft/item/ItemBucketMilk.java.patch | 11 + .../net/minecraft/item/ItemDye.java.patch | 56 + .../minecraft/item/ItemEmptyMap.java.patch | 11 + .../item/ItemFlintAndSteel.java.patch | 11 + .../net/minecraft/item/ItemHoe.java.patch | 17 + .../net/minecraft/item/ItemLilyPad.java.patch | 17 + .../net/minecraft/item/ItemMap.java.patch | 11 + .../item/ItemMonsterPlacer.java.patch | 113 ++ .../net/minecraft/item/ItemRecord.java.patch | 18 + .../minecraft/item/ItemSeedFood.java.patch | 37 + .../net/minecraft/item/ItemSeeds.java.patch | 37 + .../net/minecraft/item/ItemShears.java.patch | 89 ++ .../net/minecraft/item/ItemSkull.java.patch | 31 + .../net/minecraft/item/ItemSnow.java.patch | 13 + .../net/minecraft/item/ItemStack.java.patch | 237 +++ .../net/minecraft/item/ItemSword.java.patch | 13 + .../net/minecraft/item/ItemTool.java.patch | 71 + .../item/crafting/FurnaceRecipes.java.patch | 20 + .../item/crafting/RecipeFireworks.java.patch | 37 + .../item/crafting/RecipeRepairItem.java.patch | 42 + .../item/crafting/RecipesArmorDyes.java.patch | 15 + .../item/crafting/RecipesBanners.java.patch | 27 + .../crafting/RecipesMapCloning.java.patch | 15 + .../item/crafting/ShapedRecipes.java.patch | 15 + .../item/crafting/ShapelessRecipes.java.patch | 15 + .../nbt/CompressedStreamTools.java.patch | 53 + .../minecraft/nbt/NBTSizeTracker.java.patch | 37 + .../minecraft/nbt/NBTTagCompound.java.patch | 18 + .../net/minecraft/nbt/NBTTagString.java.patch | 11 + .../network/NetHandlerPlayServer.java.patch | 133 ++ .../network/NetworkManager.java.patch | 53 + .../network/NetworkSystem.java.patch | 11 + .../network/ServerStatusResponse.java.patch | 88 ++ .../handshake/client/C00Handshake.java.patch | 48 + .../client/C17PacketCustomPayload.java.patch | 14 + .../server/S3FPacketCustomPayload.java.patch | 14 + .../server/S00PacketServerInfo.java.patch | 11 + .../net/minecraft/potion/Potion.java.patch | 88 ++ .../minecraft/potion/PotionEffect.java.patch | 91 ++ .../minecraft/realms/RealmsConnect.java.patch | 19 + .../server/MinecraftServer.java.patch | 289 ++++ .../dedicated/DedicatedServer.java.patch | 60 + .../dedicated/ServerHangWatchdog.java.patch | 28 + .../server/gui/MinecraftServerGui.java.patch | 24 + .../integrated/IntegratedServer.java.patch | 88 ++ .../management/ItemInWorldManager.java.patch | 266 ++++ .../management/PlayerManager.java.patch | 220 +++ .../ServerConfigurationManager.java.patch | 223 +++ .../network/NetHandlerHandshakeTCP.java.patch | 11 + .../network/NetHandlerLoginServer.java.patch | 26 + .../net/minecraft/stats/StatList.java.patch | 92 ++ .../tileentity/TileEntity.java.patch | 251 ++++ .../tileentity/TileEntityBeacon.java.patch | 20 + .../TileEntityBrewingStand.java.patch | 97 ++ .../tileentity/TileEntityChest.java.patch | 35 + .../tileentity/TileEntityFurnace.java.patch | 99 ++ .../tileentity/TileEntityHopper.java.patch | 62 + .../tileentity/TileEntityLockable.java.patch | 28 + .../tileentity/TileEntityNote.java.patch | 12 + .../tileentity/TileEntityPiston.java.patch | 22 + .../tileentity/TileEntitySign.java.patch | 11 + .../net/minecraft/util/BlockPos.java.patch | 32 + .../util/ChatComponentStyle.java.patch | 10 + .../net/minecraft/util/ChatStyle.java.patch | 10 + .../net/minecraft/util/EnumFacing.java.patch | 67 + .../util/EnumWorldBlockLayer.java.patch | 12 + .../minecraft/util/IChatComponent.java.patch | 10 + .../net/minecraft/util/MouseHelper.java.patch | 10 + .../util/MovingObjectPosition.java.patch | 15 + .../util/ResourceLocation.java.patch | 26 + .../net/minecraft/util/Session.java.patch | 72 + .../minecraft/util/StringTranslate.java.patch | 54 + .../net/minecraft/util/Vec3.java.patch | 35 + .../WeightedRandomChestContent.java.patch | 68 + .../net/minecraft/world/ChunkCache.java.patch | 54 + .../net/minecraft/world/Explosion.java.patch | 52 + .../minecraft/world/IBlockAccess.java.patch | 17 + .../minecraft/world/SpawnerAnimals.java.patch | 51 + .../net/minecraft/world/World.java.patch | 909 +++++++++++ .../minecraft/world/WorldProvider.java.patch | 383 +++++ .../minecraft/world/WorldServer.java.patch | 265 ++++ .../world/WorldServerMulti.java.patch | 60 + .../net/minecraft/world/WorldType.java.patch | 155 ++ .../world/biome/BiomeColorHelper.java.patch | 11 + .../world/biome/BiomeDecorator.java.patch | 169 +++ .../world/biome/BiomeGenBase.java.patch | 138 ++ .../world/biome/BiomeGenForest.java.patch | 23 + .../world/biome/BiomeGenHills.java.patch | 62 + .../world/biome/BiomeGenJungle.java.patch | 13 + .../world/biome/BiomeGenPlains.java.patch | 22 + .../world/biome/BiomeGenSwamp.java.patch | 13 + .../world/biome/WorldChunkManager.java.patch | 45 + .../world/border/WorldBorder.java.patch | 12 + .../minecraft/world/chunk/Chunk.java.patch | 265 ++++ .../chunk/storage/AnvilChunkLoader.java.patch | 162 ++ .../chunk/storage/AnvilSaveHandler.java.patch | 23 + .../storage/ExtendedBlockStorage.java.patch | 11 + .../world/chunk/storage/RegionFile.java.patch | 42 + .../world/gen/ChunkProviderEnd.java.patch | 67 + .../gen/ChunkProviderGenerate.java.patch | 110 ++ .../world/gen/ChunkProviderHell.java.patch | 141 ++ .../world/gen/ChunkProviderServer.java.patch | 125 ++ .../world/gen/MapGenCaves.java.patch | 119 ++ .../world/gen/MapGenRavine.java.patch | 111 ++ .../feature/WorldGenAbstractTree.java.patch | 13 + .../feature/WorldGenBigMushroom.java.patch | 33 + .../gen/feature/WorldGenBigTree.java.patch | 52 + .../gen/feature/WorldGenCanopyTree.java.patch | 71 + .../gen/feature/WorldGenDeadBush.java.patch | 17 + .../gen/feature/WorldGenDungeons.java.patch | 30 + .../gen/feature/WorldGenForest.java.patch | 50 + .../gen/feature/WorldGenHugeTrees.java.patch | 66 + .../gen/feature/WorldGenMegaJungle.java.patch | 50 + .../feature/WorldGenMegaPineTree.java.patch | 63 + .../gen/feature/WorldGenMinable.java.patch | 11 + .../feature/WorldGenSavannaTree.java.patch | 64 + .../gen/feature/WorldGenShrub.java.patch | 31 + .../gen/feature/WorldGenSwamp.java.patch | 94 ++ .../gen/feature/WorldGenTaiga1.java.patch | 50 + .../gen/feature/WorldGenTaiga2.java.patch | 50 + .../gen/feature/WorldGenTallGrass.java.patch | 17 + .../gen/feature/WorldGenTrees.java.patch | 94 ++ .../WorldGeneratorBonusChest.java.patch | 17 + .../world/gen/layer/GenLayer.java.patch | 55 + .../world/gen/layer/GenLayerBiome.java.patch | 94 ++ ...ComponentScatteredFeaturePieces.java.patch | 79 + .../gen/structure/MapGenStronghold.java.patch | 22 + .../gen/structure/MapGenStructure.java.patch | 17 + .../structure/StructureComponent.java.patch | 13 + .../StructureMineshaftPieces.java.patch | 33 + .../StructureNetherBridgePieces.java.patch | 28 + .../gen/structure/StructureStart.java.patch | 23 + .../StructureStrongholdPieces.java.patch | 75 + .../StructureVillagePieces.java.patch | 84 ++ .../world/storage/MapData.java.patch | 48 + .../world/storage/SaveHandler.java.patch | 105 ++ .../world/storage/WorldInfo.java.patch | 35 + src/main/resources/forge_at.cfg | 92 +- 350 files changed, 21753 insertions(+), 52 deletions(-) create mode 100644 jsons/1.9-dev.json create mode 100644 jsons/1.9-rel.json create mode 100644 jsons/1.9.json create mode 100644 patches.mcp/minecraft/net/minecraft/block/Block.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockDropper.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/state/BlockState.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/network/OldServerPinger.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/command/CommandBase.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/command/PlayerSelector.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityAgeable.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/Item.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/BlockPos.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/ChatComponentStyle.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/ChatStyle.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/IChatComponent.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/MovingObjectPosition.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/ResourceLocation.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/Session.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/StringTranslate.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/Vec3.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/SpawnerAnimals.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/World.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch diff --git a/build.gradle b/build.gradle index 64c092506b..cf8043dae8 100644 --- a/build.gradle +++ b/build.gradle @@ -26,11 +26,11 @@ apply plugin: "net.minecraftforge.gradle.patcher" apply plugin: "net.minecraftforge.gradle.launch4j" minecraft { - version = "1.8.9" + version = "1.9" mappings = 'stable_20' //mappings = "snapshot_nodoc_20151122" workspaceDir = "projects" - versionJson = "jsons/1.8.9-dev.json" + versionJson = "jsons/1.9-dev.json" buildUserdev = true buildInstaller = true installerVersion = "1.4" @@ -47,11 +47,11 @@ minecraft { projects { forge { rootDir "." - patchDir "patches/minecraft" + patchDir "patches.mcp/minecraft" patchAfter "clean" genPatchesFrom "clean" - genMcpPatches = false - applyMcpPatches = false + genMcpPatches = true + applyMcpPatches = true with common } } @@ -66,7 +66,7 @@ extractForgeResources { exclude "**/log4j2.xml" } genGradleProjects { addTestCompileDep "junit:junit:4.12" } processJson { - releaseJson = "jsons/1.8.9-rel.json" + releaseJson = "jsons/1.9-rel.json" addReplacements([ "@minecraft_version@": project.minecraft.version, "@version@": project.version, diff --git a/jsons/1.9-dev.json b/jsons/1.9-dev.json new file mode 100644 index 0000000000..bcca6f1593 --- /dev/null +++ b/jsons/1.9-dev.json @@ -0,0 +1,95 @@ +{ + "id": "@minecraft_version@-@project@@version@", + "time": "@timestamp@", + "releaseTime": "1960-01-01T00:00:00-0700", + "type": "release", + "inheritsFrom": "1.9", + "minecraftArguments": "--version FML_DEV --tweakClass net.minecraftforge.fml.common.launcher.FMLTweaker", + "libraries": [ + { + "name": "net.minecraft:launchwrapper:1.12" + }, + { + "name": "jline:jline:2.13", + "children": ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "com.google.code.findbugs:jsr305:1.3.9", + "children": ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.ow2.asm:asm-debug-all:5.0.3", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "com.typesafe.akka:akka-actor_2.11:2.3.3", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "com.typesafe:config:1.2.1", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang:scala-actors-migration_2.11:1.1.0", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang:scala-compiler:2.11.1", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang.plugins:scala-continuations-library_2.11:1.0.2", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang.plugins:scala-continuations-plugin_2.11.1:1.0.2", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang:scala-library:2.11.1", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang.modules:scala-parser-combinators_2.11:1.0.1", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang:scala-reflect:2.11.1", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang.modules:scala-swing_2.11:1.0.1", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang.modules:scala-xml_2.11:1.0.2", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "lzma:lzma:0.0.1" + }, + { + "name": "java3d:vecmath:1.5.2" + }, + { + "name": "net.sf.trove4j:trove4j:3.0.3" + } + ], + "mainClass": "net.minecraft.launchwrapper.Launch", + "minimumLauncherVersion": 14, + "assets": "1.8" +} diff --git a/jsons/1.9-rel.json b/jsons/1.9-rel.json new file mode 100644 index 0000000000..33e0246407 --- /dev/null +++ b/jsons/1.9-rel.json @@ -0,0 +1,146 @@ +{ +"install": { + "profileName": "@project@", + "target":"@minecraft_version@-@project@@version@", + "path":"@artifact@", + "version":"@project@ @version@", + "filePath":"@universal_jar@", + "welcome":"Welcome to the simple @project@ installer.", + "minecraft":"@minecraft_version@", + "mirrorList" : "http://files.minecraftforge.net/mirror-brand.list", + "logo":"/big_logo.png" +}, +"versionInfo": { + "id": "@minecraft_version@-@project@@version@", + "time": "@timestamp@", + "releaseTime": "1960-01-01T00:00:00-0700", + "type": "release", + "minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type} --tweakClass net.minecraftforge.fml.common.launcher.FMLTweaker", + "mainClass": "net.minecraft.launchwrapper.Launch", + "minimumLauncherVersion": 14, + "assets": "1.8", + "inheritsFrom": "1.8.9", + "jar": "1.8.9", + "libraries": [ + { + "name": "@artifact@", + "url": "http://files.minecraftforge.net/maven/" + }, + { + "comment": "Force the downgrade on dedicated server to match client. Netty bug: https://github.com/MinecraftForge/MinecraftForge/issues/1848", + "name": "io.netty:netty-all:4.0.23.Final", + "serverreq":true + }, + { + "name": "net.minecraft:launchwrapper:1.12", + "serverreq":true + }, + { + "name": "org.ow2.asm:asm-all:5.0.3", + "serverreq":true + }, + { + "name": "jline:jline:2.13", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "2d9530d0a25daffaffda7c35037b046b627bb171" ], + "serverreq":true, + "clientreq":false + }, + { + "name": "com.typesafe.akka:akka-actor_2.11:2.3.3", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "ed62e9fc709ca0f2ff1a3220daa8b70a2870078e", "25a86ccfdb6f6dfe08971f4825d0a01be83a6f2e" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "com.typesafe:config:1.2.1", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "f771f71fdae3df231bcd54d5ca2d57f0bf93f467", "7d7bc36df0989d72f2d5d057309675777acc528b" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang:scala-actors-migration_2.11:1.1.0", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "dfa8bc42b181d5b9f1a5dd147f8ae308b893eb6f", "8c9aaeeb68487ca519411a14068e1b4d69739207" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang:scala-compiler:2.11.1", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "56ea2e6c025e0821f28d73ca271218b8dd04926a", "1444992390544ba3780867a13ff696a89d7d1639" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang.plugins:scala-continuations-library_2.11:1.0.2", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "87213338cd5a153a7712cb574c0ddd2edfee0386", "0b4c1bf8d48993f138d6e10c0c144e50acfff581" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang.plugins:scala-continuations-plugin_2.11.1:1.0.2", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "1f7371605d4ba42aa26d3443440c0083c587b4e9", "1ea655dda4504ae0a367327e2340cd3beaee6c73" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang:scala-library:2.11.1", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "0e11da23da3eabab9f4777b9220e60d44c1aab6a", "1e4df76e835201c6eabd43adca89ab11f225f134" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang:scala-parser-combinators_2.11:1.0.1", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "f05d7345bf5a58924f2837c6c1f4d73a938e1ff0", "a1cbbcbde1dcc614f4253ed1aa0b320bc78d8f1d" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang:scala-reflect:2.11.1", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "6580347e61cc7f8e802941e7fde40fa83b8badeb", "91ce0f0be20f4a536321724b4b3bbc6530ddcd88" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang:scala-swing_2.11:1.0.1", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "b1cdd92bd47b1e1837139c1c53020e86bb9112ae", "d77152691dcf5bbdb00529af37aa7d3d887b3e63" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang:scala-xml_2.11:1.0.2", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "7a80ec00aec122fba7cd4e0d4cdd87ff7e4cb6d0", "62736b01689d56b6d09a0164b7ef9da2b0b9633d" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "lzma:lzma:0.0.1", + "serverreq":true + }, + { + "name": "net.sf.jopt-simple:jopt-simple:4.6", + "serverreq":true + }, + { + "name": "java3d:vecmath:1.5.2", + "clientreq":true, + "serverreq":true + }, + { + "name": "net.sf.trove4j:trove4j:3.0.3", + "clientreq":true, + "serverreq":true + } + ] +} +} diff --git a/jsons/1.9.json b/jsons/1.9.json new file mode 100644 index 0000000000..f366dbe213 --- /dev/null +++ b/jsons/1.9.json @@ -0,0 +1,218 @@ +{ + "id": "1.9", + "time": "2016-02-29T08:50:46-05:00", + "releaseTime": "2016-02-29T08:49:54-05:00", + "type": "release", + "minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userType ${user_type} --versionType ${version_type}", + "libraries": [ + { + "name": "oshi-project:oshi-core:1.1" + }, + { + "name": "net.java.dev.jna:jna:3.4.0" + }, + { + "name": "net.java.dev.jna:platform:3.4.0" + }, + { + "name": "com.ibm.icu:icu4j-core-mojang:51.2" + }, + { + "name": "net.sf.jopt-simple:jopt-simple:4.6" + }, + { + "name": "com.paulscode:codecjorbis:20101023" + }, + { + "name": "com.paulscode:codecwav:20101023" + }, + { + "name": "com.paulscode:libraryjavasound:20101123" + }, + { + "name": "com.paulscode:librarylwjglopenal:20100824" + }, + { + "name": "com.paulscode:soundsystem:20120107" + }, + { + "name": "io.netty:netty-all:4.0.23.Final" + }, + { + "name": "com.google.guava:guava:17.0" + }, + { + "name": "org.apache.commons:commons-lang3:3.3.2" + }, + { + "name": "commons-io:commons-io:2.4" + }, + { + "name": "commons-codec:commons-codec:1.9" + }, + { + "name": "net.java.jinput:jinput:2.0.5" + }, + { + "name": "net.java.jutils:jutils:1.0.0" + }, + { + "name": "com.google.code.gson:gson:2.2.4" + }, + { + "name": "com.mojang:authlib:1.5.22" + }, + { + "name": "com.mojang:realms:1.8.3" + }, + { + "name": "org.apache.commons:commons-compress:1.8.1" + }, + { + "name": "org.apache.httpcomponents:httpclient:4.3.3" + }, + { + "name": "commons-logging:commons-logging:1.1.3" + }, + { + "name": "org.apache.httpcomponents:httpcore:4.3.2" + }, + { + "name": "org.apache.logging.log4j:log4j-api:2.0-beta9" + }, + { + "name": "org.apache.logging.log4j:log4j-core:2.0-beta9" + }, + { + "name": "org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209", + "rules": [ + { + "action": "allow" + }, + { + "action": "disallow", + "os": { + "name": "osx" + } + } + ] + }, + { + "name": "org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209", + "rules": [ + { + "action": "allow" + }, + { + "action": "disallow", + "os": { + "name": "osx" + } + } + ] + }, + { + "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209", + "rules": [ + { + "action": "allow" + }, + { + "action": "disallow", + "os": { + "name": "osx" + } + } + ], + "natives": { + "linux": "natives-linux", + "osx": "natives-osx", + "windows": "natives-windows" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + }, + { + "name": "org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-20140822", + "rules": [ + { + "action": "allow", + "os": { + "name": "osx" + } + } + ] + }, + { + "name": "org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-20140822", + "rules": [ + { + "action": "allow", + "os": { + "name": "osx" + } + } + ] + }, + { + "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.2-nightly-20140822", + "rules": [ + { + "action": "allow", + "os": { + "name": "osx" + } + } + ], + "natives": { + "linux": "natives-linux", + "osx": "natives-osx", + "windows": "natives-windows" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + }, + { + "name": "net.java.jinput:jinput-platform:2.0.5", + "natives": { + "linux": "natives-linux", + "osx": "natives-osx", + "windows": "natives-windows" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + } + ], + "mainClass": "net.minecraft.client.main.Main", + "minimumLauncherVersion": 18, + "assets": "1.9", + "downloads": { + "client": { + "url": "https://launcher.mojang.com/mc/game/1.9/client/2f67dfe8953299440d1902f9124f0f2c3a2c940f/client.jar", + "sha1": "2f67dfe8953299440d1902f9124f0f2c3a2c940f", + "size": 8697592 + }, + "server": { + "url": "https://launcher.mojang.com/mc/game/1.9/server/b4d449cf2918e0f3bd8aa18954b916a4d1880f0d/server.jar", + "sha1": "b4d449cf2918e0f3bd8aa18954b916a4d1880f0d", + "size": 8848015 + } + }, + "assetIndex": { + "totalSize": 119917473, + "id": "1.9", + "known": true, + "url": "https://launchermeta.mojang.com/mc-staging/assets/1.9/cde65b47a43f638653ab1da3848b53f8a7477b16/1.9.json", + "sha1": "cde65b47a43f638653ab1da3848b53f8a7477b16", + "size": 136916 + } +} \ No newline at end of file diff --git a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch new file mode 100644 index 0000000000..c62a56071d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch @@ -0,0 +1,1338 @@ +--- ../src-base/minecraft/net/minecraft/block/Block.java ++++ ../src-work/minecraft/net/minecraft/block/Block.java +@@ -38,8 +38,9 @@ + public class Block + { + private static final ResourceLocation AIR_ID = new ResourceLocation("air"); +- public static final RegistryNamespacedDefaultedByKey blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID); +- public static final ObjectIntIdentityMap BLOCK_STATE_IDS = new ObjectIntIdentityMap(); ++ public static final RegistryNamespacedDefaultedByKey blockRegistry = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); ++ @Deprecated //Modders: DO NOT use this! Use GameRegistry ++ public static final ObjectIntIdentityMap BLOCK_STATE_IDS = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); + private CreativeTabs displayOnCreativeTab; + public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F); + public static final Block.SoundType soundTypeWood = new Block.SoundType("wood", 1.0F, 1.0F); +@@ -119,6 +120,9 @@ + private IBlockState defaultBlockState; + private String unlocalizedName; + ++ public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = ++ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)blockRegistry).getDelegate(this, Block.class); ++ + public static int getIdFromBlock(Block blockIn) + { + return blockRegistry.getIDForObject(blockIn); +@@ -132,7 +136,8 @@ + + public static Block getBlockById(int id) + { +- return (Block)blockRegistry.getObjectById(id); ++ Block ret = (Block)blockRegistry.getObjectById(id); ++ return ret == null ? net.minecraft.init.Blocks.air : ret; + } + + public static IBlockState getStateById(int id) +@@ -303,7 +308,7 @@ + + public boolean isReplaceable(World worldIn, BlockPos pos) + { +- return false; ++ return getMaterial().isReplaceable(); + } + + public Block setHardness(float hardness) +@@ -340,9 +345,10 @@ + return this.needsRandomTick; + } + ++ @Deprecated //Forge: New State sensitive version. + public boolean hasTileEntity() + { +- return this.isBlockContainer; ++ return hasTileEntity(getDefaultState()); + } + + public final void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) +@@ -359,13 +365,13 @@ + public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos).getBlock(); +- int i = worldIn.getCombinedLight(pos, block.getLightValue()); ++ int i = worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); + + if (i == 0 && block instanceof BlockSlab) + { + pos = pos.down(); + block = worldIn.getBlockState(pos).getBlock(); +- return worldIn.getCombinedLight(pos, block.getLightValue()); ++ return worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); + } + else + { +@@ -376,7 +382,7 @@ + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { +- return side == EnumFacing.DOWN && this.minY > 0.0D ? true : (side == EnumFacing.UP && this.maxY < 1.0D ? true : (side == EnumFacing.NORTH && this.minZ > 0.0D ? true : (side == EnumFacing.SOUTH && this.maxZ < 1.0D ? true : (side == EnumFacing.WEST && this.minX > 0.0D ? true : (side == EnumFacing.EAST && this.maxX < 1.0D ? true : !worldIn.getBlockState(pos).getBlock().isOpaqueCube()))))); ++ return side == EnumFacing.DOWN && this.minY > 0.0D ? true : (side == EnumFacing.UP && this.maxY < 1.0D ? true : (side == EnumFacing.NORTH && this.minZ > 0.0D ? true : (side == EnumFacing.SOUTH && this.maxZ < 1.0D ? true : (side == EnumFacing.WEST && this.minX > 0.0D ? true : (side == EnumFacing.EAST && this.maxX < 1.0D ? true : !worldIn.getBlockState(pos).getBlock().doesSideBlockRendering(worldIn, pos, side)))))); + } + + public boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side) +@@ -453,6 +459,10 @@ + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { ++ if (hasTileEntity(state) && !(this instanceof BlockContainer)) ++ { ++ worldIn.removeTileEntity(pos); ++ } + } + + public int quantityDropped(Random random) +@@ -467,8 +477,7 @@ + + public float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos) + { +- float f = this.getBlockHardness(worldIn, pos); +- return f < 0.0F ? 0.0F : (!playerIn.canHarvestBlock(this) ? playerIn.getToolDigEfficiency(this) / f / 100.0F : playerIn.getToolDigEfficiency(this) / f / 30.0F); ++ return net.minecraftforge.common.ForgeHooks.blockStrength(worldIn.getBlockState(pos), playerIn, worldIn, pos); + } + + public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture) +@@ -478,20 +487,16 @@ + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) ++ if (!worldIn.isRemote && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe + { +- int i = this.quantityDroppedWithBonus(fortune, worldIn.rand); ++ java.util.List items = getDrops(worldIn, pos, state, fortune); ++ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, fortune, chance, false, harvesters.get()); + +- for (int j = 0; j < i; ++j) ++ for (ItemStack item : items) + { + if (worldIn.rand.nextFloat() <= chance) + { +- Item item = this.getItemDropped(state, worldIn.rand, fortune); +- +- if (item != null) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); +- } ++ spawnAsEntity(worldIn, pos, item); + } + } + } +@@ -499,8 +504,13 @@ + + public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) + { +- if (!worldIn.isRemote && worldIn.getGameRules().getBoolean("doTileDrops")) ++ if (!worldIn.isRemote && worldIn.getGameRules().getBoolean("doTileDrops") && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe + { ++ if (captureDrops.get()) ++ { ++ capturedDrops.get().add(stack); ++ return; ++ } + float f = 0.5F; + double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; +@@ -687,7 +697,7 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable(); ++ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) +@@ -799,25 +809,35 @@ + player.triggerAchievement(StatList.mineBlockStatArray[getIdFromBlock(this)]); + player.addExhaustion(0.025F); + +- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) ++ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) + { ++ java.util.ArrayList items = new java.util.ArrayList(); + ItemStack itemstack = this.createStackedBlock(state); + + if (itemstack != null) + { +- spawnAsEntity(worldIn, pos, itemstack); ++ items.add(itemstack); + } ++ ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); ++ for (ItemStack stack : items) ++ { ++ spawnAsEntity(worldIn, pos, stack); ++ } + } + else + { ++ harvesters.set(player); + int i = EnchantmentHelper.getFortuneModifier(player); + this.dropBlockAsItem(worldIn, pos, state, i); ++ harvesters.set(null); + } + } + ++ @Deprecated //Forge: State sensitive version + protected boolean canSilkHarvest() + { +- return this.isFullCube() && !this.isBlockContainer; ++ return this.isFullCube() && !this.hasTileEntity(silk_check_state.get()); + } + + protected ItemStack createStackedBlock(IBlockState state) +@@ -1010,6 +1030,1147 @@ + return "Block{" + blockRegistry.getNameForObject(this) + "}"; + } + ++ /* ======================================== FORGE START =====================================*/ ++ //For ForgeInternal use Only! ++ protected ThreadLocal harvesters = new ThreadLocal(); ++ private ThreadLocal silk_check_state = new ThreadLocal(); ++ protected static java.util.Random RANDOM = new java.util.Random(); // Useful for random things without a seed. ++ /** ++ * Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15 ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return The light value ++ */ ++ public int getLightValue(IBlockAccess world, BlockPos pos) ++ { ++ Block block = world.getBlockState(pos).getBlock(); ++ if (block != this) ++ { ++ return block.getLightValue(world, pos); ++ } ++ return getLightValue(); ++ } ++ ++ /** ++ * Checks if a player or entity can use this block to 'climb' like a ladder. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param entity The entity trying to use the ladder, CAN be null. ++ * @return True if the block should act like a ladder ++ */ ++ public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return false; } ++ ++ /** ++ * Return true if the block is a normal, solid cube. This ++ * determines indirect power state, entity ejection from blocks, and a few ++ * others. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return True if the block is a full cube ++ */ ++ public boolean isNormalCube(IBlockAccess world, BlockPos pos) ++ { ++ return getMaterial().isOpaque() && isFullCube() && !canProvidePower(); ++ } ++ ++ /** ++ * Check if the face of a block should block rendering. ++ * ++ * Faces which are fully opaque should return true, faces with transparency ++ * or faces which do not span the full size of the block should return false. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param side The side to check ++ * @return True if the block is opaque on the specified side. ++ */ ++ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ return isOpaqueCube(); ++ } ++ ++ /** ++ * Checks if the block is a solid face on the given side, used by placement logic. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param side The side to check ++ * @return True if the block is solid on the specified side. ++ */ ++ public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) ++ { ++ IBlockState state = this.getActualState(world.getBlockState(pos), world, pos); ++ ++ if (this instanceof BlockSlab) ++ { ++ return isFullBlock() ++ || (state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP ) ++ || (state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM && side == EnumFacing.DOWN); ++ } ++ else if (this instanceof BlockFarmland) ++ { ++ return (side != EnumFacing.DOWN && side != EnumFacing.UP); ++ } ++ else if (this instanceof BlockStairs) ++ { ++ boolean flipped = state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP; ++ BlockStairs.EnumShape shape = (BlockStairs.EnumShape)state.getValue(BlockStairs.SHAPE); ++ EnumFacing facing = (EnumFacing)state.getValue(BlockStairs.FACING); ++ if (side == EnumFacing.UP) return flipped; ++ if (side == EnumFacing.DOWN) return !flipped; ++ if (facing == side) return true; ++ if (flipped) ++ { ++ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.rotateYCCW(); ++ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.rotateY(); ++ } ++ else ++ { ++ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.rotateY(); ++ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.rotateYCCW(); ++ } ++ return false; ++ } ++ else if (this instanceof BlockSnow) ++ { ++ return ((Integer)state.getValue(BlockSnow.LAYERS)) >= 8; ++ } ++ else if (this instanceof BlockHopper && side == EnumFacing.UP) ++ { ++ return true; ++ } ++ else if (this instanceof BlockCompressedPowered) ++ { ++ return true; ++ } ++ return isNormalCube(world, pos); ++ } ++ ++ /** ++ * Determines if this block should set fire and deal fire damage ++ * to entities coming into contact with it. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return True if the block should deal damage ++ */ ++ public boolean isBurning(IBlockAccess world, BlockPos pos) ++ { ++ return false; ++ } ++ ++ /** ++ * Determines this block should be treated as an air block ++ * by the rest of the code. This method is primarily ++ * useful for creating pure logic-blocks that will be invisible ++ * to the player and otherwise interact as air would. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return True if the block considered air ++ */ ++ public boolean isAir(IBlockAccess world, BlockPos pos) ++ { ++ return getMaterial() == Material.air; ++ } ++ ++ /** ++ * Determines if the player can harvest this block, obtaining it's drops when the block is destroyed. ++ * ++ * @param player The player damaging the block, may be null ++ * @param meta The block's current metadata ++ * @return True to spawn the drops ++ */ ++ public boolean canHarvestBlock(IBlockAccess world, BlockPos pos, EntityPlayer player) ++ { ++ return net.minecraftforge.common.ForgeHooks.canHarvestBlock(this, player, world, pos); ++ } ++ ++ /** ++ * Called when a player removes a block. This is responsible for ++ * actually destroying the block, and the block is intact at time of call. ++ * This is called regardless of whether the player can harvest the block or ++ * not. ++ * ++ * Return true if the block is actually destroyed. ++ * ++ * Note: When used in multiplayer, this is called on both client and ++ * server sides! ++ * ++ * @param world The current world ++ * @param player The player damaging the block, may be null ++ * @param pos Block position in world ++ * @param willHarvest True if Block.harvestBlock will be called after this, if the return in true. ++ * Can be useful to delay the destruction of tile entities till after harvestBlock ++ * @return True if the block is actually destroyed. ++ */ ++ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) ++ { ++ return world.setBlockToAir(pos); ++ } ++ ++ /** ++ * Chance that fire will spread and consume this block. ++ * 300 being a 100% chance, 0, being a 0% chance. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param face The face that the fire is coming from ++ * @return A number ranging from 0 to 300 relating used to determine if the block will be consumed by fire ++ */ ++ public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ return net.minecraft.init.Blocks.fire.getFlammability(this); ++ } ++ ++ /** ++ * Called when fire is updating, checks if a block face can catch fire. ++ * ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param face The face that the fire is coming from ++ * @return True if the face can be on fire, false otherwise. ++ */ ++ public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ return getFlammability(world, pos, face) > 0; ++ } ++ ++ /** ++ * Called when fire is updating on a neighbor block. ++ * The higher the number returned, the faster fire will spread around this block. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param face The face that the fire is coming from ++ * @return A number that is used to determine the speed of fire growth around the block ++ */ ++ public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ return net.minecraft.init.Blocks.fire.getEncouragement(this); ++ } ++ ++ /** ++ * Currently only called by fire when it is on top of this block. ++ * Returning true will prevent the fire from naturally dying during updating. ++ * Also prevents firing from dying from rain. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param metadata The blocks current metadata ++ * @param side The face that the fire is coming from ++ * @return True if this block sustains fire, meaning it will never go out. ++ */ ++ public boolean isFireSource(World world, BlockPos pos, EnumFacing side) ++ { ++ if (this == net.minecraft.init.Blocks.netherrack && side == EnumFacing.UP) ++ { ++ return true; ++ } ++ if ((world.provider instanceof net.minecraft.world.WorldProviderEnd) && this == net.minecraft.init.Blocks.bedrock && side == EnumFacing.UP) ++ { ++ return true; ++ } ++ return false; ++ } ++ ++ private boolean isTileProvider = this instanceof ITileEntityProvider; ++ /** ++ * Called throughout the code as a replacement for block instanceof BlockContainer ++ * Moving this to the Block base class allows for mods that wish to extend vanilla ++ * blocks, and also want to have a tile entity on that block, may. ++ * ++ * Return true from this function to specify this block has a tile entity. ++ * ++ * @param state State of the current block ++ * @return True if block has a tile entity, false otherwise ++ */ ++ public boolean hasTileEntity(IBlockState state) ++ { ++ return isTileProvider; ++ } ++ ++ /** ++ * Called throughout the code as a replacement for ITileEntityProvider.createNewTileEntity ++ * Return the same thing you would from that function. ++ * This will fall back to ITileEntityProvider.createNewTileEntity(World) if this block is a ITileEntityProvider ++ * ++ * @param metadata The Metadata of the current block ++ * @return A instance of a class extending TileEntity ++ */ ++ public TileEntity createTileEntity(World world, IBlockState state) ++ { ++ if (isTileProvider) ++ { ++ return ((ITileEntityProvider)this).createNewTileEntity(world, getMetaFromState(state)); ++ } ++ return null; ++ } ++ ++ /** ++ * State and fortune sensitive version, this replaces the old (int meta, Random rand) ++ * version in 1.1. ++ * ++ * @param state Current state ++ * @param fortune Current item fortune level ++ * @param random Random number generator ++ * @return The number of items to drop ++ */ ++ public int quantityDropped(IBlockState state, int fortune, Random random) ++ { ++ return quantityDroppedWithBonus(fortune, random); ++ } ++ ++ /** ++ * This returns a complete list of items dropped from this block. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param state Current state ++ * @param fortune Breakers fortune level ++ * @return A ArrayList containing all items this block drops ++ */ ++ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ List ret = new java.util.ArrayList(); ++ ++ Random rand = world instanceof World ? ((World)world).rand : RANDOM; ++ ++ int count = quantityDropped(state, fortune, rand); ++ for(int i = 0; i < count; i++) ++ { ++ Item item = this.getItemDropped(state, rand, fortune); ++ if (item != null) ++ { ++ ret.add(new ItemStack(item, 1, this.damageDropped(state))); ++ } ++ } ++ return ret; ++ } ++ ++ /** ++ * Return true from this function if the player with silk touch can harvest this block directly, and not it's normal drops. ++ * ++ * @param world The world ++ * @param pos Block position in world ++ * @param state current block state ++ * @param player The player doing the harvesting ++ * @return True if the block can be directly harvested using silk touch ++ */ ++ public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) ++ { ++ silk_check_state.set(state);; ++ boolean ret = this.canSilkHarvest(); ++ silk_check_state.set(null); ++ return ret; ++ } ++ ++ /** ++ * Determines if a specified mob type can spawn on this block, returning false will ++ * prevent any mob from spawning on the block. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param type The Mob Category Type ++ * @return True to allow a mob of the specified category to spawn, false to prevent it. ++ */ ++ public boolean canCreatureSpawn(IBlockAccess world, BlockPos pos, net.minecraft.entity.EntityLiving.SpawnPlacementType type) ++ { ++ IBlockState state = world.getBlockState(pos); ++ if (this instanceof BlockSlab) ++ { ++ return (isFullBlock() || state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP); ++ } ++ else if (this instanceof BlockStairs) ++ { ++ return state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP; ++ } ++ return isSideSolid(world, pos, EnumFacing.UP); ++ } ++ ++ /** ++ * Determines if this block is classified as a Bed, Allowing ++ * players to sleep in it, though the block has to specifically ++ * perform the sleeping functionality in it's activated event. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param player The player or camera entity, null in some cases. ++ * @return True to treat this as a bed ++ */ ++ public boolean isBed(IBlockAccess world, BlockPos pos, Entity player) ++ { ++ return this == net.minecraft.init.Blocks.bed; ++ } ++ ++ /** ++ * Returns the position that the player is moved to upon ++ * waking up, or respawning at the bed. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param player The player or camera entity, null in some cases. ++ * @return The spawn position ++ */ ++ public BlockPos getBedSpawnPosition(IBlockAccess world, BlockPos pos, EntityPlayer player) ++ { ++ if (world instanceof World) ++ return BlockBed.getSafeExitLocation((World)world, pos, 0); ++ return null; ++ } ++ ++ /** ++ * Called when a user either starts or stops sleeping in the bed. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param player The player or camera entity, null in some cases. ++ * @param occupied True if we are occupying the bed, or false if they are stopping use of the bed ++ */ ++ public void setBedOccupied(IBlockAccess world, BlockPos pos, EntityPlayer player, boolean occupied) ++ { ++ if (world instanceof World) ++ { ++ IBlockState state = world.getBlockState(pos); ++ state = state.getBlock().getActualState(state, world, pos); ++ state = state.withProperty(BlockBed.OCCUPIED, true); ++ ((World)world).setBlockState(pos, state, 4); ++ } ++ } ++ ++ /** ++ * Returns the direction of the block. Same values that ++ * are returned by BlockDirectional ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return Bed direction ++ */ ++ public EnumFacing getBedDirection(IBlockAccess world, BlockPos pos) ++ { ++ return (EnumFacing)getActualState(world.getBlockState(pos), world, pos).getValue(BlockDirectional.FACING); ++ } ++ ++ /** ++ * Determines if the current block is the foot half of the bed. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return True if the current block is the foot side of a bed. ++ */ ++ public boolean isBedFoot(IBlockAccess world, BlockPos pos) ++ { ++ return getActualState(world.getBlockState(pos), world, pos).getValue(BlockBed.PART) == BlockBed.EnumPartType.FOOT; ++ } ++ ++ /** ++ * Called when a leaf should start its decay process. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ */ ++ public void beginLeavesDecay(World world, BlockPos pos){} ++ ++ /** ++ * Determines if this block can prevent leaves connected to it from decaying. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return true if the presence this block can prevent leaves from decaying. ++ */ ++ public boolean canSustainLeaves(IBlockAccess world, BlockPos pos) ++ { ++ return false; ++ } ++ ++ /** ++ * Determines if this block is considered a leaf block, used to apply the leaf decay and generation system. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return true if this block is considered leaves. ++ */ ++ public boolean isLeaves(IBlockAccess world, BlockPos pos) ++ { ++ return getMaterial() == Material.leaves; ++ } ++ ++ /** ++ * Used during tree growth to determine if newly generated leaves can replace this block. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return true if this block can be replaced by growing leaves. ++ */ ++ public boolean canBeReplacedByLeaves(IBlockAccess world, BlockPos pos) ++ { ++ return !isFullBlock(); ++ } ++ ++ /** ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return true if the block is wood (logs) ++ */ ++ public boolean isWood(IBlockAccess world, BlockPos pos) ++ { ++ return false; ++ } ++ ++ /** ++ * Determines if the current block is replaceable by Ore veins during world generation. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param target The generic target block the gen is looking for, Standards define stone ++ * for overworld generation, and neatherack for the nether. ++ * @return True to allow this block to be replaced by a ore ++ */ ++ public boolean isReplaceableOreGen(World world, BlockPos pos, com.google.common.base.Predicate target) ++ { ++ return target.apply(world.getBlockState(pos)); ++ } ++ ++ /** ++ * Location sensitive version of getExplosionRestance ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param exploder The entity that caused the explosion, can be null ++ * @param explosion The explosion ++ * @return The amount of the explosion absorbed. ++ */ ++ public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) ++ { ++ return getExplosionResistance(exploder); ++ } ++ ++ /** ++ * Called when the block is destroyed by an explosion. ++ * Useful for allowing the block to take into account tile entities, ++ * state, etc. when exploded, before it is removed. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param Explosion The explosion instance affecting the block ++ */ ++ public void onBlockExploded(World world, BlockPos pos, Explosion explosion) ++ { ++ world.setBlockToAir(pos); ++ onBlockDestroyedByExplosion(world, pos, explosion); ++ } ++ ++ /** ++ * Determine if this block can make a redstone connection on the side provided, ++ * Useful to control which sides are inputs and outputs for redstone wires. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param side The side that is trying to make the connection, CAN BE NULL ++ * @return True to make the connection ++ */ ++ public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side) ++ { ++ return canProvidePower() && side != null; ++ } ++ ++ /** ++ * Determines if a torch can be placed on the top surface of this block. ++ * Useful for creating your own block that torches can be on, such as fences. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return True to allow the torch to be placed ++ */ ++ public boolean canPlaceTorchOnTop(IBlockAccess world, BlockPos pos) ++ { ++ if (isSideSolid(world, pos, EnumFacing.UP)) ++ { ++ return true; ++ } ++ else ++ { ++ return this instanceof BlockFence || this == net.minecraft.init.Blocks.glass || this == net.minecraft.init.Blocks.cobblestone_wall || this == net.minecraft.init.Blocks.stained_glass; ++ } ++ } ++ ++ /** Dont think this exists in 1.8 anymore ++ /** ++ * Determines if this block should render in this pass. ++ * ++ * @param pass The pass in question ++ * @return True to render ++ * / ++ public boolean canRenderInPass(int pass) ++ { ++ return pass == func_149701_w(); ++ } ++ */ ++ ++ /** ++ * Called when a user uses the creative pick block button on this block ++ * ++ * @param target The full target the player is looking at ++ * @return A ItemStack to add to the player's inventory, Null if nothing should be added. ++ */ ++ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) ++ { ++ return getPickBlock(target, world, pos); ++ } ++ @Deprecated ++ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos) ++ { ++ Item item = getItem(world, pos); ++ ++ if (item == null) ++ { ++ return null; ++ } ++ ++ Block block = item instanceof ItemBlock && !isFlowerPot() ? Block.getBlockFromItem(item) : this; ++ return new ItemStack(item, 1, block.getDamageValue(world, pos)); ++ } ++ ++ /** ++ * Used by getTopSolidOrLiquidBlock while placing biome decorations, villages, etc ++ * Also used to determine if the player can spawn on this block. ++ * ++ * @return False to disallow spawning ++ */ ++ public boolean isFoliage(IBlockAccess world, BlockPos pos) ++ { ++ return false; ++ } ++ ++ /** ++ * Allows a block to override the standard EntityLivingBase.updateFallState ++ * particles, this is a server side method that spawns particles with ++ * WorldServer.spawnParticle ++ * ++ * @param world The current Server world ++ * @param blockPosition of the block that the entity landed on. ++ * @param iblockstate State at the specific world/pos ++ * @param entity the entity that hit landed on the block. ++ * @param numberOfParticles that vanilla would have spawned. ++ * @return True to prevent vanilla landing particles form spawning. ++ */ ++ public boolean addLandingEffects(net.minecraft.world.WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles ) ++ { ++ return false; ++ } ++ ++ /** ++ * Spawn a digging particle effect in the world, this is a wrapper ++ * around EffectRenderer.addBlockHitEffects to allow the block more ++ * control over the particles. Useful when you have entirely different ++ * texture sheets for different sides/locations in the world. ++ * ++ * @param world The current world ++ * @param target The target the player is looking at {x/y/z/side/sub} ++ * @param effectRenderer A reference to the current effect renderer. ++ * @return True to prevent vanilla digging particles form spawning. ++ */ ++ @SideOnly(Side.CLIENT) ++ public boolean addHitEffects(World worldObj, MovingObjectPosition target, net.minecraft.client.particle.EffectRenderer effectRenderer) ++ { ++ return false; ++ } ++ ++ /** ++ * Spawn particles for when the block is destroyed. Due to the nature ++ * of how this is invoked, the x/y/z locations are not always guaranteed ++ * to host your block. So be sure to do proper sanity checks before assuming ++ * that the location is this block. ++ * ++ * @param world The current world ++ * @param pos Position to spawn the particle ++ * @param effectRenderer A reference to the current effect renderer. ++ * @return True to prevent vanilla break particles from spawning. ++ */ ++ @SideOnly(Side.CLIENT) ++ public boolean addDestroyEffects(World world, BlockPos pos, net.minecraft.client.particle.EffectRenderer effectRenderer) ++ { ++ return false; ++ } ++ ++ /** ++ * Determines if this block can support the passed in plant, allowing it to be planted and grow. ++ * Some examples: ++ * Reeds check if its a reed, or if its sand/dirt/grass and adjacent to water ++ * Cacti checks if its a cacti, or if its sand ++ * Nether types check for soul sand ++ * Crops check for tilled soil ++ * Caves check if it's a solid surface ++ * Plains check if its grass or dirt ++ * Water check if its still water ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param direction The direction relative to the given position the plant wants to be, typically its UP ++ * @param plantable The plant that wants to check ++ * @return True to allow the plant to be planted/stay. ++ */ ++ public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) ++ { ++ IBlockState state = world.getBlockState(pos); ++ IBlockState plant = plantable.getPlant(world, pos.offset(direction)); ++ net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); ++ ++ if (plant.getBlock() == net.minecraft.init.Blocks.cactus && this == net.minecraft.init.Blocks.cactus) ++ { ++ return true; ++ } ++ ++ if (plant.getBlock() == net.minecraft.init.Blocks.reeds && this == net.minecraft.init.Blocks.reeds) ++ { ++ return true; ++ } ++ ++ if (plantable instanceof BlockBush && ((BlockBush)plantable).canPlaceBlockOn(this)) ++ { ++ return true; ++ } ++ ++ switch (plantType) ++ { ++ case Desert: return this == net.minecraft.init.Blocks.sand || this == net.minecraft.init.Blocks.hardened_clay || this == net.minecraft.init.Blocks.stained_hardened_clay || this == net.minecraft.init.Blocks.dirt; ++ case Nether: return this == net.minecraft.init.Blocks.soul_sand; ++ case Crop: return this == net.minecraft.init.Blocks.farmland; ++ case Cave: return isSideSolid(world, pos, EnumFacing.UP); ++ case Plains: return this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.farmland; ++ case Water: return getMaterial() == Material.water && ((Integer)state.getValue(BlockLiquid.LEVEL)) == 0; ++ case Beach: ++ boolean isBeach = this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.sand; ++ boolean hasWater = (world.getBlockState(pos.east()).getBlock().getMaterial() == Material.water || ++ world.getBlockState(pos.west()).getBlock().getMaterial() == Material.water || ++ world.getBlockState(pos.north()).getBlock().getMaterial() == Material.water || ++ world.getBlockState(pos.south()).getBlock().getMaterial() == Material.water); ++ return isBeach && hasWater; ++ } ++ ++ return false; ++ } ++ ++ /** ++ * Called when a plant grows on this block, only implemented for saplings using the WorldGen*Trees classes right now. ++ * Modder may implement this for custom plants. ++ * This does not use ForgeDirection, because large/huge trees can be located in non-representable direction, ++ * so the source location is specified. ++ * Currently this just changes the block to dirt if it was grass. ++ * ++ * Note: This happens DURING the generation, the generation may not be complete when this is called. ++ * ++ * @param world Current world ++ * @param pos Block position in world ++ * @param source Source plant's position in world ++ */ ++ public void onPlantGrow(World world, BlockPos pos, BlockPos source) ++ { ++ if (this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.farmland) ++ { ++ world.setBlockState(pos, net.minecraft.init.Blocks.dirt.getDefaultState(), 2); ++ } ++ } ++ ++ /** ++ * Checks if this soil is fertile, typically this means that growth rates ++ * of plants on this soil will be slightly sped up. ++ * Only vanilla case is tilledField when it is within range of water. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return True if the soil should be considered fertile. ++ */ ++ public boolean isFertile(World world, BlockPos pos) ++ { ++ if (this == net.minecraft.init.Blocks.farmland) ++ { ++ return ((Integer)world.getBlockState(pos).getValue(BlockFarmland.MOISTURE)) > 0; ++ } ++ ++ return false; ++ } ++ ++ /** ++ * Location aware and overrideable version of the lightOpacity array, ++ * return the number to subtract from the light value when it passes through this block. ++ * ++ * This is not guaranteed to have the tile entity in place before this is called, so it is ++ * Recommended that you have your tile entity call relight after being placed if you ++ * rely on it for light info. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return The amount of light to block, 0 for air, 255 for fully opaque. ++ */ ++ public int getLightOpacity(IBlockAccess world, BlockPos pos) ++ { ++ return getLightOpacity(); ++ } ++ ++ /** ++ * Determines if this block is can be destroyed by the specified entities normal behavior. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return True to allow the ender dragon to destroy this block ++ */ ++ public boolean canEntityDestroy(IBlockAccess world, BlockPos pos, Entity entity) ++ { ++ if (entity instanceof net.minecraft.entity.boss.EntityDragon) ++ { ++ return this != net.minecraft.init.Blocks.barrier && this != net.minecraft.init.Blocks.obsidian && this != net.minecraft.init.Blocks.end_stone && this != net.minecraft.init.Blocks.bedrock && this != net.minecraft.init.Blocks.command_block; ++ } ++ ++ return true; ++ } ++ ++ /** ++ * Determines if this block can be used as the base of a beacon. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param beacon Beacon position in world ++ * @return True, to support the beacon, and make it active with this block. ++ */ ++ public boolean isBeaconBase(IBlockAccess worldObj, BlockPos pos, BlockPos beacon) ++ { ++ return this == net.minecraft.init.Blocks.emerald_block || this == net.minecraft.init.Blocks.gold_block || this == net.minecraft.init.Blocks.diamond_block || this == net.minecraft.init.Blocks.iron_block; ++ } ++ ++ /** ++ * Rotate the block. For vanilla blocks this rotates around the axis passed in (generally, it should be the "face" that was hit). ++ * Note: for mod blocks, this is up to the block and modder to decide. It is not mandated that it be a rotation around the ++ * face, but could be a rotation to orient *to* that face, or a visiting of possible rotations. ++ * The method should return true if the rotation was successful though. ++ * ++ * @param world The world ++ * @param pos Block position in world ++ * @param axis The axis to rotate around ++ * @return True if the rotation was successful, False if the rotation failed, or is not possible ++ */ ++ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) ++ { ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("facing") || prop.getName().equals("rotation")) ++ { ++ world.setBlockState(pos, state.cycleProperty(prop)); ++ return true; ++ } ++ } ++ return false; ++ } ++ ++ /** ++ * Get the rotations that can apply to the block at the specified coordinates. Null means no rotations are possible. ++ * Note, this is up to the block to decide. It may not be accurate or representative. ++ * @param world The world ++ * @param pos Block position in world ++ * @return An array of valid axes to rotate around, or null for none or unknown ++ */ ++ public EnumFacing[] getValidRotations(World world, BlockPos pos) ++ { ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("facing") && prop.getValueClass() == EnumFacing.class) ++ { ++ java.util.Collection values = ((java.util.Collection)prop.getAllowedValues()); ++ return values.toArray(new EnumFacing[values.size()]); ++ } ++ } ++ return null; ++ } ++ ++ /** ++ * Determines the amount of enchanting power this block can provide to an enchanting table. ++ * @param world The World ++ * @param pos Block position in world ++ * @return The amount of enchanting power this block produces. ++ */ ++ public float getEnchantPowerBonus(World world, BlockPos pos) ++ { ++ return this == net.minecraft.init.Blocks.bookshelf ? 1 : 0; ++ } ++ ++ /** ++ * Common way to recolor a block with an external tool ++ * @param world The world ++ * @param pos Block position in world ++ * @param side The side hit with the coloring tool ++ * @param color The color to change to ++ * @return If the recoloring was successful ++ */ ++ public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, net.minecraft.item.EnumDyeColor color) ++ { ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class) ++ { ++ net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.getValue(prop); ++ if (current != color) ++ { ++ world.setBlockState(pos, state.withProperty(prop, color)); ++ return true; ++ } ++ } ++ } ++ return false; ++ } ++ ++ /** ++ * Gathers how much experience this block drops when broken. ++ * ++ * @param world The world ++ * @param pos Block position ++ * @param fortune ++ * @return Amount of XP from breaking this block. ++ */ ++ public int getExpDrop(IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return 0; ++ } ++ ++ /** ++ * Called when a tile entity on a side of this block changes is created or is destroyed. ++ * @param world The world ++ * @param pos Block position in world ++ * @param neighbor Block position of neighbor ++ */ ++ public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor){} ++ ++ /** ++ * Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules. ++ * @param world The world ++ * @param pos Block position in world ++ * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side ++ * @return Whether Block#isProvidingWeakPower should be called when determining indirect power ++ */ ++ public boolean shouldCheckWeakPower(IBlockAccess world, BlockPos pos, EnumFacing side) ++ { ++ return isNormalCube(); ++ } ++ ++ /** ++ * If this block should be notified of weak changes. ++ * Weak changes are changes 1 block away through a solid block. ++ * Similar to comparators. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param side The side to check ++ * @return true To be notified of changes ++ */ ++ public boolean getWeakChanges(IBlockAccess world, BlockPos pos) ++ { ++ return false; ++ } ++ ++ private String[] harvestTool = new String[16];; ++ private int[] harvestLevel = new int[]{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; ++ /** ++ * Sets or removes the tool and level required to harvest this block. ++ * ++ * @param toolClass Class ++ * @param level Harvest level: ++ * Wood: 0 ++ * Stone: 1 ++ * Iron: 2 ++ * Diamond: 3 ++ * Gold: 0 ++ */ ++ public void setHarvestLevel(String toolClass, int level) ++ { ++ java.util.Iterator itr = getBlockState().getValidStates().iterator(); ++ while (itr.hasNext()) ++ { ++ setHarvestLevel(toolClass, level, itr.next()); ++ } ++ } ++ ++ /** ++ * Sets or removes the tool and level required to harvest this block. ++ * ++ * @param toolClass Class ++ * @param level Harvest level: ++ * Wood: 0 ++ * Stone: 1 ++ * Iron: 2 ++ * Diamond: 3 ++ * Gold: 0 ++ * @param state The specific state. ++ */ ++ public void setHarvestLevel(String toolClass, int level, IBlockState state) ++ { ++ int idx = this.getMetaFromState(state); ++ this.harvestTool[idx] = toolClass; ++ this.harvestLevel[idx] = level; ++ } ++ ++ /** ++ * Queries the class of tool required to harvest this block, if null is returned ++ * we assume that anything can harvest this block. ++ */ ++ public String getHarvestTool(IBlockState state) ++ { ++ return harvestTool[getMetaFromState(state)]; ++ } ++ ++ /** ++ * Queries the harvest level of this item stack for the specified tool class, ++ * Returns -1 if this tool is not of the specified type ++ * ++ * @param stack This item stack instance ++ * @return Harvest level, or -1 if not the specified tool type. ++ */ ++ public int getHarvestLevel(IBlockState state) ++ { ++ return harvestLevel[getMetaFromState(state)]; ++ } ++ ++ /** ++ * Checks if the specified tool type is efficient on this block, ++ * meaning that it digs at full speed. ++ */ ++ public boolean isToolEffective(String type, IBlockState state) ++ { ++ if ("pickaxe".equals(type) && (this == net.minecraft.init.Blocks.redstone_ore || this == net.minecraft.init.Blocks.lit_redstone_ore || this == net.minecraft.init.Blocks.obsidian)) ++ return false; ++ return type != null && type.equals(getHarvestTool(state)); ++ } ++ ++ /** ++ * Can return IExtendedBlockState ++ */ ++ public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) ++ { ++ return state; ++ } ++ ++ /** ++ * Called when the entity is inside this block, may be used to determined if the entity can breathing, ++ * display material overlays, or if the entity can swim inside a block. ++ * ++ * @param world that is being tested. ++ * @param blockpos position thats being tested. ++ * @param iblockstate state at world/blockpos ++ * @param entity that is being tested. ++ * @param yToTest, primarily for testingHead, which sends the the eye level of the entity, other wise it sends a y that can be tested vs liquid height. ++ * @param materialIn to test for. ++ * @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment. ++ * @return null for default behavior, true if the entity is within the material, false if it was not. ++ */ ++ public Boolean isEntityInsideMaterial(World world, BlockPos blockpos, IBlockState iblockstate, Entity entity, double yToTest, Material materialIn, boolean testingHead) ++ { ++ return null; ++ } ++ ++ /** ++ * Called when boats or fishing hooks are inside the block to check if they are inside ++ * the material requested. ++ * ++ * @param world world that is being tested. ++ * @param pos block thats being tested. ++ * @param boundingBox box to test, generally the bounds of an entity that are besting tested. ++ * @param materialIn to check for. ++ * @return null for default behavior, true if the box is within the material, false if it was not. ++ */ ++ public Boolean isAABBInsideMaterial(World world, BlockPos pos, AxisAlignedBB boundingBox, Material materialIn) ++ { ++ return null; ++ } ++ ++ /** ++ * Queries if this block should render in a given layer. ++ * ISmartBlockModel can use MinecraftForgeClient.getRenderLayer to alter their model based on layer ++ */ ++ public boolean canRenderInLayer(EnumWorldBlockLayer layer) ++ { ++ return getBlockLayer() == layer; ++ } ++ ++ // For Internal use only to capture droped items inside getDrops ++ protected static ThreadLocal captureDrops = new ThreadLocal() ++ { ++ @Override protected Boolean initialValue() { return false; } ++ }; ++ protected static ThreadLocal> capturedDrops = new ThreadLocal>() ++ { ++ @Override protected List initialValue() { return new java.util.ArrayList(); } ++ }; ++ protected List captureDrops(boolean start) ++ { ++ if (start) ++ { ++ captureDrops.set(true); ++ capturedDrops.get().clear(); ++ return null; ++ } ++ else ++ { ++ captureDrops.set(false); ++ return capturedDrops.get(); ++ } ++ } ++ ++ private ResourceLocation registryName = null; ++ /** ++ * Sets a unique name for this Block. This should be used for uniquely identify the instance of the Block. ++ * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. ++ * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. ++ * ++ * The supplied name will be prefixed with the currently active mod's modId. ++ * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. ++ * ++ * If a name already exists, or this Block is already registered in a registry, then an IllegalStateException is thrown. ++ * ++ * Returns 'this' to allow for chaining. ++ * ++ * @param name Unique registry name ++ * @return This instance ++ */ ++ public final Block setRegistryName(String name) ++ { ++ if (getRegistryName() != null) ++ throw new IllegalStateException("Attempted to set registry name on block with exisiting registry name! New: " + name + " Old: " + getRegistryName()); ++ int index = name.lastIndexOf(':'); ++ String oldPrefix = index == -1 ? "" : name.substring(0, index); ++ name = index == -1 ? name : name.substring(index + 1); ++ net.minecraftforge.fml.common.ModContainer mc = net.minecraftforge.fml.common.Loader.instance().activeModContainer(); ++ String prefix = mc == null ? "minecraft" : mc.getModId(); ++ if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) ++ { ++ net.minecraftforge.fml.common.FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name); ++ prefix = oldPrefix; ++ } ++ this.registryName = new ResourceLocation(prefix, name); ++ return this; ++ } ++ public final Block setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); } ++ public final Block setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); } ++ ++ /** ++ * A unique identifier for this block, if this block is registered in the game registry it will return that name. ++ * Otherwise it will return the name set in setRegistryName(). ++ * If neither are valid null is returned. ++ * ++ * @return Unique identifier or null. ++ */ ++ public final String getRegistryName() ++ { ++ if (delegate.getResourceName() != null) return delegate.getResourceName().toString(); ++ return registryName != null ? registryName.toString() : null; ++ } ++ /* ========================================= FORGE END ======================================*/ ++ + public static void registerBlocks() + { + registerBlock(0, AIR_ID, (new BlockAir()).setUnlocalizedName("air")); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch new file mode 100644 index 0000000000..09cf5e0464 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch @@ -0,0 +1,54 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockBanner.java ++++ ../src-work/minecraft/net/minecraft/block/BlockBanner.java +@@ -85,22 +85,7 @@ + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- TileEntity tileentity = worldIn.getTileEntity(pos); +- +- if (tileentity instanceof TileEntityBanner) + { +- ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor()); +- NBTTagCompound nbttagcompound = new NBTTagCompound(); +- tileentity.writeToNBT(nbttagcompound); +- nbttagcompound.removeTag("x"); +- nbttagcompound.removeTag("y"); +- nbttagcompound.removeTag("z"); +- nbttagcompound.removeTag("id"); +- itemstack.setTagInfo("BlockEntityTag", nbttagcompound); +- spawnAsEntity(worldIn, pos, itemstack); +- } +- else +- { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + } +@@ -133,6 +118,28 @@ + } + } + ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ TileEntity te = world.getTileEntity(pos); ++ ++ java.util.List ret = new java.util.ArrayList(); ++ if (te instanceof TileEntityBanner) ++ { ++ TileEntityBanner banner = (TileEntityBanner)te; ++ ItemStack item = new ItemStack(Items.banner, 1, banner.getBaseColor()); ++ NBTTagCompound nbt = new NBTTagCompound(); ++ TileEntityBanner.func_181020_a(nbt, banner.getBaseColor(), banner.func_181021_d()); ++ item.setTagInfo("BlockEntityTag", nbt); ++ ret.add(item); ++ } ++ else ++ { ++ ret.add(new ItemStack(Items.banner, 1, 0)); ++ } ++ return ret; ++ } ++ + public static class BlockBannerHanging extends BlockBanner + { + public BlockBannerHanging() diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch new file mode 100644 index 0000000000..26af27af21 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch @@ -0,0 +1,66 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockBush.java ++++ ../src-work/minecraft/net/minecraft/block/BlockBush.java +@@ -13,7 +13,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class BlockBush extends Block ++public class BlockBush extends Block implements net.minecraftforge.common.IPlantable + { + protected BlockBush() + { +@@ -36,7 +36,7 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return super.canPlaceBlockAt(worldIn, pos) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return super.canPlaceBlockAt(worldIn, pos) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); + } + + protected boolean canPlaceBlockOn(Block ground) +@@ -66,7 +66,10 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ BlockPos down = pos.down(); ++ Block soil = worldIn.getBlockState(down).getBlock(); ++ if (state.getBlock() != this) return this.canPlaceBlockOn(soil); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. ++ return soil.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, this); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) +@@ -89,4 +92,33 @@ + { + return EnumWorldBlockLayer.CUTOUT; + } ++ ++ @Override ++ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ if (this == Blocks.wheat) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.carrots) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.potatoes) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.melon_stem) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.pumpkin_stem) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.deadbush) return net.minecraftforge.common.EnumPlantType.Desert; ++ if (this == Blocks.waterlily) return net.minecraftforge.common.EnumPlantType.Water; ++ if (this == Blocks.red_mushroom) return net.minecraftforge.common.EnumPlantType.Cave; ++ if (this == Blocks.brown_mushroom) return net.minecraftforge.common.EnumPlantType.Cave; ++ if (this == Blocks.nether_wart) return net.minecraftforge.common.EnumPlantType.Nether; ++ if (this == Blocks.sapling) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.tallgrass) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.double_plant) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.red_flower) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.yellow_flower) return net.minecraftforge.common.EnumPlantType.Plains; ++ return net.minecraftforge.common.EnumPlantType.Plains; ++ } ++ ++ @Override ++ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ IBlockState state = world.getBlockState(pos); ++ if (state.getBlock() != this) return getDefaultState(); ++ return state; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch new file mode 100644 index 0000000000..ef2527c7b0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockButton.java ++++ ../src-work/minecraft/net/minecraft/block/BlockButton.java +@@ -74,8 +74,7 @@ + + protected static boolean func_181088_a(World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_) + { +- BlockPos blockpos = p_181088_1_.offset(p_181088_2_); +- return p_181088_2_ == EnumFacing.DOWN ? World.doesBlockHaveSolidTopSurface(p_181088_0_, blockpos) : p_181088_0_.getBlockState(blockpos).getBlock().isNormalCube(); ++ return p_181088_2_ == EnumFacing.DOWN && World.doesBlockHaveSolidTopSurface(p_181088_0_, p_181088_1_.down()) ? true : p_181088_0_.isSideSolid(p_181088_1_.offset(p_181088_2_), p_181088_2_.getOpposite()); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch new file mode 100644 index 0000000000..04f56d2171 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockCactus.java ++++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java +@@ -18,7 +18,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class BlockCactus extends Block ++public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable + { + public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); + +@@ -109,7 +109,7 @@ + } + + Block block = worldIn.getBlockState(pos.down()).getBlock(); +- return block == Blocks.cactus || block == Blocks.sand; ++ return block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this); + } + + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) +@@ -137,4 +137,16 @@ + { + return new BlockState(this, new IProperty[] {AGE}); + } ++ ++ @Override ++ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ return net.minecraftforge.common.EnumPlantType.Desert; ++ } ++ ++ @Override ++ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ return getDefaultState(); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch new file mode 100644 index 0000000000..af39114510 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockChest.java ++++ ../src-work/minecraft/net/minecraft/block/BlockChest.java +@@ -527,7 +527,7 @@ + + private boolean isBelowSolidBlock(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); ++ return worldIn.isSideSolid(pos.up(), EnumFacing.DOWN, false); + } + + private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch new file mode 100644 index 0000000000..e5f3922b4a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java ++++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java +@@ -137,6 +137,13 @@ + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); ++ } ++ ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List dropped = super.getDrops(world, pos, state, fortune); + int i = ((Integer)state.getValue(AGE)).intValue(); + int j = 1; + +@@ -147,8 +154,9 @@ + + for (int k = 0; k < j; ++k) + { +- spawnAsEntity(worldIn, pos, new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage())); ++ dropped.add(new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage())); + } ++ return dropped; + } + + @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch new file mode 100644 index 0000000000..3d2a7232a0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch @@ -0,0 +1,77 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockCrops.java ++++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java +@@ -81,11 +81,11 @@ + float f1 = 0.0F; + IBlockState iblockstate = worldIn.getBlockState(blockpos.add(i, 0, j)); + +- if (iblockstate.getBlock() == Blocks.farmland) ++ if (iblockstate.getBlock().canSustainPlant(worldIn, blockpos.add(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)blockIn)) + { + f1 = 1.0F; + +- if (((Integer)iblockstate.getValue(BlockFarmland.MOISTURE)).intValue() > 0) ++ if (iblockstate.getBlock().isFertile(worldIn, blockpos.add(i, 0, j))) + { + f1 = 3.0F; + } +@@ -126,7 +126,7 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); + } + + protected Item getSeed() +@@ -142,24 +142,6 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); +- +- if (!worldIn.isRemote) +- { +- int i = ((Integer)state.getValue(AGE)).intValue(); +- +- if (i >= 7) +- { +- int j = 3 + fortune; +- +- for (int k = 0; k < j; ++k) +- { +- if (worldIn.rand.nextInt(15) <= i) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0)); +- } +- } +- } +- } + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) +@@ -202,4 +184,26 @@ + { + return new BlockState(this, new IProperty[] {AGE}); + } ++ ++ @Override ++ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = super.getDrops(world, pos, state, fortune); ++ int age = ((Integer)state.getValue(AGE)).intValue(); ++ Random rand = world instanceof World ? ((World)world).rand : new Random(); ++ ++ if (age >= 7) ++ { ++ int k = 3 + fortune; ++ ++ for (int i = 0; i < 3 + fortune; ++i) ++ { ++ if (rand.nextInt(15) <= age) ++ { ++ ret.add(new ItemStack(this.getSeed(), 1, 0)); ++ } ++ } ++ } ++ return ret; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch new file mode 100644 index 0000000000..c0c9491c97 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockDeadBush.java ++++ ../src-work/minecraft/net/minecraft/block/BlockDeadBush.java +@@ -14,7 +14,7 @@ + import net.minecraft.util.BlockPos; + import net.minecraft.world.World; + +-public class BlockDeadBush extends BlockBush ++public class BlockDeadBush extends BlockBush implements net.minecraftforge.common.IShearable + { + protected BlockDeadBush() + { +@@ -45,14 +45,15 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0)); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } ++ ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } ++ @Override ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(Blocks.deadbush))); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch new file mode 100644 index 0000000000..ec621d11fe --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockDoor.java ++++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java +@@ -154,7 +154,7 @@ + { + if (this.blockMaterial == Material.iron) + { +- return true; ++ return false; //Allow items to interact with the door + } + else + { +@@ -272,7 +272,7 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return pos.getY() >= 255 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); ++ return pos.getY() >= worldIn.getHeight() - 1 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); + } + + public int getMobilityFlag() diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch new file mode 100644 index 0000000000..8cbc62e73a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch @@ -0,0 +1,89 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java ++++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java +@@ -25,7 +25,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class BlockDoublePlant extends BlockBush implements IGrowable ++public class BlockDoublePlant extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable + { + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockDoublePlant.EnumPlantType.class); + public static final PropertyEnum HALF = PropertyEnum.create("half", BlockDoublePlant.EnumBlockHalf.class); +@@ -90,6 +90,8 @@ + Block block = (Block)(flag ? this : worldIn.getBlockState(blockpos).getBlock()); + Block block1 = (Block)(flag ? worldIn.getBlockState(blockpos1).getBlock() : this); + ++ if (!flag) this.dropBlockAsItem(worldIn, pos, state, 0); //Forge move above the setting to air. ++ + if (block == this) + { + worldIn.setBlockState(blockpos, Blocks.air.getDefaultState(), 2); +@@ -98,17 +100,13 @@ + if (block1 == this) + { + worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3); +- +- if (!flag) +- { +- this.dropBlockAsItem(worldIn, blockpos1, state, 0); +- } + } + } + } + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { ++ if (state.getBlock() != this) return super.canBlockStay(worldIn, pos, state); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. + if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) + { + return worldIn.getBlockState(pos.down()).getBlock() == this; +@@ -158,7 +156,6 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (worldIn.isRemote || player.getCurrentEquippedItem() == null || player.getCurrentEquippedItem().getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player)) + { + super.harvestBlock(worldIn, player, pos, state, te); + } +@@ -221,8 +218,6 @@ + else + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta(); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i)); + return true; + } + } +@@ -293,6 +288,32 @@ + return Block.EnumOffsetType.XZ; + } + ++ @Override ++ public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos) ++ { ++ IBlockState state = world.getBlockState(pos); ++ EnumPlantType type = (EnumPlantType)state.getValue(VARIANT); ++ return state.getValue(HALF) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS); ++ } ++ @Override ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ java.util.List ret = new java.util.ArrayList(); ++ EnumPlantType type = (EnumPlantType)world.getBlockState(pos).getValue(VARIANT); ++ if (type == EnumPlantType.FERN) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.FERN.getMeta())); ++ if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.GRASS.getMeta())); ++ return ret; ++ } ++ @Override ++ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) ++ { ++ //Forge: Break both parts on the client to prevent the top part flickering as default type for a few frames. ++ IBlockState state = world.getBlockState(pos); ++ if (state.getBlock() == this && state.getValue(HALF) == EnumBlockHalf.LOWER && world.getBlockState(pos.up()).getBlock() == this) ++ world.setBlockToAir(pos.up()); ++ return world.setBlockToAir(pos); ++ } ++ + public static enum EnumBlockHalf implements IStringSerializable + { + UPPER, diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDropper.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDropper.java.patch new file mode 100644 index 0000000000..20608bde19 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockDropper.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockDropper.java ++++ ../src-work/minecraft/net/minecraft/block/BlockDropper.java +@@ -43,7 +43,7 @@ + { + ItemStack itemstack = tileentitydispenser.getStackInSlot(i); + +- if (itemstack != null) ++ if (itemstack != null && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(worldIn, pos, tileentitydispenser, i, itemstack)) + { + EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING); + BlockPos blockpos = pos.offset(enumfacing); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch new file mode 100644 index 0000000000..4ac1d28471 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFalling.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java +@@ -86,6 +86,7 @@ + + public static boolean canFallInto(World worldIn, BlockPos pos) + { ++ if (worldIn.isAirBlock(pos)) return true; + Block block = worldIn.getBlockState(pos).getBlock(); + Material material = block.blockMaterial; + return block == Blocks.fire || material == Material.air || material == Material.water || material == Material.lava; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch new file mode 100644 index 0000000000..b94b5429ec --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java +@@ -89,7 +89,7 @@ + private boolean hasCrops(World worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos.up()).getBlock(); +- return block instanceof BlockCrops || block instanceof BlockStem; ++ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(worldIn, pos, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block); + } + + private boolean hasWater(World worldIn, BlockPos pos) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch new file mode 100644 index 0000000000..287e8d5dd9 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch @@ -0,0 +1,211 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFire.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFire.java +@@ -41,18 +41,24 @@ + int j = pos.getY(); + int k = pos.getZ(); + +- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) ++ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) + { + boolean flag = (i + j + k & 1) == 1; + boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1; + int l = 0; + +- if (this.canCatchFire(worldIn, pos.up())) ++ if (this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) + { + l = flag ? 1 : 2; + } + +- return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west()))).withProperty(UPPER, Integer.valueOf(l)).withProperty(FLIP, Boolean.valueOf(flag1)).withProperty(ALT, Boolean.valueOf(flag)); ++ return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH))) ++ .withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east(), EnumFacing.EAST ))) ++ .withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH))) ++ .withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST ))) ++ .withProperty(UPPER, Integer.valueOf(l)) ++ .withProperty(FLIP, Boolean.valueOf(flag1)) ++ .withProperty(ALT, Boolean.valueOf(flag)); + } + else + { +@@ -108,6 +114,7 @@ + + public void setFireInfo(Block blockIn, int encouragement, int flammability) + { ++ if (blockIn == Blocks.air) throw new IllegalArgumentException("Tried to set air on fire... This is bad."); + this.encouragements.put(blockIn, Integer.valueOf(encouragement)); + this.flammabilities.put(blockIn, Integer.valueOf(flammability)); + } +@@ -147,13 +154,8 @@ + } + + Block block = worldIn.getBlockState(pos.down()).getBlock(); +- boolean flag = block == Blocks.netherrack; ++ boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP); + +- if (worldIn.provider instanceof WorldProviderEnd && block == Blocks.bedrock) +- { +- flag = true; +- } +- + if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos)) + { + worldIn.setBlockToAir(pos); +@@ -182,7 +184,7 @@ + return; + } + +- if (!this.canCatchFire(worldIn, pos.down()) && i == 15 && rand.nextInt(4) == 0) ++ if (!this.canCatchFire(worldIn, pos.down(), EnumFacing.UP) && i == 15 && rand.nextInt(4) == 0) + { + worldIn.setBlockToAir(pos); + return; +@@ -197,12 +199,12 @@ + j = -50; + } + +- this.catchOnFire(worldIn, pos.east(), 300 + j, rand, i); +- this.catchOnFire(worldIn, pos.west(), 300 + j, rand, i); +- this.catchOnFire(worldIn, pos.down(), 250 + j, rand, i); +- this.catchOnFire(worldIn, pos.up(), 250 + j, rand, i); +- this.catchOnFire(worldIn, pos.north(), 300 + j, rand, i); +- this.catchOnFire(worldIn, pos.south(), 300 + j, rand, i); ++ this.tryCatchFire(worldIn, pos.east(), 300 + j, rand, i, EnumFacing.WEST); ++ this.tryCatchFire(worldIn, pos.west(), 300 + j, rand, i, EnumFacing.EAST); ++ this.tryCatchFire(worldIn, pos.down(), 250 + j, rand, i, EnumFacing.UP); ++ this.tryCatchFire(worldIn, pos.up(), 250 + j, rand, i, EnumFacing.DOWN); ++ this.tryCatchFire(worldIn, pos.north(), 300 + j, rand, i, EnumFacing.SOUTH); ++ this.tryCatchFire(worldIn, pos.south(), 300 + j, rand, i, EnumFacing.NORTH); + + for (int k = -1; k <= 1; ++k) + { +@@ -261,22 +263,30 @@ + return false; + } + ++ @Deprecated // Use Block.getFlammability + public int getFlammability(Block blockIn) + { + Integer integer = (Integer)this.flammabilities.get(blockIn); + return integer == null ? 0 : integer.intValue(); + } + ++ @Deprecated // Use Block.getFlammability + public int getEncouragement(Block blockIn) + { + Integer integer = (Integer)this.encouragements.get(blockIn); + return integer == null ? 0 : integer.intValue(); + } + ++ @Deprecated // Use tryCatchFire with face below + private void catchOnFire(World worldIn, BlockPos pos, int chance, Random random, int age) + { +- int i = this.getFlammability(worldIn.getBlockState(pos).getBlock()); ++ this.tryCatchFire(worldIn, pos, chance, random, age, EnumFacing.UP); ++ } + ++ private void tryCatchFire(World worldIn, BlockPos pos, int chance, Random random, int age, EnumFacing face) ++ { ++ int i = worldIn.getBlockState(pos).getBlock().getFlammability(worldIn, pos, face); ++ + if (random.nextInt(chance) < i) + { + IBlockState iblockstate = worldIn.getBlockState(pos); +@@ -308,7 +318,7 @@ + { + for (EnumFacing enumfacing : EnumFacing.values()) + { +- if (this.canCatchFire(worldIn, pos.offset(enumfacing))) ++ if (this.canCatchFire(worldIn, pos.offset(enumfacing), enumfacing.getOpposite())) + { + return true; + } +@@ -329,7 +339,7 @@ + + for (EnumFacing enumfacing : EnumFacing.values()) + { +- i = Math.max(this.getEncouragement(worldIn.getBlockState(pos.offset(enumfacing)).getBlock()), i); ++ i = Math.max(worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getFlammability(worldIn, pos.offset(enumfacing), enumfacing.getOpposite()), i); + } + + return i; +@@ -341,9 +351,10 @@ + return false; + } + ++ @Deprecated // Use canCatchFire with face sensitive version below + public boolean canCatchFire(IBlockAccess worldIn, BlockPos pos) + { +- return this.getEncouragement(worldIn.getBlockState(pos).getBlock()) > 0; ++ return canCatchFire(worldIn, pos, EnumFacing.UP); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) +@@ -382,9 +393,9 @@ + worldIn.playSound((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false); + } + +- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) ++ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) + { +- if (Blocks.fire.canCatchFire(worldIn, pos.west())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.west(), EnumFacing.EAST)) + { + for (int j = 0; j < 2; ++j) + { +@@ -395,7 +406,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.east())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.east(), EnumFacing.WEST)) + { + for (int k = 0; k < 2; ++k) + { +@@ -406,7 +417,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.north())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH)) + { + for (int l = 0; l < 2; ++l) + { +@@ -417,7 +428,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.south())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH)) + { + for (int i1 = 0; i1 < 2; ++i1) + { +@@ -428,7 +439,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.up())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) + { + for (int j1 = 0; j1 < 2; ++j1) + { +@@ -476,4 +487,19 @@ + { + return new BlockState(this, new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER, FLIP, ALT}); + } ++ ++ /*================================= Forge Start ======================================*/ ++ /** ++ * Side sensitive version that calls the block function. ++ * ++ * @param world The current world ++ * @param pos Block position ++ * @param face The side the fire is coming from ++ * @return True if the face can catch fire. ++ */ ++ public boolean canCatchFire(IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ return world.getBlockState(pos).getBlock().isFlammable(world, pos, face); ++ } ++ /*================================= Forge Start ======================================*/ + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch new file mode 100644 index 0000000000..d4e12c92cb --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch @@ -0,0 +1,48 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java +@@ -169,13 +169,6 @@ + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { +- TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); +- +- if (tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(tileentityflowerpot.getFlowerPotItem(), 1, tileentityflowerpot.getFlowerPotData())); +- } +- + super.breakBlock(worldIn, pos, state); + } + +@@ -395,6 +388,31 @@ + return EnumWorldBlockLayer.CUTOUT; + } + ++ ++ /*============================FORGE START=====================================*/ ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = super.getDrops(world, pos, state, fortune); ++ TileEntityFlowerPot te = world.getTileEntity(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)world.getTileEntity(pos) : null; ++ if (te != null && te.getFlowerPotItem() != null) ++ ret.add(new ItemStack(te.getFlowerPotItem(), 1, te.getFlowerPotData())); ++ return ret; ++ } ++ @Override ++ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) ++ { ++ if (willHarvest) return true; //If it will harvest, delay deletion of the block until after getDrops ++ return super.removedByPlayer(world, pos, player, willHarvest); ++ } ++ @Override ++ public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) ++ { ++ super.harvestBlock(world, player, pos, state, te); ++ world.setBlockToAir(pos); ++ } ++ /*===========================FORGE END==========================================*/ ++ + public static enum EnumFlowerType implements IStringSerializable + { + EMPTY("empty"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch new file mode 100644 index 0000000000..b373fbe3aa --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockGrass.java ++++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java +@@ -58,7 +58,7 @@ + { + if (!worldIn.isRemote) + { +- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) ++ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) + { + worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); + } +@@ -72,7 +72,7 @@ + Block block = worldIn.getBlockState(blockpos.up()).getBlock(); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + +- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) ++ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2) + { + worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState()); + } +@@ -110,7 +110,7 @@ + { + if (j >= i / 16) + { +- if (worldIn.getBlockState(blockpos1).getBlock().blockMaterial == Material.air) ++ if (worldIn.isAirBlock(blockpos1)) + { + if (rand.nextInt(8) == 0) + { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch new file mode 100644 index 0000000000..4034822ae1 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java ++++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java +@@ -79,6 +79,20 @@ + return new BlockState(this, new IProperty[] {VARIANT}); + } + ++ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) ++ { ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("variant")) ++ { ++ world.setBlockState(pos, state.cycleProperty(prop)); ++ return true; ++ } ++ } ++ return false; ++ } ++ + public static enum EnumType implements IStringSerializable + { + NORTH_WEST(1, "north_west"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch new file mode 100644 index 0000000000..c1631128c5 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockIce.java ++++ ../src-work/minecraft/net/minecraft/block/BlockIce.java +@@ -38,14 +38,17 @@ + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + player.addExhaustion(0.025F); + +- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) ++ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) + { ++ java.util.List items = new java.util.ArrayList(); + ItemStack itemstack = this.createStackedBlock(state); + +- if (itemstack != null) +- { +- spawnAsEntity(worldIn, pos, itemstack); +- } ++ if (itemstack != null) items.add(itemstack); ++ ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); ++ ++ for (ItemStack is : items) ++ spawnAsEntity(worldIn, pos, is); + } + else + { +@@ -56,7 +59,9 @@ + } + + int i = EnchantmentHelper.getFortuneModifier(player); ++ harvesters.set(player); + this.dropBlockAsItem(worldIn, pos, state, i); ++ harvesters.set(null); + Material material = worldIn.getBlockState(pos.down()).getBlock().getMaterial(); + + if (material.blocksMovement() || material.isLiquid()) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch new file mode 100644 index 0000000000..a6e6780658 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch @@ -0,0 +1,30 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockLadder.java ++++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java +@@ -78,7 +78,10 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos.west()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.east()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.north()).getBlock().isNormalCube() ? true : worldIn.getBlockState(pos.south()).getBlock().isNormalCube())); ++ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST, true) || ++ worldIn.isSideSolid(pos.east(), EnumFacing.WEST, true) || ++ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH, true) || ++ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH, true); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) +@@ -116,7 +119,7 @@ + + protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing) + { +- return worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock().isNormalCube(); ++ return worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing, true); + } + + public IBlockState getStateFromMeta(int meta) +@@ -146,4 +149,6 @@ + { + return new BlockState(this, new IProperty[] {FACING}); + } ++ ++ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch new file mode 100644 index 0000000000..e1c41a698a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch @@ -0,0 +1,126 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java ++++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java +@@ -18,7 +18,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public abstract class BlockLeaves extends BlockLeavesBase ++public abstract class BlockLeaves extends BlockLeavesBase implements net.minecraftforge.common.IShearable + { + public static final PropertyBool DECAYABLE = PropertyBool.create("decayable"); + public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay"); +@@ -75,9 +75,9 @@ + BlockPos blockpos = pos.add(j1, k1, l1); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + +- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(CHECK_DECAY)).booleanValue()) ++ if (iblockstate.getBlock().isLeaves(worldIn, blockpos)) + { +- worldIn.setBlockState(blockpos, iblockstate.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4); ++ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos); + } + } + } +@@ -117,9 +117,9 @@ + { + Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2)).getBlock(); + +- if (block != Blocks.log && block != Blocks.log2) ++ if (!block.canSustainLeaves(worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2))) + { +- if (block.getMaterial() == Material.leaves) ++ if (block.isLeaves(worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2))) + { + this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2; + } +@@ -226,40 +226,7 @@ + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) +- { +- int i = this.getSaplingDropChance(state); +- +- if (fortune > 0) +- { +- i -= 2 << fortune; +- +- if (i < 10) +- { +- i = 10; +- } +- } +- +- if (worldIn.rand.nextInt(i) == 0) +- { +- Item item = this.getItemDropped(state, worldIn.rand, fortune); +- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); +- } +- +- i = 200; +- +- if (fortune > 0) +- { +- i -= 10 << fortune; +- +- if (i < 40) +- { +- i = 40; +- } +- } +- +- this.dropApple(worldIn, pos, state, i); +- } ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + + protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) +@@ -296,4 +263,48 @@ + } + + public abstract BlockPlanks.EnumType getWoodType(int meta); ++ ++ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } ++ @Override public boolean isLeaves(IBlockAccess world, BlockPos pos){ return true; } ++ ++ @Override ++ public void beginLeavesDecay(World world, BlockPos pos) ++ { ++ IBlockState state = world.getBlockState(pos); ++ if (!(Boolean)state.getValue(CHECK_DECAY)) ++ { ++ world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4); ++ } ++ } ++ ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = new java.util.ArrayList(); ++ Random rand = world instanceof World ? ((World)world).rand : new Random(); ++ int chance = this.getSaplingDropChance(state); ++ ++ if (fortune > 0) ++ { ++ chance -= 2 << fortune; ++ if (chance < 10) chance = 10; ++ } ++ ++ if (rand.nextInt(chance) == 0) ++ ret.add(new ItemStack(getItemDropped(state, rand, fortune), 1, damageDropped(state))); ++ ++ chance = 200; ++ if (fortune > 0) ++ { ++ chance -= 10 << fortune; ++ if (chance < 40) chance = 40; ++ } ++ ++ this.captureDrops(true); ++ if (world instanceof World) ++ this.dropApple((World)world, pos, state, chance); // Dammet mojang ++ ret.addAll(this.captureDrops(false)); ++ return ret; ++ } ++ + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch new file mode 100644 index 0000000000..21869253d1 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockLever.java ++++ ../src-work/minecraft/net/minecraft/block/BlockLever.java +@@ -237,6 +237,12 @@ + return new BlockState(this, new IProperty[] {FACING, POWERED}); + } + ++ ++ private boolean canAttach(World world, BlockPos pos, EnumFacing side) ++ { ++ return world.isSideSolid(pos, side); ++ } ++ + public static enum EnumOrientation implements IStringSerializable + { + DOWN_X(0, "down_x", EnumFacing.DOWN), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch new file mode 100644 index 0000000000..e1ad4d6e70 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockLog.java ++++ ../src-work/minecraft/net/minecraft/block/BlockLog.java +@@ -33,9 +33,9 @@ + { + IBlockState iblockstate = worldIn.getBlockState(blockpos); + +- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(BlockLeaves.CHECK_DECAY)).booleanValue()) ++ if (iblockstate.getBlock().isLeaves(worldIn, blockpos)) + { +- worldIn.setBlockState(blockpos, iblockstate.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4); ++ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos); + } + } + } +@@ -46,6 +46,9 @@ + return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(LOG_AXIS, BlockLog.EnumAxis.fromFacingAxis(facing.getAxis())); + } + ++ @Override public boolean canSustainLeaves(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } ++ @Override public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } ++ + public static enum EnumAxis implements IStringSerializable + { + X("x"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch new file mode 100644 index 0000000000..1ea021a24c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java ++++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java +@@ -37,10 +37,14 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); +- int i = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15); +- this.dropXpOnBlockBreak(worldIn, pos, i); + } + ++ @Override ++ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); ++ } ++ + public boolean isOpaqueCube() + { + return false; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch new file mode 100644 index 0000000000..c8f6e6acd2 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java ++++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java +@@ -71,7 +71,7 @@ + if (pos.getY() >= 0 && pos.getY() < 256) + { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); +- return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate.getBlock())); ++ return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate.getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this)); + } + else + { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch new file mode 100644 index 0000000000..774ac70798 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java ++++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java +@@ -39,7 +39,7 @@ + { + if (!worldIn.isRemote) + { +- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) ++ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) + { + worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); + } +@@ -53,7 +53,7 @@ + IBlockState iblockstate = worldIn.getBlockState(blockpos); + Block block = worldIn.getBlockState(blockpos.up()).getBlock(); + +- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) ++ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2) + { + worldIn.setBlockState(blockpos, this.getDefaultState()); + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch new file mode 100644 index 0000000000..1640b0ea13 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch @@ -0,0 +1,49 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java ++++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java +@@ -38,7 +38,7 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return super.canBlockStay(worldIn, pos, state); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) +@@ -54,9 +54,11 @@ + super.updateTick(worldIn, pos, state, rand); + } + ++ @SuppressWarnings("unused") + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); ++ if (false && !worldIn.isRemote) + { + int i = 1; + +@@ -107,4 +109,24 @@ + { + return new BlockState(this, new IProperty[] {AGE}); + } ++ ++ @Override ++ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = new java.util.ArrayList(); ++ Random rand = world instanceof World ? ((World)world).rand : new Random(); ++ int count = 1; ++ ++ if (((Integer)state.getValue(AGE)) >= 3) ++ { ++ count = 2 + rand.nextInt(3) + (fortune > 0 ? rand.nextInt(fortune + 1) : 0); ++ } ++ ++ for (int i = 0; i < count; i++) ++ { ++ ret.add(new ItemStack(Items.nether_wart)); ++ } ++ ++ return ret; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch new file mode 100644 index 0000000000..4696ecb981 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java ++++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java +@@ -99,14 +99,15 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4)); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } ++ ++ @Override ++ public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ IBlockState state = world.getBlockState(pos); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4))); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch new file mode 100644 index 0000000000..f93eeb4289 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockNote.java ++++ ../src-work/minecraft/net/minecraft/block/BlockNote.java +@@ -58,7 +58,9 @@ + if (tileentity instanceof TileEntityNote) + { + TileEntityNote tileentitynote = (TileEntityNote)tileentity; ++ int old = tileentitynote.note; + tileentitynote.changePitch(); ++ if (old == tileentitynote.note) return false; + tileentitynote.triggerNote(worldIn, pos); + playerIn.triggerAchievement(StatList.field_181735_S); + } +@@ -98,6 +100,10 @@ + + public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) + { ++ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(worldIn, pos, state, eventParam, eventID); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false; ++ eventID = e.instrument.ordinal(); ++ eventParam = e.getVanillaNoteId(); + float f = (float)Math.pow(2.0D, (double)(eventParam - 12) / 12.0D); + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "note." + this.getInstrument(eventID), 3.0F, f); + worldIn.spawnParticle(EnumParticleTypes.NOTE, (double)pos.getX() + 0.5D, (double)pos.getY() + 1.2D, (double)pos.getZ() + 0.5D, (double)eventParam / 24.0D, 0.0D, 0.0D, new int[0]); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch new file mode 100644 index 0000000000..efca433f42 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java ++++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java +@@ -142,11 +142,17 @@ + if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata())); + } + else + { + super.harvestBlock(worldIn, player, pos, state, te); + } + } ++ ++ @Override ++ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) ++ { ++ IBlockState state = world.getBlockState(pos); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata()))); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch new file mode 100644 index 0000000000..28763cd3ca --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch @@ -0,0 +1,51 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockOre.java ++++ ../src-work/minecraft/net/minecraft/block/BlockOre.java +@@ -58,34 +58,40 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); +- +- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) ++ } ++ @Override ++ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ IBlockState state = world.getBlockState(pos); ++ Random rand = world instanceof World ? ((World)world).rand : new Random(); ++ if (this.getItemDropped(state, rand, fortune) != Item.getItemFromBlock(this)) + { + int i = 0; + + if (this == Blocks.coal_ore) + { +- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 0, 2); ++ i = MathHelper.getRandomIntegerInRange(rand, 0, 2); + } + else if (this == Blocks.diamond_ore) + { +- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); ++ i = MathHelper.getRandomIntegerInRange(rand, 3, 7); + } + else if (this == Blocks.emerald_ore) + { +- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); ++ i = MathHelper.getRandomIntegerInRange(rand, 3, 7); + } + else if (this == Blocks.lapis_ore) + { +- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); ++ i = MathHelper.getRandomIntegerInRange(rand, 2, 5); + } + else if (this == Blocks.quartz_ore) + { +- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); ++ i = MathHelper.getRandomIntegerInRange(rand, 2, 5); + } + +- this.dropXpOnBlockBreak(worldIn, pos, i); ++ return i; + } ++ return 0; + } + + public int getDamageValue(World worldIn, BlockPos pos) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch new file mode 100644 index 0000000000..c5061c08f0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch @@ -0,0 +1,41 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPane.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPane.java +@@ -38,7 +38,10 @@ + + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { +- return state.withProperty(NORTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()))).withProperty(SOUTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()))).withProperty(WEST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()))).withProperty(EAST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()))); ++ return state.withProperty(NORTH, canPaneConnectTo(worldIn, pos, EnumFacing.NORTH)) ++ .withProperty(SOUTH, canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH)) ++ .withProperty(WEST, canPaneConnectTo(worldIn, pos, EnumFacing.WEST)) ++ .withProperty(EAST, canPaneConnectTo(worldIn, pos, EnumFacing.EAST)); + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) +@@ -64,10 +67,10 @@ + + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { +- boolean flag = this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()); +- boolean flag1 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()); +- boolean flag2 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()); +- boolean flag3 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()); ++ boolean flag = this.canPaneConnectTo(worldIn, pos, EnumFacing.NORTH); ++ boolean flag1 = this.canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH); ++ boolean flag2 = this.canPaneConnectTo(worldIn, pos, EnumFacing.WEST); ++ boolean flag3 = this.canPaneConnectTo(worldIn, pos, EnumFacing.EAST); + + if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) + { +@@ -186,4 +189,11 @@ + { + return new BlockState(this, new IProperty[] {NORTH, EAST, WEST, SOUTH}); + } ++ ++ public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir) ++ { ++ BlockPos off = pos.offset(dir); ++ Block block = world.getBlockState(off).getBlock(); ++ return canPaneConnectToBlock(block) || block.isSideSolid(world, off, dir.getOpposite()); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch new file mode 100644 index 0000000000..c696444afe --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java +@@ -189,7 +189,7 @@ + } + } + +- if (!flag1 && block.getMaterial() != Material.air && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) ++ if (!flag1 && !block.isAir(worldIn, blockpos) && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) + { + this.doMove(worldIn, pos, enumfacing, false); + } +@@ -333,7 +333,7 @@ + return false; + } + +- return !(blockIn instanceof ITileEntityProvider); ++ return !(blockIn.hasTileEntity(worldIn.getBlockState(pos))); + } + else + { +@@ -371,7 +371,9 @@ + { + BlockPos blockpos = (BlockPos)list1.get(j); + Block block = worldIn.getBlockState(blockpos).getBlock(); +- block.dropBlockAsItem(worldIn, blockpos, worldIn.getBlockState(blockpos), 0); ++ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. ++ float chance = block instanceof BlockSnow ? -1.0f : 1.0f; ++ block.dropBlockAsItemWithChance(worldIn, blockpos, worldIn.getBlockState(blockpos), chance, 0); + worldIn.setBlockToAir(blockpos); + --i; + ablock[i] = block; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch new file mode 100644 index 0000000000..c1bf64fbd4 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java +@@ -109,16 +109,7 @@ + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) +- { +- TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); +- +- if (tileentitypiston != null) +- { +- IBlockState iblockstate = tileentitypiston.getPistonState(); +- iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0); +- } +- } ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +@@ -282,4 +273,16 @@ + { + return new BlockState(this, new IProperty[] {FACING, TYPE}); + } ++ ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ TileEntityPiston tileentitypiston = this.getTileEntity(world, pos); ++ if (tileentitypiston != null) ++ { ++ IBlockState pushed = tileentitypiston.getPistonState(); ++ return pushed.getBlock().getDrops(world, pos, pushed, fortune); ++ } ++ return new java.util.ArrayList(); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch new file mode 100644 index 0000000000..7c4e2d1991 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch @@ -0,0 +1,25 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPotato.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java +@@ -22,13 +22,14 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); +- +- if (!worldIn.isRemote) +- { +- if (((Integer)state.getValue(AGE)).intValue() >= 7 && worldIn.rand.nextInt(50) == 0) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(Items.poisonous_potato)); +- } +- } + } ++ @Override ++ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = super.getDrops(world, pos, state, fortune); ++ java.util.Random rand = world instanceof World ? ((World)world).rand : new java.util.Random(); ++ if (((Integer)state.getValue(AGE)) >= 7 && rand.nextInt(50) == 0) ++ ret.add(new ItemStack(Items.poisonous_potato)); ++ return ret; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch new file mode 100644 index 0000000000..6d75c0f947 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java +@@ -115,7 +115,7 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); ++ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch new file mode 100644 index 0000000000..413d42a6f4 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockQuartz.java ++++ ../src-work/minecraft/net/minecraft/block/BlockQuartz.java +@@ -90,6 +90,26 @@ + return new BlockState(this, new IProperty[] {VARIANT}); + } + ++ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) ++ { ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("variant") && prop.getValueClass() == EnumType.class) ++ { ++ EnumType current = (EnumType)state.getValue(prop); ++ EnumType next = current == EnumType.LINES_X ? EnumType.LINES_Y : ++ current == EnumType.LINES_Y ? EnumType.LINES_Z : ++ current == EnumType.LINES_Z ? EnumType.LINES_X : current; ++ if (next == current) ++ return false; ++ world.setBlockState(pos, state.withProperty(prop, next)); ++ return true; ++ } ++ } ++ return false; ++ } ++ + public static enum EnumType implements IStringSerializable + { + DEFAULT(0, "default", "default"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch new file mode 100644 index 0000000000..8dea2624ef --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch @@ -0,0 +1,147 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRailBase.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRailBase.java +@@ -31,7 +31,7 @@ + public static boolean isRailBlock(IBlockState state) + { + Block block = state.getBlock(); +- return block == Blocks.rail || block == Blocks.golden_rail || block == Blocks.detector_rail || block == Blocks.activator_rail; ++ return block instanceof BlockRailBase; + } + + protected BlockRailBase(boolean isPowered) +@@ -175,6 +175,81 @@ + + public abstract IProperty getShapeProperty(); + ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * Return true if the rail can make corners. ++ * Used by placement logic. ++ * @param world The world. ++ * @param pod Block's position in world ++ * @return True if the rail can make corners. ++ */ ++ public boolean isFlexibleRail(IBlockAccess world, BlockPos pos) ++ { ++ return !this.isPowered; ++ } ++ ++ /** ++ * Returns true if the rail can make up and down slopes. ++ * Used by placement logic. ++ * @param world The world. ++ * @param pod Block's position in world ++ * @return True if the rail can make slopes. ++ */ ++ public boolean canMakeSlopes(IBlockAccess world, BlockPos pos) ++ { ++ return true; ++ } ++ ++ /** ++ * Returns the max speed of the rail at the specified position. ++ * @param world The world. ++ * @param cart The cart on the rail, may be null. ++ * @param pod Block's position in world ++ * @return The max speed of the current rail. ++ */ ++ public float getRailMaxSpeed(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos) ++ { ++ return 0.4f; ++ } ++ ++ /** ++ * This function is called by any minecart that passes over this rail. ++ * It is called once per update tick that the minecart is on the rail. ++ * @param world The world. ++ * @param cart The cart on the rail. ++ * @param pod Block's position in world ++ */ ++ public void onMinecartPass(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos) ++ { ++ } ++ ++ /** ++ * Rotate the block. For vanilla blocks this rotates around the axis passed in (generally, it should be the "face" that was hit). ++ * Note: for mod blocks, this is up to the block and modder to decide. It is not mandated that it be a rotation around the ++ * face, but could be a rotation to orient *to* that face, or a visiting of possible rotations. ++ * The method should return true if the rotation was successful though. ++ * ++ * @param world The world ++ * @param pos Block position in world ++ * @param axis The axis to rotate around ++ * @return True if the rotation was successful, False if the rotation failed, or is not possible ++ */ ++ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) ++ { ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("shape")) ++ { ++ world.setBlockState(pos, state.cycleProperty(prop)); ++ return true; ++ } ++ } ++ return false; ++ } ++ ++ /* ======================================== FORGE END =====================================*/ ++ + public static enum EnumRailDirection implements IStringSerializable + { + NORTH_SOUTH(0, "north_south"), +@@ -245,6 +320,7 @@ + private IBlockState state; + private final boolean isPowered; + private final List field_150657_g = Lists.newArrayList(); ++ private final boolean canMakeSlopes; + + public Rail(World worldIn, BlockPos pos, IBlockState state) + { +@@ -253,7 +329,8 @@ + this.state = state; + this.block = (BlockRailBase)state.getBlock(); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(BlockRailBase.this.getShapeProperty()); +- this.isPowered = this.block.isPowered; ++ this.isPowered = !this.block.isFlexibleRail(worldIn, pos); ++ canMakeSlopes = this.block.canMakeSlopes(worldIn, pos); + this.func_180360_a(blockrailbase$enumraildirection); + } + +@@ -439,7 +516,7 @@ + } + } + +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos.up())) + { +@@ -452,7 +529,7 @@ + } + } + +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) + { +@@ -595,7 +672,7 @@ + } + } + +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos.up())) + { +@@ -608,7 +685,7 @@ + } + } + +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) + { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch new file mode 100644 index 0000000000..6799d4271b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java +@@ -295,6 +295,21 @@ + return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(POWERED, Boolean.valueOf(false)).withProperty(MODE, BlockRedstoneComparator.Mode.COMPARE); + } + ++ @Override ++ public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) ++ { ++ if (pos.getY() == neighbor.getY() && world instanceof World) ++ { ++ onNeighborBlockChange((World)world, pos, world.getBlockState(pos), world.getBlockState(neighbor).getBlock()); ++ } ++ } ++ ++ @Override ++ public boolean getWeakChanges(IBlockAccess world, BlockPos pos) ++ { ++ return true; ++ } ++ + public static enum Mode implements IStringSerializable + { + COMPARE("compare"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch new file mode 100644 index 0000000000..f165b66c88 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java +@@ -198,6 +198,8 @@ + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + BlockPos blockpos = pos.offset(enumfacing.getOpposite()); ++ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldIn, pos, worldIn.getBlockState(pos), java.util.EnumSet.of(enumfacing.getOpposite())).isCanceled()) ++ return; + worldIn.notifyBlockOfStateChange(blockpos, this); + worldIn.notifyNeighborsOfStateExcept(blockpos, this, enumfacing); + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch new file mode 100644 index 0000000000..61ff6434e5 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java +@@ -91,12 +91,16 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); ++ } + +- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) ++ @Override ++ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ if (this.getItemDropped(world.getBlockState(pos), RANDOM, fortune) != Item.getItemFromBlock(this)) + { +- int i = 1 + worldIn.rand.nextInt(5); +- this.dropXpOnBlockBreak(worldIn, pos, i); ++ return 1 + RANDOM.nextInt(5); + } ++ return 0; + } + + @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch new file mode 100644 index 0000000000..9e635ef051 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch @@ -0,0 +1,59 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java +@@ -58,10 +58,10 @@ + BlockPos blockpos = pos.offset(direction); + Block block = worldIn.getBlockState(pos.offset(direction)).getBlock(); + +- if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (block.isBlockNormalCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down())))) ++ if (!canRestoneConnect(worldIn, blockpos, direction) && (block.isBlockNormalCube() || !canRestoneConnect(worldIn, blockpos.down(), null))) + { + Block block1 = worldIn.getBlockState(pos.up()).getBlock(); +- return !block1.isBlockNormalCube() && block.isBlockNormalCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; ++ return !block1.isBlockNormalCube() && block.isBlockNormalCube() && canRestoneConnect(worldIn, blockpos.up(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; + } + else + { +@@ -359,35 +359,24 @@ + Block block = iblockstate.getBlock(); + boolean flag = block.isNormalCube(); + boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); +- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down()))); ++ return !flag1 && flag && canRestoneConnect(worldIn, blockpos.up(), null) ? true : (canRestoneConnect(worldIn, blockpos, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canRestoneConnect(worldIn, blockpos.down(), null))); + } + +- protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos) ++ protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side) + { +- return canConnectUpwardsTo(worldIn.getBlockState(pos)); +- } +- +- protected static boolean canConnectUpwardsTo(IBlockState state) +- { +- return canConnectTo(state, (EnumFacing)null); +- } +- +- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) +- { +- Block block = blockState.getBlock(); +- +- if (block == Blocks.redstone_wire) ++ IBlockState state = world.getBlockState(pos); ++ if (state.getBlock() == Blocks.redstone_wire) + { + return true; + } +- else if (Blocks.unpowered_repeater.isAssociated(block)) ++ else if (Blocks.unpowered_repeater.isAssociated(state.getBlock())) + { +- EnumFacing enumfacing = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING); +- return enumfacing == side || enumfacing.getOpposite() == side; ++ EnumFacing direction = (EnumFacing)state.getValue(BlockRedstoneRepeater.FACING); ++ return direction == side || direction.getOpposite() == side; + } + else + { +- return block.canProvidePower() && side != null; ++ return state.getBlock().canConnectRedstone(world, pos, side); + } + } + diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch new file mode 100644 index 0000000000..a6e2c2ae8b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockReed.java ++++ ../src-work/minecraft/net/minecraft/block/BlockReed.java +@@ -18,7 +18,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class BlockReed extends Block ++public class BlockReed extends Block implements net.minecraftforge.common.IPlantable + { + public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); + +@@ -65,6 +65,7 @@ + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos.down()).getBlock(); ++ if (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this)) return true; + + if (block == this) + { +@@ -164,4 +165,15 @@ + { + return new BlockState(this, new IProperty[] {AGE}); + } ++ ++ @Override ++ public net.minecraftforge.common.EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) ++ { ++ return net.minecraftforge.common.EnumPlantType.Beach; ++ } ++ @Override ++ public IBlockState getPlant(IBlockAccess world, BlockPos pos) ++ { ++ return this.getDefaultState(); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch new file mode 100644 index 0000000000..e450bf9074 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRotatedPillar.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRotatedPillar.java +@@ -18,4 +18,18 @@ + { + super(p_i46385_1_, p_i46385_2_); + } ++ ++ public boolean rotateBlock(net.minecraft.world.World world, net.minecraft.util.BlockPos pos, EnumFacing axis) ++ { ++ net.minecraft.block.state.IBlockState state = world.getBlockState(pos); ++ for (net.minecraft.block.properties.IProperty prop : state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("axis")) ++ { ++ world.setBlockState(pos, state.cycleProperty(prop)); ++ return true; ++ } ++ } ++ return false; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch new file mode 100644 index 0000000000..ce119c1ba8 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockSapling.java ++++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java +@@ -71,6 +71,7 @@ + + public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand) + { ++ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) return; + WorldGenerator worldgenerator = (WorldGenerator)(rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true)); + int i = 0; + int j = 0; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch new file mode 100644 index 0000000000..abe2893df2 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch @@ -0,0 +1,57 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockSkull.java ++++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java +@@ -121,10 +121,6 @@ + return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).getSkullType() : super.getDamageValue(worldIn, pos); + } + +- public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) +- { +- } +- + public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) + { + if (player.capabilities.isCreativeMode) +@@ -132,13 +128,18 @@ + state = state.withProperty(NODROP, Boolean.valueOf(true)); + worldIn.setBlockState(pos, state, 4); + } ++ this.dropBlockAsItem(worldIn, pos, state, 0); + + super.onBlockHarvested(worldIn, pos, state, player); + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { +- if (!worldIn.isRemote) ++ super.breakBlock(worldIn, pos, state); ++ } ++ public java.util.List getDrops(IBlockAccess worldIn, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = new java.util.ArrayList(); + { + if (!((Boolean)state.getValue(NODROP)).booleanValue()) + { +@@ -147,7 +148,7 @@ + if (tileentity instanceof TileEntitySkull) + { + TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; +- ItemStack itemstack = new ItemStack(Items.skull, 1, this.getDamageValue(worldIn, pos)); ++ ItemStack itemstack = new ItemStack(Items.skull, 1, tileentityskull.getSkullType()); + + if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null) + { +@@ -157,12 +158,11 @@ + itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound); + } + +- spawnAsEntity(worldIn, pos, itemstack); ++ ret.add(itemstack); + } + } +- +- super.breakBlock(worldIn, pos, state); + } ++ return ret; + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch new file mode 100644 index 0000000000..f6b830de37 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch @@ -0,0 +1,38 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockSlab.java ++++ ../src-work/minecraft/net/minecraft/block/BlockSlab.java +@@ -91,6 +91,17 @@ + return this.isDouble(); + } + ++ @Override ++ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ if ( isOpaqueCube() ) ++ return true; ++ ++ // face is on the block being rendered, not this block. ++ EnumBlockHalf side = world.getBlockState(pos).getValue(HALF); ++ return (side == EnumBlockHalf.TOP && face == EnumFacing.DOWN) || (side == EnumBlockHalf.BOTTOM && face == EnumFacing.UP); ++ } ++ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + IBlockState iblockstate = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM); +@@ -118,15 +129,8 @@ + { + return false; + } +- else +- { +- BlockPos blockpos = pos.offset(side.getOpposite()); +- IBlockState iblockstate = worldIn.getBlockState(pos); +- IBlockState iblockstate1 = worldIn.getBlockState(blockpos); +- boolean flag = isSlab(iblockstate.getBlock()) && iblockstate.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP; +- boolean flag1 = isSlab(iblockstate1.getBlock()) && iblockstate1.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP; +- return flag1 ? (side == EnumFacing.DOWN ? true : (side == EnumFacing.UP && super.shouldSideBeRendered(worldIn, pos, side) ? true : !isSlab(iblockstate.getBlock()) || !flag)) : (side == EnumFacing.UP ? true : (side == EnumFacing.DOWN && super.shouldSideBeRendered(worldIn, pos, side) ? true : !isSlab(iblockstate.getBlock()) || flag)); +- } ++ // additional logic breaks doesSideBlockRendering and is no longer useful. ++ return super.shouldSideBeRendered(worldIn, pos, side); + } + + @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch new file mode 100644 index 0000000000..99b5ece864 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch @@ -0,0 +1,53 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockSnow.java ++++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java +@@ -79,7 +79,7 @@ + { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); + Block block = iblockstate.getBlock(); +- return block != Blocks.ice && block != Blocks.packed_ice ? (block.getMaterial() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; ++ return block != Blocks.ice && block != Blocks.packed_ice ? (block.isLeaves(worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; + } + + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) +@@ -91,7 +91,6 @@ + { + if (!this.canPlaceBlockAt(worldIn, pos)) + { +- this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + return false; + } +@@ -103,9 +102,8 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0)); ++ super.harvestBlock(worldIn, player, pos, state, te); + worldIn.setBlockToAir(pos); +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) +@@ -115,14 +113,13 @@ + + public int quantityDropped(Random random) + { +- return 0; ++ return 1; + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11) + { +- this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0); + worldIn.setBlockToAir(pos); + } + } +@@ -152,4 +149,6 @@ + { + return new BlockState(this, new IProperty[] {LAYERS}); + } ++ ++ @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.getValue(LAYERS)) + 1; } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch new file mode 100644 index 0000000000..33a74a3c22 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockStairs.java ++++ ../src-work/minecraft/net/minecraft/block/BlockStairs.java +@@ -68,6 +68,19 @@ + return false; + } + ++ @Override ++ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ if ( isOpaqueCube() ) ++ return true; ++ ++ // face is on the block being rendered, not this block. ++ IBlockState iblockstate = world.getBlockState(pos); ++ EnumHalf half = iblockstate.getValue(HALF); ++ EnumFacing side = iblockstate.getValue(FACING); ++ return side == face.getOpposite() || (half == EnumHalf.TOP && face == EnumFacing.DOWN) || (half == EnumHalf.BOTTOM && face == EnumFacing.UP); ++ } ++ + public boolean isFullCube() + { + return false; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch new file mode 100644 index 0000000000..41d70ce17d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockStem.java ++++ ../src-work/minecraft/net/minecraft/block/BlockStem.java +@@ -94,7 +94,7 @@ + pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand)); + Block block = worldIn.getBlockState(pos.down()).getBlock(); + +- if (worldIn.getBlockState(pos).getBlock().blockMaterial == Material.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass)) ++ if (worldIn.isAirBlock(pos) && (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this) || block == Blocks.dirt || block == Blocks.grass)) + { + worldIn.setBlockState(pos, this.crop.getDefaultState()); + } +@@ -148,8 +148,12 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); ++ } + +- if (!worldIn.isRemote) ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = new java.util.ArrayList(); + { + Item item = this.getSeedItem(); + +@@ -159,13 +163,14 @@ + + for (int j = 0; j < 3; ++j) + { +- if (worldIn.rand.nextInt(15) <= i) ++ if (RANDOM.nextInt(15) <= i) + { +- spawnAsEntity(worldIn, pos, new ItemStack(item)); ++ ret.add(new ItemStack(item)); + } + } + } + } ++ return ret; + } + + protected Item getSeedItem() diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch new file mode 100644 index 0000000000..d0a3b75f39 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch @@ -0,0 +1,66 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTallGrass.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTallGrass.java +@@ -23,7 +23,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class BlockTallGrass extends BlockBush implements IGrowable ++public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable + { + public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockTallGrass.EnumType.class); + +@@ -43,7 +43,7 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return super.canBlockStay(worldIn, pos, state); + } + + public boolean isReplaceable(World worldIn, BlockPos pos) +@@ -53,7 +53,7 @@ + + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { +- return rand.nextInt(8) == 0 ? Items.wheat_seeds : null; ++ return null; + } + + public int quantityDroppedWithBonus(int fortune, Random random) +@@ -63,13 +63,7 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta())); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } +@@ -204,4 +198,22 @@ + } + } + } ++ ++ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } ++ @Override ++ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) ++ { ++ List ret = new java.util.ArrayList(); ++ ret.add(new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)world.getBlockState(pos).getValue(TYPE)).getMeta())); ++ return ret; ++ } ++ @Override ++ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ List ret = new java.util.ArrayList(); ++ if (RANDOM.nextInt(8) != 0) return ret; ++ ItemStack seed = net.minecraftforge.common.ForgeHooks.getGrassSeed(RANDOM); ++ if (seed != null) ret.add(seed); ++ return ret; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch new file mode 100644 index 0000000000..83c0fc29c7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch @@ -0,0 +1,38 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTorch.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java +@@ -63,7 +63,7 @@ + else + { + Block block = worldIn.getBlockState(pos).getBlock(); +- return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block == Blocks.stained_glass; ++ return block.canPlaceTorchOnTop(worldIn, pos); + } + } + +@@ -84,7 +84,7 @@ + { + BlockPos blockpos = pos.offset(facing.getOpposite()); + boolean flag = facing.getAxis().isHorizontal(); +- return flag && worldIn.isBlockNormalCube(blockpos, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos); ++ return flag && worldIn.isSideSolid(blockpos, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) +@@ -97,7 +97,7 @@ + { + for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) + { +- if (worldIn.isBlockNormalCube(pos.offset(enumfacing.getOpposite()), true)) ++ if (worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) + { + return this.getDefaultState().withProperty(FACING, enumfacing); + } +@@ -130,7 +130,7 @@ + EnumFacing enumfacing1 = enumfacing.getOpposite(); + boolean flag = false; + +- if (enumfacing$axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true)) ++ if (enumfacing$axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing, true)) + { + flag = true; + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch new file mode 100644 index 0000000000..7de11cc755 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch @@ -0,0 +1,43 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java +@@ -25,6 +25,8 @@ + + public class BlockTrapDoor extends Block + { ++ /** Set this to allow trapdoors to remain free-floating */ ++ public static boolean disableValidation = false; + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + public static final PropertyBool OPEN = PropertyBool.create("open"); + public static final PropertyEnum HALF = PropertyEnum.create("half", BlockTrapDoor.DoorHalf.class); +@@ -140,9 +142,10 @@ + { + if (!worldIn.isRemote) + { ++ EnumFacing direction = (EnumFacing)state.getValue(FACING); + BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()); + +- if (!isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock())) ++ if (!(isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock()) || worldIn.isSideSolid(blockpos, direction, true))) + { + worldIn.setBlockToAir(pos); + this.dropBlockAsItem(worldIn, pos, state, 0); +@@ -186,7 +189,10 @@ + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { +- return !side.getAxis().isVertical() && isValidSupportBlock(worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock()); ++ if (disableValidation) return true; ++ EnumFacing dir = side.getOpposite(); ++ pos = pos.offset(dir); ++ return !side.getAxis().isVertical() && (isValidSupportBlock(worldIn.getBlockState(pos).getBlock()) || worldIn.isSideSolid(pos, side, true)); + } + + protected static EnumFacing getFacing(int meta) +@@ -223,6 +229,7 @@ + + private static boolean isValidSupportBlock(Block blockIn) + { ++ if (disableValidation) return true; + return blockIn.blockMaterial.isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs; + } + diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch new file mode 100644 index 0000000000..a8de6b96ff --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java +@@ -58,14 +58,14 @@ + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { +- return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock().isNormalCube(); ++ return side.getAxis().isHorizontal() && worldIn.isSideSolid(pos.offset(side.getOpposite()), side, true); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) + { +- if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube()) ++ if (worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true)) + { + return true; + } +@@ -99,7 +99,7 @@ + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + +- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock().isNormalCube()) ++ if (!worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch new file mode 100644 index 0000000000..a3536a8504 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch @@ -0,0 +1,40 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockVine.java ++++ ../src-work/minecraft/net/minecraft/block/BlockVine.java +@@ -25,7 +25,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class BlockVine extends Block ++public class BlockVine extends Block implements net.minecraftforge.common.IShearable + { + public static final PropertyBool UP = PropertyBool.create("up"); + public static final PropertyBool NORTH = PropertyBool.create("north"); +@@ -387,13 +387,7 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0)); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } +@@ -474,4 +468,14 @@ + + return i; + } ++ /*************************FORGE START***********************************/ ++ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity){ return true; } ++ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } ++ @Override ++ public java.util.List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return java.util.Arrays.asList(new ItemStack(this, 1)); ++ } ++ /*************************FORGE END***********************************/ ++ + } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch new file mode 100644 index 0000000000..a9bcee491d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java ++++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java +@@ -78,7 +78,7 @@ + { + Block block = this.world.getBlockState(origin).getBlock(); + +- if (block.getMaterial() == Material.air) ++ if (block.isAir(world, origin)) + { + return true; + } +@@ -109,7 +109,7 @@ + BlockPos blockpos = origin.offset(this.moveDirection.getOpposite(), i); + block = this.world.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() == Material.air || !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) ++ if (block.isAir(world, blockpos)|| !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) + { + break; + } +@@ -156,7 +156,7 @@ + + block = this.world.getBlockState(blockpos1).getBlock(); + +- if (block.getMaterial() == Material.air) ++ if (block.isAir(world, blockpos1)) + { + return true; + } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockState.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockState.java.patch new file mode 100644 index 0000000000..3572047363 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/state/BlockState.java.patch @@ -0,0 +1,53 @@ +--- ../src-base/minecraft/net/minecraft/block/state/BlockState.java ++++ ../src-work/minecraft/net/minecraft/block/state/BlockState.java +@@ -38,6 +38,16 @@ + + public BlockState(Block blockIn, IProperty... properties) + { ++ this(blockIn, properties, null); ++ } ++ ++ protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) ++ { ++ return new StateImplementation(block, properties); ++ } ++ ++ protected BlockState(Block blockIn, IProperty[] properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) ++ { + this.block = blockIn; + Arrays.sort(properties, new Comparator() + { +@@ -53,7 +63,7 @@ + for (List list1 : Cartesian.cartesianProduct(this.getAllowedValues())) + { + Map map1 = MapPopulator.createMap(this.properties, list1); +- BlockState.StateImplementation blockstate$stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map1)); ++ BlockState.StateImplementation blockstate$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map1), unlistedProperties); + map.put(map1, blockstate$stateimplementation); + list.add(blockstate$stateimplementation); + } +@@ -132,6 +142,13 @@ + } + } + ++ protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable) ++ { ++ this.block = blockIn; ++ this.properties = propertiesIn; ++ this.propertyValueTable = propertyValueTable; ++ } ++ + public , V extends T> IBlockState withProperty(IProperty property, V value) + { + if (!this.properties.containsKey(property)) +@@ -199,5 +216,10 @@ + map.put(property, value); + return map; + } ++ ++ public ImmutableTable getPropertyValueTable() ++ { ++ return propertyValueTable; ++ } + } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch new file mode 100644 index 0000000000..a8c5028636 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/block/state/BlockStateBase.java ++++ ../src-work/minecraft/net/minecraft/block/state/BlockStateBase.java +@@ -67,4 +67,9 @@ + + return stringbuilder.toString(); + } ++ ++ public com.google.common.collect.ImmutableTable getPropertyValueTable() ++ { ++ return null; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch b/patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch new file mode 100644 index 0000000000..e666d37fe5 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/ClientBrandRetriever.java ++++ ../src-work/minecraft/net/minecraft/client/ClientBrandRetriever.java +@@ -8,6 +8,6 @@ + { + public static String getClientModName() + { +- return "vanilla"; ++ return net.minecraftforge.fml.common.FMLCommonHandler.instance().getModName(); + } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch new file mode 100644 index 0000000000..093758d5b0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch @@ -0,0 +1,26 @@ +--- ../src-base/minecraft/net/minecraft/client/LoadingScreenRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/LoadingScreenRenderer.java +@@ -139,6 +139,10 @@ + GlStateManager.clear(16640); + } + ++ try ++ { ++ if (!net.minecraftforge.fml.client.FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) //FML Don't render while FML's pre-screen is rendering ++ { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); +@@ -174,6 +178,12 @@ + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + this.mc.fontRendererObj.drawStringWithShadow(this.currentlyDisplayedText, (float)((k - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2), (float)(l / 2 - 4 - 16), 16777215); + this.mc.fontRendererObj.drawStringWithShadow(this.message, (float)((k - this.mc.fontRendererObj.getStringWidth(this.message)) / 2), (float)(l / 2 - 4 + 8), 16777215); ++ } ++ } ++ catch (java.io.IOException e) ++ { ++ com.google.common.base.Throwables.propagate(e); ++ } //FML End + this.framebuffer.unbindFramebuffer(); + + if (OpenGlHelper.isFramebufferEnabled()) diff --git a/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch b/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch new file mode 100644 index 0000000000..352354a013 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch @@ -0,0 +1,459 @@ +--- ../src-base/minecraft/net/minecraft/client/Minecraft.java ++++ ../src-work/minecraft/net/minecraft/client/Minecraft.java +@@ -301,7 +301,6 @@ + this.sessionService = (new YggdrasilAuthenticationService(gameConfig.userInfo.proxy, UUID.randomUUID().toString())).createMinecraftSessionService(); + this.session = gameConfig.userInfo.session; + logger.info("Setting user: " + this.session.getUsername()); +- logger.info("(Session ID is " + this.session.getSessionID() + ")"); + this.isDemo = gameConfig.gameInfo.isDemo; + this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1; + this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1; +@@ -415,10 +414,10 @@ + this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_); + this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language); + this.mcResourceManager.registerReloadListener(this.mcLanguageManager); +- this.refreshResources(); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.defaultResourcePacks, this.mcResourceManager); + this.renderEngine = new TextureManager(this.mcResourceManager); + this.mcResourceManager.registerReloadListener(this.renderEngine); +- this.drawSplashScreen(this.renderEngine); ++ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.renderEngine); + this.initStream(); + this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); + this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves")); +@@ -453,6 +452,8 @@ + } + }); + this.mouseHelper = new MouseHelper(); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar= net.minecraftforge.fml.common.ProgressManager.push("Rendering Setup", 5, true); ++ bar.step("GL Setup"); + this.checkGLError("Pre startup"); + GlStateManager.enableTexture2D(); + GlStateManager.shadeModel(7425); +@@ -466,17 +467,21 @@ + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + this.checkGLError("Startup"); +- this.textureMapBlocks = new TextureMap("textures"); ++ bar.step("Loading Texture Map"); ++ this.textureMapBlocks = new TextureMap("textures",true); + this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels); + this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks); + this.renderEngine.bindTexture(TextureMap.locationBlocksTexture); + this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0); ++ bar.step("Loading Model Manager"); + this.modelManager = new ModelManager(this.textureMapBlocks); + this.mcResourceManager.registerReloadListener(this.modelManager); ++ bar.step("Loading Item Renderer"); + this.renderItem = new RenderItem(this.renderEngine, this.modelManager); + this.renderManager = new RenderManager(this.renderEngine, this.renderItem); + this.itemRenderer = new ItemRenderer(this); + this.mcResourceManager.registerReloadListener(this.renderItem); ++ bar.step("Loading Entity Renderer"); + this.entityRenderer = new EntityRenderer(this, this.mcResourceManager); + this.mcResourceManager.registerReloadListener(this.entityRenderer); + this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.gameSettings); +@@ -486,22 +491,25 @@ + this.guiAchievement = new GuiAchievement(this); + GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight); + this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading(); + this.checkGLError("Post startup"); +- this.ingameGUI = new GuiIngame(this); ++ this.ingameGUI = new net.minecraftforge.client.GuiIngameForge(this); + + if (this.serverName != null) + { +- this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort)); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.serverName, this.serverPort); + } + else + { + this.displayGuiScreen(new GuiMainMenu()); + } + +- this.renderEngine.deleteTexture(this.mojangLogo); ++ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(renderEngine, mojangLogo); + this.mojangLogo = null; + this.loadingScreen = new LoadingScreenRenderer(this); + ++ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete(); + if (this.gameSettings.fullScreen && !this.fullscreen) + { + this.toggleFullscreen(); +@@ -681,21 +689,23 @@ + File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); + Bootstrap.printToSYSOUT(crashReportIn.getCompleteReport()); + ++ int retVal; + if (crashReportIn.getFile() != null) + { + Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + crashReportIn.getFile()); +- System.exit(-1); ++ retVal = -1; + } + else if (crashReportIn.saveToFile(file2)) + { + Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); +- System.exit(-1); ++ retVal = -1; + } + else + { + Bootstrap.printToSYSOUT("#@?@# Game crashed! Crash report could not be saved. #@?@#"); +- System.exit(-2); ++ retVal = -2; + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleExit(retVal); + } + + public boolean isUnicode() +@@ -883,11 +893,6 @@ + + public void displayGuiScreen(GuiScreen guiScreenIn) + { +- if (this.currentScreen != null) +- { +- this.currentScreen.onGuiClosed(); +- } +- + if (guiScreenIn == null && this.theWorld == null) + { + guiScreenIn = new GuiMainMenu(); +@@ -897,6 +902,17 @@ + guiScreenIn = new GuiGameOver(); + } + ++ GuiScreen old = this.currentScreen; ++ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(guiScreenIn); ++ ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; ++ ++ guiScreenIn = event.gui; ++ if (old != null && guiScreenIn != old) ++ { ++ old.onGuiClosed(); ++ } ++ + if (guiScreenIn instanceof GuiMainMenu) + { + this.gameSettings.showDebugInfo = false; +@@ -1030,9 +1046,11 @@ + + if (!this.skipRenderWorld) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.timer.renderPartialTicks); + this.mcProfiler.endStartSection("gameRenderer"); + this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks, i); + this.mcProfiler.endSection(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.timer.renderPartialTicks); + } + + this.mcProfiler.endSection(); +@@ -1377,7 +1395,7 @@ + + if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit)) + { +- this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit); ++ this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver); + this.thePlayer.swingItem(); + } + } +@@ -1463,15 +1481,19 @@ + case BLOCK: + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + +- if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air) ++ if (!this.theWorld.isAirBlock(blockpos)) + { + int i = itemstack != null ? itemstack.stackSize : 0; + ++ ++ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.theWorld, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec).isCanceled(); ++ if (result) { //Forge: Kept separate to simplify patch + if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec)) + { + flag = false; + this.thePlayer.swingItem(); + } ++ } + + if (itemstack == null) + { +@@ -1494,7 +1516,8 @@ + { + ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); + +- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) ++ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, theWorld, null, null, null).isCanceled(); ++ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) + { + this.entityRenderer.itemRenderer.resetEquippedProgress2(); + } +@@ -1598,6 +1621,8 @@ + --this.rightClickDelayTimer; + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreClientTick(); ++ + this.mcProfiler.startSection("gui"); + + if (!this.isGamePaused) +@@ -1690,6 +1715,8 @@ + + while (Mouse.next()) + { ++ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; ++ + int i = Mouse.getEventButton(); + KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); + +@@ -1745,6 +1772,7 @@ + this.currentScreen.handleMouseInput(); + } + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput(); + } + + if (this.leftClickCounter > 0) +@@ -1923,6 +1951,7 @@ + } + } + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput(); + } + + for (int l = 0; l < 9; ++l) +@@ -2119,12 +2148,15 @@ + this.myNetworkManager.processReceivedPackets(); + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick(); ++ + this.mcProfiler.endSection(); + this.systemTime = getSystemTime(); + } + + public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn) + { ++ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(folderName, worldName, worldSettingsIn); + this.loadWorld((WorldClient)null); + System.gc(); + ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); +@@ -2160,6 +2192,12 @@ + + while (!this.theIntegratedServer.serverIsInRunLoop()) + { ++ if (!net.minecraftforge.fml.common.StartupQuery.check()) ++ { ++ loadWorld(null); ++ displayGuiScreen(null); ++ return; ++ } + String s = this.theIntegratedServer.getUserMessage(); + + if (s != null) +@@ -2185,8 +2223,14 @@ + SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); + NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); + networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); +- networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); +- networkmanager.sendPacket(new C00PacketLoginStart(this.getSession().getProfile())); ++ networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true)); ++ com.mojang.authlib.GameProfile gameProfile = this.getSession().getProfile(); ++ if (!this.getSession().hasCachedProperties()) ++ { ++ gameProfile = sessionService.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. ++ this.getSession().setProperties(gameProfile.getProperties()); ++ } ++ networkmanager.sendPacket(new C00PacketLoginStart(gameProfile)); + this.myNetworkManager = networkmanager; + } + +@@ -2197,6 +2241,8 @@ + + public void loadWorld(WorldClient worldClientIn, String loadingMessage) + { ++ if (theWorld != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(theWorld)); ++ + if (worldClientIn == null) + { + NetHandlerPlayClient nethandlerplayclient = this.getNetHandler(); +@@ -2210,6 +2256,18 @@ + { + this.theIntegratedServer.initiateShutdown(); + this.theIntegratedServer.setStaticInstance(); ++ if (loadingScreen != null) ++ { ++ this.loadingScreen.displayLoadingString(I18n.format("forge.client.shutdown.internal")); ++ } ++ while (!theIntegratedServer.isServerStopped()) ++ { ++ try ++ { ++ Thread.sleep(10); ++ } ++ catch (InterruptedException ie) {} ++ } + } + + this.theIntegratedServer = null; +@@ -2232,6 +2290,7 @@ + this.ingameGUI.func_181029_i(); + this.setServerData((ServerData)null); + this.integratedServerIsRunning = false; ++ net.minecraftforge.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.theWorld); + } + + this.mcSoundHandler.stopSounds(); +@@ -2336,126 +2395,10 @@ + if (this.objectMouseOver != null) + { + boolean flag = this.thePlayer.capabilities.isCreativeMode; +- int i = 0; +- boolean flag1 = false; +- TileEntity tileentity = null; +- Item item; +- +- if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) +- { +- BlockPos blockpos = this.objectMouseOver.getBlockPos(); +- Block block = this.theWorld.getBlockState(blockpos).getBlock(); +- +- if (block.getMaterial() == Material.air) +- { +- return; +- } +- +- item = block.getItem(this.theWorld, blockpos); +- +- if (item == null) +- { +- return; +- } +- +- if (flag && GuiScreen.isCtrlKeyDown()) +- { +- tileentity = this.theWorld.getTileEntity(blockpos); +- } +- +- Block block1 = item instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem(item) : block; +- i = block1.getDamageValue(this.theWorld, blockpos); +- flag1 = item.getHasSubtypes(); +- } +- else +- { +- if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) +- { +- return; +- } +- +- if (this.objectMouseOver.entityHit instanceof EntityPainting) +- { +- item = Items.painting; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) +- { +- item = Items.lead; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) +- { +- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; +- ItemStack itemstack = entityitemframe.getDisplayedItem(); +- +- if (itemstack == null) +- { +- item = Items.item_frame; +- } +- else +- { +- item = itemstack.getItem(); +- i = itemstack.getMetadata(); +- flag1 = true; +- } +- } +- else if (this.objectMouseOver.entityHit instanceof EntityMinecart) +- { +- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; +- +- switch (entityminecart.getMinecartType()) +- { +- case FURNACE: +- item = Items.furnace_minecart; +- break; +- case CHEST: +- item = Items.chest_minecart; +- break; +- case TNT: +- item = Items.tnt_minecart; +- break; +- case HOPPER: +- item = Items.hopper_minecart; +- break; +- case COMMAND_BLOCK: +- item = Items.command_block_minecart; +- break; +- default: +- item = Items.minecart; +- } +- } +- else if (this.objectMouseOver.entityHit instanceof EntityBoat) +- { +- item = Items.boat; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) +- { +- item = Items.armor_stand; +- } +- else +- { +- item = Items.spawn_egg; +- i = EntityList.getEntityID(this.objectMouseOver.entityHit); +- flag1 = true; +- +- if (!EntityList.entityEggs.containsKey(Integer.valueOf(i))) +- { +- return; +- } +- } +- } +- + InventoryPlayer inventoryplayer = this.thePlayer.inventory; + +- if (tileentity == null) +- { +- inventoryplayer.setCurrentItem(item, i, flag1, flag); +- } +- else +- { +- ItemStack itemstack1 = this.func_181036_a(item, i, tileentity); +- inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1); +- } +- ++ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld)) return; ++ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions + if (flag) + { + int j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + inventoryplayer.currentItem; +@@ -2756,18 +2699,8 @@ + + public static int getGLMaximumTextureSize() + { +- for (int i = 16384; i > 0; i >>= 1) +- { +- GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)((ByteBuffer)null)); +- int j = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); +- +- if (j != 0) +- { +- return i; +- } +- } +- +- return -1; ++ //Forge we redirect this to our code which caches the value before any splash screen stuff is done. ++ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize(); + } + + public boolean isSnooperEnabled() diff --git a/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch new file mode 100644 index 0000000000..3d4c138169 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -0,0 +1,41 @@ +--- ../src-base/minecraft/net/minecraft/client/audio/SoundManager.java ++++ ../src-work/minecraft/net/minecraft/client/audio/SoundManager.java +@@ -69,6 +69,7 @@ + { + SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); + SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundSetupEvent(this)); + } + catch (SoundSystemException soundsystemexception) + { +@@ -80,6 +81,7 @@ + { + this.unloadSoundSystem(); + this.loadSoundSystem(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundLoadEvent(this)); + } + + private synchronized void loadSoundSystem() +@@ -316,6 +318,9 @@ + } + else + { ++ sound = net.minecraftforge.client.ForgeHooksClient.playSound(this, sound); ++ if (sound == null) return; ++ + SoundEventAccessorComposite soundeventaccessorcomposite = this.sndHandler.getSound(sound.getSoundLocation()); + + if (soundeventaccessorcomposite == null) +@@ -357,10 +362,12 @@ + if (soundpoolentry.isStreamingSound()) + { + this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, sound, s)); + } + else + { + this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, sound, s)); + } + + logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.getSoundPoolEntryLocation(), soundeventaccessorcomposite.getSoundEventLocation(), s}); diff --git a/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch new file mode 100644 index 0000000000..840d193e0f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java ++++ ../src-work/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java +@@ -128,6 +128,6 @@ + f *= 1.0F - f1 * 0.15F; + } + +- return f; ++ return net.minecraftforge.client.ForgeHooksClient.getOffsetFOV(this, f); + } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch new file mode 100644 index 0000000000..42c1d46058 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -0,0 +1,71 @@ +--- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java ++++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java +@@ -345,6 +345,15 @@ + this.mc.ingameGUI.getChatGUI().printChatMessage(chatComponent); + } + ++ private boolean isHeadspaceFree(BlockPos pos, int height) ++ { ++ for (int y = 0; y < height; y++) ++ { ++ if (isOpenBlockSpace(pos.add(0, y, 0))) return false; ++ } ++ return true; ++ } ++ + protected boolean pushOutOfBlocks(double x, double y, double z) + { + if (this.noClip) +@@ -357,30 +366,34 @@ + double d0 = x - (double)blockpos.getX(); + double d1 = z - (double)blockpos.getZ(); + +- if (!this.isOpenBlockSpace(blockpos)) ++ int entHeight = Math.max(Math.round(this.height), 1); ++ ++ boolean inTranslucentBlock = this.isHeadspaceFree(blockpos, entHeight); ++ ++ if (inTranslucentBlock) + { + int i = -1; + double d2 = 9999.0D; + +- if (this.isOpenBlockSpace(blockpos.west()) && d0 < d2) ++ if (!this.isHeadspaceFree(blockpos.west(), entHeight) && d0 < d2) + { + d2 = d0; + i = 0; + } + +- if (this.isOpenBlockSpace(blockpos.east()) && 1.0D - d0 < d2) ++ if (!this.isHeadspaceFree(blockpos.east(), entHeight) && 1.0D - d0 < d2) + { + d2 = 1.0D - d0; + i = 1; + } + +- if (this.isOpenBlockSpace(blockpos.north()) && d1 < d2) ++ if (!this.isHeadspaceFree(blockpos.north(), entHeight) && d1 < d2) + { + d2 = d1; + i = 4; + } + +- if (this.isOpenBlockSpace(blockpos.south()) && 1.0D - d1 < d2) ++ if (!this.isHeadspaceFree(blockpos.south(), entHeight) && 1.0D - d1 < d2) + { + d2 = 1.0D - d1; + i = 5; +@@ -448,6 +461,12 @@ + + public void playSound(String name, float volume, float pitch) + { ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, name, volume, pitch); ++ if (event.isCanceled() || event.name == null) return; ++ name = event.name; ++ volume = event.newVolume; ++ pitch = event.newPitch; ++ + this.worldObj.playSound(this.posX, this.posY, this.posZ, name, volume, pitch, false); + } + diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch new file mode 100644 index 0000000000..dff19271b4 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch @@ -0,0 +1,156 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/FontRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/gui/FontRenderer.java +@@ -57,7 +57,7 @@ + this.locationFontTexture = location; + this.renderEngine = textureManagerIn; + this.unicodeFlag = unicode; +- textureManagerIn.bindTexture(this.locationFontTexture); ++ bindTexture(this.locationFontTexture); + + for (int i = 0; i < 32; ++i) + { +@@ -97,6 +97,7 @@ + public void onResourceManagerReload(IResourceManager resourceManager) + { + this.readFontTexture(); ++ this.readGlyphSizes(); + } + + private void readFontTexture() +@@ -105,7 +106,7 @@ + + try + { +- bufferedimage = TextureUtil.readBufferedImage(Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture).getInputStream()); ++ bufferedimage = TextureUtil.readBufferedImage(getResourceInputStream(this.locationFontTexture)); + } + catch (IOException ioexception) + { +@@ -165,7 +166,7 @@ + + try + { +- inputstream = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin")).getInputStream(); ++ inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin")); + inputstream.read(this.glyphWidth); + } + catch (IOException ioexception) +@@ -196,7 +197,7 @@ + int i = ch % 16 * 8; + int j = ch / 16 * 8; + int k = italic ? 1 : 0; +- this.renderEngine.bindTexture(this.locationFontTexture); ++ bindTexture(this.locationFontTexture); + int l = this.charWidth[ch]; + float f = (float)l - 0.01F; + GL11.glBegin(GL11.GL_TRIANGLE_STRIP); +@@ -224,7 +225,7 @@ + + private void loadGlyphTexture(int page) + { +- this.renderEngine.bindTexture(this.getUnicodePageLocation(page)); ++ bindTexture(this.getUnicodePageLocation(page)); + } + + protected float renderUnicodeChar(char ch, boolean italic) +@@ -271,7 +272,7 @@ + + public int drawString(String text, float x, float y, int color, boolean dropShadow) + { +- GlStateManager.enableAlpha(); ++ enableAlpha(); + this.resetStyles(); + int i; + +@@ -341,7 +342,7 @@ + + int j1 = this.colorCode[i1]; + this.textColor = j1; +- GlStateManager.color((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.alpha); ++ setColor((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.alpha); + } + else if (i1 == 16) + { +@@ -370,7 +371,7 @@ + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; +- GlStateManager.color(this.red, this.blue, this.green, this.alpha); ++ setColor(this.red, this.blue, this.green, this.alpha); + } + + ++i; +@@ -398,7 +399,7 @@ + c0 = c1; + } + +- float f1 = this.unicodeFlag ? 0.5F : 1.0F; ++ float f1 = j == -1 || this.unicodeFlag ? 0.5f : 1f; + boolean flag = (c0 == 0 || j == -1 || this.unicodeFlag) && shadow; + + if (flag) +@@ -436,7 +437,16 @@ + + ++f; + } ++ doDraw(f); ++ } ++ } ++ } + ++ protected void doDraw(float f) ++ { ++ { ++ { ++ + if (this.strikethroughStyle) + { + Tessellator tessellator = Tessellator.getInstance(); +@@ -509,7 +519,7 @@ + this.blue = (float)(color >> 8 & 255) / 255.0F; + this.green = (float)(color & 255) / 255.0F; + this.alpha = (float)(color >> 24 & 255) / 255.0F; +- GlStateManager.color(this.red, this.blue, this.green, this.alpha); ++ setColor(this.red, this.blue, this.green, this.alpha); + this.posX = x; + this.posY = y; + this.renderStringAtPos(text, dropShadow); +@@ -588,11 +598,6 @@ + int j = this.glyphWidth[character] >>> 4; + int k = this.glyphWidth[character] & 15; + +- if (k > 7) +- { +- k = 15; +- j = 0; +- } + + ++k; + return (k - j) / 2 + 1; +@@ -846,6 +851,26 @@ + return this.bidiFlag; + } + ++ protected void setColor(float r, float g, float b, float a) ++ { ++ GlStateManager.color(r,g,b,a); ++ } ++ ++ protected void enableAlpha() ++ { ++ GlStateManager.enableAlpha(); ++ } ++ ++ protected void bindTexture(ResourceLocation location) ++ { ++ renderEngine.bindTexture(location); ++ } ++ ++ protected InputStream getResourceInputStream(ResourceLocation location) throws IOException ++ { ++ return Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream(); ++ } ++ + public int getColorCode(char character) + { + return this.colorCode["0123456789abcdef".indexOf(character)]; diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch new file mode 100644 index 0000000000..ee9c091800 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java +@@ -21,6 +21,7 @@ + public boolean enabled; + public boolean visible; + protected boolean hovered; ++ public int packedFGColour; //FML + + public GuiButton(int buttonId, int x, int y, String buttonText) + { +@@ -74,6 +75,11 @@ + this.mouseDragged(mc, mouseX, mouseY); + int j = 14737632; + ++ if (packedFGColour != 0) ++ { ++ j = packedFGColour; ++ } ++ else + if (!this.enabled) + { + j = 10526880; diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch new file mode 100644 index 0000000000..56a8b7f493 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch @@ -0,0 +1,39 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java +@@ -215,13 +215,14 @@ + this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(stringbuilder.toString()), 1); + } + +- this.inputField.writeText((String)this.foundPlayerNames.get(this.autocompleteIndex++)); ++ this.inputField.writeText(net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes((String)this.foundPlayerNames.get(this.autocompleteIndex++))); + } + + private void sendAutocompleteRequest(String p_146405_1_, String p_146405_2_) + { + if (p_146405_1_.length() >= 1) + { ++ net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_146405_1_, p_146405_2_); + BlockPos blockpos = null; + + if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) +@@ -281,6 +282,12 @@ + this.playerNamesFound = false; + this.foundPlayerNames.clear(); + ++ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete; ++ if (complete != null) ++ { ++ p_146406_1_ = com.google.common.collect.ObjectArrays.concat(complete, p_146406_1_, String.class); ++ } ++ + for (String s : p_146406_1_) + { + if (s.length() > 0) +@@ -291,6 +298,7 @@ + + String s1 = this.inputField.getText().substring(this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false)); + String s2 = StringUtils.getCommonPrefix(p_146406_1_); ++ s2 = net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes(s2); + + if (s2.length() > 0 && !s1.equalsIgnoreCase(s2)) + { diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch new file mode 100644 index 0000000000..a0dc53077d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch @@ -0,0 +1,36 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java +@@ -205,6 +205,8 @@ + } + } + ++ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress(); ++ + WorldSettings.GameType worldsettings$gametype = WorldSettings.GameType.getByName(this.gameMode); + WorldSettings worldsettings = new WorldSettings(i, worldsettings$gametype, this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]); + worldsettings.setWorldName(this.chunkProviderSettingsJson); +@@ -312,14 +314,7 @@ + } + else if (button.id == 8) + { +- if (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT) +- { +- this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.chunkProviderSettingsJson)); +- } +- else +- { +- this.mc.displayGuiScreen(new GuiCustomizeWorldScreen(this, this.chunkProviderSettingsJson)); +- } ++ WorldType.worldTypes[this.selectedIndex].onCustomizeButton(mc, this); + } + } + } +@@ -371,7 +366,7 @@ + this.btnBonusItems.visible = this.field_146344_y; + this.btnMapType.visible = this.field_146344_y; + this.btnAllowCommands.visible = this.field_146344_y; +- this.btnCustomizeType.visible = this.field_146344_y && (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT || WorldType.worldTypes[this.selectedIndex] == WorldType.CUSTOMIZED); ++ this.btnCustomizeType.visible = this.field_146344_y && WorldType.worldTypes[this.selectedIndex].isCustomizable(); + } + + this.func_146319_h(); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch new file mode 100644 index 0000000000..aef607d2cf --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiIngameMenu.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java +@@ -30,8 +30,9 @@ + + this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + i, I18n.format("menu.returnToGame", new Object[0]))); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.options", new Object[0]))); ++ this.buttonList.add(new GuiButton(12, this.width / 2 + 2, this.height / 4 + 96 + i, 98, 20, I18n.format("fml.menu.modoptions"))); + GuiButton guibutton; +- this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.shareToLan", new Object[0]))); ++ this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 - 100, this.height / 4 + 72 + i, 200, 20, I18n.format("menu.shareToLan", new Object[0]))); + this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.achievements", new Object[0]))); + this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.stats", new Object[0]))); + guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic(); +@@ -74,13 +75,19 @@ + this.mc.setIngameFocus(); + break; + case 5: ++ if (this.mc.thePlayer != null) + this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.getStatFileWriter())); + break; + case 6: ++ if (this.mc.thePlayer != null) + this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); + break; + case 7: + this.mc.displayGuiScreen(new GuiShareToLan(this)); ++ break; ++ case 12: ++ net.minecraftforge.fml.client.FMLClientHandler.instance().showInGameModOptions(this); ++ break; + } + } + diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch new file mode 100644 index 0000000000..264eb0ac2a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java +@@ -223,7 +223,8 @@ + { + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer", new Object[0]))); + this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0]))); +- this.buttonList.add(this.realmsButton = new GuiButton(14, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("menu.online", new Object[0]))); ++ this.buttonList.add(this.realmsButton = new GuiButton(14, this.width / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.format("menu.online", new Object[0]).replace("Minecraft", "").trim())); ++ this.buttonList.add(new GuiButton(6, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.format("fml.menu.mods"))); + } + + private void addDemoButtons(int p_73972_1_, int p_73972_2_) +@@ -271,6 +272,11 @@ + this.mc.shutdown(); + } + ++ if (button.id == 6) ++ { ++ this.mc.displayGuiScreen(new net.minecraftforge.fml.client.GuiModList(this)); ++ } ++ + if (button.id == 11) + { + this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings); +@@ -516,7 +522,16 @@ + s = s + " Demo"; + } + +- this.drawString(this.fontRendererObj, s, 2, this.height - 10, -1); ++ java.util.List brandings = com.google.common.collect.Lists.reverse(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(true)); ++ for (int brdline = 0; brdline < brandings.size(); brdline++) ++ { ++ String brd = brandings.get(brdline); ++ if (!com.google.common.base.Strings.isNullOrEmpty(brd)) ++ { ++ this.drawString(this.fontRendererObj, brd, 2, this.height - ( 10 + brdline * (this.fontRendererObj.FONT_HEIGHT + 1)), 16777215); ++ } ++ } ++ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.fontRendererObj, this.width, this.height); + String s1 = "Copyright Mojang AB. Do not distribute!"; + this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2, this.height - 10, -1); + diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch new file mode 100644 index 0000000000..4e8b2f3eb7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiMultiplayer.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiMultiplayer.java +@@ -40,6 +40,7 @@ + public GuiMultiplayer(GuiScreen parentScreen) + { + this.parentScreen = parentScreen; ++ net.minecraftforge.fml.client.FMLClientHandler.instance().setupServerList(); + } + + public void initGui() +@@ -372,7 +373,7 @@ + + private void connectToServer(ServerData server) + { +- this.mc.displayGuiScreen(new GuiConnecting(this, this.mc, server)); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServer(this, server); + } + + public void selectServer(int index) diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch new file mode 100644 index 0000000000..e0dae1287d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java +@@ -176,6 +176,9 @@ + long l = j - k; + List list = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.getCpu()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GL11.glGetString(GL11.GL_VENDOR)}), GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VERSION)}); + ++ list.add(""); ++ list.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false)); ++ + if (this.isReducedDebug()) + { + return list; diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch new file mode 100644 index 0000000000..7503750725 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch @@ -0,0 +1,107 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java +@@ -143,7 +143,8 @@ + } + } + +- this.drawHoveringText(list, x, y); ++ FontRenderer font = stack.getItem().getFontRenderer(stack); ++ this.drawHoveringText(list, x, y, (font == null ? fontRendererObj : font)); + } + + protected void drawCreativeTabHoveringText(String tabName, int mouseX, int mouseY) +@@ -153,6 +154,11 @@ + + protected void drawHoveringText(List textLines, int x, int y) + { ++ drawHoveringText(textLines, x, y, fontRendererObj); ++ } ++ ++ protected void drawHoveringText(List textLines, int x, int y, FontRenderer font) ++ { + if (!textLines.isEmpty()) + { + GlStateManager.disableRescaleNormal(); +@@ -163,7 +169,7 @@ + + for (String s : textLines) + { +- int j = this.fontRendererObj.getStringWidth(s); ++ int j = font.getStringWidth(s); + + if (j > i) + { +@@ -208,7 +214,7 @@ + for (int k1 = 0; k1 < textLines.size(); ++k1) + { + String s1 = (String)textLines.get(k1); +- this.fontRendererObj.drawStringWithShadow(s1, (float)l1, (float)i2, -1); ++ font.drawStringWithShadow(s1, (float)l1, (float)i2, -1); + + if (k1 == 0) + { +@@ -436,6 +442,7 @@ + { + this.mc.ingameGUI.getChatGUI().addToSentMessages(msg); + } ++ if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(mc.thePlayer, msg) != 0) return; + + this.mc.thePlayer.sendChatMessage(msg); + } +@@ -450,9 +457,15 @@ + + if (guibutton.mousePressed(this.mc, mouseX, mouseY)) + { ++ net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre event = new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre(this, guibutton, this.buttonList); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) ++ break; ++ guibutton = event.button; + this.selectedButton = guibutton; + guibutton.playPressSound(this.mc.getSoundHandler()); + this.actionPerformed(guibutton); ++ if (this.equals(this.mc.currentScreen)) ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Post(this, event.button, this.buttonList)); + } + } + } +@@ -482,8 +495,12 @@ + this.fontRendererObj = mc.fontRendererObj; + this.width = width; + this.height = height; ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.buttonList))) ++ { + this.buttonList.clear(); + this.initGui(); ++ } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.buttonList)); + } + + public void func_183500_a(int p_183500_1_, int p_183500_2_) +@@ -502,7 +519,9 @@ + { + while (Mouse.next()) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Pre(this))) continue; + this.handleMouseInput(); ++ if (this.equals(this.mc.currentScreen)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Post(this)); + } + } + +@@ -510,7 +529,9 @@ + { + while (Keyboard.next()) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Pre(this))) continue; + this.handleKeyboardInput(); ++ if (this.equals(this.mc.currentScreen)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Post(this)); + } + } + } +@@ -570,6 +591,7 @@ + public void drawDefaultBackground() + { + this.drawWorldBackground(0); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this)); + } + + public void drawWorldBackground(int tint) diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch new file mode 100644 index 0000000000..8327deb5fb --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiSelectWorld.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiSelectWorld.java +@@ -186,7 +186,7 @@ + + if (this.mc.getSaveLoader().canLoadWorld(s)) + { +- this.mc.launchIntegratedServer(s, s1, (WorldSettings)null); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(this, s, s1); + } + } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch new file mode 100644 index 0000000000..a179369e29 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiSleepMP.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiSleepMP.java +@@ -32,7 +32,7 @@ + + if (!s.isEmpty()) + { +- this.mc.thePlayer.sendChatMessage(s); ++ this.sendChatMessage(s); // Forge: fix vanilla not adding messages to the sent list while sleeping + } + + this.inputField.setText(""); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch new file mode 100644 index 0000000000..f370344408 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -0,0 +1,39 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java +@@ -181,15 +181,8 @@ + GlStateManager.disableFog(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); +- this.mc.getTextureManager().bindTexture(Gui.optionsBackground); +- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +- float f = 32.0F; +- worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); +- worldrenderer.pos((double)this.left, (double)this.bottom, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); +- worldrenderer.pos((double)this.right, (double)this.bottom, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); +- worldrenderer.pos((double)this.right, (double)this.top, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); +- worldrenderer.pos((double)this.left, (double)this.top, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); +- tessellator.draw(); ++ // Forge: background rendering moved into separate method. ++ this.drawContainerBackground(tessellator); + int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; + int l = this.top + 4 - (int)this.amountScrolled; + +@@ -458,4 +451,18 @@ + { + return this.slotHeight; + } ++ ++ protected void drawContainerBackground(Tessellator tessellator) ++ { ++ WorldRenderer worldrenderer = tessellator.getWorldRenderer(); ++ this.mc.getTextureManager().bindTexture(Gui.optionsBackground); ++ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); ++ float f = 32.0F; ++ worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); ++ worldrenderer.pos((double)this.left, (double)this.bottom, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); ++ worldrenderer.pos((double)this.right, (double)this.bottom, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); ++ worldrenderer.pos((double)this.right, (double)this.top, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); ++ worldrenderer.pos((double)this.left, (double)this.top, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); ++ tessellator.draw(); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch new file mode 100644 index 0000000000..abc8964e46 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java +@@ -73,6 +73,7 @@ + s3 = s4; + } + ++ s3 = FontRenderer.getFormatFromString(s2) + s3; //Forge: Fix chat formatting not surviving line wrapping. + ChatComponentText chatcomponenttext2 = new ChatComponentText(s3); + chatcomponenttext2.setChatStyle(ichatcomponent1.getChatStyle().createShallowCopy()); + list1.add(j + 1, chatcomponenttext2); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch new file mode 100644 index 0000000000..eaedd5e00c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java ++++ ../src-work/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java +@@ -82,7 +82,7 @@ + boolean flag1 = this.field_148301_e.version < 47; + boolean flag2 = flag || flag1; + this.mc.fontRendererObj.drawString(this.field_148301_e.serverName, x + 32 + 3, y + 1, 16777215); +- List list = this.mc.fontRendererObj.listFormattedStringToWidth(this.field_148301_e.serverMOTD, listWidth - 32 - 2); ++ List list = this.mc.fontRendererObj.listFormattedStringToWidth(net.minecraftforge.fml.client.FMLClientHandler.instance().fixDescription(this.field_148301_e.serverMOTD), listWidth - 48 - 2); + + for (int i = 0; i < Math.min(list.size(), 2); ++i) + { +@@ -176,6 +176,11 @@ + int i1 = mouseX - x; + int j1 = mouseY - y; + ++ String tooltip = net.minecraftforge.fml.client.FMLClientHandler.instance().enhanceServerListEntry(this, this.field_148301_e, x, listWidth, y, i1, j1); ++ if (tooltip != null) ++ { ++ this.field_148303_c.setHoveringText(tooltip); ++ } else + if (i1 >= listWidth - 15 && i1 <= listWidth - 5 && j1 >= 0 && j1 <= 8) + { + this.field_148303_c.setHoveringText(s1); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch new file mode 100644 index 0000000000..628bd5b875 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch @@ -0,0 +1,117 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java ++++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java +@@ -49,6 +49,10 @@ + private StatFileWriter statFileWriter; + private boolean loadingAchievements = true; + ++ private int currentPage = -1; ++ private GuiButton button; ++ private java.util.LinkedList minecraftAchievements = new java.util.LinkedList(); ++ + public GuiAchievements(GuiScreen parentScreenIn, StatFileWriter statFileWriterIn) + { + this.parentScreen = parentScreenIn; +@@ -57,6 +61,14 @@ + int j = 141; + this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - i / 2 - 12); + this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - j / 2); ++ minecraftAchievements.clear(); ++ for (Achievement achievement : AchievementList.achievementList) ++ { ++ if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement)) ++ { ++ minecraftAchievements.add(achievement); ++ } ++ } + } + + public void initGui() +@@ -64,6 +76,7 @@ + this.mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS)); + this.buttonList.clear(); + this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0]))); ++ this.buttonList.add(button = new GuiButton(2, (width - field_146555_f) / 2 + 24, height / 2 + 74, 125, 20, net.minecraftforge.common.AchievementPage.getTitle(currentPage))); + } + + protected void actionPerformed(GuiButton button) throws IOException +@@ -74,6 +87,16 @@ + { + this.mc.displayGuiScreen(this.parentScreen); + } ++ ++ if (button.id == 2) ++ { ++ currentPage++; ++ if (currentPage >= net.minecraftforge.common.AchievementPage.getAchievementPages().size()) ++ { ++ currentPage = -1; ++ } ++ this.button.displayString = net.minecraftforge.common.AchievementPage.getTitle(currentPage); ++ } + } + } + +@@ -257,7 +280,9 @@ + GlStateManager.depthFunc(518); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)i1, (float)j1, -200.0F); +- GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 0.0F); ++ // FIXES models rendering weirdly in the acheivements pane ++ // see https://github.com/MinecraftForge/MinecraftForge/commit/1b7ce7592caafb760ec93066184182ae0711e793#commitcomment-10512284 ++ GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 1.0F); + GlStateManager.enableTexture2D(); + GlStateManager.disableLighting(); + GlStateManager.enableRescaleNormal(); +@@ -331,11 +356,12 @@ + GlStateManager.depthFunc(515); + this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND); + +- for (int j5 = 0; j5 < AchievementList.achievementList.size(); ++j5) ++ java.util.List achievementList = (currentPage == -1 ? minecraftAchievements : net.minecraftforge.common.AchievementPage.getAchievementPage(currentPage).getAchievements()); ++ for (int j5 = 0; j5 < achievementList.size(); ++j5) + { +- Achievement achievement1 = (Achievement)AchievementList.achievementList.get(j5); ++ Achievement achievement1 = achievementList.get(j5); + +- if (achievement1.parentAchievement != null) ++ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement)) + { + int k5 = achievement1.displayColumn * 24 - i + 11; + int l5 = achievement1.displayRow * 24 - j + 11; +@@ -389,9 +415,9 @@ + GlStateManager.enableRescaleNormal(); + GlStateManager.enableColorMaterial(); + +- for (int i6 = 0; i6 < AchievementList.achievementList.size(); ++i6) ++ for (int i6 = 0; i6 < achievementList.size(); ++i6) + { +- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(i6); ++ Achievement achievement2 = achievementList.get(i6); + int l6 = achievement2.displayColumn * 24 - i; + int j7 = achievement2.displayRow * 24 - j; + +@@ -432,6 +458,7 @@ + + this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND); + ++ GlStateManager.enableBlend(); // Forge: Specifically enable blend because it is needed here. And we fix Generic RenderItem's leakage of it. + if (achievement2.getSpecial()) + { + this.drawTexturedModalRect(l6 - 2, j7 - 2, 26, 202, 26, 26); +@@ -440,6 +467,7 @@ + { + this.drawTexturedModalRect(l6 - 2, j7 - 2, 0, 202, 26, 26); + } ++ GlStateManager.disableBlend(); //Forge: Cleanup states we set. + + if (!this.statFileWriter.canUnlockAchievement(achievement2)) + { +@@ -448,7 +476,7 @@ + this.itemRender.func_175039_a(false); + } + +- GlStateManager.enableLighting(); ++ GlStateManager.disableLighting(); //Forge: Make sure Lighting is disabled. Fixes MC-33065 + GlStateManager.enableCull(); + this.itemRender.renderItemAndEffectIntoGUI(achievement2.theItemStack, l6 + 3, j7 + 3); + GlStateManager.blendFunc(770, 771); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch new file mode 100644 index 0000000000..7cffb600f4 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch @@ -0,0 +1,69 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiStats.java ++++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiStats.java +@@ -5,6 +5,8 @@ + import java.util.Collections; + import java.util.Comparator; + import java.util.List; ++ ++import net.minecraft.block.Block; + import net.minecraft.client.Minecraft; + import net.minecraft.client.audio.PositionedSoundRecord; + import net.minecraft.client.gui.GuiButton; +@@ -443,17 +445,18 @@ + for (StatCrafting statcrafting : StatList.objectMineStats) + { + boolean flag = false; +- int i = Item.getIdFromItem(statcrafting.func_150959_a()); ++ int i = Block.getIdFromBlock(Block.getBlockFromItem(statcrafting.func_150959_a())); ++ int itemId = Item.getIdFromItem(statcrafting.func_150959_a()); + + if (GuiStats.this.field_146546_t.readStat(statcrafting) > 0) + { + flag = true; + } +- else if (StatList.objectUseStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectUseStats[i]) > 0) ++ else if (StatList.objectUseStats[itemId] != null && GuiStats.this.field_146546_t.readStat(StatList.objectUseStats[itemId]) > 0) + { + flag = true; + } +- else if (StatList.objectCraftStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectCraftStats[i]) > 0) ++ else if (StatList.objectCraftStats[itemId] != null && GuiStats.this.field_146546_t.readStat(StatList.objectCraftStats[itemId]) > 0) + { + flag = true; + } +@@ -468,8 +471,15 @@ + { + public int compare(StatCrafting p_compare_1_, StatCrafting p_compare_2_) + { +- int j = Item.getIdFromItem(p_compare_1_.func_150959_a()); +- int k = Item.getIdFromItem(p_compare_2_.func_150959_a()); ++ int j; ++ int k; ++ if (StatsBlock.this.field_148217_o == 2) { ++ j = Block.getIdFromBlock(Block.getBlockFromItem(p_compare_1_.func_150959_a())); ++ k = Block.getIdFromBlock(Block.getBlockFromItem(p_compare_2_.func_150959_a())); ++ } else { ++ j = Item.getIdFromItem(p_compare_1_.func_150959_a()); ++ k = Item.getIdFromItem(p_compare_2_.func_150959_a()); ++ } + StatBase statbase = null; + StatBase statbase1 = null; + +@@ -748,7 +758,7 @@ + super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, GuiStats.this.fontRendererObj.FONT_HEIGHT * 4); + this.setShowSelectionBox(false); + +- for (EntityList.EntityEggInfo entitylist$entityegginfo : EntityList.entityEggs.values()) ++ for (EntityList.EntityEggInfo entitylist$entityegginfo : com.google.common.collect.Iterables.concat(EntityList.entityEggs.values(), net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().values())) + { + if (GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d) > 0 || GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e) > 0) + { +@@ -784,7 +794,7 @@ + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(entryID); +- String s = I18n.format("entity." + EntityList.getStringFromID(entitylist$entityegginfo.spawnedID) + ".name", new Object[0]); ++ String s = I18n.format("entity." + entitylist$entityegginfo.name + ".name", new Object[0]); + int i = GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d); + int j = GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e); + String s1 = I18n.format("stat.entityKills", new Object[] {Integer.valueOf(i), s}); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch new file mode 100644 index 0000000000..2f5400a117 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch @@ -0,0 +1,70 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java ++++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java +@@ -175,8 +175,11 @@ + GlStateManager.translate(0.0F, 0.0F, 32.0F); + this.zLevel = 200.0F; + this.itemRender.zLevel = 200.0F; ++ net.minecraft.client.gui.FontRenderer font = null; ++ if (stack != null) font = stack.getItem().getFontRenderer(stack); ++ if (font == null) font = fontRendererObj; + this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); +- this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); ++ this.itemRender.renderItemOverlayIntoGUI(font, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); + this.zLevel = 0.0F; + this.itemRender.zLevel = 0.0F; + } +@@ -239,13 +242,12 @@ + + if (itemstack == null) + { +- String s1 = slotIn.getSlotTexture(); ++ TextureAtlasSprite textureatlassprite = slotIn.getBackgroundSprite(); + +- if (s1 != null) ++ if (textureatlassprite != null) + { +- TextureAtlasSprite textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite(s1); + GlStateManager.disableLighting(); +- this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); ++ this.mc.getTextureManager().bindTexture(slotIn.getBackgroundLocation()); + this.drawTexturedModalRect(i, j, textureatlassprite, 16, 16); + GlStateManager.enableLighting(); + flag1 = true; +@@ -326,6 +328,7 @@ + int j = this.guiLeft; + int k = this.guiTop; + boolean flag1 = mouseX < j || mouseY < k || mouseX >= j + this.xSize || mouseY >= k + this.ySize; ++ if (slot != null) flag1 = false; // Forge, prevent dropping of items through slots outside of GUI boundaries + int l = -1; + + if (slot != null) +@@ -463,10 +466,12 @@ + + protected void mouseReleased(int mouseX, int mouseY, int state) + { ++ super.mouseReleased(mouseX, mouseY, state); //Forge, Call parent to release buttons + Slot slot = this.getSlotAtPosition(mouseX, mouseY); + int i = this.guiLeft; + int j = this.guiTop; + boolean flag = mouseX < i || mouseY < j || mouseX >= i + this.xSize || mouseY >= j + this.ySize; ++ if (slot != null) flag = false; // Forge, prevent dropping of items through slots outside of GUI boundaries + int k = -1; + + if (slot != null) +@@ -685,4 +690,16 @@ + this.mc.thePlayer.closeScreen(); + } + } ++ ++ /* ======================================== FORGE START =====================================*/ ++ ++ /** ++ * Returns the slot that is currently displayed under the mouse. ++ */ ++ public Slot getSlotUnderMouse() ++ { ++ return this.theSlot; ++ } ++ ++ /* ======================================== FORGE END =====================================*/ + } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch new file mode 100644 index 0000000000..9faeb7374d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -0,0 +1,265 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java ++++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java +@@ -48,6 +48,8 @@ + private Slot field_147064_C; + private boolean field_147057_D; + private CreativeCrafting field_147059_E; ++ private static int tabPage = 0; ++ private int maxPages = 0; + + public GuiContainerCreative(EntityPlayer p_i1088_1_) + { +@@ -175,7 +177,7 @@ + return; + } + +- if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2)) ++ if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2) && ItemStack.areItemStackTagsEqual(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770 + { + if (clickedButton == 0) + { +@@ -259,6 +261,13 @@ + this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]); + this.field_147059_E = new CreativeCrafting(this.mc); + this.mc.thePlayer.inventoryContainer.onCraftGuiOpened(this.field_147059_E); ++ int tabCount = CreativeTabs.creativeTabArray.length; ++ if (tabCount > 12) ++ { ++ buttonList.add(new GuiButton(101, guiLeft, guiTop - 50, 20, 20, "<")); ++ buttonList.add(new GuiButton(102, guiLeft + xSize - 20, guiTop - 50, 20, 20, ">")); ++ maxPages = ((tabCount - 12) / 10) + 1; ++ } + } + else + { +@@ -280,7 +289,7 @@ + + protected void keyTyped(char typedChar, int keyCode) throws IOException + { +- if (selectedTabIndex != CreativeTabs.tabAllSearch.getTabIndex()) ++ if (!CreativeTabs.creativeTabArray[selectedTabIndex].hasSearchBar()) + { + if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)) + { +@@ -318,6 +327,14 @@ + GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; + guicontainercreative$containercreative.itemList.clear(); + ++ CreativeTabs tab = CreativeTabs.creativeTabArray[selectedTabIndex]; ++ if (tab.hasSearchBar() && tab != CreativeTabs.tabAllSearch) ++ { ++ tab.displayAllReleventItems(guicontainercreative$containercreative.itemList); ++ updateFilteredItems(guicontainercreative$containercreative); ++ return; ++ } ++ + for (Item item : Item.itemRegistry) + { + if (item != null && item.getCreativeTab() != null) +@@ -325,7 +342,13 @@ + item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList); + } + } ++ updateFilteredItems(guicontainercreative$containercreative); ++ } + ++ //split from above for custom search tabs ++ private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$containercreative) ++ { ++ if (CreativeTabs.creativeTabArray[selectedTabIndex] == CreativeTabs.tabAllSearch) // FORGE: Only add enchanted books to the regular search + for (Enchantment enchantment : Enchantment.enchantmentsBookList) + { + if (enchantment != null && enchantment.type != null) +@@ -333,7 +356,6 @@ + Items.enchanted_book.getAll(enchantment, guicontainercreative$containercreative.itemList); + } + } +- + Iterator iterator = guicontainercreative$containercreative.itemList.iterator(); + String s1 = this.searchField.getText().toLowerCase(); + +@@ -365,7 +387,7 @@ + { + CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; + +- if (creativetabs.drawInForegroundOfTab()) ++ if (creativetabs != null && creativetabs.drawInForegroundOfTab()) + { + GlStateManager.disableBlend(); + this.fontRendererObj.drawString(I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752); +@@ -400,7 +422,7 @@ + + for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray) + { +- if (this.func_147049_a(creativetabs, i, j)) ++ if (creativetabs != null && this.func_147049_a(creativetabs, i, j)) + { + this.setCurrentCreativeTab(creativetabs); + return; +@@ -413,11 +435,13 @@ + + private boolean needsScrollBars() + { ++ if (CreativeTabs.creativeTabArray[selectedTabIndex] == null) return false; + return selectedTabIndex != CreativeTabs.tabInventory.getTabIndex() && CreativeTabs.creativeTabArray[selectedTabIndex].shouldHidePlayerInventory() && ((GuiContainerCreative.ContainerCreative)this.inventorySlots).func_148328_e(); + } + + private void setCurrentCreativeTab(CreativeTabs p_147050_1_) + { ++ if (p_147050_1_ == null) return; + int i = selectedTabIndex; + selectedTabIndex = p_147050_1_.getTabIndex(); + GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; +@@ -483,12 +507,14 @@ + + if (this.searchField != null) + { +- if (p_147050_1_ == CreativeTabs.tabAllSearch) ++ if (p_147050_1_.hasSearchBar()) + { + this.searchField.setVisible(true); + this.searchField.setCanLoseFocus(false); + this.searchField.setFocused(true); + this.searchField.setText(""); ++ this.searchField.width = p_147050_1_.getSearchbarWidth(); ++ this.searchField.xPosition = this.guiLeft + (82 /*default left*/ + 89 /*default width*/) - this.searchField.width; + this.updateCreativeSearch(); + } + else +@@ -558,20 +584,43 @@ + } + + super.drawScreen(mouseX, mouseY, partialTicks); ++ int start = tabPage * 10; ++ int end = Math.min(CreativeTabs.creativeTabArray.length, ((tabPage + 1) * 10) + 2); ++ if (tabPage != 0) start += 2; ++ boolean rendered = false; + +- for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray) ++ for (CreativeTabs creativetabs : java.util.Arrays.copyOfRange(CreativeTabs.creativeTabArray,start,end)) + { ++ if (creativetabs == null) continue; + if (this.renderCreativeInventoryHoveringText(creativetabs, mouseX, mouseY)) + { ++ rendered = true; + break; + } + } + ++ if (!rendered && renderCreativeInventoryHoveringText(CreativeTabs.tabAllSearch, mouseX, mouseY)) ++ { ++ renderCreativeInventoryHoveringText(CreativeTabs.tabInventory, mouseX, mouseY); ++ } ++ + if (this.field_147064_C != null && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex() && this.isPointInRegion(this.field_147064_C.xDisplayPosition, this.field_147064_C.yDisplayPosition, 16, 16, mouseX, mouseY)) + { + this.drawCreativeTabHoveringText(I18n.format("inventory.binSlot", new Object[0]), mouseX, mouseY); + } + ++ if (maxPages != 0) ++ { ++ String page = String.format("%d / %d", tabPage + 1, maxPages + 1); ++ int width = fontRendererObj.getStringWidth(page); ++ GlStateManager.disableLighting(); ++ this.zLevel = 300.0F; ++ itemRender.zLevel = 300.0F; ++ fontRendererObj.drawString(page, guiLeft + (xSize / 2) - (width / 2), guiTop - 44, -1); ++ this.zLevel = 0.0F; ++ itemRender.zLevel = 0.0F; ++ } ++ + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableLighting(); + } +@@ -633,16 +682,35 @@ + RenderHelper.enableGUIStandardItemLighting(); + CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; + +- for (CreativeTabs creativetabs1 : CreativeTabs.creativeTabArray) ++ int start = tabPage * 10; ++ int end = Math.min(CreativeTabs.creativeTabArray.length, ((tabPage + 1) * 10 + 2)); ++ if (tabPage != 0) start += 2; ++ ++ for (CreativeTabs creativetabs1 : java.util.Arrays.copyOfRange(CreativeTabs.creativeTabArray,start,end)) + { + this.mc.getTextureManager().bindTexture(creativeInventoryTabs); + ++ if (creativetabs1 == null) continue; + if (creativetabs1.getTabIndex() != selectedTabIndex) + { + this.func_147051_a(creativetabs1); + } + } + ++ if (tabPage != 0) ++ { ++ if (creativetabs != CreativeTabs.tabAllSearch) ++ { ++ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); ++ func_147051_a(CreativeTabs.tabAllSearch); ++ } ++ if (creativetabs != CreativeTabs.tabInventory) ++ { ++ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); ++ func_147051_a(CreativeTabs.tabInventory); ++ } ++ } ++ + this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName())); + this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); + this.searchField.drawTextBox(); +@@ -657,6 +725,14 @@ + this.drawTexturedModalRect(i, j + (int)((float)(k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); + } + ++ if (creativetabs == null || creativetabs.getTabPage() != tabPage) ++ { ++ if (creativetabs != CreativeTabs.tabAllSearch && creativetabs != CreativeTabs.tabInventory) ++ { ++ return; ++ } ++ } ++ + this.func_147051_a(creativetabs); + + if (creativetabs == CreativeTabs.tabInventory) +@@ -667,6 +743,14 @@ + + protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) + { ++ if (p_147049_1_.getTabPage() != tabPage) ++ { ++ if (p_147049_1_ != CreativeTabs.tabAllSearch && p_147049_1_ != CreativeTabs.tabInventory) ++ { ++ return false; ++ } ++ } ++ + int i = p_147049_1_.getTabColumn(); + int j = 28 * i; + int k = 0; +@@ -763,6 +847,8 @@ + } + + GlStateManager.disableLighting(); ++ GlStateManager.color(1F, 1F, 1F); //Forge: Reset color in case Items change it. ++ GlStateManager.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border. + this.drawTexturedModalRect(l, i1, j, k, 28, j1); + this.zLevel = 100.0F; + this.itemRender.zLevel = 100.0F; +@@ -789,6 +875,15 @@ + { + this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); + } ++ ++ if (button.id == 101) ++ { ++ tabPage = Math.max(tabPage - 1, 0); ++ } ++ else if (button.id == 102) ++ { ++ tabPage = Math.min(tabPage + 1, maxPages); ++ } + } + + public int getSelectedTabIndex() diff --git a/patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch new file mode 100644 index 0000000000..4f3c8aede2 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/model/ModelBase.java ++++ ../src-work/minecraft/net/minecraft/client/model/ModelBase.java +@@ -10,7 +10,6 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public abstract class ModelBase + { + public float swingProgress; diff --git a/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch new file mode 100644 index 0000000000..e3afbc8713 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/client/model/ModelBox.java ++++ ../src-work/minecraft/net/minecraft/client/model/ModelBox.java +@@ -4,7 +4,6 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public class ModelBox + { + private PositionTextureVertex[] vertexPositions; +@@ -81,6 +80,7 @@ + } + } + ++ @SideOnly(Side.CLIENT) + public void render(WorldRenderer renderer, float scale) + { + for (int i = 0; i < this.quadList.length; ++i) diff --git a/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch new file mode 100644 index 0000000000..b67e508a85 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/client/model/ModelRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/model/ModelRenderer.java +@@ -10,7 +10,6 @@ + import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; + +-@SideOnly(Side.CLIENT) + public class ModelRenderer + { + public float textureWidth; +@@ -109,6 +108,7 @@ + this.rotationPointZ = rotationPointZIn; + } + ++ @SideOnly(Side.CLIENT) + public void render(float p_78785_1_) + { + if (!this.isHidden) +@@ -190,6 +190,7 @@ + } + } + ++ @SideOnly(Side.CLIENT) + public void renderWithRotation(float p_78791_1_) + { + if (!this.isHidden) +@@ -225,6 +226,7 @@ + } + } + ++ @SideOnly(Side.CLIENT) + public void postRender(float scale) + { + if (!this.isHidden) +@@ -266,6 +268,7 @@ + } + } + ++ @SideOnly(Side.CLIENT) + private void compileDisplayList(float scale) + { + this.displayList = GLAllocation.generateDisplayLists(1); diff --git a/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch new file mode 100644 index 0000000000..c3d2571d6f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/client/model/PositionTextureVertex.java ++++ ../src-work/minecraft/net/minecraft/client/model/PositionTextureVertex.java +@@ -1,10 +1,7 @@ + package net.minecraft.client.model; + + import net.minecraft.util.Vec3; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public class PositionTextureVertex + { + public Vec3 vector3D; diff --git a/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch new file mode 100644 index 0000000000..321941a6b1 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/client/model/TexturedQuad.java ++++ ../src-work/minecraft/net/minecraft/client/model/TexturedQuad.java +@@ -4,10 +4,7 @@ + import net.minecraft.client.renderer.WorldRenderer; + import net.minecraft.client.renderer.vertex.DefaultVertexFormats; + import net.minecraft.util.Vec3; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public class TexturedQuad + { + public PositionTextureVertex[] vertexPositions; diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch new file mode 100644 index 0000000000..dd87a5fddc --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java ++++ ../src-work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java +@@ -55,6 +55,7 @@ + Chunk chunk = new Chunk(this.worldObj, p_73158_1_, p_73158_2_); + this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_), chunk); + this.chunkListing.add(chunk); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); + chunk.setChunkLoaded(true); + return chunk; + } diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch new file mode 100644 index 0000000000..d19712b436 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java ++++ ../src-work/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java +@@ -67,7 +67,7 @@ + inetaddress = InetAddress.getByName(ip); + GuiConnecting.this.networkManager = NetworkManager.func_181124_a(inetaddress, port, GuiConnecting.this.mc.gameSettings.func_181148_f()); + GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen)); +- GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN)); ++ GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN, true)); + GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile())); + } + catch (UnknownHostException unknownhostexception) diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch new file mode 100644 index 0000000000..404b94ff21 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -0,0 +1,87 @@ +--- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java ++++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java +@@ -111,6 +111,12 @@ + } + } + ++ ItemStack stack = mc.thePlayer.getCurrentEquippedItem(); ++ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, pos, mc.thePlayer)) ++ { ++ return false; ++ } ++ + if (this.currentGameType.isCreative() && this.mc.thePlayer.getHeldItem() != null && this.mc.thePlayer.getHeldItem().getItem() instanceof ItemSword) + { + return false; +@@ -128,13 +134,7 @@ + else + { + world.playAuxSFX(2001, pos, Block.getStateId(iblockstate)); +- boolean flag = world.setBlockToAir(pos); + +- if (flag) +- { +- block1.onBlockDestroyedByPlayer(world, pos, iblockstate); +- } +- + this.currentBlock = new BlockPos(this.currentBlock.getX(), -1, this.currentBlock.getZ()); + + if (!this.currentGameType.isCreative()) +@@ -152,6 +152,12 @@ + } + } + ++ boolean flag = block1.removedByPlayer(world, pos, mc.thePlayer, false); ++ ++ if (flag) ++ { ++ block1.onBlockDestroyedByPlayer(world, pos, iblockstate); ++ } + return flag; + } + } +@@ -356,11 +362,19 @@ + { + if (this.currentGameType != WorldSettings.GameType.SPECTATOR) + { ++ ++ if (heldStack != null && ++ heldStack.getItem() != null && ++ heldStack.getItem().onItemUseFirst(heldStack, player, worldIn, hitPos, side, f, f1, f2)) ++ { ++ return true; ++ } ++ + IBlockState iblockstate = worldIn.getBlockState(hitPos); + +- if ((!player.isSneaking() || player.getHeldItem() == null) && iblockstate.getBlock().onBlockActivated(worldIn, hitPos, iblockstate, player, side, f, f1, f2)) ++ if ((!player.isSneaking() || player.getHeldItem() == null || player.getHeldItem().getItem().doesSneakBypassUse(worldIn, hitPos, player))) + { +- flag = true; ++ flag = iblockstate.getBlock().onBlockActivated(worldIn, hitPos, iblockstate, player, side, f, f1, f2); + } + + if (!flag && heldStack != null && heldStack.getItem() instanceof ItemBlock) +@@ -393,7 +407,9 @@ + } + else + { +- return heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2); ++ if (!heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2)) return false; ++ if (heldStack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, heldStack); ++ return true; + } + } + else +@@ -420,9 +436,10 @@ + { + playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack; + +- if (itemstack.stackSize == 0) ++ if (itemstack.stackSize <= 0) + { + playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(playerIn, itemstack); + } + + return true; diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch new file mode 100644 index 0000000000..a0e81d0547 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java ++++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java +@@ -52,12 +52,13 @@ + super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_5_, true); + this.sendQueue = p_i45063_1_; + this.getWorldInfo().setDifficulty(p_i45063_4_); +- this.setSpawnPoint(new BlockPos(8, 64, 8)); + this.provider.registerWorld(this); ++ this.setSpawnPoint(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect. + this.chunkProvider = this.createChunkProvider(); + this.mapStorage = new SaveDataMemoryStorage(); + this.calculateInitialSkylight(); + this.calculateInitialWeather(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this)); + } + + public void tick() diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch new file mode 100644 index 0000000000..e1acbc07d3 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java ++++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java +@@ -23,6 +23,7 @@ + + public void processHandshake(C00Handshake packetIn) + { ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; + this.networkManager.setConnectionState(packetIn.getRequestedState()); + this.networkManager.setNetHandler(new NetHandlerLoginServer(this.mcServer, this.networkManager)); + } diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch new file mode 100644 index 0000000000..2c10876e58 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java ++++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java +@@ -104,7 +104,10 @@ + { + this.gameProfile = packetIn.getProfile(); + this.networkManager.setConnectionState(EnumConnectionState.PLAY); +- this.networkManager.setNetHandler(new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile)); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlClientHandshake(this.networkManager); ++ NetHandlerPlayClient nhpc = new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile); ++ this.networkManager.setNetHandler(nhpc); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().setPlayClient(nhpc); + } + + public void onDisconnect(IChatComponent reason) diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch new file mode 100644 index 0000000000..601a6a7967 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch @@ -0,0 +1,62 @@ +--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java ++++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java +@@ -246,7 +246,7 @@ + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + this.gameController.playerController = new PlayerControllerMP(this.gameController, this); +- this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler); ++ this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(getNetworkManager()).getOverrideDimension(packetIn), packetIn.getDifficulty(), this.gameController.mcProfiler); + this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); + this.gameController.loadWorld(this.clientWorldController); + this.gameController.thePlayer.dimension = packetIn.getDimension(); +@@ -750,14 +750,16 @@ + public void handleChat(S02PacketChat packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); ++ net.minecraft.util.IChatComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(packetIn.getType(), packetIn.getChatComponent()); ++ if (message == null) return; + + if (packetIn.getType() == 2) + { +- this.gameController.ingameGUI.setRecordPlaying(packetIn.getChatComponent(), false); ++ this.gameController.ingameGUI.setRecordPlaying(message, false); + } + else + { +- this.gameController.ingameGUI.getChatGUI().printChatMessage(packetIn.getChatComponent()); ++ this.gameController.ingameGUI.getChatGUI().printChatMessage(message); + } + } + +@@ -808,6 +810,11 @@ + float f = (float)(packetIn.getYaw() * 360) / 256.0F; + float f1 = (float)(packetIn.getPitch() * 360) / 256.0F; + EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.getEntityType(), this.gameController.theWorld); ++ if (entitylivingbase == null) ++ { ++ net.minecraftforge.fml.common.FMLLog.info("Server attempted to spawn an unknown entity using ID: {0} at ({1}, {2}, {3}) Skipping!", packetIn.getEntityType(), d0, d1, d2); ++ return; ++ } + entitylivingbase.serverPosX = packetIn.getX(); + entitylivingbase.serverPosY = packetIn.getY(); + entitylivingbase.serverPosZ = packetIn.getZ(); +@@ -1133,6 +1140,10 @@ + { + tileentity.readFromNBT(packetIn.getNbtCompound()); + } ++ else ++ { ++ tileentity.onDataPacket(netManager, packetIn); ++ } + } + } + +@@ -1341,7 +1352,7 @@ + + if (entity instanceof EntityLivingBase) + { +- PotionEffect potioneffect = new PotionEffect(packetIn.getEffectId(), packetIn.getDuration(), packetIn.getAmplifier(), false, packetIn.func_179707_f()); ++ PotionEffect potioneffect = new PotionEffect(packetIn.getEffectId() & 0xff, packetIn.getDuration(), packetIn.getAmplifier(), false, packetIn.func_179707_f()); + potioneffect.setPotionDurationMax(packetIn.func_149429_c()); + ((EntityLivingBase)entity).addPotionEffect(potioneffect); + } diff --git a/patches.mcp/minecraft/net/minecraft/client/network/OldServerPinger.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/OldServerPinger.java.patch new file mode 100644 index 0000000000..5631206e36 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/network/OldServerPinger.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/network/OldServerPinger.java ++++ ../src-work/minecraft/net/minecraft/client/network/OldServerPinger.java +@@ -150,6 +150,7 @@ + server.setBase64EncodedIconData((String)null); + } + ++ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(server, serverstatusresponse); + this.field_175092_e = Minecraft.getSystemTime(); + networkmanager.sendPacket(new C01PacketPing(this.field_175092_e)); + this.field_147403_d = true; diff --git a/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch new file mode 100644 index 0000000000..2cb6442033 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java +@@ -133,6 +133,7 @@ + + public void addEffect(EntityFX effect) + { ++ if (effect == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs. + int i = effect.getFXLayer(); + int j = effect.getAlpha() != 1.0F ? 0 : 1; + +@@ -351,7 +352,7 @@ + + public void addBlockDestroyEffects(BlockPos pos, IBlockState state) + { +- if (state.getBlock().getMaterial() != Material.air) ++ if (!state.getBlock().isAir(worldObj, pos) && !state.getBlock().addDestroyEffects(worldObj, pos, this)) + { + state = state.getBlock().getActualState(state, this.worldObj, pos); + int i = 4; +@@ -457,4 +458,13 @@ + + return "" + i; + } ++ ++ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.MovingObjectPosition target) ++ { ++ Block block = worldObj.getBlockState(pos).getBlock(); ++ if (block != null && !block.addHitEffects(worldObj, target, this)) ++ { ++ addBlockHitEffects(pos, target.sideHit); ++ } ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch new file mode 100644 index 0000000000..39f2cb1698 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java +@@ -533,8 +533,19 @@ + @SideOnly(Side.CLIENT) + public static enum EnumNeighborInfo + { +- DOWN(new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.5F, false, new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0]), +- UP(new EnumFacing[]{EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH}, 1.0F, false, new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0]), ++ // -- Forge Patch to Fix Top/Bottom Lighting Interpolation -- ++ // Forge PR - https://github.com/MinecraftForge/MinecraftForge/pull/1892 ++ // Mojang Bug - https://bugs.mojang.com/browse/MC-80148 ++ DOWN( new EnumFacing[]{ EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH }, 0.5F, true, ++ new Orientation[]{ Orientation.FLIP_WEST, Orientation.SOUTH, Orientation.FLIP_WEST, Orientation.FLIP_SOUTH, Orientation.WEST, Orientation.FLIP_SOUTH, Orientation.WEST, Orientation.SOUTH }, ++ new Orientation[]{ Orientation.FLIP_WEST, Orientation.NORTH, Orientation.FLIP_WEST, Orientation.FLIP_NORTH, Orientation.WEST, Orientation.FLIP_NORTH, Orientation.WEST, Orientation.NORTH }, ++ new Orientation[]{ Orientation.FLIP_EAST, Orientation.NORTH, Orientation.FLIP_EAST, Orientation.FLIP_NORTH, Orientation.EAST, Orientation.FLIP_NORTH, Orientation.EAST, Orientation.NORTH }, ++ new Orientation[]{ Orientation.FLIP_EAST, Orientation.SOUTH, Orientation.FLIP_EAST, Orientation.FLIP_SOUTH, Orientation.EAST, Orientation.FLIP_SOUTH, Orientation.EAST, Orientation.SOUTH } ), ++ UP( new EnumFacing[]{ EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH }, 1.0F, true, ++ new Orientation[]{ Orientation.EAST, Orientation.SOUTH, Orientation.EAST, Orientation.FLIP_SOUTH, Orientation.FLIP_EAST, Orientation.FLIP_SOUTH, Orientation.FLIP_EAST, Orientation.SOUTH }, ++ new Orientation[]{ Orientation.EAST, Orientation.NORTH, Orientation.EAST, Orientation.FLIP_NORTH, Orientation.FLIP_EAST, Orientation.FLIP_NORTH, Orientation.FLIP_EAST, Orientation.NORTH }, ++ new Orientation[]{ Orientation.WEST, Orientation.NORTH, Orientation.WEST, Orientation.FLIP_NORTH, Orientation.FLIP_WEST, Orientation.FLIP_NORTH, Orientation.FLIP_WEST, Orientation.NORTH }, ++ new Orientation[]{ Orientation.WEST, Orientation.SOUTH, Orientation.WEST, Orientation.FLIP_SOUTH, Orientation.FLIP_WEST, Orientation.FLIP_SOUTH, Orientation.FLIP_WEST, Orientation.SOUTH } ), + NORTH(new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.WEST}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST}), + SOUTH(new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.DOWN, EnumFacing.UP}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST}), + WEST(new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.6F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.SOUTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.SOUTH}), diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch new file mode 100644 index 0000000000..af6ec831d7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch @@ -0,0 +1,9 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelShapes.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelShapes.java +@@ -309,5 +309,6 @@ + return new ModelResourceLocation(s + "_double_slab", s1); + } + }); ++ net.minecraftforge.client.model.ModelLoader.onRegisterAllBlocks(this); + } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch new file mode 100644 index 0000000000..fe9f2c0563 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch @@ -0,0 +1,49 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java +@@ -24,7 +24,7 @@ + { + private BlockModelShapes blockModelShapes; + private final GameSettings gameSettings; +- private final BlockModelRenderer blockModelRenderer = new BlockModelRenderer(); ++ private final BlockModelRenderer blockModelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(); + private final ChestRenderer chestRenderer = new ChestRenderer(); + private final BlockFluidRenderer fluidRenderer = new BlockFluidRenderer(); + +@@ -48,6 +48,24 @@ + { + state = block.getActualState(state, blockAccess, pos); + IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(state); ++ ++ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) ++ { ++ IBlockState extendedState = block.getExtendedState(state, blockAccess, pos); ++ for ( net.minecraft.util.EnumWorldBlockLayer layer : net.minecraft.util.EnumWorldBlockLayer.values() ) ++ { ++ if ( block.canRenderInLayer( layer ) ) ++ { ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(layer); ++ ++ IBakedModel targetLayer = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); ++ IBakedModel damageModel = (new SimpleBakedModel.Builder(targetLayer, texture)).makeBakedModel(); ++ this.blockModelRenderer.renderModel(blockAccess, damageModel, state, pos, Tessellator.getInstance().getWorldRenderer()); ++ } ++ } ++ return; ++ } ++ + IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, texture)).makeBakedModel(); + this.blockModelRenderer.renderModel(blockAccess, ibakedmodel1, state, pos, Tessellator.getInstance().getWorldRenderer()); + } +@@ -128,6 +146,12 @@ + ibakedmodel = ((WeightedBakedModel)ibakedmodel).getAlternativeModel(MathHelper.getPositionRandom(pos)); + } + ++ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) ++ { ++ IBlockState extendedState = block.getExtendedState(state, worldIn, pos); ++ ibakedmodel = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); ++ } ++ + return ibakedmodel; + } + diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch new file mode 100644 index 0000000000..7b5b273156 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -0,0 +1,192 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java +@@ -200,6 +200,7 @@ + { + this.loadShader(new ResourceLocation("shaders/post/invert.json")); + } ++ else net.minecraftforge.client.ForgeHooksClient.loadEntityShader(entityIn, this); + } + } + +@@ -419,7 +420,7 @@ + + if (d3 < d2 || d2 == 0.0D) + { +- if (entity1 == entity.ridingEntity) ++ if (entity1 == entity.ridingEntity && !entity.canRiderInteract()) + { + if (d2 == 0.0D) + { +@@ -512,7 +513,7 @@ + f = f * 60.0F / 70.0F; + } + +- return f; ++ return net.minecraftforge.client.ForgeHooksClient.getFOVModifier(this, entity, block, partialTicks, f); + } + } + +@@ -576,14 +577,8 @@ + { + BlockPos blockpos = new BlockPos(entity); + IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); +- Block block = iblockstate.getBlock(); ++ net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.mc.theWorld, blockpos, iblockstate, entity); + +- if (block == Blocks.bed) +- { +- int j = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); +- GlStateManager.rotate((float)(j * 90), 0.0F, 1.0F, 0.0F); +- } +- + GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, -1.0F, 0.0F); + GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, -1.0F, 0.0F, 0.0F); + } +@@ -650,17 +645,20 @@ + + if (!this.mc.gameSettings.debugCamEnable) + { +- GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 1.0F, 0.0F, 0.0F); +- ++ float yaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F; ++ float pitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks; ++ float roll = 0.0F; + if (entity instanceof EntityAnimal) + { + EntityAnimal entityanimal = (EntityAnimal)entity; +- GlStateManager.rotate(entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); ++ yaw = entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * partialTicks + 180.0F; + } +- else +- { +- GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); +- } ++ Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); ++ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, block, partialTicks, yaw, pitch, roll); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ GlStateManager.rotate(event.roll, 0.0F, 0.0F, 1.0F); ++ GlStateManager.rotate(event.pitch, 1.0F, 0.0F, 0.0F); ++ GlStateManager.rotate(event.yaw, 0.0F, 1.0F, 0.0F); + } + + GlStateManager.translate(0.0F, -f, 0.0F); +@@ -1103,7 +1101,7 @@ + + try + { +- this.mc.currentScreen.drawScreen(k1, l1, p_181560_1_); ++ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.mc.currentScreen, k1, l1, p_181560_1_); + } + catch (Throwable throwable) + { +@@ -1164,7 +1162,7 @@ + + if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR) + { +- flag = block.hasTileEntity() && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; ++ flag = block.hasTileEntity(this.mc.theWorld.getBlockState(blockpos)) && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; + } + else + { +@@ -1314,7 +1312,9 @@ + GlStateManager.pushMatrix(); + RenderHelper.enableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("entities"); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); + renderglobal.renderEntities(entity, icamera, partialTicks); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); + RenderHelper.disableStandardItemLighting(); + this.disableLightmap(); + GlStateManager.matrixMode(5888); +@@ -1326,6 +1326,7 @@ + EntityPlayer entityplayer = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.getHeldItem(), partialTicks)) + renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); + GlStateManager.enableAlpha(); + } +@@ -1339,6 +1340,7 @@ + EntityPlayer entityplayer1 = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer1, mc.objectMouseOver, 0, entityplayer1.getHeldItem(), partialTicks)) + renderglobal.drawSelectionBox(entityplayer1, this.mc.objectMouseOver, 0, partialTicks); + GlStateManager.enableAlpha(); + } +@@ -1380,6 +1382,15 @@ + GlStateManager.shadeModel(7425); + this.mc.mcProfiler.endStartSection("translucent"); + renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double)partialTicks, pass, entity); ++ if (!this.debugView) //Only render if render pass 0 happens as well. ++ { ++ RenderHelper.enableStandardItemLighting(); ++ this.mc.mcProfiler.endStartSection("entities"); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); ++ renderglobal.renderEntities(entity, icamera, partialTicks); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); ++ RenderHelper.disableStandardItemLighting(); ++ } + GlStateManager.shadeModel(7424); + GlStateManager.depthMask(true); + GlStateManager.enableCull(); +@@ -1392,8 +1403,12 @@ + this.renderCloudsCheck(renderglobal, partialTicks, pass); + } + ++ this.mc.mcProfiler.endStartSection("forge_render_last"); ++ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(renderglobal, partialTicks); ++ + this.mc.mcProfiler.endStartSection("hand"); + ++ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(renderglobal, partialTicks, pass)) + if (this.renderHand) + { + GlStateManager.clear(256); +@@ -1505,6 +1520,13 @@ + + protected void renderRainSnow(float partialTicks) + { ++ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getWeatherRenderer(); ++ if (renderer != null) ++ { ++ renderer.render(partialTicks, this.mc.theWorld, mc); ++ return; ++ } ++ + float f = this.mc.theWorld.getRainStrength(partialTicks); + + if (f > 0.0F) +@@ -1830,6 +1852,13 @@ + this.fogColorBlue = f7; + } + ++ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, block, partialTicks, this.fogColorRed, this.fogColorGreen, this.fogColorBlue); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ ++ this.fogColorRed = event.red; ++ this.fogColorGreen = event.green; ++ this.fogColorBlue = event.blue; ++ + GlStateManager.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); + } + +@@ -1848,6 +1877,10 @@ + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + ++ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, block, partialTicks, 0.1F); ++ if (hook >= 0) ++ GlStateManager.setFogDensity(hook); ++ else + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.blindness)) + { + float f1 = 5.0F; +@@ -1925,6 +1958,7 @@ + GlStateManager.setFogStart(f * 0.05F); + GlStateManager.setFogEnd(Math.min(f, 192.0F) * 0.5F); + } ++ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, block, partialTicks, p_78468_1_, f); + } + + GlStateManager.enableColorMaterial(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch new file mode 100644 index 0000000000..d6f61cabd4 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java +@@ -27,7 +27,12 @@ + + protected void updateActivePotionEffects() + { +- if (!this.mc.thePlayer.getActivePotionEffects().isEmpty()) ++ boolean hasVisibleEffect = false; ++ for(PotionEffect potioneffect : this.mc.thePlayer.getActivePotionEffects()) { ++ Potion potion = Potion.potionTypes[potioneffect.getPotionID()]; ++ if(potion.shouldRender(potioneffect)) { hasVisibleEffect = true; break; } ++ } ++ if (!this.mc.thePlayer.getActivePotionEffects().isEmpty() && hasVisibleEffect) + { + this.guiLeft = 160 + (this.width - this.xSize - 200) / 2; + this.hasActivePotionEffects = true; +@@ -70,6 +75,7 @@ + for (PotionEffect potioneffect : this.mc.thePlayer.getActivePotionEffects()) + { + Potion potion = Potion.potionTypes[potioneffect.getPotionID()]; ++ if(!potion.shouldRender(potioneffect)) continue; + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(inventoryBackground); + this.drawTexturedModalRect(i, j, 0, 166, 140, 32); +@@ -80,6 +86,8 @@ + this.drawTexturedModalRect(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18); + } + ++ potion.renderInventoryEffect(i, j, potioneffect, mc); ++ if (!potion.shouldRenderInvText(potioneffect)) { j += l; continue; } + String s1 = I18n.format(potion.getName(), new Object[0]); + + if (potioneffect.getAmplifier() == 1) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch new file mode 100644 index 0000000000..deb8b59874 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/ItemModelMesher.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/ItemModelMesher.java +@@ -50,6 +50,11 @@ + } + } + ++ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartItemModel) ++ { ++ ibakedmodel = ((net.minecraftforge.client.model.ISmartItemModel)ibakedmodel).handleItemState(stack); ++ } ++ + if (ibakedmodel == null) + { + ibakedmodel = this.modelManager.getMissingModel(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch new file mode 100644 index 0000000000..4d51db24c7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -0,0 +1,60 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java +@@ -313,7 +313,7 @@ + + if (this.itemToRender != null) + { +- if (this.itemToRender.getItem() == Items.filled_map) ++ if (this.itemToRender.getItem() instanceof net.minecraft.item.ItemMap) + { + this.renderItemMap(abstractclientplayer, f2, f, f1); + } +@@ -365,6 +365,7 @@ + if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) + { + IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer)); ++ BlockPos overlayPos = new BlockPos(this.mc.thePlayer); + EntityPlayer entityplayer = this.mc.thePlayer; + + for (int i = 0; i < 8; ++i) +@@ -378,11 +379,13 @@ + if (iblockstate1.getBlock().isVisuallyOpaque()) + { + iblockstate = iblockstate1; ++ overlayPos = blockpos; + } + } + + if (iblockstate.getBlock().getRenderType() != -1) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, partialTicks, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, overlayPos)) + this.func_178108_a(partialTicks, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); + } + } +@@ -391,11 +394,13 @@ + { + if (this.mc.thePlayer.isInsideOfMaterial(Material.water)) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(mc.thePlayer, partialTicks)) + this.renderWaterOverlayTexture(partialTicks); + } + + if (this.mc.thePlayer.isBurning()) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderFireOverlay(mc.thePlayer, partialTicks)) + this.renderFireInFirstPerson(partialTicks); + } + } +@@ -512,6 +517,12 @@ + { + if (!this.itemToRender.getIsItemStackEqual(itemstack)) + { ++ if (!this.itemToRender.getItem().shouldCauseReequipAnimation(this.itemToRender, itemstack, equippedItemSlot != entityplayer.inventory.currentItem)) ++ { ++ this.itemToRender = itemstack; ++ this.equippedItemSlot = entityplayer.inventory.currentItem; ++ return; ++ } + flag = true; + } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch new file mode 100644 index 0000000000..ae77f90371 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch @@ -0,0 +1,26 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java +@@ -83,6 +83,10 @@ + public static int GL_ARRAY_BUFFER; + public static int GL_STATIC_DRAW; + ++ /* Stores the last values sent into setLightmapTextureCoords */ ++ public static float lastBrightnessX = 0.0f; ++ public static float lastBrightnessY = 0.0f; ++ + public static void initializeTextures() + { + ContextCapabilities contextcapabilities = GLContext.getCapabilities(); +@@ -843,6 +847,12 @@ + { + GL13.glMultiTexCoord2f(target, p_77475_1_, p_77475_2_); + } ++ ++ if (target == lightmapTexUnit) ++ { ++ lastBrightnessX = p_77475_1_; ++ lastBrightnessY = p_77475_2_; ++ } + } + + public static void glBlendFunc(int sFactorRGB, int dFactorRGB, int sfactorAlpha, int dfactorAlpha) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch new file mode 100644 index 0000000000..2b7737d4bb --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -0,0 +1,152 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/RenderGlobal.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java +@@ -525,8 +525,10 @@ + + public void renderEntities(Entity renderViewEntity, ICamera camera, float partialTicks) + { ++ int pass = net.minecraftforge.client.MinecraftForgeClient.getRenderPass(); + if (this.renderEntitiesStartupCounter > 0) + { ++ if (pass > 0) return; + --this.renderEntitiesStartupCounter; + } + else +@@ -537,9 +539,12 @@ + this.theWorld.theProfiler.startSection("prepare"); + TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), partialTicks); + this.renderManager.cacheActiveRenderInfo(this.theWorld, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks); ++ if(pass == 0) ++ { + this.countEntitiesTotal = 0; + this.countEntitiesRendered = 0; + this.countEntitiesHidden = 0; ++ } + Entity entity = this.mc.getRenderViewEntity(); + double d3 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; + double d4 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; +@@ -551,11 +556,15 @@ + this.mc.entityRenderer.enableLightmap(); + this.theWorld.theProfiler.endStartSection("global"); + List list = this.theWorld.getLoadedEntityList(); ++ if (pass == 0) ++ { + this.countEntitiesTotal = list.size(); ++ } + + for (int i = 0; i < this.theWorld.weatherEffects.size(); ++i) + { + Entity entity1 = (Entity)this.theWorld.weatherEffects.get(i); ++ if (!entity1.shouldRenderInPass(pass)) continue; + ++this.countEntitiesRendered; + + if (entity1.isInRangeToRender3d(d0, d1, d2)) +@@ -577,6 +586,7 @@ + for (int j = 0; j < list.size(); ++j) + { + Entity entity3 = (Entity)list.get(j); ++ if (!entity3.shouldRenderInPass(pass)) continue; + boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); + boolean flag1 = entity3.isInRangeToRender3d(d0, d1, d2) && (entity3.ignoreFrustumCheck || camera.isBoundingBoxInFrustum(entity3.getEntityBoundingBox()) || entity3.riddenByEntity == this.mc.thePlayer) && entity3 instanceof EntityPlayer; + +@@ -626,6 +636,7 @@ + } + + entity2 = (Entity)iterator.next(); ++ if (!entity2.shouldRenderInPass(pass)) continue; + flag2 = this.renderManager.shouldRender(entity2, camera, d0, d1, d2) || entity2.riddenByEntity == this.mc.thePlayer; + + if (!flag2) +@@ -654,6 +665,7 @@ + this.theWorld.theProfiler.endStartSection("blockentities"); + RenderHelper.enableStandardItemLighting(); + ++ TileEntityRendererDispatcher.instance.preDrawBatch(); + for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 : this.renderInfos) + { + List list1 = renderglobal$containerlocalrenderinformation1.renderChunk.getCompiledChunk().getTileEntities(); +@@ -662,6 +674,7 @@ + { + for (TileEntity tileentity2 : list1) + { ++ if (!tileentity2.shouldRenderInPass(pass) || !camera.isBoundingBoxInFrustum(tileentity2.getRenderBoundingBox())) continue; + TileEntityRendererDispatcher.instance.renderTileEntity(tileentity2, partialTicks, -1); + } + } +@@ -671,9 +684,11 @@ + { + for (TileEntity tileentity : this.setTileEntities) + { ++ if (!tileentity.shouldRenderInPass(pass) || !camera.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) continue; + TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, -1); + } + } ++ TileEntityRendererDispatcher.instance.drawBatch(pass); + + this.preRenderDamagedBlocks(); + +@@ -700,7 +715,7 @@ + + Block block = this.theWorld.getBlockState(blockpos).getBlock(); + +- if (tileentity1 != null && (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull)) ++ if (tileentity1 != null && tileentity1.shouldRenderInPass(pass) && tileentity1.canRenderBreaking() && camera.isBoundingBoxInFrustum(tileentity1.getRenderBoundingBox())) + { + TileEntityRendererDispatcher.instance.renderTileEntity(tileentity1, partialTicks, destroyblockprogress.getPartialBlockDamage()); + } +@@ -1161,6 +1176,12 @@ + + public void renderSky(float partialTicks, int pass) + { ++ net.minecraftforge.client.IRenderHandler renderer = this.theWorld.provider.getSkyRenderer(); ++ if (renderer != null) ++ { ++ renderer.render(partialTicks, theWorld, mc); ++ return; ++ } + if (this.mc.theWorld.provider.getDimensionId() == 1) + { + this.renderSkyEnd(); +@@ -1378,6 +1399,12 @@ + + public void renderClouds(float partialTicks, int pass) + { ++ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getCloudRenderer(); ++ if (renderer != null) ++ { ++ renderer.render(partialTicks, this.mc.theWorld, mc); ++ return; ++ } + if (this.mc.theWorld.provider.isSurfaceWorld()) + { + if (this.mc.gameSettings.func_181147_e() == 2) +@@ -1793,8 +1820,11 @@ + double d4 = (double)blockpos.getY() - d1; + double d5 = (double)blockpos.getZ() - d2; + Block block = this.theWorld.getBlockState(blockpos).getBlock(); ++ TileEntity te = this.theWorld.getTileEntity(blockpos); ++ boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull; ++ if (!hasBreak) hasBreak = te != null && te.canRenderBreaking(); + +- if (!(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull)) ++ if (!hasBreak) + { + if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) + { +@@ -1949,13 +1979,16 @@ + if (recordName != null) + { + ItemRecord itemrecord = ItemRecord.getRecord(recordName); ++ ResourceLocation resource = null; + + if (itemrecord != null) + { + this.mc.ingameGUI.setRecordPlayingMessage(itemrecord.getRecordNameLocal()); ++ resource = itemrecord.getRecordResource(recordName); + } + +- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(new ResourceLocation(recordName), (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); ++ if (resource == null) resource = new ResourceLocation(recordName); ++ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(resource, (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); + this.mapSoundPositions.put(blockPosIn, positionedsoundrecord); + this.mc.getSoundHandler().playSound(positionedsoundrecord); + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch new file mode 100644 index 0000000000..112e541b52 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch @@ -0,0 +1,41 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/WorldRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/WorldRenderer.java +@@ -506,15 +506,15 @@ + break; + case USHORT: + case SHORT: +- this.byteBuffer.putShort(i, (short)((int)p_181663_1_ * 32767 & 65535)); +- this.byteBuffer.putShort(i + 2, (short)((int)p_181663_2_ * 32767 & 65535)); +- this.byteBuffer.putShort(i + 4, (short)((int)p_181663_3_ * 32767 & 65535)); ++ this.byteBuffer.putShort(i, (short)((int)(p_181663_1_ * 32767) & 65535)); ++ this.byteBuffer.putShort(i + 2, (short)((int)(p_181663_2_ * 32767) & 65535)); ++ this.byteBuffer.putShort(i + 4, (short)((int)(p_181663_3_ * 32767) & 65535)); + break; + case UBYTE: + case BYTE: +- this.byteBuffer.put(i, (byte)((int)p_181663_1_ * 127 & 255)); +- this.byteBuffer.put(i + 1, (byte)((int)p_181663_2_ * 127 & 255)); +- this.byteBuffer.put(i + 2, (byte)((int)p_181663_3_ * 127 & 255)); ++ this.byteBuffer.put(i, (byte)((int)(p_181663_1_ * 127) & 255)); ++ this.byteBuffer.put(i + 1, (byte)((int)(p_181663_2_ * 127) & 255)); ++ this.byteBuffer.put(i + 2, (byte)((int)(p_181663_3_ * 127) & 255)); + } + + this.nextVertexFormatIndex(); +@@ -578,6 +578,16 @@ + } + } + ++ public void checkAndGrow() ++ { ++ this.growBuffer(vertexFormat.getNextOffset()/* / 4 * 4 */); ++ } ++ ++ public boolean isColorDisabled() ++ { ++ return noColor; ++ } ++ + @SideOnly(Side.CLIENT) + public class State + { diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch new file mode 100644 index 0000000000..2551f52b99 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch @@ -0,0 +1,66 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java +@@ -23,32 +23,9 @@ + + for (int j = 0; j < list.size(); ++j) + { ++ // moved to VertexFormatElement.preDraw + VertexFormatElement vertexformatelement = (VertexFormatElement)list.get(j); +- VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.getUsage(); +- int k = vertexformatelement.getType().getGlConstant(); +- int l = vertexformatelement.getIndex(); +- bytebuffer.position(vertexformat.func_181720_d(j)); +- +- switch (vertexformatelement$enumusage) +- { +- case POSITION: +- GL11.glVertexPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); +- GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); +- break; +- case UV: +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l); +- GL11.glTexCoordPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); +- GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); +- break; +- case COLOR: +- GL11.glColorPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); +- GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); +- break; +- case NORMAL: +- GL11.glNormalPointer(k, i, bytebuffer); +- GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); +- } ++ vertexformatelement.getUsage().preDraw(vertexformat, j, i, bytebuffer); + } + + GL11.glDrawArrays(p_181679_1_.getDrawMode(), 0, p_181679_1_.getVertexCount()); +@@ -57,26 +34,8 @@ + for (int j1 = list.size(); i1 < j1; ++i1) + { + VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1); +- VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.getUsage(); +- int k1 = vertexformatelement1.getIndex(); +- +- switch (vertexformatelement$enumusage1) +- { +- case POSITION: +- GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); +- break; +- case UV: +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k1); +- GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); +- break; +- case COLOR: +- GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); +- GlStateManager.resetColor(); +- break; +- case NORMAL: +- GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); +- } ++ // moved to VertexFormatElement.postDraw ++ vertexformatelement1.getUsage().postDraw(vertexformat, i1, i, bytebuffer); + } + } + diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch new file mode 100644 index 0000000000..97dc4cd38c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java +@@ -5,8 +5,9 @@ + import net.minecraftforge.fml.relauncher.SideOnly; + + @SideOnly(Side.CLIENT) +-public class BakedQuad ++public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer + { ++ @Override public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) { net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); } + protected final int[] vertexData; + protected final int tintIndex; + protected final EnumFacing face; diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch new file mode 100644 index 0000000000..b9543da5ae --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -0,0 +1,68 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java +@@ -20,6 +20,11 @@ + + public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) + { ++ return makeBakedQuad(posFrom, posTo, face, sprite, facing, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); ++ } ++ ++ public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) ++ { + int[] aint = this.makeQuadVertexData(face, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, uvLocked, shade); + EnumFacing enumfacing = getFacingFromVertexData(aint); + +@@ -33,11 +38,17 @@ + this.func_178408_a(aint, enumfacing); + } + ++ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing); + return new BakedQuad(aint, face.tintIndex, enumfacing); + } + + private int[] makeQuadVertexData(BlockPartFace partFace, TextureAtlasSprite sprite, EnumFacing facing, float[] p_178405_4_, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) + { ++ return makeQuadVertexData(partFace, sprite, facing, p_178405_4_, modelRotationIn, partRotation, uvLocked, shade); ++ } ++ ++ private int[] makeQuadVertexData(BlockPartFace partFace, TextureAtlasSprite sprite, EnumFacing facing, float[] p_178405_4_, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) ++ { + int[] aint = new int[28]; + + for (int i = 0; i < 4; ++i) +@@ -88,7 +99,12 @@ + + private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) + { +- EnumFacing enumfacing = modelRotationIn.rotateFace(facing); ++ fillVertexData(faceData, vertexIndex, facing, partFace, p_178402_5_, sprite, modelRotationIn, partRotation, uvLocked, shade); ++ } ++ ++ private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) ++ { ++ EnumFacing enumfacing = modelRotationIn.rotate(facing); + int i = shade ? this.getFaceShadeColor(enumfacing) : -1; + EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.getFacing(facing).func_179025_a(vertexIndex); + Vector3f vector3f = new Vector3f(p_178402_5_[enumfacedirection$vertexinformation.field_179184_a], p_178402_5_[enumfacedirection$vertexinformation.field_179182_b], p_178402_5_[enumfacedirection$vertexinformation.field_179183_c]); +@@ -154,14 +170,19 @@ + + public int rotateVertex(Vector3f position, EnumFacing facing, int vertexIndex, ModelRotation modelRotationIn, boolean uvLocked) + { ++ return rotateVertex(position, facing, vertexIndex, modelRotationIn, uvLocked); ++ } ++ ++ public int rotateVertex(Vector3f position, EnumFacing facing, int vertexIndex, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) ++ { + if (modelRotationIn == ModelRotation.X0_Y0) + { + return vertexIndex; + } + else + { +- this.rotateScale(position, new Vector3f(0.5F, 0.5F, 0.5F), modelRotationIn.getMatrix4d(), new Vector3f(1.0F, 1.0F, 1.0F)); +- return modelRotationIn.rotateVertex(facing, vertexIndex); ++ net.minecraftforge.client.ForgeHooksClient.transform(position, modelRotationIn.getMatrix()); ++ return modelRotationIn.rotate(facing, vertexIndex); + } + } + diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch new file mode 100644 index 0000000000..a953b5c380 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java +@@ -10,7 +10,11 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + ++/* ++ * @deprecated use {@link net.minecraftforge.client.model.IPerspectiveAwareModel} instead ++ */ + @SideOnly(Side.CLIENT) ++@Deprecated + public class ItemCameraTransforms + { + public static final ItemCameraTransforms DEFAULT = new ItemCameraTransforms(); +@@ -117,7 +121,7 @@ + } + + @SideOnly(Side.CLIENT) +- public static enum TransformType ++ public static enum TransformType implements net.minecraftforge.client.model.IModelPart + { + NONE, + THIRD_PERSON, diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch new file mode 100644 index 0000000000..8e3564b56f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java +@@ -13,9 +13,14 @@ + import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.util.vector.Vector3f; + ++/* ++ * @deprecated use {@link net.minecraftforge.client.model.IModelState} and {@link net.minecraftforge.client.model.TRSRTransformation} ++ */ + @SideOnly(Side.CLIENT) +-public class ItemTransformVec3f ++@Deprecated ++public class ItemTransformVec3f implements net.minecraftforge.client.model.IModelState + { ++ public com.google.common.base.Optional apply(com.google.common.base.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(this, part); } + public static final ItemTransformVec3f DEFAULT = new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F)); + public final Vector3f rotation; + public final Vector3f translation; diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch new file mode 100644 index 0000000000..f336ff667c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java +@@ -29,7 +29,7 @@ + + public static ModelBlockDefinition parseFromReader(Reader p_178331_0_) + { +- return (ModelBlockDefinition)GSON.fromJson(p_178331_0_, ModelBlockDefinition.class); ++ return net.minecraftforge.client.model.BlockStateLoader.load(p_178331_0_, GSON); + } + + public ModelBlockDefinition(Collection p_i46221_1_) +@@ -155,11 +155,17 @@ + return this.modelLocation; + } + ++ @Deprecated + public ModelRotation getRotation() + { + return this.modelRotation; + } + ++ public net.minecraftforge.client.model.IModelState getState() ++ { ++ return this.modelRotation; ++ } ++ + public boolean isUvLocked() + { + return this.uvLock; diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch new file mode 100644 index 0000000000..649bea3448 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java +@@ -38,7 +38,7 @@ + } + else + { +- s = ((IProperty)this.name).getName((Comparable)map.remove(this.name)); ++ s = String.format("%s:%s", ((ResourceLocation)Block.blockRegistry.getNameForObject(state.getBlock())).getResourceDomain(), ((IProperty)this.name).getName((Comparable)map.remove(this.name))); + } + + if (this.suffix != null) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch new file mode 100644 index 0000000000..521b0958b6 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch @@ -0,0 +1,68 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java +@@ -131,7 +131,9 @@ + return; + } + +- iblockaccess = new RegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); ++ RegionRenderCache cache = createRegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); ++ net.minecraftforge.client.MinecraftForgeClient.onRebuildChunk(world, position, cache); ++ iblockaccess = cache; + generator.setCompiledChunk(compiledchunk); + } + finally +@@ -158,7 +160,7 @@ + lvt_10_1_.func_178606_a(blockpos$mutableblockpos); + } + +- if (block.hasTileEntity()) ++ if (block.hasTileEntity(iblockstate)) + { + TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos)); + TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileentity); +@@ -174,7 +176,9 @@ + } + } + +- EnumWorldBlockLayer enumworldblocklayer1 = block.getBlockLayer(); ++ for(EnumWorldBlockLayer enumworldblocklayer1 : EnumWorldBlockLayer.values()) { ++ if(!block.canRenderInLayer(enumworldblocklayer1)) continue; ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1); + int j = enumworldblocklayer1.ordinal(); + + if (block.getRenderType() != -1) +@@ -189,6 +193,7 @@ + + aboolean[j] |= blockrendererdispatcher.renderBlock(iblockstate, blockpos$mutableblockpos, iblockaccess, worldrenderer); + } ++ } + } + + for (EnumWorldBlockLayer enumworldblocklayer : EnumWorldBlockLayer.values()) +@@ -385,6 +390,26 @@ + return this.needsUpdate; + } + ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * Creates a new RegionRenderCache instance.
++ * Extending classes can change the behavior of the cache, allowing to visually change ++ * blocks (schematics etc). ++ * ++ * @see RegionRenderCache ++ * @param world The world to cache. ++ * @param from The starting position of the chunk minus one on each axis. ++ * @param to The ending position of the chunk plus one on each axis. ++ * @param subtract Padding used internally by the RegionRenderCache constructor to make ++ * the cache a 20x20x20 cube, for a total of 8000 states in the cache. ++ * @return new RegionRenderCache instance ++ */ ++ protected RegionRenderCache createRegionRenderCache(World world, BlockPos from, BlockPos to, int subtract) ++ { ++ return new RegionRenderCache(world, from, to, subtract); ++ } ++ /* ========================================= FORGE END ======================================*/ ++ + public BlockPos getBlockPosOffset16(EnumFacing p_181701_1_) + { + return (BlockPos)this.mapEnumFacing.get(p_181701_1_); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch new file mode 100644 index 0000000000..4aea0952a7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch @@ -0,0 +1,74 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java +@@ -41,7 +41,7 @@ + boolean flag = p_177077_9_.isGui3d(); + int i = this.func_177078_a(itemstack); + float f = 0.25F; +- float f1 = MathHelper.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F; ++ float f1 = shouldBob() ? MathHelper.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F : 0; + float f2 = p_177077_9_.getItemCameraTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y; + GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_); + +@@ -110,7 +110,6 @@ + + for (int j = 0; j < i; ++j) + { +- if (ibakedmodel.isGui3d()) + { + GlStateManager.pushMatrix(); + +@@ -119,25 +118,15 @@ + float f = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f1 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f2 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; +- GlStateManager.translate(f, f1, f2); ++ GlStateManager.translate(shouldSpreadItems() ? f : 0.0F, shouldSpreadItems() ? f1 : 0.0F, f2); + } + ++ if (ibakedmodel.isGui3d()) + GlStateManager.scale(0.5F, 0.5F, 0.5F); +- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); ++ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND); + this.itemRenderer.renderItem(itemstack, ibakedmodel); + GlStateManager.popMatrix(); + } +- else +- { +- GlStateManager.pushMatrix(); +- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); +- this.itemRenderer.renderItem(itemstack, ibakedmodel); +- GlStateManager.popMatrix(); +- float f3 = ibakedmodel.getItemCameraTransforms().ground.scale.x; +- float f4 = ibakedmodel.getItemCameraTransforms().ground.scale.y; +- float f5 = ibakedmodel.getItemCameraTransforms().ground.scale.z; +- GlStateManager.translate(0.0F * f3, 0.0F * f4, 0.046875F * f5); +- } + } + + GlStateManager.popMatrix(); +@@ -157,4 +146,25 @@ + { + return TextureMap.locationBlocksTexture; + } ++ ++ /*==================================== FORGE START ===========================================*/ ++ ++ /** ++ * Items should spread out when rendered in 3d? ++ * @return ++ */ ++ public boolean shouldSpreadItems() ++ { ++ return true; ++ } ++ ++ /** ++ * Items should have a bob effect ++ * @return ++ */ ++ public boolean shouldBob() ++ { ++ return true; ++ } ++ /*==================================== FORGE END =============================================*/ + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch new file mode 100644 index 0000000000..4a76f02129 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -0,0 +1,90 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java +@@ -72,7 +72,7 @@ + public RenderItem(TextureManager textureManager, ModelManager modelManager) + { + this.textureManager = textureManager; +- this.itemModelMesher = new ItemModelMesher(modelManager); ++ this.itemModelMesher = new net.minecraftforge.client.ItemModelMesherForge(modelManager); + this.registerItems(); + } + +@@ -226,7 +226,7 @@ + k = k | -16777216; + } + +- this.renderQuad(renderer, bakedquad, k); ++ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, k); + } + } + +@@ -296,6 +296,11 @@ + modelresourcelocation = new ModelResourceLocation("bow_pulling_0", "inventory"); + } + } ++ else ++ { ++ // TODO: maybe switch to the smart player model / normal smart item model? ++ modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount()); ++ } + + if (modelresourcelocation != null) + { +@@ -317,14 +322,9 @@ + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.pushMatrix(); +- ItemCameraTransforms itemcameratransforms = model.getItemCameraTransforms(); +- itemcameratransforms.applyTransform(cameraTransformType); ++ // TODO: check if negative scale is a thing ++ model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(model, cameraTransformType); + +- if (this.func_183005_a(itemcameratransforms.getTransform(cameraTransformType))) +- { +- GlStateManager.cullFace(1028); +- } +- + this.renderItem(stack, model); + GlStateManager.cullFace(1029); + GlStateManager.popMatrix(); +@@ -352,7 +352,7 @@ + GlStateManager.blendFunc(770, 771); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.setupGuiTransform(x, y, ibakedmodel.isGui3d()); +- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GUI); ++ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GUI); + this.renderItem(stack, ibakedmodel); + GlStateManager.disableAlpha(); + GlStateManager.disableRescaleNormal(); +@@ -459,10 +459,11 @@ + GlStateManager.enableDepth(); + } + +- if (stack.isItemDamaged()) ++ if (stack.getItem().showDurabilityBar(stack)) + { +- int j = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage()); +- int i = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); ++ double health = stack.getItem().getDurabilityForDisplay(stack); ++ int j = (int)Math.round(13.0D - health * 13.0D); ++ int i = (int)Math.round(255.0D - health * 255.0D); + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + GlStateManager.disableTexture2D(); +@@ -473,7 +474,7 @@ + this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255); + this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255); + this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255); +- GlStateManager.enableBlend(); ++ //GlStateManager.enableBlend(); // Forge: Disable Blend because it screws with a lot of things down the line. + GlStateManager.enableAlpha(); + GlStateManager.enableTexture2D(); + GlStateManager.enableLighting(); +@@ -1038,6 +1039,7 @@ + this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block"); + this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block"); + this.registerBlock(Blocks.dragon_egg, "dragon_egg"); ++ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.itemModelMesher); + } + + public void onResourceManagerReload(IResourceManager resourceManager) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch new file mode 100644 index 0000000000..d075ecd19f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java +@@ -192,7 +192,12 @@ + this.playerRenderer = new RenderPlayer(this); + this.skinMap.put("default", this.playerRenderer); + this.skinMap.put("slim", new RenderPlayer(this, true)); ++ net.minecraftforge.fml.client.registry.RenderingRegistry.loadEntityRenderers(this, this.entityRenderMap); + } ++ ++ public Map getSkinMap() { ++ return (Map) java.util.Collections.unmodifiableMap(skinMap); ++ } + + public void setRenderPosition(double renderPosXIn, double renderPosYIn, double renderPosZIn) + { +@@ -241,9 +246,9 @@ + IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn)); + Block block = iblockstate.getBlock(); + +- if (block == Blocks.bed) ++ if (block.isBed(worldIn, new BlockPos(livingPlayerIn), (EntityLivingBase)livingPlayerIn)) + { +- int i = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); ++ int i = block.getBedDirection(worldIn, new BlockPos(livingPlayerIn)).getHorizontalIndex(); + this.playerViewY = (float)(i * 90 + 180); + this.playerViewX = 0.0F; + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch new file mode 100644 index 0000000000..9e48e16214 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java +@@ -49,6 +49,7 @@ + + public void doRender(AbstractClientPlayer entity, double x, double y, double z, float entityYaw, float partialTicks) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(entity, this, partialTicks, x, y, z))) return; + if (!entity.isUser() || this.renderManager.livingPlayer == entity) + { + double d0 = y; +@@ -61,6 +62,7 @@ + this.setModelVisibilities(entity); + super.doRender(entity, x, d0, z, entityYaw, partialTicks); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(entity, this, partialTicks, x, y, z)); + } + + private void setModelVisibilities(AbstractClientPlayer clientPlayer) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch new file mode 100644 index 0000000000..e4a92b81b1 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java +@@ -44,7 +44,7 @@ + case 4: + return butcherVillagerTextures; + default: +- return villagerTextures; ++ return net.minecraftforge.fml.common.registry.VillagerRegistry.getVillagerSkin(entity.getProfession(), villagerTextures); + } + } + diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch new file mode 100644 index 0000000000..22636f0721 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -0,0 +1,64 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java +@@ -38,6 +38,9 @@ + protected List> layerRenderers = Lists.>newArrayList(); + protected boolean renderOutlines = false; + ++ public static float NAME_TAG_RANGE = 64.0f; ++ public static float NAME_TAG_RANGE_SNEAK = 32.0f; ++ + public RendererLivingEntity(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) + { + super(renderManagerIn); +@@ -83,10 +86,12 @@ + + public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(entity, this, x, y, z))) return; + GlStateManager.pushMatrix(); + GlStateManager.disableCull(); + this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks); +- this.mainModel.isRiding = entity.isRiding(); ++ boolean shouldSit = entity.isRiding() && (entity.ridingEntity != null && entity.ridingEntity.shouldRiderSit()); ++ this.mainModel.isRiding = shouldSit; + this.mainModel.isChild = entity.isChild(); + + try +@@ -95,7 +100,7 @@ + float f1 = this.interpolateRotation(entity.prevRotationYawHead, entity.rotationYawHead, partialTicks); + float f2 = f1 - f; + +- if (entity.isRiding() && entity.ridingEntity instanceof EntityLivingBase) ++ if (shouldSit && entity.ridingEntity instanceof EntityLivingBase) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)entity.ridingEntity; + f = this.interpolateRotation(entitylivingbase.prevRenderYawOffset, entitylivingbase.renderYawOffset, partialTicks); +@@ -191,6 +196,7 @@ + { + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(entity, this, x, y, z)); + } + + protected boolean setScoreTeamColor(T entityLivingBaseIn) +@@ -469,10 +475,11 @@ + + public void renderName(T entity, double x, double y, double z) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(entity, this, x, y, z))) return; + if (this.canRenderName(entity)) + { + double d0 = entity.getDistanceSqToEntity(this.renderManager.livingPlayer); +- float f = entity.isSneaking() ? 32.0F : 64.0F; ++ float f = entity.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; + + if (d0 < (double)(f * f)) + { +@@ -518,6 +525,7 @@ + } + } + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(entity, this, x, y, z)); + } + + protected boolean canRenderName(T entity) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch new file mode 100644 index 0000000000..d499c73f25 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch @@ -0,0 +1,107 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java +@@ -55,29 +55,28 @@ + T t = this.func_177175_a(armorSlot); + t.setModelAttributes(this.renderer.getMainModel()); + t.setLivingAnimations(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_4_); ++ t = getArmorModelHook(entitylivingbaseIn, itemstack, armorSlot, t); + this.func_177179_a(t, armorSlot); + boolean flag = this.isSlotForLeggings(armorSlot); +- this.renderer.bindTexture(this.getArmorResource(itemarmor, flag)); ++ this.renderer.bindTexture(this.getArmorResource(entitylivingbaseIn, itemstack, flag ? 2 : 1, null)); + +- switch (itemarmor.getArmorMaterial()) +- { +- case LEATHER: + int i = itemarmor.getColor(itemstack); ++ { ++ if (i != -1) // Allow this for anything, not only cloth. ++ { + float f = (float)(i >> 16 & 255) / 255.0F; + float f1 = (float)(i >> 8 & 255) / 255.0F; + float f2 = (float)(i & 255) / 255.0F; + GlStateManager.color(this.colorR * f, this.colorG * f1, this.colorB * f2, this.alpha); + t.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); +- this.renderer.bindTexture(this.getArmorResource(itemarmor, flag, "overlay")); +- case CHAIN: +- case IRON: +- case GOLD: +- case DIAMOND: ++ this.renderer.bindTexture(this.getArmorResource(entitylivingbaseIn, itemstack, flag ? 2 : 1, "overlay")); ++ } ++ { // Non-colored + GlStateManager.color(this.colorR, this.colorG, this.colorB, this.alpha); + t.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); +- default: +- +- if (!this.field_177193_i && itemstack.isItemEnchanted()) ++ } ++ // Default ++ if (!this.field_177193_i && itemstack.hasEffect()) + { + this.func_177183_a(entitylivingbaseIn, t, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); + } +@@ -135,11 +134,13 @@ + GlStateManager.disableBlend(); + } + ++ @Deprecated //Use the more sensitive version getArmorResource below + private ResourceLocation getArmorResource(ItemArmor p_177181_1_, boolean p_177181_2_) + { + return this.getArmorResource(p_177181_1_, p_177181_2_, (String)null); + } + ++ @Deprecated //Use the more sensitive version getArmorResource below + private ResourceLocation getArmorResource(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) + { + String s = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.getArmorMaterial().getName(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); +@@ -157,4 +158,49 @@ + protected abstract void initArmor(); + + protected abstract void func_177179_a(T p_177179_1_, int p_177179_2_); ++ ++ /*=================================== FORGE START =========================================*/ ++ ++ /** ++ * Hook to allow item-sensitive armor model. for LayerBipedArmor. ++ */ ++ protected T getArmorModelHook(EntityLivingBase entity, ItemStack itemStack, int slot, T model) ++ { ++ return model; ++ } ++ ++ /** ++ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. ++ * ++ * @param entity Entity wearing the armor ++ * @param stack ItemStack for the armor ++ * @param slot Slot ID that the item is in ++ * @param type Subtype, can be null or "overlay" ++ * @return ResourceLocation pointing at the armor's texture ++ */ ++ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, int slot, String type) ++ { ++ ItemArmor item = (ItemArmor)stack.getItem(); ++ String texture = item.getArmorMaterial().getName(); ++ String domain = "minecraft"; ++ int idx = texture.indexOf(':'); ++ if (idx != -1) ++ { ++ domain = texture.substring(0, idx); ++ texture = texture.substring(idx + 1); ++ } ++ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); ++ ++ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); ++ ResourceLocation resourcelocation = (ResourceLocation)ARMOR_TEXTURE_RES_MAP.get(s1); ++ ++ if (resourcelocation == null) ++ { ++ resourcelocation = new ResourceLocation(s1); ++ ARMOR_TEXTURE_RES_MAP.put(s1, resourcelocation); ++ } ++ ++ return resourcelocation; ++ } ++ /*=================================== FORGE END ===========================================*/ + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch new file mode 100644 index 0000000000..50001b7701 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java +@@ -49,4 +49,10 @@ + { + p_177194_1_.setInvisible(false); + } ++ ++ @Override ++ protected ModelBiped getArmorModelHook(net.minecraft.entity.EntityLivingBase entity, net.minecraft.item.ItemStack itemStack, int slot, ModelBiped model) ++ { ++ return net.minecraftforge.client.ForgeHooksClient.getArmorModel(entity, itemStack, slot, model); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch new file mode 100644 index 0000000000..fdbf34c9e6 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java +@@ -58,12 +58,17 @@ + { + Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]); + Arrays.sort((Object[])astitcher$holder); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", astitcher$holder.length); + + for (Stitcher.Holder stitcher$holder : astitcher$holder) + { ++ bar.step(stitcher$holder.getAtlasSprite().getIconName()); + if (!this.allocateSlot(stitcher$holder)) + { + String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {stitcher$holder.getAtlasSprite().getIconName(), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconWidth()), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconHeight())}); ++ net.minecraftforge.fml.common.FMLLog.info(s); ++ for (Stitcher.Holder h : astitcher$holder) ++ net.minecraftforge.fml.common.FMLLog.info(" %s", h); + throw new StitcherException(stitcher$holder, s); + } + } +@@ -73,6 +78,7 @@ + this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth); + this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight); + } ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); + } + + public List getStichSlots() +@@ -260,7 +266,7 @@ + + public String toString() + { +- return "Holder{width=" + this.width + ", height=" + this.height + '}'; ++ return "Holder{width=" + this.width + ", height=" + this.height + ", name=" + this.theTexture.getIconName() + '}'; + } + + public int compareTo(Stitcher.Holder p_compareTo_1_) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch new file mode 100644 index 0000000000..fb734bf696 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java +@@ -402,4 +402,30 @@ + { + return "TextureAtlasSprite{name=\'" + this.iconName + '\'' + ", frameCount=" + this.framesTextureData.size() + ", rotated=" + this.rotated + ", x=" + this.originX + ", y=" + this.originY + ", height=" + this.height + ", width=" + this.width + ", u0=" + this.minU + ", u1=" + this.maxU + ", v0=" + this.minV + ", v1=" + this.maxV + '}'; + } ++ ++ /*===================================== FORGE START =====================================*/ ++ /** ++ * The result of this function determines is the below 'load' function is called, and the ++ * default vanilla loading code is bypassed completely. ++ * @param manager ++ * @param location ++ * @return True to use your own custom load code and bypass vanilla loading. ++ */ ++ public boolean hasCustomLoader(net.minecraft.client.resources.IResourceManager manager, net.minecraft.util.ResourceLocation location) ++ { ++ return false; ++ } ++ ++ /** ++ * Load the specified resource as this sprite's data. ++ * Returning false from this function will prevent this icon from being stitched onto the master texture. ++ * @param manager Main resource manager ++ * @param location File resource location ++ * @return False to prevent this Icon from being stitched ++ */ ++ public boolean load(net.minecraft.client.resources.IResourceManager manager, net.minecraft.util.ResourceLocation location) ++ { ++ return true; ++ } ++ /*===================================== FORGE END ======================================*/ + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch new file mode 100644 index 0000000000..62022a2a2c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureManager.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureManager.java +@@ -137,9 +137,12 @@ + + public void onResourceManagerReload(IResourceManager resourceManager) + { ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Reloading Texture Manager", this.mapTextureObjects.keySet().size(), true); + for (Entry entry : this.mapTextureObjects.entrySet()) + { ++ bar.step(entry.getKey().toString()); + this.loadTexture((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue()); + } ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); + } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch new file mode 100644 index 0000000000..a731967169 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -0,0 +1,186 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java +@@ -28,6 +28,7 @@ + @SideOnly(Side.CLIENT) + public class TextureMap extends AbstractTexture implements ITickableTextureObject + { ++ private static final boolean ENABLE_SKIP = Boolean.parseBoolean(System.getProperty("fml.skipFirstTextureLoad", "true")); + private static final Logger logger = LogManager.getLogger(); + public static final ResourceLocation LOCATION_MISSING_TEXTURE = new ResourceLocation("missingno"); + public static final ResourceLocation locationBlocksTexture = new ResourceLocation("textures/atlas/blocks.png"); +@@ -38,6 +39,7 @@ + private final IIconCreator iconCreator; + private int mipmapLevels; + private final TextureAtlasSprite missingImage; ++ private boolean skipFirst = false; + + public TextureMap(String p_i46099_1_) + { +@@ -46,12 +48,23 @@ + + public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn) + { ++ this(p_i46100_1_, iconCreatorIn, false); ++ } ++ ++ public TextureMap(String p_i46100_1_, boolean skipFirst) ++ { ++ this(p_i46100_1_, null, skipFirst); ++ } ++ ++ public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn, boolean skipFirst) ++ { + this.listAnimatedSprites = Lists.newArrayList(); + this.mapRegisteredSprites = Maps.newHashMap(); + this.mapUploadedSprites = Maps.newHashMap(); + this.missingImage = new TextureAtlasSprite("missingno"); + this.basePath = p_i46100_1_; + this.iconCreator = iconCreatorIn; ++ this.skipFirst = skipFirst && ENABLE_SKIP; + } + + private void initMissingImage() +@@ -90,12 +103,28 @@ + int j = Integer.MAX_VALUE; + int k = 1 << this.mipmapLevels; + ++ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this); ++ net.minecraftforge.fml.common.FMLLog.info("Max texture size: %d", i); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.mapRegisteredSprites.size()); ++ ++ if(!skipFirst) + for (Entry entry : this.mapRegisteredSprites.entrySet()) + { + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); + ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.getIconName()); + ResourceLocation resourcelocation1 = this.completeResourceLocation(resourcelocation, 0); ++ bar.step(resourcelocation1.getResourcePath()); + ++ if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) ++ { ++ if (!textureatlassprite.load(resourceManager, resourcelocation)) ++ { ++ j = Math.min(j, Math.min(textureatlassprite.getIconWidth(), textureatlassprite.getIconHeight())); ++ stitcher.addSprite(textureatlassprite); ++ } ++ continue; ++ } ++ + try + { + IResource iresource = resourceManager.getResource(resourcelocation1); +@@ -145,12 +174,14 @@ + } + catch (RuntimeException runtimeexception) + { +- logger.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception); ++ //logger.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation1, runtimeexception.getMessage()); + continue; + } + catch (IOException ioexception1) + { +- logger.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1); ++ //logger.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation1); + continue; + } + +@@ -166,6 +197,7 @@ + stitcher.addSprite(textureatlassprite); + } + ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); + int j1 = Math.min(j, k); + int k1 = MathHelper.calculateLogBaseTwo(j1); + +@@ -175,8 +207,11 @@ + this.mipmapLevels = k1; + } + ++ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.mapRegisteredSprites.size()); + for (final TextureAtlasSprite textureatlassprite1 : this.mapRegisteredSprites.values()) + { ++ if (skipFirst) break; ++ bar.step(textureatlassprite1.getIconName()); + try + { + textureatlassprite1.generateMipmaps(this.mipmapLevels); +@@ -213,9 +248,13 @@ + + this.missingImage.generateMipmaps(this.mipmapLevels); + stitcher.addSprite(this.missingImage); ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); ++ skipFirst = false; ++ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 3); + + try + { ++ bar.step("Stitching"); + stitcher.doStitch(); + } + catch (StitcherException stitcherexception) +@@ -224,9 +263,11 @@ + } + + logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); ++ bar.step("Allocating GL texture"); + TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); + Map map = Maps.newHashMap(this.mapRegisteredSprites); + ++ bar.step("Uploading GL texture"); + for (TextureAtlasSprite textureatlassprite2 : stitcher.getStichSlots()) + { + String s = textureatlassprite2.getIconName(); +@@ -256,6 +297,13 @@ + { + textureatlassprite3.copyFrom(this.missingImage); + } ++ ++ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); ++ ++ // TextureUtil.saveGlTexture is gone, FIXME ++ //if (!net.minecraftforge.common.ForgeModContainer.disableStitchedFileSaving) ++ //TextureUtil.saveGlTexture(this.basePath.replaceAll("/", "_"), this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); + } + + private ResourceLocation completeResourceLocation(ResourceLocation location, int p_147634_2_) +@@ -319,4 +367,37 @@ + { + return this.missingImage; + } ++ ++ //=================================================================================================== ++ // Forge Start ++ //=================================================================================================== ++ /** ++ * Grabs the registered entry for the specified name, returning null if there was not a entry. ++ * Opposed to registerIcon, this will not instantiate the entry, useful to test if a mapping exists. ++ * ++ * @param name The name of the entry to find ++ * @return The registered entry, null if nothing was registered. ++ */ ++ public TextureAtlasSprite getTextureExtry(String name) ++ { ++ return (TextureAtlasSprite)mapRegisteredSprites.get(name); ++ } ++ ++ /** ++ * Adds a texture registry entry to this map for the specified name if one does not already exist. ++ * Returns false if the map already contains a entry for the specified name. ++ * ++ * @param name Entry name ++ * @param entry Entry instance ++ * @return True if the entry was added to the map, false otherwise. ++ */ ++ public boolean setTextureEntry(String name, TextureAtlasSprite entry) ++ { ++ if (!mapRegisteredSprites.containsKey(name)) ++ { ++ mapRegisteredSprites.put(name, entry); ++ return true; ++ } ++ return false; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch new file mode 100644 index 0000000000..d067a7ffb1 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java +@@ -197,9 +197,11 @@ + + public static void allocateTextureImpl(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_) + { ++ synchronized (net.minecraftforge.fml.client.SplashProgress.class) ++ { + deleteTexture(p_180600_0_); + bindTexture(p_180600_0_); +- ++ } + if (p_180600_1_ >= 0) + { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, p_180600_1_); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch new file mode 100644 index 0000000000..2ffb2ffa54 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java +@@ -99,15 +99,18 @@ + GlStateManager.disableLighting(); + int i = itemFrame.getRotation(); + +- if (item == Items.filled_map) ++ if (item instanceof net.minecraft.item.ItemMap) + { + i = i % 4 * 2; + } + + GlStateManager.rotate((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F); + +- if (item == Items.filled_map) ++ net.minecraftforge.client.event.RenderItemInFrameEvent event = new net.minecraftforge.client.event.RenderItemInFrameEvent(itemFrame, this); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) + { ++ if (item instanceof net.minecraft.item.ItemMap) ++ { + this.renderManager.renderEngine.bindTexture(mapBackgroundTextures); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + float f = 0.0078125F; +@@ -165,6 +168,7 @@ + textureatlassprite.updateAnimation(); + } + } ++ } + + GlStateManager.enableLighting(); + GlStateManager.popMatrix(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch new file mode 100644 index 0000000000..709342ac46 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java +@@ -78,6 +78,7 @@ + { + TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F); + } ++ else if (block != Blocks.chest) net.minecraftforge.client.ForgeHooksClient.renderTileItem(itemStackIn.getItem(), itemStackIn.getMetadata()); + else + { + TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java.patch new file mode 100644 index 0000000000..c78c4ad821 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java +@@ -23,10 +23,11 @@ + @SideOnly(Side.CLIENT) + public class TileEntityPistonRenderer extends TileEntitySpecialRenderer + { +- private final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); ++ private BlockRendererDispatcher blockRenderer; + + public void renderTileEntityAt(TileEntityPiston te, double x, double y, double z, float partialTicks, int destroyStage) + { ++ if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); + BlockPos blockpos = te.getPos(); + IBlockState iblockstate = te.getPistonState(); + Block block = iblockstate.getBlock(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch new file mode 100644 index 0000000000..1f47f6fb49 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch @@ -0,0 +1,79 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java +@@ -102,11 +102,14 @@ + { + if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared()) + { ++ if(!tileentityIn.hasFastRenderer()) ++ { + int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0); + int j = i % 65536; + int k = i / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); ++ } + BlockPos blockpos = tileentityIn.getPos(); + this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage); + } +@@ -125,6 +128,11 @@ + { + try + { ++ if(tileEntityIn.hasFastRenderer()) ++ { ++ tileentityspecialrenderer.renderTileEntityFast(tileEntityIn, x, y, z, partialTicks, destroyStage, batchBuffer.getWorldRenderer()); ++ } ++ else + tileentityspecialrenderer.renderTileEntityAt(tileEntityIn, x, y, z, partialTicks, destroyStage); + } + catch (Throwable throwable) +@@ -146,4 +154,49 @@ + { + return this.fontRenderer; + } ++ ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * Buffer used for batched TESRs ++ */ ++ private net.minecraft.client.renderer.Tessellator batchBuffer = new net.minecraft.client.renderer.Tessellator(0x200000); ++ ++ /** ++ * Prepare for a batched TESR rendering. ++ * You probably shouldn't call this manually. ++ */ ++ public void preDrawBatch() ++ { ++ batchBuffer.getWorldRenderer().begin(org.lwjgl.opengl.GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.BLOCK); ++ } ++ ++ /** ++ * Render all TESRs batched so far. ++ * You probably shouldn't call this manually. ++ */ ++ public void drawBatch(int pass) ++ { ++ renderEngine.bindTexture(net.minecraft.client.renderer.texture.TextureMap.locationBlocksTexture); ++ net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); ++ GlStateManager.blendFunc(org.lwjgl.opengl.GL11.GL_SRC_ALPHA, org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA); ++ GlStateManager.enableBlend(); ++ GlStateManager.disableCull(); ++ ++ if (net.minecraft.client.Minecraft.isAmbientOcclusionEnabled()) ++ { ++ GlStateManager.shadeModel(org.lwjgl.opengl.GL11.GL_SMOOTH); ++ } ++ else ++ { ++ GlStateManager.shadeModel(org.lwjgl.opengl.GL11.GL_FLAT); ++ } ++ ++ if(pass > 0) ++ { ++ batchBuffer.getWorldRenderer().sortVertexData((float)staticPlayerX, (float)staticPlayerY, (float)staticPlayerZ); ++ } ++ batchBuffer.draw(); ++ ++ net.minecraft.client.renderer.RenderHelper.enableStandardItemLighting(); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch new file mode 100644 index 0000000000..2dcbbec257 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch @@ -0,0 +1,9 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java +@@ -45,4 +45,6 @@ + { + return false; + } ++ ++ public void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, net.minecraft.client.renderer.WorldRenderer worldRenderer) {} + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch new file mode 100644 index 0000000000..664239ceb7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java +@@ -142,10 +142,17 @@ + NORMAL("Normal"), + COLOR("Vertex Color"), + UV("UV"), ++ // As of 1.8.8 - unused in vanilla; use GENERIC for now ++ @Deprecated + MATRIX("Bone Matrix"), ++ @Deprecated + BLEND_WEIGHT("Blend Weight"), +- PADDING("Padding"); ++ PADDING("Padding"), ++ GENERIC("Generic"); + ++ public void preDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.preDraw(this, format, element, stride, buffer); } ++ public void postDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.postDraw(this, format, element, stride, buffer); } ++ + private final String displayName; + + private EnumUsage(String displayNameIn) diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch new file mode 100644 index 0000000000..2e41170995 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/AbstractResourcePack.java ++++ ../src-work/minecraft/net/minecraft/client/resources/AbstractResourcePack.java +@@ -58,7 +58,7 @@ + + protected void logNameNotLowercase(String p_110594_1_) + { +- resourceLog.warn("ResourcePack: ignored non-lowercase namespace: %s in %s", new Object[] {p_110594_1_, this.resourcePackFile}); ++ resourceLog.warn("ResourcePack: ignored non-lowercase namespace: {} in {}", new Object[] {p_110594_1_, this.resourcePackFile}); + } + + public T getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch new file mode 100644 index 0000000000..3c23434d3e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/FallbackResourceManager.java ++++ ../src-work/minecraft/net/minecraft/client/resources/FallbackResourceManager.java +@@ -67,6 +67,7 @@ + throw new FileNotFoundException(location.toString()); + } + ++ @SuppressWarnings("resource") + protected InputStream getInputStream(ResourceLocation location, IResourcePack resourcePack) throws IOException + { + InputStream inputstream = resourcePack.getInputStream(location); diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch new file mode 100644 index 0000000000..fa44d5f1b7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/LanguageManager.java ++++ ../src-work/minecraft/net/minecraft/client/resources/LanguageManager.java +@@ -73,6 +73,7 @@ + } + + currentLocale.loadLocaleDataFiles(resourceManager, list); ++ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(currentLocale.properties, this.currentLanguage); + StringTranslate.replaceWith(currentLocale.properties); + } + diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch new file mode 100644 index 0000000000..c6fcea8cda --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/Locale.java ++++ ../src-work/minecraft/net/minecraft/client/resources/Locale.java +@@ -95,6 +95,8 @@ + + private void loadLocaleData(InputStream p_135021_1_) throws IOException + { ++ p_135021_1_ = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(properties, p_135021_1_); ++ if (p_135021_1_ == null) return; + for (String s : IOUtils.readLines(p_135021_1_, Charsets.UTF_8)) + { + if (!s.isEmpty() && s.charAt(0) != 35) diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch new file mode 100644 index 0000000000..061a43cc38 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch @@ -0,0 +1,43 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java ++++ ../src-work/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java +@@ -92,6 +92,7 @@ + public void reloadResources(List p_110541_1_) + { + this.clearResources(); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resources", p_110541_1_.size()+1, true); + logger.info("Reloading ResourceManager: " + joinerResourcePacks.join(Iterables.transform(p_110541_1_, new Function() + { + public String apply(IResourcePack p_apply_1_) +@@ -102,23 +103,32 @@ + + for (IResourcePack iresourcepack : p_110541_1_) + { ++ resReload.step(iresourcepack.getPackName()); + this.reloadResourcePack(iresourcepack); + } + ++ resReload.step("Reloading listeners"); + this.notifyReloadListeners(); ++ net.minecraftforge.fml.common.ProgressManager.pop(resReload); + } + + public void registerReloadListener(IResourceManagerReloadListener reloadListener) + { ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resource", 1); ++ resReload.step(reloadListener.getClass()); + this.reloadListeners.add(reloadListener); + reloadListener.onResourceManagerReload(this); ++ net.minecraftforge.fml.common.ProgressManager.pop(resReload); + } + + private void notifyReloadListeners() + { ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Reloading", this.reloadListeners.size()); + for (IResourceManagerReloadListener iresourcemanagerreloadlistener : this.reloadListeners) + { ++ resReload.step(iresourcemanagerreloadlistener.getClass()); + iresourcemanagerreloadlistener.onResourceManagerReload(this); + } ++ net.minecraftforge.fml.common.ProgressManager.pop(resReload); + } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch new file mode 100644 index 0000000000..327276eb4b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch @@ -0,0 +1,9 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/model/IBakedModel.java ++++ ../src-work/minecraft/net/minecraft/client/resources/model/IBakedModel.java +@@ -23,5 +23,6 @@ + + TextureAtlasSprite getParticleTexture(); + ++ @Deprecated + ItemCameraTransforms getItemCameraTransforms(); + } diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch new file mode 100644 index 0000000000..cdc15c69cd --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch @@ -0,0 +1,124 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/model/ModelBakery.java ++++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelBakery.java +@@ -114,7 +114,7 @@ + } + catch (Exception var6) + { +- LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation); ++ LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, var6); + } + } + catch (Exception exception) +@@ -294,6 +294,7 @@ + + protected void registerVariantNames() + { ++ this.variantNames.clear(); //FML clear this to prevent double ups. + this.variantNames.put(Item.getItemFromBlock(Blocks.stone), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.dirt), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.planks), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); +@@ -336,6 +337,10 @@ + this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence_gate), Lists.newArrayList(new String[] {"oak_fence_gate"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence), Lists.newArrayList(new String[] {"oak_fence"})); + this.variantNames.put(Items.oak_door, Lists.newArrayList(new String[] {"oak_door"})); ++ for (Entry, Set> e : customVariantNames.entrySet()) ++ { ++ this.variantNames.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator())); ++ } + } + + protected List getVariantNames(Item p_177596_1_) +@@ -352,7 +357,7 @@ + + protected ResourceLocation getItemLocation(String p_177583_1_) + { +- ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_); ++ ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_.replaceAll("#.*", "")); + return new ResourceLocation(resourcelocation.getResourceDomain(), "item/" + resourcelocation.getResourcePath()); + } + +@@ -395,7 +400,7 @@ + for (Entry entry : this.itemLocations.entrySet()) + { + ResourceLocation resourcelocation = (ResourceLocation)entry.getValue(); +- ModelResourceLocation modelresourcelocation1 = new ModelResourceLocation((String)entry.getKey(), "inventory"); ++ ModelResourceLocation modelresourcelocation1 = net.minecraftforge.client.model.ModelLoader.getInventoryVariant(entry.getKey()); + ModelBlock modelblock1 = (ModelBlock)this.models.get(resourcelocation); + + if (modelblock1 != null && modelblock1.isResolved()) +@@ -453,6 +458,11 @@ + + private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked) + { ++ return bakeModel(modelBlockIn, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); ++ } ++ ++ protected IBakedModel bakeModel(ModelBlock modelBlockIn, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) ++ { + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle"))); + SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite); + +@@ -463,13 +473,13 @@ + BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); + TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture))); + +- if (blockpartface.cullFace == null) ++ if (blockpartface.cullFace == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix())) + { + simplebakedmodel$builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); + } + else + { +- simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); ++ simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); + } + } + } +@@ -479,6 +489,11 @@ + + private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) + { ++ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation)p_177589_5_, p_177589_6_); ++ } ++ ++ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) ++ { + return this.faceBakery.makeBakedQuad(p_177589_1_.positionFrom, p_177589_1_.positionTo, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.partRotation, p_177589_6_, p_177589_1_.shade); + } + +@@ -722,4 +737,35 @@ + MODEL_CLOCK.name = "class generation marker"; + MODEL_ENTITY.name = "block entity marker"; + } ++ ++ /*********************************************************** ++ * FML Start ++ ***********************************************************/ ++ private static Map, Set> customVariantNames = Maps.newHashMap(); ++ /** ++ * @deprecated use registerItemVariants ++ */ ++ @Deprecated ++ public static void addVariantName(Item item, String... names) ++ { ++ if (customVariantNames.containsKey(item.delegate)) ++ customVariantNames.get(item.delegate).addAll(Lists.newArrayList(names)); ++ else ++ customVariantNames.put(item.delegate, Sets.newHashSet(names)); ++ } ++ ++ public static void registerItemVariants(Item item, T... names) ++ { ++ if (!customVariantNames.containsKey(item.delegate)) ++ { ++ customVariantNames.put(item.delegate, Sets.newHashSet()); ++ } ++ for(ResourceLocation name : names) ++ { ++ customVariantNames.get(item.delegate).add(name.toString()); ++ } ++ } ++ /*********************************************************** ++ * FML End ++ ***********************************************************/ + } diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch new file mode 100644 index 0000000000..62b6e2b6ee --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/model/ModelManager.java ++++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelManager.java +@@ -24,9 +24,10 @@ + + public void onResourceManagerReload(IResourceManager resourceManager) + { +- ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider); ++ ModelBakery modelbakery = new net.minecraftforge.client.model.ModelLoader(resourceManager, this.texMap, this.modelProvider); + this.modelRegistry = modelbakery.setupModelRegistry(); + this.defaultModel = (IBakedModel)this.modelRegistry.getObject(ModelBakery.MODEL_MISSING); ++ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelRegistry, modelbakery); + this.modelProvider.reloadModels(); + } + diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch new file mode 100644 index 0000000000..c3643e8c62 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/model/ModelRotation.java ++++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelRotation.java +@@ -10,7 +10,7 @@ + import org.lwjgl.util.vector.Vector3f; + + @SideOnly(Side.CLIENT) +-public enum ModelRotation ++public enum ModelRotation implements net.minecraftforge.client.model.IModelState, net.minecraftforge.client.model.ITransformation + { + X0_Y0(0, 0), + X0_Y90(0, 90), +@@ -116,4 +116,9 @@ + mapRotations.put(Integer.valueOf(modelrotation.combinedXY), modelrotation); + } + } ++ ++ public com.google.common.base.Optional apply(com.google.common.base.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(getMatrix(), part); } ++ public javax.vecmath.Matrix4f getMatrix() { return net.minecraftforge.client.ForgeHooksClient.getMatrix(this); } ++ public EnumFacing rotate(EnumFacing facing) { return rotateFace(facing); } ++ public int rotate(EnumFacing facing, int vertexIndex) { return rotateVertex(facing, vertexIndex); } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch new file mode 100644 index 0000000000..10da977f0c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/settings/GameSettings.java ++++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java +@@ -994,6 +994,7 @@ + + public void saveOptions() + { ++ if (net.minecraftforge.fml.client.FMLClientHandler.instance().isLoading()) return; + try + { + PrintWriter printwriter = new PrintWriter(new FileWriter(this.optionsFile)); diff --git a/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch new file mode 100644 index 0000000000..ec5e56034d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch @@ -0,0 +1,57 @@ +--- ../src-base/minecraft/net/minecraft/client/shader/Framebuffer.java ++++ ../src-work/minecraft/net/minecraft/client/shader/Framebuffer.java +@@ -119,8 +119,17 @@ + if (this.useDepth) + { + OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); ++ if (!this.stencilEnabled) ++ { + OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight); + OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); ++ } ++ else ++ { ++ OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.framebufferTextureWidth, this.framebufferTextureHeight); ++ OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); ++ OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); ++ } + } + + this.framebufferClear(); +@@ -280,4 +289,36 @@ + GlStateManager.clear(i); + this.unbindFramebuffer(); + } ++ ++ /*================================ FORGE START ================================================*/ ++ private boolean stencilEnabled = false; ++ /** ++ * Attempts to enabled 8 bits of stencil buffer on this FrameBuffer. ++ * Modders must call this directly to set things up. ++ * This is to prevent the default cause where graphics cards do not support stencil bits. ++ * Modders should check the below 'isStencilEnabled' to check if another modder has already enabled them. ++ * ++ * Note: ++ * As of now the only thing that is checked is if FBOs are supported entirely, in the future ++ * we may expand to check for errors. ++ * ++ * @return True if the FBO was re-initialized with stencil bits. ++ */ ++ public boolean enableStencil() ++ { ++ if (!OpenGlHelper.isFramebufferEnabled()) return false; ++ stencilEnabled = true; ++ this.createBindFramebuffer(framebufferWidth, framebufferHeight); ++ return true; //TODO: Find a way to detect if this failed? ++ } ++ ++ /** ++ * Returns wither or not this FBO has been successfully initialized with stencil bits. ++ * If not, and a modder wishes it to be, they must call enableStencil. ++ */ ++ public boolean isStencilEnabled() ++ { ++ return this.stencilEnabled; ++ } ++ /*================================ FORGE END ================================================*/ + } diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandBase.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandBase.java.patch new file mode 100644 index 0000000000..5355ef914b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/command/CommandBase.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/command/CommandBase.java ++++ ../src-work/minecraft/net/minecraft/command/CommandBase.java +@@ -329,7 +329,7 @@ + ichatcomponent.appendText(" "); + } + +- IChatComponent ichatcomponent1 = new ChatComponentText(args[i]); ++ IChatComponent ichatcomponent1 = net.minecraftforge.common.ForgeHooks.newChatWithLinks(args[i]); // Forge: links for messages + + if (p_147176_3_) + { diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch new file mode 100644 index 0000000000..630385eaab --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/command/CommandEnchant.java ++++ ../src-work/minecraft/net/minecraft/command/CommandEnchant.java +@@ -93,7 +93,7 @@ + { + Enchantment enchantment2 = Enchantment.getEnchantmentById(l); + +- if (!enchantment2.canApplyTogether(enchantment1)) ++ if (!enchantment2.canApplyTogether(enchantment1) || !enchantment1.canApplyTogether(enchantment2)) //Forge BugFix: Let Both enchantments veto being together + { + throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment1.getTranslatedName(j), enchantment2.getTranslatedName(nbttaglist.getCompoundTagAt(k).getShort("lvl"))}); + } diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch new file mode 100644 index 0000000000..777a3d0617 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/command/CommandFill.java ++++ ../src-work/minecraft/net/minecraft/command/CommandFill.java +@@ -48,6 +48,7 @@ + { + i = parseInt(args[7], 0, 15); + } ++ IBlockState state = block.getStateFromMeta(i); + + BlockPos blockpos2 = new BlockPos(Math.min(blockpos.getX(), blockpos1.getX()), Math.min(blockpos.getY(), blockpos1.getY()), Math.min(blockpos.getZ(), blockpos1.getZ())); + BlockPos blockpos3 = new BlockPos(Math.max(blockpos.getX(), blockpos1.getX()), Math.max(blockpos.getY(), blockpos1.getY()), Math.max(blockpos.getZ(), blockpos1.getZ())); +@@ -75,7 +76,7 @@ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + +- if (args.length >= 10 && block.hasTileEntity()) ++ if (args.length >= 10 && block.hasTileEntity(state)) + { + String s = getChatComponentFromNthArg(sender, args, 9).getUnformattedText(); + +@@ -116,7 +117,7 @@ + continue; + } + } +- else if (args[8].equals("replace") && !block.hasTileEntity()) ++ else if (args[8].equals("replace") && !block.hasTileEntity(state)) + { + if (args.length > 9) + { diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch new file mode 100644 index 0000000000..dc2cf60369 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/command/CommandHandler.java ++++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java +@@ -44,6 +44,16 @@ + } + else if (icommand.canCommandSenderUseCommand(sender)) + { ++ net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(icommand, sender, astring); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) ++ { ++ if (event.exception != null) ++ { ++ com.google.common.base.Throwables.propagateIfPossible(event.exception); ++ } ++ return 1; ++ } ++ + if (i > -1) + { + List list = PlayerSelector.matchEntities(sender, astring[i], Entity.class); +@@ -107,7 +117,7 @@ + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.generic.exception", new Object[0]); + chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); + sender.addChatMessage(chatcomponenttranslation); +- logger.warn("Couldn\'t process command: \'" + input + "\'"); ++ logger.warn("Couldn\'t process command: \'" + input + "\'", var9); // Forge: Log stacktrace of unknown exceptions + } + + return false; diff --git a/patches.mcp/minecraft/net/minecraft/command/PlayerSelector.java.patch b/patches.mcp/minecraft/net/minecraft/command/PlayerSelector.java.patch new file mode 100644 index 0000000000..2a904ba288 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/command/PlayerSelector.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/command/PlayerSelector.java ++++ ../src-work/minecraft/net/minecraft/command/PlayerSelector.java +@@ -36,9 +36,9 @@ + + public class PlayerSelector + { +- private static final Pattern tokenPattern = Pattern.compile("^@([pare])(?:\\[([\\w=,!-]*)\\])?$"); ++ private static final Pattern tokenPattern = Pattern.compile("^@([pare])(?:\\[([\\w\\.=,!-]*)\\])?$"); // FORGE: allow . in entity selectors + private static final Pattern intListPattern = Pattern.compile("\\G([-!]?[\\w-]*)(?:$|,)"); +- private static final Pattern keyValueListPattern = Pattern.compile("\\G(\\w+)=([-!]?[\\w-]*)(?:$|,)"); ++ private static final Pattern keyValueListPattern = Pattern.compile("\\G(\\w+)=([-!]?[\\w\\.-]*)(?:$|,)"); // FORGE: allow . in entity selectors + private static final Set WORLD_BINDING_ARGS = Sets.newHashSet(new String[] {"x", "y", "z", "dx", "dy", "dz", "rm", "r"}); + + public static EntityPlayerMP matchOnePlayer(ICommandSender sender, String token) diff --git a/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch b/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch new file mode 100644 index 0000000000..b672663398 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/command/server/CommandSetBlock.java ++++ ../src-work/minecraft/net/minecraft/command/server/CommandSetBlock.java +@@ -52,6 +52,8 @@ + i = parseInt(args[4], 0, 15); + } + ++ IBlockState state = block.getStateFromMeta(i); ++ + World world = sender.getEntityWorld(); + + if (!world.isBlockLoaded(blockpos)) +@@ -63,7 +65,7 @@ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + +- if (args.length >= 7 && block.hasTileEntity()) ++ if (args.length >= 7 && block.hasTileEntity(state)) + { + String s = getChatComponentFromNthArg(sender, args, 6).getUnformattedText(); + diff --git a/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch b/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch new file mode 100644 index 0000000000..be6dce5388 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/command/server/CommandTestForBlock.java ++++ ../src-work/minecraft/net/minecraft/command/server/CommandTestForBlock.java +@@ -70,7 +70,7 @@ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + +- if (args.length >= 6 && block.hasTileEntity()) ++ if (args.length >= 6 && block.hasTileEntity(block.getStateFromMeta(i))) + { + String s = getChatComponentFromNthArg(sender, args, 5).getUnformattedText(); + diff --git a/patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch b/patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch new file mode 100644 index 0000000000..2ad18820d5 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/crash/CrashReport.java ++++ ../src-work/minecraft/net/minecraft/crash/CrashReport.java +@@ -115,6 +115,7 @@ + return IntCache.getCacheSizes(); + } + }); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().enhanceCrashReport(this, this.theReportCategory); + } + + public String getDescription() +@@ -203,6 +204,8 @@ + { + StringBuilder stringbuilder = new StringBuilder(); + stringbuilder.append("---- Minecraft Crash Report ----\n"); ++ net.minecraftforge.fml.common.asm.transformers.BlamingTransformer.onCrash(stringbuilder); ++ net.minecraftforge.fml.relauncher.CoreModManager.onCrash(stringbuilder); + stringbuilder.append("// "); + stringbuilder.append(getWittyComment()); + stringbuilder.append("\n\n"); diff --git a/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch b/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch new file mode 100644 index 0000000000..3918b6866f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch @@ -0,0 +1,16 @@ +--- ../src-base/minecraft/net/minecraft/crash/CrashReportCategory.java ++++ ../src-work/minecraft/net/minecraft/crash/CrashReportCategory.java +@@ -117,8 +117,11 @@ + } + else + { +- this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - size]; +- System.arraycopy(astacktraceelement, 3 + size, this.stackTrace, 0, this.stackTrace.length); ++ int len = astacktraceelement.length - 3 - size; ++ // Really Mojang, Still, god damn... ++ if (len <= 0) len = astacktraceelement.length; ++ this.stackTrace = new StackTraceElement[len]; ++ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.stackTrace, 0, this.stackTrace.length); + return this.stackTrace.length; + } + } diff --git a/patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch b/patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch new file mode 100644 index 0000000000..83ecfbcea4 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch @@ -0,0 +1,106 @@ +--- ../src-base/minecraft/net/minecraft/creativetab/CreativeTabs.java ++++ ../src-work/minecraft/net/minecraft/creativetab/CreativeTabs.java +@@ -125,8 +125,22 @@ + @SideOnly(Side.CLIENT) + private ItemStack iconItemStack; + ++ public CreativeTabs(String label) ++ { ++ this(getNextID(), label); ++ } ++ + public CreativeTabs(int index, String label) + { ++ if (index >= creativeTabArray.length) ++ { ++ CreativeTabs[] tmp = new CreativeTabs[index + 1]; ++ for (int x = 0; x < creativeTabArray.length; x++) ++ { ++ tmp[x] = creativeTabArray[x]; ++ } ++ creativeTabArray = tmp; ++ } + this.tabIndex = index; + this.tabLabel = label; + creativeTabArray[index] = this; +@@ -209,12 +223,20 @@ + @SideOnly(Side.CLIENT) + public int getTabColumn() + { ++ if (tabIndex > 11) ++ { ++ return ((tabIndex - 12) % 10) % 5; ++ } + return this.tabIndex % 6; + } + + @SideOnly(Side.CLIENT) + public boolean isTabInFirstRow() + { ++ if (tabIndex > 11) ++ { ++ return ((tabIndex - 12) % 10) < 5; ++ } + return this.tabIndex < 6; + } + +@@ -256,10 +278,17 @@ + { + for (Item item : Item.itemRegistry) + { +- if (item != null && item.getCreativeTab() == this) ++ if (item == null) + { +- item.getSubItems(item, this, p_78018_1_); ++ continue; + } ++ for (CreativeTabs tab : item.getCreativeTabs()) ++ { ++ if (tab == this) ++ { ++ item.getSubItems(item, this, p_78018_1_); ++ } ++ } + } + + if (this.getRelevantEnchantmentTypes() != null) +@@ -292,4 +321,39 @@ + } + } + } ++ ++ public int getTabPage() ++ { ++ if (tabIndex > 11) ++ { ++ return ((tabIndex - 12) / 10) + 1; ++ } ++ return 0; ++ } ++ ++ public static int getNextID() ++ { ++ return creativeTabArray.length; ++ } ++ ++ /** ++ * Determines if the search bar should be shown for this tab. ++ * ++ * @return True to show the bar ++ */ ++ public boolean hasSearchBar() ++ { ++ return tabIndex == CreativeTabs.tabAllSearch.tabIndex; ++ } ++ ++ /** ++ * Gets the width of the search bar of the creative tab, use this if your ++ * creative tab name overflows together with a custom texture. ++ * ++ * @return The width of the search bar, 89 by default ++ */ ++ public int getSearchbarWidth() ++ { ++ return 89; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch new file mode 100644 index 0000000000..f3dc07bd21 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -0,0 +1,66 @@ +--- ../src-base/minecraft/net/minecraft/enchantment/Enchantment.java ++++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java +@@ -61,7 +61,7 @@ + + if (enchantmentsList[enchID] != null) + { +- throw new IllegalArgumentException("Duplicate enchantment id!"); ++ throw new IllegalArgumentException("Duplicate enchantment id! " + this.getClass() + " and " + enchantmentsList[enchID].getClass() + " Enchantment ID:" + enchID); + } + else + { +@@ -139,7 +139,7 @@ + + public boolean canApply(ItemStack stack) + { +- return this.type.canEnchantItem(stack.getItem()); ++ return canApplyAtEnchantingTable(stack); + } + + public void onEntityDamaged(EntityLivingBase user, Entity target, int level) +@@ -150,6 +150,45 @@ + { + } + ++ /** ++ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)} ++ * applies for all possible enchantments. ++ * @param stack ++ * @return ++ */ ++ public boolean canApplyAtEnchantingTable(ItemStack stack) ++ { ++ return this.type.canEnchantItem(stack.getItem()); ++ } ++ ++ private static final java.lang.reflect.Field bookSetter = Enchantment.class.getDeclaredFields()[1]; ++ /** ++ * Add to the list of enchantments applicable by the anvil from a book ++ * ++ * @param enchantment ++ */ ++ public static void addToBookList(Enchantment enchantment) ++ { ++ try ++ { ++ net.minecraftforge.common.util.EnumHelper.setFailsafeFieldValue(bookSetter, null, ++ com.google.common.collect.ObjectArrays.concat(enchantmentsBookList, enchantment)); ++ } ++ catch (Exception e) ++ { ++ throw new RuntimeException(e); //Rethrow see what happens ++ } ++ } ++ ++ /** ++ * Is this enchantment allowed to be enchanted on books via Enchantment Table ++ * @return false to disable the vanilla feature ++ */ ++ public boolean isAllowedOnBooks() ++ { ++ return true; ++ } ++ + static + { + List list = Lists.newArrayList(); diff --git a/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch new file mode 100644 index 0000000000..854ea8d5d5 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -0,0 +1,41 @@ +--- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java ++++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java +@@ -296,7 +296,7 @@ + public static int calcItemStackEnchantability(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) + { + Item item = p_77514_3_.getItem(); +- int i = item.getItemEnchantability(); ++ int i = item.getItemEnchantability(p_77514_3_); + + if (i <= 0) + { +@@ -345,7 +345,7 @@ + public static List buildEnchantmentList(Random randomIn, ItemStack itemStackIn, int p_77513_2_) + { + Item item = itemStackIn.getItem(); +- int i = item.getItemEnchantability(); ++ int i = item.getItemEnchantability(itemStackIn); + + if (i <= 0) + { +@@ -387,7 +387,9 @@ + + for (EnchantmentData enchantmentdata1 : list) + { +- if (!enchantmentdata1.enchantmentobj.canApplyTogether(Enchantment.getEnchantmentById(integer.intValue()))) ++ Enchantment e1 = enchantmentdata1.enchantmentobj; ++ Enchantment e2 = Enchantment.getEnchantmentById(integer.intValue()); ++ if (!e1.canApplyTogether(e2) || !e2.canApplyTogether(e1)) //Forge BugFix: Let Both enchantments veto being together + { + flag = false; + break; +@@ -421,7 +423,8 @@ + + for (Enchantment enchantment : Enchantment.enchantmentsBookList) + { +- if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) ++ if (enchantment == null) continue; ++ if (enchantment.canApplyAtEnchantingTable(p_77505_1_) || (flag && enchantment.isAllowedOnBooks())) + { + for (int i = enchantment.getMinLevel(); i <= enchantment.getMaxLevel(); ++i) + { diff --git a/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch b/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch new file mode 100644 index 0000000000..2691d82dfc --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch @@ -0,0 +1,356 @@ +--- ../src-base/minecraft/net/minecraft/entity/Entity.java ++++ ../src-work/minecraft/net/minecraft/entity/Entity.java +@@ -49,7 +49,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public abstract class Entity implements ICommandSender ++public abstract class Entity implements ICommandSender, net.minecraftforge.common.capabilities.ICapabilitySerializable + { + private static final AxisAlignedBB ZERO_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + private static int nextEntityID; +@@ -129,6 +129,15 @@ + protected UUID entityUniqueID; + private final CommandResultStats cmdResultStats; + ++ /** Forge: Used to store custom data for each entity. */ ++ private NBTTagCompound customEntityData; ++ public boolean captureDrops = false; ++ public java.util.ArrayList capturedDrops = new java.util.ArrayList(); ++ ++ @Deprecated //ToDo: Move to Capabilities? ++ protected java.util.HashMap extendedProperties = new java.util.HashMap(); ++ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities; ++ + public int getEntityId() + { + return this.entityId; +@@ -172,6 +181,9 @@ + this.dataWatcher.addObject(2, ""); + this.dataWatcher.addObject(4, Byte.valueOf((byte)0)); + this.entityInit(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); ++ for (net.minecraftforge.common.IExtendedEntityProperties props : extendedProperties.values()) props.init(this, worldIn); ++ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this); + } + + protected abstract void entityInit(); +@@ -996,12 +1008,12 @@ + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + ++ Boolean result = block.isEntityInsideMaterial(this.worldObj, blockpos, iblockstate, this, d0, materialIn, true); ++ if (result != null) return result; ++ + if (block.getMaterial() == materialIn) + { +- float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F; +- float f1 = (float)(blockpos.getY() + 1) - f; +- boolean flag = d0 < (double)f1; +- return !flag && this instanceof EntityPlayer ? false : flag; ++ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(materialIn, this, blockpos); + } + else + { +@@ -1356,6 +1368,23 @@ + tagCompund.setBoolean("Silent", this.isSilent()); + } + ++ if (customEntityData != null) tagCompund.setTag("ForgeData", customEntityData); ++ for (String identifier : this.extendedProperties.keySet()) ++ { ++ try ++ { ++ net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); ++ props.saveNBTData(tagCompund); ++ } ++ catch (Throwable t) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe("Failed to save extended properties for %s. This is a mod issue.", identifier); ++ t.printStackTrace(); ++ } ++ } ++ ++ if (this.capabilities != null) tagCompund.setTag("ForgeCaps", this.capabilities.serializeNBT()); ++ + this.writeEntityToNBT(tagCompund); + + if (this.ridingEntity != null) +@@ -1438,6 +1467,30 @@ + this.setAlwaysRenderNameTag(tagCompund.getBoolean("CustomNameVisible")); + this.cmdResultStats.readStatsFromNBT(tagCompund); + this.setSilent(tagCompund.getBoolean("Silent")); ++ ++ if (tagCompund.hasKey("ForgeData")) customEntityData = tagCompund.getCompoundTag("ForgeData"); ++ for (String identifier : this.extendedProperties.keySet()) ++ { ++ try ++ { ++ net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); ++ props.loadNBTData(tagCompund); ++ } ++ catch (Throwable t) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe("Failed to load extended properties for %s. This is a mod issue.", identifier); ++ t.printStackTrace(); ++ } ++ } ++ ++ //Rawr, legacy code, Vanilla added a UUID, keep this so older maps will convert properly TODO: Remove in 1.9 ++ if (tagCompund.hasKey("PersistentIDMSB") && tagCompund.hasKey("PersistentIDLSB")) ++ { ++ this.entityUniqueID = new UUID(tagCompund.getLong("PersistentIDMSB"), tagCompund.getLong("PersistentIDLSB")); ++ } ++ ++ if (this.capabilities != null && tagCompund.hasKey("ForgeCaps")) this.capabilities.deserializeNBT(tagCompund.getCompoundTag("ForgeCaps")); ++ + this.readEntityFromNBT(tagCompund); + + if (this.shouldSetPosAfterLoading()) +@@ -1512,7 +1565,10 @@ + { + EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, itemStackIn); + entityitem.setDefaultPickupDelay(); +- this.worldObj.spawnEntityInWorld(entityitem); ++ if (captureDrops) ++ this.capturedDrops.add(entityitem); ++ else ++ this.worldObj.spawnEntityInWorld(entityitem); + return entityitem; + } + else +@@ -1655,6 +1711,7 @@ + + public void mountEntity(Entity entityIn) + { ++ if(!(this instanceof EntityLivingBase) && !net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } + this.entityRiderPitchDelta = 0.0D; + this.entityRiderYawDelta = 0.0D; + +@@ -2049,6 +2106,7 @@ + { + if (!this.worldObj.isRemote && !this.isDead) + { ++ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, dimensionId)) return; + this.worldObj.theProfiler.startSection("changeDimension"); + MinecraftServer minecraftserver = MinecraftServer.getServer(); + int i = this.dimension; +@@ -2092,7 +2150,7 @@ + + public float getExplosionResistance(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn) + { +- return blockStateIn.getBlock().getExplosionResistance(this); ++ return blockStateIn.getBlock().getExplosionResistance(worldIn, pos, this, explosionIn); + } + + public boolean verifyExplosion(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn, float p_174816_5_) +@@ -2353,4 +2411,209 @@ + + EnchantmentHelper.applyArthropodEnchantments(entityLivingBaseIn, entityIn); + } ++ ++ /* ================================== Forge Start =====================================*/ ++ /** ++ * Returns a NBTTagCompound that can be used to store custom data for this entity. ++ * It will be written, and read from disc, so it persists over world saves. ++ * @return A NBTTagCompound ++ */ ++ public NBTTagCompound getEntityData() ++ { ++ if (customEntityData == null) ++ { ++ customEntityData = new NBTTagCompound(); ++ } ++ return customEntityData; ++ } ++ ++ /** ++ * Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position. ++ * @return false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation. ++ */ ++ public boolean shouldRiderSit() ++ { ++ return true; ++ } ++ ++ /** ++ * Called when a user uses the creative pick block button on this entity. ++ * ++ * @param target The full target the player is looking at ++ * @return A ItemStack to add to the player's inventory, Null if nothing should be added. ++ */ ++ public ItemStack getPickedResult(MovingObjectPosition target) ++ { ++ if (this instanceof net.minecraft.entity.item.EntityPainting) ++ { ++ return new ItemStack(net.minecraft.init.Items.painting); ++ } ++ else if (this instanceof EntityLeashKnot) ++ { ++ return new ItemStack(net.minecraft.init.Items.lead); ++ } ++ else if (this instanceof net.minecraft.entity.item.EntityItemFrame) ++ { ++ ItemStack held = ((net.minecraft.entity.item.EntityItemFrame)this).getDisplayedItem(); ++ if (held == null) ++ { ++ return new ItemStack(net.minecraft.init.Items.item_frame); ++ } ++ else ++ { ++ return held.copy(); ++ } ++ } ++ else if (this instanceof net.minecraft.entity.item.EntityMinecart) ++ { ++ return ((net.minecraft.entity.item.EntityMinecart)this).getCartItem(); ++ } ++ else if (this instanceof net.minecraft.entity.item.EntityBoat) ++ { ++ return new ItemStack(net.minecraft.init.Items.boat); ++ } ++ else if (this instanceof net.minecraft.entity.item.EntityArmorStand) ++ { ++ return new ItemStack(net.minecraft.init.Items.armor_stand); ++ } ++ else ++ { ++ int id = EntityList.getEntityID(this); ++ if (id > 0 && EntityList.entityEggs.containsKey(id)) ++ { ++ return new ItemStack(net.minecraft.init.Items.spawn_egg, 1, id); ++ } ++ String name = EntityList.getEntityString(this); ++ if (name != null && net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().containsKey(name)) ++ { ++ ItemStack stack = new ItemStack(net.minecraft.init.Items.spawn_egg); ++ stack.setTagInfo("entity_name", new net.minecraft.nbt.NBTTagString(name)); ++ return stack; ++ } ++ } ++ return null; ++ } ++ ++ public UUID getPersistentID() ++ { ++ return entityUniqueID; ++ } ++ ++ /** ++ * Reset the entity ID to a new value. Not to be used from Mod code ++ */ ++ public final void resetEntityId() ++ { ++ this.entityId = nextEntityID++; ++ } ++ ++ public boolean shouldRenderInPass(int pass) ++ { ++ return pass == 0; ++ } ++ ++ /** ++ * Returns true if the entity is of the @link{EnumCreatureType} provided ++ * @param type The EnumCreatureType type this entity is evaluating ++ * @param forSpawnCount If this is being invoked to check spawn count caps. ++ * @return If the creature is of the type provided ++ */ ++ public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) ++ { ++ if (forSpawnCount && (this instanceof EntityLiving) && ((EntityLiving)this).isNoDespawnRequired()) return false; ++ return type.getCreatureClass().isAssignableFrom(this.getClass()); ++ } ++ ++ /** ++ * Register the instance of IExtendedProperties into the entity's collection. ++ * @param identifier The identifier which you can use to retrieve these properties for the entity. ++ * @param properties The instanceof IExtendedProperties to register ++ * @return The identifier that was used to register the extended properties. Empty String indicates an error. If your requested key already existed, this will return a modified one that is unique. ++ */ ++ public String registerExtendedProperties(String identifier, net.minecraftforge.common.IExtendedEntityProperties properties) ++ { ++ if (identifier == null) ++ { ++ net.minecraftforge.fml.common.FMLLog.warning("Someone is attempting to register extended properties using a null identifier. This is not allowed. Aborting. This may have caused instability."); ++ return ""; ++ } ++ if (properties == null) ++ { ++ net.minecraftforge.fml.common.FMLLog.warning("Someone is attempting to register null extended properties. This is not allowed. Aborting. This may have caused instability."); ++ return ""; ++ } ++ ++ String baseIdentifier = identifier; ++ int identifierModCount = 1; ++ while (this.extendedProperties.containsKey(identifier)) ++ { ++ identifier = String.format("%s%d", baseIdentifier, identifierModCount++); ++ } ++ ++ if (baseIdentifier != identifier) ++ { ++ net.minecraftforge.fml.common.FMLLog.info("An attempt was made to register exended properties using an existing key. The duplicate identifier (%s) has been remapped to %s.", baseIdentifier, identifier); ++ } ++ ++ this.extendedProperties.put(identifier, properties); ++ return identifier; ++ } ++ ++ /** ++ * Gets the extended properties identified by the passed in key ++ * @param identifier The key that identifies the extended properties. ++ * @return The instance of IExtendedProperties that was found, or null. ++ */ ++ public net.minecraftforge.common.IExtendedEntityProperties getExtendedProperties(String identifier) ++ { ++ return this.extendedProperties.get(identifier); ++ } ++ ++ /** ++ * If a rider of this entity can interact with this entity. Should return true on the ++ * ridden entity if so. ++ * ++ * @return if the entity can be interacted with from a rider ++ */ ++ public boolean canRiderInteract() ++ { ++ return false; ++ } ++ ++ /** ++ * If the rider should be dismounted from the entity when the entity goes under water ++ * ++ * @param rider The entity that is riding ++ * @return if the entity should be dismounted when under water ++ */ ++ public boolean shouldDismountInWater(Entity rider) ++ { ++ return this instanceof EntityLivingBase; ++ } ++ ++ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ if (getCapability(capability, facing) != null) ++ return true; ++ return capabilities == null ? false : capabilities.hasCapability(capability, facing); ++ } ++ ++ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ return capabilities == null ? null : capabilities.getCapability(capability, facing); ++ } ++ ++ public void deserializeNBT(NBTTagCompound nbt) ++ { ++ this.readFromNBT(nbt); ++ } ++ ++ public NBTTagCompound serializeNBT() ++ { ++ NBTTagCompound ret = new NBTTagCompound(); ++ ret.setString("id", this.getEntityString()); ++ this.writeToNBT(ret); ++ return ret; ++ } ++ /* ================================== Forge End =====================================*/ + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityAgeable.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityAgeable.java.patch new file mode 100644 index 0000000000..7fa218dc7f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityAgeable.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityAgeable.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityAgeable.java +@@ -31,7 +31,7 @@ + { + if (!this.worldObj.isRemote) + { +- Class oclass = EntityList.getClassFromID(itemstack.getMetadata()); ++ Class oclass = EntityList.stringToClassMapping.get(net.minecraft.item.ItemMonsterPlacer.getEntityName(itemstack)); + + if (oclass != null && this.getClass() == oclass) + { diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch new file mode 100644 index 0000000000..a249f305a0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityHanging.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityHanging.java +@@ -123,6 +123,9 @@ + { + BlockPos blockpos1 = blockpos.offset(enumfacing, k).up(l); + Block block = this.worldObj.getBlockState(blockpos1).getBlock(); ++ ++ if ( block.isSideSolid( this.worldObj, blockpos1, this.facingDirection )) ++ continue; + + if (!block.getMaterial().isSolid() && !BlockRedstoneDiode.isRedstoneRepeaterBlockID(block)) + { diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch new file mode 100644 index 0000000000..7b099fb5e7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch @@ -0,0 +1,68 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityList.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityList.java +@@ -88,6 +88,7 @@ + + public static void addMapping(Class entityClass, String entityName, int id) + { ++ if (id < 0 || id > 255) throw new IllegalArgumentException("Attempted to register a entity with invalid ID: " + id + " Name: " + entityName + " Class: " + entityClass); + if (stringToClassMapping.containsKey(entityName)) + { + throw new IllegalArgumentException("ID is already registered: " + entityName); +@@ -151,9 +152,10 @@ + nbt.removeTag("Type"); + } + ++ Class oclass = null; + try + { +- Class oclass = (Class)stringToClassMapping.get(nbt.getString("id")); ++ oclass = stringToClassMapping.get(nbt.getString("id")); + + if (oclass != null) + { +@@ -167,7 +169,17 @@ + + if (entity != null) + { ++ try ++ { + entity.readFromNBT(nbt); ++ } ++ catch (Exception e) ++ { ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, ++ "An Entity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", ++ nbt.getString("id"), oclass.getName()); ++ entity = null; ++ } + } + else + { +@@ -343,7 +355,9 @@ + + public static class EntityEggInfo + { ++ @Deprecated // This is not always a valid number in the global ID list. + public final int spawnedID; ++ public final String name; + public final int primaryColor; + public final int secondaryColor; + public final StatBase field_151512_d; +@@ -356,6 +370,17 @@ + this.secondaryColor = spotColor; + this.field_151512_d = StatList.getStatKillEntity(this); + this.field_151513_e = StatList.getStatEntityKilledBy(this); ++ this.name = EntityList.getStringFromID(id); + } ++ ++ public EntityEggInfo(String name, int primaryColor, int secondaryColor) ++ { ++ this.spawnedID = -1; ++ this.name = name; ++ this.primaryColor = primaryColor; ++ this.secondaryColor = secondaryColor; ++ this.field_151512_d = (new StatBase("stat.killEntity." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKill", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).registerStat(); ++ this.field_151513_e = (new StatBase("stat.entityKilledBy." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKilledBy", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).registerStat(); ++ } + } + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch new file mode 100644 index 0000000000..319c8d88ad --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch @@ -0,0 +1,41 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java +@@ -121,6 +121,7 @@ + public void setAttackTarget(EntityLivingBase entitylivingbaseIn) + { + this.attackTarget = entitylivingbaseIn; ++ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, entitylivingbaseIn); + } + + public boolean canAttackClass(Class cls) +@@ -498,10 +499,22 @@ + + protected void despawnEntity() + { ++ net.minecraftforge.fml.common.eventhandler.Event.Result result = null; + if (this.persistenceRequired) + { + this.entityAge = 0; + } ++ else if ((this.entityAge & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT) ++ { ++ if (result == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ this.entityAge = 0; ++ } ++ else ++ { ++ this.setDead(); ++ } ++ } + else + { + Entity entity = this.worldObj.getClosestPlayerToEntity(this, -1.0D); +@@ -621,7 +634,6 @@ + return this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()); + } + +- @SideOnly(Side.CLIENT) + public float getRenderSizeModifier() + { + return 1.0F; diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch new file mode 100644 index 0000000000..4dc1946473 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -0,0 +1,220 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java +@@ -170,6 +170,7 @@ + } + + int i = (int)(150.0D * d0); ++ if ( !block.addLandingEffects( (WorldServer)this.worldObj, pos, iblockstate, this, i ) ) + ((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.BLOCK_DUST, this.posX, this.posY, this.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] {Block.getStateId(iblockstate)}); + } + } +@@ -237,7 +238,7 @@ + } + } + +- if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase) ++ if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity != null && ridingEntity.shouldDismountInWater(this)) + { + this.mountEntity((Entity)null); + } +@@ -319,7 +320,7 @@ + if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot")) + { + int i = this.getExperiencePoints(this.attackingPlayer); +- ++ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.attackingPlayer, i); + while (i > 0) + { + int j = EntityXPOrb.getXPSplit(i); +@@ -380,6 +381,7 @@ + { + this.entityLivingToAttack = livingBase; + this.revengeTimer = this.ticksExisted; ++ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, livingBase); + } + + public EntityLivingBase getLastAttacker() +@@ -663,7 +665,6 @@ + return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; + } + +- @SideOnly(Side.CLIENT) + public void removePotionEffectClient(int potionId) + { + this.activePotionsMap.remove(Integer.valueOf(potionId)); +@@ -712,6 +713,8 @@ + + public void heal(float healAmount) + { ++ healAmount = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, healAmount); ++ if (healAmount <= 0) return; + float f = this.getHealth(); + + if (f > 0.0F) +@@ -732,6 +735,7 @@ + + public boolean attackEntityFrom(DamageSource source, float amount) + { ++ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, source, amount)) return false; + if (this.isEntityInvulnerable(source)) + { + return false; +@@ -797,9 +801,9 @@ + this.recentlyHit = 100; + this.attackingPlayer = (EntityPlayer)entity; + } +- else if (entity instanceof EntityWolf) ++ else if (entity instanceof net.minecraft.entity.passive.EntityTameable) + { +- EntityWolf entitywolf = (EntityWolf)entity; ++ net.minecraft.entity.passive.EntityTameable entitywolf = (net.minecraft.entity.passive.EntityTameable)entity; + + if (entitywolf.isTamed()) + { +@@ -883,6 +887,7 @@ + + public void onDeath(DamageSource cause) + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; + Entity entity = cause.getEntity(); + EntityLivingBase entitylivingbase = this.func_94060_bK(); + +@@ -908,6 +913,9 @@ + i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity); + } + ++ captureDrops = true; ++ capturedDrops.clear(); ++ + if (this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot")) + { + this.dropFewItems(this.recentlyHit > 0, i); +@@ -918,6 +926,16 @@ + this.addRandomDrop(); + } + } ++ ++ captureDrops = false; ++ ++ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, cause, capturedDrops, i, recentlyHit > 0)) ++ { ++ for (EntityItem item : capturedDrops) ++ { ++ worldObj.spawnEntityInWorld(item); ++ } ++ } + } + + this.worldObj.setEntityState(this, (byte)3); +@@ -972,7 +990,7 @@ + int j = MathHelper.floor_double(this.getEntityBoundingBox().minY); + int k = MathHelper.floor_double(this.posZ); + Block block = this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock(); +- return (block == Blocks.ladder || block == Blocks.vine) && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).isSpectator()); ++ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(block, worldObj, new BlockPos(i, j, k), this); + } + + public boolean isEntityAlive() +@@ -982,6 +1000,9 @@ + + public void fall(float distance, float damageMultiplier) + { ++ float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, distance, damageMultiplier); ++ if (ret == null) return; ++ distance = ret[0]; damageMultiplier = ret[1]; + super.fall(distance, damageMultiplier); + PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump); + float f = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F; +@@ -1094,6 +1115,8 @@ + { + if (!this.isEntityInvulnerable(damageSrc)) + { ++ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); ++ if (damageAmount <= 0) return; + damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); + damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); + float f = damageAmount; +@@ -1142,6 +1165,11 @@ + + public void swingItem() + { ++ ItemStack stack = this.getHeldItem(); ++ if (stack != null && stack.getItem() != null) ++ { ++ if (stack.getItem().onEntitySwing(this, stack)) return; ++ } + if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) + { + this.swingProgressInt = -1; +@@ -1281,6 +1309,7 @@ + + public void dismountEntity(Entity p_110145_1_) + { ++ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_110145_1_, false)){ return; } + double d0 = p_110145_1_.posX; + double d1 = p_110145_1_.getEntityBoundingBox().minY + (double)p_110145_1_.height; + double d2 = p_110145_1_.posZ; +@@ -1346,6 +1375,7 @@ + } + + this.isAirBorne = true; ++ net.minecraftforge.common.ForgeHooks.onLivingJump(this); + } + + protected void updateAITick() +@@ -1530,6 +1560,7 @@ + + public void onUpdate() + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return; + super.onUpdate(); + + if (!this.worldObj.isRemote) +@@ -1817,6 +1848,7 @@ + + public void mountEntity(Entity entityIn) + { ++ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } + if (this.ridingEntity != null && entityIn == null) + { + if (!this.worldObj.isRemote) +@@ -1998,4 +2030,39 @@ + { + this.potionsNeedUpdate = true; + } ++ ++ /*** ++ * Removes all potion effects that have curativeItem as a curative item for its effect ++ * @param curativeItem The itemstack we are using to cure potion effects ++ */ ++ public void curePotionEffects(ItemStack curativeItem) ++ { ++ Iterator potionKey = activePotionsMap.keySet().iterator(); ++ if (worldObj.isRemote) return; ++ ++ while (potionKey.hasNext()) ++ { ++ Integer key = potionKey.next(); ++ PotionEffect effect = (PotionEffect)activePotionsMap.get(key); ++ ++ if (effect.isCurativeItem(curativeItem)) ++ { ++ potionKey.remove(); ++ onFinishedPotionEffect(effect); ++ this.potionsNeedUpdate = true; ++ } ++ } ++ } ++ ++ /** ++ * Returns true if the entity's rider (EntityPlayer) should face forward when mounted. ++ * currently only used in vanilla code by pigs. ++ * ++ * @param player The player who is riding the entity. ++ * @return If the player should orient the same direction as this entity. ++ */ ++ public boolean shouldRiderFaceForward(EntityPlayer player) ++ { ++ return this instanceof net.minecraft.entity.passive.EntityPig; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch new file mode 100644 index 0000000000..20ea69bf3a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java +@@ -109,6 +109,7 @@ + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + this.commandBlockLogic.tryOpenEditCommandBlock(playerIn); + return false; + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch new file mode 100644 index 0000000000..0e8f1cf592 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java ++++ ../src-work/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java +@@ -44,6 +44,12 @@ + return (EntityLiving.SpawnPlacementType)ENTITY_PLACEMENTS.get(entityClass); + } + ++ public static void setPlacementType(Class entityClass, EntityLiving.SpawnPlacementType placementType) ++ { ++ if(!ENTITY_PLACEMENTS.containsKey(entityClass)) ++ ENTITY_PLACEMENTS.put(entityClass, placementType); ++ } ++ + static + { + ENTITY_PLACEMENTS.put(EntityBat.class, EntityLiving.SpawnPlacementType.ON_GROUND); diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch new file mode 100644 index 0000000000..d3e15e11d6 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java +@@ -56,6 +56,8 @@ + + public void trackEntity(Entity p_72786_1_) + { ++ if (net.minecraftforge.fml.common.registry.EntityRegistry.instance().tryTrackingEntity(this, p_72786_1_)) return; ++ + if (p_72786_1_ instanceof EntityPlayerMP) + { + this.trackEntity(p_72786_1_, 512, 2); +@@ -331,4 +333,23 @@ + } + } + } ++ ++ /* ======================================== FORGE START =====================================*/ ++ ++ // don't expose the EntityTrackerEntry directly so mods can't mess with the data in there as easily ++ /** ++ * Get all players tracking the given Entity. The Entity must be part of the World that this Tracker belongs to. ++ * @param entity the Entity ++ * @return all players tracking the Entity ++ */ ++ public Set getTrackingPlayers(Entity entity) ++ { ++ EntityTrackerEntry entry = (EntityTrackerEntry) trackedEntityHashTable.lookup(entity.getEntityId()); ++ if (entry == null) ++ return java.util.Collections.emptySet(); ++ else ++ return java.util.Collections.unmodifiableSet(entry.trackingPlayers); ++ } ++ ++ /* ======================================== FORGE END =====================================*/ + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch new file mode 100644 index 0000000000..8f9273e0ee --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java +@@ -379,6 +379,14 @@ + this.lastTrackedEntityMotionY = this.trackedEntity.motionY; + this.motionZ = this.trackedEntity.motionZ; + ++ int posX = MathHelper.floor_double(this.trackedEntity.posX * 32.0D); ++ int posY = MathHelper.floor_double(this.trackedEntity.posY * 32.0D); ++ int posZ = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D); ++ if (posX != this.encodedPosX || posY != this.encodedPosY || posZ != this.encodedPosZ) ++ { ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.trackedEntity, playerMP, this.encodedPosX, this.encodedPosY, this.encodedPosZ); ++ } ++ + if (this.sendVelocityUpdates && !(packet instanceof S0FPacketSpawnMob)) + { + playerMP.playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(this.trackedEntity.getEntityId(), this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ)); +@@ -426,12 +434,14 @@ + playerMP.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.trackedEntity.getEntityId(), potioneffect)); + } + } ++ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(trackedEntity, playerMP); + } + } + else if (this.trackingPlayers.contains(playerMP)) + { + this.trackingPlayers.remove(playerMP); + playerMP.removeEntity(this.trackedEntity); ++ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(trackedEntity, playerMP); + } + } + } +@@ -463,6 +473,9 @@ + logger.warn("Fetching addPacket for removed entity"); + } + ++ Packet pkt = net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.getEntitySpawningPacket(this.trackedEntity); ++ if (pkt != null) return pkt; ++ + if (this.trackedEntity instanceof EntityItem) + { + return new S0EPacketSpawnObject(this.trackedEntity, 2, 1); diff --git a/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch b/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch new file mode 100644 index 0000000000..81f1b497ae --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch @@ -0,0 +1,55 @@ +--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java ++++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java +@@ -20,6 +20,8 @@ + private double targetX; + private double targetY; + private double targetZ; ++ private int failedPathFindingPenalty = 0; ++ private boolean canPenalize = false; + + public EntityAIAttackOnCollide(EntityCreature creature, Class targetClass, double speedIn, boolean useLongMemory) + { +@@ -54,6 +56,19 @@ + } + else + { ++ if (canPenalize) ++ { ++ if (--this.delayCounter <= 0) ++ { ++ this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); ++ this.targetX = 4 + this.attacker.getRNG().nextInt(7); ++ return this.entityPathEntity != null; ++ } ++ else ++ { ++ return true; ++ } ++ } + this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); + return this.entityPathEntity != null; + } +@@ -91,6 +106,23 @@ + this.targetZ = entitylivingbase.posZ; + this.delayCounter = 4 + this.attacker.getRNG().nextInt(7); + ++ if (this.canPenalize) ++ { ++ this.targetX += failedPathFindingPenalty; ++ if (this.attacker.getNavigator().getPath() != null) ++ { ++ net.minecraft.pathfinding.PathPoint finalPathPoint = this.attacker.getNavigator().getPath().getFinalPathPoint(); ++ if (finalPathPoint != null && entitylivingbase.getDistanceSq(finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord) < 1) ++ failedPathFindingPenalty = 0; ++ else ++ failedPathFindingPenalty += 10; ++ } ++ else ++ { ++ failedPathFindingPenalty += 10; ++ } ++ } ++ + if (d0 > 1024.0D) + { + this.delayCounter += 10; diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch new file mode 100644 index 0000000000..b7daaa8b7b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/entity/boss/EntityDragon.java ++++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java +@@ -479,9 +479,9 @@ + BlockPos blockpos = new BlockPos(k1, l1, i2); + Block block = this.worldObj.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(worldObj, new BlockPos(k1, l1, i2))) + { +- if (block != Blocks.barrier && block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && block != Blocks.command_block && this.worldObj.getGameRules().getBoolean("mobGriefing")) ++ if (block.canEntityDestroy(worldObj, new BlockPos(k1, l1, i2), this) && this.worldObj.getGameRules().getBoolean("mobGriefing")) + { + flag1 = this.worldObj.setBlockToAir(blockpos) || flag1; + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch new file mode 100644 index 0000000000..c999b9d328 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/boss/EntityWither.java ++++ ../src-work/minecraft/net/minecraft/entity/boss/EntityWither.java +@@ -343,7 +343,7 @@ + BlockPos blockpos = new BlockPos(i3, k, l); + Block block = this.worldObj.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() != Material.air && func_181033_a(block)) ++ if (!block.isAir(worldObj,blockpos) && func_181033_a(block) && block.canEntityDestroy(worldObj, blockpos, this)) + { + flag = this.worldObj.destroyBlock(blockpos, true) || flag; + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch new file mode 100644 index 0000000000..98bf842696 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/boss/IBossDisplayData.java ++++ ../src-work/minecraft/net/minecraft/entity/boss/IBossDisplayData.java +@@ -4,7 +4,6 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public interface IBossDisplayData + { + float getMaxHealth(); diff --git a/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch new file mode 100644 index 0000000000..662a54e4d7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java ++++ ../src-work/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java +@@ -90,7 +90,8 @@ + for (int i = 0; i < list.size(); ++i) + { + Entity entity = (Entity)list.get(i); +- entity.onStruckByLightning(this); ++ if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this)) ++ entity.onStruckByLightning(this); + } + } + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch new file mode 100644 index 0000000000..8829569eeb --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch @@ -0,0 +1,25 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityEnderPearl.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java +@@ -61,6 +61,9 @@ + + if (entityplayermp.playerNetServerHandler.getNetworkManager().isChannelOpen() && entityplayermp.worldObj == this.worldObj && !entityplayermp.isPlayerSleeping()) + { ++ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) ++ { // Don't indent to lower patch size + if (this.rand.nextFloat() < 0.05F && this.worldObj.getGameRules().getBoolean("doMobSpawning")) + { + EntityEndermite entityendermite = new EntityEndermite(this.worldObj); +@@ -74,9 +77,10 @@ + entitylivingbase.mountEntity((Entity)null); + } + +- entitylivingbase.setPositionAndUpdate(this.posX, this.posY, this.posZ); ++ entitylivingbase.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ); + entitylivingbase.fallDistance = 0.0F; +- entitylivingbase.attackEntityFrom(DamageSource.fall, 5.0F); ++ entitylivingbase.attackEntityFrom(DamageSource.fall, event.attackDamage); ++ } + } + } + else if (entitylivingbase != null) diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch new file mode 100644 index 0000000000..65666ecaac --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch @@ -0,0 +1,114 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java +@@ -29,6 +29,11 @@ + private String owner; + public float hoverStart; + ++ /** ++ * The maximum age of this EntityItem. The item is expired once this is reached. ++ */ ++ public int lifespan = 6000; ++ + public EntityItem(World worldIn, double x, double y, double z) + { + super(worldIn); +@@ -46,6 +51,7 @@ + { + this(worldIn, x, y, z); + this.setEntityItemStack(stack); ++ this.lifespan = (stack.getItem() == null ? 6000 : stack.getItem().getEntityLifespan(stack, worldIn)); + } + + protected boolean canTriggerWalking() +@@ -69,6 +75,8 @@ + + public void onUpdate() + { ++ ItemStack stack = this.getDataWatcher().getWatchableObjectItemStack(10); ++ if (stack != null && stack.getItem() != null && stack.getItem().onEntityItemUpdate(this)) return; + if (this.getEntityItem() == null) + { + this.setDead(); +@@ -129,8 +137,16 @@ + + this.handleWaterMovement(); + +- if (!this.worldObj.isRemote && this.age >= 6000) ++ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); ++ ++ if (!this.worldObj.isRemote && this.age >= lifespan) + { ++ int hook = net.minecraftforge.event.ForgeEventFactory.onItemExpire(this, item); ++ if (hook < 0) this.setDead(); ++ else this.lifespan += hook; ++ } ++ if (item != null && item.stackSize <= 0) ++ { + this.setDead(); + } + } +@@ -271,6 +287,7 @@ + tagCompound.setShort("Health", (short)((byte)this.health)); + tagCompound.setShort("Age", (short)this.age); + tagCompound.setShort("PickupDelay", (short)this.delayBeforeCanPickup); ++ tagCompound.setInteger("Lifespan", lifespan); + + if (this.getThrower() != null) + { +@@ -311,20 +328,23 @@ + NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Item"); + this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound)); + +- if (this.getEntityItem() == null) +- { +- this.setDead(); +- } ++ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); ++ if (item == null || item.stackSize <= 0) this.setDead(); ++ if (tagCompund.hasKey("Lifespan")) lifespan = tagCompund.getInteger("Lifespan"); + } + + public void onCollideWithPlayer(EntityPlayer entityIn) + { + if (!this.worldObj.isRemote) + { ++ if (this.delayBeforeCanPickup > 0) return; + ItemStack itemstack = this.getEntityItem(); + int i = itemstack.stackSize; + +- if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack)) ++ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, entityIn, itemstack); ++ if (hook < 0) return; ++ ++ if (this.delayBeforeCanPickup <= 0 && (this.owner == null || lifespan - this.age <= 200 || this.owner.equals(entityIn.getName())) && (hook == 1 || i <= 0 || entityIn.inventory.addItemStackToInventory(itemstack))) + { + if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log)) + { +@@ -361,6 +381,7 @@ + } + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(entityIn, this); + if (!this.isSilent()) + { + this.worldObj.playSoundAtEntity(entityIn, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); +@@ -402,11 +423,6 @@ + + if (itemstack == null) + { +- if (this.worldObj != null) +- { +- logger.error("Item entity " + this.getEntityId() + " has no item?!"); +- } +- + return new ItemStack(Blocks.stone); + } + else +@@ -480,6 +496,6 @@ + public void func_174870_v() + { + this.setInfinitePickupDelay(); +- this.age = 5999; ++ this.age = getEntityItem().getItem().getEntityLifespan(getEntityItem(), worldObj) - 1; + } + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch new file mode 100644 index 0000000000..dce70c355e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityItemFrame.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityItemFrame.java +@@ -122,7 +122,7 @@ + { + if (p_110131_1_ != null) + { +- if (p_110131_1_.getItem() == Items.filled_map) ++ if (p_110131_1_.getItem() instanceof net.minecraft.item.ItemMap) + { + MapData mapdata = ((ItemMap)p_110131_1_.getItem()).getMapData(p_110131_1_, this.worldObj); + mapdata.mapDecorations.remove("frame-" + this.getEntityId()); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch new file mode 100644 index 0000000000..5ceb361afd --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -0,0 +1,454 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecart.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecart.java +@@ -50,6 +50,20 @@ + @SideOnly(Side.CLIENT) + private double velocityZ; + ++ /* Forge: Minecart Compatibility Layer Integration. */ ++ public static float defaultMaxSpeedAirLateral = 0.4f; ++ public static float defaultMaxSpeedAirVertical = -1f; ++ public static double defaultDragAir = 0.94999998807907104D; ++ protected boolean canUseRail = true; ++ protected boolean canBePushed = true; ++ private static net.minecraftforge.common.IMinecartCollisionHandler collisionHandler = null; ++ ++ /* Instance versions of the above physics properties */ ++ private float currentSpeedRail = getMaxCartSpeedOnRail(); ++ protected float maxSpeedAirLateral = defaultMaxSpeedAirLateral; ++ protected float maxSpeedAirVertical = defaultMaxSpeedAirVertical; ++ protected double dragAir = defaultDragAir; ++ + public EntityMinecart(World worldIn) + { + super(worldIn); +@@ -95,17 +109,19 @@ + + public AxisAlignedBB getCollisionBox(Entity entityIn) + { ++ if (getCollisionHandler() != null) return getCollisionHandler().getCollisionBox(this, entityIn); + return entityIn.canBePushed() ? entityIn.getEntityBoundingBox() : null; + } + + public AxisAlignedBB getCollisionBoundingBox() + { ++ if (getCollisionHandler() != null) return getCollisionHandler().getBoundingBox(this); + return null; + } + + public boolean canBePushed() + { +- return true; ++ return canBePushed; + } + + public EntityMinecart(World worldIn, double x, double y, double z) +@@ -309,7 +325,7 @@ + BlockPos blockpos = new BlockPos(k, l, i1); + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + +- if (BlockRailBase.isRailBlock(iblockstate)) ++ if (canUseRail() && BlockRailBase.isRailBlock(iblockstate)) + { + this.func_180460_a(blockpos, iblockstate); + +@@ -348,7 +364,10 @@ + + this.setRotation(this.rotationYaw, this.rotationPitch); + +- for (Entity entity : this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D))) ++ AxisAlignedBB box; ++ if (getCollisionHandler() != null) box = getCollisionHandler().getMinecartCollisionBox(this); ++ else box = this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D); ++ for (Entity entity : this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box)) + { + if (entity != this.riddenByEntity && entity.canBePushed() && entity instanceof EntityMinecart) + { +@@ -367,6 +386,7 @@ + } + + this.handleWaterMovement(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition())); + } + } + +@@ -381,10 +401,21 @@ + + protected void moveDerailedMinecart() + { +- double d0 = this.getMaximumSpeed(); ++ double d0 = onGround ? this.getMaximumSpeed() : getMaxSpeedAirLateral(); + this.motionX = MathHelper.clamp_double(this.motionX, -d0, d0); + this.motionZ = MathHelper.clamp_double(this.motionZ, -d0, d0); + ++ double moveY = motionY; ++ if(getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical()) ++ { ++ moveY = getMaxSpeedAirVertical(); ++ if(Math.abs(motionX) < 0.3f && Math.abs(motionZ) < 0.3f) ++ { ++ moveY = 0.15f; ++ motionY = moveY; ++ } ++ } ++ + if (this.onGround) + { + this.motionX *= 0.5D; +@@ -392,13 +423,13 @@ + this.motionZ *= 0.5D; + } + +- this.moveEntity(this.motionX, this.motionY, this.motionZ); ++ this.moveEntity(this.motionX, moveY, this.motionZ); + + if (!this.onGround) + { +- this.motionX *= 0.949999988079071D; +- this.motionY *= 0.949999988079071D; +- this.motionZ *= 0.949999988079071D; ++ this.motionX *= getDragAir(); ++ this.motionY *= getDragAir(); ++ this.motionZ *= getDragAir(); + } + } + +@@ -418,25 +449,25 @@ + flag1 = !flag; + } + +- double d0 = 0.0078125D; ++ double slopeAdjustment = getSlopeAdjustment(); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.getValue(blockrailbase.getShapeProperty()); + + switch (blockrailbase$enumraildirection) + { + case ASCENDING_EAST: +- this.motionX -= 0.0078125D; ++ this.motionX -= slopeAdjustment; + ++this.posY; + break; + case ASCENDING_WEST: +- this.motionX += 0.0078125D; ++ this.motionX += slopeAdjustment; + ++this.posY; + break; + case ASCENDING_NORTH: +- this.motionZ += 0.0078125D; ++ this.motionZ += slopeAdjustment; + ++this.posY; + break; + case ASCENDING_SOUTH: +- this.motionZ -= 0.0078125D; ++ this.motionZ -= slopeAdjustment; + ++this.posY; + } + +@@ -481,7 +512,7 @@ + } + } + +- if (flag1) ++ if (flag1 && shouldDoRailFunctions()) + { + double d17 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + +@@ -527,20 +558,8 @@ + this.posX = d19 + d1 * d18; + this.posZ = d20 + d2 * d18; + this.setPosition(this.posX, this.posY, this.posZ); +- double d22 = this.motionX; +- double d23 = this.motionZ; ++ this.moveMinecartOnRail(p_180460_1_); + +- if (this.riddenByEntity != null) +- { +- d22 *= 0.75D; +- d23 *= 0.75D; +- } +- +- double d13 = this.getMaximumSpeed(); +- d22 = MathHelper.clamp_double(d22, -d13, d13); +- d23 = MathHelper.clamp_double(d23, -d13, d13); +- this.moveEntity(d22, 0.0D, d23); +- + if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - p_180460_1_.getX() == aint[0][0] && MathHelper.floor_double(this.posZ) - p_180460_1_.getZ() == aint[0][2]) + { + this.setPosition(this.posX, this.posY + (double)aint[0][1], this.posZ); +@@ -577,8 +596,14 @@ + this.motionZ = d5 * (double)(i - p_180460_1_.getZ()); + } + +- if (flag) ++ ++ if(shouldDoRailFunctions()) + { ++ ((BlockRailBase)p_180460_2_.getBlock()).onMinecartPass(worldObj, this, p_180460_1_); ++ } ++ ++ if (flag && shouldDoRailFunctions()) ++ { + double d15 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (d15 > 0.01D) +@@ -817,13 +842,20 @@ + + public void applyEntityCollision(Entity entityIn) + { ++ ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, entityIn)); ++ if (getCollisionHandler() != null) ++ { ++ getCollisionHandler().onEntityCollision(this, entityIn); ++ return; ++ } + if (!this.worldObj.isRemote) + { + if (!entityIn.noClip && !this.noClip) + { + if (entityIn != this.riddenByEntity) + { +- if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) ++ if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) + { + entityIn.mountEntity(this); + } +@@ -869,7 +901,7 @@ + double d7 = entityIn.motionX + this.motionX; + double d8 = entityIn.motionZ + this.motionZ; + +- if (((EntityMinecart)entityIn).getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE) ++ if (((EntityMinecart)entityIn).isPoweredCart() && !isPoweredCart()) + { + this.motionX *= 0.20000000298023224D; + this.motionZ *= 0.20000000298023224D; +@@ -877,7 +909,7 @@ + entityIn.motionX *= 0.949999988079071D; + entityIn.motionZ *= 0.949999988079071D; + } +- else if (((EntityMinecart)entityIn).getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE) ++ else if (((EntityMinecart)entityIn).isPoweredCart() && isPoweredCart()) + { + entityIn.motionX *= 0.20000000298023224D; + entityIn.motionZ *= 0.20000000298023224D; +@@ -1042,6 +1074,221 @@ + } + } + ++ /* =================================== FORGE START ===========================================*/ ++ private BlockPos getCurrentRailPosition() ++ { ++ int x = MathHelper.floor_double(this.posX); ++ int y = MathHelper.floor_double(this.posY); ++ int z = MathHelper.floor_double(this.posZ); ++ ++ if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(x, y - 1, z))) y--; ++ return new BlockPos(x, y, z); ++ } ++ ++ protected double getMaxSpeed() ++ { ++ if (!canUseRail()) return getMaximumSpeed(); ++ BlockPos pos = this.getCurrentRailPosition(); ++ IBlockState state = this.worldObj.getBlockState(pos); ++ if (!BlockRailBase.isRailBlock(state)) return getMaximumSpeed(); ++ ++ float railMaxSpeed = ((BlockRailBase)state.getBlock()).getRailMaxSpeed(worldObj, this, pos); ++ return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); ++ } ++ ++ /** ++ * Moved to allow overrides. ++ * This code handles minecart movement and speed capping when on a rail. ++ */ ++ public void moveMinecartOnRail(BlockPos pos) ++ { ++ double mX = this.motionX; ++ double mZ = this.motionZ; ++ ++ if (this.riddenByEntity != null) ++ { ++ mX *= 0.75D; ++ mZ *= 0.75D; ++ } ++ ++ double max = this.getMaxSpeed(); ++ mX = MathHelper.clamp_double(mX, -max, max); ++ mZ = MathHelper.clamp_double(mZ, -max, max); ++ this.moveEntity(mX, 0.0D, mZ); ++ } ++ ++ /** ++ * Gets the current global Minecart Collision handler if none ++ * is registered, returns null ++ * @return The collision handler or null ++ */ ++ public static net.minecraftforge.common.IMinecartCollisionHandler getCollisionHandler() ++ { ++ return collisionHandler; ++ } ++ ++ /** ++ * Sets the global Minecart Collision handler, overwrites any ++ * that is currently set. ++ * @param handler The new handler ++ */ ++ public static void setCollisionHandler(net.minecraftforge.common.IMinecartCollisionHandler handler) ++ { ++ collisionHandler = handler; ++ } ++ ++ /** ++ * This function returns an ItemStack that represents this cart. ++ * This should be an ItemStack that can be used by the player to place the cart, ++ * but is not necessary the item the cart drops when destroyed. ++ * @return An ItemStack that can be used to place the cart. ++ */ ++ public ItemStack getCartItem() ++ { ++ if (this instanceof EntityMinecartFurnace) ++ { ++ return new ItemStack(Items.furnace_minecart); ++ } ++ else if (this instanceof EntityMinecartChest) ++ { ++ return new ItemStack(Items.chest_minecart); ++ } ++ else if (this instanceof EntityMinecartTNT) ++ { ++ return new ItemStack(Items.tnt_minecart); ++ } ++ else if (this instanceof EntityMinecartHopper) ++ { ++ return new ItemStack(Items.hopper_minecart); ++ } ++ else if (this instanceof EntityMinecartCommandBlock) ++ { ++ return new ItemStack(Items.command_block_minecart); ++ } ++ return new ItemStack(Items.minecart); ++ } ++ ++ /** ++ * Returns true if this cart can currently use rails. ++ * This function is mainly used to gracefully detach a minecart from a rail. ++ * @return True if the minecart can use rails. ++ */ ++ public boolean canUseRail() ++ { ++ return canUseRail; ++ } ++ ++ /** ++ * Set whether the minecart can use rails. ++ * This function is mainly used to gracefully detach a minecart from a rail. ++ * @param use Whether the minecart can currently use rails. ++ */ ++ public void setCanUseRail(boolean use) ++ { ++ canUseRail = use; ++ } ++ ++ /** ++ * Return false if this cart should not call onMinecartPass() and should ignore Powered Rails. ++ * @return True if this cart should call onMinecartPass(). ++ */ ++ public boolean shouldDoRailFunctions() ++ { ++ return true; ++ } ++ ++ /** ++ * Returns true if this cart is self propelled. ++ * @return True if powered. ++ */ ++ public boolean isPoweredCart() ++ { ++ return getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE; ++ } ++ ++ /** ++ * Returns true if this cart can be ridden by an Entity. ++ * @return True if this cart can be ridden. ++ */ ++ public boolean canBeRidden() ++ { ++ return this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE; ++ } ++ ++ /** ++ * Getters/setters for physics variables ++ */ ++ ++ /** ++ * Returns the carts max speed when traveling on rails. Carts going faster ++ * than 1.1 cause issues with chunk loading. Carts cant traverse slopes or ++ * corners at greater than 0.5 - 0.6. This value is compared with the rails ++ * max speed and the carts current speed cap to determine the carts current ++ * max speed. A normal rail's max speed is 0.4. ++ * ++ * @return Carts max speed. ++ */ ++ public float getMaxCartSpeedOnRail() ++ { ++ return 1.2f; ++ } ++ ++ /** ++ * Returns the current speed cap for the cart when traveling on rails. This ++ * functions differs from getMaxCartSpeedOnRail() in that it controls ++ * current movement and cannot be overridden. The value however can never be ++ * higher than getMaxCartSpeedOnRail(). ++ * ++ * @return ++ */ ++ public final float getCurrentCartSpeedCapOnRail() ++ { ++ return currentSpeedRail; ++ } ++ ++ public final void setCurrentCartSpeedCapOnRail(float value) ++ { ++ value = Math.min(value, getMaxCartSpeedOnRail()); ++ currentSpeedRail = value; ++ } ++ ++ public float getMaxSpeedAirLateral() ++ { ++ return maxSpeedAirLateral; ++ } ++ ++ public void setMaxSpeedAirLateral(float value) ++ { ++ maxSpeedAirLateral = value; ++ } ++ ++ public float getMaxSpeedAirVertical() ++ { ++ return maxSpeedAirVertical; ++ } ++ ++ public void setMaxSpeedAirVertical(float value) ++ { ++ maxSpeedAirVertical = value; ++ } ++ ++ public double getDragAir() ++ { ++ return dragAir; ++ } ++ ++ public void setDragAir(double value) ++ { ++ dragAir = value; ++ } ++ ++ public double getSlopeAdjustment() ++ { ++ return 0.0078125D; ++ } ++ ++ /* =================================== FORGE END ===========================================*/ ++ + public static enum EnumMinecartType + { + RIDEABLE(0, "MinecartRideable"), diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch new file mode 100644 index 0000000000..9ac57f9f40 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java +@@ -180,6 +180,7 @@ + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + if (!this.worldObj.isRemote) + { + playerIn.displayGUIChest(this); +@@ -232,4 +233,22 @@ + this.minecartContainerItems[i] = null; + } + } ++ ++ public net.minecraftforge.items.IItemHandler itemHandler = new net.minecraftforge.items.wrapper.InvWrapper(this); ++ ++ @Override ++ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) ++ { ++ return (T) itemHandler; ++ } ++ return super.getCapability(capability, facing); ++ } ++ ++ @Override ++ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch new file mode 100644 index 0000000000..e262844ee4 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java +@@ -18,6 +18,7 @@ + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn) + { + return true; diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch new file mode 100644 index 0000000000..6c351329fe --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java +@@ -131,6 +131,7 @@ + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + ItemStack itemstack = playerIn.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.getItem() == Items.coal) diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch new file mode 100644 index 0000000000..79d7a4a279 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java +@@ -54,6 +54,7 @@ + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + if (!this.worldObj.isRemote) + { + playerIn.displayGUIChest(this); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch new file mode 100644 index 0000000000..1a1ae19dc3 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityXPOrb.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityXPOrb.java +@@ -199,6 +199,7 @@ + { + if (this.delayBeforeCanPickup == 0 && entityIn.xpCooldown == 0) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerPickupXpEvent(entityIn, this))) return; + entityIn.xpCooldown = 2; + this.worldObj.playSoundAtEntity(entityIn, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F)); + entityIn.onItemPickup(this, 1); diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch new file mode 100644 index 0000000000..e401e46a65 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch @@ -0,0 +1,39 @@ +--- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java ++++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java +@@ -198,12 +198,14 @@ + + protected boolean teleportTo(double x, double y, double z) + { ++ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, x, y, z, 0); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; + double d0 = this.posX; + double d1 = this.posY; + double d2 = this.posZ; +- this.posX = x; +- this.posY = y; +- this.posZ = z; ++ this.posX = event.targetX; ++ this.posY = event.targetY; ++ this.posZ = event.targetZ; + boolean flag = false; + BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ); + +@@ -364,6 +366,18 @@ + } + } + ++ /*===================================== Forge Start ==============================*/ ++ public static void setCarriable(Block block, boolean canCarry) ++ { ++ if (canCarry) carriableBlocks.add(block); ++ else carriableBlocks.remove(block); ++ } ++ public static boolean getCarriable(Block block) ++ { ++ return carriableBlocks.contains(block); ++ } ++ /*===================================== Forge End ==============================*/ ++ + public boolean isScreaming() + { + return this.dataWatcher.getWatchableObjectByte(18) > 0; diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch new file mode 100644 index 0000000000..722b948e03 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java ++++ ../src-work/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java +@@ -103,6 +103,7 @@ + { + this.motionY = (double)(0.42F + (float)this.getSlimeSize() * 0.1F); + this.isAirBorne = true; ++ net.minecraftforge.common.ForgeHooks.onLivingJump(this); + } + + protected void handleJumpLava() diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch new file mode 100644 index 0000000000..d7c70c78c3 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java ++++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java +@@ -111,7 +111,7 @@ + if (this.onGround && !this.wasOnGround) + { + int i = this.getSlimeSize(); +- ++ if (spawnCustomParticles()) { i = 0; } // don't spawn particles if it's handled by the implementation itself + for (int j = 0; j < i * 8; ++j) + { + float f = this.rand.nextFloat() * (float)Math.PI * 2.0F; +@@ -271,7 +271,7 @@ + BlockPos blockpos = new BlockPos(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ)); + Chunk chunk = this.worldObj.getChunkFromBlockCoords(blockpos); + +- if (this.worldObj.getWorldInfo().getTerrainType() == WorldType.FLAT && this.rand.nextInt(4) != 1) ++ if (this.worldObj.getWorldInfo().getTerrainType().handleSlimeSpawnReduction(rand, worldObj)) + { + return false; + } +@@ -336,6 +336,14 @@ + return super.onInitialSpawn(difficulty, livingdata); + } + ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * Called when the slime spawns particles on landing, see onUpdate. ++ * Return true to prevent the spawning of the default particles. ++ */ ++ protected boolean spawnCustomParticles() { return false; } ++ /* ======================================== FORGE END =====================================*/ ++ + static class AISlimeAttack extends EntityAIBase + { + private EntitySlime slime; diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch new file mode 100644 index 0000000000..cafe8f8f1b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch @@ -0,0 +1,60 @@ +--- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java ++++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java +@@ -87,7 +87,7 @@ + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); +- this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * 0.10000000149011612D); ++ this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance); + } + + protected void entityInit() +@@ -229,12 +229,25 @@ + entitylivingbase = (EntityLivingBase)source.getEntity(); + } + +- if (entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) ++ int i = MathHelper.floor_double(this.posX); ++ int j = MathHelper.floor_double(this.posY); ++ int k = MathHelper.floor_double(this.posZ); ++ ++ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(reinforcementChance).getAttributeValue()); ++ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true; ++ ++ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || ++ entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) + { +- int i = MathHelper.floor_double(this.posX); +- int j = MathHelper.floor_double(this.posY); +- int k = MathHelper.floor_double(this.posZ); +- EntityZombie entityzombie = new EntityZombie(this.worldObj); ++ EntityZombie entityzombie; ++ if (summonAid.customSummonedAid != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) ++ { ++ entityzombie = summonAid.customSummonedAid; ++ } ++ else ++ { ++ entityzombie = new EntityZombie(this.worldObj); ++ } + + for (int l = 0; l < 50; ++l) + { +@@ -249,7 +262,7 @@ + if (!this.worldObj.isAnyPlayerWithinRangeAt((double)i1, (double)j1, (double)k1, 7.0D) && this.worldObj.checkNoEntityCollision(entityzombie.getEntityBoundingBox(), entityzombie) && this.worldObj.getCollidingBoundingBoxes(entityzombie, entityzombie.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.getEntityBoundingBox())) + { + this.worldObj.spawnEntityInWorld(entityzombie); +- entityzombie.setAttackTarget(entitylivingbase); ++ if (entitylivingbase != null) entityzombie.setAttackTarget(entitylivingbase); + entityzombie.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null); + this.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); + entityzombie.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); +@@ -465,7 +478,7 @@ + + if (livingdata == null) + { +- livingdata = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < 0.05F, this.worldObj.rand.nextFloat() < 0.05F); ++ livingdata = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < net.minecraftforge.common.ForgeModContainer.zombieBabyChance, this.worldObj.rand.nextFloat() < 0.05F); + } + + if (livingdata instanceof EntityZombie.GroupData) diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch new file mode 100644 index 0000000000..172f84a75b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntityHorse.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntityHorse.java +@@ -1247,6 +1247,7 @@ + } + + this.jumpPower = 0.0F; ++ net.minecraftforge.common.ForgeHooks.onLivingJump(this); + } + + this.stepHeight = 1.0F; diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch new file mode 100644 index 0000000000..fe79857772 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch @@ -0,0 +1,62 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntityMooshroom.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntityMooshroom.java +@@ -9,7 +9,7 @@ + import net.minecraft.util.EnumParticleTypes; + import net.minecraft.world.World; + +-public class EntityMooshroom extends EntityCow ++public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable + { + public EntityMooshroom(World worldIn) + { +@@ -18,6 +18,7 @@ + this.spawnableBlock = Blocks.mycelium; + } + ++ @SuppressWarnings("unused") + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); +@@ -37,7 +38,7 @@ + } + } + +- if (itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) ++ if (false && itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) //Forge Disable, Moved to onSheared + { + this.setDead(); + this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); +@@ -77,4 +78,33 @@ + { + return new EntityMooshroom(this.worldObj); + } ++ ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos){ return getGrowingAge() >= 0; } ++ @Override ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos, int fortune) ++ { ++ this.setDead(); ++ this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); ++ ++ EntityCow entitycow = new EntityCow(this.worldObj); ++ entitycow.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); ++ entitycow.setHealth(this.getHealth()); ++ entitycow.renderYawOffset = this.renderYawOffset; ++ ++ if (this.hasCustomName()) ++ { ++ entitycow.setCustomNameTag(this.getCustomNameTag()); ++ } ++ ++ this.worldObj.spawnEntityInWorld(entitycow); ++ ++ java.util.List ret = new java.util.ArrayList(); ++ for (int i = 0; i < 5; ++i) ++ { ++ ret.add(new ItemStack(Blocks.red_mushroom)); ++ } ++ ++ this.playSound("mob.sheep.shear", 1.0F, 1.0F); ++ return ret; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch new file mode 100644 index 0000000000..247ecdbad1 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java +@@ -279,7 +279,7 @@ + + Block block = this.worldObj.getBlockState(blockpos.down()).getBlock(); + +- if (block == Blocks.grass || block.getMaterial() == Material.leaves) ++ if (block == Blocks.grass || block.isLeaves(worldObj, blockpos.down())) + { + return true; + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch new file mode 100644 index 0000000000..97fe930d79 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch @@ -0,0 +1,45 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntitySheep.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntitySheep.java +@@ -35,7 +35,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class EntitySheep extends EntityAnimal ++public class EntitySheep extends EntityAnimal implements net.minecraftforge.common.IShearable + { + private final InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() + { +@@ -140,11 +140,12 @@ + } + } + ++ @SuppressWarnings("unused") + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); + +- if (itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) ++ if (false && itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) //Forge: Moved to onSheared + { + if (!this.worldObj.isRemote) + { +@@ -327,4 +328,19 @@ + DYE_TO_RGB.put(EnumDyeColor.RED, new float[] {0.6F, 0.2F, 0.2F}); + DYE_TO_RGB.put(EnumDyeColor.BLACK, new float[] {0.1F, 0.1F, 0.1F}); + } ++ ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return !this.getSheared() && !this.isChild(); } ++ @Override ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ this.setSheared(true); ++ int i = 1 + this.rand.nextInt(3); ++ ++ java.util.List ret = new java.util.ArrayList(); ++ for (int j = 0; j < i; ++j) ++ ret.add(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, this.getFleeceColor().getMetadata())); ++ ++ this.playSound("mob.sheep.shear", 1.0F, 1.0F); ++ return ret; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch new file mode 100644 index 0000000000..e744501189 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -0,0 +1,44 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java +@@ -81,6 +81,7 @@ + private boolean isLookingForHome; + private boolean areAdditionalTasksSet; + private InventoryBasic villagerInventory; ++ @Deprecated //Use VillagerRegistry + private static final EntityVillager.ITradeList[][][][] DEFAULT_TRADE_LIST_MAP = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.wheat, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.potato, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.carrot, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.bread, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.pumpkin_pie, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.apple, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.cookie, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.cake, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.fish, new EntityVillager.PriceInfo(6, 6), Items.cooked_fish, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.fishing_rod, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.shears, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 0), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.arrow, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.bow, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new EntityVillager.PriceInfo(10, 10), Items.flint, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.paper, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.book, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.compass, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.written_book, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.clock, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.name_tag, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.rotten_flesh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.gold_ingot, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.redstone, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.ender_eye, new EntityVillager.PriceInfo(7, 11)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.experience_bottle, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_helmet, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.iron_chestplate, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_chestplate, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.chainmail_boots, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_leggings, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.chainmail_helmet, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_chestplate, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_axe, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_sword, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_sword, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_axe, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_shovel, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_pickaxe, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.porkchop, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.chicken, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.cooked_porkchop, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.cooked_chicken, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.leather, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.leather_leggings, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.leather_chestplate, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.saddle, new EntityVillager.PriceInfo(8, 10))}}}}; + + public EntityVillager(World worldIn) +@@ -210,7 +211,7 @@ + ItemStack itemstack = player.inventory.getCurrentItem(); + boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg; + +- if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild()) ++ if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking()) + { + if (!this.worldObj.isRemote && (this.buyingList == null || this.buyingList.size() > 0)) + { +@@ -522,6 +523,7 @@ + + private void populateBuyingList() + { ++ //TODO: Hook into VillagerRegistry + EntityVillager.ITradeList[][][] aentityvillager$itradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()]; + + if (this.careerId != 0 && this.careerLevel != 0) +@@ -635,6 +637,7 @@ + } + } + ++ //TODO: Hook into VillagerRegistry to get name + if (s1 != null) + { + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("entity.Villager." + s1, new Object[0]); +@@ -697,7 +700,7 @@ + public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) + { + livingdata = super.onInitialSpawn(difficulty, livingdata); +- this.setProfession(this.worldObj.rand.nextInt(5)); ++ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(this, this.worldObj.rand); + this.setAdditionalAItasks(); + return livingdata; + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch new file mode 100644 index 0000000000..66f4725bfb --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -0,0 +1,635 @@ +--- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java ++++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java +@@ -80,6 +80,11 @@ + @SuppressWarnings("incomplete-switch") + public abstract class EntityPlayer extends EntityLivingBase + { ++ public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; ++ private java.util.HashMap spawnChunkMap = new java.util.HashMap(); ++ private java.util.HashMap spawnForcedMap = new java.util.HashMap(); ++ public float eyeHeight = this.getDefaultEyeHeight(); ++ + public InventoryPlayer inventory = new InventoryPlayer(this); + private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); + public Container inventoryContainer; +@@ -175,7 +180,8 @@ + { + if (this.itemInUse != null) + { +- this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); ++ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, itemInUse, this.itemInUseCount)) ++ this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); + } + + this.clearItemInUse(); +@@ -199,6 +205,7 @@ + + public void onUpdate() + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPreTick(this); + this.noClip = this.isSpectator(); + + if (this.isSpectator()) +@@ -212,6 +219,14 @@ + + if (itemstack == this.itemInUse) + { ++ itemInUseCount = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, itemInUse, itemInUseCount); ++ if (itemInUseCount <= 0) ++ { ++ this.onItemUseFinish(); ++ } ++ else ++ { // Forge Keep unindented to lower patch ++ itemInUse.getItem().onUsingTick(itemInUse, this, itemInUseCount); //Forge Added + if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) + { + this.updateItemUse(itemstack, 5); +@@ -221,6 +236,7 @@ + { + this.onItemUseFinish(); + } ++ } + } + else + { +@@ -266,7 +282,7 @@ + + super.onUpdate(); + +- if (!this.worldObj.isRemote && this.openContainer != null && !this.openContainer.canInteractWith(this)) ++ if (!this.worldObj.isRemote && this.openContainer != null && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.openContainer)) + { + this.closeScreen(); + this.openContainer = this.inventoryContainer; +@@ -343,6 +359,7 @@ + { + this.setPosition(d3, this.posY, d4); + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPostTick(this); + } + + public int getMaxInPortalTime() +@@ -412,11 +429,12 @@ + int i = this.itemInUse.stackSize; + ItemStack itemstack = this.itemInUse.onItemUseFinish(this.worldObj, this); + ++ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, itemInUse, itemInUseCount, itemstack); + if (itemstack != this.itemInUse || itemstack != null && itemstack.stackSize != i) + { + this.inventory.mainInventory[this.inventory.currentItem] = itemstack; + +- if (itemstack.stackSize == 0) ++ if (itemstack != null && itemstack.stackSize == 0) + { + this.inventory.mainInventory[this.inventory.currentItem] = null; + } +@@ -476,11 +494,11 @@ + this.cameraYaw = 0.0F; + this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); + +- if (this.ridingEntity instanceof EntityPig) ++ if (this.ridingEntity instanceof EntityLivingBase && ((EntityLivingBase)ridingEntity).shouldRiderFaceForward(this)) + { + this.rotationPitch = f1; + this.rotationYaw = f; +- this.renderYawOffset = ((EntityPig)this.ridingEntity).renderYawOffset; ++ this.renderYawOffset = ((EntityLivingBase)this.ridingEntity).renderYawOffset; + } + } + } +@@ -610,11 +628,15 @@ + + public void onDeath(DamageSource cause) + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; + super.onDeath(cause); + this.setSize(0.2F, 0.2F); + this.setPosition(this.posX, this.posY, this.posZ); + this.motionY = 0.10000000149011612D; + ++ captureDrops = true; ++ capturedDrops.clear(); ++ + if (this.getName().equals("Notch")) + { + this.dropItem(new ItemStack(Items.apple, 1), true, false); +@@ -625,6 +647,9 @@ + this.inventory.dropAllItems(); + } + ++ captureDrops = false; ++ if (!worldObj.isRemote) net.minecraftforge.event.ForgeEventFactory.onPlayerDrops(this, cause, capturedDrops, recentlyHit > 0); ++ + if (cause != null) + { + this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F); +@@ -707,12 +732,25 @@ + + public EntityItem dropOneItem(boolean dropAll) + { +- return this.dropItem(this.inventory.decrStackSize(this.inventory.currentItem, dropAll && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1), false, true); ++ ItemStack stack = inventory.getCurrentItem(); ++ ++ if (stack == null) ++ { ++ return null; ++ } ++ ++ if (stack.getItem().onDroppedByPlayer(stack, this)) ++ { ++ int count = dropAll && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1; ++ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, inventory.decrStackSize(inventory.currentItem, count), true); ++ } ++ ++ return null; + } + + public EntityItem dropPlayerItemWithRandomChoice(ItemStack itemStackIn, boolean unused) + { +- return this.dropItem(itemStackIn, false, false); ++ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, itemStackIn, false); + } + + public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem) +@@ -770,13 +808,25 @@ + + public void joinEntityItemWithWorld(EntityItem itemIn) + { ++ if (captureDrops) ++ { ++ capturedDrops.add(itemIn); ++ return; ++ } ++ + this.worldObj.spawnEntityInWorld(itemIn); + } + ++ @Deprecated //Use location sensitive version below + public float getToolDigEfficiency(Block p_180471_1_) + { +- float f = this.inventory.getStrVsBlock(p_180471_1_); ++ return getBreakSpeed(p_180471_1_.getDefaultState(), new BlockPos(0, -1, 0)); ++ } + ++ public float getBreakSpeed(IBlockState state, BlockPos pos) ++ { ++ ItemStack stack = inventory.getCurrentItem(); ++ float f = (stack == null ? 1.0F : stack.getItem().getDigSpeed(stack, state)); + if (f > 1.0F) + { + int i = EnchantmentHelper.getEfficiencyModifier(this); +@@ -826,12 +876,13 @@ + f /= 5.0F; + } + +- return f; ++ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos); ++ return (f < 0 ? 0 : f); + } + + public boolean canHarvestBlock(Block blockToHarvest) + { +- return this.inventory.canHeldItemHarvest(blockToHarvest); ++ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, blockToHarvest, this.inventory.canHeldItemHarvest(blockToHarvest)); + } + + public void readEntityFromNBT(NBTTagCompound tagCompund) +@@ -867,6 +918,16 @@ + this.spawnForced = tagCompund.getBoolean("SpawnForced"); + } + ++ NBTTagList spawnlist = null; ++ spawnlist = tagCompund.getTagList("Spawns", 10); ++ for (int i = 0; i < spawnlist.tagCount(); i++) ++ { ++ NBTTagCompound spawndata = (NBTTagCompound)spawnlist.getCompoundTagAt(i); ++ int spawndim = spawndata.getInteger("Dim"); ++ this.spawnChunkMap.put(spawndim, new BlockPos(spawndata.getInteger("SpawnX"), spawndata.getInteger("SpawnY"), spawndata.getInteger("SpawnZ"))); ++ this.spawnForcedMap.put(spawndim, spawndata.getBoolean("SpawnForced")); ++ } ++ + this.foodStats.readNBT(tagCompund); + this.capabilities.readCapabilitiesFromNBT(tagCompund); + +@@ -898,6 +959,23 @@ + tagCompound.setBoolean("SpawnForced", this.spawnForced); + } + ++ NBTTagList spawnlist = new NBTTagList(); ++ for (java.util.Map.Entry entry : this.spawnChunkMap.entrySet()) ++ { ++ BlockPos spawn = entry.getValue(); ++ if (spawn == null) continue; ++ Boolean forced = spawnForcedMap.get(entry.getKey()); ++ if (forced == null) forced = false; ++ NBTTagCompound spawndata = new NBTTagCompound(); ++ spawndata.setInteger("Dim", entry.getKey()); ++ spawndata.setInteger("SpawnX", spawn.getX()); ++ spawndata.setInteger("SpawnY", spawn.getY()); ++ spawndata.setInteger("SpawnZ", spawn.getZ()); ++ spawndata.setBoolean("SpawnForced", forced); ++ spawnlist.appendTag(spawndata); ++ } ++ tagCompound.setTag("Spawns", spawnlist); ++ + this.foodStats.writeNBT(tagCompound); + this.capabilities.writeCapabilitiesToNBT(tagCompound); + tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT()); +@@ -911,6 +989,7 @@ + + public boolean attackEntityFrom(DamageSource source, float amount) + { ++ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, source, amount)) return false; + if (this.isEntityInvulnerable(source)) + { + return false; +@@ -1007,12 +1086,15 @@ + { + if (!this.isEntityInvulnerable(damageSrc)) + { ++ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); ++ if (damageAmount <= 0) return; + if (!damageSrc.isUnblockable() && this.isBlocking() && damageAmount > 0.0F) + { + damageAmount = (1.0F + damageAmount) * 0.5F; + } + +- damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); ++ damageAmount = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, inventory.armorInventory, damageSrc, damageAmount); ++ if (damageAmount <= 0) return; + damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); + float f = damageAmount; + damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); +@@ -1074,6 +1156,7 @@ + } + else + { ++ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, targetEntity)) return false; + ItemStack itemstack = this.getCurrentEquippedItem(); + ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null; + +@@ -1125,7 +1208,9 @@ + + public void destroyCurrentEquippedItem() + { ++ ItemStack orig = getCurrentEquippedItem(); + this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, orig); + } + + public double getYOffset() +@@ -1135,6 +1220,7 @@ + + public void attackTargetEntityWithCurrentItem(Entity targetEntity) + { ++ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, targetEntity)) return; + if (targetEntity.canAttackWithItem()) + { + if (!targetEntity.hitByEntity(this)) +@@ -1311,6 +1397,8 @@ + + public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation) + { ++ EntityPlayer.EnumStatus ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, bedLocation); ++ if (ret != null) return ret; + if (!this.worldObj.isRemote) + { + if (this.isPlayerSleeping() || !this.isEntityAlive()) +@@ -1350,9 +1438,9 @@ + + this.setSize(0.2F, 0.2F); + +- if (this.worldObj.isBlockLoaded(bedLocation)) ++ if (this.worldObj.isBlockLoaded(bedLocation) && worldObj.getBlockState(bedLocation).getBlock().isBed(worldObj, bedLocation, this)) + { +- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(bedLocation).getValue(BlockDirectional.FACING); ++ EnumFacing enumfacing = this.worldObj.getBlockState(bedLocation).getBlock().getBedDirection(worldObj, bedLocation); + float f = 0.5F; + float f1 = 0.5F; + +@@ -1415,13 +1503,14 @@ + + public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn) + { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_70999_1_, updateWorldFlag, setSpawn); + this.setSize(0.6F, 1.8F); + IBlockState iblockstate = this.worldObj.getBlockState(this.playerLocation); + +- if (this.playerLocation != null && iblockstate.getBlock() == Blocks.bed) ++ if (this.playerLocation != null && iblockstate.getBlock().isBed(worldObj, playerLocation, this)) + { +- this.worldObj.setBlockState(this.playerLocation, iblockstate.withProperty(BlockBed.OCCUPIED, Boolean.valueOf(false)), 4); +- BlockPos blockpos = BlockBed.getSafeExitLocation(this.worldObj, this.playerLocation, 0); ++ iblockstate.getBlock().setBedOccupied(worldObj, playerLocation, this, false); ++ BlockPos blockpos = iblockstate.getBlock().getBedSpawnPosition(worldObj, playerLocation, this); + + if (blockpos == null) + { +@@ -1430,6 +1519,10 @@ + + this.setPosition((double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.1F), (double)((float)blockpos.getZ() + 0.5F)); + } ++ else ++ { ++ setSpawn = false; ++ } + + this.sleeping = false; + +@@ -1448,14 +1541,14 @@ + + private boolean isInBed() + { +- return this.worldObj.getBlockState(this.playerLocation).getBlock() == Blocks.bed; ++ return net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, playerLocation); + } + + public static BlockPos getBedSpawnLocation(World worldIn, BlockPos bedLocation, boolean forceSpawn) + { + Block block = worldIn.getBlockState(bedLocation).getBlock(); + +- if (block != Blocks.bed) ++ if (!block.isBed(worldIn, bedLocation, null)) + { + if (!forceSpawn) + { +@@ -1470,16 +1563,16 @@ + } + else + { +- return BlockBed.getSafeExitLocation(worldIn, bedLocation, 0); ++ return worldIn.getBlockState(bedLocation).getBlock().getBedSpawnPosition(worldIn, bedLocation, null); + } + } + + @SideOnly(Side.CLIENT) + public float getBedOrientationInDegrees() + { +- if (this.playerLocation != null) ++ if (this.playerLocation != null && worldObj.getBlockState(playerLocation).getBlock().isBed(worldObj, playerLocation, this)) + { +- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockDirectional.FACING); ++ EnumFacing enumfacing = this.worldObj.getBlockState(this.playerLocation).getBlock().getBedDirection(worldObj, playerLocation); + + switch (enumfacing) + { +@@ -1519,16 +1612,24 @@ + + public BlockPos getBedLocation() + { +- return this.spawnChunk; ++ return getBedLocation(this.dimension); + } + ++ @Deprecated // Use dimension-sensitive version. + public boolean isSpawnForced() + { +- return this.spawnForced; ++ return isSpawnForced(this.dimension); + } + + public void setSpawnPoint(BlockPos pos, boolean forced) + { ++ if(net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, pos, forced)) return; ++ if (this.dimension != 0) ++ { ++ setSpawnChunk(pos, forced, this.dimension); ++ return; ++ } ++ + if (pos != null) + { + this.spawnChunk = pos; +@@ -1712,6 +1813,10 @@ + + super.fall(distance, damageMultiplier); + } ++ else ++ { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, distance, damageMultiplier); ++ } + } + + protected void resetHeight() +@@ -1735,6 +1840,7 @@ + } + + EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entityLivingIn))); ++ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entityLivingIn)); + + if (entitylist$entityegginfo != null) + { +@@ -1847,6 +1953,8 @@ + { + if (stack != this.itemInUse) + { ++ duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, stack, duration); ++ if (duration <= 0) return; + this.itemInUse = stack; + this.itemInUseCount = duration; + +@@ -1918,6 +2026,10 @@ + this.field_181016_an = oldPlayer.field_181016_an; + this.field_181017_ao = oldPlayer.field_181017_ao; + this.field_181018_ap = oldPlayer.field_181018_ap; ++ //Copy and re-init ExtendedProperties when switching dimensions. ++ this.extendedProperties = oldPlayer.extendedProperties; ++ for (net.minecraftforge.common.IExtendedEntityProperties p : this.extendedProperties.values()) ++ p.init(this, this.worldObj); + } + else if (this.worldObj.getGameRules().getBoolean("keepInventory")) + { +@@ -1931,6 +2043,18 @@ + this.xpSeed = oldPlayer.xpSeed; + this.theInventoryEnderChest = oldPlayer.theInventoryEnderChest; + this.getDataWatcher().updateObject(10, Byte.valueOf(oldPlayer.getDataWatcher().getWatchableObjectByte(10))); ++ ++ this.spawnChunkMap = oldPlayer.spawnChunkMap; ++ this.spawnForcedMap = oldPlayer.spawnForcedMap; ++ ++ //Copy over a section of the Entity Data from the old player. ++ //Allows mods to specify data that persists after players respawn. ++ NBTTagCompound old = oldPlayer.getEntityData(); ++ if (old.hasKey(PERSISTED_NBT_TAG)) ++ { ++ getEntityData().setTag(PERSISTED_NBT_TAG, old.getCompoundTag(PERSISTED_NBT_TAG)); ++ } ++ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, oldPlayer, !respawnFromEnd); + } + + protected boolean canTriggerWalking() +@@ -1968,7 +2092,14 @@ + + public void setCurrentItemOrArmor(int slotIn, ItemStack stack) + { +- this.inventory.armorInventory[slotIn] = stack; ++ if (slotIn == 0) //Forge: Fix issue in Player where it doen't take into account selected item ++ { ++ this.inventory.mainInventory[this.inventory.currentItem] = stack; ++ } ++ else ++ { ++ this.inventory.armorInventory[slotIn - 1] = stack; ++ } + } + + @SideOnly(Side.CLIENT) +@@ -2013,7 +2144,10 @@ + + public IChatComponent getDisplayName() + { +- IChatComponent ichatcomponent = new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName())); ++ IChatComponent ichatcomponent = new ChatComponentText(""); ++ if (!prefixes.isEmpty()) for (net.minecraft.util.IChatComponent prefix : prefixes) ichatcomponent.appendSibling(prefix); ++ ichatcomponent.appendSibling(new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getDisplayNameString()))); ++ if (!suffixes.isEmpty()) for (net.minecraft.util.IChatComponent suffix : suffixes) ichatcomponent.appendSibling(suffix); + ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); + ichatcomponent.getChatStyle().setChatHoverEvent(this.getHoverEvent()); + ichatcomponent.getChatStyle().setInsertion(this.getName()); +@@ -2022,7 +2156,7 @@ + + public float getEyeHeight() + { +- float f = 1.62F; ++ float f = eyeHeight; + + if (this.isPlayerSleeping()) + { +@@ -2155,6 +2289,136 @@ + this.hasReducedDebug = reducedDebug; + } + ++ /** ++ * Opens a GUI with this player, uses FML's IGuiHandler system. ++ * Allows for extension by modders. ++ * ++ * @param mod The mod trying to open a GUI ++ * @param modGuiId GUI ID ++ * @param world Current World ++ * @param x Passed directly to IGuiHandler, data meaningless Typically world X position ++ * @param y Passed directly to IGuiHandler, data meaningless Typically world Y position ++ * @param z Passed directly to IGuiHandler, data meaningless Typically world Z position ++ */ ++ public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) ++ { ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z); ++ } ++ ++ ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * A dimension aware version of getBedLocation. ++ * @param dimension The dimension to get the bed spawn for ++ * @return The player specific spawn location for the dimension. May be null. ++ */ ++ public BlockPos getBedLocation(int dimension) ++ { ++ return dimension == 0 ? spawnChunk : spawnChunkMap.get(dimension); ++ } ++ ++ /** ++ * A dimension aware version of isSpawnForced. ++ * Noramally isSpawnForced is used to determine if the respawn system should check for a bed or not. ++ * This just extends that to be dimension aware. ++ * @param dimension The dimension to get whether to check for a bed before spawning for ++ * @return The player specific spawn location for the dimension. May be null. ++ */ ++ public boolean isSpawnForced(int dimension) ++ { ++ if (dimension == 0) return this.spawnForced; ++ Boolean forced = this.spawnForcedMap.get(dimension); ++ return forced == null ? false : forced; ++ } ++ ++ /** ++ * A dimension aware version of setSpawnChunk. ++ * This functions identically, but allows you to specify which dimension to affect, rather than affecting the player's current dimension. ++ * @param pos The spawn point to set as the player-specific spawn point for the dimension ++ * @param forced Whether or not the respawn code should check for a bed at this location (true means it won't check for a bed) ++ * @param dimension Which dimension to apply the player-specific respawn point to ++ */ ++ public void setSpawnChunk(BlockPos pos, boolean forced, int dimension) ++ { ++ if (dimension == 0) ++ { ++ if (pos != null) ++ { ++ spawnChunk = pos; ++ spawnForced = forced; ++ } ++ else ++ { ++ spawnChunk = null; ++ spawnForced = false; ++ } ++ return; ++ } ++ ++ if (pos != null) ++ { ++ spawnChunkMap.put(dimension, pos); ++ spawnForcedMap.put(dimension, forced); ++ } ++ else ++ { ++ spawnChunkMap.remove(dimension); ++ spawnForcedMap.remove(dimension); ++ } ++ } ++ ++ private String displayname; ++ ++ /** ++ * Returns the default eye height of the player ++ * @return player default eye height ++ */ ++ public float getDefaultEyeHeight() ++ { ++ return 1.62F; ++ } ++ ++ /** ++ * Get the currently computed display name, cached for efficiency. ++ * @return the current display name ++ */ ++ public String getDisplayNameString() ++ { ++ if(this.displayname == null) ++ { ++ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.getName()); ++ } ++ return this.displayname; ++ } ++ ++ /** ++ * Force the displayed name to refresh ++ */ ++ public void refreshDisplayName() ++ { ++ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.getName()); ++ } ++ ++ private final java.util.Collection prefixes = new java.util.LinkedList(); ++ private final java.util.Collection suffixes = new java.util.LinkedList(); ++ ++ /** ++ * Add a prefix to the player's username in chat ++ * @param prefix The prefix ++ */ ++ public void addPrefix(net.minecraft.util.IChatComponent prefix) { prefixes.add(prefix); } ++ ++ /** ++ * Add a suffix to the player's username in chat ++ * @param suffix The suffix ++ */ ++ public void addSuffix(net.minecraft.util.IChatComponent suffix) { suffixes.add(suffix); } ++ ++ public java.util.Collection getPrefixes() { return this.prefixes; } ++ public java.util.Collection getSuffixes() { return this.suffixes; } ++ ++ /* ======================================== FORGE END =====================================*/ ++ + public static enum EnumChatVisibility + { + FULL(0, "options.chat.visibility.full"), diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch new file mode 100644 index 0000000000..0adab5b6c7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -0,0 +1,90 @@ +--- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java ++++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java +@@ -123,14 +123,15 @@ + public int ping; + public boolean playerConqueredTheEnd; + ++ @SuppressWarnings("unused") + public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager) + { + super(worldIn, profile); + interactionManager.thisPlayerMP = this; + this.theItemInWorldManager = interactionManager; +- BlockPos blockpos = worldIn.getSpawnPoint(); ++ BlockPos blockpos = worldIn.provider.getRandomizedSpawnPoint(); + +- if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) ++ if (false && !worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) + { + int i = Math.max(5, server.getSpawnProtectionSize() - 6); + int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ())); +@@ -223,7 +224,7 @@ + + this.openContainer.detectAndSendChanges(); + +- if (!this.worldObj.isRemote && !this.openContainer.canInteractWith(this)) ++ if (!this.worldObj.isRemote && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.openContainer)) + { + this.closeScreen(); + this.openContainer = this.inventoryContainer; +@@ -294,6 +295,7 @@ + for (Chunk chunk1 : list) + { + this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(chunk1.getChunkCoordIntPair(), this)); + } + } + } +@@ -424,6 +426,7 @@ + + public void onDeath(DamageSource cause) + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; + if (this.worldObj.getGameRules().getBoolean("showDeathMessages")) + { + Team team = this.getTeam(); +@@ -447,7 +450,20 @@ + + if (!this.worldObj.getGameRules().getBoolean("keepInventory")) + { ++ captureDrops = true; ++ capturedDrops.clear(); ++ + this.inventory.dropAllItems(); ++ ++ captureDrops = false; ++ net.minecraftforge.event.entity.player.PlayerDropsEvent event = new net.minecraftforge.event.entity.player.PlayerDropsEvent(this, cause, capturedDrops, recentlyHit > 0); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) ++ { ++ for (net.minecraft.entity.item.EntityItem item : capturedDrops) ++ { ++ joinEntityItemWithWorld(item); ++ } ++ } + } + + for (ScoreObjective scoreobjective : this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.deathCount)) +@@ -461,6 +477,7 @@ + if (entitylivingbase != null) + { + EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entitylivingbase))); ++ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entitylivingbase)); + + if (entitylist$entityegginfo != null) + { +@@ -528,6 +545,7 @@ + + public void travelToDimension(int dimensionId) + { ++ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, dimensionId)) return; + if (this.dimension == 1 && dimensionId == 1) + { + this.triggerAchievement(AchievementList.theEnd2); +@@ -831,6 +849,7 @@ + { + if (stat != null) + { ++ if (stat.isAchievement() && net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.AchievementEvent(this, (net.minecraft.stats.Achievement) stat))) return; + this.statsFile.increaseStat(this, stat, amount); + + for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(stat.func_150952_k())) diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch new file mode 100644 index 0000000000..7639ca0cc9 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch @@ -0,0 +1,32 @@ +--- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java ++++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java +@@ -272,12 +272,8 @@ + { + if (this.mainInventory[j] == null) + { +- this.mainInventory[j] = new ItemStack(item, 0, itemStackIn.getMetadata()); +- +- if (itemStackIn.hasTagCompound()) +- { +- this.mainInventory[j].setTagCompound((NBTTagCompound)itemStackIn.getTagCompound().copy()); +- } ++ this.mainInventory[j] = itemStackIn.copy(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up. ++ this.mainInventory[j].stackSize = 0; + } + + int k = i; +@@ -315,6 +311,14 @@ + this.mainInventory[i].updateAnimation(this.player.worldObj, this.player, i, this.currentItem == i); + } + } ++ ++ for (int i = 0; i < armorInventory.length; i++) ++ { ++ if (armorInventory[i] != null) ++ { ++ armorInventory[i].getItem().onArmorTick(player.worldObj, player, armorInventory[i]); ++ } ++ } + } + + public boolean consumeInventoryItem(Item itemIn) diff --git a/patches.mcp/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch b/patches.mcp/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch new file mode 100644 index 0000000000..fa1e0f4b7c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityFishHook.java ++++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityFishHook.java +@@ -567,11 +567,19 @@ + } + } + ++ @SuppressWarnings("unused") + private ItemStack getFishingResult() + { + float f = this.worldObj.rand.nextFloat(); + int i = EnchantmentHelper.getLuckOfSeaModifier(this.angler); + int j = EnchantmentHelper.getLureModifier(this.angler); ++ ++ if (true) ++ { ++ this.angler.addStat(net.minecraftforge.common.FishingHooks.getFishableCategory(f, i, j).stat, 1); ++ return net.minecraftforge.common.FishingHooks.getRandomFishable(this.rand, f, i, j); ++ } ++ + float f1 = 0.1F - (float)i * 0.025F - (float)j * 0.01F; + float f2 = 0.05F + (float)i * 0.01F - (float)j * 0.01F; + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); diff --git a/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch b/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch new file mode 100644 index 0000000000..c1ce77797c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/init/Bootstrap.java ++++ ../src-work/minecraft/net/minecraft/init/Bootstrap.java +@@ -65,6 +65,7 @@ + return alreadyRegistered; + } + ++ @SuppressWarnings("unused") + static void registerDispenserBehaviors() + { + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.arrow, new BehaviorProjectileDispense() +@@ -135,7 +136,7 @@ + double d0 = source.getX() + (double)enumfacing.getFrontOffsetX(); + double d1 = (double)((float)source.getBlockPos().getY() + 0.2F); + double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ(); +- Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), stack.getMetadata(), d0, d1, d2); ++ Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), ItemMonsterPlacer.getEntityName(stack), d0, d1, d2); + + if (entity instanceof EntityLivingBase && stack.hasDisplayName()) + { diff --git a/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch new file mode 100644 index 0000000000..84a24da4df --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/inventory/Container.java ++++ ../src-work/minecraft/net/minecraft/inventory/Container.java +@@ -608,7 +608,7 @@ + Slot slot1 = (Slot)this.inventorySlots.get(i); + ItemStack itemstack1 = slot1.getStack(); + +- if (itemstack1 == null) ++ if (itemstack1 == null && slot1.isItemValid(stack)) // Forge: Make sure to respect isItemValid in the slot. + { + slot1.putStack(stack.copy()); + slot1.onSlotChanged(); diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch new file mode 100644 index 0000000000..d8b6bd0eb5 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerBeacon.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerBeacon.java +@@ -143,7 +143,7 @@ + + public boolean isItemValid(ItemStack stack) + { +- return stack == null ? false : stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot; ++ return stack == null ? false : stack.getItem().isBeaconPayment(stack); + } + + public int getSlotStackLimit() diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch new file mode 100644 index 0000000000..fa6d5d0171 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerBrewingStand.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java +@@ -154,7 +154,7 @@ + + public boolean isItemValid(ItemStack stack) + { +- return stack != null ? stack.getItem().isPotionIngredient(stack) : false; ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack); + } + + public int getSlotStackLimit() +@@ -185,7 +185,7 @@ + + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + { +- if (stack.getItem() == Items.potionitem && stack.getMetadata() > 0) ++ if (stack.getItem() instanceof net.minecraft.item.ItemPotion && stack.getMetadata() > 0) + { + this.player.triggerAchievement(AchievementList.potion); + } +@@ -195,7 +195,7 @@ + + public static boolean canHoldPotion(ItemStack stack) + { +- return stack != null && (stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle); ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack); + } + } + } diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch new file mode 100644 index 0000000000..292d16a78e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch @@ -0,0 +1,77 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerEnchantment.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerEnchantment.java +@@ -65,9 +65,12 @@ + }); + this.addSlotToContainer(new Slot(this.tableInventory, 1, 35, 47) + { ++ java.util.List ores = net.minecraftforge.oredict.OreDictionary.getOres("gemLapis"); + public boolean isItemValid(ItemStack stack) + { +- return stack.getItem() == Items.dye && EnumDyeColor.byDyeDamage(stack.getMetadata()) == EnumDyeColor.BLUE; ++ for (ItemStack ore : ores) ++ if (net.minecraftforge.oredict.OreDictionary.itemMatches(ore, stack, false)) return true; ++ return false; + } + }); + +@@ -146,6 +149,7 @@ + if (!this.worldPointer.isRemote) + { + int l = 0; ++ float power = 0; + + for (int j = -1; j <= 1; ++j) + { +@@ -153,37 +157,14 @@ + { + if ((j != 0 || k != 0) && this.worldPointer.isAirBlock(this.position.add(k, 0, j)) && this.worldPointer.isAirBlock(this.position.add(k, 1, j))) + { +- if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j * 2)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } +- +- if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j * 2)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } +- ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 0, j * 2)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 1, j * 2)); + if (k != 0 && j != 0) + { +- if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } +- +- if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } +- +- if (this.worldPointer.getBlockState(this.position.add(k, 0, j * 2)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } +- +- if (this.worldPointer.getBlockState(this.position.add(k, 1, j * 2)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 0, j)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 1, j)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k, 0, j * 2)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k, 1, j * 2)); + } + } + } +@@ -193,7 +174,7 @@ + + for (int i1 = 0; i1 < 3; ++i1) + { +- this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, l, itemstack); ++ this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, (int)power, itemstack); + this.field_178151_h[i1] = -1; + + if (this.enchantLevels[i1] < i1 + 1) diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch new file mode 100644 index 0000000000..2b87f8433e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerPlayer.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerPlayer.java +@@ -43,7 +43,8 @@ + } + public boolean isItemValid(ItemStack stack) + { +- return stack == null ? false : (stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType == k_f : (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull ? false : k_f == 0)); ++ if (stack == null) return false; ++ return stack.getItem().isValidArmor(stack, k_f, thePlayer); + } + @SideOnly(Side.CLIENT) + public String getSlotTexture() diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch new file mode 100644 index 0000000000..8ca672062a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch @@ -0,0 +1,47 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerRepair.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerRepair.java +@@ -70,6 +70,8 @@ + playerIn.addExperienceLevel(-ContainerRepair.this.maximumCost); + } + ++ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(playerIn, stack, ContainerRepair.this.inputSlots.getStackInSlot(0), ContainerRepair.this.inputSlots.getStackInSlot(1)); ++ + ContainerRepair.this.inputSlots.setInventorySlotContents(0, (ItemStack)null); + + if (ContainerRepair.this.materialCost > 0) +@@ -94,7 +96,7 @@ + ContainerRepair.this.maximumCost = 0; + IBlockState iblockstate = worldIn.getBlockState(blockPosIn); + +- if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().nextFloat() < 0.12F) ++ if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().nextFloat() < breakChance) + { + int l = ((Integer)iblockstate.getValue(BlockAnvil.DAMAGE)).intValue(); + ++l; +@@ -172,6 +174,7 @@ + + if (itemstack2 != null) + { ++ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, i2)) return; + flag = itemstack2.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(itemstack2).tagCount() > 0; + + if (itemstack1.isItemStackDamageable() && itemstack1.getItem().getIsRepairable(itemstack, itemstack2)) +@@ -264,7 +267,8 @@ + { + int i4 = ((Integer)iterator.next()).intValue(); + +- if (i4 != i5 && !enchantment.canApplyTogether(Enchantment.getEnchantmentById(i4))) ++ Enchantment e2 = Enchantment.getEnchantmentById(i4); ++ if (i4 != i5 && !(enchantment.canApplyTogether(e2) && e2.canApplyTogether(enchantment))) //Forge BugFix: Let Both enchantments veto being together + { + flag1 = false; + ++l1; +@@ -315,6 +319,8 @@ + } + } + ++ if (flag && !itemstack1.getItem().isBookEnchantable(itemstack1, itemstack2)) itemstack1 = null; ++ + if (StringUtils.isBlank(this.repairedItemName)) + { + if (itemstack.hasDisplayName()) diff --git a/patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch new file mode 100644 index 0000000000..543b01f37d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch @@ -0,0 +1,75 @@ +--- ../src-base/minecraft/net/minecraft/inventory/Slot.java ++++ ../src-work/minecraft/net/minecraft/inventory/Slot.java +@@ -89,7 +89,7 @@ + @SideOnly(Side.CLIENT) + public String getSlotTexture() + { +- return null; ++ return backgroundName; + } + + public ItemStack decrStackSize(int amount) +@@ -112,4 +112,63 @@ + { + return true; + } ++ ++ /*========================================= FORGE START =====================================*/ ++ protected String backgroundName = null; ++ protected net.minecraft.util.ResourceLocation backgroundLocation = null; ++ protected Object backgroundMap; ++ /** ++ * Gets the path of the texture file to use for the background image of this slot when drawing the GUI. ++ * @return The resource location for the background image ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.util.ResourceLocation getBackgroundLocation() ++ { ++ return (backgroundLocation == null ? net.minecraft.client.renderer.texture.TextureMap.locationBlocksTexture : backgroundLocation); ++ } ++ ++ /** ++ * Sets the texture file to use for the background image of the slot when it's empty. ++ * @param texture the resourcelocation for the texture ++ */ ++ @SideOnly(Side.CLIENT) ++ public void setBackgroundLocation(net.minecraft.util.ResourceLocation texture) ++ { ++ this.backgroundLocation = texture; ++ } ++ ++ /** ++ * Sets which icon index to use as the background image of the slot when it's empty. ++ * @param name The icon to use, null for none ++ */ ++ public void setBackgroundName(String name) ++ { ++ this.backgroundName = name; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite() ++ { ++ String name = getSlotTexture(); ++ return name == null ? null : getBackgroundMap().getAtlasSprite(name); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ protected net.minecraft.client.renderer.texture.TextureMap getBackgroundMap() ++ { ++ if (backgroundMap == null) backgroundMap = net.minecraft.client.Minecraft.getMinecraft().getTextureMapBlocks(); ++ return (net.minecraft.client.renderer.texture.TextureMap)backgroundMap; ++ } ++ ++ /** ++ * Retrieves the index in the inventory for this slot, this value should typically not ++ * be used, but can be useful for some occasions. ++ * ++ * @return Index in associated inventory for this slot. ++ */ ++ public int getSlotIndex() ++ { ++ return slotIndex; ++ } ++ /*========================================= FORGE END =====================================*/ + } diff --git a/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch new file mode 100644 index 0000000000..59cf4f6175 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/inventory/SlotCrafting.java ++++ ../src-work/minecraft/net/minecraft/inventory/SlotCrafting.java +@@ -112,8 +112,11 @@ + + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix); + this.onCrafting(stack); ++ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn); + ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b(this.craftMatrix, playerIn.worldObj); ++ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); + + for (int i = 0; i < aitemstack.length; ++i) + { diff --git a/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch new file mode 100644 index 0000000000..5de127a2d0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java ++++ ../src-work/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java +@@ -81,6 +81,8 @@ + + this.field_75228_b = 0; + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(thePlayer, stack); ++ + if (stack.getItem() == Items.iron_ingot) + { + this.thePlayer.triggerAchievement(AchievementList.acquireIron); diff --git a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch new file mode 100644 index 0000000000..518fc5a37b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch @@ -0,0 +1,779 @@ +--- ../src-base/minecraft/net/minecraft/item/Item.java ++++ ../src-work/minecraft/net/minecraft/item/Item.java +@@ -48,8 +48,8 @@ + + public class Item + { +- public static final RegistryNamespaced itemRegistry = new RegistryNamespaced(); +- private static final Map BLOCK_TO_ITEM = Maps.newHashMap(); ++ public static final RegistryNamespaced itemRegistry = net.minecraftforge.fml.common.registry.GameData.getItemRegistry(); ++ private static final Map BLOCK_TO_ITEM = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap(); + protected static final UUID itemModifierUUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + private CreativeTabs tabToDisplayOn; + protected static Random itemRand = new Random(); +@@ -61,6 +61,9 @@ + private String potionEffect; + private String unlocalizedName; + ++ public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = ++ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)itemRegistry).getDelegate(this, Item.class); ++ + public static int getIdFromItem(Item itemIn) + { + return itemIn == null ? 0 : itemRegistry.getIDForObject(itemIn); +@@ -126,6 +129,7 @@ + return stack; + } + ++ @Deprecated // Use ItemStack sensitive version below. + public int getItemStackLimit() + { + return this.maxStackSize; +@@ -239,6 +243,7 @@ + return this.containerItem; + } + ++ @Deprecated // Use ItemStack sensitive version below. + public boolean hasContainerItem() + { + return this.containerItem != null; +@@ -316,7 +321,7 @@ + + public boolean isItemTool(ItemStack stack) + { +- return this.getItemStackLimit() == 1 && this.isDamageable(); ++ return this.getItemStackLimit(stack) == 1 && this.isDamageable(); + } + + protected MovingObjectPosition getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids) +@@ -334,6 +339,10 @@ + float f6 = f3 * f4; + float f7 = f2 * f4; + double d3 = 5.0D; ++ if (playerIn instanceof net.minecraft.entity.player.EntityPlayerMP) ++ { ++ d3 = ((net.minecraft.entity.player.EntityPlayerMP)playerIn).theItemInWorldManager.getBlockReachDistance(); ++ } + Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); + return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); + } +@@ -371,11 +380,670 @@ + return false; + } + ++ @Deprecated // Use ItemStack sensitive version below. + public Multimap getItemAttributeModifiers() + { + return HashMultimap.create(); + } + ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * ItemStack sensitive version of getItemAttributeModifiers ++ */ ++ public Multimap getAttributeModifiers(ItemStack stack) ++ { ++ return this.getItemAttributeModifiers(); ++ } ++ ++ /** ++ * Called when a player drops the item into the world, ++ * returning false from this will prevent the item from ++ * being removed from the players inventory and spawning ++ * in the world ++ * ++ * @param player The player that dropped the item ++ * @param item The item stack, before the item is removed. ++ */ ++ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) ++ { ++ return true; ++ } ++ ++ /** ++ * Allow the item one last chance to modify its name used for the ++ * tool highlight useful for adding something extra that can't be removed ++ * by a user in the displayed name, such as a mode of operation. ++ * ++ * @param item the ItemStack for the item. ++ * @param the name that will be displayed unless it is changed in this method. ++ */ ++ public String getHighlightTip( ItemStack item, String displayName ) ++ { ++ return displayName; ++ } ++ ++ /** ++ * This is called when the item is used, before the block is activated. ++ * @param stack The Item Stack ++ * @param player The Player that used the item ++ * @param world The Current World ++ * @param pos Target position ++ * @param side The side of the target hit ++ * @return Return true to prevent any further processing. ++ */ ++ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) ++ { ++ return false; ++ } ++ ++ /** ++ * Metadata-sensitive version of getStrVsBlock ++ * @param itemstack The Item Stack ++ * @param state The block state ++ * @return The damage strength ++ */ ++ public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state) ++ { ++ return getStrVsBlock(itemstack, state.getBlock()); ++ } ++ ++ ++ protected boolean canRepair = true; ++ /** ++ * Called by CraftingManager to determine if an item is reparable. ++ * @return True if reparable ++ */ ++ public boolean isRepairable() ++ { ++ return canRepair && isDamageable(); ++ } ++ ++ /** ++ * Call to disable repair recipes. ++ * @return The current Item instance ++ */ ++ public Item setNoRepair() ++ { ++ canRepair = false; ++ return this; ++ } ++ ++ /** ++ * Called before a block is broken. Return true to prevent default block harvesting. ++ * ++ * Note: In SMP, this is called on both client and server sides! ++ * ++ * @param itemstack The current ItemStack ++ * @param pos Block's position in world ++ * @param player The Player that is wielding the item ++ * @return True to prevent harvesting, false to continue as normal ++ */ ++ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) ++ { ++ return false; ++ } ++ ++ /** ++ * Called each tick while using an item. ++ * @param stack The Item being used ++ * @param player The Player using the item ++ * @param count The amount of time in tick the item has been used for continuously ++ */ ++ public void onUsingTick(ItemStack stack, EntityPlayer player, int count) ++ { ++ } ++ ++ /** ++ * Called when the player Left Clicks (attacks) an entity. ++ * Processed before damage is done, if return value is true further processing is canceled ++ * and the entity is not attacked. ++ * ++ * @param stack The Item being used ++ * @param player The player that is attacking ++ * @param entity The entity being attacked ++ * @return True to cancel the rest of the interaction. ++ */ ++ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) ++ { ++ return false; ++ } ++ ++ /** ++ * Player, Render pass, and item usage sensitive version of getIconIndex. ++ * ++ * @param stack The item stack to get the icon for. ++ * @param player The player holding the item ++ * @param useRemaining The ticks remaining for the active item. ++ * @return Null to use default model, or a custom ModelResourceLocation for the stage of use. ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.resources.model.ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) ++ { ++ return null; ++ } ++ ++ /** ++ * ItemStack sensitive version of getContainerItem. ++ * Returns a full ItemStack instance of the result. ++ * ++ * @param itemStack The current ItemStack ++ * @return The resulting ItemStack ++ */ ++ public ItemStack getContainerItem(ItemStack itemStack) ++ { ++ if (!hasContainerItem(itemStack)) ++ { ++ return null; ++ } ++ return new ItemStack(getContainerItem()); ++ } ++ ++ /** ++ * ItemStack sensitive version of hasContainerItem ++ * @param stack The current item stack ++ * @return True if this item has a 'container' ++ */ ++ public boolean hasContainerItem(ItemStack stack) ++ { ++ return hasContainerItem(); ++ } ++ ++ /** ++ * Retrieves the normal 'lifespan' of this item when it is dropped on the ground as a EntityItem. ++ * This is in ticks, standard result is 6000, or 5 mins. ++ * ++ * @param itemStack The current ItemStack ++ * @param world The world the entity is in ++ * @return The normal lifespan in ticks. ++ */ ++ public int getEntityLifespan(ItemStack itemStack, World world) ++ { ++ return 6000; ++ } ++ ++ /** ++ * Determines if this Item has a special entity for when they are in the world. ++ * Is called when a EntityItem is spawned in the world, if true and Item#createCustomEntity ++ * returns non null, the EntityItem will be destroyed and the new Entity will be added to the world. ++ * ++ * @param stack The current item stack ++ * @return True of the item has a custom entity, If true, Item#createCustomEntity will be called ++ */ ++ public boolean hasCustomEntity(ItemStack stack) ++ { ++ return false; ++ } ++ ++ /** ++ * This function should return a new entity to replace the dropped item. ++ * Returning null here will not kill the EntityItem and will leave it to function normally. ++ * Called when the item it placed in a world. ++ * ++ * @param world The world object ++ * @param location The EntityItem object, useful for getting the position of the entity ++ * @param itemstack The current item stack ++ * @return A new Entity object to spawn or null ++ */ ++ public Entity createEntity(World world, Entity location, ItemStack itemstack) ++ { ++ return null; ++ } ++ ++ /** ++ * Called by the default implemetation of EntityItem's onUpdate method, allowing for cleaner ++ * control over the update of the item without having to write a subclass. ++ * ++ * @param entityItem The entity Item ++ * @return Return true to skip any further update code. ++ */ ++ public boolean onEntityItemUpdate(net.minecraft.entity.item.EntityItem entityItem) ++ { ++ return false; ++ } ++ ++ /** ++ * Gets a list of tabs that items belonging to this class can display on, ++ * combined properly with getSubItems allows for a single item to span ++ * many sub-items across many tabs. ++ * ++ * @return A list of all tabs that this item could possibly be one. ++ */ ++ public CreativeTabs[] getCreativeTabs() ++ { ++ return new CreativeTabs[]{ getCreativeTab() }; ++ } ++ ++ /** ++ * Determines the base experience for a player when they remove this item from a furnace slot. ++ * This number must be between 0 and 1 for it to be valid. ++ * This number will be multiplied by the stack size to get the total experience. ++ * ++ * @param item The item stack the player is picking up. ++ * @return The amount to award for each item. ++ */ ++ public float getSmeltingExperience(ItemStack item) ++ { ++ return -1; //-1 will default to the old lookups. ++ } ++ ++ /** ++ * Return the correct icon for rendering based on the supplied ItemStack and render pass. ++ * ++ * Defers to {@link #getIconFromDamageForRenderPass(int, int)} ++ * @param stack to render for ++ * @param pass the multi-render pass ++ * @return the icon ++ * / ++ public IIcon getIcon(ItemStack stack, int pass) ++ { ++ return func_77618_c(stack.getMetadata(), pass); ++ } ++ */ ++ ++ /** ++ * Generates the base Random item for a specific instance of the chest gen, ++ * Enchanted books use this to pick a random enchantment. ++ * ++ * @param chest The chest category to generate for ++ * @param rnd World RNG ++ * @param original Original result registered with the chest gen hooks. ++ * @return New values to use as the random item, typically this will be original ++ */ ++ public net.minecraft.util.WeightedRandomChestContent getChestGenBase(net.minecraftforge.common.ChestGenHooks chest, Random rnd, net.minecraft.util.WeightedRandomChestContent original) ++ { ++ if (this instanceof ItemEnchantedBook) ++ { ++ return ((ItemEnchantedBook)this).getRandom(rnd, ++ original.minStackSize, ++ original.maxStackSize, original.itemWeight); ++ } ++ return original; ++ } ++ ++ /** ++ * ++ * Should this item, when held, allow sneak-clicks to pass through to the underlying block? ++ * ++ * @param world The world ++ * @param pos Block position in world ++ * @param player The Player that is wielding the item ++ * @return ++ */ ++ public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player) ++ { ++ return false; ++ } ++ ++ /** ++ * Called to tick armor in the armor slot. Override to do something ++ */ ++ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack){} ++ ++ /** ++ * Determines if the specific ItemStack can be placed in the specified armor slot. ++ * ++ * @param stack The ItemStack ++ * @param armorType Armor slot ID: 0: Helmet, 1: Chest, 2: Legs, 3: Boots ++ * @param entity The entity trying to equip the armor ++ * @return True if the given ItemStack can be inserted in the slot ++ */ ++ public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) ++ { ++ if (this instanceof ItemArmor) ++ { ++ return ((ItemArmor)this).armorType == armorType; ++ } ++ ++ if (armorType == 0) ++ { ++ return this == Item.getItemFromBlock(Blocks.pumpkin) || this == Items.skull; ++ } ++ ++ return false; ++ } ++ ++ /** ++ * Allow or forbid the specific book/item combination as an anvil enchant ++ * ++ * @param stack The item ++ * @param book The book ++ * @return if the enchantment is allowed ++ */ ++ public boolean isBookEnchantable(ItemStack stack, ItemStack book) ++ { ++ return true; ++ } ++ ++ /** ++ * Called by RenderBiped and RenderPlayer to determine the armor texture that ++ * should be use for the currently equipped item. ++ * This will only be called on instances of ItemArmor. ++ * ++ * Returning null from this function will use the default value. ++ * ++ * @param stack ItemStack for the equipped armor ++ * @param entity The entity wearing the armor ++ * @param slot The slot the armor is in ++ * @param type The subtype, can be null or "overlay" ++ * @return Path of texture to bind, or null to use default ++ */ ++ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) ++ { ++ return null; ++ } ++ ++ /** ++ * Returns the font renderer used to render tooltips and overlays for this item. ++ * Returning null will use the standard font renderer. ++ * ++ * @param stack The current item stack ++ * @return A instance of FontRenderer or null to use default ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack) ++ { ++ return null; ++ } ++ ++ /** ++ * @deprecated Use 4-argument version. ++ */ ++ // remove 1.9 ++ @SideOnly(Side.CLIENT) ++ @Deprecated ++ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) ++ { ++ return null; ++ } ++ ++ /** ++ * Override this method to have an item handle its own armor rendering. ++ * ++ * @param entityLiving The entity wearing the armor ++ * @param itemStack The itemStack to render the model of ++ * @param armorSlot 0=head, 1=torso, 2=legs, 3=feet ++ * @param _default Original armor model. Will have attributes set. ++ * @return A ModelBiped to render instead of the default ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot, net.minecraft.client.model.ModelBiped _default) ++ { ++ return getArmorModel(entityLiving, itemStack, armorSlot); ++ } ++ ++ /** ++ * Called when a entity tries to play the 'swing' animation. ++ * ++ * @param entityLiving The entity swinging the item. ++ * @param stack The Item stack ++ * @return True to cancel any further processing by EntityLiving ++ */ ++ public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) ++ { ++ return false; ++ } ++ ++ /** ++ * Called when the client starts rendering the HUD, for whatever item the player currently has as a helmet. ++ * This is where pumpkins would render there overlay. ++ * ++ * @param stack The ItemStack that is equipped ++ * @param player Reference to the current client entity ++ * @param resolution Resolution information about the current viewport and configured GUI Scale ++ * @param partialTicks Partial ticks for the renderer, useful for interpolation ++ */ ++ @SideOnly(Side.CLIENT) ++ public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, net.minecraft.client.gui.ScaledResolution resolution, float partialTicks){} ++ ++ /** ++ * Return the itemDamage represented by this ItemStack. Defaults to the itemDamage field on ItemStack, but can be overridden here for other sources such as NBT. ++ * ++ * @param stack The itemstack that is damaged ++ * @return the damage value ++ */ ++ public int getDamage(ItemStack stack) ++ { ++ return stack.itemDamage; ++ } ++ ++ /** ++ * This used to be 'display damage' but its really just 'aux' data in the ItemStack, usually shares the same variable as damage. ++ * @param stack ++ * @return ++ */ ++ public int getMetadata(ItemStack stack) ++ { ++ return stack.itemDamage; ++ } ++ ++ /** ++ * Determines if the durability bar should be rendered for this item. ++ * Defaults to vanilla stack.isDamaged behavior. ++ * But modders can use this for any data they wish. ++ * ++ * @param stack The current Item Stack ++ * @return True if it should render the 'durability' bar. ++ */ ++ public boolean showDurabilityBar(ItemStack stack) ++ { ++ return stack.isItemDamaged(); ++ } ++ ++ /** ++ * Queries the percentage of the 'Durability' bar that should be drawn. ++ * ++ * @param stack The current ItemStack ++ * @return 1.0 for 100% 0 for 0% ++ */ ++ public double getDurabilityForDisplay(ItemStack stack) ++ { ++ return (double)stack.getItemDamage() / (double)stack.getMaxDamage(); ++ } ++ ++ /** ++ * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item, ++ * but can be overridden here for other sources such as NBT. ++ * ++ * @param stack The itemstack that is damaged ++ * @return the damage value ++ */ ++ public int getMaxDamage(ItemStack stack) ++ { ++ return getMaxDamage(); ++ } ++ ++ /** ++ * Return if this itemstack is damaged. Note only called if {@link #isDamageable()} is true. ++ * @param stack the stack ++ * @return if the stack is damaged ++ */ ++ public boolean isDamaged(ItemStack stack) ++ { ++ return stack.itemDamage > 0; ++ } ++ ++ /** ++ * Set the damage for this itemstack. Note, this method is responsible for zero checking. ++ * @param stack the stack ++ * @param damage the new damage value ++ */ ++ public void setDamage(ItemStack stack, int damage) ++ { ++ stack.itemDamage = damage; ++ ++ if (stack.itemDamage < 0) ++ { ++ stack.itemDamage = 0; ++ } ++ } ++ ++ /** ++ * ItemStack sensitive version of {@link #canHarvestBlock(Block)} ++ * @param par1Block The block trying to harvest ++ * @param itemStack The itemstack used to harvest the block ++ * @return true if can harvest the block ++ */ ++ public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) ++ { ++ return canHarvestBlock(par1Block); ++ } ++ ++ /** ++ * Gets the maximum number of items that this stack should be able to hold. ++ * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit() ++ * ++ * @param stack The ItemStack ++ * @return THe maximum number this item can be stacked to ++ */ ++ public int getItemStackLimit(ItemStack stack) ++ { ++ return this.getItemStackLimit(); ++ } ++ ++ private java.util.Map toolClasses = new java.util.HashMap(); ++ /** ++ * Sets or removes the harvest level for the specified tool class. ++ * ++ * @param toolClass Class ++ * @param level Harvest level: ++ * Wood: 0 ++ * Stone: 1 ++ * Iron: 2 ++ * Diamond: 3 ++ * Gold: 0 ++ */ ++ public void setHarvestLevel(String toolClass, int level) ++ { ++ if (level < 0) ++ toolClasses.remove(toolClass); ++ else ++ toolClasses.put(toolClass, level); ++ } ++ ++ public java.util.Set getToolClasses(ItemStack stack) ++ { ++ return toolClasses.keySet(); ++ } ++ ++ /** ++ * Queries the harvest level of this item stack for the specifred tool class, ++ * Returns -1 if this tool is not of the specified type ++ * ++ * @param stack This item stack instance ++ * @param toolClass Tool Class ++ * @return Harvest level, or -1 if not the specified tool type. ++ */ ++ public int getHarvestLevel(ItemStack stack, String toolClass) ++ { ++ Integer ret = toolClasses.get(toolClass); ++ return ret == null ? -1 : ret; ++ } ++ ++ /** ++ * ItemStack sensitive version of getItemEnchantability ++ * ++ * @param stack The ItemStack ++ * @return the item echantability value ++ */ ++ public int getItemEnchantability(ItemStack stack) ++ { ++ return getItemEnchantability(); ++ } ++ ++ /** ++ * Whether this Item can be used as a payment to activate the vanilla beacon. ++ * @param stack the ItemStack ++ * @return true if this Item can be used ++ */ ++ public boolean isBeaconPayment(ItemStack stack) ++ { ++ return this == Items.emerald || this == Items.diamond || this == Items.gold_ingot || this == Items.iron_ingot; ++ } ++ ++ ++ /** ++ * Determine if the player switching between these two item stacks ++ * @param oldStack The old stack that was equipped ++ * @param newStack The new stack ++ * @param slotChanged If the current equipped slot was changed, ++ * Vanilla does not play the animation if you switch between two ++ * slots that hold the exact same item. ++ * @return True to play the item change animation ++ */ ++ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) ++ { ++ return !ItemStack.areItemStacksEqual(oldStack, newStack); ++ } ++ ++ ++ private ResourceLocation registryName = null; ++ /** ++ * Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item. ++ * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. ++ * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. ++ * ++ * The supplied name will be prefixed with the currently active mod's modId. ++ * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. ++ * ++ * If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown. ++ * ++ * Returns 'this' to allow for chaining. ++ * ++ * @param name Unique registry name ++ * @return This instance ++ */ ++ public final Item setRegistryName(String name) ++ { ++ if (getRegistryName() != null) ++ throw new IllegalStateException("Attempted to set registry name on block with exisiting registry name! New: " + name + " Old: " + getRegistryName()); ++ int index = name.lastIndexOf(':'); ++ String oldPrefix = index == -1 ? "" : name.substring(0, index); ++ name = index == -1 ? name : name.substring(index + 1); ++ net.minecraftforge.fml.common.ModContainer mc = net.minecraftforge.fml.common.Loader.instance().activeModContainer(); ++ String prefix = mc == null ? "minecraft" : mc.getModId(); ++ if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) ++ { ++ net.minecraftforge.fml.common.FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name); ++ prefix = oldPrefix; ++ } ++ this.registryName = new ResourceLocation(prefix, name); ++ return this; ++ } ++ public final Item setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); } ++ public final Item setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); } ++ ++ /** ++ * A unique identifier for this block, if this block is registered in the game registry it will return that name. ++ * Otherwise it will return the name set in setRegistryName(). ++ * If neither are valid null is returned. ++ * ++ * @return Unique identifier or null. ++ */ ++ public final String getRegistryName() ++ { ++ if (delegate.getResourceName() != null) return delegate.getResourceName().toString(); ++ return registryName != null ? registryName.toString() : null; ++ } ++ ++ /** ++ * Called from ItemStack.setItem, will hold extra data for the life of this ItemStack. ++ * Can be retrieved from stack.getCapabilities() ++ * The NBT can be null if this is not called from readNBT or if the item the stack is ++ * changing FROM is different then this item, or the previous item had no capabilities. ++ * ++ * This is called BEFORE the stacks item is set so you can use stack.getItem() to see the OLD item. ++ * Remember that getItem CAN return null. ++ * ++ * @param stack The ItemStack ++ * @param nbt NBT of this item serialized, or null. ++ * @return A holder instance associated with this ItemStack where you can hold capabilities for the life of this item. ++ */ ++ public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) ++ { ++ return null; ++ } ++ /* ======================================== FORGE END =====================================*/ ++ + public static void registerItems() + { + registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() +@@ -855,6 +1523,10 @@ + private final float damageVsEntity; + private final int enchantability; + ++ //Added by forge for custom Tool materials. ++ @Deprecated public Item customCraftingMaterial = null; // Remote in 1.8.1 ++ private ItemStack repairMaterial = null; ++ + private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) + { + this.harvestLevel = harvestLevel; +@@ -889,9 +1561,36 @@ + return this.enchantability; + } + ++ @Deprecated // Use getRepairItemStack below + public Item getRepairItem() + { +- return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null)))); ++ switch (this) ++ { ++ case WOOD: return Item.getItemFromBlock(Blocks.planks); ++ case STONE: return Item.getItemFromBlock(Blocks.cobblestone); ++ case GOLD: return Items.gold_ingot; ++ case IRON: return Items.iron_ingot; ++ case EMERALD: return Items.diamond; ++ default: return customCraftingMaterial; ++ } + } ++ ++ public ToolMaterial setRepairItem(ItemStack stack) ++ { ++ if (this.repairMaterial != null || customCraftingMaterial != null) throw new RuntimeException("Can not change already set repair material"); ++ if (this == WOOD || this == STONE || this == GOLD || this == IRON || this == EMERALD) throw new RuntimeException("Can not change vanilla tool repair materials"); ++ this.repairMaterial = stack; ++ this.customCraftingMaterial = stack.getItem(); ++ return this; ++ } ++ ++ public ItemStack getRepairItemStack() ++ { ++ if (repairMaterial != null) return repairMaterial; ++ Item ret = this.getRepairItem(); ++ if (ret == null) return null; ++ repairMaterial = new ItemStack(ret, 1, net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE); ++ return repairMaterial; ++ } + } + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch new file mode 100644 index 0000000000..1c97a02e1a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch @@ -0,0 +1,47 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemArmor.java ++++ ../src-work/minecraft/net/minecraft/item/ItemArmor.java +@@ -37,7 +37,7 @@ + if (list.size() > 0) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0); +- int l = entitylivingbase instanceof EntityPlayer ? 1 : 0; ++ int l = 0;// Forge: We fix the indexes. Mojang Stop hard coding this! + int i1 = EntityLiving.getArmorPosition(stack); + ItemStack itemstack = stack.copy(); + itemstack.stackSize = 1; +@@ -190,7 +190,7 @@ + + if (itemstack == null) + { +- playerIn.setCurrentItemOrArmor(i, itemStackIn.copy()); ++ playerIn.setCurrentItemOrArmor(i + 1, itemStackIn.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. + itemStackIn.stackSize = 0; + } + +@@ -210,6 +210,9 @@ + private final int[] damageReductionAmountArray; + private final int enchantability; + ++ //Added by forge for custom Armor materials. ++ public Item customCraftingMaterial = null; ++ + private ArmorMaterial(String name, int maxDamage, int[] reductionAmounts, int enchantability) + { + this.name = name; +@@ -235,7 +238,15 @@ + + public Item getRepairItem() + { +- return this == LEATHER ? Items.leather : (this == CHAIN ? Items.iron_ingot : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == DIAMOND ? Items.diamond : null)))); ++ switch (this) ++ { ++ case LEATHER: return Items.leather; ++ case CHAIN: return Items.iron_ingot; ++ case GOLD: return Items.gold_ingot; ++ case IRON: return Items.iron_ingot; ++ case DIAMOND: return Items.diamond; ++ default: return customCraftingMaterial; ++ } + } + + @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch new file mode 100644 index 0000000000..6ee6336091 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch @@ -0,0 +1,56 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBlock.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java +@@ -54,16 +54,8 @@ + int i = this.getMetadata(stack.getMetadata()); + IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn); + +- if (worldIn.setBlockState(pos, iblockstate1, 3)) ++ if (placeBlockAt(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ, iblockstate1)) + { +- iblockstate1 = worldIn.getBlockState(pos); +- +- if (iblockstate1.getBlock() == this.block) +- { +- setTileEntityNBT(worldIn, playerIn, pos, stack); +- this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); +- } +- + worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F); + --stack.stackSize; + } +@@ -124,7 +116,7 @@ + { + Block block = worldIn.getBlockState(pos).getBlock(); + +- if (block == Blocks.snow_layer) ++ if (block == Blocks.snow_layer && block.isReplaceable(worldIn, pos)) + { + side = EnumFacing.UP; + } +@@ -162,4 +154,26 @@ + { + return this.block; + } ++ ++ /** ++ * Called to actually place the block, after the location is determined ++ * and all permission checks have been made. ++ * ++ * @param stack The item stack that was used to place the block. This can be changed inside the method. ++ * @param player The player who is placing the block. Can be null if the block is not being placed by a player. ++ * @param side The side the player (or machine) right-clicked on. ++ */ ++ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) ++ { ++ if (!world.setBlockState(pos, newState, 3)) return false; ++ ++ IBlockState state = world.getBlockState(pos); ++ if (state.getBlock() == this.block) ++ { ++ setTileEntityNBT(world, player, pos, stack); ++ this.block.onBlockPlacedBy(world, pos, state, player, stack); ++ } ++ ++ return true; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch new file mode 100644 index 0000000000..751ab83674 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBow.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBow.java +@@ -27,6 +27,9 @@ + if (flag || playerIn.inventory.hasItem(Items.arrow)) + { + int i = this.getMaxItemUseDuration(stack) - timeLeft; ++ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, stack, i); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; ++ i = event.charge; + float f = (float)i / 20.0F; + f = (f * f + f * 2.0F) / 3.0F; + +@@ -104,6 +107,9 @@ + + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { ++ net.minecraftforge.event.entity.player.ArrowNockEvent event = new net.minecraftforge.event.entity.player.ArrowNockEvent(playerIn, itemStackIn); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return event.result; ++ + if (playerIn.capabilities.isCreativeMode || playerIn.inventory.hasItem(Items.arrow)) + { + playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch new file mode 100644 index 0000000000..490b216773 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBucket.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBucket.java +@@ -36,6 +36,9 @@ + } + else + { ++ ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(playerIn, worldIn, itemStackIn, movingobjectposition); ++ if (ret != null) return ret; ++ + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = movingobjectposition.getBlockPos(); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch new file mode 100644 index 0000000000..e1b1013f42 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBucketMilk.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBucketMilk.java +@@ -23,7 +23,7 @@ + + if (!worldIn.isRemote) + { +- playerIn.clearActivePotions(); ++ playerIn.curePotionEffects(stack); + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch new file mode 100644 index 0000000000..fa9033555e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch @@ -0,0 +1,56 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemDye.java ++++ ../src-work/minecraft/net/minecraft/item/ItemDye.java +@@ -47,7 +47,7 @@ + + if (enumdyecolor == EnumDyeColor.WHITE) + { +- if (applyBonemeal(stack, worldIn, pos)) ++ if (applyBonemeal(stack, worldIn, pos, playerIn)) + { + if (!worldIn.isRemote) + { +@@ -97,8 +97,18 @@ + + public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target) + { ++ if (worldIn instanceof net.minecraft.world.WorldServer) ++ return applyBonemeal(stack, worldIn, target, net.minecraftforge.common.util.FakePlayerFactory.getMinecraft((net.minecraft.world.WorldServer)worldIn)); ++ return false; ++ } ++ ++ public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target, EntityPlayer player) ++ { + IBlockState iblockstate = worldIn.getBlockState(target); + ++ int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, worldIn, target, iblockstate, stack); ++ if (hook != 0) return hook > 0; ++ + if (iblockstate.getBlock() instanceof IGrowable) + { + IGrowable igrowable = (IGrowable)iblockstate.getBlock(); +@@ -132,7 +142,7 @@ + + Block block = worldIn.getBlockState(pos).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (block.isAir(worldIn, pos)) + { + block.setBlockBoundsBasedOnState(worldIn, pos); + +@@ -144,6 +154,16 @@ + worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); + } + } ++ else ++ { ++ for (int i1 = 0; i1 < amount; ++i1) ++ { ++ double d0 = itemRand.nextGaussian() * 0.02D; ++ double d1 = itemRand.nextGaussian() * 0.02D; ++ double d2 = itemRand.nextGaussian() * 0.02D; ++ worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * 1.0f, (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); ++ } ++ } + } + + public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch new file mode 100644 index 0000000000..6fc09d1de6 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemEmptyMap.java ++++ ../src-work/minecraft/net/minecraft/item/ItemEmptyMap.java +@@ -22,7 +22,7 @@ + worldIn.setItemData(s, mapdata); + mapdata.scale = 0; + mapdata.calculateMapCenter(playerIn.posX, playerIn.posZ, mapdata.scale); +- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); ++ mapdata.dimension = worldIn.provider.getDimensionId(); + mapdata.markDirty(); + --itemStackIn.stackSize; + diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch new file mode 100644 index 0000000000..17bd77146c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemFlintAndSteel.java ++++ ../src-work/minecraft/net/minecraft/item/ItemFlintAndSteel.java +@@ -27,7 +27,7 @@ + } + else + { +- if (worldIn.getBlockState(pos).getBlock().getMaterial() == Material.air) ++ if (worldIn.isAirBlock(pos)) + { + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); + worldIn.setBlockState(pos, Blocks.fire.getDefaultState()); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch new file mode 100644 index 0000000000..28920005fb --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemHoe.java ++++ ../src-work/minecraft/net/minecraft/item/ItemHoe.java +@@ -34,10 +34,13 @@ + } + else + { ++ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, playerIn, worldIn, pos); ++ if (hook != 0) return hook > 0; ++ + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + +- if (side != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).getBlock().getMaterial() == Material.air) ++ if (side != EnumFacing.DOWN && worldIn.isAirBlock(pos.up())) + { + if (block == Blocks.grass) + { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch new file mode 100644 index 0000000000..86d27a4436 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemLilyPad.java ++++ ../src-work/minecraft/net/minecraft/item/ItemLilyPad.java +@@ -49,7 +49,14 @@ + + if (iblockstate.getBlock().getMaterial() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) + { ++ // special case for handling block placement with water lilies ++ net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(worldIn, blockpos1); + worldIn.setBlockState(blockpos1, Blocks.waterlily.getDefaultState()); ++ if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(playerIn, blocksnapshot, net.minecraft.util.EnumFacing.UP).isCanceled()) ++ { ++ blocksnapshot.restore(true, false); ++ return itemStackIn; ++ } + + if (!playerIn.capabilities.isCreativeMode) + { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch new file mode 100644 index 0000000000..4df592c19b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemMap.java ++++ ../src-work/minecraft/net/minecraft/item/ItemMap.java +@@ -57,7 +57,7 @@ + mapdata = new MapData(s); + mapdata.scale = 3; + mapdata.calculateMapCenter((double)worldIn.getWorldInfo().getSpawnX(), (double)worldIn.getWorldInfo().getSpawnZ(), mapdata.scale); +- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); ++ mapdata.dimension = worldIn.provider.getDimensionId(); + mapdata.markDirty(); + worldIn.setItemData(s, mapdata); + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch new file mode 100644 index 0000000000..ba116ba1e7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch @@ -0,0 +1,113 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemMonsterPlacer.java ++++ ../src-work/minecraft/net/minecraft/item/ItemMonsterPlacer.java +@@ -36,7 +36,7 @@ + public String getItemStackDisplayName(ItemStack stack) + { + String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); +- String s1 = EntityList.getStringFromID(stack.getMetadata()); ++ String s1 = ItemMonsterPlacer.getEntityName(stack); + + if (s1 != null) + { +@@ -49,7 +49,7 @@ + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int renderPass) + { +- EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(stack.getMetadata())); ++ EntityList.EntityEggInfo entitylist$entityegginfo = ItemMonsterPlacer.getEggInfo(stack); + return entitylist$entityegginfo != null ? (renderPass == 0 ? entitylist$entityegginfo.primaryColor : entitylist$entityegginfo.secondaryColor) : 16777215; + } + +@@ -74,7 +74,7 @@ + if (tileentity instanceof TileEntityMobSpawner) + { + MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic(); +- mobspawnerbaselogic.setEntityName(EntityList.getStringFromID(stack.getMetadata())); ++ mobspawnerbaselogic.setEntityName(ItemMonsterPlacer.getEntityName(stack)); + tileentity.markDirty(); + worldIn.markBlockForUpdate(pos); + +@@ -90,12 +90,12 @@ + pos = pos.offset(side); + double d0 = 0.0D; + +- if (side == EnumFacing.UP && iblockstate instanceof BlockFence) ++ if (side == EnumFacing.UP && iblockstate.getBlock() instanceof BlockFence) //Forge: Fix Vanilla bug comparing state instead of block + { + d0 = 0.5D; + } + +- Entity entity = spawnCreature(worldIn, stack.getMetadata(), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); ++ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(stack), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); + + if (entity != null) + { +@@ -146,7 +146,7 @@ + + if (worldIn.getBlockState(blockpos).getBlock() instanceof BlockLiquid) + { +- Entity entity = spawnCreature(worldIn, itemStackIn.getMetadata(), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); ++ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(itemStackIn), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); + + if (entity != null) + { +@@ -170,19 +170,29 @@ + } + } + ++ @Deprecated // Use string version below. + public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z) + { + if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID))) + { + return null; + } ++ return spawnCreature(worldIn, EntityList.getStringFromID(entityID), x, y, z); ++ } ++ ++ public static Entity spawnCreature(World worldIn, String name, double x, double y, double z) ++ { ++ if (!EntityList.stringToClassMapping.containsKey(name)) ++ { ++ return null; ++ } + else + { + Entity entity = null; + + for (int i = 0; i < 1; ++i) + { +- entity = EntityList.createEntityByID(entityID, worldIn); ++ entity = EntityList.createEntityByName(name, worldIn); + + if (entity instanceof EntityLivingBase) + { +@@ -207,5 +217,28 @@ + { + subItems.add(new ItemStack(itemIn, 1, entitylist$entityegginfo.spawnedID)); + } ++ ++ for (String name : net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().keySet()) ++ { ++ ItemStack stack = new ItemStack(itemIn); ++ net.minecraft.nbt.NBTTagCompound nbt = new net.minecraft.nbt.NBTTagCompound(); ++ nbt.setString("entity_name", name); ++ stack.setTagCompound(nbt); ++ subItems.add(stack); ++ } + } ++ ++ public static String getEntityName(ItemStack stack) ++ { ++ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("entity_name", 8)) ++ return stack.getTagCompound().getString("entity_name"); ++ return EntityList.getStringFromID(stack.getMetadata()); ++ } ++ ++ private static EntityList.EntityEggInfo getEggInfo(ItemStack stack) ++ { ++ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("entity_name", 8)) ++ return net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(stack.getTagCompound().getString("entity_name")); ++ return (EntityList.EntityEggInfo)EntityList.entityEggs.get(stack.getMetadata()); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch new file mode 100644 index 0000000000..e6bf3bf5d1 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemRecord.java ++++ ../src-work/minecraft/net/minecraft/item/ItemRecord.java +@@ -76,4 +76,15 @@ + { + return (ItemRecord)RECORDS.get(name); + } ++ ++ /** ++ * Retrieves the resource location of the sound to play for this record. ++ * ++ * @param name The name of the record to play ++ * @return The resource location for the audio, null to use default. ++ */ ++ public net.minecraft.util.ResourceLocation getRecordResource(String name) ++ { ++ return new net.minecraft.util.ResourceLocation(name); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch new file mode 100644 index 0000000000..53391bf0b0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSeedFood.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSeedFood.java +@@ -6,7 +6,7 @@ + import net.minecraft.util.EnumFacing; + import net.minecraft.world.World; + +-public class ItemSeedFood extends ItemFood ++public class ItemSeedFood extends ItemFood implements net.minecraftforge.common.IPlantable + { + private Block crops; + private Block soilId; +@@ -28,7 +28,7 @@ + { + return false; + } +- else if (worldIn.getBlockState(pos).getBlock() == this.soilId && worldIn.isAirBlock(pos.up())) ++ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) + { + worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); + --stack.stackSize; +@@ -39,4 +39,16 @@ + return false; + } + } ++ ++ @Override ++ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ return net.minecraftforge.common.EnumPlantType.Crop; ++ } ++ ++ @Override ++ public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ return this.crops.getDefaultState(); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch new file mode 100644 index 0000000000..053649392d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSeeds.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSeeds.java +@@ -7,7 +7,7 @@ + import net.minecraft.util.EnumFacing; + import net.minecraft.world.World; + +-public class ItemSeeds extends Item ++public class ItemSeeds extends Item implements net.minecraftforge.common.IPlantable + { + private Block crops; + private Block soilBlockID; +@@ -29,7 +29,7 @@ + { + return false; + } +- else if (worldIn.getBlockState(pos).getBlock() == this.soilBlockID && worldIn.isAirBlock(pos.up())) ++ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) + { + worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); + --stack.stackSize; +@@ -40,4 +40,16 @@ + return false; + } + } ++ ++ @Override ++ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ return this.crops == net.minecraft.init.Blocks.nether_wart ? net.minecraftforge.common.EnumPlantType.Nether : net.minecraftforge.common.EnumPlantType.Crop; ++ } ++ ++ @Override ++ public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ return this.crops.getDefaultState(); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch new file mode 100644 index 0000000000..6c0e839312 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch @@ -0,0 +1,89 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemShears.java ++++ ../src-work/minecraft/net/minecraft/item/ItemShears.java +@@ -19,13 +19,12 @@ + + public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) + { +- if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool) ++ if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool && !(blockIn instanceof net.minecraftforge.common.IShearable)) + { + return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn); + } + else + { +- stack.damageItem(1, playerIn); + return true; + } + } +@@ -39,4 +38,71 @@ + { + return block != Blocks.web && block.getMaterial() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, block)) : 15.0F; + } ++ ++ ++ @Override ++ public boolean itemInteractionForEntity(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity) ++ { ++ if (entity.worldObj.isRemote) ++ { ++ return false; ++ } ++ if (entity instanceof net.minecraftforge.common.IShearable) ++ { ++ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)entity; ++ BlockPos pos = new BlockPos(entity.posX, entity.posY, entity.posZ); ++ if (target.isShearable(itemstack, entity.worldObj, pos)) ++ { ++ java.util.List drops = target.onSheared(itemstack, entity.worldObj, pos, ++ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.enchantment.Enchantment.fortune.effectId, itemstack)); ++ ++ java.util.Random rand = new java.util.Random(); ++ for(ItemStack stack : drops) ++ { ++ net.minecraft.entity.item.EntityItem ent = entity.entityDropItem(stack, 1.0F); ++ ent.motionY += rand.nextFloat() * 0.05F; ++ ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; ++ ent.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; ++ } ++ itemstack.damageItem(1, entity); ++ } ++ return true; ++ } ++ return false; ++ } ++ ++ @Override ++ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, net.minecraft.entity.player.EntityPlayer player) ++ { ++ if (player.worldObj.isRemote || player.capabilities.isCreativeMode) ++ { ++ return false; ++ } ++ Block block = player.worldObj.getBlockState(pos).getBlock(); ++ if (block instanceof net.minecraftforge.common.IShearable) ++ { ++ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)block; ++ if (target.isShearable(itemstack, player.worldObj, pos)) ++ { ++ java.util.List drops = target.onSheared(itemstack, player.worldObj, pos, ++ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.enchantment.Enchantment.fortune.effectId, itemstack)); ++ java.util.Random rand = new java.util.Random(); ++ ++ for(ItemStack stack : drops) ++ { ++ float f = 0.7F; ++ double d = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; ++ double d1 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; ++ double d2 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; ++ net.minecraft.entity.item.EntityItem entityitem = new net.minecraft.entity.item.EntityItem(player.worldObj, (double)pos.getX() + d, (double)pos.getY() + d1, (double)pos.getZ() + d2, stack); ++ entityitem.setDefaultPickupDelay(); ++ player.worldObj.spawnEntityInWorld(entityitem); ++ } ++ ++ itemstack.damageItem(1, player); ++ player.addStat(net.minecraft.stats.StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); ++ } ++ } ++ return false; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch new file mode 100644 index 0000000000..4e8acb4a5a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSkull.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSkull.java +@@ -34,6 +34,11 @@ + + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { ++ if (worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && side != EnumFacing.DOWN) ++ { ++ side = EnumFacing.UP; ++ pos = pos.down(); ++ } + if (side == EnumFacing.DOWN) + { + return false; +@@ -46,7 +51,7 @@ + + if (!flag) + { +- if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid()) ++ if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid() && !worldIn.isSideSolid(pos, side, true)) + { + return false; + } +@@ -66,6 +71,7 @@ + { + if (!worldIn.isRemote) + { ++ if (!Blocks.skull.canPlaceBlockOnSide(worldIn, pos, side)) return false; + worldIn.setBlockState(pos, Blocks.skull.getDefaultState().withProperty(BlockSkull.FACING, side), 3); + int i = 0; + diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch new file mode 100644 index 0000000000..3d986ba7ba --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSnow.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSnow.java +@@ -67,4 +67,10 @@ + { + return damage; + } ++ ++ public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) ++ { ++ IBlockState state = world.getBlockState(pos); ++ return (state.getBlock() != net.minecraft.init.Blocks.snow_layer || ((Integer)state.getValue(BlockSnow.LAYERS)) > 7) ? super.canPlaceBlockOnSide(world, pos, side, player, stack) : true; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch new file mode 100644 index 0000000000..0414b92f39 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch @@ -0,0 +1,237 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemStack.java ++++ ../src-work/minecraft/net/minecraft/item/ItemStack.java +@@ -35,7 +35,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public final class ItemStack ++public final class ItemStack implements net.minecraftforge.common.capabilities.ICapabilitySerializable + { + public static final DecimalFormat DECIMALFORMAT = new DecimalFormat("#.###"); + public int stackSize; +@@ -49,6 +49,10 @@ + private Block canPlaceOnCacheBlock; + private boolean canPlaceOnCacheResult; + ++ private net.minecraftforge.fml.common.registry.RegistryDelegate delegate; ++ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities; ++ private NBTTagCompound capNBT; ++ + public ItemStack(Block blockIn) + { + this((Block)blockIn, 1); +@@ -74,13 +78,15 @@ + this((Item)itemIn, amount, 0); + } + +- public ItemStack(Item itemIn, int amount, int meta) ++ public ItemStack(Item itemIn, int amount, int meta) { this (itemIn, amount, meta, null); } ++ public ItemStack(Item itemIn, int amount, int meta, NBTTagCompound capNBT) + { ++ this.capNBT = capNBT; + this.canDestroyCacheBlock = null; + this.canDestroyCacheResult = false; + this.canPlaceOnCacheBlock = null; + this.canPlaceOnCacheResult = false; +- this.item = itemIn; ++ this.setItem(itemIn); + this.stackSize = amount; + this.itemDamage = meta; + +@@ -107,7 +113,7 @@ + + public ItemStack splitStack(int amount) + { +- ItemStack itemstack = new ItemStack(this.item, amount, this.itemDamage); ++ ItemStack itemstack = new ItemStack(this.item, amount, this.itemDamage, this.capabilities != null ? this.capabilities.serializeNBT() : null); + + if (this.stackTagCompound != null) + { +@@ -120,11 +126,12 @@ + + public Item getItem() + { +- return this.item; ++ return this.delegate != null ? this.delegate.get() : null; + } + + public boolean onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { ++ if (!worldIn.isRemote) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); + boolean flag = this.getItem().onItemUse(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); + + if (flag) +@@ -162,19 +169,23 @@ + nbt.setTag("tag", this.stackTagCompound); + } + ++ if (this.capabilities != null) nbt.setTag("ForgeCaps", this.capabilities.serializeNBT()); ++ + return nbt; + } + + public void readFromNBT(NBTTagCompound nbt) + { ++ this.capNBT = nbt.hasKey("ForgeCaps") ? nbt.getCompoundTag("ForgeCaps") : null; + if (nbt.hasKey("id", 8)) + { +- this.item = Item.getByNameOrId(nbt.getString("id")); ++ this.setItem(Item.getByNameOrId(nbt.getString("id"))); + } + else + { +- this.item = Item.getItemById(nbt.getShort("id")); ++ this.setItem(Item.getItemById(nbt.getShort("id"))); + } ++ this.capNBT = null; + + this.stackSize = nbt.getByte("Count"); + this.itemDamage = nbt.getShort("Damage"); +@@ -197,7 +208,7 @@ + + public int getMaxStackSize() + { +- return this.getItem().getItemStackLimit(); ++ return this.getItem().getItemStackLimit(this); + } + + public boolean isStackable() +@@ -207,7 +218,7 @@ + + public boolean isItemStackDamageable() + { +- return this.item == null ? false : (this.item.getMaxDamage() <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable")); ++ return this.item == null ? false : (this.item.getMaxDamage(this) <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable")); + } + + public boolean getHasSubtypes() +@@ -217,32 +228,27 @@ + + public boolean isItemDamaged() + { +- return this.isItemStackDamageable() && this.itemDamage > 0; ++ return this.isItemStackDamageable() && getItem().isDamaged(this); + } + + public int getItemDamage() + { +- return this.itemDamage; ++ return getItem().getDamage(this); + } + + public int getMetadata() + { +- return this.itemDamage; ++ return getItem().getMetadata(this); + } + + public void setItemDamage(int meta) + { +- this.itemDamage = meta; +- +- if (this.itemDamage < 0) +- { +- this.itemDamage = 0; +- } ++ getItem().setDamage(this, meta); + } + + public int getMaxDamage() + { +- return this.item.getMaxDamage(); ++ return this.item.getMaxDamage(this); + } + + public boolean attemptDamageItem(int amount, Random rand) +@@ -274,8 +280,8 @@ + } + } + +- this.itemDamage += amount; +- return this.itemDamage > this.getMaxDamage(); ++ setItemDamage(getItemDamage() + amount); //Redirect through Item's callback if applicable. ++ return getItemDamage() > getMaxDamage(); + } + } + +@@ -334,7 +340,7 @@ + + public boolean canHarvestBlock(Block blockIn) + { +- return this.item.canHarvestBlock(blockIn); ++ return getItem().canHarvestBlock(blockIn, this); + } + + public boolean interactWithEntity(EntityPlayer playerIn, EntityLivingBase entityIn) +@@ -344,7 +350,7 @@ + + public ItemStack copy() + { +- ItemStack itemstack = new ItemStack(this.item, this.stackSize, this.itemDamage); ++ ItemStack itemstack = new ItemStack(this.item, this.stackSize, this.itemDamage, this.capabilities != null ? this.capabilities.serializeNBT() : null); + + if (this.stackTagCompound != null) + { +@@ -742,6 +748,7 @@ + } + } + ++ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, playerIn, list, advanced); + return list; + } + +@@ -852,7 +859,7 @@ + } + else + { +- multimap = this.getItem().getItemAttributeModifiers(); ++ multimap = this.getItem().getAttributeModifiers(this); + } + + return multimap; +@@ -860,6 +867,18 @@ + + public void setItem(Item newItem) + { ++ if (newItem == this.item && item != null && this.capabilities != null) //Item Didn't change but refreshed ++ { ++ net.minecraftforge.common.capabilities.ICapabilityProvider parent = item.initCapabilities(this, this.capabilities.serializeNBT()); ++ this.capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(item, this, parent); ++ } ++ else if (newItem != this.item && newItem != null) // Item Changed ++ { ++ net.minecraftforge.common.capabilities.ICapabilityProvider parent = newItem.initCapabilities(this, this.capNBT); ++ this.capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(newItem, this, parent); ++ } ++ if (this.capNBT != null && this.capabilities != null) this.capabilities.deserializeNBT(this.capNBT); ++ this.delegate = newItem != null ? newItem.delegate : null; + this.item = newItem; + } + +@@ -946,4 +965,26 @@ + return false; + } + } ++ ++ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ return this.capabilities == null ? false : this.capabilities.hasCapability(capability, facing); ++ } ++ ++ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ return this.capabilities == null ? null : this.capabilities.getCapability(capability, facing); ++ } ++ ++ public void deserializeNBT(NBTTagCompound nbt) ++ { ++ this.readFromNBT(nbt); ++ } ++ ++ public NBTTagCompound serializeNBT() ++ { ++ NBTTagCompound ret = new NBTTagCompound(); ++ this.writeToNBT(ret); ++ return ret; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch new file mode 100644 index 0000000000..3b7d5e0e08 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSword.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSword.java +@@ -101,7 +101,9 @@ + + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) + { +- return this.material.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); ++ ItemStack mat = this.material.getRepairItemStack(); ++ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, repair, false)) return true; ++ return super.getIsRepairable(toRepair, repair); + } + + public Multimap getItemAttributeModifiers() diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch new file mode 100644 index 0000000000..cb93922328 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch @@ -0,0 +1,71 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemTool.java ++++ ../src-work/minecraft/net/minecraft/item/ItemTool.java +@@ -28,6 +28,18 @@ + this.efficiencyOnProperMaterial = material.getEfficiencyOnProperMaterial(); + this.damageVsEntity = attackDamage + material.getDamageVsEntity(); + this.setCreativeTab(CreativeTabs.tabTools); ++ if (this instanceof ItemPickaxe) ++ { ++ toolClass = "pickaxe"; ++ } ++ else if (this instanceof ItemAxe) ++ { ++ toolClass = "axe"; ++ } ++ else if (this instanceof ItemSpade) ++ { ++ toolClass = "shovel"; ++ } + } + + public float getStrVsBlock(ItemStack stack, Block block) +@@ -74,7 +86,9 @@ + + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) + { +- return this.toolMaterial.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); ++ ItemStack mat = this.toolMaterial.getRepairItemStack(); ++ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, repair, false)) return true; ++ return super.getIsRepairable(toRepair, repair); + } + + public Multimap getItemAttributeModifiers() +@@ -83,4 +97,38 @@ + multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Tool modifier", (double)this.damageVsEntity, 0)); + return multimap; + } ++ ++ /*===================================== FORGE START =================================*/ ++ private String toolClass; ++ @Override ++ public int getHarvestLevel(ItemStack stack, String toolClass) ++ { ++ int level = super.getHarvestLevel(stack, toolClass); ++ if (level == -1 && toolClass != null && toolClass.equals(this.toolClass)) ++ { ++ return this.toolMaterial.getHarvestLevel(); ++ } ++ else ++ { ++ return level; ++ } ++ } ++ ++ @Override ++ public Set getToolClasses(ItemStack stack) ++ { ++ return toolClass != null ? com.google.common.collect.ImmutableSet.of(toolClass) : super.getToolClasses(stack); ++ } ++ ++ @Override ++ public float getDigSpeed(ItemStack stack, net.minecraft.block.state.IBlockState state) ++ { ++ for (String type : getToolClasses(stack)) ++ { ++ if (state.getBlock().isToolEffective(type, state)) ++ return efficiencyOnProperMaterial; ++ } ++ return super.getDigSpeed(stack, state); ++ } ++ /*===================================== FORGE END =================================*/ + } diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch new file mode 100644 index 0000000000..7275586224 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java +@@ -72,6 +72,7 @@ + + public void addSmeltingRecipe(ItemStack input, ItemStack stack, float experience) + { ++ if (getSmeltingResult(input) != null) { net.minecraftforge.fml.common.FMLLog.info("Ignored smelting recipe with conflicting input: " + input + " = " + stack); return; } + this.smeltingList.put(input, stack); + this.experienceList.put(stack, Float.valueOf(experience)); + } +@@ -101,6 +102,9 @@ + + public float getSmeltingExperience(ItemStack stack) + { ++ float ret = stack.getItem().getSmeltingExperience(stack); ++ if (ret != -1) return ret; ++ + for (Entry entry : this.experienceList.entrySet()) + { + if (this.compareItemStacks(stack, (ItemStack)entry.getKey())) diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch new file mode 100644 index 0000000000..359c3119c9 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipeFireworks.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeFireworks.java +@@ -86,9 +86,9 @@ + { + this.field_92102_a = new ItemStack(Items.fireworks); + ++ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + if (l > 0) + { +- NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + NBTTagCompound nbttagcompound3 = new NBTTagCompound(); + NBTTagList nbttaglist = new NBTTagList(); + +@@ -105,9 +105,9 @@ + nbttagcompound3.setTag("Explosions", nbttaglist); + nbttagcompound3.setByte("Flight", (byte)j); + nbttagcompound1.setTag("Fireworks", nbttagcompound3); +- this.field_92102_a.setTagCompound(nbttagcompound1); + } + ++ this.field_92102_a.setTagCompound(nbttagcompound1); //Forge BugFix: NPE Protection + return true; + } + else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1) +@@ -249,11 +249,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); +- +- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch new file mode 100644 index 0000000000..b3ad23a686 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java +@@ -25,7 +25,7 @@ + { + ItemStack itemstack1 = (ItemStack)list.get(0); + +- if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable()) ++ if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isRepairable()) + { + return false; + } +@@ -52,7 +52,7 @@ + { + ItemStack itemstack1 = (ItemStack)list.get(0); + +- if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable()) ++ if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isRepairable()) + { + return null; + } +@@ -65,7 +65,7 @@ + ItemStack itemstack2 = (ItemStack)list.get(0); + ItemStack itemstack3 = (ItemStack)list.get(1); + +- if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isDamageable()) ++ if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isRepairable()) + { + Item item = itemstack2.getItem(); + int j = item.getMaxDamage() - itemstack2.getItemDamage(); +@@ -102,11 +102,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); +- +- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch new file mode 100644 index 0000000000..799b450b6f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java +@@ -146,11 +146,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); +- +- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch new file mode 100644 index 0000000000..2deece9748 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipesBanners.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesBanners.java +@@ -135,11 +135,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); +- +- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; +@@ -356,9 +352,9 @@ + + if (itemstack != null) + { +- if (itemstack.getItem().hasContainerItem()) ++ if (itemstack.getItem().hasContainerItem(itemstack)) + { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0) + { diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch new file mode 100644 index 0000000000..9cf0ab1975 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java +@@ -108,11 +108,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); +- +- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch new file mode 100644 index 0000000000..d6265c91ae --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/ShapedRecipes.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/ShapedRecipes.java +@@ -33,11 +33,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); +- +- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch new file mode 100644 index 0000000000..2241e26998 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java +@@ -29,11 +29,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); +- +- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch new file mode 100644 index 0000000000..76f2e67396 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch @@ -0,0 +1,53 @@ +--- ../src-base/minecraft/net/minecraft/nbt/CompressedStreamTools.java ++++ ../src-work/minecraft/net/minecraft/nbt/CompressedStreamTools.java +@@ -17,8 +17,6 @@ + import net.minecraft.crash.CrashReport; + import net.minecraft.crash.CrashReportCategory; + import net.minecraft.util.ReportedException; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + + public class CompressedStreamTools + { +@@ -53,7 +51,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + public static void safeWrite(NBTTagCompound p_74793_0_, File p_74793_1_) throws IOException + { + File file1 = new File(p_74793_1_.getAbsolutePath() + "_tmp"); +@@ -118,6 +115,7 @@ + private static NBTBase func_152455_a(DataInput p_152455_0_, int p_152455_1_, NBTSizeTracker p_152455_2_) throws IOException + { + byte b0 = p_152455_0_.readByte(); ++ p_152455_2_.read(8); // Forge: Count everything! + + if (b0 == 0) + { +@@ -125,7 +123,8 @@ + } + else + { +- p_152455_0_.readUTF(); ++ NBTSizeTracker.readUTF(p_152455_2_, p_152455_0_.readUTF()); //Forge: Count this string. ++ p_152455_2_.read(32); //Forge: 4 extra bytes for the object allocation. + NBTBase nbtbase = NBTBase.createNewByType(b0); + + try +@@ -144,7 +143,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + public static void write(NBTTagCompound p_74795_0_, File p_74795_1_) throws IOException + { + DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(p_74795_1_)); +@@ -159,7 +157,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + public static NBTTagCompound read(File p_74797_0_) throws IOException + { + if (!p_74797_0_.exists()) diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch new file mode 100644 index 0000000000..078cb5b16d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/nbt/NBTSizeTracker.java ++++ ../src-work/minecraft/net/minecraft/nbt/NBTSizeTracker.java +@@ -25,4 +25,34 @@ + throw new RuntimeException("Tried to read NBT tag that was too big; tried to allocate: " + this.read + "bytes where max allowed: " + this.max); + } + } ++ ++ /* ++ * UTF8 is not a simple encoding system, each character can be either ++ * 1, 2, or 3 bytes. Depending on where it's numerical value falls. ++ * We have to count up each character individually to see the true ++ * length of the data. ++ * ++ * Basic concept is that it uses the MSB of each byte as a 'read more' signal. ++ * So it has to shift each 7-bit segment. ++ * ++ * This will accurately count the correct byte length to encode this string, plus the 2 bytes for it's length prefix. ++ */ ++ public static void readUTF(NBTSizeTracker tracker, String data) ++ { ++ tracker.read(16); //Header length ++ if (data == null) ++ return; ++ ++ int len = data.length(); ++ int utflen = 0; ++ ++ for (int i = 0; i < len; i++) ++ { ++ int c = data.charAt(i); ++ if ((c >= 0x0001) && (c <= 0x007F)) utflen += 1; ++ else if (c > 0x07FF) utflen += 3; ++ else utflen += 2; ++ } ++ tracker.read(8 * utflen); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch new file mode 100644 index 0000000000..a5014d15a5 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/nbt/NBTTagCompound.java ++++ ../src-work/minecraft/net/minecraft/nbt/NBTTagCompound.java +@@ -395,6 +395,7 @@ + + private static byte readType(DataInput input, NBTSizeTracker sizeTracker) throws IOException + { ++ sizeTracker.read(8); + return input.readByte(); + } + +@@ -405,6 +406,7 @@ + + static NBTBase readNBT(byte id, String key, DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { ++ sizeTracker.read(32); //Forge: 4 extra bytes for the object allocation. + NBTBase nbtbase = NBTBase.createNewByType(id); + + try diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch new file mode 100644 index 0000000000..c8ca6ca1aa --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/nbt/NBTTagString.java ++++ ../src-work/minecraft/net/minecraft/nbt/NBTTagString.java +@@ -32,7 +32,7 @@ + { + sizeTracker.read(288L); + this.data = input.readUTF(); +- sizeTracker.read((long)(16 * this.data.length())); ++ NBTSizeTracker.readUTF(sizeTracker, data); // Forge: Correctly read String length including header. + } + + public byte getId() diff --git a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch new file mode 100644 index 0000000000..91465a327f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -0,0 +1,133 @@ +--- ../src-base/minecraft/net/minecraft/network/NetHandlerPlayServer.java ++++ ../src-work/minecraft/net/minecraft/network/NetHandlerPlayServer.java +@@ -254,6 +254,8 @@ + this.playerEntity.ridingEntity.updateRiderPosition(); + } + ++ if (!this.hasMoved) return; //Fixes teleportation kick while riding entities ++ + this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); + + if (this.playerEntity.ridingEntity != null) +@@ -350,6 +352,8 @@ + this.playerEntity.jump(); + } + ++ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving ++ + this.playerEntity.moveEntity(d11, d12, d13); + this.playerEntity.onGround = packetIn.isOnGround(); + d11 = d8 - this.playerEntity.posX; +@@ -370,6 +374,8 @@ + logger.warn(this.playerEntity.getName() + " moved wrongly!"); + } + ++ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving ++ + this.playerEntity.setPositionAndRotation(d8, d9, d10, f1, f2); + this.playerEntity.addMovementStat(this.playerEntity.posX - d0, this.playerEntity.posY - d1, this.playerEntity.posZ - d2); + +@@ -377,7 +383,7 @@ + { + boolean flag2 = worldserver.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.getEntityBoundingBox().contract((double)f3, (double)f3, (double)f3)).isEmpty(); + +- if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping()) ++ if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping() && !this.playerEntity.noClip) + { + this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, f1, f2); + return; +@@ -405,6 +411,8 @@ + this.floatingTickCount = 0; + } + ++ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving ++ + this.playerEntity.onGround = packetIn.isOnGround(); + this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); + this.playerEntity.handleFalling(this.playerEntity.posY - d7, packetIn.isOnGround()); +@@ -497,7 +505,10 @@ + double d2 = this.playerEntity.posZ - ((double)blockpos.getZ() + 0.5D); + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + +- if (d3 > 36.0D) ++ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1; ++ dist *= dist; ++ ++ if (d3 > dist) + { + return; + } +@@ -549,6 +560,7 @@ + WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); + ItemStack itemstack = this.playerEntity.inventory.getCurrentItem(); + boolean flag = false; ++ boolean placeResult = true; + BlockPos blockpos = packetIn.getPosition(); + EnumFacing enumfacing = EnumFacing.getFront(packetIn.getPlacedBlockDirection()); + this.playerEntity.markPlayerActive(); +@@ -560,13 +572,20 @@ + return; + } + ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(playerEntity, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, worldserver, new BlockPos(0, 0, 0), null, new net.minecraft.util.Vec3(packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ())); ++ if (event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { + this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack); ++ } + } + else if (blockpos.getY() < this.serverController.getBuildLimit() - 1 || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit()) + { +- if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < 64.0D && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) ++ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 3; ++ dist *= dist; ++ if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < dist && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) + { +- this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); ++ // record block place result so we can update client itemstack size if place event was cancelled. ++ placeResult = this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); + } + + flag = true; +@@ -598,12 +617,18 @@ + this.playerEntity.isChangingQuantityOnly = true; + this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = ItemStack.copyItemStack(this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem]); + Slot slot = this.playerEntity.openContainer.getSlotFromInventory(this.playerEntity.inventory, this.playerEntity.inventory.currentItem); ++ int windowId = this.playerEntity.openContainer.windowId; ++ if (slot == null) // Forge: Fix 'slotless' inventories not selecting a valid slot to update ++ { ++ slot = this.playerEntity.inventoryContainer.getSlotFromInventory(this.playerEntity.inventory, this.playerEntity.inventory.currentItem); ++ windowId = this.playerEntity.inventoryContainer.windowId; ++ } + this.playerEntity.openContainer.detectAndSendChanges(); + this.playerEntity.isChangingQuantityOnly = false; + +- if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack())) ++ if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack()) || !placeResult) // force client itemstack update if place event was cancelled + { +- this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); ++ this.sendPacket(new S2FPacketSetSlot(windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); + } + } + } +@@ -770,8 +795,10 @@ + } + else + { +- IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.text", new Object[] {this.playerEntity.getDisplayName(), s}); +- this.serverController.getConfigurationManager().sendChatMsgImpl(ichatcomponent, false); ++ ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", this.playerEntity.getDisplayName(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s)); ++ IChatComponent chat = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, chatcomponenttranslation1); ++ if (chat == null) return; ++ this.serverController.getConfigurationManager().sendChatMsgImpl(chat, false); + } + + this.chatSpamThresholdCount += 20; +@@ -916,7 +943,7 @@ + return; + } + +- this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, 0, false); ++ this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, playerEntity.dimension, false); + } + + break; diff --git a/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch new file mode 100644 index 0000000000..6578510e08 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch @@ -0,0 +1,53 @@ +--- ../src-base/minecraft/net/minecraft/network/NetworkManager.java ++++ ../src-work/minecraft/net/minecraft/network/NetworkManager.java +@@ -93,6 +93,11 @@ + this.direction = packetDirection; + } + ++ public EnumPacketDirection getDirection() ++ { ++ return this.direction; ++ } ++ + public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception + { + super.channelActive(p_channelActive_1_); +@@ -208,7 +213,7 @@ + final EnumConnectionState enumconnectionstate = EnumConnectionState.getFromPacket(inPacket); + final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.channel.attr(attrKeyConnectionState).get(); + +- if (enumconnectionstate1 != enumconnectionstate) ++ if (enumconnectionstate1 != enumconnectionstate && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) + { + logger.debug("Disabled auto read"); + this.channel.config().setAutoRead(false); +@@ -216,7 +221,7 @@ + + if (this.channel.eventLoop().inEventLoop()) + { +- if (enumconnectionstate != enumconnectionstate1) ++ if (enumconnectionstate != enumconnectionstate1 && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) + { + this.setConnectionState(enumconnectionstate); + } +@@ -236,7 +241,7 @@ + { + public void run() + { +- if (enumconnectionstate != enumconnectionstate1) ++ if (enumconnectionstate != enumconnectionstate1 && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) + { + NetworkManager.this.setConnectionState(enumconnectionstate); + } +@@ -455,6 +460,11 @@ + } + } + ++ public Channel channel() ++ { ++ return channel; ++ } ++ + static class InboundHandlerTuplePacketListener + { + private final Packet packet; diff --git a/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch new file mode 100644 index 0000000000..218327728f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/network/NetworkSystem.java ++++ ../src-work/minecraft/net/minecraft/network/NetworkSystem.java +@@ -115,7 +115,7 @@ + ; + } + +- p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND))); ++ p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND))); + NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); + NetworkSystem.this.networkManagers.add(networkmanager); + p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager); diff --git a/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch b/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch new file mode 100644 index 0000000000..b46a1356ff --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch @@ -0,0 +1,88 @@ +--- ../src-base/minecraft/net/minecraft/network/ServerStatusResponse.java ++++ ../src-work/minecraft/net/minecraft/network/ServerStatusResponse.java +@@ -29,6 +29,7 @@ + public void setServerDescription(IChatComponent motd) + { + this.serverMotd = motd; ++ invalidateJson(); + } + + public ServerStatusResponse.PlayerCountData getPlayerCountData() +@@ -39,6 +40,7 @@ + public void setPlayerCountData(ServerStatusResponse.PlayerCountData countData) + { + this.playerCount = countData; ++ invalidateJson(); + } + + public ServerStatusResponse.MinecraftProtocolVersionIdentifier getProtocolVersionInfo() +@@ -49,11 +51,13 @@ + public void setProtocolVersionInfo(ServerStatusResponse.MinecraftProtocolVersionIdentifier protocolVersionData) + { + this.protocolVersion = protocolVersionData; ++ invalidateJson(); + } + + public void setFavicon(String faviconBlob) + { + this.favicon = faviconBlob; ++ invalidateJson(); + } + + public String getFavicon() +@@ -215,6 +219,7 @@ + serverstatusresponse.setFavicon(JsonUtils.getString(jsonobject, "favicon")); + } + ++ net.minecraftforge.fml.client.FMLClientHandler.instance().captureAdditionalData(serverstatusresponse, jsonobject); + return serverstatusresponse; + } + +@@ -242,7 +247,47 @@ + jsonobject.addProperty("favicon", p_serialize_1_.getFavicon()); + } + ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.enhanceStatusQuery(jsonobject); + return jsonobject; + } + } ++ ++ private java.util.concurrent.Semaphore mutex = new java.util.concurrent.Semaphore(1); ++ private String json = null; ++ /** ++ * Returns this object as a Json string. ++ * Converting to JSON if a cached version is not available. ++ * ++ * Also to prevent potentially large memory allocations on the server ++ * this is moved from the S00PacketServerInfo writePacket function ++ * ++ * As this method is called from the network threads thread safety is important! ++ * ++ * @return ++ */ ++ public String getJson() ++ { ++ String ret = this.json; ++ if (ret == null) ++ { ++ mutex.acquireUninterruptibly(); ++ ret = this.json; ++ if (ret == null) ++ { ++ ret = net.minecraft.network.status.server.S00PacketServerInfo.GSON.toJson(this); ++ this.json = ret; ++ } ++ mutex.release(); ++ } ++ return ret; ++ } ++ ++ /** ++ * Invalidates the cached json, causing the next call to getJson to rebuild it. ++ * This is needed externally because PlayerCountData.setPlayer's is public. ++ */ ++ public void invalidateJson() ++ { ++ this.json = null; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch b/patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch new file mode 100644 index 0000000000..dbeee89f60 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch @@ -0,0 +1,48 @@ +--- ../src-base/minecraft/net/minecraft/network/handshake/client/C00Handshake.java ++++ ../src-work/minecraft/net/minecraft/network/handshake/client/C00Handshake.java +@@ -14,6 +14,7 @@ + private String ip; + private int port; + private EnumConnectionState requestedState; ++ private boolean hasFMLMarker = false; + + public C00Handshake() + { +@@ -28,18 +29,26 @@ + this.requestedState = requestedState; + } + ++ public C00Handshake(int protocol, String address, int port, EnumConnectionState state, boolean addFMLMarker) ++ { ++ this(protocol, address, port, state); ++ this.hasFMLMarker = addFMLMarker; ++ } ++ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.protocolVersion = buf.readVarIntFromBuffer(); + this.ip = buf.readStringFromBuffer(255); + this.port = buf.readUnsignedShort(); + this.requestedState = EnumConnectionState.getById(buf.readVarIntFromBuffer()); ++ this.hasFMLMarker = this.ip.contains("\0FML\0"); ++ this.ip = this.ip.split("\0")[0]; + } + + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.protocolVersion); +- buf.writeString(this.ip); ++ buf.writeString(this.ip + "\0FML\0"); + buf.writeShort(this.port); + buf.writeVarIntToBuffer(this.requestedState.getId()); + } +@@ -58,4 +67,9 @@ + { + return this.protocolVersion; + } ++ ++ public boolean hasFMLMarker() ++ { ++ return this.hasFMLMarker; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch b/patches.mcp/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch new file mode 100644 index 0000000000..331306c787 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java ++++ ../src-work/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java +@@ -47,7 +47,11 @@ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.channel); ++ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. ++ this.data.markReaderIndex(); + buf.writeBytes((ByteBuf)this.data); ++ this.data.resetReaderIndex(); ++ } + } + + public void processPacket(INetHandlerPlayServer handler) diff --git a/patches.mcp/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch b/patches.mcp/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch new file mode 100644 index 0000000000..8218d2cac5 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java ++++ ../src-work/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java +@@ -46,7 +46,11 @@ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.channel); ++ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. ++ this.data.markReaderIndex(); + buf.writeBytes((ByteBuf)this.data); ++ this.data.resetReaderIndex(); ++ } + } + + public void processPacket(INetHandlerPlayClient handler) diff --git a/patches.mcp/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch b/patches.mcp/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch new file mode 100644 index 0000000000..086221d574 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java ++++ ../src-work/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java +@@ -34,7 +34,7 @@ + + public void writePacketData(PacketBuffer buf) throws IOException + { +- buf.writeString(GSON.toJson((Object)this.response)); ++ buf.writeString(this.response.getJson()); + } + + public void processPacket(INetHandlerStatusClient handler) diff --git a/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch b/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch new file mode 100644 index 0000000000..ed45cdb843 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch @@ -0,0 +1,88 @@ +--- ../src-base/minecraft/net/minecraft/potion/Potion.java ++++ ../src-work/minecraft/net/minecraft/potion/Potion.java +@@ -21,7 +21,7 @@ + + public class Potion + { +- public static final Potion[] potionTypes = new Potion[32]; ++ public static final Potion[] potionTypes = new Potion[256]; + private static final Map field_180150_I = Maps.newHashMap(); + public static final Potion field_180151_b = null; + public static final Potion moveSpeed = (new Potion(1, new ResourceLocation("speed"), false, 8171462)).setPotionName("potion.moveSpeed").setIconIndex(0, 0).registerPotionAttributeModifier(SharedMonsterAttributes.movementSpeed, "91AEAA56-376B-4498-935B-2F7F68070635", 0.20000000298023224D, 2); +@@ -64,10 +64,10 @@ + private double effectiveness; + private boolean usable; + ++ @Deprecated // use the Constructor without potion ID or everything will explode. + protected Potion(int potionID, ResourceLocation location, boolean badEffect, int potionColor) + { +- this.id = potionID; +- potionTypes[potionID] = this; ++ net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().register(potionID, location, this); + field_180150_I.put(location, this); + this.isBadEffect = badEffect; + +@@ -83,14 +83,18 @@ + this.liquidColor = potionColor; + } + ++ protected Potion(ResourceLocation location, boolean badEffect, int potionColor) { ++ this(-1, location, badEffect, potionColor); ++ } ++ + public static Potion getPotionFromResourceLocation(String location) + { +- return (Potion)field_180150_I.get(new ResourceLocation(location)); ++ return net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().getObject(new ResourceLocation(location)); + } + + public static Set getPotionLocations() + { +- return field_180150_I.keySet(); ++ return net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().getKeys(); + } + + protected Potion setIconIndex(int p_76399_1_, int p_76399_2_) +@@ -230,7 +234,6 @@ + return this.statusIconIndex; + } + +- @SideOnly(Side.CLIENT) + public boolean isBadEffect() + { + return this.isBadEffect; +@@ -310,4 +313,34 @@ + { + return modifier.getAmount() * (double)(p_111183_1_ + 1); + } ++ ++ /* ======================================== FORGE START =====================================*/ ++ ++ /** ++ * If the Potion effect should be displayed in the players inventory ++ * @param effect the active PotionEffect ++ * @return true to display it (default), false to hide it. ++ */ ++ public boolean shouldRender(PotionEffect effect) { return true; } ++ ++ /** ++ * If the standard PotionEffect text (name and duration) should be drawn when this potion is active. ++ * @param effect the active PotionEffect ++ * @return true to draw the standard text ++ */ ++ public boolean shouldRenderInvText(PotionEffect effect) ++ { ++ return true; ++ } ++ ++ /** ++ * Called to draw the this Potion onto the player's inventory when it's active. ++ * This can be used to e.g. render Potion icons from your own texture. ++ * @param x the x coordinate ++ * @param y the y coordinate ++ * @param effect the active PotionEffect ++ * @param mc the Minecraft instance, for convenience ++ */ ++ @SideOnly(Side.CLIENT) ++ public void renderInventoryEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc) { } + } diff --git a/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch new file mode 100644 index 0000000000..9ba184d035 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch @@ -0,0 +1,91 @@ +--- ../src-base/minecraft/net/minecraft/potion/PotionEffect.java ++++ ../src-work/minecraft/net/minecraft/potion/PotionEffect.java +@@ -18,6 +18,8 @@ + @SideOnly(Side.CLIENT) + private boolean isPotionDurationMax; + private boolean showParticles; ++ /** List of ItemStack that can cure the potion effect **/ ++ private java.util.List curativeItems; + + public PotionEffect(int id, int effectDuration) + { +@@ -36,6 +38,8 @@ + this.amplifier = effectAmplifier; + this.isAmbient = ambient; + this.showParticles = showParticles; ++ this.curativeItems = new java.util.ArrayList(); ++ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket)); + } + + public PotionEffect(PotionEffect other) +@@ -45,6 +49,7 @@ + this.amplifier = other.amplifier; + this.isAmbient = other.isAmbient; + this.showParticles = other.showParticles; ++ this.curativeItems = other.curativeItems; + } + + public void combine(PotionEffect other) +@@ -190,7 +195,7 @@ + + public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) + { +- int i = nbt.getByte("Id"); ++ int i = nbt.getByte("Id") & 0xff; + + if (i >= 0 && i < Potion.potionTypes.length && Potion.potionTypes[i] != null) + { +@@ -223,4 +228,53 @@ + { + return this.isPotionDurationMax; + } ++ ++ /* ======================================== FORGE START =====================================*/ ++ /*** ++ * Returns a list of curative items for the potion effect ++ * @return The list (ItemStack) of curative items for the potion effect ++ */ ++ public java.util.List getCurativeItems() ++ { ++ return this.curativeItems; ++ } ++ ++ /*** ++ * Checks the given ItemStack to see if it is in the list of curative items for the potion effect ++ * @param stack The ItemStack being checked against the list of curative items for the potion effect ++ * @return true if the given ItemStack is in the list of curative items for the potion effect, false otherwise ++ */ ++ public boolean isCurativeItem(net.minecraft.item.ItemStack stack) ++ { ++ for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) ++ { ++ if (curativeItem.isItemEqual(stack)) ++ { ++ return true; ++ } ++ } ++ ++ return false; ++ } ++ ++ /*** ++ * Sets the array of curative items for the potion effect ++ * @param curativeItems The list of ItemStacks being set to the potion effect ++ */ ++ public void setCurativeItems(java.util.List curativeItems) ++ { ++ this.curativeItems = curativeItems; ++ } ++ ++ /*** ++ * Adds the given stack to list of curative items for the potion effect ++ * @param stack The ItemStack being added to the curative item list ++ */ ++ public void addCurativeItem(net.minecraft.item.ItemStack stack) ++ { ++ if (!this.isCurativeItem(stack)) ++ { ++ this.curativeItems.add(stack); ++ } ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch b/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch new file mode 100644 index 0000000000..2aab40a377 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/realms/RealmsConnect.java ++++ ../src-work/minecraft/net/minecraft/realms/RealmsConnect.java +@@ -38,6 +38,7 @@ + + try + { ++ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToRealmsServer(p_connect_1_, p_connect_2_); + inetaddress = InetAddress.getByName(p_connect_1_); + + if (RealmsConnect.this.aborted) +@@ -59,7 +60,7 @@ + return; + } + +- RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); ++ RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true)); + + if (RealmsConnect.this.aborted) + { diff --git a/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch new file mode 100644 index 0000000000..8fe34998e9 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -0,0 +1,289 @@ +--- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java ++++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java +@@ -98,7 +98,7 @@ + @SideOnly(Side.SERVER) + private String hostname; + private int serverPort = -1; +- public WorldServer[] worldServers; ++ public WorldServer[] worldServers = new WorldServer[0]; + private ServerConfigurationManager serverConfigManager; + private boolean serverRunning = true; + private boolean serverStopped; +@@ -115,7 +115,8 @@ + private int buildLimit; + private int maxPlayerIdleMinutes = 0; + public final long[] tickTimeArray = new long[100]; +- public long[][] timeOfLastDimensionTick; ++ //public long[][] timeOfLastDimensionTick; ++ public java.util.Hashtable worldTickTimes = new java.util.Hashtable(); + private KeyPair serverKeyPair; + private String serverOwner; + private String folderName; +@@ -227,8 +228,6 @@ + { + this.convertMapIfNeeded(p_71247_1_); + this.setUserMessage("menu.loadingLevel"); +- this.worldServers = new WorldServer[3]; +- this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; + ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true); + this.setResourcePackFromWorld(this.getFolderName(), isavehandler); + WorldInfo worldinfo = isavehandler.loadWorldInfo(); +@@ -259,47 +258,21 @@ + worldsettings = new WorldSettings(worldinfo); + } + +- for (int i = 0; i < this.worldServers.length; ++i) ++ WorldServer overWorld = (WorldServer)(isDemo() ? new DemoWorldServer(this, isavehandler, worldinfo, 0, theProfiler).init() : new WorldServer(this, isavehandler, worldinfo, 0, theProfiler).init()); ++ overWorld.initialize(worldsettings); ++ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) + { +- int j = 0; ++ WorldServer world = (dim == 0 ? overWorld : (WorldServer)new WorldServerMulti(this, isavehandler, dim, overWorld, theProfiler).init()); ++ world.addWorldAccess(new WorldManager(this, world)); + +- if (i == 1) +- { +- j = -1; +- } +- +- if (i == 2) +- { +- j = 1; +- } +- +- if (i == 0) +- { +- if (this.isDemo()) +- { +- this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- } +- else +- { +- this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- } +- +- this.worldServers[i].initialize(worldsettings); +- } +- else +- { +- this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); +- } +- +- this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); +- + if (!this.isSinglePlayer()) + { +- this.worldServers[i].getWorldInfo().setGameType(this.getGameType()); ++ world.getWorldInfo().setGameType(this.getGameType()); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); + } + +- this.serverConfigManager.setPlayerManager(this.worldServers); ++ this.serverConfigManager.setPlayerManager(new WorldServer[]{ overWorld }); + this.setDifficultyForAllWorlds(this.getDifficulty()); + this.initialWorldChunkLoad(); + } +@@ -314,7 +287,7 @@ + this.setUserMessage("menu.generatingTerrain"); + int j1 = 0; + logger.info("Preparing start region for level " + j1); +- WorldServer worldserver = this.worldServers[j1]; ++ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(j1); + BlockPos blockpos = worldserver.getSpawnPoint(); + long k1 = getCurrentTimeMillis(); + +@@ -403,7 +376,7 @@ + + public void stopServer() + { +- if (!this.worldIsBeingDeleted) ++ if (!this.worldIsBeingDeleted && net.minecraftforge.fml.common.Loader.instance().hasReachedState(net.minecraftforge.fml.common.LoaderState.SERVER_STARTED) && !serverStopped) // make sure the save is valid and we don't save twice + { + logger.info("Stopping server"); + +@@ -427,8 +400,15 @@ + for (int i = 0; i < this.worldServers.length; ++i) + { + WorldServer worldserver = this.worldServers[i]; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); + worldserver.flush(); + } ++ ++ WorldServer[] tmp = worldServers; ++ for (WorldServer world : tmp) ++ { ++ net.minecraftforge.common.DimensionManager.setWorld(world.provider.getDimensionId(), null); ++ } + } + + if (this.usageSnooper.isSnooperRunning()) +@@ -460,6 +440,7 @@ + { + if (this.startServer()) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarted(); + this.currentTime = getCurrentTimeMillis(); + long i = 0L; + this.statusResponse.setServerDescription(new ChatComponentText(this.motd)); +@@ -504,12 +485,20 @@ + Thread.sleep(Math.max(1L, 50L - i)); + this.serverIsRunning = true; + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopping(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions + } + else + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions + this.finalTick((CrashReport)null); + } + } ++ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) ++ { ++ // ignore silently ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions ++ } + catch (Throwable throwable1) + { + logger.error("Encountered an unexpected exception", throwable1); +@@ -535,14 +524,15 @@ + logger.error("We were unable to save this crash report to disk."); + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions + this.finalTick(crashreport); + } + finally + { + try + { +- this.serverStopped = true; + this.stopServer(); ++ this.serverStopped = true; + } + catch (Throwable throwable) + { +@@ -550,6 +540,8 @@ + } + finally + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopped(); ++ this.serverStopped = true; + this.systemExitNow(); + } + } +@@ -599,6 +591,7 @@ + public void tick() + { + long i = System.nanoTime(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreServerTick(); + ++this.tickCounter; + + if (this.startProfiling) +@@ -625,6 +618,7 @@ + + Collections.shuffle(Arrays.asList(agameprofile)); + this.statusResponse.getPlayerCountData().setPlayers(agameprofile); ++ this.statusResponse.invalidateJson(); + } + + if (this.tickCounter % 900 == 0) +@@ -652,6 +646,7 @@ + + this.theProfiler.endSection(); + this.theProfiler.endSection(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostServerTick(); + } + + public void updateTimeLightAndEntities() +@@ -667,14 +662,17 @@ + } + + this.theProfiler.endStartSection("levels"); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.tick(); + +- for (int j = 0; j < this.worldServers.length; ++j) ++ Integer[] ids = net.minecraftforge.common.DimensionManager.getIDs(this.tickCounter % 200 == 0); ++ for (int x = 0; x < ids.length; x++) + { ++ int id = ids[x]; + long i = System.nanoTime(); + +- if (j == 0 || this.getAllowNether()) ++ if (id == 0 || this.getAllowNether()) + { +- WorldServer worldserver = this.worldServers[j]; ++ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(id); + this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); + + if (this.tickCounter % 20 == 0) +@@ -685,6 +683,7 @@ + } + + this.theProfiler.startSection("tick"); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreWorldTick(worldserver); + + try + { +@@ -708,6 +707,7 @@ + throw new ReportedException(crashreport1); + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostWorldTick(worldserver); + this.theProfiler.endSection(); + this.theProfiler.startSection("tracker"); + worldserver.getEntityTracker().updateTrackedEntities(); +@@ -715,9 +715,11 @@ + this.theProfiler.endSection(); + } + +- this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i; ++ worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - i; + } + ++ this.theProfiler.endStartSection("dim_unloading"); ++ net.minecraftforge.common.DimensionManager.unloadWorlds(worldTickTimes); + this.theProfiler.endStartSection("connection"); + this.getNetworkSystem().networkTick(); + this.theProfiler.endStartSection("players"); +@@ -739,6 +741,7 @@ + + public void startServerThread() + { ++ net.minecraftforge.fml.common.StartupQuery.reset(); + this.serverThread = new Thread(this, "Server thread"); + this.serverThread.start(); + } +@@ -755,7 +758,13 @@ + + public WorldServer worldServerForDimension(int dimension) + { +- return dimension == -1 ? this.worldServers[1] : (dimension == 1 ? this.worldServers[2] : this.worldServers[0]); ++ WorldServer ret = net.minecraftforge.common.DimensionManager.getWorld(dimension); ++ if (ret == null) ++ { ++ net.minecraftforge.common.DimensionManager.initDimension(dimension); ++ ret = net.minecraftforge.common.DimensionManager.getWorld(dimension); ++ } ++ return ret; + } + + public String getMinecraftVersion() +@@ -785,7 +794,7 @@ + + public String getServerModName() + { +- return "vanilla"; ++ return net.minecraftforge.fml.common.FMLCommonHandler.instance().getModName(); + } + + public CrashReport addServerInfoToCrashReport(CrashReport report) +@@ -996,6 +1005,7 @@ + + if (worldserver != null) + { ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); + worldserver.flush(); + } + } diff --git a/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch new file mode 100644 index 0000000000..770752bbb7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -0,0 +1,60 @@ +--- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java ++++ ../src-work/minecraft/net/minecraft/server/dedicated/DedicatedServer.java +@@ -49,6 +49,7 @@ + private boolean canSpawnStructures; + private WorldSettings.GameType gameType; + private boolean guiIsEnabled; ++ public static boolean allowPlayerLogins = false; + + public DedicatedServer(File workDir) + { +@@ -82,6 +83,7 @@ + { + public void run() + { ++ if (net.minecraftforge.server.console.TerminalHandler.handleCommands(DedicatedServer.this)) return; + BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in)); + String s4; + +@@ -107,6 +109,8 @@ + logger.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStart(this); ++ + logger.info("Loading properties"); + this.settings = new PropertyManager(new File("server.properties")); + this.eula = new ServerEula(new File("eula.txt")); +@@ -198,6 +202,7 @@ + } + else + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStarted(); + this.setConfigManager(new DedicatedPlayerList(this)); + long j = System.nanoTime(); + +@@ -244,6 +249,7 @@ + this.setBuildLimit((this.getBuildLimit() + 8) / 16 * 16); + this.setBuildLimit(MathHelper.clamp_int(this.getBuildLimit(), 64, 256)); + this.settings.setProperty("max-build-height", Integer.valueOf(this.getBuildLimit())); ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; + logger.info("Preparing level \"" + this.getFolderName() + "\""); + this.loadAllWorlds(this.getFolderName(), this.getFolderName(), k, worldtype, s2); + long i1 = System.nanoTime() - j; +@@ -272,7 +278,7 @@ + thread1.start(); + } + +- return true; ++ return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this); + } + } + } +@@ -621,4 +627,7 @@ + this.commandManager.executeCommand(RConConsoleSource.getInstance(), command); + return RConConsoleSource.getInstance().getLogContents(); + } ++ ++ //Forge: Enable formated text for colors in console. ++ @Override public void addChatMessage(net.minecraft.util.IChatComponent message) { logger.info(message.getFormattedText()); } + } diff --git a/patches.mcp/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch b/patches.mcp/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch new file mode 100644 index 0000000000..10a8b960a9 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java ++++ ../src-work/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java +@@ -22,6 +22,7 @@ + private static final Logger LOGGER = LogManager.getLogger(); + private final DedicatedServer server; + private final long maxTickTime; ++ private boolean firstRun = true; + + public ServerHangWatchdog(DedicatedServer server) + { +@@ -37,7 +38,7 @@ + long j = MinecraftServer.getCurrentTimeMillis(); + long k = j - i; + +- if (k > this.maxTickTime) ++ if (k > this.maxTickTime && !this.firstRun) + { + LOGGER.fatal("A single server tick took " + String.format("%.2f", new Object[] {Float.valueOf((float)k / 1000.0F)}) + " seconds (should be max " + String.format("%.2f", new Object[] {Float.valueOf(0.05F)}) + ")"); + LOGGER.fatal("Considering it to be crashed, server will forcibly shutdown."); +@@ -75,6 +76,8 @@ + this.scheduleHalt(); + } + ++ this.firstRun = false; ++ + try + { + Thread.sleep(i + this.maxTickTime - j); diff --git a/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch new file mode 100644 index 0000000000..1aca6a5bcf --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/server/gui/MinecraftServerGui.java ++++ ../src-work/minecraft/net/minecraft/server/gui/MinecraftServerGui.java +@@ -78,6 +78,7 @@ + System.exit(0); + } + }); ++ minecraftservergui.latch.countDown(); + } + + public MinecraftServerGui(DedicatedServer serverIn) +@@ -162,8 +163,13 @@ + return jpanel; + } + ++ private java.util.concurrent.CountDownLatch latch = new java.util.concurrent.CountDownLatch(1); + public void func_164247_a(final JTextArea p_164247_1_, final JScrollPane p_164247_2_, final String p_164247_3_) + { ++ try ++ { ++ latch.await(); ++ } catch (InterruptedException e){} //Prevent logging until after constructor has ended. + if (!SwingUtilities.isEventDispatchThread()) + { + SwingUtilities.invokeLater(new Runnable() diff --git a/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch new file mode 100644 index 0000000000..6b4e353d1e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -0,0 +1,88 @@ +--- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java ++++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java +@@ -71,8 +71,6 @@ + protected void loadAllWorlds(String p_71247_1_, String p_71247_2_, long seed, WorldType type, String p_71247_6_) + { + this.convertMapIfNeeded(p_71247_1_); +- this.worldServers = new WorldServer[3]; +- this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; + ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(p_71247_1_, true); + this.setResourcePackFromWorld(this.getFolderName(), isavehandler); + WorldInfo worldinfo = isavehandler.loadWorldInfo(); +@@ -86,44 +84,24 @@ + worldinfo.setWorldName(p_71247_2_); + } + +- for (int i = 0; i < this.worldServers.length; ++i) +- { +- int j = 0; ++ WorldServer overWorld = (isDemo() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init() : ++ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init()); ++ overWorld.initialize(this.theWorldSettings); + +- if (i == 1) ++ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) ++ { ++ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.theProfiler)).init()); ++ world.addWorldAccess(new WorldManager(this, world)); ++ if (!this.isSinglePlayer()) + { +- j = -1; ++ world.getWorldInfo().setGameType(getGameType()); + } +- +- if (i == 2) +- { +- j = 1; +- } +- +- if (i == 0) +- { +- if (this.isDemo()) +- { +- this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- } +- else +- { +- this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- } +- +- this.worldServers[i].initialize(this.theWorldSettings); +- } +- else +- { +- this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); +- } +- +- this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); + } + +- this.getConfigurationManager().setPlayerManager(this.worldServers); ++ this.getConfigurationManager().setPlayerManager(new WorldServer[]{ overWorld }); + +- if (this.worldServers[0].getWorldInfo().getDifficulty() == null) ++ if (overWorld.getWorldInfo().getDifficulty() == null) + { + this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); + } +@@ -141,9 +119,10 @@ + this.setAllowFlight(true); + logger.info("Generating keypair"); + this.setKeyPair(CryptManager.generateKeyPair()); ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; + this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.getWorldName()); + this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName()); +- return true; ++ return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this); + } + + public void tick() +@@ -216,6 +195,7 @@ + + public EnumDifficulty getDifficulty() + { ++ if (this.mc.theWorld == null) return this.mc.gameSettings.difficulty; // Fix NPE just in case. + return this.mc.theWorld.getWorldInfo().getDifficulty(); + } + diff --git a/patches.mcp/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch new file mode 100644 index 0000000000..6d0ff4dda3 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch @@ -0,0 +1,266 @@ +--- ../src-base/minecraft/net/minecraft/server/management/ItemInWorldManager.java ++++ ../src-work/minecraft/net/minecraft/server/management/ItemInWorldManager.java +@@ -22,6 +22,8 @@ + + public class ItemInWorldManager + { ++ /** Forge reach distance */ ++ private double blockReachDistance = 5.0d; + public World theWorld; + public EntityPlayerMP thisPlayerMP; + private WorldSettings.GameType gameType = WorldSettings.GameType.NOT_SET; +@@ -116,7 +118,7 @@ + else + { + int k = this.curblockDamage - this.initialDamage; +- float f1 = block1.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180241_i) * (float)(k + 1); ++ float f1 = block1.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180240_f) * (float)(k + 1); //Forge: Fix network break progress using wrong position + int l = (int)(f1 * 10.0F); + + if (l != this.durabilityRemainingOnBlock) +@@ -130,6 +132,14 @@ + + public void onBlockClicked(BlockPos pos, EnumFacing side) + { ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thisPlayerMP, ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, theWorld, pos, side, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(thisPlayerMP, getBlockReachDistance() + 1)); ++ if (event.isCanceled()) ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ return; ++ } ++ + if (this.isCreative()) + { + if (!this.theWorld.extinguishFire((EntityPlayer)null, pos, side)) +@@ -164,18 +174,35 @@ + } + } + +- this.theWorld.extinguishFire((EntityPlayer)null, pos, side); ++ // + this.initialDamage = this.curblockDamage; + float f = 1.0F; + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(theWorld, pos)) + { +- block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); ++ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); ++ this.theWorld.extinguishFire((EntityPlayer)null, pos, side); ++ } ++ else ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ } + f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos); + } + +- if (block.getMaterial() != Material.air && f >= 1.0F) ++ if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { ++ if (f >= 1.0F) ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ } ++ return; ++ } ++ ++ if (!block.isAir(theWorld, pos) && f >= 1.0F) ++ { + this.tryHarvestBlock(pos); + } + else +@@ -196,7 +223,7 @@ + int i = this.curblockDamage - this.initialDamage; + Block block = this.theWorld.getBlockState(pos).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(theWorld, pos)) + { + float f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos) * (float)(i + 1); + +@@ -225,9 +252,13 @@ + + private boolean removeBlock(BlockPos pos) + { ++ return removeBlock(pos, false); ++ } ++ private boolean removeBlock(BlockPos pos, boolean canHarvest) ++ { + IBlockState iblockstate = this.theWorld.getBlockState(pos); + iblockstate.getBlock().onBlockHarvested(this.theWorld, pos, iblockstate, this.thisPlayerMP); +- boolean flag = this.theWorld.setBlockToAir(pos); ++ boolean flag = iblockstate.getBlock().removedByPlayer(theWorld, pos, thisPlayerMP, canHarvest); + + if (flag) + { +@@ -239,7 +270,8 @@ + + public boolean tryHarvestBlock(BlockPos pos) + { +- if (this.gameType.isCreative() && this.thisPlayerMP.getHeldItem() != null && this.thisPlayerMP.getHeldItem().getItem() instanceof ItemSword) ++ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(theWorld, gameType, thisPlayerMP, pos); ++ if (exp == -1) + { + return false; + } +@@ -248,40 +280,21 @@ + IBlockState iblockstate = this.theWorld.getBlockState(pos); + TileEntity tileentity = this.theWorld.getTileEntity(pos); + +- if (this.gameType.isAdventure()) +- { +- if (this.gameType == WorldSettings.GameType.SPECTATOR) +- { +- return false; +- } ++ ItemStack stack = thisPlayerMP.getCurrentEquippedItem(); ++ if (stack != null && stack.getItem().onBlockStartBreak(stack, pos, thisPlayerMP)) return false; + +- if (!this.thisPlayerMP.isAllowEdit()) +- { +- ItemStack itemstack = this.thisPlayerMP.getCurrentEquippedItem(); +- +- if (itemstack == null) +- { +- return false; +- } +- +- if (!itemstack.canDestroy(iblockstate.getBlock())) +- { +- return false; +- } +- } +- } +- + this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, pos, Block.getStateId(iblockstate)); +- boolean flag1 = this.removeBlock(pos); ++ boolean flag1 = false; + + if (this.isCreative()) + { ++ flag1 = this.removeBlock(pos); + this.thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(this.theWorld, pos)); + } + else + { + ItemStack itemstack1 = this.thisPlayerMP.getCurrentEquippedItem(); +- boolean flag = this.thisPlayerMP.canHarvestBlock(iblockstate.getBlock()); ++ boolean flag = iblockstate.getBlock().canHarvestBlock(theWorld, pos, thisPlayerMP); + + if (itemstack1 != null) + { +@@ -293,12 +306,18 @@ + } + } + ++ flag1 = this.removeBlock(pos, flag); + if (flag1 && flag) + { + iblockstate.getBlock().harvestBlock(this.theWorld, this.thisPlayerMP, pos, iblockstate, tileentity); + } + } + ++ // Drop experiance ++ if (!this.isCreative() && flag1 && exp > 0) ++ { ++ iblockstate.getBlock().dropXpOnBlockBreak(theWorld, pos, exp); ++ } + return flag1; + } + } +@@ -332,6 +351,7 @@ + if (itemstack.stackSize == 0) + { + player.inventory.mainInventory[player.inventory.currentItem] = null; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemstack); + } + + if (!player.isUsingItem()) +@@ -380,33 +400,51 @@ + } + else + { +- if (!player.isSneaking() || player.getHeldItem() == null) ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(player, ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, worldIn, pos, side, new net.minecraft.util.Vec3(offsetX, offsetY, offsetZ)); ++ if (event.isCanceled()) + { +- IBlockState iblockstate = worldIn.getBlockState(pos); +- +- if (iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, offsetX, offsetY, offsetZ)) +- { +- return true; +- } ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ return false; + } + +- if (stack == null) ++ if (stack != null && stack.getItem().onItemUseFirst(stack, player, worldIn, pos, side, offsetX, offsetY, offsetZ)) + { +- return false; ++ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); ++ return true; + } +- else if (this.isCreative()) ++ ++ IBlockState iblockstate = worldIn.getBlockState(pos); ++ boolean isAir = worldIn.isAirBlock(pos); ++ boolean useBlock = !player.isSneaking() || player.getHeldItem() == null; ++ if (!useBlock) useBlock = player.getHeldItem().getItem().doesSneakBypassUse(worldIn, pos, player); ++ boolean result = false; ++ ++ if (useBlock) + { +- int j = stack.getMetadata(); +- int i = stack.stackSize; +- boolean flag = stack.onItemUse(player, worldIn, pos, side, offsetX, offsetY, offsetZ); +- stack.setItemDamage(j); +- stack.stackSize = i; +- return flag; ++ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ result = iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, offsetX, offsetY, offsetZ); ++ } ++ else ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ result = event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW; ++ } + } +- else ++ if (stack != null && !result && event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { +- return stack.onItemUse(player, worldIn, pos, side, offsetX, offsetY, offsetZ); ++ int meta = stack.getMetadata(); ++ int size = stack.stackSize; ++ result = stack.onItemUse(player, worldIn, pos, side, offsetX, offsetY, offsetZ); ++ if (isCreative()) ++ { ++ stack.setItemDamage(meta); ++ stack.stackSize = size; ++ } ++ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); + } ++ return result; + } + } + +@@ -414,4 +452,13 @@ + { + this.theWorld = serverWorld; + } ++ ++ public double getBlockReachDistance() ++ { ++ return blockReachDistance; ++ } ++ public void setBlockReachDistance(double distance) ++ { ++ blockReachDistance = distance; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch new file mode 100644 index 0000000000..d0bc684553 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch @@ -0,0 +1,220 @@ +--- ../src-base/minecraft/net/minecraft/server/management/PlayerManager.java ++++ ../src-work/minecraft/net/minecraft/server/management/PlayerManager.java +@@ -117,15 +117,24 @@ + int j = (int)player.posZ >> 4; + player.managedPosX = player.posX; + player.managedPosZ = player.posZ; ++ // Load nearby chunks first ++ List chunkList = Lists.newArrayList(); + + for (int k = i - this.playerViewRadius; k <= i + this.playerViewRadius; ++k) + { + for (int l = j - this.playerViewRadius; l <= j + this.playerViewRadius; ++l) + { +- this.getPlayerInstance(k, l, true).addPlayer(player); ++ chunkList.add(new ChunkCoordIntPair(k, l)); + } + } + ++ java.util.Collections.sort(chunkList, new net.minecraftforge.common.util.ChunkCoordComparator(player)); ++ ++ for (ChunkCoordIntPair pair : chunkList) ++ { ++ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(player); ++ } ++ + this.players.add(player); + this.filterChunkLoadQueue(player); + } +@@ -225,6 +234,7 @@ + int i1 = this.playerViewRadius; + int j1 = i - k; + int k1 = j - l; ++ List chunksToLoad = Lists.newArrayList(); + + if (j1 != 0 || k1 != 0) + { +@@ -234,7 +244,7 @@ + { + if (!this.overlaps(l1, i2, k, l, i1)) + { +- this.getPlayerInstance(l1, i2, true).addPlayer(player); ++ chunksToLoad.add(new ChunkCoordIntPair(l1, i2)); + } + + if (!this.overlaps(l1 - j1, i2 - k1, i, j, i1)) +@@ -252,6 +262,18 @@ + this.filterChunkLoadQueue(player); + player.managedPosX = player.posX; + player.managedPosZ = player.posZ; ++ // send nearest chunks first ++ java.util.Collections.sort(chunksToLoad, new net.minecraftforge.common.util.ChunkCoordComparator(player)); ++ ++ for (ChunkCoordIntPair pair : chunksToLoad) ++ { ++ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(player); ++ } ++ ++ if (i1 > 1 || i1 < -1 || j1 > 1 || j1 < -1) ++ { ++ java.util.Collections.sort(player.loadedChunks, new net.minecraftforge.common.util.ChunkCoordComparator(player)); ++ } + } + } + } +@@ -322,11 +344,20 @@ + private int numBlocksToUpdate; + private int flagsYAreasToUpdate; + private long previousWorldTime; ++ private final java.util.HashMap players = new java.util.HashMap(); ++ private boolean loaded = false; ++ private Runnable loadedRunnable = new Runnable() ++ { ++ public void run() ++ { ++ PlayerInstance.this.loaded = true; ++ } ++ }; + + public PlayerInstance(int chunkX, int chunkZ) + { + this.chunkCoords = new ChunkCoordIntPair(chunkX, chunkZ); +- PlayerManager.this.getWorldServer().theChunkProviderServer.loadChunk(chunkX, chunkZ); ++ PlayerManager.this.getWorldServer().theChunkProviderServer.loadChunk(chunkX, chunkZ, this.loadedRunnable); + } + + public void addPlayer(EntityPlayerMP player) +@@ -343,7 +374,24 @@ + } + + this.playersWatchingChunk.add(player); ++ Runnable playerRunnable = null; ++ if (this.loaded) ++ { + player.loadedChunks.add(this.chunkCoords); ++ } ++ else ++ { ++ final EntityPlayerMP tmp = player; ++ playerRunnable = new Runnable() ++ { ++ public void run() ++ { ++ tmp.loadedChunks.add(PlayerInstance.this.chunkCoords); ++ } ++ }; ++ PlayerManager.this.getWorldServer().theChunkProviderServer.loadChunk(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, playerRunnable); ++ } ++ this.players.put(player, playerRunnable); + } + } + +@@ -351,6 +399,24 @@ + { + if (this.playersWatchingChunk.contains(player)) + { ++ // If we haven't loaded yet don't load the chunk just so we can clean it up ++ if (!this.loaded) ++ { ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getWorldServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.players.get(player)); ++ this.playersWatchingChunk.remove(player); ++ this.players.remove(player); ++ ++ if (this.playersWatchingChunk.isEmpty()) ++ { ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getWorldServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.loadedRunnable); ++ long i = (long) this.chunkCoords.chunkXPos + 2147483647L | (long) this.chunkCoords.chunkZPos + 2147483647L << 32; ++ PlayerManager.this.playerInstances.remove(i); ++ PlayerManager.this.playerInstanceList.remove(this); ++ } ++ ++ return; ++ } ++ + Chunk chunk = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos); + + if (chunk.isPopulated()) +@@ -358,9 +424,12 @@ + player.playerNetServerHandler.sendPacket(new S21PacketChunkData(chunk, true, 0)); + } + ++ this.players.remove(player); + this.playersWatchingChunk.remove(player); + player.loadedChunks.remove(this.chunkCoords); + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.UnWatch(chunkCoords, player)); ++ + if (this.playersWatchingChunk.isEmpty()) + { + long i = (long)this.chunkCoords.chunkXPos + 2147483647L | (long)this.chunkCoords.chunkZPos + 2147483647L << 32; +@@ -398,7 +467,7 @@ + + this.flagsYAreasToUpdate |= 1 << (y >> 4); + +- if (this.numBlocksToUpdate < 64) ++ //Forge; Cache everything, so always run + { + short short1 = (short)(x << 12 | z << 8 | y); + +@@ -410,6 +479,10 @@ + } + } + ++ if (numBlocksToUpdate == locationOfBlockChange.length) ++ { ++ locationOfBlockChange = java.util.Arrays.copyOf(locationOfBlockChange, locationOfBlockChange.length << 1); ++ } + this.locationOfBlockChange[this.numBlocksToUpdate++] = short1; + } + } +@@ -427,6 +500,7 @@ + } + } + ++ @SuppressWarnings("unused") + public void onUpdate() + { + if (this.numBlocksToUpdate != 0) +@@ -439,18 +513,19 @@ + BlockPos blockpos = new BlockPos(i, j, k); + this.sendToAllPlayersWatchingChunk(new S23PacketBlockChange(PlayerManager.this.theWorldServer, blockpos)); + +- if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity()) ++ if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity(PlayerManager.this.theWorldServer.getBlockState(blockpos))) + { + this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos)); + } + } +- else if (this.numBlocksToUpdate == 64) ++ else if (this.numBlocksToUpdate >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) + { + int i1 = this.chunkCoords.chunkXPos * 16; + int k1 = this.chunkCoords.chunkZPos * 16; + this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), false, this.flagsYAreasToUpdate)); + +- for (int i2 = 0; i2 < 16; ++i2) ++ // Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones ++ for (int i2 = 0; false && i2 < 16; ++i2) + { + if ((this.flagsYAreasToUpdate & 1 << i2) != 0) + { +@@ -467,7 +542,9 @@ + else + { + this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos))); +- ++ } ++ { // Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small ++ WorldServer world = PlayerManager.this.theWorldServer; + for (int j1 = 0; j1 < this.numBlocksToUpdate; ++j1) + { + int l1 = (this.locationOfBlockChange[j1] >> 12 & 15) + this.chunkCoords.chunkXPos * 16; +@@ -475,7 +552,7 @@ + int l2 = (this.locationOfBlockChange[j1] >> 8 & 15) + this.chunkCoords.chunkZPos * 16; + BlockPos blockpos1 = new BlockPos(l1, j2, l2); + +- if (PlayerManager.this.theWorldServer.getBlockState(blockpos1).getBlock().hasTileEntity()) ++ if (world.getBlockState(blockpos1).getBlock().hasTileEntity(world.getBlockState(blockpos1))) + { + this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos1)); + } diff --git a/patches.mcp/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch new file mode 100644 index 0000000000..14c98b3ca8 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -0,0 +1,223 @@ +--- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java ++++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java +@@ -99,7 +99,7 @@ + this.maxPlayers = 8; + } + +- public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn) ++ public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn, NetHandlerPlayServer nethandlerplayserver) + { + GameProfile gameprofile = playerIn.getGameProfile(); + PlayerProfileCache playerprofilecache = this.mcServer.getPlayerProfileCache(); +@@ -108,6 +108,17 @@ + playerprofilecache.addEntry(gameprofile); + NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(playerIn); + playerIn.setWorld(this.mcServer.worldServerForDimension(playerIn.dimension)); ++ ++ World playerWorld = this.mcServer.worldServerForDimension(playerIn.dimension); ++ if (playerWorld == null) ++ { ++ playerIn.dimension=0; ++ playerWorld=this.mcServer.worldServerForDimension(0); ++ BlockPos spawnPoint = playerWorld.provider.getRandomizedSpawnPoint(); ++ playerIn.setPosition(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ()); ++ } ++ ++ playerIn.setWorld(playerWorld); + playerIn.theItemInWorldManager.setWorld((WorldServer)playerIn.worldObj); + String s1 = "local"; + +@@ -121,7 +132,7 @@ + WorldInfo worldinfo = worldserver.getWorldInfo(); + BlockPos blockpos = worldserver.getSpawnPoint(); + this.setPlayerGameTypeBasedOnOther(playerIn, (EntityPlayerMP)null, worldserver); +- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.mcServer, netManager, playerIn); ++ playerIn.playerNetServerHandler = nethandlerplayserver; + nethandlerplayserver.sendPacket(new S01PacketJoinGame(playerIn.getEntityId(), playerIn.theItemInWorldManager.getGameType(), worldinfo.isHardcoreModeEnabled(), worldserver.provider.getDimensionId(), worldserver.getDifficulty(), this.getMaxPlayers(), worldinfo.getTerrainType(), worldserver.getGameRules().getBoolean("reducedDebugInfo"))); + nethandlerplayserver.sendPacket(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(this.getServerInstance().getServerModName()))); + nethandlerplayserver.sendPacket(new S41PacketServerDifficulty(worldinfo.getDifficulty(), worldinfo.isDifficultyLocked())); +@@ -161,6 +172,7 @@ + + playerIn.addSelfToInternalCraftingInventory(); + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(playerIn); + if (nbttagcompound != null && nbttagcompound.hasKey("Riding", 10)) + { + Entity entity = EntityList.createEntityFromNBT(nbttagcompound.getCompoundTag("Riding"), worldserver); +@@ -262,6 +274,7 @@ + playerIn.readFromNBT(nbttagcompound); + nbttagcompound1 = nbttagcompound; + logger.debug("loading single player"); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(playerIn, this.playerNBTManagerObj, playerIn.getUniqueID().toString()); + } + else + { +@@ -271,8 +284,23 @@ + return nbttagcompound1; + } + ++ public NBTTagCompound getPlayerNBT(EntityPlayerMP player) ++ { ++ // Hacky method to allow loading the NBT for a player prior to login ++ NBTTagCompound nbttagcompound = this.mcServer.worldServers[0].getWorldInfo().getPlayerNBTTagCompound(); ++ if (player.getName().equals(this.mcServer.getServerOwner()) && nbttagcompound != null) ++ { ++ return nbttagcompound; ++ } ++ else ++ { ++ return ((net.minecraft.world.storage.SaveHandler)this.playerNBTManagerObj).getPlayerNBT(player); ++ } ++ } + protected void writePlayerData(EntityPlayerMP playerIn) + { ++ if (playerIn.playerNetServerHandler == null) return; ++ + this.playerNBTManagerObj.writePlayerData(playerIn); + StatisticsFile statisticsfile = (StatisticsFile)this.playerStatFiles.get(playerIn.getUniqueID()); + +@@ -288,6 +316,7 @@ + this.uuidToPlayerMap.put(playerIn.getUniqueID(), playerIn); + this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {playerIn})); + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); + worldserver.spawnEntityInWorld(playerIn); + this.preparePlayer(playerIn, (WorldServer)null); + +@@ -305,6 +334,7 @@ + + public void playerLoggedOut(EntityPlayerMP playerIn) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(playerIn); + playerIn.triggerAchievement(StatList.leaveGameStat); + this.writePlayerData(playerIn); + WorldServer worldserver = playerIn.getServerForPlayer(); +@@ -326,6 +356,7 @@ + this.uuidToPlayerMap.remove(uuid); + this.playerStatFiles.remove(uuid); + } ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); + + this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn})); + } +@@ -409,13 +440,23 @@ + + public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd) + { ++ World world = mcServer.worldServerForDimension(dimension); ++ if (world == null) ++ { ++ dimension = 0; ++ } ++ else if (!world.provider.canRespawnHere()) ++ { ++ dimension = world.provider.getRespawnDimension(playerIn); ++ } ++ + playerIn.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(playerIn); + playerIn.getServerForPlayer().getEntityTracker().untrackEntity(playerIn); + playerIn.getServerForPlayer().getPlayerManager().removePlayer(playerIn); + this.playerEntityList.remove(playerIn); + this.mcServer.worldServerForDimension(playerIn.dimension).removePlayerEntityDangerously(playerIn); +- BlockPos blockpos = playerIn.getBedLocation(); +- boolean flag = playerIn.isSpawnForced(); ++ BlockPos blockpos = playerIn.getBedLocation(dimension); ++ boolean flag = playerIn.isSpawnForced(dimension); + playerIn.dimension = dimension; + ItemInWorldManager iteminworldmanager; + +@@ -431,6 +472,7 @@ + EntityPlayerMP entityplayermp = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), iteminworldmanager); + entityplayermp.playerNetServerHandler = playerIn.playerNetServerHandler; + entityplayermp.clonePlayer(playerIn, conqueredEnd); ++ entityplayermp.dimension = dimension; + entityplayermp.setEntityId(playerIn.getEntityId()); + entityplayermp.func_174817_o(playerIn); + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); +@@ -470,19 +512,25 @@ + this.uuidToPlayerMap.put(entityplayermp.getUniqueID(), entityplayermp); + entityplayermp.addSelfToInternalCraftingInventory(); + entityplayermp.setHealth(entityplayermp.getHealth()); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp); + return entityplayermp; + } + + public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension) + { ++ transferPlayerToDimension(playerIn, dimension, mcServer.worldServerForDimension(dimension).getDefaultTeleporter()); ++ } ++ ++ public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension, net.minecraft.world.Teleporter teleporter) ++ { + int i = playerIn.dimension; + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); + playerIn.dimension = dimension; + WorldServer worldserver1 = this.mcServer.worldServerForDimension(playerIn.dimension); +- playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, playerIn.worldObj.getDifficulty(), playerIn.worldObj.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); ++ playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); + worldserver.removePlayerEntityDangerously(playerIn); + playerIn.isDead = false; +- this.transferEntityToWorld(playerIn, i, worldserver, worldserver1); ++ this.transferEntityToWorld(playerIn, i, worldserver, worldserver1, teleporter); + this.preparePlayer(playerIn, worldserver); + playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch); + playerIn.theItemInWorldManager.setWorld(worldserver1); +@@ -493,17 +541,27 @@ + { + playerIn.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), potioneffect)); + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(playerIn, i, dimension); + } + + public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) + { +- double d0 = entityIn.posX; +- double d1 = entityIn.posZ; ++ transferEntityToWorld(entityIn, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.getDefaultTeleporter()); ++ } ++ ++ @SuppressWarnings("unused") ++ public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter) ++ { ++ net.minecraft.world.WorldProvider pOld = p_82448_3_.provider; ++ net.minecraft.world.WorldProvider pNew = p_82448_4_.provider; ++ double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor(); ++ double d0 = entityIn.posX * moveFactor; ++ double d1 = entityIn.posZ * moveFactor; + double d2 = 8.0D; + float f = entityIn.rotationYaw; + p_82448_3_.theProfiler.startSection("moving"); + +- if (entityIn.dimension == -1) ++ if (false && entityIn.dimension == -1) //Forge Kill it but dont comment out so we can rename it. + { + d0 = MathHelper.clamp_double(d0 / d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); + d1 = MathHelper.clamp_double(d1 / d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); +@@ -514,7 +572,7 @@ + p_82448_3_.updateEntityWithOptionalForce(entityIn, false); + } + } +- else if (entityIn.dimension == 0) ++ else if (false && entityIn.dimension == 0) //Forge Kill it but dont comment out so we can rename it. + { + d0 = MathHelper.clamp_double(d0 * d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); + d1 = MathHelper.clamp_double(d1 * d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); +@@ -525,7 +583,8 @@ + p_82448_3_.updateEntityWithOptionalForce(entityIn, false); + } + } +- else ++ ++ if (entityIn.dimension == 1) + { + BlockPos blockpos; + +@@ -560,7 +619,7 @@ + if (entityIn.isEntityAlive()) + { + entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch); +- p_82448_4_.getDefaultTeleporter().placeInPortal(entityIn, f); ++ teleporter.placeInPortal(entityIn, f); + p_82448_4_.spawnEntityInWorld(entityIn); + p_82448_4_.updateEntityWithOptionalForce(entityIn, false); + } diff --git a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch b/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch new file mode 100644 index 0000000000..6c4b469422 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java ++++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java +@@ -22,6 +22,8 @@ + + public void processHandshake(C00Handshake packetIn) + { ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; ++ + switch (packetIn.getRequestedState()) + { + case LOGIN: diff --git a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch new file mode 100644 index 0000000000..207663b904 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch @@ -0,0 +1,26 @@ +--- ../src-base/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java ++++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java +@@ -66,12 +66,12 @@ + if (entityplayermp == null) + { + this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; +- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.field_181025_l); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.field_181025_l); + this.field_181025_l = null; + } + } + +- if (this.connectionTimer++ == 600) ++ if (this.connectionTimer++ == net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.LOGIN_TIMEOUT) + { + this.closeConnection("Took too long to log in"); + } +@@ -130,7 +130,7 @@ + } + else + { +- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); + } + } + } diff --git a/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch b/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch new file mode 100644 index 0000000000..1a464c5e9a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch @@ -0,0 +1,92 @@ +--- ../src-base/minecraft/net/minecraft/stats/StatList.java ++++ ../src-work/minecraft/net/minecraft/stats/StatList.java +@@ -119,7 +119,7 @@ + } + } + +- replaceAllSimilarBlocks(objectCraftStats); ++ replaceAllSimilarBlocks(objectCraftStats, true); + } + + private static void initMiningStats() +@@ -141,7 +141,7 @@ + } + } + +- replaceAllSimilarBlocks(mineBlockStatArray); ++ replaceAllSimilarBlocks(mineBlockStatArray, false); + } + + private static void initStats() +@@ -165,7 +165,7 @@ + } + } + +- replaceAllSimilarBlocks(objectUseStats); ++ replaceAllSimilarBlocks(objectUseStats, true); + } + + private static void initItemDepleteStats() +@@ -184,7 +184,7 @@ + } + } + +- replaceAllSimilarBlocks(objectBreakStats); ++ replaceAllSimilarBlocks(objectBreakStats, true); + } + + private static String func_180204_a(Item p_180204_0_) +@@ -193,28 +193,35 @@ + return resourcelocation != null ? resourcelocation.toString().replace(':', '.') : null; + } + +- private static void replaceAllSimilarBlocks(StatBase[] p_75924_0_) ++ private static void replaceAllSimilarBlocks(StatBase[] p_75924_0_, boolean useItemIds) + { +- mergeStatBases(p_75924_0_, Blocks.water, Blocks.flowing_water); +- mergeStatBases(p_75924_0_, Blocks.lava, Blocks.flowing_lava); +- mergeStatBases(p_75924_0_, Blocks.lit_pumpkin, Blocks.pumpkin); +- mergeStatBases(p_75924_0_, Blocks.lit_furnace, Blocks.furnace); +- mergeStatBases(p_75924_0_, Blocks.lit_redstone_ore, Blocks.redstone_ore); +- mergeStatBases(p_75924_0_, Blocks.powered_repeater, Blocks.unpowered_repeater); +- mergeStatBases(p_75924_0_, Blocks.powered_comparator, Blocks.unpowered_comparator); +- mergeStatBases(p_75924_0_, Blocks.redstone_torch, Blocks.unlit_redstone_torch); +- mergeStatBases(p_75924_0_, Blocks.lit_redstone_lamp, Blocks.redstone_lamp); +- mergeStatBases(p_75924_0_, Blocks.double_stone_slab, Blocks.stone_slab); +- mergeStatBases(p_75924_0_, Blocks.double_wooden_slab, Blocks.wooden_slab); +- mergeStatBases(p_75924_0_, Blocks.double_stone_slab2, Blocks.stone_slab2); +- mergeStatBases(p_75924_0_, Blocks.grass, Blocks.dirt); +- mergeStatBases(p_75924_0_, Blocks.farmland, Blocks.dirt); ++ mergeStatBases(p_75924_0_, Blocks.water, Blocks.flowing_water, useItemIds); ++ mergeStatBases(p_75924_0_, Blocks.lava, Blocks.flowing_lava, useItemIds); ++ mergeStatBases(p_75924_0_, Blocks.lit_pumpkin, Blocks.pumpkin, useItemIds); ++ mergeStatBases(p_75924_0_, Blocks.lit_furnace, Blocks.furnace, useItemIds); ++ mergeStatBases(p_75924_0_, Blocks.lit_redstone_ore, Blocks.redstone_ore, useItemIds); ++ mergeStatBases(p_75924_0_, Blocks.powered_repeater, Blocks.unpowered_repeater, useItemIds); ++ mergeStatBases(p_75924_0_, Blocks.powered_comparator, Blocks.unpowered_comparator, useItemIds); ++ mergeStatBases(p_75924_0_, Blocks.redstone_torch, Blocks.unlit_redstone_torch, useItemIds); ++ mergeStatBases(p_75924_0_, Blocks.lit_redstone_lamp, Blocks.redstone_lamp, useItemIds); ++ mergeStatBases(p_75924_0_, Blocks.double_stone_slab, Blocks.stone_slab, useItemIds); ++ mergeStatBases(p_75924_0_, Blocks.double_wooden_slab, Blocks.wooden_slab, useItemIds); ++ mergeStatBases(p_75924_0_, Blocks.double_stone_slab2, Blocks.stone_slab2, useItemIds); ++ mergeStatBases(p_75924_0_, Blocks.grass, Blocks.dirt, useItemIds); ++ mergeStatBases(p_75924_0_, Blocks.farmland, Blocks.dirt, useItemIds); + } + +- private static void mergeStatBases(StatBase[] statBaseIn, Block p_151180_1_, Block p_151180_2_) ++ private static void mergeStatBases(StatBase[] statBaseIn, Block p_151180_1_, Block p_151180_2_, boolean useItemIds) + { +- int i = Block.getIdFromBlock(p_151180_1_); +- int j = Block.getIdFromBlock(p_151180_2_); ++ int i; ++ int j; ++ if (useItemIds) { ++ i = Item.getIdFromItem(Item.getItemFromBlock(p_151180_1_)); ++ j = Item.getIdFromItem(Item.getItemFromBlock(p_151180_2_)); ++ } else { ++ i = Block.getIdFromBlock(p_151180_1_); ++ j = Block.getIdFromBlock(p_151180_2_); ++ } + + if (statBaseIn[i] != null && statBaseIn[j] == null) + { diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch new file mode 100644 index 0000000000..241001f4b5 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -0,0 +1,251 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java +@@ -17,7 +17,7 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +-public abstract class TileEntity ++public abstract class TileEntity implements net.minecraftforge.common.capabilities.ICapabilitySerializable + { + private static final Logger logger = LogManager.getLogger(); + private static Map < String, Class > nameToClassMap = Maps. < String, Class > newHashMap(); +@@ -59,6 +59,8 @@ + public void readFromNBT(NBTTagCompound compound) + { + this.pos = new BlockPos(compound.getInteger("x"), compound.getInteger("y"), compound.getInteger("z")); ++ if (compound.hasKey("ForgeData")) this.customTileData = compound.getCompoundTag("ForgeData"); ++ if (this.capabilities != null && compound.hasKey("ForgeCaps")) this.capabilities.deserializeNBT(compound.getCompoundTag("ForgeCaps")); + } + + public void writeToNBT(NBTTagCompound compound) +@@ -75,6 +77,8 @@ + compound.setInteger("x", this.pos.getX()); + compound.setInteger("y", this.pos.getY()); + compound.setInteger("z", this.pos.getZ()); ++ if (this.customTileData != null) compound.setTag("ForgeData", this.customTileData); ++ if (this.capabilities != null) compound.setTag("ForgeCaps", this.capabilities.serializeNBT()); + } + } + +@@ -82,9 +86,10 @@ + { + TileEntity tileentity = null; + ++ Class oclass = null; + try + { +- Class oclass = (Class)nameToClassMap.get(nbt.getString("id")); ++ oclass = (Class)nameToClassMap.get(nbt.getString("id")); + + if (oclass != null) + { +@@ -102,7 +107,17 @@ + } + else + { ++ try ++ { + logger.warn("Skipping BlockEntity with id " + nbt.getString("id")); ++ } ++ catch (Exception ex) ++ { ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex, ++ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", ++ nbt.getString("id"), oclass.getName()); ++ tileentity = null; ++ } + } + + return tileentity; +@@ -134,7 +149,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + public double getDistanceSq(double x, double y, double z) + { + double d0 = (double)this.pos.getX() + 0.5D - x; +@@ -279,4 +293,183 @@ + addMapping(TileEntityFlowerPot.class, "FlowerPot"); + addMapping(TileEntityBanner.class, "Banner"); + } ++ ++ // -- BEGIN FORGE PATCHES -- ++ /** ++ * Called when you receive a TileEntityData packet for the location this ++ * TileEntity is currently in. On the client, the NetworkManager will always ++ * be the remote server. On the server, it will be whomever is responsible for ++ * sending the packet. ++ * ++ * @param net The NetworkManager the packet originated from ++ * @param pkt The data packet ++ */ ++ public void onDataPacket(net.minecraft.network.NetworkManager net, net.minecraft.network.play.server.S35PacketUpdateTileEntity pkt) ++ { ++ } ++ ++ /** ++ * Called when the chunk this TileEntity is on is Unloaded. ++ */ ++ public void onChunkUnload() ++ { ++ } ++ ++ private boolean isVanilla = getClass().getName().startsWith("net.minecraft."); ++ /** ++ * Called from Chunk.setBlockIDWithMetadata and Chunk.fillChunk, determines if this tile entity should be re-created when the ID, or Metadata changes. ++ * Use with caution as this will leave straggler TileEntities, or create conflicts with other TileEntities if not used properly. ++ * ++ * @param world Current world ++ * @param pos Tile's world position ++ * @param oldState The old ID of the block ++ * @param newState The new ID of the block (May be the same) ++ * @return true forcing the invalidation of the existing TE, false not to invalidate the existing TE ++ */ ++ public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) ++ { ++ return isVanilla ? (oldState.getBlock() != newSate.getBlock()) : oldState != newSate; ++ } ++ ++ public boolean shouldRenderInPass(int pass) ++ { ++ return pass == 0; ++ } ++ ++ /** ++ * Sometimes default render bounding box: infinite in scope. Used to control rendering on {@link TileEntitySpecialRenderer}. ++ */ ++ public static final net.minecraft.util.AxisAlignedBB INFINITE_EXTENT_AABB = new net.minecraft.util.AxisAlignedBB(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); ++ /** ++ * Return an {@link AxisAlignedBB} that controls the visible scope of a {@link TileEntitySpecialRenderer} associated with this {@link TileEntity} ++ * Defaults to the collision bounding box {@link Block#getCollisionBoundingBoxFromPool(World, int, int, int)} associated with the block ++ * at this location. ++ * ++ * @return an appropriately size {@link AxisAlignedBB} for the {@link TileEntity} ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.util.AxisAlignedBB getRenderBoundingBox() ++ { ++ net.minecraft.util.AxisAlignedBB bb = INFINITE_EXTENT_AABB; ++ Block type = getBlockType(); ++ if (type == Blocks.enchanting_table) ++ { ++ bb = new net.minecraft.util.AxisAlignedBB(getPos(), getPos().add(1, 1, 1)); ++ } ++ else if (type == Blocks.chest || type == Blocks.trapped_chest) ++ { ++ bb = new net.minecraft.util.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(2, 2, 2)); ++ } ++ else if (type != null && type != Blocks.beacon) ++ { ++ net.minecraft.util.AxisAlignedBB cbb = null; ++ try ++ { ++ cbb = type.getCollisionBoundingBox(worldObj, getPos(), worldObj.getBlockState(getPos())); ++ } ++ catch (Exception e) ++ { ++ // We have to capture any exceptions that may occur here because BUKKIT servers like to send ++ // the tile entity data BEFORE the chunk data, you know, the OPPOSITE of what vanilla does! ++ // So we can not GARENTEE that the world state is the real state for the block... ++ // So, once again in the long line of US having to accommodate BUKKIT breaking things, ++ // here it is, assume that the TE is only 1 cubic block. Problem with this is that it may ++ // cause the TileEntity renderer to error further down the line! But alas, nothing we can do. ++ cbb = new net.minecraft.util.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(1, 1, 1)); ++ } ++ if (cbb != null) bb = cbb; ++ } ++ return bb; ++ } ++ ++ /** ++ * Checks if this tile entity knows how to render its 'breaking' overlay effect. ++ * If this returns true, The TileEntitySpecialRenderer will be called again with break progress set. ++ * @return True to re-render tile with breaking effect. ++ */ ++ public boolean canRenderBreaking() ++ { ++ Block block = this.getBlockType(); ++ return (block instanceof net.minecraft.block.BlockChest || ++ block instanceof net.minecraft.block.BlockEnderChest || ++ block instanceof net.minecraft.block.BlockSign || ++ block instanceof net.minecraft.block.BlockSkull); ++ } ++ ++ private NBTTagCompound customTileData; ++ ++ /** ++ * Gets a {@link NBTTagCompound} that can be used to store custom data for this tile entity. ++ * It will be written, and read from disc, so it persists over world saves. ++ * ++ * @return A compound tag for custom data ++ */ ++ public NBTTagCompound getTileData() ++ { ++ if (this.customTileData == null) ++ { ++ this.customTileData = new NBTTagCompound(); ++ } ++ return this.customTileData; ++ } ++ ++ /** ++ * Determines if the player can overwrite the NBT data of this tile entity while they place it using a ItemStack. ++ * Added as a fix for MC-75630 - Exploit with signs and command blocks ++ * @return True to prevent NBT copy, false to allow. ++ */ ++ public boolean restrictNBTCopy() ++ { ++ return this instanceof TileEntityCommandBlock || ++ this instanceof TileEntityMobSpawner || ++ this instanceof TileEntitySign; ++ } ++ ++ ++ /** ++ * Called from the Chunk when this is first added to the world. Override instead of adding ++ * if (firstTick) stuff in update. Happens after validate and after it has been placed into the Chunk tileEntity ++ * map. ++ */ ++ public void onLoad() ++ { ++ // NOOP ++ } ++ ++ /** ++ * If the TileEntitySpecialRenderer associated with this TileEntity can be batched in with another renderers, and won't access the GL state. ++ * If TileEntity returns true, then TESR should have the same functionality as (and probably extend) the FastTESR class. ++ */ ++ public boolean hasFastRenderer() ++ { ++ return false; ++ } ++ ++ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities; ++ public TileEntity() ++ { ++ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this); ++ } ++ ++ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ return capabilities == null ? false : capabilities.hasCapability(capability, facing); ++ } ++ ++ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ return capabilities == null ? null : capabilities.getCapability(capability, facing); ++ } ++ ++ public void deserializeNBT(NBTTagCompound nbt) ++ { ++ this.readFromNBT(nbt); ++ } ++ ++ public NBTTagCompound serializeNBT() ++ { ++ NBTTagCompound ret = new NBTTagCompound(); ++ this.writeToNBT(ret); ++ return ret; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch new file mode 100644 index 0000000000..f6606e0c9d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java +@@ -169,7 +169,7 @@ + { + Block block = this.worldObj.getBlockState(new BlockPos(j1, i2, k1)).getBlock(); + +- if (block != Blocks.emerald_block && block != Blocks.gold_block && block != Blocks.diamond_block && block != Blocks.iron_block) ++ if (!block.isBeaconBase(this.worldObj, new BlockPos(j1, i2, k1), getPos())) + { + flag1 = false; + break; +@@ -368,7 +368,7 @@ + + public boolean isItemValidForSlot(int index, ItemStack stack) + { +- return stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot; ++ return stack.getItem() != null && stack.getItem().isBeaconPayment(stack); + } + + public String getGuiID() diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch new file mode 100644 index 0000000000..099972726e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -0,0 +1,97 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java +@@ -104,7 +104,7 @@ + + private boolean canBrew() + { +- if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0) ++ if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0 && false) // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe + { + ItemStack itemstack = this.brewingItemStacks[3]; + +@@ -118,7 +118,7 @@ + + for (int i = 0; i < 3; ++i) + { +- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) ++ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) + { + int j = this.brewingItemStacks[i].getMetadata(); + int k = this.getPotionResult(j, itemstack); +@@ -145,19 +145,22 @@ + } + else + { +- return false; ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(brewingItemStacks, brewingItemStacks[3], outputSlots); + } + } + + private void brewPotions() + { ++ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBreaw(brewingItemStacks)) return; + if (this.canBrew()) + { ++ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(brewingItemStacks, brewingItemStacks[3], outputSlots); + ItemStack itemstack = this.brewingItemStacks[3]; + ++ if (false) { // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe + for (int i = 0; i < 3; ++i) + { +- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) ++ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) + { + int j = this.brewingItemStacks[i].getMetadata(); + int k = this.getPotionResult(j, itemstack); +@@ -177,10 +180,11 @@ + } + } + } ++ } + +- if (itemstack.getItem().hasContainerItem()) ++ if (itemstack.getItem().hasContainerItem(itemstack)) + { +- this.brewingItemStacks[3] = new ItemStack(itemstack.getItem().getContainerItem()); ++ this.brewingItemStacks[3] = itemstack.getItem().getContainerItem(itemstack); + } + else + { +@@ -191,6 +195,7 @@ + this.brewingItemStacks[3] = null; + } + } ++ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(brewingItemStacks); + } + } + +@@ -310,7 +315,9 @@ + + public boolean isItemValidForSlot(int index, ItemStack stack) + { +- return index == 3 ? stack.getItem().isPotionIngredient(stack) : stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle; ++ if (index == 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack)) return true; ++ else if (index != 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack)) return true; ++ return false; + } + + public boolean[] func_174902_m() +@@ -386,4 +393,18 @@ + this.brewingItemStacks[i] = null; + } + } ++ ++ net.minecraftforge.items.IItemHandler handlerInput = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.UP); ++ net.minecraftforge.items.IItemHandler handlerOutput = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.DOWN); ++ ++ @Override ++ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) ++ if (facing == EnumFacing.UP) ++ return (T) handlerInput; ++ else ++ return (T) handlerOutput; ++ return super.getCapability(capability, facing); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch new file mode 100644 index 0000000000..3e3327995d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityChest.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityChest.java +@@ -186,6 +186,7 @@ + { + super.updateContainingBlockInfo(); + this.adjacentChestChecked = false; ++ doubleChestHandler = null; + } + + @SuppressWarnings("incomplete-switch") +@@ -468,4 +469,24 @@ + this.chestContents[i] = null; + } + } ++ ++ public net.minecraftforge.items.VanillaDoubleChestItemHandler doubleChestHandler; ++ ++ @Override ++ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) ++ { ++ if(doubleChestHandler == null || doubleChestHandler.needsRefresh()) ++ doubleChestHandler = net.minecraftforge.items.VanillaDoubleChestItemHandler.get(this); ++ if (doubleChestHandler != null && doubleChestHandler != net.minecraftforge.items.VanillaDoubleChestItemHandler.NO_ADJACENT_CHESTS_INSTANCE) ++ return (T) doubleChestHandler; ++ } ++ return super.getCapability(capability, facing); ++ } ++ ++ public net.minecraftforge.items.IItemHandler getSingleChestHandler() ++ { ++ return super.getCapability(net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch new file mode 100644 index 0000000000..3fcdeb5ebd --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch @@ -0,0 +1,99 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java +@@ -141,9 +141,9 @@ + } + } + +- this.furnaceBurnTime = compound.getShort("BurnTime"); +- this.cookTime = compound.getShort("CookTime"); +- this.totalCookTime = compound.getShort("CookTimeTotal"); ++ this.furnaceBurnTime = compound.getInteger("BurnTime"); ++ this.cookTime = compound.getInteger("CookTime"); ++ this.totalCookTime = compound.getInteger("CookTimeTotal"); + this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]); + + if (compound.hasKey("CustomName", 8)) +@@ -155,9 +155,9 @@ + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); +- compound.setShort("BurnTime", (short)this.furnaceBurnTime); +- compound.setShort("CookTime", (short)this.cookTime); +- compound.setShort("CookTimeTotal", (short)this.totalCookTime); ++ compound.setInteger("BurnTime", this.furnaceBurnTime); ++ compound.setInteger("CookTime", this.cookTime); ++ compound.setInteger("CookTimeTotal", this.totalCookTime); + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.furnaceItemStacks.length; ++i) +@@ -223,8 +223,7 @@ + + if (this.furnaceItemStacks[1].stackSize == 0) + { +- Item item = this.furnaceItemStacks[1].getItem().getContainerItem(); +- this.furnaceItemStacks[1] = item != null ? new ItemStack(item) : null; ++ this.furnaceItemStacks[1] = furnaceItemStacks[1].getItem().getContainerItem(furnaceItemStacks[1]); + } + } + } +@@ -279,7 +278,11 @@ + else + { + ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]); +- return itemstack == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].isItemEqual(itemstack) ? false : (this.furnaceItemStacks[2].stackSize < this.getInventoryStackLimit() && this.furnaceItemStacks[2].stackSize < this.furnaceItemStacks[2].getMaxStackSize() ? true : this.furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize()))); ++ if (itemstack == null) return false; ++ if (this.furnaceItemStacks[2] == null) return true; ++ if (!this.furnaceItemStacks[2].isItemEqual(itemstack)) return false; ++ int result = furnaceItemStacks[2].stackSize + itemstack.stackSize; ++ return result <= getInventoryStackLimit() && result <= this.furnaceItemStacks[2].getMaxStackSize(); //Forge BugFix: Make it respect stack sizes properly. + } + } + +@@ -295,7 +298,7 @@ + } + else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem()) + { +- ++this.furnaceItemStacks[2].stackSize; ++ this.furnaceItemStacks[2].stackSize += itemstack.stackSize; // Forge BugFix: Results may have multiple items + } + + if (this.furnaceItemStacks[0].getItem() == Item.getItemFromBlock(Blocks.sponge) && this.furnaceItemStacks[0].getMetadata() == 1 && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].getItem() == Items.bucket) +@@ -342,7 +345,15 @@ + } + } + +- return item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD") ? 200 : (item == Items.stick ? 100 : (item == Items.coal ? 1600 : (item == Items.lava_bucket ? 20000 : (item == Item.getItemFromBlock(Blocks.sapling) ? 100 : (item == Items.blaze_rod ? 2400 : 0))))))); ++ if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200; ++ if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200; ++ if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200; ++ if (item == Items.stick) return 100; ++ if (item == Items.coal) return 1600; ++ if (item == Items.lava_bucket) return 20000; ++ if (item == Item.getItemFromBlock(Blocks.sapling)) return 100; ++ if (item == Items.blaze_rod) return 2400; ++ return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(p_145952_0_); + } + } + +@@ -451,4 +462,21 @@ + this.furnaceItemStacks[i] = null; + } + } ++ ++ net.minecraftforge.items.IItemHandler handlerTop = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.UP); ++ net.minecraftforge.items.IItemHandler handlerBottom = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.DOWN); ++ net.minecraftforge.items.IItemHandler handlerSide = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.WEST); ++ ++ @Override ++ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) ++ if (facing == EnumFacing.DOWN) ++ return (T) handlerBottom; ++ else if (facing == EnumFacing.UP) ++ return (T) handlerTop; ++ else ++ return (T) handlerSide; ++ return super.getCapability(capability, facing); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch new file mode 100644 index 0000000000..b74a494e6c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch @@ -0,0 +1,62 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java +@@ -260,6 +260,7 @@ + + private boolean transferItemsOut() + { ++ if (net.minecraftforge.items.VanillaInventoryCodeHooks.insertHook(this)) { return true; } + IInventory iinventory = this.getInventoryForHopperTransfer(); + + if (iinventory == null) +@@ -366,6 +367,7 @@ + + public static boolean captureDroppedItems(IHopper p_145891_0_) + { ++ if (net.minecraftforge.items.VanillaInventoryCodeHooks.extractHook(p_145891_0_)) { return true; } + IInventory iinventory = getHopperInventory(p_145891_0_); + + if (iinventory != null) +@@ -515,17 +517,31 @@ + + if (itemstack == null) + { ++ //Forge: BUGFIX: Again, make things respect max stack sizes. ++ int max = Math.min(stack.getMaxStackSize(), inventoryIn.getInventoryStackLimit()); ++ if (max >= stack.stackSize) ++ { + inventoryIn.setInventorySlotContents(index, stack); + stack = null; ++ } ++ else ++ { ++ inventoryIn.setInventorySlotContents(index, stack.splitStack(max)); ++ } + flag = true; + } + else if (canCombine(itemstack, stack)) + { +- int i = stack.getMaxStackSize() - itemstack.stackSize; ++ //Forge: BUGFIX: Again, make things respect max stack sizes. ++ int max = Math.min(stack.getMaxStackSize(), inventoryIn.getInventoryStackLimit()); ++ if (max > itemstack.stackSize) ++ { ++ int i = max - itemstack.stackSize; + int j = Math.min(stack.stackSize, i); + stack.stackSize -= j; + itemstack.stackSize += j; + flag = j > 0; ++ } + } + + if (flag) +@@ -668,4 +684,10 @@ + this.inventory[i] = null; + } + } ++ ++ ++ protected net.minecraftforge.items.IItemHandler createUnSidedHandler() ++ { ++ return new net.minecraftforge.items.VanillaHopperItemHandler(this); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch new file mode 100644 index 0000000000..d62f80aaf4 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityLockable.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityLockable.java +@@ -47,4 +47,25 @@ + { + return (IChatComponent)(this.hasCustomName() ? new ChatComponentText(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); + } ++ ++ private net.minecraftforge.items.IItemHandler itemHandler; ++ ++ protected net.minecraftforge.items.IItemHandler createUnSidedHandler() ++ { ++ return new net.minecraftforge.items.wrapper.InvWrapper(this); ++ } ++ ++ @Override ++ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) ++ return (T) (itemHandler == null ? (itemHandler = createUnSidedHandler()) : itemHandler); ++ return super.getCapability(capability, facing); ++ } ++ ++ @Override ++ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch new file mode 100644 index 0000000000..01099d4508 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityNote.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityNote.java +@@ -27,7 +27,9 @@ + + public void changePitch() + { ++ byte old = note; + this.note = (byte)((this.note + 1) % 25); ++ if (!net.minecraftforge.common.ForgeHooks.onNoteChange(this, old)) return; + this.markDirty(); + } + diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch new file mode 100644 index 0000000000..4595567a7b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityPiston.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityPiston.java +@@ -148,7 +148,8 @@ + if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) + { + this.worldObj.setBlockState(this.pos, this.pistonState, 3); +- this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); ++ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldObj, pos, worldObj.getBlockState(pos), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) ++ this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); + } + } + } +@@ -166,7 +167,8 @@ + if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) + { + this.worldObj.setBlockState(this.pos, this.pistonState, 3); +- this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); ++ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldObj, pos, worldObj.getBlockState(pos), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) ++ this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); + } + } + else diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch new file mode 100644 index 0000000000..b95942d3ed --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntitySign.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntitySign.java +@@ -61,7 +61,7 @@ + } + public boolean canCommandSenderUseCommand(int permLevel, String commandName) + { +- return true; ++ return permLevel <= 2; //Forge: Fixes MC-75630 - Exploit with signs and command blocks + } + public BlockPos getPosition() + { diff --git a/patches.mcp/minecraft/net/minecraft/util/BlockPos.java.patch b/patches.mcp/minecraft/net/minecraft/util/BlockPos.java.patch new file mode 100644 index 0000000000..d8fbe33d7e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/BlockPos.java.patch @@ -0,0 +1,32 @@ +--- ../src-base/minecraft/net/minecraft/util/BlockPos.java ++++ ../src-work/minecraft/net/minecraft/util/BlockPos.java +@@ -257,6 +257,21 @@ + }; + } + ++ /** ++ * Returns a version of this BlockPos that is guaranteed to be Immutable. ++ * In most cases this will return 'this', but if 'this' is an instance of ++ * MutableBlockPos it will return a new instance of BlockPos with the same values. ++ * ++ * When storing a parameter given to you for an extended period of time, make sure you ++ * use this in case the value is changed internally. ++ * ++ * @return An immutable BlockPos. ++ */ ++ public BlockPos getImmutable() ++ { ++ return this; ++ } ++ + public static final class MutableBlockPos extends BlockPos + { + private int x; +@@ -298,5 +313,7 @@ + this.z = zIn; + return this; + } ++ ++ @Override public BlockPos getImmutable() { return new BlockPos(this); } + } + } diff --git a/patches.mcp/minecraft/net/minecraft/util/ChatComponentStyle.java.patch b/patches.mcp/minecraft/net/minecraft/util/ChatComponentStyle.java.patch new file mode 100644 index 0000000000..a694725b19 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/ChatComponentStyle.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/util/ChatComponentStyle.java ++++ ../src-work/minecraft/net/minecraft/util/ChatComponentStyle.java +@@ -74,7 +74,6 @@ + return stringbuilder.toString(); + } + +- @SideOnly(Side.CLIENT) + public final String getFormattedText() + { + StringBuilder stringbuilder = new StringBuilder(); diff --git a/patches.mcp/minecraft/net/minecraft/util/ChatStyle.java.patch b/patches.mcp/minecraft/net/minecraft/util/ChatStyle.java.patch new file mode 100644 index 0000000000..f9f7a30098 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/ChatStyle.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/util/ChatStyle.java ++++ ../src-work/minecraft/net/minecraft/util/ChatStyle.java +@@ -229,7 +229,6 @@ + return this; + } + +- @SideOnly(Side.CLIENT) + public String getFormattingCode() + { + if (this.isEmpty()) diff --git a/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch b/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch new file mode 100644 index 0000000000..5f5717bf96 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch @@ -0,0 +1,67 @@ +--- ../src-base/minecraft/net/minecraft/util/EnumFacing.java ++++ ../src-work/minecraft/net/minecraft/util/EnumFacing.java +@@ -6,8 +6,6 @@ + import java.util.Iterator; + import java.util.Map; + import java.util.Random; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + + public enum EnumFacing implements IStringSerializable + { +@@ -60,7 +58,6 @@ + return getFront(this.opposite); + } + +- @SideOnly(Side.CLIENT) + public EnumFacing rotateAround(EnumFacing.Axis axis) + { + switch (axis) +@@ -111,7 +108,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + private EnumFacing rotateX() + { + switch (this) +@@ -131,7 +127,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + private EnumFacing rotateZ() + { + switch (this) +@@ -192,7 +187,6 @@ + return this.axis; + } + +- @SideOnly(Side.CLIENT) + public static EnumFacing byName(String name) + { + return name == null ? null : (EnumFacing)NAME_LOOKUP.get(name.toLowerCase()); +@@ -218,7 +212,6 @@ + return values()[rand.nextInt(values().length)]; + } + +- @SideOnly(Side.CLIENT) + public static EnumFacing getFacingFromVector(float p_176737_0_, float p_176737_1_, float p_176737_2_) + { + EnumFacing enumfacing = NORTH; +@@ -261,7 +254,6 @@ + throw new IllegalArgumentException("No such direction: " + p_181076_0_ + " " + p_181076_1_); + } + +- @SideOnly(Side.CLIENT) + public Vec3i getDirectionVec() + { + return this.directionVec; +@@ -297,7 +289,6 @@ + this.plane = plane; + } + +- @SideOnly(Side.CLIENT) + public static EnumFacing.Axis byName(String name) + { + return name == null ? null : (EnumFacing.Axis)NAME_LOOKUP.get(name.toLowerCase()); diff --git a/patches.mcp/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch b/patches.mcp/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch new file mode 100644 index 0000000000..7bb192c6d1 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/util/EnumWorldBlockLayer.java ++++ ../src-work/minecraft/net/minecraft/util/EnumWorldBlockLayer.java +@@ -1,9 +1,5 @@ + package net.minecraft.util; + +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; +- +-@SideOnly(Side.CLIENT) + public enum EnumWorldBlockLayer + { + SOLID("Solid"), diff --git a/patches.mcp/minecraft/net/minecraft/util/IChatComponent.java.patch b/patches.mcp/minecraft/net/minecraft/util/IChatComponent.java.patch new file mode 100644 index 0000000000..6a73ab2ebb --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/IChatComponent.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/util/IChatComponent.java ++++ ../src-work/minecraft/net/minecraft/util/IChatComponent.java +@@ -31,7 +31,6 @@ + + String getUnformattedText(); + +- @SideOnly(Side.CLIENT) + String getFormattedText(); + + List getSiblings(); diff --git a/patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch b/patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch new file mode 100644 index 0000000000..7c04c79199 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/util/MouseHelper.java ++++ ../src-work/minecraft/net/minecraft/util/MouseHelper.java +@@ -13,6 +13,7 @@ + + public void grabMouseCursor() + { ++ if (Boolean.parseBoolean(System.getProperty("fml.noGrab","false"))) return; + Mouse.setGrabbed(true); + this.deltaX = 0; + this.deltaY = 0; diff --git a/patches.mcp/minecraft/net/minecraft/util/MovingObjectPosition.java.patch b/patches.mcp/minecraft/net/minecraft/util/MovingObjectPosition.java.patch new file mode 100644 index 0000000000..56494d05e6 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/MovingObjectPosition.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/util/MovingObjectPosition.java ++++ ../src-work/minecraft/net/minecraft/util/MovingObjectPosition.java +@@ -10,6 +10,12 @@ + public Vec3 hitVec; + public Entity entityHit; + ++ /** Used to determine what sub-segment is hit */ ++ public int subHit = -1; ++ ++ /** Used to add extra hit info */ ++ public Object hitInfo = null; ++ + public MovingObjectPosition(Vec3 hitVecIn, EnumFacing facing, BlockPos blockPosIn) + { + this(MovingObjectPosition.MovingObjectType.BLOCK, hitVecIn, facing, blockPosIn); diff --git a/patches.mcp/minecraft/net/minecraft/util/ResourceLocation.java.patch b/patches.mcp/minecraft/net/minecraft/util/ResourceLocation.java.patch new file mode 100644 index 0000000000..737a367859 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/ResourceLocation.java.patch @@ -0,0 +1,26 @@ +--- ../src-base/minecraft/net/minecraft/util/ResourceLocation.java ++++ ../src-work/minecraft/net/minecraft/util/ResourceLocation.java +@@ -1,7 +1,5 @@ + package net.minecraft.util; + +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.Validate; + + public class ResourceLocation +@@ -21,7 +19,6 @@ + this(0, splitObjectName(resourceName)); + } + +- @SideOnly(Side.CLIENT) + public ResourceLocation(String resourceDomainIn, String resourcePathIn) + { + this(0, new String[] {resourceDomainIn, resourcePathIn}); +@@ -50,7 +47,6 @@ + return this.resourcePath; + } + +- @SideOnly(Side.CLIENT) + public String getResourceDomain() + { + return this.resourceDomain; diff --git a/patches.mcp/minecraft/net/minecraft/util/Session.java.patch b/patches.mcp/minecraft/net/minecraft/util/Session.java.patch new file mode 100644 index 0000000000..48492d58dc --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/Session.java.patch @@ -0,0 +1,72 @@ +--- ../src-base/minecraft/net/minecraft/util/Session.java ++++ ../src-work/minecraft/net/minecraft/util/Session.java +@@ -5,6 +5,8 @@ + import com.mojang.util.UUIDTypeAdapter; + import java.util.Map; + import java.util.UUID; ++ ++import net.minecraftforge.fml.common.FMLLog; + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +@@ -15,9 +17,24 @@ + private final String playerID; + private final String token; + private final Session.Type sessionType; ++ /** Forge: Cache of the local session's GameProfile properties. */ ++ private com.mojang.authlib.properties.PropertyMap properties; + + public Session(String usernameIn, String playerIDIn, String tokenIn, String sessionTypeIn) + { ++ if (usernameIn == null || usernameIn.isEmpty()) ++ { ++ usernameIn = "MissingName"; ++ playerIDIn = tokenIn = "NotValid"; ++ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "========================================================="); ++ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "WARNING!! the username was not set for this session, typically"); ++ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "this means you installed Forge incorrectly. We have set your"); ++ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "name to \"MissingName\" and your session to nothing. Please"); ++ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "check your installation and post a console log from the launcher"); ++ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "when asking for help!"); ++ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "========================================================="); ++ } ++ + this.username = usernameIn; + this.playerID = playerIDIn; + this.token = tokenIn; +@@ -49,11 +66,13 @@ + try + { + UUID uuid = UUIDTypeAdapter.fromString(this.getPlayerID()); +- return new GameProfile(uuid, this.getUsername()); ++ GameProfile ret = new GameProfile(uuid, this.getUsername()); //Forge: Adds cached GameProfile properties to returned GameProfile. ++ if (properties != null) ret.getProperties().putAll(properties); // Helps to cut down on calls to the session service, ++ return ret; // which helps to fix MC-52974. + } + catch (IllegalArgumentException var2) + { +- return new GameProfile((UUID)null, this.getUsername()); ++ return new GameProfile(net.minecraft.entity.player.EntityPlayer.getUUID(new GameProfile((UUID)null, this.getUsername())), this.getUsername()); + } + } + +@@ -62,6 +81,19 @@ + return this.sessionType; + } + ++ /* ======================================== FORGE START ===================================== */ ++ //For internal use only. Modders should never need to use this. ++ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) ++ { ++ if(this.properties == null) this.properties = properties; ++ } ++ ++ public boolean hasCachedProperties() ++ { ++ return properties != null; ++ } ++ /* ========================================= FORGE END ====================================== */ ++ + @SideOnly(Side.CLIENT) + public static enum Type + { diff --git a/patches.mcp/minecraft/net/minecraft/util/StringTranslate.java.patch b/patches.mcp/minecraft/net/minecraft/util/StringTranslate.java.patch new file mode 100644 index 0000000000..f6d51a843f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/StringTranslate.java.patch @@ -0,0 +1,54 @@ +--- ../src-base/minecraft/net/minecraft/util/StringTranslate.java ++++ ../src-work/minecraft/net/minecraft/util/StringTranslate.java +@@ -23,9 +23,29 @@ + + public StringTranslate() + { ++ InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); ++ inject(this, inputstream); ++ } ++ ++ public static void inject(InputStream inputstream) ++ { ++ inject(instance, inputstream); ++ } ++ ++ private static void inject(StringTranslate inst, InputStream inputstream) ++ { ++ java.util.HashMap map = parseLangFile(inputstream); ++ inst.languageList.putAll(map); ++ inst.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); ++ } ++ ++ public static java.util.HashMap parseLangFile(InputStream inputstream) ++ { ++ java.util.HashMap table = Maps.newHashMap(); + try + { +- InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); ++ inputstream = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(table, inputstream); ++ if (inputstream == null) return table; + + for (String s : IOUtils.readLines(inputstream, Charsets.UTF_8)) + { +@@ -37,17 +57,17 @@ + { + String s1 = astring[0]; + String s2 = numericVariablePattern.matcher(astring[1]).replaceAll("%$1s"); +- this.languageList.put(s1, s2); ++ table.put(s1, s2); + } + } + } + +- this.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); + } +- catch (IOException var7) ++ catch (Exception var7) + { + ; + } ++ return table; + } + + static StringTranslate getInstance() diff --git a/patches.mcp/minecraft/net/minecraft/util/Vec3.java.patch b/patches.mcp/minecraft/net/minecraft/util/Vec3.java.patch new file mode 100644 index 0000000000..43a23f3c84 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/Vec3.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/util/Vec3.java ++++ ../src-work/minecraft/net/minecraft/util/Vec3.java +@@ -1,8 +1,5 @@ + package net.minecraft.util; + +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; +- + public class Vec3 + { + public final double xCoord; +@@ -36,7 +33,6 @@ + this((double)p_i46377_1_.getX(), (double)p_i46377_1_.getY(), (double)p_i46377_1_.getZ()); + } + +- @SideOnly(Side.CLIENT) + public Vec3 subtractReverse(Vec3 vec) + { + return new Vec3(vec.xCoord - this.xCoord, vec.yCoord - this.yCoord, vec.zCoord - this.zCoord); +@@ -53,7 +49,6 @@ + return this.xCoord * vec.xCoord + this.yCoord * vec.yCoord + this.zCoord * vec.zCoord; + } + +- @SideOnly(Side.CLIENT) + public Vec3 crossProduct(Vec3 vec) + { + return new Vec3(this.yCoord * vec.zCoord - this.zCoord * vec.yCoord, this.zCoord * vec.xCoord - this.xCoord * vec.zCoord, this.xCoord * vec.yCoord - this.yCoord * vec.xCoord); +@@ -79,7 +74,6 @@ + return new Vec3(this.xCoord + x, this.yCoord + y, this.zCoord + z); + } + +- @SideOnly(Side.CLIENT) + public double distanceTo(Vec3 vec) + { + double d0 = vec.xCoord - this.xCoord; diff --git a/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch b/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch new file mode 100644 index 0000000000..5c01e52079 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch @@ -0,0 +1,68 @@ +--- ../src-base/minecraft/net/minecraft/util/WeightedRandomChestContent.java ++++ ../src-work/minecraft/net/minecraft/util/WeightedRandomChestContent.java +@@ -36,48 +36,39 @@ + for (int i = 0; i < max; ++i) + { + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, listIn); +- int j = weightedrandomchestcontent.minStackSize + random.nextInt(weightedrandomchestcontent.maxStackSize - weightedrandomchestcontent.minStackSize + 1); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, inv); + +- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j) ++ for (ItemStack itemstack1 : stacks) + { +- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); +- itemstack1.stackSize = j; + inv.setInventorySlotContents(random.nextInt(inv.getSizeInventory()), itemstack1); + } +- else +- { +- for (int k = 0; k < j; ++k) +- { +- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); +- itemstack.stackSize = 1; +- inv.setInventorySlotContents(random.nextInt(inv.getSizeInventory()), itemstack); +- } +- } + } + } + ++ // -- Forge hooks ++ /** ++ * Allow a mod to submit a custom implementation that can delegate item stack generation beyond simple stack lookup ++ * ++ * @param random The current random for generation ++ * @param newInventory The inventory being generated (do not populate it, but you can refer to it) ++ * @return An array of {@link ItemStack} to put into the chest ++ */ ++ protected ItemStack[] generateChestContent(Random random, IInventory newInventory) ++ { ++ return net.minecraftforge.common.ChestGenHooks.generateStacks(random, theItemId, minStackSize, maxStackSize); ++ } ++ + public static void generateDispenserContents(Random random, List listIn, TileEntityDispenser dispenser, int max) + { + for (int i = 0; i < max; ++i) + { + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, listIn); +- int j = weightedrandomchestcontent.minStackSize + random.nextInt(weightedrandomchestcontent.maxStackSize - weightedrandomchestcontent.minStackSize + 1); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, dispenser); + +- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j) ++ for (ItemStack itemstack1 : stacks) + { +- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); +- itemstack1.stackSize = j; + dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack1); + } +- else +- { +- for (int k = 0; k < j; ++k) +- { +- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); +- itemstack.stackSize = 1; +- dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack); +- } +- } + } + } + diff --git a/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch new file mode 100644 index 0000000000..c8595ac68b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch @@ -0,0 +1,54 @@ +--- ../src-base/minecraft/net/minecraft/world/ChunkCache.java ++++ ../src-work/minecraft/net/minecraft/world/ChunkCache.java +@@ -61,6 +61,8 @@ + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; ++ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return null; ++ if (chunkArray[i][j] == null) return null; + return this.chunkArray[i][j].getTileEntity(pos, Chunk.EnumCreateEntityType.IMMEDIATE); + } + +@@ -139,6 +141,8 @@ + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; ++ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return p_175629_1_.defaultLightValue; ++ if (chunkArray[i][j] == null) return p_175629_1_.defaultLightValue; + return this.chunkArray[i][j].getLightFor(p_175629_1_, pos); + } + } +@@ -150,7 +154,7 @@ + + public boolean isAirBlock(BlockPos pos) + { +- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; ++ return this.getBlockState(pos).getBlock().isAir(this, pos); + } + + @SideOnly(Side.CLIENT) +@@ -160,6 +164,7 @@ + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; ++ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return p_175628_1_.defaultLightValue; + return this.chunkArray[i][j].getLightFor(p_175628_1_, pos); + } + else +@@ -179,4 +184,16 @@ + { + return this.worldObj.getWorldType(); + } ++ ++ @Override ++ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) ++ { ++ int x = (pos.getX() >> 4) - this.chunkX; ++ int z = (pos.getZ() >> 4) - this.chunkZ; ++ if (pos.getY() >= 0 && pos.getY() < 256) return _default; ++ if (x < 0 || x >= chunkArray.length || z < 0 || z >= chunkArray[x].length) return _default; ++ if (chunkArray[x][z] == null) return _default; ++ ++ return getBlockState(pos).getBlock().isSideSolid(this, pos, side); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch b/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch new file mode 100644 index 0000000000..5e8458644a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch @@ -0,0 +1,52 @@ +--- ../src-base/minecraft/net/minecraft/world/Explosion.java ++++ ../src-work/minecraft/net/minecraft/world/Explosion.java +@@ -38,6 +38,7 @@ + private final float explosionSize; + private final List affectedBlockPositions; + private final Map playerKnockbackMap; ++ private final Vec3 position; + + @SideOnly(Side.CLIENT) + public Explosion(World worldIn, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) +@@ -65,6 +66,7 @@ + this.explosionZ = p_i45754_7_; + this.isFlaming = p_i45754_10_; + this.isSmoking = p_i45754_11_; ++ this.position = new Vec3(explosionX, explosionY, explosionZ); + } + + public void doExplosionA() +@@ -99,7 +101,7 @@ + + if (iblockstate.getBlock().getMaterial() != Material.air) + { +- float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance((Entity)null); ++ float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance(worldObj, blockpos, (Entity)null, this); + f -= (f2 + 0.3F) * 0.3F; + } + +@@ -126,6 +128,7 @@ + int j2 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D); + int j1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); ++ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3); + Vec3 vec3 = new Vec3(this.explosionX, this.explosionY, this.explosionZ); + + for (int k2 = 0; k2 < list.size(); ++k2) +@@ -213,8 +216,7 @@ + block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos), 1.0F / this.explosionSize, 0); + } + +- this.worldObj.setBlockState(blockpos, Blocks.air.getDefaultState(), 3); +- block.onBlockDestroyedByExplosion(this.worldObj, blockpos, this); ++ block.onBlockExploded(this.worldObj, blockpos, this); + } + } + } +@@ -250,4 +252,6 @@ + { + return this.affectedBlockPositions; + } ++ ++ public Vec3 getPosition(){ return this.position; } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch b/patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch new file mode 100644 index 0000000000..7fb64f305a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/IBlockAccess.java ++++ ../src-work/minecraft/net/minecraft/world/IBlockAccess.java +@@ -29,4 +29,14 @@ + + @SideOnly(Side.CLIENT) + WorldType getWorldType(); ++ ++ /** ++ * FORGE: isSideSolid, pulled up from {@link World} ++ * ++ * @param pos Position ++ * @param side Side ++ * @param _default default return value ++ * @return if the block is solid on the side ++ */ ++ boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/SpawnerAnimals.java.patch b/patches.mcp/minecraft/net/minecraft/world/SpawnerAnimals.java.patch new file mode 100644 index 0000000000..135ef3d399 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/SpawnerAnimals.java.patch @@ -0,0 +1,51 @@ +--- ../src-base/minecraft/net/minecraft/world/SpawnerAnimals.java ++++ ../src-work/minecraft/net/minecraft/world/SpawnerAnimals.java +@@ -69,14 +69,15 @@ + { + if ((!enumcreaturetype.getPeacefulCreature() || spawnPeacefulMobs) && (enumcreaturetype.getPeacefulCreature() || spawnHostileMobs) && (!enumcreaturetype.getAnimal() || p_77192_4_)) + { +- int j4 = worldServerIn.countEntities(enumcreaturetype.getCreatureClass()); ++ int j4 = worldServerIn.countEntities(enumcreaturetype, true); + int k4 = enumcreaturetype.getMaxNumberOfCreature() * i / MOB_COUNT_DIV; + + if (j4 <= k4) + { ++ java.util.ArrayList shuffled = com.google.common.collect.Lists.newArrayList(this.eligibleChunksForSpawning); ++ java.util.Collections.shuffle(shuffled); + label374: +- +- for (ChunkCoordIntPair chunkcoordintpair1 : this.eligibleChunksForSpawning) ++ for (ChunkCoordIntPair chunkcoordintpair1 : shuffled) + { + BlockPos blockpos = getRandomChunkPosition(worldServerIn, chunkcoordintpair1.chunkXPos, chunkcoordintpair1.chunkZPos); + int k1 = blockpos.getX(); +@@ -134,8 +135,10 @@ + + entityliving.setLocationAndAngles((double)f, (double)i3, (double)f1, worldServerIn.rand.nextFloat() * 360.0F, 0.0F); + +- if (entityliving.getCanSpawnHere() && entityliving.isNotColliding()) ++ net.minecraftforge.fml.common.eventhandler.Event.Result canSpawn = net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(entityliving, worldServerIn, f, i3, f1); ++ if (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT && (entityliving.getCanSpawnHere() && entityliving.isNotColliding()))) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, worldServerIn, f, l3, f1)) + ientitylivingdata = entityliving.onInitialSpawn(worldServerIn.getDifficultyForLocation(new BlockPos(entityliving)), ientitylivingdata); + + if (entityliving.isNotColliding()) +@@ -144,7 +147,7 @@ + worldServerIn.spawnEntityInWorld(entityliving); + } + +- if (j2 >= entityliving.getMaxSpawnedInChunk()) ++ if (i2 >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(entityliving)) + { + continue label374; + } +@@ -193,7 +196,7 @@ + { + BlockPos blockpos = pos.down(); + +- if (!World.doesBlockHaveSolidTopSurface(worldIn, blockpos)) ++ if (!worldIn.getBlockState(blockpos).getBlock().canCreatureSpawn(worldIn, blockpos, spawnPlacementTypeIn)) + { + return false; + } diff --git a/patches.mcp/minecraft/net/minecraft/world/World.java.patch b/patches.mcp/minecraft/net/minecraft/world/World.java.patch new file mode 100644 index 0000000000..273dc98c57 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/World.java.patch @@ -0,0 +1,909 @@ +--- ../src-base/minecraft/net/minecraft/world/World.java ++++ ../src-work/minecraft/net/minecraft/world/World.java +@@ -57,6 +57,13 @@ + + public abstract class World implements IBlockAccess + { ++ /** ++ * Used in the getEntitiesWithinAABB functions to expand the search area for entities. ++ * Modders should change this variable to a higher value if it is less then the radius ++ * of one of there entities. ++ */ ++ public static double MAX_ENTITY_RADIUS = 2.0D; ++ + private int seaLevel = 63; + protected boolean scheduledUpdatesAreImmediate; + public final List loadedEntityList = Lists.newArrayList(); +@@ -98,6 +105,10 @@ + private final WorldBorder worldBorder; + int[] lightUpdateBlockList; + ++ public boolean restoringBlockSnapshots = false; ++ public boolean captureBlockSnapshots = false; ++ public java.util.ArrayList capturedBlockSnapshots = new java.util.ArrayList(); ++ + protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) + { + this.ambientTickCountdown = this.rand.nextInt(12000); +@@ -110,6 +121,7 @@ + this.provider = providerIn; + this.isRemote = client; + this.worldBorder = providerIn.getWorldBorder(); ++ perWorldStorage = new MapStorage((ISaveHandler)null); + } + + public World init() +@@ -119,6 +131,11 @@ + + public BiomeGenBase getBiomeGenForCoords(final BlockPos pos) + { ++ return this.provider.getBiomeGenForCoords(pos); ++ } ++ ++ public BiomeGenBase getBiomeGenForCoordsBody(final BlockPos pos) ++ { + if (this.isBlockLoaded(pos)) + { + Chunk chunk = this.getChunkFromBlockCoords(pos); +@@ -184,7 +201,7 @@ + + public boolean isAirBlock(BlockPos pos) + { +- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; ++ return this.getBlockState(pos).getBlock().isAir(this, pos); + } + + public boolean isBlockLoaded(BlockPos pos) +@@ -284,39 +301,63 @@ + { + Chunk chunk = this.getChunkFromBlockCoords(pos); + Block block = newState.getBlock(); ++ ++ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; ++ if (this.captureBlockSnapshots && !this.isRemote) ++ { ++ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, pos, flags); ++ this.capturedBlockSnapshots.add(blockSnapshot); ++ } ++ Block oldBlock = getBlockState(pos).getBlock(); ++ int oldLight = oldBlock.getLightValue(this, pos); ++ int oldOpacity = oldBlock.getLightOpacity(this, pos); ++ + IBlockState iblockstate = chunk.setBlockState(pos, newState); + + if (iblockstate == null) + { ++ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); + return false; + } + else + { + Block block1 = iblockstate.getBlock(); + +- if (block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue() != block1.getLightValue()) ++ if (block.getLightOpacity(this, pos) != oldOpacity || block.getLightValue(this, pos) != oldLight) + { + this.theProfiler.startSection("checkLight"); + this.checkLight(pos); + this.theProfiler.endSection(); + } + +- if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && chunk.isPopulated()) ++ if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates + { +- this.markBlockForUpdate(pos); ++ this.markAndNotifyBlock(pos, chunk, iblockstate, newState, flags); // Modularize client and physic updates + } + ++ return true; ++ } ++ } ++ } ++ ++ // Split off from original setBlockState(BlockPos, IBlockState Block p_147465_4_, int) method in order to directly send client and physic updates ++ public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState old, IBlockState new_, int flags) ++ { ++ if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && (chunk == null || chunk.isPopulated())) ++ { ++ this.markBlockForUpdate(pos); ++ } ++ { ++ { + if (!this.isRemote && (flags & 1) != 0) + { +- this.notifyNeighborsRespectDebug(pos, iblockstate.getBlock()); ++ this.notifyNeighborsRespectDebug(pos, new_.getBlock()); + +- if (block.hasComparatorInputOverride()) ++ if (new_.getBlock().hasComparatorInputOverride()) + { +- this.updateComparatorOutputLevel(pos, block); ++ this.updateComparatorOutputLevel(pos, new_.getBlock()); + } + } +- +- return true; + } + } + } +@@ -404,6 +445,9 @@ + + public void notifyNeighborsOfStateChange(BlockPos pos, Block blockType) + { ++ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), java.util.EnumSet.allOf(EnumFacing.class)).isCanceled()) ++ return; ++ + this.notifyBlockOfStateChange(pos.west(), blockType); + this.notifyBlockOfStateChange(pos.east(), blockType); + this.notifyBlockOfStateChange(pos.down(), blockType); +@@ -414,6 +458,11 @@ + + public void notifyNeighborsOfStateExcept(BlockPos pos, Block blockType, EnumFacing skipSide) + { ++ java.util.EnumSet directions = java.util.EnumSet.allOf(EnumFacing.class); ++ directions.remove(skipSide); ++ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), directions).isCanceled()) ++ return; ++ + if (skipSide != EnumFacing.WEST) + { + this.notifyBlockOfStateChange(pos.west(), blockType); +@@ -777,7 +826,7 @@ + + public boolean isDaytime() + { +- return this.skylightSubtracted < 4; ++ return this.provider.isDaytime(); + } + + public MovingObjectPosition rayTraceBlocks(Vec3 p_72933_1_, Vec3 p_72933_2_) +@@ -972,6 +1021,12 @@ + + public void playSoundAtEntity(Entity entityIn, String name, float volume, float pitch) + { ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(entityIn, name, volume, pitch); ++ if (event.isCanceled() || event.name == null) return; ++ name = event.name; ++ volume = event.newVolume; ++ pitch = event.newPitch; ++ + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).playSound(name, entityIn.posX, entityIn.posY, entityIn.posZ, volume, pitch); +@@ -980,6 +1035,12 @@ + + public void playSoundToNearExcept(EntityPlayer player, String name, float volume, float pitch) + { ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(player, name, volume, pitch); ++ if (event.isCanceled() || event.name == null) return; ++ name = event.name; ++ volume = event.newVolume; ++ pitch = event.newPitch; ++ + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).playSoundToNearExcept(player, name, player.posX, player.posY, player.posZ, volume, pitch); +@@ -1033,6 +1094,9 @@ + + public boolean spawnEntityInWorld(Entity entityIn) + { ++ // do not drop any items while restoring blocksnapshots. Prevents dupes ++ if (!this.isRemote && (entityIn == null || (entityIn instanceof net.minecraft.entity.item.EntityItem && this.restoringBlockSnapshots))) return false; ++ + int i = MathHelper.floor_double(entityIn.posX / 16.0D); + int j = MathHelper.floor_double(entityIn.posZ / 16.0D); + boolean flag = entityIn.forceSpawn; +@@ -1055,6 +1119,8 @@ + this.updateAllPlayersSleepingFlag(); + } + ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entityIn, this)) && !flag) return false; ++ + this.getChunkFromChunkCoords(i, j).addEntity(entityIn); + this.loadedEntityList.add(entityIn); + this.onEntityAdded(entityIn); +@@ -1267,17 +1333,29 @@ + + public int calculateSkylightSubtracted(float p_72967_1_) + { ++ float f = provider.getSunBrightnessFactor(p_72967_1_); ++ f = 1 - f; ++ return (int)(f * 11); ++ } ++ ++ /** ++ * The current sun brightness factor for this dimension. ++ * 0.0f means no light at all, and 1.0f means maximum sunlight. ++ * Highly recommended for sunlight detection like solar panel. ++ * ++ * @return The current brightness factor ++ * */ ++ public float getSunBrightnessFactor(float p_72967_1_) ++ { + float f = this.getCelestialAngle(p_72967_1_); + float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F); + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); + f1 = 1.0F - f1; + f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength(p_72967_1_) * 5.0F) / 16.0D)); + f1 = (float)((double)f1 * (1.0D - (double)(this.getThunderStrength(p_72967_1_) * 5.0F) / 16.0D)); +- f1 = 1.0F - f1; +- return (int)(f1 * 11.0F); ++ return f1; + } + +- @SideOnly(Side.CLIENT) + public void removeWorldAccess(IWorldAccess worldAccess) + { + this.worldAccesses.remove(worldAccess); +@@ -1286,6 +1364,12 @@ + @SideOnly(Side.CLIENT) + public float getSunBrightness(float p_72971_1_) + { ++ return this.provider.getSunBrightness(p_72971_1_); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public float getSunBrightnessBody(float p_72971_1_) ++ { + float f = this.getCelestialAngle(p_72971_1_); + float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.2F); + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); +@@ -1298,6 +1382,12 @@ + @SideOnly(Side.CLIENT) + public Vec3 getSkyColor(Entity entityIn, float partialTicks) + { ++ return this.provider.getSkyColor(entityIn, partialTicks); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public Vec3 getSkyColorBody(Entity entityIn, float partialTicks) ++ { + float f = this.getCelestialAngle(partialTicks); + float f1 = MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); +@@ -1305,9 +1395,7 @@ + int j = MathHelper.floor_double(entityIn.posY); + int k = MathHelper.floor_double(entityIn.posZ); + BlockPos blockpos = new BlockPos(i, j, k); +- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(blockpos); +- float f2 = biomegenbase.getFloatTemperature(blockpos); +- int l = biomegenbase.getSkyColorByTemp(f2); ++ int l = net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(this, blockpos); + float f3 = (float)(l >> 16 & 255) / 255.0F; + float f4 = (float)(l >> 8 & 255) / 255.0F; + float f5 = (float)(l & 255) / 255.0F; +@@ -1367,6 +1455,11 @@ + + public float getCurrentMoonPhaseFactor() + { ++ return provider.getCurrentMoonPhaseFactor(); ++ } ++ ++ public float getCurrentMoonPhaseFactorBody() ++ { + return WorldProvider.moonPhaseFactors[this.provider.getMoonPhase(this.worldInfo.getWorldTime())]; + } + +@@ -1379,6 +1472,12 @@ + @SideOnly(Side.CLIENT) + public Vec3 getCloudColour(float partialTicks) + { ++ return this.provider.drawClouds(partialTicks); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public Vec3 drawCloudsBody(float partialTicks) ++ { + float f = this.getCelestialAngle(partialTicks); + float f1 = MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); +@@ -1434,9 +1533,9 @@ + for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1) + { + blockpos1 = blockpos.down(); +- Material material = chunk.getBlock(blockpos1).getMaterial(); ++ Block block = chunk.getBlock(blockpos1); + +- if (material.blocksMovement() && material != Material.leaves) ++ if (block.getMaterial().blocksMovement() && !block.isLeaves(this, blockpos1) && !block.isFoliage(this, blockpos1)) + { + break; + } +@@ -1448,6 +1547,12 @@ + @SideOnly(Side.CLIENT) + public float getStarBrightness(float partialTicks) + { ++ return this.provider.getStarBrightness(partialTicks); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public float getStarBrightnessBody(float partialTicks) ++ { + float f = this.getCelestialAngle(partialTicks); + float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.25F); + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); +@@ -1494,7 +1599,15 @@ + entity.addEntityCrashInfo(crashreportcategory); + } + +- throw new ReportedException(crashreport); ++ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe(crashreport.getCompleteReport()); ++ removeEntity(entity); ++ } ++ else ++ { ++ throw new ReportedException(crashreport); ++ } + } + + if (entity.isDead) +@@ -1554,7 +1667,15 @@ + CrashReport crashreport1 = CrashReport.makeCrashReport(throwable1, "Ticking entity"); + CrashReportCategory crashreportcategory2 = crashreport1.makeCategory("Entity being ticked"); + entity2.addEntityCrashInfo(crashreportcategory2); +- throw new ReportedException(crashreport1); ++ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe(crashreport1.getCompleteReport()); ++ removeEntity(entity2); ++ } ++ else ++ { ++ throw new ReportedException(crashreport1); ++ } + } + } + +@@ -1601,7 +1722,16 @@ + CrashReport crashreport2 = CrashReport.makeCrashReport(throwable, "Ticking block entity"); + CrashReportCategory crashreportcategory1 = crashreport2.makeCategory("Block entity being ticked"); + tileentity.addInfoToCrashReport(crashreportcategory1); +- throw new ReportedException(crashreport2); ++ if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe(crashreport2.getCompleteReport()); ++ tileentity.invalidate(); ++ this.removeTileEntity(tileentity.getPos()); ++ } ++ else ++ { ++ throw new ReportedException(crashreport2); ++ } + } + } + } +@@ -1618,15 +1748,20 @@ + } + } + +- this.processingLoadedTiles = false; +- + if (!this.tileEntitiesToBeRemoved.isEmpty()) + { ++ for (Object tile : tileEntitiesToBeRemoved) ++ { ++ ((TileEntity)tile).onChunkUnload(); ++ } ++ + this.tickableTileEntities.removeAll(this.tileEntitiesToBeRemoved); + this.loadedTileEntityList.removeAll(this.tileEntitiesToBeRemoved); + this.tileEntitiesToBeRemoved.clear(); + } + ++ this.processingLoadedTiles = false; //FML Move below remove to prevent CMEs ++ + this.theProfiler.endStartSection("pendingBlockEntities"); + + if (!this.addedTileEntityList.isEmpty()) +@@ -1660,7 +1795,8 @@ + + public boolean addTileEntity(TileEntity tile) + { +- boolean flag = this.loadedTileEntityList.add(tile); ++ List dest = processingLoadedTiles ? addedTileEntityList : loadedTileEntityList; ++ boolean flag = dest.add(tile); + + if (flag && tile instanceof ITickable) + { +@@ -1699,9 +1835,13 @@ + { + int i = MathHelper.floor_double(entityIn.posX); + int j = MathHelper.floor_double(entityIn.posZ); +- int k = 32; ++ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(i >> 4, j >> 4)); ++ int k = isForced ? 0 : 32; ++ boolean canUpdate = !forceUpdate || this.isAreaLoaded(i - k, 0, j - k, i + k, 0, j + k, true); + +- if (!forceUpdate || this.isAreaLoaded(i - k, 0, j - k, i + k, 0, j + k, true)) ++ if (!canUpdate) canUpdate = net.minecraftforge.event.ForgeEventFactory.canEntityUpdate(entityIn); ++ ++ if (canUpdate) + { + entityIn.lastTickPosX = entityIn.posX; + entityIn.lastTickPosY = entityIn.posY; +@@ -1829,7 +1969,7 @@ + { + Block block = this.getBlockState(blockpos$mutableblockpos.set(k1, l1, i2)).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(this, new BlockPos(k1, l1, i2))) + { + return true; + } +@@ -1894,6 +2034,10 @@ + { + return true; + } ++ else if (block.isBurning(this, new BlockPos(k1, l1, i2))) ++ { ++ return true; ++ } + } + } + } +@@ -1930,6 +2074,16 @@ + blockpos$mutableblockpos.set(k1, l1, i2); + IBlockState iblockstate = this.getBlockState(blockpos$mutableblockpos); + Block block = iblockstate.getBlock(); ++ ++ Boolean result = block.isEntityInsideMaterial(this, blockpos$mutableblockpos, iblockstate, entityIn, (double)l, materialIn, false); ++ if (result != null && result == true) ++ { ++ // Forge: When requested call blocks modifyAcceleration method, and more importantly cause this method to return true, which results in an entity being "inWater" ++ flag = true; ++ vec3 = block.modifyAcceleration(this, blockpos$mutableblockpos, entityIn, vec3); ++ continue; ++ } ++ else if (result != null && result == false) continue; + + if (block.getMaterial() == materialIn) + { +@@ -2004,6 +2158,9 @@ + IBlockState iblockstate = this.getBlockState(blockpos$mutableblockpos.set(k1, l1, i2)); + Block block = iblockstate.getBlock(); + ++ Boolean result = block.isAABBInsideMaterial(this, blockpos$mutableblockpos, bb, materialIn); ++ if (result != null) return result; ++ + if (block.getMaterial() == materialIn) + { + int j2 = ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue(); +@@ -2034,6 +2191,7 @@ + public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) + { + Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking); ++ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; + explosion.doExplosionA(); + explosion.doExplosionB(true); + return explosion; +@@ -2180,19 +2338,27 @@ + else + { + this.addTileEntity(tileEntityIn); +- this.getChunkFromBlockCoords(pos).addTileEntity(pos, tileEntityIn); ++ Chunk chunk = this.getChunkFromBlockCoords(pos); //Forge add NPE protection ++ if (chunk != null) chunk.addTileEntity(pos, tileEntityIn); + } ++ this.updateComparatorOutputLevel(pos, getBlockState(pos).getBlock()); //Notify neighbors of changes + } + } + + public void removeTileEntity(BlockPos pos) + { ++ //Chunk chunk = this.getChunkFromBlockCoords(pos); ++ //if (chunk != null) chunk.removeTileEntity(pos); ++ //Forge ToDO: Are these patches needed anymore? ++ + TileEntity tileentity = this.getTileEntity(pos); + + if (tileentity != null && this.processingLoadedTiles) + { + tileentity.invalidate(); + this.addedTileEntityList.remove(tileentity); ++ if (!(tileentity instanceof ITickable)) //Forge: If they are not tickable they wont be removed in the update loop. ++ this.loadedTileEntityList.remove(tileentity); + } + else + { +@@ -2205,6 +2371,7 @@ + + this.getChunkFromBlockCoords(pos).removeTileEntity(pos); + } ++ this.updateComparatorOutputLevel(pos, getBlockState(pos).getBlock()); //Notify neighbors of changes + } + + public void markTileEntityForRemoval(TileEntity tileEntityIn) +@@ -2223,7 +2390,7 @@ + { + IBlockState iblockstate = blockAccess.getBlockState(pos); + Block block = iblockstate.getBlock(); +- return block.getMaterial().isOpaque() && block.isFullCube() ? true : (block instanceof BlockStairs ? iblockstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP : (block instanceof BlockSlab ? iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue() == 7 : false)))); ++ return block.isSideSolid(blockAccess, pos, EnumFacing.UP); + } + + public boolean isBlockNormalCube(BlockPos pos, boolean _default) +@@ -2243,7 +2410,7 @@ + else + { + Block block = this.getBlockState(pos).getBlock(); +- return block.getMaterial().isOpaque() && block.isFullCube(); ++ return block.isNormalCube(this, pos); + } + } + } +@@ -2262,6 +2429,7 @@ + { + this.spawnHostileMobs = hostile; + this.spawnPeacefulMobs = peaceful; ++ this.provider.setAllowedSpawnTypes(hostile, peaceful); + } + + public void tick() +@@ -2271,6 +2439,11 @@ + + protected void calculateInitialWeather() + { ++ this.provider.calculateInitialWeather(); ++ } ++ ++ public void calculateInitialWeatherBody() ++ { + if (this.worldInfo.isRaining()) + { + this.rainingStrength = 1.0F; +@@ -2284,6 +2457,11 @@ + + protected void updateWeather() + { ++ this.provider.updateWeather(); ++ } ++ ++ public void updateWeatherBody() ++ { + if (!this.provider.getHasNoSky()) + { + if (!this.isRemote) +@@ -2378,6 +2556,7 @@ + { + this.activeChunkSet.clear(); + this.theProfiler.startSection("buildList"); ++ this.activeChunkSet.addAll(getPersistentChunks().keySet()); + + for (int i = 0; i < this.playerEntities.size(); ++i) + { +@@ -2434,8 +2613,9 @@ + Block block = chunkIn.getBlock(blockpos); + j = j + p_147467_1_; + k = k + p_147467_2_; ++ BlockPos worldpos = blockpos.add(p_147467_1_, 0, p_147467_2_); + +- if (block.getMaterial() == Material.air && this.getLight(blockpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, blockpos) <= 0) ++ if (block.isAir(this, worldpos) && this.getLight(worldpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, worldpos) <= 0) //Forge: isAir, and fix arguments to world positions instead of chunk position + { + EntityPlayer entityplayer = this.getClosestPlayer((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, 8.0D); + +@@ -2475,6 +2655,11 @@ + + public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj) + { ++ return this.provider.canBlockFreeze(pos, noWaterAdj); ++ } ++ ++ public boolean canBlockFreezeBody(BlockPos pos, boolean noWaterAdj) ++ { + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); + float f = biomegenbase.getFloatTemperature(pos); + +@@ -2516,6 +2701,11 @@ + + public boolean canSnowAt(BlockPos pos, boolean checkLight) + { ++ return this.provider.canSnowAt(pos, checkLight); ++ } ++ ++ public boolean canSnowAtBody(BlockPos pos, boolean checkLight) ++ { + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); + float f = biomegenbase.getFloatTemperature(pos); + +@@ -2533,7 +2723,7 @@ + { + Block block = this.getBlockState(pos).getBlock(); + +- if (block.getMaterial() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos)) ++ if (block.isAir(this, pos) && Blocks.snow_layer.canPlaceBlockAt(this, pos)) + { + return true; + } +@@ -2565,10 +2755,11 @@ + else + { + Block block = this.getBlockState(pos).getBlock(); +- int i = lightType == EnumSkyBlock.SKY ? 0 : block.getLightValue(); +- int j = block.getLightOpacity(); ++ int blockLight = block.getLightValue(this, pos); ++ int i = lightType == EnumSkyBlock.SKY ? 0 : blockLight; ++ int j = block.getLightOpacity(this, pos); + +- if (j >= 15 && block.getLightValue() > 0) ++ if (j >= 15 && blockLight > 0) + { + j = 1; + } +@@ -2768,10 +2959,10 @@ + public List getEntitiesInAABBexcluding(Entity entityIn, AxisAlignedBB boundingBox, Predicate predicate) + { + List list = Lists.newArrayList(); +- int i = MathHelper.floor_double((boundingBox.minX - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((boundingBox.maxX + 2.0D) / 16.0D); +- int k = MathHelper.floor_double((boundingBox.minZ - 2.0D) / 16.0D); +- int l = MathHelper.floor_double((boundingBox.maxZ + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((boundingBox.minX - MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((boundingBox.maxX + MAX_ENTITY_RADIUS) / 16.0D); ++ int k = MathHelper.floor_double((boundingBox.minZ - MAX_ENTITY_RADIUS) / 16.0D); ++ int l = MathHelper.floor_double((boundingBox.maxZ + MAX_ENTITY_RADIUS) / 16.0D); + + for (int i1 = i; i1 <= j; ++i1) + { +@@ -2824,10 +3015,10 @@ + + public List getEntitiesWithinAABB(Class clazz, AxisAlignedBB aabb, Predicate filter) + { +- int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((aabb.maxX + 2.0D) / 16.0D); +- int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D); +- int l = MathHelper.floor_double((aabb.maxZ + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((aabb.minX - MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((aabb.maxX + MAX_ENTITY_RADIUS) / 16.0D); ++ int k = MathHelper.floor_double((aabb.minZ - MAX_ENTITY_RADIUS) / 16.0D); ++ int l = MathHelper.floor_double((aabb.maxZ + MAX_ENTITY_RADIUS) / 16.0D); + List list = Lists.newArrayList(); + + for (int i1 = i; i1 <= j; ++i1) +@@ -2905,11 +3096,13 @@ + + public void loadEntities(Collection entityCollection) + { +- this.loadedEntityList.addAll(entityCollection); +- + for (Entity entity : entityCollection) + { +- this.onEntityAdded(entity); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entity, this))) ++ { ++ loadedEntityList.add(entity); ++ this.onEntityAdded(entity); ++ } + } + } + +@@ -2922,7 +3115,9 @@ + { + Block block = this.getBlockState(pos).getBlock(); + AxisAlignedBB axisalignedbb = p_175716_3_ ? null : blockIn.getCollisionBoundingBox(this, pos, blockIn.getDefaultState()); +- return axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, entityIn) ? false : (block.getMaterial() == Material.circuits && blockIn == Blocks.anvil ? true : block.getMaterial().isReplaceable() && blockIn.canReplace(this, pos, side, itemStackIn)); ++ if (axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, entityIn)) return false; ++ if (block.getMaterial() == Material.circuits && blockIn == Blocks.anvil) return true; ++ return block.isReplaceable(this, pos) && blockIn.canReplace(this, pos, side, itemStackIn); + } + + public int getSeaLevel() +@@ -3007,7 +3202,7 @@ + { + IBlockState iblockstate = this.getBlockState(pos); + Block block = iblockstate.getBlock(); +- return block.isNormalCube() ? this.getStrongPower(pos) : block.getWeakPower(this, pos, iblockstate, facing); ++ return block.shouldCheckWeakPower(this, pos, facing) ? this.getStrongPower(pos) : block.getWeakPower(this, pos, iblockstate, facing); + } + + public boolean isBlockPowered(BlockPos pos) +@@ -3134,7 +3329,7 @@ + + public long getSeed() + { +- return this.worldInfo.getSeed(); ++ return this.provider.getSeed(); + } + + public long getTotalWorldTime() +@@ -3144,17 +3339,17 @@ + + public long getWorldTime() + { +- return this.worldInfo.getWorldTime(); ++ return this.provider.getWorldTime(); + } + + public void setWorldTime(long time) + { +- this.worldInfo.setWorldTime(time); ++ this.provider.setWorldTime(time); + } + + public BlockPos getSpawnPoint() + { +- BlockPos blockpos = new BlockPos(this.worldInfo.getSpawnX(), this.worldInfo.getSpawnY(), this.worldInfo.getSpawnZ()); ++ BlockPos blockpos = this.provider.getSpawnPoint(); + + if (!this.getWorldBorder().contains(blockpos)) + { +@@ -3166,7 +3361,7 @@ + + public void setSpawnPoint(BlockPos pos) + { +- this.worldInfo.setSpawn(pos); ++ this.provider.setSpawnPoint(pos); + } + + @SideOnly(Side.CLIENT) +@@ -3186,12 +3381,18 @@ + + if (!this.loadedEntityList.contains(entityIn)) + { ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entityIn, this))) + this.loadedEntityList.add(entityIn); + } + } + + public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) + { ++ return this.provider.canMineBlock(player, pos); ++ } ++ ++ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) ++ { + return true; + } + +@@ -3285,8 +3486,7 @@ + + public boolean isBlockinHighHumidity(BlockPos pos) + { +- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); +- return biomegenbase.isHighHumidity(); ++ return this.provider.isBlockHighHumidity(pos); + } + + public MapStorage getMapStorage() +@@ -3345,12 +3545,12 @@ + + public int getHeight() + { +- return 256; ++ return this.provider.getHeight(); + } + + public int getActualHeight() + { +- return this.provider.getHasNoSky() ? 128 : 256; ++ return this.provider.getActualHeight(); + } + + public Random setRandomSeed(int p_72843_1_, int p_72843_2_, int p_72843_3_) +@@ -3405,7 +3605,7 @@ + @SideOnly(Side.CLIENT) + public double getHorizon() + { +- return this.worldInfo.getTerrainType() == WorldType.FLAT ? 0.0D : 63.0D; ++ return provider.getHorizon(); + } + + public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) +@@ -3439,7 +3639,7 @@ + + public void updateComparatorOutputLevel(BlockPos pos, Block blockIn) + { +- for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) ++ for (EnumFacing enumfacing : EnumFacing.VALUES) + { + BlockPos blockpos = pos.offset(enumfacing); + +@@ -3447,18 +3647,14 @@ + { + IBlockState iblockstate = this.getBlockState(blockpos); + +- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) ++ iblockstate.getBlock().onNeighborChange(this, blockpos, pos); ++ if (iblockstate.getBlock().isNormalCube(this, blockpos)) + { +- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); +- } +- else if (iblockstate.getBlock().isNormalCube()) +- { +- blockpos = blockpos.offset(enumfacing); +- iblockstate = this.getBlockState(blockpos); +- +- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) ++ BlockPos posOther = blockpos.offset(enumfacing); ++ Block other = getBlockState(posOther).getBlock(); ++ if (other.getWeakChanges(this, posOther)) + { +- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); ++ other.onNeighborChange(this, posOther, pos); + } + } + } +@@ -3528,4 +3724,81 @@ + int k = 128; + return i >= -k && i <= k && j >= -k && j <= k; + } ++ ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * Determine if the given block is considered solid on the ++ * specified side. Used by placement logic. ++ * ++ * @param pos Block Position ++ * @param side The Side in question ++ * @return True if the side is solid ++ */ ++ public boolean isSideSolid(BlockPos pos, EnumFacing side) ++ { ++ return isSideSolid(pos, side, false); ++ } ++ ++ /** ++ * Determine if the given block is considered solid on the ++ * specified side. Used by placement logic. ++ * ++ * @param pos Block Position ++ * @param side The Side in question ++ * @param _default The default to return if the block doesn't exist. ++ * @return True if the side is solid ++ */ ++ @Override ++ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) ++ { ++ if (!this.isValid(pos)) return _default; ++ ++ Chunk chunk = getChunkFromBlockCoords(pos); ++ if (chunk == null || chunk.isEmpty()) return _default; ++ return getBlockState(pos).getBlock().isSideSolid(this, pos, side); ++ } ++ ++ /** ++ * Get the persistent chunks for this world ++ * ++ * @return ++ */ ++ public com.google.common.collect.ImmutableSetMultimap getPersistentChunks() ++ { ++ return net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this); ++ } ++ ++ /** ++ * Readded as it was removed, very useful helper function ++ * ++ * @param pos Block position ++ * @return The blocks light opacity ++ */ ++ public int getBlockLightOpacity(BlockPos pos) ++ { ++ if (!this.isValid(pos)) return 0; ++ return getChunkFromBlockCoords(pos).getBlockLightOpacity(pos); ++ } ++ ++ /** ++ * Returns a count of entities that classify themselves as the specified creature type. ++ */ ++ public int countEntities(net.minecraft.entity.EnumCreatureType type, boolean forSpawnCount) ++ { ++ int count = 0; ++ for (int x = 0; x < loadedEntityList.size(); x++) ++ { ++ if (((Entity)loadedEntityList.get(x)).isCreatureType(type, forSpawnCount)) ++ { ++ count++; ++ } ++ } ++ return count; ++ } ++ ++ protected MapStorage perWorldStorage; //Moved to a getter to simulate final without being final so we can load in subclasses. ++ public MapStorage getPerWorldStorage() ++ { ++ return perWorldStorage; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch new file mode 100644 index 0000000000..d281192b68 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -0,0 +1,383 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldProvider.java ++++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java +@@ -51,26 +51,12 @@ + + protected void registerWorldChunkManager() + { +- WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType(); +- +- if (worldtype == WorldType.FLAT) +- { +- FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions()); +- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), BiomeGenBase.field_180279_ad), 0.5F); +- } +- else if (worldtype == WorldType.DEBUG_WORLD) +- { +- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.0F); +- } +- else +- { +- this.worldChunkMgr = new WorldChunkManager(this.worldObj); +- } ++ this.worldChunkMgr = terrainType.getChunkManager(worldObj); + } + + public IChunkProvider createChunkGenerator() + { +- return (IChunkProvider)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings)))); ++ return terrainType.getChunkGenerator(worldObj, generatorSettings); + } + + public boolean canCoordinateBeSpawn(int x, int z) +@@ -153,13 +139,13 @@ + + public static WorldProvider getProviderForDimension(int dimension) + { +- return (WorldProvider)(dimension == -1 ? new WorldProviderHell() : (dimension == 0 ? new WorldProviderSurface() : (dimension == 1 ? new WorldProviderEnd() : null))); ++ return net.minecraftforge.common.DimensionManager.createProviderFor(dimension); + } + + @SideOnly(Side.CLIENT) + public float getCloudHeight() + { +- return 128.0F; ++ return this.terrainType.getCloudHeight(); + } + + @SideOnly(Side.CLIENT) +@@ -175,13 +161,13 @@ + + public int getAverageGroundLevel() + { +- return this.terrainType == WorldType.FLAT ? 4 : this.worldObj.getSeaLevel() + 1; ++ return this.terrainType.getMinimumSpawnHeight(this.worldObj); + } + + @SideOnly(Side.CLIENT) + public double getVoidFogYFactor() + { +- return this.terrainType == WorldType.FLAT ? 1.0D : 0.03125D; ++ return this.terrainType.voidFadeMagnitude(); + } + + @SideOnly(Side.CLIENT) +@@ -223,4 +209,319 @@ + { + return new WorldBorder(); + } ++ ++ /*======================================= Forge Start =========================================*/ ++ private net.minecraftforge.client.IRenderHandler skyRenderer = null; ++ private net.minecraftforge.client.IRenderHandler cloudRenderer = null; ++ private net.minecraftforge.client.IRenderHandler weatherRenderer = null; ++ ++ /** ++ * Sets the providers current dimension ID, used in default getSaveFolder() ++ * Added to allow default providers to be registered for multiple dimensions. ++ * ++ * @param dim Dimension ID ++ */ ++ public void setDimension(int dim) ++ { ++ this.dimensionId = dim; ++ } ++ ++ /** ++ * Returns the sub-folder of the world folder that this WorldProvider saves to. ++ * EXA: DIM1, DIM-1 ++ * @return The sub-folder name to save this world's chunks to. ++ */ ++ public String getSaveFolder() ++ { ++ return (dimensionId == 0 ? null : "DIM" + dimensionId); ++ } ++ ++ /** ++ * A message to display to the user when they transfer to this dimension. ++ * ++ * @return The message to be displayed ++ */ ++ public String getWelcomeMessage() ++ { ++ if (this instanceof WorldProviderEnd) ++ { ++ return "Entering the End"; ++ } ++ else if (this instanceof WorldProviderHell) ++ { ++ return "Entering the Nether"; ++ } ++ return null; ++ } ++ ++ /** ++ * A Message to display to the user when they transfer out of this dismension. ++ * ++ * @return The message to be displayed ++ */ ++ public String getDepartMessage() ++ { ++ if (this instanceof WorldProviderEnd) ++ { ++ return "Leaving the End"; ++ } ++ else if (this instanceof WorldProviderHell) ++ { ++ return "Leaving the Nether"; ++ } ++ return null; ++ } ++ ++ /** ++ * The dimensions movement factor. Relative to normal overworld. ++ * It is applied to the players position when they transfer dimensions. ++ * Exa: Nether movement is 8.0 ++ * @return The movement factor ++ */ ++ public double getMovementFactor() ++ { ++ if (this instanceof WorldProviderHell) ++ { ++ return 8.0; ++ } ++ return 1.0; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public net.minecraftforge.client.IRenderHandler getSkyRenderer() ++ { ++ return this.skyRenderer; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public void setSkyRenderer(net.minecraftforge.client.IRenderHandler skyRenderer) ++ { ++ this.skyRenderer = skyRenderer; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public net.minecraftforge.client.IRenderHandler getCloudRenderer() ++ { ++ return cloudRenderer; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public void setCloudRenderer(net.minecraftforge.client.IRenderHandler renderer) ++ { ++ cloudRenderer = renderer; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public net.minecraftforge.client.IRenderHandler getWeatherRenderer() ++ { ++ return weatherRenderer; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public void setWeatherRenderer(net.minecraftforge.client.IRenderHandler renderer) ++ { ++ weatherRenderer = renderer; ++ } ++ ++ public BlockPos getRandomizedSpawnPoint() ++ { ++ BlockPos ret = this.worldObj.getSpawnPoint(); ++ ++ boolean isAdventure = worldObj.getWorldInfo().getGameType() == WorldSettings.GameType.ADVENTURE; ++ int spawnFuzz = terrainType.getSpawnFuzz(); ++ int border = MathHelper.floor_double(worldObj.getWorldBorder().getClosestDistance(ret.getX(), ret.getZ())); ++ if (border < spawnFuzz) spawnFuzz = border; ++ if (spawnFuzz < 1) spawnFuzz = 1; ++ int spawnFuzzHalf = spawnFuzz / 2; ++ ++ if (!getHasNoSky() && !isAdventure) ++ { ++ ret = worldObj.getTopSolidOrLiquidBlock(ret.add(worldObj.rand.nextInt(spawnFuzzHalf) - spawnFuzz, 0, worldObj.rand.nextInt(spawnFuzzHalf) - spawnFuzz)); ++ } ++ ++ return ret; ++ } ++ /** ++ * Determine if the cursor on the map should 'spin' when rendered, like it does for the player in the nether. ++ * ++ * @param entity The entity holding the map, playername, or frame-ENTITYID ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @return True to 'spin' the cursor ++ */ ++ public boolean shouldMapSpin(String entity, double x, double y, double z) ++ { ++ return dimensionId < 0; ++ } ++ ++ /** ++ * Determines the dimension the player will be respawned in, typically this brings them back to the overworld. ++ * ++ * @param player The player that is respawning ++ * @return The dimension to respawn the player in ++ */ ++ public int getRespawnDimension(net.minecraft.entity.player.EntityPlayerMP player) ++ { ++ return 0; ++ } ++ ++ /*======================================= Start Moved From World =========================================*/ ++ ++ public BiomeGenBase getBiomeGenForCoords(BlockPos pos) ++ { ++ return worldObj.getBiomeGenForCoordsBody(pos); ++ } ++ ++ public boolean isDaytime() ++ { ++ return worldObj.getSkylightSubtracted() < 4; ++ } ++ ++ /** ++ * The current sun brightness factor for this dimension. ++ * 0.0f means no light at all, and 1.0f means maximum sunlight. ++ * This will be used for the "calculateSkylightSubtracted" ++ * which is for Sky light value calculation. ++ * ++ * @return The current brightness factor ++ * */ ++ public float getSunBrightnessFactor(float par1) ++ { ++ return worldObj.getSunBrightnessFactor(par1); ++ } ++ ++ /** ++ * Calculates the current moon phase factor. ++ * This factor is effective for slimes. ++ * (This method do not affect the moon rendering) ++ * */ ++ public float getCurrentMoonPhaseFactor() ++ { ++ return worldObj.getCurrentMoonPhaseFactorBody(); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public Vec3 getSkyColor(net.minecraft.entity.Entity cameraEntity, float partialTicks) ++ { ++ return worldObj.getSkyColorBody(cameraEntity, partialTicks); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public Vec3 drawClouds(float partialTicks) ++ { ++ return worldObj.drawCloudsBody(partialTicks); ++ } ++ ++ /** ++ * Gets the Sun Brightness for rendering sky. ++ * */ ++ @SideOnly(Side.CLIENT) ++ public float getSunBrightness(float par1) ++ { ++ return worldObj.getSunBrightnessBody(par1); ++ } ++ ++ /** ++ * Gets the Star Brightness for rendering sky. ++ * */ ++ @SideOnly(Side.CLIENT) ++ public float getStarBrightness(float par1) ++ { ++ return worldObj.getStarBrightnessBody(par1); ++ } ++ ++ public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) ++ { ++ worldObj.spawnHostileMobs = allowHostile; ++ worldObj.spawnPeacefulMobs = allowPeaceful; ++ } ++ ++ public void calculateInitialWeather() ++ { ++ worldObj.calculateInitialWeatherBody(); ++ } ++ ++ public void updateWeather() ++ { ++ worldObj.updateWeatherBody(); ++ } ++ ++ public boolean canBlockFreeze(BlockPos pos, boolean byWater) ++ { ++ return worldObj.canBlockFreezeBody(pos, byWater); ++ } ++ ++ public boolean canSnowAt(BlockPos pos, boolean checkLight) ++ { ++ return worldObj.canSnowAtBody(pos, checkLight); ++ } ++ public void setWorldTime(long time) ++ { ++ worldObj.worldInfo.setWorldTime(time); ++ } ++ ++ public long getSeed() ++ { ++ return worldObj.worldInfo.getSeed(); ++ } ++ ++ public long getWorldTime() ++ { ++ return worldObj.worldInfo.getWorldTime(); ++ } ++ ++ public BlockPos getSpawnPoint() ++ { ++ net.minecraft.world.storage.WorldInfo info = worldObj.worldInfo; ++ return new BlockPos(info.getSpawnX(), info.getSpawnY(), info.getSpawnZ()); ++ } ++ ++ public void setSpawnPoint(BlockPos pos) ++ { ++ worldObj.worldInfo.setSpawn(pos); ++ } ++ ++ public boolean canMineBlock(net.minecraft.entity.player.EntityPlayer player, BlockPos pos) ++ { ++ return worldObj.canMineBlockBody(player, pos); ++ } ++ ++ public boolean isBlockHighHumidity(BlockPos pos) ++ { ++ return worldObj.getBiomeGenForCoords(pos).isHighHumidity(); ++ } ++ ++ public int getHeight() ++ { ++ return 256; ++ } ++ ++ public int getActualHeight() ++ { ++ return hasNoSky ? 128 : 256; ++ } ++ ++ public double getHorizon() ++ { ++ return worldObj.worldInfo.getTerrainType().getHorizon(worldObj); ++ } ++ ++ public void resetRainAndThunder() ++ { ++ worldObj.worldInfo.setRainTime(0); ++ worldObj.worldInfo.setRaining(false); ++ worldObj.worldInfo.setThunderTime(0); ++ worldObj.worldInfo.setThundering(false); ++ } ++ ++ public boolean canDoLightning(net.minecraft.world.chunk.Chunk chunk) ++ { ++ return true; ++ } ++ ++ public boolean canDoRainSnowIce(net.minecraft.world.chunk.Chunk chunk) ++ { ++ return true; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch new file mode 100644 index 0000000000..a37fdd7e46 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch @@ -0,0 +1,265 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldServer.java ++++ ../src-work/minecraft/net/minecraft/world/WorldServer.java +@@ -94,30 +94,46 @@ + private static final List bonusChestContent = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.stick, 0, 1, 3, 10), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.planks), 0, 1, 3, 10), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.log), 0, 1, 3, 10), new WeightedRandomChestContent(Items.stone_axe, 0, 1, 1, 3), new WeightedRandomChestContent(Items.wooden_axe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.stone_pickaxe, 0, 1, 1, 3), new WeightedRandomChestContent(Items.wooden_pickaxe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.apple, 0, 2, 3, 5), new WeightedRandomChestContent(Items.bread, 0, 2, 3, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.log2), 0, 1, 3, 10)}); + private List pendingTickListEntriesThisTick = Lists.newArrayList(); + ++ /** Stores the recently processed (lighting) chunks */ ++ protected Set doneChunks = new java.util.HashSet(); ++ public List customTeleporters = new ArrayList(); ++ private static boolean initChest = false; ++ public static void fillChestHook() ++ { ++ if (!initChest) ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.BONUS_CHEST, bonusChestContent, 10, 10); ++ initChest = true; ++ } ++ + public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) + { + super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false); + this.mcServer = server; + this.theEntityTracker = new EntityTracker(this); + this.thePlayerManager = new PlayerManager(this); ++ // Guarantee the dimension ID was not reset by the provider ++ int providerDim = this.provider.dimensionId; + this.provider.registerWorld(this); ++ this.provider.dimensionId = providerDim; + this.chunkProvider = this.createChunkProvider(); ++ perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn)); + this.worldTeleporter = new Teleporter(this); + this.calculateInitialSkylight(); + this.calculateInitialWeather(); + this.getWorldBorder().setSize(server.getMaxWorldSize()); ++ net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this); + } + + public World init() + { + this.mapStorage = new MapStorage(this.saveHandler); + String s = VillageCollection.fileNameForProvider(this.provider); +- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); ++ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); + + if (villagecollection == null) + { + this.villageCollectionObj = new VillageCollection(this); +- this.mapStorage.setData(s, this.villageCollectionObj); ++ this.perWorldStorage.setData(s, this.villageCollectionObj); + } + else + { +@@ -210,6 +226,10 @@ + this.villageSiege.tick(); + this.theProfiler.endStartSection("portalForcer"); + this.worldTeleporter.removeStalePortalLocations(this.getTotalWorldTime()); ++ for (Teleporter tele : customTeleporters) ++ { ++ tele.removeStalePortalLocations(getTotalWorldTime()); ++ } + this.theProfiler.endSection(); + this.sendQueuedBlockEvents(); + } +@@ -217,12 +237,14 @@ + public BiomeGenBase.SpawnListEntry getSpawnListEntryForTypeAt(EnumCreatureType creatureType, BlockPos pos) + { + List list = this.getChunkProvider().getPossibleCreatures(creatureType, pos); ++ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, creatureType, pos, list); + return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.getRandomItem(this.rand, list) : null; + } + + public boolean canCreatureTypeSpawnHere(EnumCreatureType creatureType, BiomeGenBase.SpawnListEntry spawnListEntry, BlockPos pos) + { + List list = this.getChunkProvider().getPossibleCreatures(creatureType, pos); ++ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, creatureType, pos, list); + return list != null && !list.isEmpty() ? list.contains(spawnListEntry) : false; + } + +@@ -268,10 +290,7 @@ + + private void resetRainAndThunder() + { +- this.worldInfo.setRainTime(0); +- this.worldInfo.setRaining(false); +- this.worldInfo.setThunderTime(0); +- this.worldInfo.setThundering(false); ++ this.provider.resetRainAndThunder(); + } + + public boolean areAllPlayersAsleep() +@@ -349,7 +368,7 @@ + chunk.func_150804_b(false); + this.theProfiler.endStartSection("thunder"); + +- if (this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) ++ if (this.provider.canDoLightning(chunk) && this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) + { + this.updateLCG = this.updateLCG * 3 + 1013904223; + int i1 = this.updateLCG >> 2; +@@ -363,7 +382,7 @@ + + this.theProfiler.endStartSection("iceandsnow"); + +- if (this.rand.nextInt(16) == 0) ++ if (this.provider.canDoRainSnowIce(chunk) && this.rand.nextInt(16) == 0) + { + this.updateLCG = this.updateLCG * 3 + 1013904223; + int k2 = this.updateLCG >> 2; +@@ -456,6 +475,9 @@ + if (blockIn.requiresUpdates()) + { + i = 8; ++ //Keeping here as a note for future when it may be restored. ++ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.position.getX() >> 4, nextticklistentry.position.getZ() >> 4)); ++ i = isForced ? 0 : 8; + + if (this.isAreaLoaded(nextticklistentry.position.add(-i, -i, -i), nextticklistentry.position.add(i, i, i))) + { +@@ -508,7 +530,7 @@ + + public void updateEntities() + { +- if (this.playerEntities.isEmpty()) ++ if (this.playerEntities.isEmpty() && getPersistentChunks().isEmpty()) + { + if (this.updateEntityTick++ >= 1200) + { +@@ -573,6 +595,9 @@ + { + NextTickListEntry nextticklistentry1 = (NextTickListEntry)iterator.next(); + iterator.remove(); ++ //Keeping here as a note for future when it may be restored. ++ //boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.xCoord >> 4, nextticklistentry.zCoord >> 4)); ++ //byte b0 = isForced ? 0 : 8; + int k = 0; + + if (this.isAreaLoaded(nextticklistentry1.position.add(-k, -k, -k), nextticklistentry1.position.add(k, k, k))) +@@ -696,22 +721,40 @@ + { + List list = Lists.newArrayList(); + +- for (int i = 0; i < this.loadedTileEntityList.size(); ++i) ++ //Forge: Optimize this loop to only grab from the chunks it needs ++ for (int x = (minX & ~0x0F); x < maxX; x += 16) + { +- TileEntity tileentity = (TileEntity)this.loadedTileEntityList.get(i); +- BlockPos blockpos = tileentity.getPos(); +- +- if (blockpos.getX() >= minX && blockpos.getY() >= minY && blockpos.getZ() >= minZ && blockpos.getX() < maxX && blockpos.getY() < maxY && blockpos.getZ() < maxZ) ++ for (int z = (minZ & ~0x0F); z < maxZ; z += 16) // & ~0xF Floors it by 16. Yay bitmath! + { +- list.add(tileentity); ++ if (!this.isChunkLoaded(x >> 4, z >> 4, true)) continue; //Prevent loading extra chunks to just read data. This causes orphaned chunks that never unload. ++ Chunk chunk = this.getChunkFromChunkCoords(x >> 4, z >> 4); ++ if (chunk != null && !chunk.isEmpty()) ++ { ++ for (TileEntity entity : chunk.getTileEntityMap().values()) ++ { ++ if (!entity.isInvalid()) ++ { ++ BlockPos pos = entity.getPos(); ++ if (pos.getX() >= minX && pos.getY() >= minY && pos.getZ() >= minZ && ++ pos.getX() < maxX && pos.getY() < maxY && pos.getZ() < maxZ) ++ { ++ list.add(entity); ++ } ++ ++ } ++ } ++ } + } + } +- + return list; + } + + public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) + { ++ return super.isBlockModifiable(player, pos); ++ } ++ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) ++ { + return !this.mcServer.isBlockProtected(this, pos, player) && this.getWorldBorder().contains(pos); + } + +@@ -777,6 +820,7 @@ + } + else + { ++ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; + this.findingSpawnPoint = true; + WorldChunkManager worldchunkmanager = this.provider.getWorldChunkManager(); + List list = worldchunkmanager.getBiomesToSpawnIn(); +@@ -822,7 +866,7 @@ + + protected void createBonusChest() + { +- WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(bonusChestContent, 10); ++ WorldGeneratorBonusChest worldgeneratorbonuschest = net.minecraftforge.common.ForgeHooks.getBonusChest(rand); + + for (int i = 0; i < 10; ++i) + { +@@ -859,6 +903,7 @@ + } + + this.chunkProvider.saveChunks(p_73044_1_, progressCallback); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); + + for (Chunk chunk : Lists.newArrayList(this.theChunkProviderServer.func_152380_a())) + { +@@ -892,6 +937,7 @@ + this.worldInfo.setBorderLerpTime(this.getWorldBorder().getTimeUntilTarget()); + this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getHostPlayerData()); + this.mapStorage.saveAllData(); ++ this.perWorldStorage.saveAllData(); + } + + public void onEntityAdded(Entity entityIn) +@@ -947,6 +993,7 @@ + public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) + { + Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking); ++ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; + explosion.doExplosionA(); + explosion.doExplosionB(false); + +@@ -1026,19 +1073,23 @@ + this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionId()); + } + ++ /* The function in use here has been replaced in order to only send the weather info to players in the correct dimension, ++ * rather than to all players on the server. This is what causes the client-side rain, as the ++ * client believes that it has started raining locally, rather than in another dimension. ++ */ + if (flag != this.isRaining()) + { + if (flag) + { +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F)); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(2, 0.0F), this.provider.dimensionId); + } + else + { +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(1, 0.0F)); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(1, 0.0F), this.provider.dimensionId); + } + +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, this.rainingStrength)); +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, this.thunderingStrength)); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); + } + } + +@@ -1104,6 +1155,11 @@ + return this.mcServer.isCallingFromMinecraftThread(); + } + ++ public java.io.File getChunkSaveLocation() ++ { ++ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)theChunkProviderServer.chunkLoader).chunkSaveLocation; ++ } ++ + static class ServerBlockEventList extends ArrayList + { + private ServerBlockEventList() diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch new file mode 100644 index 0000000000..92ad1ae538 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch @@ -0,0 +1,60 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldServerMulti.java ++++ ../src-work/minecraft/net/minecraft/world/WorldServerMulti.java +@@ -11,12 +11,13 @@ + public class WorldServerMulti extends WorldServer + { + private WorldServer delegate; ++ private IBorderListener borderListener; + + public WorldServerMulti(MinecraftServer server, ISaveHandler saveHandlerIn, int dimensionId, WorldServer delegate, Profiler profilerIn) + { + super(server, saveHandlerIn, new DerivedWorldInfo(delegate.getWorldInfo()), dimensionId, profilerIn); + this.delegate = delegate; +- delegate.getWorldBorder().addListener(new IBorderListener() ++ this.borderListener = new IBorderListener() + { + public void onSizeChanged(WorldBorder border, double newSize) + { +@@ -46,11 +47,13 @@ + { + WorldServerMulti.this.getWorldBorder().setDamageBuffer(newSize); + } +- }); ++ }; ++ this.delegate.getWorldBorder().addListener(this.borderListener); + } + + protected void saveLevel() throws MinecraftException + { ++ this.perWorldStorage.saveAllData(); + } + + public World init() +@@ -58,12 +61,12 @@ + this.mapStorage = this.delegate.getMapStorage(); + this.worldScoreboard = this.delegate.getScoreboard(); + String s = VillageCollection.fileNameForProvider(this.provider); +- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); ++ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); + + if (villagecollection == null) + { + this.villageCollectionObj = new VillageCollection(this); +- this.mapStorage.setData(s, this.villageCollectionObj); ++ this.perWorldStorage.setData(s, this.villageCollectionObj); + } + else + { +@@ -73,4 +76,12 @@ + + return this; + } ++ ++ ++ @Override ++ public void flush() ++ { ++ super.flush(); ++ this.delegate.getWorldBorder().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak. ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch new file mode 100644 index 0000000000..39573c29f7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch @@ -0,0 +1,155 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldType.java ++++ ../src-work/minecraft/net/minecraft/world/WorldType.java +@@ -27,6 +27,7 @@ + + private WorldType(int id, String name, int version) + { ++ if (name.length() > 16 && DEBUG_WORLD != null) throw new IllegalArgumentException("World type names must not be longer then 16: " + name); + this.worldType = name; + this.generatorVersion = version; + this.canBeCreated = true; +@@ -113,4 +114,144 @@ + this.hasNotificationData = true; + return this; + } ++ ++ public net.minecraft.world.biome.WorldChunkManager getChunkManager(World world) ++ { ++ if (this == FLAT) ++ { ++ net.minecraft.world.gen.FlatGeneratorInfo flatgeneratorinfo = net.minecraft.world.gen.FlatGeneratorInfo.createFlatGeneratorFromString(world.getWorldInfo().getGeneratorOptions()); ++ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), net.minecraft.world.biome.BiomeGenBase.field_180279_ad), 0.5F); ++ } ++ else if (this == DEBUG_WORLD) ++ { ++ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.plains, 0.0F); ++ } ++ else ++ { ++ return new net.minecraft.world.biome.WorldChunkManager(world); ++ } ++ } ++ ++ public net.minecraft.world.chunk.IChunkProvider getChunkGenerator(World world, String generatorOptions) ++ { ++ if (this == FLAT) return new net.minecraft.world.gen.ChunkProviderFlat(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); ++ if (this == DEBUG_WORLD) return new net.minecraft.world.gen.ChunkProviderDebug(world); ++ return new net.minecraft.world.gen.ChunkProviderGenerate(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); ++ } ++ ++ public int getMinimumSpawnHeight(World world) ++ { ++ return this == FLAT ? 4 : 64; ++ } ++ ++ public double getHorizon(World world) ++ { ++ return this == FLAT ? 0.0D : 63.0D; ++ } ++ ++ public double voidFadeMagnitude() ++ { ++ return this == FLAT ? 1.0D : 0.03125D; ++ } ++ ++ public boolean handleSlimeSpawnReduction(java.util.Random random, World world) ++ { ++ return this == FLAT ? random.nextInt(4) != 1 : false; ++ } ++ ++ /*=================================================== FORGE START ======================================*/ ++ private static int getNextID() ++ { ++ for (int x = 0; x < worldTypes.length; x++) ++ { ++ if (worldTypes[x] == null) ++ { ++ return x; ++ } ++ } ++ ++ int oldLen = worldTypes.length; ++ worldTypes = java.util.Arrays.copyOf(worldTypes, oldLen + 16); ++ return oldLen; ++ } ++ ++ /** ++ * Creates a new world type, the ID is hidden and should not be referenced by modders. ++ * It will automatically expand the underlying workdType array if there are no IDs left. ++ * @param name ++ */ ++ public WorldType(String name) ++ { ++ this(getNextID(), name); ++ } ++ ++ /** ++ * Called when 'Create New World' button is pressed before starting game ++ */ ++ public void onGUICreateWorldPress() { } ++ ++ /** ++ * Gets the spawn fuzz for players who join the world. ++ * Useful for void world types. ++ * @return Fuzz for entity initial spawn in blocks. ++ */ ++ public int getSpawnFuzz() ++ { ++ return Math.max(5, net.minecraft.server.MinecraftServer.getServer().getSpawnProtectionSize() - 6); ++ } ++ ++ /** ++ * Called when the 'Customize' button is pressed on world creation GUI ++ * @param mc The Minecraft instance ++ * @param guiCreateWorld the createworld GUI ++ */ ++ @SideOnly(Side.CLIENT) ++ public void onCustomizeButton(net.minecraft.client.Minecraft mc, net.minecraft.client.gui.GuiCreateWorld guiCreateWorld) ++ { ++ if (this == WorldType.FLAT) ++ { ++ mc.displayGuiScreen(new net.minecraft.client.gui.GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.chunkProviderSettingsJson)); ++ } ++ else if (this == WorldType.CUSTOMIZED) ++ { ++ mc.displayGuiScreen(new net.minecraft.client.gui.GuiCustomizeWorldScreen(guiCreateWorld, guiCreateWorld.chunkProviderSettingsJson)); ++ } ++ } ++ ++ /** ++ * Should world creation GUI show 'Customize' button for this world type? ++ * @return if this world type has customization parameters ++ */ ++ public boolean isCustomizable() ++ { ++ return this == FLAT || this == WorldType.CUSTOMIZED; ++ } ++ ++ ++ /** ++ * Get the height to render the clouds for this world type ++ * @return The height to render clouds at ++ */ ++ public float getCloudHeight() ++ { ++ return 128.0F; ++ } ++ ++ /** ++ * Creates the GenLayerBiome used for generating the world with the specified ChunkProviderSettings JSON String ++ * *IF AND ONLY IF* this WorldType == WorldType.CUSTOMIZED. ++ * ++ * ++ * @param worldSeed The world seed ++ * @param parentLayer The parent layer to feed into any layer you return ++ * @param chunkProviderSettingsJson The JSON string to use when initializing ChunkProviderSettings.Factory ++ * @return A GenLayer that will return ints representing the Biomes to be generated, see GenLayerBiome ++ */ ++ public net.minecraft.world.gen.layer.GenLayer getBiomeLayer(long worldSeed, net.minecraft.world.gen.layer.GenLayer parentLayer, String chunkProviderSettingsJson) ++ { ++ net.minecraft.world.gen.layer.GenLayer ret = new net.minecraft.world.gen.layer.GenLayerBiome(200L, parentLayer, this, chunkProviderSettingsJson); ++ ret = net.minecraft.world.gen.layer.GenLayerZoom.magnify(1000L, ret, 2); ++ ret = new net.minecraft.world.gen.layer.GenLayerBiomeEdge(1000L, ret); ++ return ret; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch new file mode 100644 index 0000000000..87ff307bcc --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeColorHelper.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeColorHelper.java +@@ -26,7 +26,7 @@ + { + public int getColorAtPos(BiomeGenBase p_180283_1_, BlockPos blockPosition) + { +- return p_180283_1_.waterColorMultiplier; ++ return p_180283_1_.getWaterColorMultiplier(); + } + }; + diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch new file mode 100644 index 0000000000..9d510ede63 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch @@ -0,0 +1,169 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeDecorator.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeDecorator.java +@@ -105,8 +105,10 @@ + + protected void genDecorations(BiomeGenBase biomeGenBaseIn) + { ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(currentWorld, randomGenerator, field_180294_c)); + this.generateOres(); + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND)) + for (int i = 0; i < this.sandPerChunk2; ++i) + { + int j = this.randomGenerator.nextInt(16) + 8; +@@ -114,6 +116,7 @@ + this.sandGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(j, 0, k))); + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CLAY)) + for (int i1 = 0; i1 < this.clayPerChunk; ++i1) + { + int l1 = this.randomGenerator.nextInt(16) + 8; +@@ -121,6 +124,7 @@ + this.clayGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(l1, 0, i6))); + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND_PASS2)) + for (int j1 = 0; j1 < this.sandPerChunk; ++j1) + { + int i2 = this.randomGenerator.nextInt(16) + 8; +@@ -135,6 +139,7 @@ + ++k1; + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE)) + for (int j2 = 0; j2 < k1; ++j2) + { + int k6 = this.randomGenerator.nextInt(16) + 8; +@@ -149,6 +154,7 @@ + } + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.BIG_SHROOM)) + for (int k2 = 0; k2 < this.bigMushroomsPerChunk; ++k2) + { + int l6 = this.randomGenerator.nextInt(16) + 8; +@@ -156,6 +162,7 @@ + this.bigMushroomGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getHeight(this.field_180294_c.add(l6, 0, k10))); + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS)) + for (int l2 = 0; l2 < this.flowersPerChunk; ++l2) + { + int i7 = this.randomGenerator.nextInt(16) + 8; +@@ -177,6 +184,7 @@ + } + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) + for (int i3 = 0; i3 < this.grassPerChunk; ++i3) + { + int j7 = this.randomGenerator.nextInt(16) + 8; +@@ -190,6 +198,7 @@ + } + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.DEAD_BUSH)) + for (int j3 = 0; j3 < this.deadBushPerChunk; ++j3) + { + int k7 = this.randomGenerator.nextInt(16) + 8; +@@ -203,6 +212,7 @@ + } + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LILYPAD)) + for (int k3 = 0; k3 < this.waterlilyPerChunk; ++k3) + { + int l7 = this.randomGenerator.nextInt(16) + 8; +@@ -229,6 +239,8 @@ + } + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM)) ++ { + for (int l3 = 0; l3 < this.mushroomsPerChunk; ++l3) + { + if (this.randomGenerator.nextInt(4) == 0) +@@ -279,7 +291,9 @@ + this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j4, l15, l8)); + } + } +- ++ } // End of Mushroom generation ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.REED)) ++ { + for (int k4 = 0; k4 < this.reedsPerChunk; ++k4) + { + int i9 = this.randomGenerator.nextInt(16) + 8; +@@ -305,7 +319,8 @@ + this.reedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j9, i19, i13)); + } + } +- ++ } // End of Reed generation ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.PUMPKIN)) + if (this.randomGenerator.nextInt(32) == 0) + { + int i5 = this.randomGenerator.nextInt(16) + 8; +@@ -319,6 +334,7 @@ + } + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CACTUS)) + for (int j5 = 0; j5 < this.cactiPerChunk; ++j5) + { + int l9 = this.randomGenerator.nextInt(16) + 8; +@@ -334,6 +350,7 @@ + + if (this.generateLakes) + { ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_WATER)) + for (int k5 = 0; k5 < 50; ++k5) + { + int i10 = this.randomGenerator.nextInt(16) + 8; +@@ -348,6 +365,7 @@ + } + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_LAVA)) + for (int l5 = 0; l5 < 20; ++l5) + { + int j10 = this.randomGenerator.nextInt(16) + 8; +@@ -357,6 +375,7 @@ + (new WorldGenLiquids(Blocks.flowing_lava)).generate(this.currentWorld, this.randomGenerator, blockpos3); + } + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post(currentWorld, randomGenerator, field_180294_c)); + } + + protected void genStandardOre1(int blockCount, WorldGenerator generator, int minHeight, int maxHeight) +@@ -397,16 +416,29 @@ + + protected void generateOres() + { ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(currentWorld, randomGenerator, field_180294_c)); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, dirtGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIRT)) + this.genStandardOre1(this.chunkProviderSettings.dirtCount, this.dirtGen, this.chunkProviderSettings.dirtMinHeight, this.chunkProviderSettings.dirtMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, gravelGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRAVEL)) + this.genStandardOre1(this.chunkProviderSettings.gravelCount, this.gravelGen, this.chunkProviderSettings.gravelMinHeight, this.chunkProviderSettings.gravelMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, dioriteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIORITE)) + this.genStandardOre1(this.chunkProviderSettings.dioriteCount, this.dioriteGen, this.chunkProviderSettings.dioriteMinHeight, this.chunkProviderSettings.dioriteMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, graniteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRANITE)) + this.genStandardOre1(this.chunkProviderSettings.graniteCount, this.graniteGen, this.chunkProviderSettings.graniteMinHeight, this.chunkProviderSettings.graniteMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, andesiteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.ANDESITE)) + this.genStandardOre1(this.chunkProviderSettings.andesiteCount, this.andesiteGen, this.chunkProviderSettings.andesiteMinHeight, this.chunkProviderSettings.andesiteMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, coalGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.COAL)) + this.genStandardOre1(this.chunkProviderSettings.coalCount, this.coalGen, this.chunkProviderSettings.coalMinHeight, this.chunkProviderSettings.coalMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, ironGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.IRON)) + this.genStandardOre1(this.chunkProviderSettings.ironCount, this.ironGen, this.chunkProviderSettings.ironMinHeight, this.chunkProviderSettings.ironMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, goldGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GOLD)) + this.genStandardOre1(this.chunkProviderSettings.goldCount, this.goldGen, this.chunkProviderSettings.goldMinHeight, this.chunkProviderSettings.goldMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, redstoneGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.REDSTONE)) + this.genStandardOre1(this.chunkProviderSettings.redstoneCount, this.redstoneGen, this.chunkProviderSettings.redstoneMinHeight, this.chunkProviderSettings.redstoneMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, diamondGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIAMOND)) + this.genStandardOre1(this.chunkProviderSettings.diamondCount, this.diamondGen, this.chunkProviderSettings.diamondMinHeight, this.chunkProviderSettings.diamondMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, lapisGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.LAPIS)) + this.genStandardOre2(this.chunkProviderSettings.lapisCount, this.lapisGen, this.chunkProviderSettings.lapisCenterHeight, this.chunkProviderSettings.lapisSpread); ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(currentWorld, randomGenerator, field_180294_c)); + } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch new file mode 100644 index 0000000000..e06baf0cab --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch @@ -0,0 +1,138 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenBase.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenBase.java +@@ -138,6 +138,10 @@ + + public BiomeGenBase(int id) + { ++ this(id, true); ++ } ++ public BiomeGenBase(int id, boolean register) ++ { + this.minHeight = height_Default.rootHeight; + this.maxHeight = height_Default.variation; + this.temperature = 0.5F; +@@ -152,6 +156,7 @@ + this.worldGeneratorBigTree = new WorldGenBigTree(false); + this.worldGeneratorSwamp = new WorldGenSwamp(); + this.biomeID = id; ++ if (register) + biomeList[id] = this; + this.theBiomeDecorator = this.createBiomeDecorator(); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); +@@ -168,11 +173,12 @@ + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1)); + this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); + this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); ++ this.addDefaultFlowers(); + } + + public BiomeDecorator createBiomeDecorator() + { +- return new BiomeDecorator(); ++ return getModdedBiomeDecorator(new BiomeDecorator()); + } + + public BiomeGenBase setTemperatureRainfall(float temperatureIn, float rainfallIn) +@@ -342,7 +348,7 @@ + { + double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(pos), 0.0F, 1.0F); + double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); +- return ColorizerGrass.getGrassColor(d0, d1); ++ return getModdedBiomeGrassColor(ColorizerGrass.getGrassColor(d0, d1)); + } + + @SideOnly(Side.CLIENT) +@@ -350,7 +356,7 @@ + { + double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(pos), 0.0F, 1.0F); + double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); +- return ColorizerFoliage.getFoliageColor(d0, d1); ++ return getModdedBiomeFoliageColor(ColorizerFoliage.getFoliageColor(d0, d1)); + } + + public boolean isSnowyBiome() +@@ -497,6 +503,84 @@ + } + } + ++ /* ========================================= FORGE START ======================================*/ ++ protected List flowers = new java.util.ArrayList(); ++ ++ public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) ++ { ++ return new net.minecraftforge.event.terraingen.DeferredBiomeDecorator(original); ++ } ++ ++ public int getWaterColorMultiplier() ++ { ++ net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor(this, waterColorMultiplier); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ return event.newColor; ++ } ++ ++ public int getModdedBiomeGrassColor(int original) ++ { ++ net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor(this, original); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ return event.newColor; ++ } ++ ++ public int getModdedBiomeFoliageColor(int original) ++ { ++ net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor(this, original); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ return event.newColor; ++ } ++ ++ /** ++ * Weighted random holder class used to hold possible flowers ++ * that can spawn in this biome when bonemeal is used on grass. ++ */ ++ public static class FlowerEntry extends WeightedRandom.Item ++ { ++ public final net.minecraft.block.state.IBlockState state; ++ public FlowerEntry(net.minecraft.block.state.IBlockState state, int weight) ++ { ++ super(weight); ++ this.state = state; ++ } ++ } ++ ++ /** ++ * Adds the default flowers, as of 1.7, it is 2 yellow, and 1 red. I chose 10 to allow some wiggle room in the numbers. ++ */ ++ public void addDefaultFlowers() ++ { ++ addFlower(Blocks.yellow_flower.getDefaultState().withProperty(Blocks.yellow_flower.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 20); ++ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); ++ } ++ ++ /** Register a new plant to be planted when bonemeal is used on grass. ++ * @param state The block to place. ++ * @param weight The weight of the plant, where red flowers are ++ * 10 and yellow flowers are 20. ++ */ ++ public void addFlower(IBlockState state, int weight) ++ { ++ this.flowers.add(new FlowerEntry(state, weight)); ++ } ++ ++ public void plantFlower(World world, Random rand, BlockPos pos) ++ { ++ FlowerEntry flower = (FlowerEntry)WeightedRandom.getRandomItem(rand, flowers); ++ if (flower == null || flower.state == null || ++ (flower.state.getBlock() instanceof net.minecraft.block.BlockBush && ++ !((net.minecraft.block.BlockBush)flower.state.getBlock()).canBlockStay(world, pos, flower.state))) ++ { ++ return; ++ } ++ ++ world.setBlockState(pos, flower.state, 3); ++ } ++ ++ ++ /* ========================================= FORGE END ======================================*/ ++ + static + { + plains.createMutation(); diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch new file mode 100644 index 0000000000..4ec3410dc6 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenForest.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenForest.java +@@ -201,4 +201,20 @@ + }; + } + } ++ ++ @Override ++ public void addDefaultFlowers() ++ { ++ if (field_150632_aF != 1) ++ { ++ super.addDefaultFlowers(); ++ return; ++ } ++ for (BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) ++ { ++ if (type.getBlockType() == BlockFlower.EnumFlowerColor.YELLOW) continue; ++ if (type == BlockFlower.EnumFlowerType.BLUE_ORCHID) type = BlockFlower.EnumFlowerType.POPPY; ++ addFlower(net.minecraft.init.Blocks.red_flower.getDefaultState().withProperty(net.minecraft.init.Blocks.red_flower.getTypeProperty(), type), 10); ++ } ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch new file mode 100644 index 0000000000..0f57bd0731 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch @@ -0,0 +1,62 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenHills.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java +@@ -40,28 +40,20 @@ + public void decorate(World worldIn, Random rand, BlockPos pos) + { + super.decorate(worldIn, rand, pos); +- int i = 3 + rand.nextInt(6); ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(worldIn, rand, pos)); ++ WorldGenerator emeralds = new EmeraldGenerator(); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(worldIn, rand, emeralds, pos, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.EMERALD)) ++ emeralds.generate(worldIn, rand, pos); + +- for (int j = 0; j < i; ++j) ++ for (int i = 0; i < 7; ++i) + { +- int k = rand.nextInt(16); +- int l = rand.nextInt(28) + 4; +- int i1 = rand.nextInt(16); +- BlockPos blockpos = pos.add(k, l, i1); +- +- if (worldIn.getBlockState(blockpos).getBlock() == Blocks.stone) +- { +- worldIn.setBlockState(blockpos, Blocks.emerald_ore.getDefaultState(), 2); +- } +- } +- +- for (i = 0; i < 7; ++i) +- { + int j1 = rand.nextInt(16); + int k1 = rand.nextInt(64); + int l1 = rand.nextInt(16); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(worldIn, rand, theWorldGenerator, pos.add(j1, k1, l1), net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.SILVERFISH)) + this.theWorldGenerator.generate(worldIn, rand, pos.add(j1, k1, l1)); + } ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(worldIn, rand, pos)); + } + + public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_) +@@ -97,4 +89,23 @@ + { + return (new BiomeGenHills(p_180277_1_, false)).mutateHills(this); + } ++ ++ private static class EmeraldGenerator extends WorldGenerator ++ { ++ @Override ++ public boolean generate(World worldIn, Random rand, BlockPos pos) ++ { ++ int count = 3 + rand.nextInt(6); ++ for (int i = 0; i < count; i++) ++ { ++ BlockPos blockpos = pos.add(rand.nextInt(16), rand.nextInt(28) + 4, rand.nextInt(16)); ++ ++ if (worldIn.getBlockState(blockpos).getBlock().isReplaceableOreGen(worldIn, blockpos, net.minecraft.block.state.pattern.BlockHelper.forBlock(Blocks.stone))) ++ { ++ worldIn.setBlockState(blockpos, Blocks.emerald_ore.getDefaultState(), 2); ++ } ++ } ++ return true; ++ } ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch new file mode 100644 index 0000000000..d078f7459b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenJungle.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenJungle.java +@@ -68,7 +68,9 @@ + super.decorate(worldIn, rand, pos); + int i = rand.nextInt(16) + 8; + int j = rand.nextInt(16) + 8; +- int k = rand.nextInt(worldIn.getHeight(pos.add(i, 0, j)).getY() * 2); ++ int height = worldIn.getHeight(pos.add(i, 0, j)).getY() * 2; // could == 0, which crashes nextInt ++ if (height < 1) height = 1; ++ int k = rand.nextInt(height); + (new WorldGenMelon()).generate(worldIn, rand, pos.add(i, k, j)); + WorldGenVines worldgenvines = new WorldGenVines(); + diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch new file mode 100644 index 0000000000..db3f9dfa0b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenPlains.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenPlains.java +@@ -103,4 +103,19 @@ + biomegenplains.field_150609_ah = 14273354; + return biomegenplains; + } ++ ++ @Override ++ public void addDefaultFlowers() ++ { ++ BlockFlower red = net.minecraft.init.Blocks.red_flower; ++ BlockFlower yel = net.minecraft.init.Blocks.yellow_flower; ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.ORANGE_TULIP), 3); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.RED_TULIP), 3); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.PINK_TULIP), 3); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.WHITE_TULIP), 3); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.HOUSTONIA), 20); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.OXEYE_DAISY), 20); ++ addFlower(yel.getDefaultState().withProperty(yel.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 30); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch new file mode 100644 index 0000000000..298d372c22 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java +@@ -84,4 +84,10 @@ + { + return 6975545; + } ++ ++ @Override ++ public void addDefaultFlowers() ++ { ++ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.BLUE_ORCHID), 10); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch new file mode 100644 index 0000000000..34cb9dd866 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch @@ -0,0 +1,45 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/WorldChunkManager.java ++++ ../src-work/minecraft/net/minecraft/world/biome/WorldChunkManager.java +@@ -16,6 +16,7 @@ + + public class WorldChunkManager + { ++ public static List allowedBiomes = Lists.newArrayList(BiomeGenBase.forest, BiomeGenBase.plains, BiomeGenBase.taiga, BiomeGenBase.taigaHills, BiomeGenBase.forestHills, BiomeGenBase.jungle, BiomeGenBase.jungleHills); + private GenLayer genBiomes; + private GenLayer biomeIndexLayer; + private BiomeCache biomeCache; +@@ -27,13 +28,7 @@ + this.biomeCache = new BiomeCache(this); + this.field_180301_f = ""; + this.biomesToSpawnIn = Lists.newArrayList(); +- this.biomesToSpawnIn.add(BiomeGenBase.forest); +- this.biomesToSpawnIn.add(BiomeGenBase.plains); +- this.biomesToSpawnIn.add(BiomeGenBase.taiga); +- this.biomesToSpawnIn.add(BiomeGenBase.taigaHills); +- this.biomesToSpawnIn.add(BiomeGenBase.forestHills); +- this.biomesToSpawnIn.add(BiomeGenBase.jungle); +- this.biomesToSpawnIn.add(BiomeGenBase.jungleHills); ++ this.biomesToSpawnIn.addAll(allowedBiomes); + } + + public WorldChunkManager(long seed, WorldType p_i45744_3_, String p_i45744_4_) +@@ -41,6 +36,7 @@ + this(); + this.field_180301_f = p_i45744_4_; + GenLayer[] agenlayer = GenLayer.initializeAllBiomeGenerators(seed, p_i45744_3_, p_i45744_4_); ++ agenlayer = getModdedBiomeGenerators(p_i45744_3_, seed, agenlayer); + this.genBiomes = agenlayer[0]; + this.biomeIndexLayer = agenlayer[1]; + } +@@ -249,4 +245,11 @@ + { + this.biomeCache.cleanupCache(); + } ++ ++ public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original) ++ { ++ net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens event = new net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens(worldType, seed, original); ++ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); ++ return event.newBiomeGens; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch b/patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch new file mode 100644 index 0000000000..154d87191a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/world/border/WorldBorder.java ++++ ../src-work/minecraft/net/minecraft/world/border/WorldBorder.java +@@ -277,4 +277,9 @@ + iborderlistener.onWarningDistanceChanged(this, warningDistance); + } + } ++ ++ public void removeListener(IBorderListener listener) ++ { ++ this.listeners.remove(listener); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch new file mode 100644 index 0000000000..b3437136c0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -0,0 +1,265 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java +@@ -167,7 +167,7 @@ + { + Block block = this.getBlock0(j, l - 1, k); + +- if (block.getLightOpacity() != 0) ++ if (getBlockLightOpacity(j, l - 1, k) != 0) + { + this.heightMap[k << 4 | j] = l; + +@@ -440,12 +440,12 @@ + + public int getBlockLightOpacity(BlockPos pos) + { +- return this.getBlock(pos).getLightOpacity(); ++ return this.getBlock(pos).getLightOpacity(worldObj, pos); + } + + private int getBlockLightOpacity(int x, int y, int z) + { +- return this.getBlock0(x, y, z).getLightOpacity(); ++ return getBlockLightOpacity(new BlockPos((xPosition << 4) + x, y, (zPosition << 4) + z)); + } + + private Block getBlock0(int x, int y, int z) +@@ -607,6 +607,7 @@ + { + Block block = state.getBlock(); + Block block1 = iblockstate.getBlock(); ++ int k1 = block1.getLightOpacity(this.worldObj, pos); // Relocate old light value lookup here, so that it is called before TE is removed. + ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4]; + boolean flag = false; + +@@ -623,14 +624,19 @@ + + extendedblockstorage.set(i, j & 15, k, state); + +- if (block1 != block) ++ //if (block1 != block) + { + if (!this.worldObj.isRemote) + { ++ if (block1 != block) //Only fire block breaks when the block changes. + block1.breakBlock(this.worldObj, pos, iblockstate); ++ TileEntity te = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); ++ if (te != null && te.shouldRefresh(this.worldObj, pos, iblockstate, state)) this.worldObj.removeTileEntity(pos); + } +- else if (block1 instanceof ITileEntityProvider) ++ else if (block1.hasTileEntity(iblockstate)) + { ++ TileEntity te = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); ++ if (te != null && te.shouldRefresh(this.worldObj, pos, iblockstate, state)) + this.worldObj.removeTileEntity(pos); + } + } +@@ -647,8 +653,7 @@ + } + else + { +- int j1 = block.getLightOpacity(); +- int k1 = block1.getLightOpacity(); ++ int j1 = block.getLightOpacity(this.worldObj, pos); + + if (j1 > 0) + { +@@ -668,28 +673,18 @@ + } + } + +- if (block1 instanceof ITileEntityProvider) +- { +- TileEntity tileentity = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); +- +- if (tileentity != null) +- { +- tileentity.updateContainingBlockInfo(); +- } +- } +- + if (!this.worldObj.isRemote && block1 != block) + { + block.onBlockAdded(this.worldObj, pos, state); + } + +- if (block instanceof ITileEntityProvider) ++ if (block.hasTileEntity(state)) + { + TileEntity tileentity1 = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); + + if (tileentity1 == null) + { +- tileentity1 = ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, block.getMetaFromState(state)); ++ tileentity1 = block.createTileEntity(this.worldObj, state); + this.worldObj.setTileEntity(pos, tileentity1); + } + +@@ -792,6 +787,7 @@ + k = this.entityLists.length - 1; + } + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EnteringChunk(entityIn, this.xPosition, this.zPosition, entityIn.chunkCoordX, entityIn.chunkCoordZ)); + entityIn.addedToChunk = true; + entityIn.chunkCoordX = this.xPosition; + entityIn.chunkCoordY = k; +@@ -830,13 +826,20 @@ + private TileEntity createNewTileEntity(BlockPos pos) + { + Block block = this.getBlock(pos); +- return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, this.getBlockMetadata(pos)); ++ IBlockState state = block.getStateFromMeta(this.getBlockMetadata(pos)); ++ return !block.hasTileEntity(state) ? null : block.createTileEntity(this.worldObj, state); + } + + public TileEntity getTileEntity(BlockPos pos, Chunk.EnumCreateEntityType p_177424_2_) + { + TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(pos); + ++ if (tileentity != null && tileentity.isInvalid()) ++ { ++ chunkTileEntityMap.remove(pos); ++ tileentity = null; ++ } ++ + if (tileentity == null) + { + if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) +@@ -846,14 +849,9 @@ + } + else if (p_177424_2_ == Chunk.EnumCreateEntityType.QUEUED) + { +- this.tileEntityPosQueue.add(pos); ++ this.tileEntityPosQueue.add(pos.getImmutable()); + } + } +- else if (tileentity.isInvalid()) +- { +- this.chunkTileEntityMap.remove(pos); +- return null; +- } + + return tileentity; + } +@@ -873,7 +871,7 @@ + tileEntityIn.setWorldObj(this.worldObj); + tileEntityIn.setPos(pos); + +- if (this.getBlock(pos) instanceof ITileEntityProvider) ++ if (this.getBlock(pos).hasTileEntity(getBlock(pos).getStateFromMeta(this.getBlockMetadata(pos)))) + { + if (this.chunkTileEntityMap.containsKey(pos)) + { +@@ -882,6 +880,7 @@ + + tileEntityIn.validate(); + this.chunkTileEntityMap.put(pos, tileEntityIn); ++ tileEntityIn.onLoad(); + } + } + +@@ -910,8 +909,9 @@ + entity.onChunkLoad(); + } + +- this.worldObj.loadEntities(this.entityLists[i]); ++ this.worldObj.loadEntities(com.google.common.collect.ImmutableList.copyOf(this.entityLists[i])); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(this)); + } + + public void onChunkUnload() +@@ -927,6 +927,7 @@ + { + this.worldObj.unloadEntities(this.entityLists[i]); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload(this)); + } + + public void setChunkModified() +@@ -936,8 +937,8 @@ + + public void getEntitiesWithinAABBForEntity(Entity entityIn, AxisAlignedBB aabb, List listToFill, Predicate p_177414_4_) + { +- int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); + i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); + j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); + +@@ -976,8 +977,8 @@ + + public void getEntitiesOfTypeWithinAAAB(Class entityClass, AxisAlignedBB aabb, List listToFill, Predicate p_177430_4_) + { +- int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); + i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); + j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); + +@@ -1137,8 +1138,10 @@ + while (!this.tileEntityPosQueue.isEmpty()) + { + BlockPos blockpos = (BlockPos)this.tileEntityPosQueue.poll(); ++ Block block = this.getBlock(blockpos); ++ IBlockState state = block.getStateFromMeta(this.getBlockMetadata(blockpos)); + +- if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.getBlock(blockpos).hasTileEntity()) ++ if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && block.hasTileEntity(state)) + { + TileEntity tileentity = this.createNewTileEntity(blockpos); + this.worldObj.setTileEntity(blockpos, tileentity); +@@ -1200,6 +1203,13 @@ + @SideOnly(Side.CLIENT) + public void fillChunk(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_) + { ++ for(TileEntity tileEntity : chunkTileEntityMap.values()) ++ { ++ tileEntity.updateContainingBlockInfo(); ++ tileEntity.getBlockMetadata(); ++ tileEntity.getBlockType(); ++ } ++ + int i = 0; + boolean flag = !this.worldObj.provider.getHasNoSky(); + +@@ -1267,10 +1277,16 @@ + this.isTerrainPopulated = true; + this.generateHeightMap(); + ++ List invalidList = new java.util.ArrayList(); ++ + for (TileEntity tileentity : this.chunkTileEntityMap.values()) + { ++ if (tileentity.shouldRefresh(this.worldObj, tileentity.getPos(), tileentity.getBlockType().getStateFromMeta(tileentity.getBlockMetadata()), getBlockState(tileentity.getPos()))) ++ invalidList.add(tileentity); + tileentity.updateContainingBlockInfo(); + } ++ ++ for (TileEntity te : invalidList) te.invalidate(); + } + + public BiomeGenBase getBiome(BlockPos pos, WorldChunkManager chunkManager) +@@ -1583,4 +1599,20 @@ + QUEUED, + CHECK; + } ++ ++ /** ++ * Removes the tile entity at the specified position, only if it's ++ * marked as invalid. ++ */ ++ public void removeInvalidTileEntity(BlockPos pos) ++ { ++ if (isChunkLoaded) ++ { ++ TileEntity entity = (TileEntity)chunkTileEntityMap.get(pos); ++ if (entity != null && entity.isInvalid()) ++ { ++ chunkTileEntityMap.remove(pos); ++ } ++ } ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch new file mode 100644 index 0000000000..2be4b4a6a9 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch @@ -0,0 +1,162 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java +@@ -42,8 +42,41 @@ + this.chunkSaveLocation = chunkSaveLocationIn; + } + ++ public boolean chunkExists(World world, int x, int z) ++ { ++ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); ++ ++ if (this.pendingAnvilChunksCoordinates.contains(chunkcoordintpair)) ++ { ++ for(ChunkCoordIntPair pendingChunkCoord : this.chunksToRemove.keySet()) ++ { ++ if (pendingChunkCoord.equals(chunkcoordintpair)) ++ { ++ return true; ++ } ++ } ++ } ++ ++ return RegionFileCache.createOrLoadRegionFile(this.chunkSaveLocation, x, z).chunkExists(x & 31, z & 31); ++ } ++ + public Chunk loadChunk(World worldIn, int x, int z) throws IOException + { ++ Object[] data = this.loadChunk__Async(worldIn, x, z); ++ ++ if (data != null) ++ { ++ Chunk chunk = (Chunk) data[0]; ++ NBTTagCompound nbttagcompound = (NBTTagCompound) data[1]; ++ this.loadEntities(worldIn, nbttagcompound.getCompoundTag("Level"), chunk); ++ return chunk; ++ } ++ ++ return null; ++ } ++ ++ public Object[] loadChunk__Async(World worldIn, int x, int z) throws IOException ++ { + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); + NBTTagCompound nbttagcompound = (NBTTagCompound)this.chunksToRemove.get(chunkcoordintpair); + +@@ -59,11 +92,17 @@ + nbttagcompound = CompressedStreamTools.read(datainputstream); + } + +- return this.checkedReadChunkFromNBT(worldIn, x, z, nbttagcompound); ++ return this.checkedReadChunkFromNBT__Async(worldIn, x, z, nbttagcompound); + } + + protected Chunk checkedReadChunkFromNBT(World worldIn, int x, int z, NBTTagCompound p_75822_4_) + { ++ Object[] data = this.checkedReadChunkFromNBT__Async(worldIn, x, z, p_75822_4_); ++ return data != null ? (Chunk)data[0] : null; ++ } ++ ++ protected Object[] checkedReadChunkFromNBT__Async(World worldIn, int x, int z, NBTTagCompound p_75822_4_) ++ { + if (!p_75822_4_.hasKey("Level", 10)) + { + logger.error("Chunk file at " + x + "," + z + " is missing level data, skipping"); +@@ -87,10 +126,29 @@ + logger.error("Chunk file at " + x + "," + z + " is in the wrong location; relocating. (Expected " + x + ", " + z + ", got " + chunk.xPosition + ", " + chunk.zPosition + ")"); + nbttagcompound.setInteger("xPos", x); + nbttagcompound.setInteger("zPos", z); ++ ++ // Have to move tile entities since we don't load them at this stage ++ NBTTagList _tileEntities = nbttagcompound.getTagList("TileEntities", 10); ++ ++ if (_tileEntities != null) ++ { ++ for (int te = 0; te < _tileEntities.tagCount(); te++) ++ { ++ NBTTagCompound _nbt = (NBTTagCompound) _tileEntities.getCompoundTagAt(te); ++ _nbt.setInteger("x", x * 16 + (_nbt.getInteger("x") - chunk.xPosition * 16)); ++ _nbt.setInteger("z", z * 16 + (_nbt.getInteger("z") - chunk.zPosition * 16)); ++ } ++ } ++ + chunk = this.readChunkFromNBT(worldIn, nbttagcompound); + } + +- return chunk; ++ Object[] data = new Object[2]; ++ data[0] = chunk; ++ data[1] = p_75822_4_; ++ // event is fired in ChunkIOProvider.callStage2 since it must be fired after TE's load. ++ // MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(chunk, par4NBTTagCompound)); ++ return data; + } + } + } +@@ -105,6 +163,7 @@ + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound.setTag("Level", nbttagcompound1); + this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(chunkIn, nbttagcompound)); + this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound); + } + catch (Exception exception) +@@ -281,11 +340,20 @@ + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + ++ try ++ { + if (entity.writeToNBTOptional(nbttagcompound1)) + { + chunkIn.setHasEntities(true); + nbttaglist1.appendTag(nbttagcompound1); + } ++ } ++ catch (Exception e) ++ { ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, ++ "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author", ++ entity.getClass().getName()); ++ } + } + } + +@@ -295,8 +363,17 @@ + for (TileEntity tileentity : chunkIn.getTileEntityMap().values()) + { + NBTTagCompound nbttagcompound2 = new NBTTagCompound(); ++ try ++ { + tileentity.writeToNBT(nbttagcompound2); + nbttaglist2.appendTag(nbttagcompound2); ++ } ++ catch (Exception e) ++ { ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, ++ "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author", ++ tileentity.getClass().getName()); ++ } + } + + p_75820_3_.setTag("TileEntities", nbttaglist2); +@@ -376,6 +453,12 @@ + chunk.setBiomeArray(p_75823_2_.getByteArray("Biomes")); + } + ++ // End this method here and split off entity loading to another method ++ return chunk; ++ } ++ ++ public void loadEntities(World worldIn, NBTTagCompound p_75823_2_, Chunk chunk) ++ { + NBTTagList nbttaglist1 = p_75823_2_.getTagList("Entities", 10); + + if (nbttaglist1 != null) +@@ -447,7 +530,5 @@ + } + } + } +- +- return chunk; + } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch new file mode 100644 index 0000000000..8252f45490 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java +@@ -20,18 +20,12 @@ + { + File file1 = this.getWorldDirectory(); + +- if (provider instanceof WorldProviderHell) ++ if (provider.getSaveFolder() != null) + { +- File file3 = new File(file1, "DIM-1"); ++ File file3 = new File(file1, provider.getSaveFolder()); + file3.mkdirs(); + return new AnvilChunkLoader(file3); + } +- else if (provider instanceof WorldProviderEnd) +- { +- File file2 = new File(file1, "DIM1"); +- file2.mkdirs(); +- return new AnvilChunkLoader(file2); +- } + else + { + return new AnvilChunkLoader(file1); diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch new file mode 100644 index 0000000000..62b0bdc266 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java +@@ -34,6 +34,8 @@ + + public void set(int x, int y, int z, IBlockState state) + { ++ if (state instanceof net.minecraftforge.common.property.IExtendedBlockState) ++ state = ((net.minecraftforge.common.property.IExtendedBlockState) state).getClean(); + IBlockState iblockstate = this.get(x, y, z); + Block block = iblockstate.getBlock(); + Block block1 = state.getBlock(); diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch new file mode 100644 index 0000000000..01c861ed3d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/storage/RegionFile.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/storage/RegionFile.java +@@ -101,6 +101,39 @@ + } + } + ++ // This is a copy (sort of) of the method below it, make sure they stay in sync ++ public synchronized boolean chunkExists(int x, int z) ++ { ++ if (this.outOfBounds(x, z)) return false; ++ ++ try ++ { ++ int offset = this.getOffset(x, z); ++ ++ if (offset == 0) return false; ++ ++ int sectorNumber = offset >> 8; ++ int numSectors = offset & 255; ++ ++ if (sectorNumber + numSectors > this.sectorFree.size()) return false; ++ ++ this.dataFile.seek((long)(sectorNumber * 4096)); ++ int length = this.dataFile.readInt(); ++ ++ if (length > 4096 * numSectors || length <= 0) return false; ++ ++ byte version = this.dataFile.readByte(); ++ ++ if (version == 1 || version == 2) return true; ++ } ++ catch (IOException ioexception) ++ { ++ return false; ++ } ++ ++ return false; ++ } ++ + public synchronized DataInputStream getChunkDataInputStream(int x, int z) + { + if (this.outOfBounds(x, z)) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch new file mode 100644 index 0000000000..45b2a8d71a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch @@ -0,0 +1,67 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java ++++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java +@@ -32,6 +32,9 @@ + double[] noiseData3; + double[] noiseData4; + double[] noiseData5; ++ // temporary variables used during event handling ++ private int chunkX = 0; ++ private int chunkZ = 0; + + public ChunkProviderEnd(World worldIn, long p_i2007_2_) + { +@@ -42,6 +45,14 @@ + this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, 8); + this.noiseGen4 = new NoiseGeneratorOctaves(this.endRNG, 10); + this.noiseGen5 = new NoiseGeneratorOctaves(this.endRNG, 16); ++ ++ NoiseGenerator[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5}; ++ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.endRNG, noiseGens); ++ this.noiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; ++ this.noiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; ++ this.noiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; ++ this.noiseGen4 = (NoiseGeneratorOctaves)noiseGens[3]; ++ this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; + } + + public void func_180520_a(int p_180520_1_, int p_180520_2_, ChunkPrimer p_180520_3_) +@@ -114,6 +125,9 @@ + + public void func_180519_a(ChunkPrimer p_180519_1_) + { ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, p_180519_1_, this.endWorld); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; + for (int i = 0; i < 16; ++i) + { + for (int j = 0; j < 16; ++j) +@@ -165,6 +179,7 @@ + + public Chunk provideChunk(int x, int z) + { ++ chunkX = x; chunkZ = z; + this.endRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L); + ChunkPrimer chunkprimer = new ChunkPrimer(); + this.biomesForGeneration = this.endWorld.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); +@@ -184,6 +199,10 @@ + + private double[] initializeNoiseField(double[] p_73187_1_, int p_73187_2_, int p_73187_3_, int p_73187_4_, int p_73187_5_, int p_73187_6_, int p_73187_7_) + { ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField(this, p_73187_1_, p_73187_2_, p_73187_3_, p_73187_4_, p_73187_5_, p_73187_6_, p_73187_7_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; ++ + if (p_73187_1_ == null) + { + p_73187_1_ = new double[p_73187_5_ * p_73187_6_ * p_73187_7_]; +@@ -273,8 +292,10 @@ + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + { + BlockFalling.fallInstantly = true; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, endWorld, endWorld.rand, p_73153_2_, p_73153_3_, false)); + BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); + this.endWorld.getBiomeGenForCoords(blockpos.add(16, 0, 16)).decorate(this.endWorld, this.endWorld.rand, blockpos); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, endWorld, endWorld.rand, p_73153_2_, p_73153_3_, false)); + BlockFalling.fallInstantly = false; + } + diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch new file mode 100644 index 0000000000..e1cdf2321c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch @@ -0,0 +1,110 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java ++++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java +@@ -58,6 +58,15 @@ + + public ChunkProviderGenerate(World worldIn, long p_i45636_2_, boolean p_i45636_4_, String p_i45636_5_) + { ++ { ++ caveGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(caveGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE); ++ strongholdGenerator = (MapGenStronghold)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(strongholdGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD); ++ villageGenerator = (MapGenVillage)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(villageGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE); ++ mineshaftGenerator = (MapGenMineshaft)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(mineshaftGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT); ++ scatteredFeatureGenerator = (MapGenScatteredFeature)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(scatteredFeatureGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE); ++ ravineGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(ravineGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE); ++ oceanMonumentGenerator = (StructureOceanMonument)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(oceanMonumentGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.OCEAN_MONUMENT); ++ } + this.worldObj = worldIn; + this.mapFeaturesEnabled = p_i45636_4_; + this.field_177475_o = worldIn.getWorldInfo().getTerrainType(); +@@ -87,6 +96,16 @@ + this.field_177476_s = this.settings.useLavaOceans ? Blocks.lava : Blocks.water; + worldIn.setSeaLevel(this.settings.seaLevel); + } ++ ++ NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, noiseGen5, noiseGen6, mobSpawnerNoise}; ++ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.rand, noiseGens); ++ this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0]; ++ this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1]; ++ this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2]; ++ this.field_147430_m = (NoiseGeneratorPerlin)noiseGens[3]; ++ this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; ++ this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; ++ this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6]; + } + + public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) +@@ -160,6 +179,10 @@ + + public void replaceBlocksForBiome(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) + { ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.worldObj); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; ++ + double d0 = 0.03125D; + this.stoneNoise = this.field_147430_m.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); + +@@ -366,6 +389,8 @@ + boolean flag = false; + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); ++ + if (this.settings.useMineShafts && this.mapFeaturesEnabled) + { + this.mineshaftGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair); +@@ -391,7 +416,8 @@ + this.oceanMonumentGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair); + } + +- if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0) ++ if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0 ++ && net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) + { + int i1 = this.rand.nextInt(16) + 8; + int j1 = this.rand.nextInt(256); +@@ -399,7 +425,8 @@ + (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, blockpos.add(i1, j1, k1)); + } + +- if (!flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes) ++ if (!flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes && ++ net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA)) + { + int i2 = this.rand.nextInt(16) + 8; + int l2 = this.rand.nextInt(this.rand.nextInt(248) + 8); +@@ -413,7 +440,8 @@ + + if (this.settings.useDungeons) + { +- for (int j2 = 0; j2 < this.settings.dungeonChance; ++j2) ++ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON); ++ for (int j2 = 0; doGen && j2 < this.settings.dungeonChance; ++j2) + { + int i3 = this.rand.nextInt(16) + 8; + int l3 = this.rand.nextInt(256); +@@ -423,10 +451,14 @@ + } + + biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(i, 0, j)); ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS)) ++ { + SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, i + 8, j + 8, 16, 16, this.rand); ++ } + blockpos = blockpos.add(8, 0, 8); + +- for (int k2 = 0; k2 < 16; ++k2) ++ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE); ++ for (int k2 = 0; doGen && k2 < 16; ++k2) + { + for (int j3 = 0; j3 < 16; ++j3) + { +@@ -445,6 +477,8 @@ + } + } + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); ++ + BlockFalling.fallInstantly = false; + } + diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch new file mode 100644 index 0000000000..1e86f817c1 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch @@ -0,0 +1,141 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderHell.java ++++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderHell.java +@@ -49,8 +49,8 @@ + private final WorldGenHellLava field_177472_y = new WorldGenHellLava(Blocks.flowing_lava, false); + private final GeneratorBushFeature field_177471_z = new GeneratorBushFeature(Blocks.brown_mushroom); + private final GeneratorBushFeature field_177465_A = new GeneratorBushFeature(Blocks.red_mushroom); +- private final MapGenNetherBridge genNetherBridge = new MapGenNetherBridge(); +- private final MapGenBase netherCaveGenerator = new MapGenCavesHell(); ++ private final MapGenNetherBridge genNetherBridge; ++ private final MapGenBase netherCaveGenerator; + double[] noiseData1; + double[] noiseData2; + double[] noiseData3; +@@ -59,16 +59,29 @@ + + public ChunkProviderHell(World worldIn, boolean p_i45637_2_, long p_i45637_3_) + { ++ this.genNetherBridge = (MapGenNetherBridge) net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(new MapGenNetherBridge(), net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_BRIDGE); ++ this.netherCaveGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(new MapGenCavesHell(), net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_CAVE); + this.worldObj = worldIn; + this.field_177466_i = p_i45637_2_; + this.hellRNG = new Random(p_i45637_3_); +- this.netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); +- this.netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); +- this.netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); +- this.slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); +- this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); +- this.netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); +- this.netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); ++ NoiseGeneratorOctaves netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); ++ NoiseGeneratorOctaves netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); ++ NoiseGeneratorOctaves netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); ++ NoiseGeneratorOctaves slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); ++ NoiseGeneratorOctaves netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); ++ NoiseGeneratorOctaves netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); ++ NoiseGeneratorOctaves netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); ++ NoiseGenerator[] noiseGens = new NoiseGenerator[] { ++ netherNoiseGen1, netherNoiseGen2, netherNoiseGen3, slowsandGravelNoiseGen, netherrackExculsivityNoiseGen, netherNoiseGen6, netherNoiseGen7 ++ }; ++ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.hellRNG, noiseGens); ++ this.netherNoiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; ++ this.netherNoiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; ++ this.netherNoiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; ++ this.slowsandGravelNoiseGen = (NoiseGeneratorOctaves)noiseGens[3]; ++ this.netherrackExculsivityNoiseGen = (NoiseGeneratorOctaves)noiseGens[4]; ++ this.netherNoiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; ++ this.netherNoiseGen7 = (NoiseGeneratorOctaves)noiseGens[6]; + worldIn.setSeaLevel(63); + } + +@@ -148,6 +161,10 @@ + + public void func_180516_b(int p_180516_1_, int p_180516_2_, ChunkPrimer p_180516_3_) + { ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180516_1_, p_180516_2_, p_180516_3_, this.worldObj); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; ++ + int i = this.worldObj.getSeaLevel() + 1; + double d0 = 0.03125D; + this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, p_180516_1_ * 16, p_180516_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); +@@ -265,6 +282,10 @@ + + private double[] initializeNoiseField(double[] p_73164_1_, int p_73164_2_, int p_73164_3_, int p_73164_4_, int p_73164_5_, int p_73164_6_, int p_73164_7_) + { ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField(this, p_73164_1_, p_73164_2_, p_73164_3_, p_73164_4_, p_73164_5_, p_73164_6_, p_73164_7_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; ++ + if (p_73164_1_ == null) + { + p_73164_1_ = new double[p_73164_5_ * p_73164_6_ * p_73164_7_]; +@@ -356,50 +377,60 @@ + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + { + BlockFalling.fallInstantly = true; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false)); + BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); + this.genNetherBridge.generateStructure(this.worldObj, this.hellRNG, chunkcoordintpair); + +- for (int i = 0; i < 8; ++i) ++ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA); ++ for (int i = 0; doGen && i < 8; ++i) + { + this.field_177472_y.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + } + +- for (int j = 0; j < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++j) ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.FIRE); ++ for (int j = 0; doGen && j < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++j) + { + this.field_177470_t.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + } + +- for (int k = 0; k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.GLOWSTONE); ++ for (int k = 0; doGen && k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) + { + this.field_177469_u.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + } + +- for (int l = 0; l < 10; ++l) ++ for (int l = 0; doGen && l < 10; ++l) + { + this.field_177468_v.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + } + +- if (this.hellRNG.nextBoolean()) ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(worldObj, hellRNG, blockpos)); ++ ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.decorate(worldObj, hellRNG, blockpos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM); ++ if (doGen && this.hellRNG.nextBoolean()) + { + this.field_177471_z.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + } + +- if (this.hellRNG.nextBoolean()) ++ if (doGen && this.hellRNG.nextBoolean()) + { + this.field_177465_A.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + } + +- for (int i1 = 0; i1 < 16; ++i1) ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.generateOre(worldObj, hellRNG, field_177467_w, blockpos, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.QUARTZ); ++ for (int i1 = 0; doGen && i1 < 16; ++i1) + { + this.field_177467_w.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); + } + +- for (int j1 = 0; j1 < 16; ++j1) ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA2); ++ for (int j1 = 0; doGen && j1 < 16; ++j1) + { + this.field_177473_x.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); + } + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false)); + BlockFalling.fallInstantly = false; + } + diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch new file mode 100644 index 0000000000..fa818727df --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch @@ -0,0 +1,125 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderServer.java ++++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderServer.java +@@ -36,6 +36,7 @@ + public LongHashMap id2ChunkMap = new LongHashMap(); + public List loadedChunks = Lists.newArrayList(); + public WorldServer worldObj; ++ private Set loadingChunks = com.google.common.collect.Sets.newHashSet(); + + public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) + { +@@ -57,7 +58,7 @@ + + public void dropChunk(int x, int z) + { +- if (this.worldObj.provider.canRespawnHere()) ++ if (this.worldObj.provider.canRespawnHere() && net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimensionId())) + { + if (!this.worldObj.isSpawnChunk(x, z)) + { +@@ -80,12 +81,64 @@ + + public Chunk loadChunk(int p_73158_1_, int p_73158_2_) + { ++ return loadChunk(p_73158_1_, p_73158_2_, null); ++ } ++ ++ public Chunk loadChunk(int par1, int par2, Runnable runnable) ++ { ++ long k = ChunkCoordIntPair.chunkXZ2Int(par1, par2); ++ this.droppedChunksSet.remove(Long.valueOf(k)); ++ Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(k); ++ net.minecraft.world.chunk.storage.AnvilChunkLoader loader = null; ++ ++ if (this.chunkLoader instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader) ++ { ++ loader = (net.minecraft.world.chunk.storage.AnvilChunkLoader) this.chunkLoader; ++ } ++ ++ // We can only use the queue for already generated chunks ++ if (chunk == null && loader != null && loader.chunkExists(this.worldObj, par1, par2)) ++ { ++ if (runnable != null) ++ { ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.queueChunkLoad(this.worldObj, loader, this, par1, par2, runnable); ++ return null; ++ } ++ else ++ { ++ chunk = net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(this.worldObj, loader, this, par1, par2); ++ } ++ } ++ else if (chunk == null) ++ { ++ chunk = this.originalLoadChunk(par1, par2); ++ } ++ ++ // If we didn't load the chunk async and have a callback run it now ++ if (runnable != null) ++ { ++ runnable.run(); ++ } ++ ++ return chunk; ++ } ++ ++ public Chunk originalLoadChunk(int p_73158_1_, int p_73158_2_) ++ { + long i = ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_); + this.droppedChunksSet.remove(Long.valueOf(i)); + Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(i); + + if (chunk == null) + { ++ boolean added = loadingChunks.add(i); ++ if (!added) ++ { ++ net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in di >mension %d that is already being loaded. This will cause weird chunk breakages.", p_73158_1_, p_73158_2_, worldObj.provider.getDimensionId()); ++ } ++ chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(i, this.worldObj); ++ ++ if (chunk == null) + chunk = this.loadChunkFromFile(p_73158_1_, p_73158_2_); + + if (chunk == null) +@@ -114,6 +167,7 @@ + + this.id2ChunkMap.add(i, chunk); + this.loadedChunks.add(chunk); ++ loadingChunks.remove(i); + chunk.onChunkLoad(); + chunk.populateChunk(this, this, p_73158_1_, p_73158_2_); + } +@@ -205,6 +259,7 @@ + if (this.serverChunkGenerator != null) + { + this.serverChunkGenerator.populate(p_73153_1_, p_73153_2_, p_73153_3_); ++ net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(p_73153_2_, p_73153_3_, worldObj, serverChunkGenerator, p_73153_1_); + chunk.setChunkModified(); + } + } +@@ -266,6 +321,11 @@ + { + if (!this.worldObj.disableLevelSaving) + { ++ for (ChunkCoordIntPair forced : this.worldObj.getPersistentChunks().keySet()) ++ { ++ this.droppedChunksSet.remove(ChunkCoordIntPair.chunkXZ2Int(forced.chunkXPos, forced.chunkZPos)); ++ } ++ + for (int i = 0; i < 100; ++i) + { + if (!this.droppedChunksSet.isEmpty()) +@@ -280,6 +340,12 @@ + this.saveChunkExtraData(chunk); + this.id2ChunkMap.remove(olong.longValue()); + this.loadedChunks.remove(chunk); ++ net.minecraftforge.common.ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.chunkXZ2Int(chunk.xPosition, chunk.zPosition), chunk); ++ if(loadedChunks.size() == 0 && net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this.worldObj).size() == 0 && !net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimensionId())){ ++ net.minecraftforge.common.DimensionManager.unloadWorld(this.worldObj.provider.getDimensionId()); ++ return serverChunkGenerator.unloadQueuedChunks(); ++ } ++ + } + + this.droppedChunksSet.remove(olong); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch new file mode 100644 index 0000000000..61a4e86c32 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch @@ -0,0 +1,119 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/MapGenCaves.java ++++ ../src-work/minecraft/net/minecraft/world/gen/MapGenCaves.java +@@ -138,7 +138,7 @@ + { + IBlockState iblockstate = p_180702_5_.getBlockState(j1, l1, k1); + +- if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) ++ if (isOceanBlock(p_180702_5_, j1, l1, k1, p_180702_3_, p_180702_4_)) + { + flag3 = true; + } +@@ -176,33 +176,12 @@ + IBlockState iblockstate1 = p_180702_5_.getBlockState(j3, j2, i2); + IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.getBlockState(j3, j2 + 1, i2), Blocks.air.getDefaultState()); + +- if (iblockstate1.getBlock() == Blocks.grass || iblockstate1.getBlock() == Blocks.mycelium) ++ if (isTopBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_)) + { + flag1 = true; + } + +- if (this.func_175793_a(iblockstate1, iblockstate2)) +- { +- if (j2 - 1 < 10) +- { +- p_180702_5_.setBlockState(j3, j2, i2, Blocks.lava.getDefaultState()); +- } +- else +- { +- p_180702_5_.setBlockState(j3, j2, i2, Blocks.air.getDefaultState()); +- +- if (iblockstate2.getBlock() == Blocks.sand) +- { +- p_180702_5_.setBlockState(j3, j2 + 1, i2, iblockstate2.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState()); +- } +- +- if (flag1 && p_180702_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) +- { +- blockpos$mutableblockpos.set(j3 + p_180702_3_ * 16, 0, i2 + p_180702_4_ * 16); +- p_180702_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock.getBlock().getDefaultState()); +- } +- } +- } ++ digBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2); + } + } + } +@@ -261,4 +240,71 @@ + } + } + } ++ ++ protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) ++ { ++ net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock(); ++ return block== Blocks.flowing_water || block == Blocks.water; ++ } ++ ++ //Exception biomes to make sure we generate like vanilla ++ private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) ++ { ++ if (biome == net.minecraft.world.biome.BiomeGenBase.beach) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.desert) return true; ++ return false; ++ } ++ ++ //Determine if the block at the specified location is the top block for the biome, we take into account ++ //Vanilla bugs to make sure that we generate the map the same way vanilla does. ++ private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) ++ { ++ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState state = data.getBlockState(x, y, z); ++ return (isExceptionBiome(biome) ? state.getBlock() == Blocks.grass : state.getBlock() == biome.topBlock); ++ } ++ ++ /** ++ * Digs out the current block, default implementation removes stone, filler, and top block ++ * Sets the block to lava if y is less then 10, and air other wise. ++ * If setting to air, it also checks to see if we've broken the surface and if so ++ * tries to make the floor the biome's top block ++ * ++ * @param data Block data array ++ * @param index Pre-calculated index into block data ++ * @param x local X position ++ * @param y local Y position ++ * @param z local Z position ++ * @param chunkX Chunk X position ++ * @param chunkZ Chunk Y position ++ * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface. ++ */ ++ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop, IBlockState state, IBlockState up) ++ { ++ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState top = biome.topBlock; ++ IBlockState filler = biome.fillerBlock; ++ ++ if (this.func_175793_a(state, up) || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) ++ { ++ if (y < 10) ++ { ++ data.setBlockState(x, y, z, Blocks.lava.getDefaultState()); ++ } ++ else ++ { ++ data.setBlockState(x, y, z, Blocks.air.getDefaultState()); ++ ++ if (up.getBlock() == Blocks.sand) ++ { ++ data.setBlockState(x, y + 1, z, up.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState()); ++ } ++ ++ if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) ++ { ++ data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); ++ } ++ } ++ } ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch new file mode 100644 index 0000000000..c8b15c2be3 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch @@ -0,0 +1,111 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/MapGenRavine.java ++++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java +@@ -128,7 +128,7 @@ + { + IBlockState iblockstate = p_180707_5_.getBlockState(j1, l1, k1); + +- if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) ++ if (isOceanBlock(p_180707_5_, j1, l1, k1, p_180707_3_, p_180707_4_)) + { + flag2 = true; + } +@@ -165,28 +165,12 @@ + { + IBlockState iblockstate1 = p_180707_5_.getBlockState(j3, j2, i2); + +- if (iblockstate1.getBlock() == Blocks.grass) ++ if (isTopBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_)) + { + flag = true; + } + +- if (iblockstate1.getBlock() == Blocks.stone || iblockstate1.getBlock() == Blocks.dirt || iblockstate1.getBlock() == Blocks.grass) +- { +- if (j2 - 1 < 10) +- { +- p_180707_5_.setBlockState(j3, j2, i2, Blocks.flowing_lava.getDefaultState()); +- } +- else +- { +- p_180707_5_.setBlockState(j3, j2, i2, Blocks.air.getDefaultState()); +- +- if (flag && p_180707_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) +- { +- blockpos$mutableblockpos.set(j3 + p_180707_3_ * 16, 0, i2 + p_180707_4_ * 16); +- p_180707_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock); +- } +- } +- } ++ digBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_, flag); + } + } + } +@@ -221,4 +205,68 @@ + } + } + } ++ protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) ++ { ++ net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock(); ++ return block== Blocks.flowing_water || block == Blocks.water; ++ } ++ ++ //Exception biomes to make sure we generate like vanilla ++ private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) ++ { ++ if (biome == net.minecraft.world.biome.BiomeGenBase.beach) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.desert) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.mushroomIsland) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.mushroomIslandShore) return true; ++ return false; ++ } ++ ++ //Determine if the block at the specified location is the top block for the biome, we take into account ++ //Vanilla bugs to make sure that we generate the map the same way vanilla does. ++ private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) ++ { ++ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState state = data.getBlockState(x, y, z); ++ return (isExceptionBiome(biome) ? state.getBlock() == Blocks.grass : state.getBlock() == biome.topBlock); ++ } ++ ++ /** ++ * Digs out the current block, default implementation removes stone, filler, and top block ++ * Sets the block to lava if y is less then 10, and air other wise. ++ * If setting to air, it also checks to see if we've broken the surface and if so ++ * tries to make the floor the biome's top block ++ * ++ * @param data Block data array ++ * @param index Pre-calculated index into block data ++ * @param x local X position ++ * @param y local Y position ++ * @param z local Z position ++ * @param chunkX Chunk X position ++ * @param chunkZ Chunk Y position ++ * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface. ++ */ ++ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop) ++ { ++ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState state = data.getBlockState(x, y, z); ++ IBlockState top = isExceptionBiome(biome) ? Blocks.grass.getDefaultState() : biome.topBlock; ++ IBlockState filler = isExceptionBiome(biome) ? Blocks.dirt.getDefaultState() : biome.fillerBlock; ++ ++ if (state.getBlock() == Blocks.stone || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) ++ { ++ if (y < 10) ++ { ++ data.setBlockState(x, y, z, Blocks.lava.getDefaultState()); ++ } ++ else ++ { ++ data.setBlockState(x, y, z, Blocks.air.getDefaultState()); ++ ++ if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) ++ { ++ data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); ++ } ++ } ++ } ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch new file mode 100644 index 0000000000..79d808460b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java +@@ -31,4 +31,10 @@ + this.setBlockAndNotifyAdequately(worldIn, p_175921_2_, Blocks.dirt.getDefaultState()); + } + } ++ ++ public boolean isReplaceable(World world, BlockPos pos) ++ { ++ net.minecraft.block.state.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()); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch new file mode 100644 index 0000000000..692f00c09b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java +@@ -54,7 +54,7 @@ + { + Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock(); + +- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) ++ if (!block.isAir(worldIn, blockpos$mutableblockpos) && !block.isLeaves(worldIn, blockpos$mutableblockpos)) + { + flag = false; + } +@@ -190,7 +190,7 @@ + { + BlockPos blockpos = new BlockPos(l1, l2, i2); + +- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.mushroomType.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, blockhugemushroom$enumtype)); + } +@@ -201,9 +201,10 @@ + + for (int i3 = 0; i3 < i; ++i3) + { +- Block block2 = worldIn.getBlockState(position.up(i3)).getBlock(); ++ BlockPos upN = position.up(i3); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(upN); + +- if (!block2.isFullBlock()) ++ if (state.getBlock().canBeReplacedByLeaves(worldIn, upN)) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(i3), this.mushroomType.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, BlockHugeMushroom.EnumType.STEM)); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch new file mode 100644 index 0000000000..02e90923a2 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch @@ -0,0 +1,52 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java +@@ -99,9 +99,9 @@ + if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_181631_2_ * p_181631_2_)) + { + BlockPos blockpos = p_181631_1_.add(j, 0, k); +- Material material = this.world.getBlockState(blockpos).getBlock().getMaterial(); ++ net.minecraft.block.state.IBlockState state = this.world.getBlockState(blockpos); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(this.world, blockpos) || state.getBlock().isLeaves(this.world, blockpos)) + { + this.setBlockAndNotifyAdequately(this.world, blockpos, p_181631_3_); + } +@@ -254,7 +254,7 @@ + { + BlockPos blockpos1 = posOne.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); + +- if (!this.func_150523_a(this.world.getBlockState(blockpos1).getBlock())) ++ if (!this.isReplaceable(world, blockpos1)) + { + return j; + } +@@ -282,6 +282,7 @@ + + if (!this.validTreeLocation()) + { ++ this.world = null; //Fix vanilla Mem leak, holds latest world + return false; + } + else +@@ -290,15 +291,18 @@ + this.generateLeaves(); + this.generateTrunk(); + this.generateLeafNodeBases(); ++ this.world = null; //Fix vanilla Mem leak, holds latest world + return true; + } + } + + private boolean validTreeLocation() + { +- Block block = this.world.getBlockState(this.basePos.down()).getBlock(); ++ BlockPos down = this.basePos.down(); ++ net.minecraft.block.state.IBlockState state = this.world.getBlockState(down); ++ boolean isSoil = state.getBlock().canSustainPlant(this.world, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if (block != Blocks.dirt && block != Blocks.grass && block != Blocks.farmland) ++ if (!isSoil) + { + return false; + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch new file mode 100644 index 0000000000..34b0130e80 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch @@ -0,0 +1,71 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java +@@ -33,9 +33,10 @@ + if (k >= 1 && k + i + 1 < 256) + { + BlockPos blockpos = position.down(); +- Block block = worldIn.getBlockState(blockpos).getBlock(); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); ++ boolean isSoil = state.getBlock().canSustainPlant(worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if (block != Blocks.grass && block != Blocks.dirt) ++ if (!(isSoil && position.getY() < 256 - i - 1)) + { + return false; + } +@@ -45,10 +46,10 @@ + } + else + { +- this.func_175921_a(worldIn, blockpos); +- this.func_175921_a(worldIn, blockpos.east()); +- this.func_175921_a(worldIn, blockpos.south()); +- this.func_175921_a(worldIn, blockpos.south().east()); ++ this.onPlantGrow(worldIn, blockpos, position); ++ this.onPlantGrow(worldIn, blockpos.east(), position); ++ this.onPlantGrow(worldIn, blockpos.south(), position); ++ this.onPlantGrow(worldIn, blockpos.south().east(), position); + EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand); + int i1 = i - rand.nextInt(4); + int j1 = 2 - rand.nextInt(3); +@@ -67,9 +68,9 @@ + + int k2 = k + j2; + BlockPos blockpos1 = new BlockPos(k1, k2, l1); +- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ state = worldIn.getBlockState(blockpos1); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(worldIn, blockpos1) || state.getBlock().isLeaves(worldIn, blockpos1)) + { + this.func_181639_b(worldIn, blockpos1); + this.func_181639_b(worldIn, blockpos1.east()); +@@ -187,7 +188,7 @@ + { + for (int k1 = -i1; k1 <= i1; ++k1) + { +- if (!this.func_150523_a(p_181638_1_.getBlockState(blockpos$mutableblockpos.set(i + j1, j + l, k + k1)).getBlock())) ++ if (!this.isReplaceable(p_181638_1_, blockpos$mutableblockpos.set(i + j1, j + l, k + k1))) + { + return false; + } +@@ -209,11 +210,17 @@ + private void func_150526_a(World worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) + { + BlockPos blockpos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); +- Block block = worldIn.getBlockState(blockpos).getBlock(); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); + +- if (block.getMaterial() == Material.air) ++ if (state.getBlock().isAir(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181641_b); + } + } ++ ++ //Just a helper macro ++ private void onPlantGrow(World world, BlockPos pos, BlockPos source) ++ { ++ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch new file mode 100644 index 0000000000..a31133713a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java +@@ -13,10 +13,12 @@ + { + Block block; + +- while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0) ++ do + { ++ block = worldIn.getBlockState(position).getBlock(); ++ if (!block.isLeaves(worldIn, position) && !block.isLeaves(worldIn, position)) break; + position = position.down(); +- } ++ } while (position.getY() > 0); + + for (int i = 0; i < 4; ++i) + { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch new file mode 100644 index 0000000000..90ee807b75 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch @@ -0,0 +1,30 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java +@@ -123,12 +123,11 @@ + if (j3 == 1) + { + worldIn.setBlockState(blockpos2, Blocks.chest.correctFacing(worldIn, blockpos2, Blocks.chest.getDefaultState()), 2); +- List list = WeightedRandomChestContent.func_177629_a(CHESTCONTENT, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(rand)}); + TileEntity tileentity1 = worldIn.getTileEntity(blockpos2); + + if (tileentity1 instanceof TileEntityChest) + { +- WeightedRandomChestContent.generateChestContents(rand, list, (TileEntityChest)tileentity1, 8); ++ WeightedRandomChestContent.generateChestContents(rand, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, rand), (TileEntityChest)tileentity1, 8); + } + + break; +@@ -159,6 +158,12 @@ + + private String pickMobSpawner(Random p_76543_1_) + { +- return SPAWNERTYPES[p_76543_1_.nextInt(SPAWNERTYPES.length)]; ++ return net.minecraftforge.common.DungeonHooks.getRandomDungeonMob(p_76543_1_); + } ++ ++ static ++ { ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, CHESTCONTENT, 8, 8); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch new file mode 100644 index 0000000000..5c7ad93a54 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch @@ -0,0 +1,50 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java +@@ -58,7 +58,7 @@ + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock())) ++ if (!this.isReplaceable(worldIn, blockpos$mutableblockpos.set(l, j, i1))) + { + flag = false; + } +@@ -77,11 +77,13 @@ + } + else + { +- Block block1 = worldIn.getBlockState(position.down()).getBlock(); ++ 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)); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 256 - i - 1) ++ if (isSoil && position.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, position.down()); ++ block1.onPlantGrow(worldIn, down, position); + + for (int i2 = position.getY() - 3 + i; i2 <= position.getY() + i; ++i2) + { +@@ -101,7 +103,7 @@ + BlockPos blockpos = new BlockPos(i3, i2, k1); + Block block = worldIn.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181630_b); + } +@@ -112,9 +114,9 @@ + + for (int j2 = 0; j2 < i; ++j2) + { +- Block block2 = worldIn.getBlockState(position.up(j2)).getBlock(); +- +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) ++ BlockPos upN = position.up(j2); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(j2), field_181629_a); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch new file mode 100644 index 0000000000..dd3577bbdc --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch @@ -0,0 +1,66 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java +@@ -59,7 +59,7 @@ + { + for (int l = -j; l <= j && flag; ++l) + { +- if (p_175926_2_.getY() + i < 0 || p_175926_2_.getY() + i >= 256 || !this.func_150523_a(worldIn.getBlockState(p_175926_2_.add(k, i, l)).getBlock())) ++ if (p_175926_2_.getY() + i < 0 || p_175926_2_.getY() + i >= 256 || !this.isReplaceable(worldIn,p_175926_2_.add(k, i, l))) + { + flag = false; + } +@@ -79,13 +79,14 @@ + { + BlockPos blockpos = p_175927_1_.down(); + Block block = worldIn.getBlockState(blockpos).getBlock(); ++ boolean isSoil = block.canSustainPlant(worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block == Blocks.grass || block == Blocks.dirt) && p_175927_1_.getY() >= 2) ++ if (isSoil && p_175927_1_.getY() >= 2) + { +- this.func_175921_a(worldIn, blockpos); +- this.func_175921_a(worldIn, blockpos.east()); +- this.func_175921_a(worldIn, blockpos.south()); +- this.func_175921_a(worldIn, blockpos.south().east()); ++ this.onPlantGrow(worldIn, blockpos, p_175927_1_); ++ this.onPlantGrow(worldIn, blockpos.east(), p_175927_1_); ++ this.onPlantGrow(worldIn, blockpos.south(), p_175927_1_); ++ this.onPlantGrow(worldIn, blockpos.south().east(), p_175927_1_); + return true; + } + else +@@ -113,9 +114,9 @@ + if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) + { + BlockPos blockpos = p_175925_2_.add(j, 0, k); +- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(worldIn, blockpos) || state.getBlock().isLeaves(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); + } +@@ -135,9 +136,9 @@ + if (j * j + k * k <= i) + { + BlockPos blockpos = p_175928_2_.add(j, 0, k); +- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); ++ Block block = worldIn.getBlockState(blockpos).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); + } +@@ -145,4 +146,10 @@ + } + } + } ++ ++ //Just a helper macro ++ private void onPlantGrow(World world, BlockPos pos, BlockPos source) ++ { ++ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch new file mode 100644 index 0000000000..c6dc8efd21 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch @@ -0,0 +1,50 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java +@@ -55,7 +55,7 @@ + { + BlockPos blockpos = position.up(i2); + +- if (this.func_150523_a(worldIn.getBlockState(blockpos).getBlock())) ++ if (this.isAirLeaves(worldIn,blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.woodMetadata); + +@@ -70,7 +70,7 @@ + { + BlockPos blockpos1 = blockpos.east(); + +- if (this.func_150523_a(worldIn.getBlockState(blockpos1).getBlock())) ++ if (this.isAirLeaves(worldIn,blockpos1)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos1, this.woodMetadata); + +@@ -83,7 +83,7 @@ + + BlockPos blockpos2 = blockpos.south().east(); + +- if (this.func_150523_a(worldIn.getBlockState(blockpos2).getBlock())) ++ if (this.isAirLeaves(worldIn,blockpos2)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos2, this.woodMetadata); + +@@ -96,7 +96,7 @@ + + BlockPos blockpos3 = blockpos.south(); + +- if (this.func_150523_a(worldIn.getBlockState(blockpos3).getBlock())) ++ if (this.isAirLeaves(worldIn,blockpos3)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos3, this.woodMetadata); + +@@ -130,4 +130,11 @@ + this.func_175925_a(worldIn, p_175930_2_.up(j), p_175930_3_ + 1 - j); + } + } ++ ++ //Helper macro ++ private boolean isAirLeaves(World world, BlockPos pos) ++ { ++ net.minecraft.block.Block block = world.getBlockState(pos).getBlock(); ++ return block.isAir(world, pos) || block.isLeaves(world, pos); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch new file mode 100644 index 0000000000..91e7fe7bb0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch @@ -0,0 +1,63 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java +@@ -43,30 +43,24 @@ + { + Block block = worldIn.getBlockState(position.up(j)).getBlock(); + +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (isAirLeaves(worldIn,position.up(j))) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(j), this.woodMetadata); + } + + if (j < i - 1) + { +- block = worldIn.getBlockState(position.add(1, j, 0)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (isAirLeaves(worldIn,position.add(1, j, 0))) + { + this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 0), this.woodMetadata); + } + +- block = worldIn.getBlockState(position.add(1, j, 1)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (isAirLeaves(worldIn,position.add(1, j, 1))) + { + this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 1), this.woodMetadata); + } + +- block = worldIn.getBlockState(position.add(0, j, 1)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (isAirLeaves(worldIn,position.add(0, j, 1))) + { + this.setBlockAndNotifyAdequately(worldIn, position.add(0, j, 1), this.woodMetadata); + } +@@ -132,16 +126,23 @@ + BlockPos blockpos = p_175934_2_.up(i); + Block block = worldIn.getBlockState(blockpos).getBlock(); + +- if (block == Blocks.grass || block == Blocks.dirt) ++ if (block.canSustainPlant(worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181635_g); + break; + } + +- if (block.getMaterial() != Material.air && i < 0) ++ if (!block.isAir(worldIn, blockpos) && i < 0) + { + break; + } + } + } ++ ++ //Helper macro ++ private boolean isAirLeaves(World world, BlockPos pos) ++ { ++ net.minecraft.block.Block block = world.getBlockState(pos).getBlock(); ++ return block.isAir(world, pos) || block.isLeaves(world, pos); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch new file mode 100644 index 0000000000..e3f30fb496 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java +@@ -73,7 +73,7 @@ + { + BlockPos blockpos = new BlockPos(l1, i2, j2); + +- if (this.predicate.apply(worldIn.getBlockState(blockpos))) ++ if (worldIn.getBlockState(blockpos).getBlock().isReplaceableOreGen(worldIn, blockpos, this.predicate)) + { + worldIn.setBlockState(blockpos, this.oreBlock, 2); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch new file mode 100644 index 0000000000..6309e7413f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch @@ -0,0 +1,64 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java +@@ -52,7 +52,7 @@ + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock())) ++ if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.set(l, j, i1))) + { + flag = false; + } +@@ -71,11 +71,13 @@ + } + else + { +- Block block = worldIn.getBlockState(position.down()).getBlock(); ++ BlockPos down = position.down(); ++ Block block = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block == Blocks.grass || block == Blocks.dirt) && position.getY() < 256 - i - 1) ++ if (isSoil && position.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, position.down()); ++ block.onPlantGrow(worldIn, down, position); + EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand); + int k2 = i - rand.nextInt(4) - 1; + int l2 = 3 - rand.nextInt(3); +@@ -95,9 +97,9 @@ + } + + BlockPos blockpos = new BlockPos(i3, i2, j1); +- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); ++ block = worldIn.getBlockState(blockpos).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) + { + this.func_181642_b(worldIn, blockpos); + k1 = i2; +@@ -149,9 +151,9 @@ + i3 += enumfacing1.getFrontOffsetX(); + j1 += enumfacing1.getFrontOffsetZ(); + BlockPos blockpos1 = new BlockPos(i3, j2, j1); +- Material material1 = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ block = worldIn.getBlockState(blockpos1).getBlock(); + +- if (material1 == Material.air || material1 == Material.leaves) ++ if (block.isAir(worldIn, blockpos2) || block.isLeaves(worldIn, blockpos2)) + { + this.func_181642_b(worldIn, blockpos1); + k1 = j2; +@@ -209,9 +211,9 @@ + + private void func_175924_b(World worldIn, BlockPos p_175924_2_) + { +- Material material = worldIn.getBlockState(p_175924_2_).getBlock().getMaterial(); ++ Block block = worldIn.getBlockState(p_175924_2_).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, p_175924_2_) || block.isLeaves(worldIn, p_175924_2_)) + { + this.setBlockAndNotifyAdequately(worldIn, p_175924_2_, field_181644_b); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch new file mode 100644 index 0000000000..c2f9fa4309 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java +@@ -24,14 +24,16 @@ + { + Block block; + +- while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0) ++ do + { ++ block = worldIn.getBlockState(position).getBlock(); ++ if (!block.isAir(worldIn, position) && !block.isLeaves(worldIn, position)) break; + position = position.down(); +- } ++ } while (position.getY() > 0); + + Block block1 = worldIn.getBlockState(position).getBlock(); + +- if (block1 == Blocks.dirt || block1 == Blocks.grass) ++ if (block1.canSustainPlant(worldIn, position, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) + { + position = position.up(); + this.setBlockAndNotifyAdequately(worldIn, position, this.woodMetadata); +@@ -53,7 +55,7 @@ + { + BlockPos blockpos = new BlockPos(l, i, j1); + +- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch new file mode 100644 index 0000000000..83021d5b60 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch @@ -0,0 +1,94 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java +@@ -60,7 +60,7 @@ + { + Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock(); + +- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) ++ if (!block.isAir(worldIn, blockpos$mutableblockpos.set(l, j, i1)) && !block.isLeaves(worldIn, blockpos$mutableblockpos.set(l, j, i1))) + { + if (block != Blocks.water && block != Blocks.flowing_water) + { +@@ -86,11 +86,13 @@ + } + else + { +- Block block1 = worldIn.getBlockState(position.down()).getBlock(); ++ 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)); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt) && position.getY() < 256 - i - 1) ++ if (isSoil && position.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, position.down()); ++ block1.onPlantGrow(worldIn, position.down(),position); + + for (int l1 = position.getY() - 3 + i; l1 <= position.getY() + i; ++l1) + { +@@ -109,7 +111,7 @@ + { + BlockPos blockpos = new BlockPos(k3, l1, j1); + +- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181649_b); + } +@@ -120,9 +122,10 @@ + + for (int i2 = 0; i2 < i; ++i2) + { +- Block block2 = worldIn.getBlockState(position.up(i2)).getBlock(); ++ BlockPos upN = position.up(i2); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2 == Blocks.flowing_water || block2 == Blocks.water) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2 == Blocks.flowing_water || block2 == Blocks.water) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(i2), field_181648_a); + } +@@ -140,29 +143,29 @@ + { + blockpos$mutableblockpos1.set(i4, j2, j4); + +- if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.leaves) ++ if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().isLeaves(worldIn, blockpos$mutableblockpos1)) + { + BlockPos blockpos3 = blockpos$mutableblockpos1.west(); + BlockPos blockpos4 = blockpos$mutableblockpos1.east(); + BlockPos blockpos1 = blockpos$mutableblockpos1.north(); + BlockPos blockpos2 = blockpos$mutableblockpos1.south(); + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn,blockpos3)) + { + this.func_181647_a(worldIn, blockpos3, BlockVine.EAST); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn,blockpos4)) + { + this.func_181647_a(worldIn, blockpos4, BlockVine.WEST); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn,blockpos1)) + { + this.func_181647_a(worldIn, blockpos1, BlockVine.SOUTH); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn,blockpos2)) + { + this.func_181647_a(worldIn, blockpos2, BlockVine.NORTH); + } +@@ -191,7 +194,7 @@ + this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); + int i = 4; + +- for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).getBlock().getMaterial() == Material.air && i > 0; --i) ++ for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).getBlock().isAir(p_181647_1_,p_181647_2_) && i > 0; --i) + { + this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); + p_181647_2_ = p_181647_2_.down(); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch new file mode 100644 index 0000000000..ae9752c7f3 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch @@ -0,0 +1,50 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java +@@ -53,7 +53,7 @@ + { + if (i1 >= 0 && i1 < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(k1, i1, l1)).getBlock())) ++ if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.set(k1, i1, l1))) + { + flag = false; + } +@@ -72,11 +72,13 @@ + } + else + { +- Block block = worldIn.getBlockState(position.down()).getBlock(); ++ BlockPos down = position.down(); ++ Block block = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); + +- if ((block == Blocks.grass || block == Blocks.dirt) && position.getY() < 256 - i - 1) ++ if (isSoil && position.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, position.down()); ++ block.onPlantGrow(worldIn, down, position); + int k2 = 0; + + for (int l2 = position.getY() + i; l2 >= position.getY() + j; --l2) +@@ -93,7 +95,7 @@ + { + BlockPos blockpos = new BlockPos(j3, l2, i2); + +- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181637_b); + } +@@ -113,9 +115,10 @@ + + for (int i3 = 0; i3 < i - 1; ++i3) + { +- Block block1 = worldIn.getBlockState(position.up(i3)).getBlock(); ++ BlockPos upN = position.up(i3); ++ Block block1 = worldIn.getBlockState(upN).getBlock(); + +- if (block1.getMaterial() == Material.air || block1.getMaterial() == Material.leaves) ++ if (block1.isAir(worldIn, upN) || block1.isLeaves(worldIn, upN)) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(i3), field_181636_a); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch new file mode 100644 index 0000000000..f30f960d23 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch @@ -0,0 +1,50 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java +@@ -55,7 +55,7 @@ + { + Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(k1, i1, l1)).getBlock(); + +- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) ++ if (!block.isAir(worldIn, blockpos$mutableblockpos) && !block.isLeaves(worldIn, blockpos$mutableblockpos)) + { + flag = false; + } +@@ -74,11 +74,13 @@ + } + else + { +- Block block1 = worldIn.getBlockState(position.down()).getBlock(); ++ 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); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 256 - i - 1) ++ if (isSoil && position.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, position.down()); ++ block1.onPlantGrow(worldIn, down, position); + int i3 = rand.nextInt(2); + int j3 = 1; + int k3 = 0; +@@ -99,7 +101,7 @@ + { + BlockPos blockpos = new BlockPos(i2, j4, k2); + +- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181646_b); + } +@@ -128,9 +130,10 @@ + + for (int k4 = 0; k4 < i - i4; ++k4) + { +- Block block2 = worldIn.getBlockState(position.up(k4)).getBlock(); ++ BlockPos upN = position.up(k4); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(k4), field_181645_a); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch new file mode 100644 index 0000000000..92401d444d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java +@@ -22,10 +22,12 @@ + { + Block block; + +- while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0) ++ do + { ++ block = worldIn.getBlockState(position).getBlock(); ++ if (!block.isAir(worldIn, position) && !block.isLeaves(worldIn, position)) break; + position = position.down(); +- } ++ } while (position.getY() > 0); + + for (int i = 0; i < 128; ++i) + { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch new file mode 100644 index 0000000000..b8493e86d1 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch @@ -0,0 +1,94 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java +@@ -68,7 +68,7 @@ + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock())) ++ if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.set(l, j, i1))) + { + flag = false; + } +@@ -87,11 +87,13 @@ + } + else + { +- Block block1 = worldIn.getBlockState(position.down()).getBlock(); ++ 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); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 256 - i - 1) ++ if (isSoil && position.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, position.down()); ++ block1.onPlantGrow(worldIn, down, position); + int k2 = 3; + int l2 = 0; + +@@ -113,7 +115,7 @@ + BlockPos blockpos = new BlockPos(k1, i3, i2); + Block block = worldIn.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine) ++ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos) || block.getMaterial() == Material.vine) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves); + } +@@ -124,9 +126,10 @@ + + for (int j3 = 0; j3 < i; ++j3) + { +- Block block2 = worldIn.getBlockState(position.up(j3)).getBlock(); ++ BlockPos upN = position.up(j3); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2.getMaterial() == Material.vine) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2.getMaterial() == Material.vine) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood); + +@@ -169,29 +172,29 @@ + { + blockpos$mutableblockpos1.set(l4, k3, i5); + +- if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.leaves) ++ if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().isLeaves(worldIn,blockpos$mutableblockpos1)) + { + BlockPos blockpos2 = blockpos$mutableblockpos1.west(); + BlockPos blockpos3 = blockpos$mutableblockpos1.east(); + BlockPos blockpos4 = blockpos$mutableblockpos1.north(); + BlockPos blockpos1 = blockpos$mutableblockpos1.south(); + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn,blockpos2)) + { + this.func_181650_b(worldIn, blockpos2, BlockVine.EAST); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn,blockpos3)) + { + this.func_181650_b(worldIn, blockpos3, BlockVine.WEST); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn,blockpos4)) + { + this.func_181650_b(worldIn, blockpos4, BlockVine.SOUTH); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn,blockpos1)) + { + this.func_181650_b(worldIn, blockpos1, BlockVine.NORTH); + } +@@ -245,7 +248,7 @@ + this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); + int i = 4; + +- for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).getBlock().getMaterial() == Material.air && i > 0; --i) ++ for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).getBlock().isAir(p_181650_1_,p_181650_2_) && i > 0; --i) + { + this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); + p_181650_2_ = p_181650_2_.down(); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch new file mode 100644 index 0000000000..389e5a4de2 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java +@@ -26,10 +26,12 @@ + { + Block block; + +- while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 1) ++ do + { ++ block = worldIn.getBlockState(position).getBlock(); ++ if (!block.isAir(worldIn, position) && !block.isLeaves(worldIn, position)) break; + position = position.down(); +- } ++ } while (position.getY() > 0); + + if (position.getY() < 1) + { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch new file mode 100644 index 0000000000..a159c3ec14 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch @@ -0,0 +1,55 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayer.java ++++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayer.java +@@ -52,12 +52,12 @@ + i = 6; + } + ++ i = getModdedBiomeSize(p_180781_2_, i); ++ + GenLayer lvt_8_1_ = GenLayerZoom.magnify(1000L, genlayer4, 0); + GenLayerRiverInit genlayerriverinit = new GenLayerRiverInit(100L, lvt_8_1_); +- GenLayerBiome lvt_9_1_ = new GenLayerBiome(200L, genlayer4, p_180781_2_, p_180781_3_); +- GenLayer genlayer6 = GenLayerZoom.magnify(1000L, lvt_9_1_, 2); +- GenLayerBiomeEdge genlayerbiomeedge = new GenLayerBiomeEdge(1000L, genlayer6); + GenLayer lvt_10_1_ = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); ++ GenLayer genlayerbiomeedge = p_180781_2_.getBiomeLayer(seed, genlayer4, p_180781_3_); + GenLayer genlayerhills = new GenLayerHills(1000L, genlayerbiomeedge, lvt_10_1_); + GenLayer genlayer5 = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); + genlayer5 = GenLayerZoom.magnify(1000L, genlayer5, j); +@@ -191,7 +191,7 @@ + + protected static boolean isBiomeOceanic(int p_151618_0_) + { +- return p_151618_0_ == BiomeGenBase.ocean.biomeID || p_151618_0_ == BiomeGenBase.deepOcean.biomeID || p_151618_0_ == BiomeGenBase.frozenOcean.biomeID; ++ return net.minecraftforge.common.BiomeManager.oceanBiomes.contains(BiomeGenBase.getBiome(p_151618_0_)); + } + + protected int selectRandom(int... p_151619_1_) +@@ -203,4 +203,27 @@ + { + 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 =====================================*/ ++ protected long nextLong(long par1) ++ { ++ long j = (this.chunkSeed >> 24) % par1; ++ ++ if (j < 0) ++ { ++ j += par1; ++ } ++ ++ this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; ++ this.chunkSeed += this.worldGenSeed; ++ return j; ++ } ++ ++ 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; ++ } ++ /* ========================================= FORGE END ======================================*/ + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch new file mode 100644 index 0000000000..28a968bdde --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch @@ -0,0 +1,94 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java ++++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java +@@ -6,10 +6,9 @@ + + public class GenLayerBiome extends GenLayer + { +- private BiomeGenBase[] field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.savanna, BiomeGenBase.savanna, BiomeGenBase.plains}; +- private BiomeGenBase[] field_151621_d = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.roofedForest, BiomeGenBase.extremeHills, BiomeGenBase.plains, BiomeGenBase.birchForest, BiomeGenBase.swampland}; +- private BiomeGenBase[] field_151622_e = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.taiga, BiomeGenBase.plains}; +- private BiomeGenBase[] field_151620_f = new BiomeGenBase[] {BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.coldTaiga}; ++ @SuppressWarnings("unchecked") ++ private java.util.List[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length]; ++ + private final ChunkProviderSettings field_175973_g; + + public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_) +@@ -17,9 +16,30 @@ + super(p_i45560_1_); + this.parent = p_i45560_3_; + ++ for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values()) ++ { ++ com.google.common.collect.ImmutableList biomesToAdd = net.minecraftforge.common.BiomeManager.getBiomes(type); ++ int idx = type.ordinal(); ++ ++ if (biomes[idx] == null) biomes[idx] = new java.util.ArrayList(); ++ if (biomesToAdd != null) biomes[idx].addAll(biomesToAdd); ++ } ++ ++ 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)); ++ + if (p_i45560_4_ == WorldType.DEFAULT_1_1) + { +- this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.plains, BiomeGenBase.taiga}; ++ 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)); + this.field_175973_g = null; + } + else if (p_i45560_4_ == WorldType.CUSTOMIZED) +@@ -73,7 +93,7 @@ + } + else + { +- aint1[j + i * areaWidth] = this.field_151623_c[this.nextInt(this.field_151623_c.length)].biomeID; ++ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome.biomeID; + } + } + else if (k == 2) +@@ -84,7 +104,7 @@ + } + else + { +- aint1[j + i * areaWidth] = this.field_151621_d[this.nextInt(this.field_151621_d.length)].biomeID; ++ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM).biome.biomeID; + } + } + else if (k == 3) +@@ -95,12 +115,12 @@ + } + else + { +- aint1[j + i * areaWidth] = this.field_151622_e[this.nextInt(this.field_151622_e.length)].biomeID; ++ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL).biome.biomeID; + } + } + else if (k == 4) + { +- aint1[j + i * areaWidth] = this.field_151620_f[this.nextInt(this.field_151620_f.length)].biomeID; ++ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY).biome.biomeID; + } + else + { +@@ -111,4 +131,12 @@ + + return aint1; + } ++ ++ protected net.minecraftforge.common.BiomeManager.BiomeEntry getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType type) ++ { ++ java.util.List biomeList = biomes[type.ordinal()]; ++ int totalWeight = net.minecraft.util.WeightedRandom.getTotalWeight(biomeList); ++ int weight = net.minecraftforge.common.BiomeManager.isTypeListModded(type)?nextInt(totalWeight):nextInt(totalWeight / 10) * 10; ++ return (net.minecraftforge.common.BiomeManager.BiomeEntry)net.minecraft.util.WeightedRandom.getRandomItem(biomeList, weight); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch new file mode 100644 index 0000000000..a32b6d0c99 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch @@ -0,0 +1,79 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java +@@ -40,6 +40,12 @@ + { + } + ++ static ++ { ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, itemsToGenerateInTemple, 2, 7); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ } ++ + public DesertPyramid(Random p_i2062_1_, int p_i2062_2_, int p_i2062_3_) + { + super(p_i2062_1_, p_i2062_2_, 64, p_i2062_3_, 21, 15, 21); +@@ -258,7 +264,7 @@ + { + int l1 = enumfacing.getFrontOffsetX() * 2; + int i2 = enumfacing.getFrontOffsetZ() * 2; +- this.field_74940_h[enumfacing.getHorizontalIndex()] = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 10 + l1, -11, 10 + i2, WeightedRandomChestContent.func_177629_a(itemsToGenerateInTemple, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(5)); ++ this.field_74940_h[enumfacing.getHorizontalIndex()] = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 10 + l1, -11, 10 + i2, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, randomIn)); + } + } + +@@ -362,6 +368,13 @@ + private static final List field_175815_j = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.arrow, 0, 2, 7, 30)}); + private static ComponentScatteredFeaturePieces.JunglePyramid.Stones junglePyramidsRandomScatteredStones = new ComponentScatteredFeaturePieces.JunglePyramid.Stones(); + ++ static ++ { ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_DISPENSER, field_175815_j, 2, 2); ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST, field_175816_i, 2, 7); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ } ++ + public JunglePyramid() + { + } +@@ -518,9 +531,12 @@ + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 4, -3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 3, -3, 1, structureBoundingBoxIn); + ++ net.minecraftforge.common.ChestGenHooks dispenser = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_DISPENSER); ++ net.minecraftforge.common.ChestGenHooks chest = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST); ++ + if (!this.field_74945_j) + { +- this.field_74945_j = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 3, -2, 1, EnumFacing.NORTH.getIndex(), field_175815_j, 2); ++ this.field_74945_j = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 3, -2, 1, EnumFacing.NORTH.getIndex(), dispenser.getItems(randomIn), dispenser.getCount(randomIn)); + } + + this.setBlockState(worldIn, Blocks.vine.getStateFromMeta(15), 3, -2, 2, structureBoundingBoxIn); +@@ -537,7 +553,7 @@ + + if (!this.field_74946_k) + { +- this.field_74946_k = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 9, -2, 3, EnumFacing.WEST.getIndex(), field_175815_j, 2); ++ this.field_74946_k = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 9, -2, 3, EnumFacing.WEST.getIndex(), dispenser.getItems(randomIn), dispenser.getCount(randomIn)); + } + + this.setBlockState(worldIn, Blocks.vine.getStateFromMeta(15), 8, -1, 3, structureBoundingBoxIn); +@@ -545,7 +561,7 @@ + + if (!this.field_74947_h) + { +- this.field_74947_h = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 8, -3, 3, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(5)); ++ this.field_74947_h = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 8, -3, 3, chest.getItems(randomIn), chest.getCount(randomIn)); + } + + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 9, -3, 2, structureBoundingBoxIn); +@@ -578,7 +594,7 @@ + + if (!this.field_74948_i) + { +- this.field_74948_i = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 9, -3, 10, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(5)); ++ this.field_74948_i = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 9, -3, 10, chest.getItems(randomIn), chest.getCount(randomIn)); + } + + return true; diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch new file mode 100644 index 0000000000..d64cd44000 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java +@@ -28,11 +28,18 @@ + + for (BiomeGenBase biomegenbase : BiomeGenBase.getBiomeGenArray()) + { +- if (biomegenbase != null && biomegenbase.minHeight > 0.0F) ++ if (biomegenbase != null && biomegenbase.minHeight > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) + { + this.field_151546_e.add(biomegenbase); + } + } ++ for (BiomeGenBase biome : net.minecraftforge.common.BiomeManager.strongHoldBiomes) ++ { ++ if (!this.field_151546_e.contains(biome)) ++ { ++ this.field_151546_e.add(biome); ++ } ++ } + } + + public MapGenStronghold(Map p_i2068_1_) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch new file mode 100644 index 0000000000..9e0994ba85 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java +@@ -217,12 +217,12 @@ + { + if (this.structureData == null) + { +- this.structureData = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName()); ++ this.structureData = (MapGenStructureData)worldIn.getPerWorldStorage().loadData(MapGenStructureData.class, this.getStructureName()); + + if (this.structureData == null) + { + this.structureData = new MapGenStructureData(this.getStructureName()); +- worldIn.setItemData(this.getStructureName(), this.structureData); ++ worldIn.getPerWorldStorage().setData(this.getStructureName(), this.structureData); + } + else + { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch new file mode 100644 index 0000000000..3763ac470f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureComponent.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureComponent.java +@@ -35,6 +35,10 @@ + + public NBTTagCompound createStructureBaseNBT() + { ++ if (MapGenStructureIO.getStructureComponentName(this) == null) // Friendlier error then the Null String error below. ++ { ++ throw new RuntimeException("StructureComponent \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); ++ } + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("id", MapGenStructureIO.getStructureComponentName(this)); + nbttagcompound.setTag("BB", this.boundingBox.toNBTTagIntArray()); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch new file mode 100644 index 0000000000..f7d5fa0b94 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java +@@ -32,6 +32,12 @@ + MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Stairs.class, "MSStairs"); + } + ++ static ++ { ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR, CHEST_CONTENT_WEIGHT_LIST, 8, 8); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ } ++ + private static StructureComponent func_175892_a(List listIn, Random rand, int x, int y, int z, EnumFacing facing, int type) + { + int i = rand.nextInt(100); +@@ -351,14 +357,15 @@ + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.05F, 1, 2, k1 - 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.05F, 1, 2, k1 + 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); + ++ net.minecraftforge.common.ChestGenHooks info = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR); + if (randomIn.nextInt(100) == 0) + { +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 2, 0, k1 - 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.CHEST_CONTENT_WEIGHT_LIST, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 3 + randomIn.nextInt(4)); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 2, 0, k1 - 1, info.getItems(randomIn), info.getCount(randomIn)); + } + + if (randomIn.nextInt(100) == 0) + { +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 0, 0, k1 + 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.CHEST_CONTENT_WEIGHT_LIST, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 3 + randomIn.nextInt(4)); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 0, 0, k1 + 1, info.getItems(randomIn), info.getCount(randomIn)); + } + + if (this.hasSpiders && !this.spawnerPlaced) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch new file mode 100644 index 0000000000..75826c803f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java +@@ -154,7 +154,7 @@ + if (this.field_111021_b && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) + { + this.field_111021_b = false; +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, field_111019_a, 2 + randomIn.nextInt(4)); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, randomIn)); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); +@@ -225,7 +225,7 @@ + if (this.field_111020_b && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(1, 3), this.getYWithOffset(2), this.getZWithOffset(1, 3)))) + { + this.field_111020_b = false; +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 1, 2, 3, field_111019_a, 2 + randomIn.nextInt(4)); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 1, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, randomIn)); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); +@@ -943,6 +943,7 @@ + abstract static class Piece extends StructureComponent + { + protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 5), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 5), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 15), new WeightedRandomChestContent(Items.golden_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.golden_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.flint_and_steel, 0, 1, 1, 5), new WeightedRandomChestContent(Items.nether_wart, 0, 3, 7, 5), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 8), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 5), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.obsidian), 0, 2, 4, 2)}); ++ static { net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, field_111019_a, 2, 5); } + + public Piece() + { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch new file mode 100644 index 0000000000..04a7017a0f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStart.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStart.java +@@ -62,6 +62,10 @@ + + public NBTTagCompound writeStructureComponentsToNBT(int chunkX, int chunkZ) + { ++ if (MapGenStructureIO.getStructureStartName(this) == null) // This is just a more friendly error instead of the 'Null String' below ++ { ++ throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); ++ } + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("id", MapGenStructureIO.getStructureStartName(this)); + nbttagcompound.setInteger("ChunkX", chunkX); +@@ -97,7 +101,8 @@ + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { +- this.components.add(MapGenStructureIO.getStructureComponent(nbttaglist.getCompoundTagAt(i), worldIn)); ++ StructureComponent tmp = MapGenStructureIO.getStructureComponent(nbttaglist.getCompoundTagAt(i), worldIn); ++ if (tmp != null) this.components.add(tmp); //Forge: Prevent NPEs further down the line when a componenet can't be loaded. + } + + this.readFromNBT(tagCompound); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch new file mode 100644 index 0000000000..63362a9378 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch @@ -0,0 +1,75 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java +@@ -240,6 +240,12 @@ + { + } + ++ static ++ { ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, strongholdChestContents, 2, 4); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ } ++ + public ChestCorridor(int p_i45582_1_, Random p_i45582_2_, StructureBoundingBox p_i45582_3_, EnumFacing p_i45582_4_) + { + super(p_i45582_1_); +@@ -296,7 +302,7 @@ + if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) + { + this.hasMadeChest = true; +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, WeightedRandomChestContent.func_177629_a(strongholdChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(2)); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, randomIn)); + } + + return true; +@@ -592,6 +598,12 @@ + private static final List strongholdLibraryChestContents = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.book, 0, 1, 3, 20), new WeightedRandomChestContent(Items.paper, 0, 2, 7, 20), new WeightedRandomChestContent(Items.map, 0, 1, 1, 1), new WeightedRandomChestContent(Items.compass, 0, 1, 1, 1)}); + private boolean isLargeRoom; + ++ static ++ { ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY, strongholdLibraryChestContents, 1, 5); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 5, 2)); ++ } ++ + public Library() + { + } +@@ -736,12 +748,13 @@ + this.setBlockState(worldIn, Blocks.torch.getDefaultState(), i1, 8, j1 + 1, structureBoundingBoxIn); + } + +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 3, 5, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn, 1, 5, 2)}), 1 + randomIn.nextInt(4)); ++ net.minecraftforge.common.ChestGenHooks info = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 3, 5, info.getItems(randomIn), info.getCount(randomIn)); + + if (this.isLargeRoom) + { + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 12, 9, 1, structureBoundingBoxIn); +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 12, 8, 1, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn, 1, 5, 2)}), 1 + randomIn.nextInt(4)); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 12, 8, 1, info.getItems(randomIn), info.getCount(randomIn)); + } + + return true; +@@ -1013,6 +1026,12 @@ + private static final List strongholdRoomCrossingChestContents = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 10), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 5), new WeightedRandomChestContent(Items.redstone, 0, 4, 9, 5), new WeightedRandomChestContent(Items.coal, 0, 3, 8, 10), new WeightedRandomChestContent(Items.bread, 0, 1, 3, 15), new WeightedRandomChestContent(Items.apple, 0, 1, 3, 15), new WeightedRandomChestContent(Items.iron_pickaxe, 0, 1, 1, 1)}); + protected int roomType; + ++ static ++ { ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, strongholdRoomCrossingChestContents, 1, 5); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ } ++ + public RoomCrossing() + { + } +@@ -1151,7 +1170,7 @@ + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 1, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 3, 3, structureBoundingBoxIn); +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 4, 8, WeightedRandomChestContent.func_177629_a(strongholdRoomCrossingChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 1 + randomIn.nextInt(4)); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 4, 8, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, randomIn)); + } + + return true; diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch new file mode 100644 index 0000000000..0491f7afe0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch @@ -0,0 +1,84 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java +@@ -57,6 +57,7 @@ + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field2.class, 3, MathHelper.getRandomIntegerInRange(random, 2 + p_75084_1_, 4 + p_75084_1_ * 2))); + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House2.class, 15, MathHelper.getRandomIntegerInRange(random, 0, 1 + p_75084_1_))); + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House3.class, 8, MathHelper.getRandomIntegerInRange(random, 0 + p_75084_1_, 3 + p_75084_1_ * 2))); ++ net.minecraftforge.fml.common.registry.VillagerRegistry.addExtraVillageComponents(list, random, p_75084_1_); + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) +@@ -129,6 +130,10 @@ + { + structurevillagepieces$village = StructureVillagePieces.House3.func_175849_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_); + } ++ else ++ { ++ structurevillagepieces$village = net.minecraftforge.fml.common.registry.VillagerRegistry.getVillageComponent(weight, start , p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_); ++ } + + return structurevillagepieces$village; + } +@@ -833,6 +838,11 @@ + { + } + ++ static ++ { ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, villageBlacksmithChestContents, 3, 8); ++ } ++ + public House2(StructureVillagePieces.Start start, int p_i45563_2_, Random rand, StructureBoundingBox p_i45563_4_, EnumFacing facing) + { + super(start, p_i45563_2_); +@@ -911,7 +921,7 @@ + if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(5, 5), this.getYWithOffset(1), this.getZWithOffset(5, 5)))) + { + this.hasMadeChest = true; +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 5, 1, 5, villageBlacksmithChestContents, 3 + randomIn.nextInt(6)); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 5, 1, 5, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, randomIn)); + } + + for (int i = 6; i <= 8; ++i) +@@ -1403,6 +1413,7 @@ + public List structureVillageWeightedPieceList; + public List field_74932_i = Lists.newArrayList(); + public List field_74930_j = Lists.newArrayList(); ++ public BiomeGenBase biome; + + public Start() + { +@@ -1416,6 +1427,7 @@ + this.terrainType = p_i2104_7_; + BiomeGenBase biomegenbase = chunkManagerIn.getBiomeGenerator(new BlockPos(p_i2104_4_, 0, p_i2104_5_), BiomeGenBase.field_180279_ad); + this.inDesert = biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills; ++ this.biome = biomegenbase; + this.func_175846_a(this.inDesert); + } + +@@ -1477,6 +1489,7 @@ + protected int field_143015_k = -1; + private int villagersSpawned; + private boolean isDesertVillage; ++ private StructureVillagePieces.Start startPiece; + + public Village() + { +@@ -1489,6 +1502,7 @@ + if (start != null) + { + this.isDesertVillage = start.inDesert; ++ startPiece = start; + } + } + +@@ -1613,6 +1627,9 @@ + + protected IBlockState func_175847_a(IBlockState p_175847_1_) + { ++ net.minecraftforge.event.terraingen.BiomeEvent.GetVillageBlockID event = new net.minecraftforge.event.terraingen.BiomeEvent.GetVillageBlockID(startPiece == null ? null : startPiece.biome, p_175847_1_); ++ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.replacement; + if (this.isDesertVillage) + { + if (p_175847_1_.getBlock() == Blocks.log || p_175847_1_.getBlock() == Blocks.log2) diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch new file mode 100644 index 0000000000..f354ddc7b3 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch @@ -0,0 +1,48 @@ +--- ../src-base/minecraft/net/minecraft/world/storage/MapData.java ++++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java +@@ -21,7 +21,7 @@ + { + public int xCenter; + public int zCenter; +- public byte dimension; ++ public int dimension; //FML byte -> int + public byte scale; + public byte[] colors = new byte[16384]; + public List playersArrayList = Lists.newArrayList(); +@@ -44,7 +44,17 @@ + + public void readFromNBT(NBTTagCompound nbt) + { +- this.dimension = nbt.getByte("dimension"); ++ net.minecraft.nbt.NBTBase dimension = nbt.getTag("dimension"); ++ ++ if (dimension instanceof net.minecraft.nbt.NBTTagByte) ++ { ++ this.dimension = ((net.minecraft.nbt.NBTTagByte)dimension).getByte(); ++ } ++ else ++ { ++ this.dimension = ((net.minecraft.nbt.NBTTagInt)dimension).getInt(); ++ } ++ + this.xCenter = nbt.getInteger("xCenter"); + this.zCenter = nbt.getInteger("zCenter"); + this.scale = nbt.getByte("scale"); +@@ -85,7 +95,7 @@ + + public void writeToNBT(NBTTagCompound nbt) + { +- nbt.setByte("dimension", this.dimension); ++ nbt.setInteger("dimension", this.dimension); + nbt.setInteger("xCenter", this.xCenter); + nbt.setInteger("zCenter", this.zCenter); + nbt.setByte("scale", this.scale); +@@ -164,7 +174,7 @@ + rotation = rotation + (rotation < 0.0D ? -8.0D : 8.0D); + b2 = (byte)((int)(rotation * 16.0D / 360.0D)); + +- if (this.dimension < 0) ++ if (worldIn.provider.shouldMapSpin(entityIdentifier, worldX, worldZ, rotation)) + { + int k = (int)(worldIn.getWorldInfo().getWorldTime() / 10L); + b2 = (byte)(k * k * 34187121 + k * 121 >> 15 & 15); diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch new file mode 100644 index 0000000000..c42cfe274e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch @@ -0,0 +1,105 @@ +--- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java ++++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java +@@ -104,20 +104,29 @@ + { + File file1 = new File(this.worldDirectory, "level.dat"); + ++ WorldInfo worldInfo = null; ++ + if (file1.exists()) + { + try + { + NBTTagCompound nbttagcompound2 = CompressedStreamTools.readCompressed(new FileInputStream(file1)); + NBTTagCompound nbttagcompound3 = nbttagcompound2.getCompoundTag("Data"); +- return new WorldInfo(nbttagcompound3); ++ worldInfo = new WorldInfo(nbttagcompound3); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound2); ++ return worldInfo; + } ++ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) ++ { ++ throw e; ++ } + catch (Exception exception1) + { + exception1.printStackTrace(); + } + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); + file1 = new File(this.worldDirectory, "level.dat_old"); + + if (file1.exists()) +@@ -126,7 +135,13 @@ + { + NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); +- return new WorldInfo(nbttagcompound1); ++ worldInfo = new WorldInfo(nbttagcompound1); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); ++ return worldInfo; ++ } ++ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) ++ { ++ throw e; + } + catch (Exception exception) + { +@@ -143,6 +158,8 @@ + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setTag("Data", nbttagcompound); + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound1); ++ + try + { + File file1 = new File(this.worldDirectory, "level.dat_new"); +@@ -181,6 +198,8 @@ + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setTag("Data", nbttagcompound); + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound1); ++ + try + { + File file1 = new File(this.worldDirectory, "level.dat_new"); +@@ -229,6 +248,7 @@ + } + + file1.renameTo(file2); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(player, this.playersDirectory, player.getUniqueID().toString()); + } + catch (Exception var5) + { +@@ -259,6 +279,7 @@ + player.readFromNBT(nbttagcompound); + } + ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(player, playersDirectory, player.getUniqueID().toString()); + return nbttagcompound; + } + +@@ -300,4 +321,22 @@ + { + return this.saveDirectoryName; + } ++ ++ public NBTTagCompound getPlayerNBT(net.minecraft.entity.player.EntityPlayerMP player) ++ { ++ try ++ { ++ File file1 = new File(this.playersDirectory, player.getUniqueID().toString() + ".dat"); ++ ++ if (file1.exists() && file1.isFile()) ++ { ++ return CompressedStreamTools.readCompressed(new FileInputStream(file1)); ++ } ++ } ++ catch (Exception exception) ++ { ++ logger.warn("Failed to load player data for " + player.getName()); ++ } ++ return null; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch new file mode 100644 index 0000000000..a95b7f74e6 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java ++++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java +@@ -51,6 +51,7 @@ + private int borderWarningDistance = 5; + private int borderWarningTime = 15; + private GameRules theGameRules = new GameRules(); ++ private java.util.Map additionalProperties; + + protected WorldInfo() + { +@@ -745,4 +746,24 @@ + } + }); + } ++ ++ /** ++ * Allow access to additional mod specific world based properties ++ * Used by FML to store mod list associated with a world, and maybe an id map ++ * Used by Forge to store the dimensions available to a world ++ * @param additionalProperties ++ */ ++ public void setAdditionalProperties(java.util.Map additionalProperties) ++ { ++ // one time set for this ++ if (this.additionalProperties == null) ++ { ++ this.additionalProperties = additionalProperties; ++ } ++ } ++ ++ public net.minecraft.nbt.NBTBase getAdditionalProperty(String additionalProperty) ++ { ++ return this.additionalProperties!=null? this.additionalProperties.get(additionalProperty) : null; ++ } + } diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index f53e403c71..c454024ee4 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -1,35 +1,35 @@ #Main Forge Access Transformer configuration file # EntityFishHook -public net.minecraft.entity.projectile.EntityFishHook field_146041_e -public net.minecraft.entity.projectile.EntityFishHook field_146036_f -public net.minecraft.entity.projectile.EntityFishHook field_146039_d +#public net.minecraft.entity.projectile.EntityFishHook field_146041_e +#public net.minecraft.entity.projectile.EntityFishHook field_146036_f +#public net.minecraft.entity.projectile.EntityFishHook field_146039_d # EntityEnderman #public tg.br #FD:EntityEnderman/field_70827_d #carriableBlocks # SoundManager public net.minecraft.client.audio.SoundManager field_148622_c #sndHandler # Block public net.minecraft.block.Block (Lnet/minecraft/block/material/Material;)V -public net.minecraft.block.Block func_149672_a(Lnet.minecraft.block.Block$SoundType;)Lnet.minecraft.block.Block; #setStepSound +#public net.minecraft.block.Block func_149672_a(Lnet.minecraft.block.Block$SoundType;)Lnet.minecraft.block.Block; #setStepSound public net.minecraft.block.Block func_149752_b(F)Lnet.minecraft.block.Block; #setResistance public net.minecraft.block.Block func_149711_c(F)Lnet.minecraft.block.Block; #setHardness public net.minecraft.block.Block func_149713_g(I)Lnet.minecraft.block.Block; #setLightOpacity public net.minecraft.block.Block func_149715_a(F)Lnet.minecraft.block.Block; #setLightValue public net.minecraft.block.Block func_149722_s()Lnet.minecraft.block.Block; #setBlockUnbreakable public net.minecraft.block.Block func_149675_a(Z)Lnet.minecraft.block.Block; #setTickRandomly -public net.minecraft.block.Block func_149676_a(FFFFFF)V #setBlockBounds -public net.minecraft.block.Block func_180637_b(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;I)V # dropXpOnBlockBreak +#public net.minecraft.block.Block func_149676_a(FFFFFF)V #setBlockBounds +#public net.minecraft.block.Block func_180637_b(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;I)V # dropXpOnBlockBreak # BlockFire public net.minecraft.block.BlockFire func_176532_c(Lnet/minecraft/block/Block;)I # getFireSpreadSpeed public net.minecraft.block.BlockFire func_176534_d(Lnet/minecraft/block/Block;)I # getFireSpreadSpeed # Item public net.minecraft.item.Item func_77656_e(I)Lnet.minecraft.item.Item; #setMaxDamage public net.minecraft.item.Item func_77627_a(Z)Lnet.minecraft.item.Item; #setHasSubtypes -public net.minecraft.item.Item func_77631_c(Ljava.lang.String;)Lnet.minecraft.item.Item; #setPotionEffect +#public net.minecraft.item.Item func_77631_c(Ljava.lang.String;)Lnet.minecraft.item.Item; #setPotionEffect # Potion -public-f net.minecraft.potion.Potion field_76415_H #id +#public-f net.minecraft.potion.Potion field_76415_H #id # EntityPlayer -public net.minecraft.entity.player.EntityPlayer func_71012_a(Lnet/minecraft/entity/item/EntityItem;)V #joinEntityItemWithWorld -public net.minecraft.client.entity.EntityPlayerSP func_71012_a(Lnet/minecraft/entity/item/EntityItem;)V #joinEntityItemWithWorld +#public net.minecraft.entity.player.EntityPlayer func_71012_a(Lnet/minecraft/entity/item/EntityItem;)V #joinEntityItemWithWorld +#public net.minecraft.client.entity.EntityPlayerSP func_71012_a(Lnet/minecraft/entity/item/EntityItem;)V #joinEntityItemWithWorld public net.minecraft.entity.player.EntityPlayer func_71053_j()V #closeScreen #public uf.b #FD:EntityPlayer/field_71076_b #sleepTimer # World Gen Chests Related @@ -87,7 +87,7 @@ public net.minecraft.world.gen.structure.MapGenStructureIO func_143031_a(Ljava/l # Stronghold public net.minecraft.world.gen.structure.StructureStrongholdPieces$Stronghold # Packets -public net.minecraft.network.play.server.S23PacketBlockChange field_148883_d # Block +#public net.minecraft.network.play.server.S23PacketBlockChange field_148883_d # Block # WorldType public-f net.minecraft.world.WorldType field_77139_a #worldTypes # DamageSource @@ -101,7 +101,7 @@ public net.minecraft.world.gen.structure.StructureVillagePieces$Village # RenderPlayer public net.minecraft.client.renderer.entity.RenderBiped field_77071_a #modelBipedMain # ChunkProviderServer -public net.minecraft.world.gen.ChunkProviderServer field_73246_d # currentChunkProvider +#public net.minecraft.world.gen.ChunkProviderServer field_73246_d # currentChunkProvider public net.minecraft.world.gen.ChunkProviderServer field_73244_f # loadedChunkHashMap public net.minecraft.world.gen.ChunkProviderServer field_73245_g # loadedChunks public net.minecraft.world.gen.ChunkProviderServer field_73251_h # worldObj @@ -109,47 +109,47 @@ public net.minecraft.world.gen.ChunkProviderServer field_73251_h # worldObj protected net.minecraft.client.renderer.entity.RenderEntityItem func_177078_a(Lnet/minecraft/item/ItemStack;)I # getMiniItemCount public net.minecraft.item.crafting.RecipesBanners$RecipeAddPattern public net.minecraft.item.crafting.RecipesBanners$RecipeDuplicatePattern -public net.minecraft.block.state.BlockState$StateImplementation -protected net.minecraft.block.state.BlockState$StateImplementation (Lnet/minecraft/block/Block;Lcom/google/common/collect/ImmutableMap;)V -protected net.minecraft.block.state.BlockState$StateImplementation field_177238_c # propertyValueTable +#public net.minecraft.block.state.BlockState$StateImplementation +#protected net.minecraft.block.state.BlockState$StateImplementation (Lnet/minecraft/block/Block;Lcom/google/common/collect/ImmutableMap;)V +#protected net.minecraft.block.state.BlockState$StateImplementation field_177238_c # propertyValueTable public net.minecraft.client.renderer.block.model.ModelBlock field_178318_c # textures public net.minecraft.client.renderer.block.model.ModelBlock field_178315_d # parent public net.minecraft.client.renderer.block.model.ModelBlock field_178322_i # ambientOcclusion -protected net.minecraft.client.resources.model.ModelBakery field_177602_b # LOCATIONS_BUILTIN_TEXTURES -protected net.minecraft.client.resources.model.ModelBakery field_177598_f # resourceManager -protected net.minecraft.client.resources.model.ModelBakery field_177599_g # sprites -protected net.minecraft.client.resources.model.ModelBakery field_177609_j # textureMap -protected net.minecraft.client.resources.model.ModelBakery field_177610_k # blockModelShapes -protected net.minecraft.client.resources.model.ModelBakery field_177605_n # bakedRegistry -protected net.minecraft.client.resources.model.ModelBakery field_177606_o # MODEL_GENERATED -protected net.minecraft.client.resources.model.ModelBakery field_177618_p # MODEL_COMPASS -protected net.minecraft.client.resources.model.ModelBakery field_177617_q # MODEL_CLOCK -protected net.minecraft.client.resources.model.ModelBakery field_177616_r # MODEL_ENTITY -protected net.minecraft.client.resources.model.ModelBakery func_177591_a(Ljava/util/Collection;)V # loadVariants -protected net.minecraft.client.resources.model.ModelBakery func_177569_a(Lnet/minecraft/client/renderer/block/model/ModelBlockDefinition;Lnet/minecraft/client/resources/model/ModelResourceLocation;)V # registerVariant -protected net.minecraft.client.resources.model.ModelBakery func_177586_a(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/block/model/ModelBlockDefinition; # getModelBlockDefinition -protected net.minecraft.client.resources.model.ModelBakery func_177594_c(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/block/model/ModelBlock; # loadModel -protected net.minecraft.client.resources.model.ModelBakery func_177592_e()V # registerVariantNames -protected net.minecraft.client.resources.model.ModelBakery func_177596_a(Lnet/minecraft/item/Item;)Ljava/util/List; # getVariantNames -protected net.minecraft.client.resources.model.ModelBakery func_177583_a(Ljava/lang/String;)Lnet/minecraft/util/ResourceLocation; # getItemLocation -protected net.minecraft.client.resources.model.ModelBakery func_177585_a(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Ljava/util/Set; # getTextureLocations -protected net.minecraft.client.resources.model.ModelBakery func_177581_b(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Z # hasItemModel -protected net.minecraft.client.resources.model.ModelBakery func_177587_c(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Z # isCustomRenderer -protected net.minecraft.client.resources.model.ModelBakery func_177582_d(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Lnet/minecraft/client/renderer/block/model/ModelBlock; # makeItemModel -protected net.minecraft.client.resources.model.ModelBakery func_177580_d(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/util/ResourceLocation; # getModelLocation -public net.minecraft.client.resources.model.WeightedBakedModel field_177565_b # models +#protected net.minecraft.client.resources.model.ModelBakery field_177602_b # LOCATIONS_BUILTIN_TEXTURES +#protected net.minecraft.client.resources.model.ModelBakery field_177598_f # resourceManager +#protected net.minecraft.client.resources.model.ModelBakery field_177599_g # sprites +#protected net.minecraft.client.resources.model.ModelBakery field_177609_j # textureMap +#protected net.minecraft.client.resources.model.ModelBakery field_177610_k # blockModelShapes +#protected net.minecraft.client.resources.model.ModelBakery field_177605_n # bakedRegistry +#protected net.minecraft.client.resources.model.ModelBakery field_177606_o # MODEL_GENERATED +#protected net.minecraft.client.resources.model.ModelBakery field_177618_p # MODEL_COMPASS +#protected net.minecraft.client.resources.model.ModelBakery field_177617_q # MODEL_CLOCK +#protected net.minecraft.client.resources.model.ModelBakery field_177616_r # MODEL_ENTITY +#protected net.minecraft.client.resources.model.ModelBakery func_177591_a(Ljava/util/Collection;)V # loadVariants +#protected net.minecraft.client.resources.model.ModelBakery func_177569_a(Lnet/minecraft/client/renderer/block/model/ModelBlockDefinition;Lnet/minecraft/client/resources/model/ModelResourceLocation;)V # registerVariant +#protected net.minecraft.client.resources.model.ModelBakery func_177586_a(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/block/model/ModelBlockDefinition; # getModelBlockDefinition +#protected net.minecraft.client.resources.model.ModelBakery func_177594_c(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/block/model/ModelBlock; # loadModel +#protected net.minecraft.client.resources.model.ModelBakery func_177592_e()V # registerVariantNames +#protected net.minecraft.client.resources.model.ModelBakery func_177596_a(Lnet/minecraft/item/Item;)Ljava/util/List; # getVariantNames +#protected net.minecraft.client.resources.model.ModelBakery func_177583_a(Ljava/lang/String;)Lnet/minecraft/util/ResourceLocation; # getItemLocation +#protected net.minecraft.client.resources.model.ModelBakery func_177585_a(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Ljava/util/Set; # getTextureLocations +#protected net.minecraft.client.resources.model.ModelBakery func_177581_b(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Z # hasItemModel +#protected net.minecraft.client.resources.model.ModelBakery func_177587_c(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Z # isCustomRenderer +#protected net.minecraft.client.resources.model.ModelBakery func_177582_d(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Lnet/minecraft/client/renderer/block/model/ModelBlock; # makeItemModel +#protected net.minecraft.client.resources.model.ModelBakery func_177580_d(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/util/ResourceLocation; # getModelLocation +#public net.minecraft.client.resources.model.WeightedBakedModel field_177565_b # models # EnumFacing public net.minecraft.util.EnumFacing field_82609_l # VALUES public net.minecraft.util.EnumFacing field_176754_o # HORIZONTALS -public net.minecraft.client.renderer.WorldRenderer func_78909_a(I)I # getColorIndex -public net.minecraft.client.renderer.WorldRenderer func_178972_a(IIIII)V # putColorRGBA +#public net.minecraft.client.renderer.WorldRenderer func_78909_a(I)I # getColorIndex +#public net.minecraft.client.renderer.WorldRenderer func_178972_a(IIIII)V # putColorRGBA # ModelBlock Constructor -public net.minecraft.client.renderer.block.model.ModelBlock (Lnet/minecraft/util/ResourceLocation;Ljava/util/List;Ljava/util/Map;ZZLnet/minecraft/client/renderer/block/model/ItemCameraTransforms;)V +#public net.minecraft.client.renderer.block.model.ModelBlock (Lnet/minecraft/util/ResourceLocation;Ljava/util/List;Ljava/util/Map;ZZLnet/minecraft/client/renderer/block/model/ItemCameraTransforms;)V # RenderLivingEntity -public net.minecraft.client.renderer.entity.RendererLivingEntity func_177094_a(Lnet/minecraft/client/renderer/entity/layers/LayerRenderer;)Z # addLayer +#public net.minecraft.client.renderer.entity.RendererLivingEntity func_177094_a(Lnet/minecraft/client/renderer/entity/layers/LayerRenderer;)Z # addLayer # S00PacketServerInfo -public net.minecraft.network.status.server.S00PacketServerInfo field_149297_a # GSON +#public net.minecraft.network.status.server.S00PacketServerInfo field_149297_a # GSON #Main FML Access Transformer configuration file # TileEntity addMapping @@ -194,7 +194,7 @@ public net.minecraft.world.storage.SaveFormatOld field_75808_a # savesDirectory protected net.minecraft.util.ObjectIntIdentityMap field_148749_a # internal map protected net.minecraft.util.ObjectIntIdentityMap field_148748_b # internal index list -protected-f net.minecraft.util.RegistryNamespaced field_148759_a # identitymap +#protected-f net.minecraft.util.RegistryNamespaced field_148759_a # identitymap # GuiButton public net.minecraft.client.gui.GuiButton field_146120_f # width - needed for config GUI stuff @@ -231,5 +231,5 @@ protected net.minecraft.client.gui.FontRenderer func_78266_a(IZ)F # renderDefaul protected net.minecraft.client.gui.FontRenderer func_78277_a(CZ)F # renderUnicodeChar # ServerConfigurationManager -public net.minecraft.server.management.ServerConfigurationManager field_72404_b #playerEntityList - private in 1.8.8 -public net.minecraft.server.management.ServerConfigurationManager field_177454_f #uuidToPlayerMap - private in 1.8.8 +#public net.minecraft.server.management.ServerConfigurationManager field_72404_b #playerEntityList - private in 1.8.8 +#public net.minecraft.server.management.ServerConfigurationManager field_177454_f #uuidToPlayerMap - private in 1.8.8 From 213abdb561320864dbe34c72265e2d70d46b5005 Mon Sep 17 00:00:00 2001 From: cpw Date: Mon, 29 Feb 2016 21:45:40 -0500 Subject: [PATCH 003/243] Add rejects with mcp names for application to main codebase. Let's roll? --- .../net/minecraft/block/Block.java.patch.rej | 91 +++ .../block/BlockBanner.java.patch.rej | 24 + .../minecraft/block/BlockBush.java.patch.rej | 23 + .../block/BlockButton.java.patch.rej | 11 + .../block/BlockCactus.java.patch.rej | 10 + .../minecraft/block/BlockChest.java.patch.rej | 10 + .../minecraft/block/BlockCrops.java.patch.rej | 36 + .../block/BlockDeadBush.java.patch.rej | 23 + .../minecraft/block/BlockDoor.java.patch.rej | 10 + .../block/BlockDoublePlant.java.patch.rej | 19 + .../block/BlockFalling.java.patch.rej | 9 + .../minecraft/block/BlockFire.java.patch.rej | 98 +++ .../minecraft/block/BlockGrass.java.patch.rej | 20 + .../minecraft/block/BlockIce.java.patch.rej | 35 + .../block/BlockLadder.java.patch.rej | 23 + .../block/BlockLeaves.java.patch.rej | 36 + .../minecraft/block/BlockLog.java.patch.rej | 13 + .../block/BlockMobSpawner.java.patch.rej | 18 + .../block/BlockMushroom.java.patch.rej | 10 + .../block/BlockMycelium.java.patch.rej | 20 + .../block/BlockNetherWart.java.patch.rej | 10 + .../block/BlockNewLeaf.java.patch.rej | 23 + .../block/BlockOldLeaf.java.patch.rej | 20 + .../minecraft/block/BlockPane.java.patch.rej | 16 + .../block/BlockPistonBase.java.patch.rej | 32 + .../block/BlockPistonMoving.java.patch.rej | 19 + .../block/BlockPotato.java.patch.rej | 24 + .../block/BlockPumpkin.java.patch.rej | 10 + .../block/BlockRailBase.java.patch.rej | 11 + .../block/BlockRedstoneWire.java.patch.rej | 59 ++ .../minecraft/block/BlockSkull.java.patch.rej | 10 + .../minecraft/block/BlockSlab.java.patch.rej | 19 + .../minecraft/block/BlockSnow.java.patch.rej | 22 + .../block/BlockStairs.java.patch.rej | 21 + .../block/BlockTallGrass.java.patch.rej | 25 + .../block/BlockTrapDoor.java.patch.rej | 45 ++ .../block/BlockTripWireHook.java.patch.rej | 28 + .../minecraft/block/BlockVine.java.patch.rej | 15 + .../BlockPistonStructureHelper.java.patch.rej | 30 + .../block/state/BlockState.java.patch.rej | 55 ++ .../minecraft/client/Minecraft.java.patch.rej | 347 +++++++++ .../client/audio/SoundManager.java.patch.rej | 25 + .../entity/EntityPlayerSP.java.patch.rej | 14 + .../client/gui/FontRenderer.java.patch.rej | 33 + .../client/gui/GuiChat.java.patch.rej | 40 + .../client/gui/GuiCreateWorld.java.patch.rej | 10 + .../client/gui/GuiSelectWorld.java.patch.rej | 10 + .../client/gui/GuiSlot.java.patch.rej | 19 + .../GuiUtilRenderComponents.java.patch.rej | 9 + .../GuiAchievements.java.patch.rej | 46 ++ .../gui/achievement/GuiStats.java.patch.rej | 62 ++ .../GuiContainerCreative.java.patch.rej | 25 + .../client/model/ModelBox.java.patch.rej | 9 + .../PositionTextureVertex.java.patch.rej | 12 + .../client/model/TexturedQuad.java.patch.rej | 12 + .../multiplayer/GuiConnecting.java.patch.rej | 10 + .../PlayerControllerMP.java.patch.rej | 77 ++ .../NetHandlerPlayClient.java.patch.rej | 23 + .../network/OldServerPinger.java.patch.rej | 9 + .../particle/EffectRenderer.java.patch.rej | 19 + .../BlockModelRenderer.java.patch.rej | 23 + .../BlockRendererDispatcher.java.patch.rej | 50 ++ .../renderer/EntityRenderer.java.patch.rej | 74 ++ .../InventoryEffectRenderer.java.patch.rej | 9 + .../renderer/ItemRenderer.java.patch.rej | 39 + .../renderer/RenderGlobal.java.patch.rej | 51 ++ .../renderer/WorldRenderer.java.patch.rej | 41 + .../WorldVertexBufferUploader.java.patch.rej | 66 ++ .../block/model/FaceBakery.java.patch.rej | 70 ++ .../model/ModelBlockDefinition.java.patch.rej | 19 + .../block/statemap/StateMap.java.patch.rej | 10 + .../renderer/chunk/RenderChunk.java.patch.rej | 12 + .../entity/RenderEntityItem.java.patch.rej | 39 + .../renderer/entity/RenderItem.java.patch.rej | 96 +++ .../entity/RenderManager.java.patch.rej | 13 + .../RendererLivingEntity.java.patch.rej | 68 ++ .../layers/LayerArmorBase.java.patch.rej | 93 +++ .../texture/TextureMap.java.patch.rej | 83 ++ ...ileEntityRendererDispatcher.java.patch.rej | 16 + .../resources/LanguageManager.java.patch.rej | 9 + .../model/IBakedModel.java.patch.rej | 8 + .../model/ModelBakery.java.patch.rej | 131 ++++ .../model/ModelManager.java.patch.rej | 13 + .../model/ModelRotation.java.patch.rej | 21 + .../command/CommandBase.java.patch.rej | 10 + .../command/CommandEnchant.java.patch.rej | 10 + .../command/CommandFill.java.patch.rej | 20 + .../command/CommandHandler.java.patch.rej | 10 + .../command/PlayerSelector.java.patch.rej | 13 + .../server/CommandSetBlock.java.patch.rej | 20 + .../server/CommandTestForBlock.java.patch.rej | 10 + .../enchantment/Enchantment.java.patch.rej | 57 ++ .../EnchantmentHelper.java.patch.rej | 23 + .../minecraft/entity/Entity.java.patch.rej | 59 ++ .../entity/EntityAgeable.java.patch.rej | 10 + .../entity/EntityHanging.java.patch.rej | 11 + .../entity/EntityList.java.patch.rej | 11 + .../entity/EntityLivingBase.java.patch.rej | 76 ++ .../EntityMinecartCommandBlock.java.patch.rej | 9 + .../entity/EntityTrackerEntry.java.patch.rej | 32 + .../ai/EntityAIAttackOnCollide.java.patch.rej | 56 ++ .../entity/boss/EntityDragon.java.patch.rej | 13 + .../entity/boss/EntityWither.java.patch.rej | 10 + .../boss/IBossDisplayData.java.patch.rej | 9 + .../entity/item/EntityMinecart.java.patch.rej | 289 +++++++ .../item/EntityMinecartEmpty.java.patch.rej | 9 + .../item/EntityMinecartFurnace.java.patch.rej | 9 + .../monster/EntityEnderman.java.patch.rej | 19 + .../monster/EntityZombie.java.patch.rej | 42 + .../passive/EntityMooshroom.java.patch.rej | 19 + .../passive/EntityOcelot.java.patch.rej | 10 + .../entity/passive/EntitySheep.java.patch.rej | 15 + .../passive/EntityVillager.java.patch.rej | 9 + .../entity/player/EntityPlayer.java.patch.rej | 256 ++++++ .../player/EntityPlayerMP.java.patch.rej | 55 ++ .../player/InventoryPlayer.java.patch.rej | 16 + .../projectile/EntityFishHook.java.patch.rej | 21 + .../minecraft/init/Bootstrap.java.patch.rej | 10 + .../ContainerBrewingStand.java.patch.rej | 30 + .../ContainerEnchantment.java.patch.rej | 10 + .../inventory/ContainerPlayer.java.patch.rej | 11 + .../inventory/ContainerRepair.java.patch.rej | 20 + .../net/minecraft/item/Item.java.patch.rej | 735 ++++++++++++++++++ .../minecraft/item/ItemArmor.java.patch.rej | 31 + .../minecraft/item/ItemBlock.java.patch.rej | 19 + .../net/minecraft/item/ItemBow.java.patch.rej | 22 + .../minecraft/item/ItemBucket.java.patch.rej | 11 + .../net/minecraft/item/ItemDye.java.patch.rej | 10 + .../item/ItemEmptyMap.java.patch.rej | 10 + .../item/ItemFlintAndSteel.java.patch.rej | 10 + .../net/minecraft/item/ItemHoe.java.patch.rej | 16 + .../minecraft/item/ItemLilyPad.java.patch.rej | 16 + .../net/minecraft/item/ItemMap.java.patch.rej | 10 + .../item/ItemMonsterPlacer.java.patch.rej | 88 +++ .../item/ItemSeedFood.java.patch.rej | 10 + .../minecraft/item/ItemSeeds.java.patch.rej | 10 + .../minecraft/item/ItemShears.java.patch.rej | 16 + .../minecraft/item/ItemSkull.java.patch.rej | 32 + .../minecraft/item/ItemStack.java.patch.rej | 101 +++ .../NetHandlerPlayServer.java.patch.rej | 129 +++ .../network/NetworkSystem.java.patch.rej | 10 + .../C17PacketCustomPayload.java.patch.rej | 13 + .../S3FPacketCustomPayload.java.patch.rej | 13 + .../server/S00PacketServerInfo.java.patch.rej | 10 + .../minecraft/potion/Potion.java.patch.rej | 46 ++ .../potion/PotionEffect.java.patch.rej | 39 + .../realms/RealmsConnect.java.patch.rej | 10 + .../server/MinecraftServer.java.patch.rej | 46 ++ .../dedicated/DedicatedServer.java.patch.rej | 18 + .../IntegratedServer.java.patch.rej | 58 ++ .../ItemInWorldManager.java.patch.rej | 276 +++++++ .../management/PlayerManager.java.patch.rej | 223 ++++++ .../ServerConfigurationManager.java.patch.rej | 237 ++++++ .../NetHandlerLoginServer.java.patch.rej | 26 + .../minecraft/stats/StatList.java.patch.rej | 20 + .../tileentity/TileEntity.java.patch.rej | 32 + .../TileEntityBrewingStand.java.patch.rej | 63 ++ .../minecraft/util/BlockPos.java.patch.rej | 32 + .../util/ChatComponentStyle.java.patch.rej | 9 + .../minecraft/util/ChatStyle.java.patch.rej | 9 + .../minecraft/util/EnumFacing.java.patch.rej | 10 + .../util/EnumWorldBlockLayer.java.patch.rej | 11 + .../util/IChatComponent.java.patch.rej | 9 + .../util/MovingObjectPosition.java.patch.rej | 14 + .../util/ResourceLocation.java.patch.rej | 27 + .../net/minecraft/util/Session.java.patch.rej | 21 + .../util/StringTranslate.java.patch.rej | 54 ++ .../net/minecraft/util/Vec3.java.patch.rej | 37 + .../WeightedRandomChestContent.java.patch.rej | 67 ++ .../minecraft/world/ChunkCache.java.patch.rej | 10 + .../minecraft/world/Explosion.java.patch.rej | 18 + .../world/SpawnerAnimals.java.patch.rej | 53 ++ .../net/minecraft/world/World.java.patch.rej | 319 ++++++++ .../world/WorldProvider.java.patch.rej | 47 ++ .../world/WorldServer.java.patch.rej | 108 +++ .../biome/BiomeColorHelper.java.patch.rej | 10 + .../world/biome/BiomeDecorator.java.patch.rej | 54 ++ .../world/biome/BiomeGenBase.java.patch.rej | 107 +++ .../biome/WorldChunkManager.java.patch.rej | 47 ++ .../world/chunk/Chunk.java.patch.rej | 98 +++ .../storage/AnvilChunkLoader.java.patch.rej | 41 + .../storage/AnvilSaveHandler.java.patch.rej | 22 + .../world/gen/ChunkProviderEnd.java.patch.rej | 60 ++ .../gen/ChunkProviderGenerate.java.patch.rej | 117 +++ .../gen/ChunkProviderHell.java.patch.rej | 144 ++++ .../gen/ChunkProviderServer.java.patch.rej | 85 ++ .../world/gen/MapGenCaves.java.patch.rej | 37 + .../world/gen/MapGenRavine.java.patch.rej | 32 + .../WorldGenBigMushroom.java.patch.rej | 34 + .../feature/WorldGenBigTree.java.patch.rej | 13 + .../feature/WorldGenCanopyTree.java.patch.rej | 34 + .../feature/WorldGenDeadBush.java.patch.rej | 16 + .../feature/WorldGenDungeons.java.patch.rej | 15 + .../gen/feature/WorldGenForest.java.patch.rej | 52 ++ .../feature/WorldGenHugeTrees.java.patch.rej | 26 + .../WorldGenMegaPineTree.java.patch.rej | 63 ++ .../WorldGenSavannaTree.java.patch.rej | 39 + .../gen/feature/WorldGenShrub.java.patch.rej | 31 + .../gen/feature/WorldGenSwamp.java.patch.rej | 80 ++ .../gen/feature/WorldGenTaiga1.java.patch.rej | 24 + .../gen/feature/WorldGenTaiga2.java.patch.rej | 52 ++ .../feature/WorldGenTallGrass.java.patch.rej | 16 + .../gen/feature/WorldGenTrees.java.patch.rej | 88 +++ .../WorldGeneratorBonusChest.java.patch.rej | 16 + .../world/gen/layer/GenLayer.java.patch.rej | 10 + .../gen/layer/GenLayerBiome.java.patch.rej | 84 ++ ...onentScatteredFeaturePieces.java.patch.rej | 55 ++ .../structure/MapGenStronghold.java.patch.rej | 21 + .../StructureMineshaftPieces.java.patch.rej | 19 + ...StructureNetherBridgePieces.java.patch.rej | 29 + .../StructureStrongholdPieces.java.patch.rej | 37 + .../StructureVillagePieces.java.patch.rej | 19 + .../world/storage/MapData.java.patch.rej | 10 + .../world/storage/SaveHandler.java.patch.rej | 57 ++ 214 files changed, 9282 insertions(+) create mode 100644 rejects/minecraft/net/minecraft/block/Block.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockBanner.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockBush.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockButton.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockCactus.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockChest.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockDeadBush.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockDoor.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockFalling.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockIce.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockNetherWart.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockNewLeaf.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockOldLeaf.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockPane.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockPotato.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockPumpkin.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockSlab.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockStairs.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockTallGrass.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/audio/SoundManager.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/model/ModelBox.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/model/TexturedQuad.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/command/CommandBase.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/command/CommandEnchant.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/command/CommandFill.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/command/CommandHandler.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/command/PlayerSelector.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/Entity.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/EntityAgeable.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/EntityHanging.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/Item.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemArmor.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemBucket.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemDye.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemEmptyMap.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemHoe.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemLilyPad.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemMap.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemSeedFood.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemSeeds.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemShears.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemSkull.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/potion/Potion.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/realms/RealmsConnect.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/BlockPos.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/ChatComponentStyle.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/ChatStyle.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/IChatComponent.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/MovingObjectPosition.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/ResourceLocation.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/Session.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/Vec3.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/ChunkCache.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/SpawnerAnimals.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/World.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/chunk/Chunk.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/storage/MapData.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej diff --git a/rejects/minecraft/net/minecraft/block/Block.java.patch.rej b/rejects/minecraft/net/minecraft/block/Block.java.patch.rej new file mode 100644 index 0000000000..d61ccd936f --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/Block.java.patch.rej @@ -0,0 +1,91 @@ +++++ REJECTED PATCH 1 + public class Block + { + private static final ResourceLocation AIR_ID = new ResourceLocation("air"); +- public static final RegistryNamespacedDefaultedByKey blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID); +- public static final ObjectIntIdentityMap BLOCK_STATE_IDS = new ObjectIntIdentityMap(); ++ public static final RegistryNamespacedDefaultedByKey blockRegistry = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); ++ @Deprecated //Modders: DO NOT use this! Use GameRegistry ++ public static final ObjectIntIdentityMap BLOCK_STATE_IDS = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); + private CreativeTabs displayOnCreativeTab; + public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F); + public static final Block.SoundType soundTypeWood = new Block.SoundType("wood", 1.0F, 1.0F); +++++ END PATCH +++++ REJECTED PATCH 6 + public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos).getBlock(); +- int i = worldIn.getCombinedLight(pos, block.getLightValue()); ++ int i = worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); + + if (i == 0 && block instanceof BlockSlab) + { + pos = pos.down(); + block = worldIn.getBlockState(pos).getBlock(); +- return worldIn.getCombinedLight(pos, block.getLightValue()); ++ return worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); + } + else + { +++++ END PATCH +++++ REJECTED PATCH 7 + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { +- return side == EnumFacing.DOWN && this.minY > 0.0D ? true : (side == EnumFacing.UP && this.maxY < 1.0D ? true : (side == EnumFacing.NORTH && this.minZ > 0.0D ? true : (side == EnumFacing.SOUTH && this.maxZ < 1.0D ? true : (side == EnumFacing.WEST && this.minX > 0.0D ? true : (side == EnumFacing.EAST && this.maxX < 1.0D ? true : !worldIn.getBlockState(pos).getBlock().isOpaqueCube()))))); ++ return side == EnumFacing.DOWN && this.minY > 0.0D ? true : (side == EnumFacing.UP && this.maxY < 1.0D ? true : (side == EnumFacing.NORTH && this.minZ > 0.0D ? true : (side == EnumFacing.SOUTH && this.maxZ < 1.0D ? true : (side == EnumFacing.WEST && this.minX > 0.0D ? true : (side == EnumFacing.EAST && this.maxX < 1.0D ? true : !worldIn.getBlockState(pos).getBlock().doesSideBlockRendering(worldIn, pos, side)))))); + } + + public boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side) +++++ END PATCH +++++ REJECTED PATCH 9 + + public float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos) + { +- float f = this.getBlockHardness(worldIn, pos); +- return f < 0.0F ? 0.0F : (!playerIn.canHarvestBlock(this) ? playerIn.getToolDigEfficiency(this) / f / 100.0F : playerIn.getToolDigEfficiency(this) / f / 30.0F); ++ return net.minecraftforge.common.ForgeHooks.blockStrength(worldIn.getBlockState(pos), playerIn, worldIn, pos); + } + + public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture) +++++ END PATCH +++++ REJECTED PATCH 13 + player.triggerAchievement(StatList.mineBlockStatArray[getIdFromBlock(this)]); + player.addExhaustion(0.025F); + +- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) ++ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) + { ++ java.util.ArrayList items = new java.util.ArrayList(); + ItemStack itemstack = this.createStackedBlock(state); + + if (itemstack != null) + { +- spawnAsEntity(worldIn, pos, itemstack); ++ items.add(itemstack); + } ++ ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); ++ for (ItemStack stack : items) ++ { ++ spawnAsEntity(worldIn, pos, stack); ++ } + } + else + { ++ harvesters.set(player); + int i = EnchantmentHelper.getFortuneModifier(player); + this.dropBlockAsItem(worldIn, pos, state, i); ++ harvesters.set(null); + } + } + ++ @Deprecated //Forge: State sensitive version + protected boolean canSilkHarvest() + { +- return this.isFullCube() && !this.isBlockContainer; ++ return this.isFullCube() && !this.hasTileEntity(silk_check_state.get()); + } + + protected ItemStack createStackedBlock(IBlockState state) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockBanner.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockBanner.java.patch.rej new file mode 100644 index 0000000000..f9e04393ab --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockBanner.java.patch.rej @@ -0,0 +1,24 @@ +++++ REJECTED PATCH 1 + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- TileEntity tileentity = worldIn.getTileEntity(pos); +- +- if (tileentity instanceof TileEntityBanner) + { +- ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor()); +- NBTTagCompound nbttagcompound = new NBTTagCompound(); +- tileentity.writeToNBT(nbttagcompound); +- nbttagcompound.removeTag("x"); +- nbttagcompound.removeTag("y"); +- nbttagcompound.removeTag("z"); +- nbttagcompound.removeTag("id"); +- itemstack.setTagInfo("BlockEntityTag", nbttagcompound); +- spawnAsEntity(worldIn, pos, itemstack); +- } +- else +- { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockBush.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockBush.java.patch.rej new file mode 100644 index 0000000000..486e8a9c09 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockBush.java.patch.rej @@ -0,0 +1,23 @@ +++++ REJECTED PATCH 2 + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return super.canPlaceBlockAt(worldIn, pos) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return super.canPlaceBlockAt(worldIn, pos) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); + } + + protected boolean canPlaceBlockOn(Block ground) +++++ END PATCH +++++ REJECTED PATCH 3 + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ BlockPos down = pos.down(); ++ Block soil = worldIn.getBlockState(down).getBlock(); ++ if (state.getBlock() != this) return this.canPlaceBlockOn(soil); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. ++ return soil.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, this); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockButton.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockButton.java.patch.rej new file mode 100644 index 0000000000..c5be66b879 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockButton.java.patch.rej @@ -0,0 +1,11 @@ +++++ REJECTED PATCH 1 + + protected static boolean func_181088_a(World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_) + { +- BlockPos blockpos = p_181088_1_.offset(p_181088_2_); +- return p_181088_2_ == EnumFacing.DOWN ? World.doesBlockHaveSolidTopSurface(p_181088_0_, blockpos) : p_181088_0_.getBlockState(blockpos).getBlock().isNormalCube(); ++ return p_181088_2_ == EnumFacing.DOWN && World.doesBlockHaveSolidTopSurface(p_181088_0_, p_181088_1_.down()) ? true : p_181088_0_.isSideSolid(p_181088_1_.offset(p_181088_2_), p_181088_2_.getOpposite()); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockCactus.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockCactus.java.patch.rej new file mode 100644 index 0000000000..1ee2a7d58e --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockCactus.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + } + + Block block = worldIn.getBlockState(pos.down()).getBlock(); +- return block == Blocks.cactus || block == Blocks.sand; ++ return block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this); + } + + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockChest.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockChest.java.patch.rej new file mode 100644 index 0000000000..04c3b7337d --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockChest.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + private boolean isBelowSolidBlock(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); ++ return worldIn.isSideSolid(pos.up(), EnumFacing.DOWN, false); + } + + private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej new file mode 100644 index 0000000000..a7266477b9 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej @@ -0,0 +1,36 @@ +++++ REJECTED PATCH 2 + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); + } + + protected Item getSeed() +++++ END PATCH +++++ REJECTED PATCH 3 + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); +- +- if (!worldIn.isRemote) +- { +- int i = ((Integer)state.getValue(AGE)).intValue(); +- +- if (i >= 7) +- { +- int j = 3 + fortune; +- +- for (int k = 0; k < j; ++k) +- { +- if (worldIn.rand.nextInt(15) <= i) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0)); +- } +- } +- } +- } + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockDeadBush.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockDeadBush.java.patch.rej new file mode 100644 index 0000000000..4f374066a5 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockDeadBush.java.patch.rej @@ -0,0 +1,23 @@ +++++ REJECTED PATCH 2 + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0)); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } ++ ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } ++ @Override ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(Blocks.deadbush))); ++ } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockDoor.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockDoor.java.patch.rej new file mode 100644 index 0000000000..52398567de --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockDoor.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return pos.getY() >= 255 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); ++ return pos.getY() >= worldIn.getHeight() - 1 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); + } + + public int getMobilityFlag() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej new file mode 100644 index 0000000000..3ee0513663 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 4 + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (worldIn.isRemote || player.getCurrentEquippedItem() == null || player.getCurrentEquippedItem().getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player)) + { + super.harvestBlock(worldIn, player, pos, state, te); + } +++++ END PATCH +++++ REJECTED PATCH 5 + else + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta(); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i)); + return true; + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockFalling.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockFalling.java.patch.rej new file mode 100644 index 0000000000..1e3ea5ded9 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockFalling.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + + public static boolean canFallInto(World worldIn, BlockPos pos) + { ++ if (worldIn.isAirBlock(pos)) return true; + Block block = worldIn.getBlockState(pos).getBlock(); + Material material = block.blockMaterial; + return block == Blocks.fire || material == Material.air || material == Material.water || material == Material.lava; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej new file mode 100644 index 0000000000..f7a3c601f9 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej @@ -0,0 +1,98 @@ +++++ REJECTED PATCH 1 + int j = pos.getY(); + int k = pos.getZ(); + +- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) ++ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) + { + boolean flag = (i + j + k & 1) == 1; + boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1; + int l = 0; + +- if (this.canCatchFire(worldIn, pos.up())) ++ if (this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) + { + l = flag ? 1 : 2; + } + +- return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west()))).withProperty(UPPER, Integer.valueOf(l)).withProperty(FLIP, Boolean.valueOf(flag1)).withProperty(ALT, Boolean.valueOf(flag)); ++ return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH))) ++ .withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east(), EnumFacing.EAST ))) ++ .withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH))) ++ .withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST ))) ++ .withProperty(UPPER, Integer.valueOf(l)) ++ .withProperty(FLIP, Boolean.valueOf(flag1)) ++ .withProperty(ALT, Boolean.valueOf(flag)); + } + else + { +++++ END PATCH +++++ REJECTED PATCH 3 + } + + Block block = worldIn.getBlockState(pos.down()).getBlock(); +- boolean flag = block == Blocks.netherrack; ++ boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP); + +- if (worldIn.provider instanceof WorldProviderEnd && block == Blocks.bedrock) +- { +- flag = true; +- } +- + if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos)) + { + worldIn.setBlockToAir(pos); +++++ END PATCH +++++ REJECTED PATCH 10 + worldIn.playSound((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false); + } + +- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) ++ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) + { +- if (Blocks.fire.canCatchFire(worldIn, pos.west())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.west(), EnumFacing.EAST)) + { + for (int j = 0; j < 2; ++j) + { +++++ END PATCH +++++ REJECTED PATCH 11 + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.east())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.east(), EnumFacing.WEST)) + { + for (int k = 0; k < 2; ++k) + { +++++ END PATCH +++++ REJECTED PATCH 12 + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.north())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH)) + { + for (int l = 0; l < 2; ++l) + { +++++ END PATCH +++++ REJECTED PATCH 13 + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.south())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH)) + { + for (int i1 = 0; i1 < 2; ++i1) + { +++++ END PATCH +++++ REJECTED PATCH 14 + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.up())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) + { + for (int j1 = 0; j1 < 2; ++j1) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej new file mode 100644 index 0000000000..279e147efb --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej @@ -0,0 +1,20 @@ +++++ REJECTED PATCH 1 + { + if (!worldIn.isRemote) + { +- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) ++ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) + { + worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); + } +++++ END PATCH +++++ REJECTED PATCH 2 + Block block = worldIn.getBlockState(blockpos.up()).getBlock(); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + +- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) ++ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2) + { + worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState()); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockIce.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockIce.java.patch.rej new file mode 100644 index 0000000000..f817b3e8d2 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockIce.java.patch.rej @@ -0,0 +1,35 @@ +++++ REJECTED PATCH 1 + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + player.addExhaustion(0.025F); + +- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) ++ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) + { ++ java.util.List items = new java.util.ArrayList(); + ItemStack itemstack = this.createStackedBlock(state); + +- if (itemstack != null) +- { +- spawnAsEntity(worldIn, pos, itemstack); +- } ++ if (itemstack != null) items.add(itemstack); ++ ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); ++ ++ for (ItemStack is : items) ++ spawnAsEntity(worldIn, pos, is); + } + else + { +++++ END PATCH +++++ REJECTED PATCH 2 + } + + int i = EnchantmentHelper.getFortuneModifier(player); ++ harvesters.set(player); + this.dropBlockAsItem(worldIn, pos, state, i); ++ harvesters.set(null); + Material material = worldIn.getBlockState(pos.down()).getBlock().getMaterial(); + + if (material.blocksMovement() || material.isLiquid()) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej new file mode 100644 index 0000000000..505d3e36f3 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej @@ -0,0 +1,23 @@ +++++ REJECTED PATCH 1 + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos.west()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.east()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.north()).getBlock().isNormalCube() ? true : worldIn.getBlockState(pos.south()).getBlock().isNormalCube())); ++ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST, true) || ++ worldIn.isSideSolid(pos.east(), EnumFacing.WEST, true) || ++ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH, true) || ++ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH, true); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) +++++ END PATCH +++++ REJECTED PATCH 2 + + protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing) + { +- return worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock().isNormalCube(); ++ return worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing, true); + } + + public IBlockState getStateFromMeta(int meta) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej new file mode 100644 index 0000000000..a5f1a72c8b --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej @@ -0,0 +1,36 @@ +++++ REJECTED PATCH 1 + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public abstract class BlockLeaves extends BlockLeavesBase ++public abstract class BlockLeaves extends BlockLeavesBase implements net.minecraftforge.common.IShearable + { + public static final PropertyBool DECAYABLE = PropertyBool.create("decayable"); + public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay"); +++++ END PATCH +++++ REJECTED PATCH 2 + BlockPos blockpos = pos.add(j1, k1, l1); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + +- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(CHECK_DECAY)).booleanValue()) ++ if (iblockstate.getBlock().isLeaves(worldIn, blockpos)) + { +- worldIn.setBlockState(blockpos, iblockstate.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4); ++ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos); + } + } + } +++++ END PATCH +++++ REJECTED PATCH 3 + { + Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2)).getBlock(); + +- if (block != Blocks.log && block != Blocks.log2) ++ if (!block.canSustainLeaves(worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2))) + { +- if (block.getMaterial() == Material.leaves) ++ if (block.isLeaves(worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2))) + { + this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej new file mode 100644 index 0000000000..b6f0ea738f --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej @@ -0,0 +1,13 @@ +++++ REJECTED PATCH 1 + { + IBlockState iblockstate = worldIn.getBlockState(blockpos); + +- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(BlockLeaves.CHECK_DECAY)).booleanValue()) ++ if (iblockstate.getBlock().isLeaves(worldIn, blockpos)) + { +- worldIn.setBlockState(blockpos, iblockstate.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4); ++ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos); + } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej new file mode 100644 index 0000000000..4d2b2a44dc --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej @@ -0,0 +1,18 @@ +++++ REJECTED PATCH 1 + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); +- int i = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15); +- this.dropXpOnBlockBreak(worldIn, pos, i); + } + ++ @Override ++ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); ++ } ++ + public boolean isOpaqueCube() + { + return false; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej new file mode 100644 index 0000000000..3f22ed398a --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + if (pos.getY() >= 0 && pos.getY() < 256) + { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); +- return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate.getBlock())); ++ return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate.getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this)); + } + else + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej new file mode 100644 index 0000000000..0124ec07f0 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej @@ -0,0 +1,20 @@ +++++ REJECTED PATCH 1 + { + if (!worldIn.isRemote) + { +- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) ++ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) + { + worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); + } +++++ END PATCH +++++ REJECTED PATCH 2 + IBlockState iblockstate = worldIn.getBlockState(blockpos); + Block block = worldIn.getBlockState(blockpos.up()).getBlock(); + +- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) ++ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2) + { + worldIn.setBlockState(blockpos, this.getDefaultState()); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockNetherWart.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockNetherWart.java.patch.rej new file mode 100644 index 0000000000..21e6728f20 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockNetherWart.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return super.canBlockStay(worldIn, pos, state); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockNewLeaf.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockNewLeaf.java.patch.rej new file mode 100644 index 0000000000..5718e98e1f --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockNewLeaf.java.patch.rej @@ -0,0 +1,23 @@ +++++ REJECTED PATCH 1 + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4)); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } ++ ++ @Override ++ public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ IBlockState state = world.getBlockState(pos); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4))); ++ } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockOldLeaf.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockOldLeaf.java.patch.rej new file mode 100644 index 0000000000..3b338ffd49 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockOldLeaf.java.patch.rej @@ -0,0 +1,20 @@ +++++ REJECTED PATCH 1 + if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata())); + } + else + { + super.harvestBlock(worldIn, player, pos, state, te); + } + } ++ ++ @Override ++ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) ++ { ++ IBlockState state = world.getBlockState(pos); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata()))); ++ } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockPane.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockPane.java.patch.rej new file mode 100644 index 0000000000..d8053e475a --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockPane.java.patch.rej @@ -0,0 +1,16 @@ +++++ REJECTED PATCH 2 + + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { +- boolean flag = this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()); +- boolean flag1 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()); +- boolean flag2 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()); +- boolean flag3 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()); ++ boolean flag = this.canPaneConnectTo(worldIn, pos, EnumFacing.NORTH); ++ boolean flag1 = this.canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH); ++ boolean flag2 = this.canPaneConnectTo(worldIn, pos, EnumFacing.WEST); ++ boolean flag3 = this.canPaneConnectTo(worldIn, pos, EnumFacing.EAST); + + if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej new file mode 100644 index 0000000000..fa4f50663f --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej @@ -0,0 +1,32 @@ +++++ REJECTED PATCH 1 + } + } + +- if (!flag1 && block.getMaterial() != Material.air && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) ++ if (!flag1 && !block.isAir(worldIn, blockpos) && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) + { + this.doMove(worldIn, pos, enumfacing, false); + } +++++ END PATCH +++++ REJECTED PATCH 2 + return false; + } + +- return !(blockIn instanceof ITileEntityProvider); ++ return !(blockIn.hasTileEntity(worldIn.getBlockState(pos))); + } + else + { +++++ END PATCH +++++ REJECTED PATCH 3 + { + BlockPos blockpos = (BlockPos)list1.get(j); + Block block = worldIn.getBlockState(blockpos).getBlock(); +- block.dropBlockAsItem(worldIn, blockpos, worldIn.getBlockState(blockpos), 0); ++ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. ++ float chance = block instanceof BlockSnow ? -1.0f : 1.0f; ++ block.dropBlockAsItemWithChance(worldIn, blockpos, worldIn.getBlockState(blockpos), chance, 0); + worldIn.setBlockToAir(blockpos); + --i; + ablock[i] = block; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej new file mode 100644 index 0000000000..7d2e63e434 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 1 + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) +- { +- TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); +- +- if (tileentitypiston != null) +- { +- IBlockState iblockstate = tileentitypiston.getPistonState(); +- iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0); +- } +- } ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockPotato.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockPotato.java.patch.rej new file mode 100644 index 0000000000..2296b2add8 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockPotato.java.patch.rej @@ -0,0 +1,24 @@ +++++ REJECTED PATCH 1 + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); +- +- if (!worldIn.isRemote) +- { +- if (((Integer)state.getValue(AGE)).intValue() >= 7 && worldIn.rand.nextInt(50) == 0) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(Items.poisonous_potato)); +- } +- } + } ++ @Override ++ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = super.getDrops(world, pos, state, fortune); ++ java.util.Random rand = world instanceof World ? ((World)world).rand : new java.util.Random(); ++ if (((Integer)state.getValue(AGE)) >= 7 && rand.nextInt(50) == 0) ++ ret.add(new ItemStack(Items.poisonous_potato)); ++ return ret; ++ } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockPumpkin.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockPumpkin.java.patch.rej new file mode 100644 index 0000000000..8680c643dc --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockPumpkin.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); ++ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej new file mode 100644 index 0000000000..3163ebffd9 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej @@ -0,0 +1,11 @@ +++++ REJECTED PATCH 4 + this.state = state; + this.block = (BlockRailBase)state.getBlock(); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(BlockRailBase.this.getShapeProperty()); +- this.isPowered = this.block.isPowered; ++ this.isPowered = !this.block.isFlexibleRail(worldIn, pos); ++ canMakeSlopes = this.block.canMakeSlopes(worldIn, pos); + this.func_180360_a(blockrailbase$enumraildirection); + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej new file mode 100644 index 0000000000..e415ab709c --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej @@ -0,0 +1,59 @@ +++++ REJECTED PATCH 1 + BlockPos blockpos = pos.offset(direction); + Block block = worldIn.getBlockState(pos.offset(direction)).getBlock(); + +- if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (block.isBlockNormalCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down())))) ++ if (!canRestoneConnect(worldIn, blockpos, direction) && (block.isBlockNormalCube() || !canRestoneConnect(worldIn, blockpos.down(), null))) + { + Block block1 = worldIn.getBlockState(pos.up()).getBlock(); +- return !block1.isBlockNormalCube() && block.isBlockNormalCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; ++ return !block1.isBlockNormalCube() && block.isBlockNormalCube() && canRestoneConnect(worldIn, blockpos.up(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; + } + else + { +++++ END PATCH +++++ REJECTED PATCH 2 + Block block = iblockstate.getBlock(); + boolean flag = block.isNormalCube(); + boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); +- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down()))); ++ return !flag1 && flag && canRestoneConnect(worldIn, blockpos.up(), null) ? true : (canRestoneConnect(worldIn, blockpos, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canRestoneConnect(worldIn, blockpos.down(), null))); + } + +- protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos) ++ protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side) + { +- return canConnectUpwardsTo(worldIn.getBlockState(pos)); +- } +- +- protected static boolean canConnectUpwardsTo(IBlockState state) +- { +- return canConnectTo(state, (EnumFacing)null); +- } +- +- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) +- { +- Block block = blockState.getBlock(); +- +- if (block == Blocks.redstone_wire) ++ IBlockState state = world.getBlockState(pos); ++ if (state.getBlock() == Blocks.redstone_wire) + { + return true; + } +- else if (Blocks.unpowered_repeater.isAssociated(block)) ++ else if (Blocks.unpowered_repeater.isAssociated(state.getBlock())) + { +- EnumFacing enumfacing = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING); +- return enumfacing == side || enumfacing.getOpposite() == side; ++ EnumFacing direction = (EnumFacing)state.getValue(BlockRedstoneRepeater.FACING); ++ return direction == side || direction.getOpposite() == side; + } + else + { +- return block.canProvidePower() && side != null; ++ return state.getBlock().canConnectRedstone(world, pos, side); + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej new file mode 100644 index 0000000000..25769e9b82 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 3 + if (tileentity instanceof TileEntitySkull) + { + TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; +- ItemStack itemstack = new ItemStack(Items.skull, 1, this.getDamageValue(worldIn, pos)); ++ ItemStack itemstack = new ItemStack(Items.skull, 1, tileentityskull.getSkullType()); + + if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockSlab.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockSlab.java.patch.rej new file mode 100644 index 0000000000..bd8488f6da --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockSlab.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 2 + { + return false; + } +- else +- { +- BlockPos blockpos = pos.offset(side.getOpposite()); +- IBlockState iblockstate = worldIn.getBlockState(pos); +- IBlockState iblockstate1 = worldIn.getBlockState(blockpos); +- boolean flag = isSlab(iblockstate.getBlock()) && iblockstate.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP; +- boolean flag1 = isSlab(iblockstate1.getBlock()) && iblockstate1.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP; +- return flag1 ? (side == EnumFacing.DOWN ? true : (side == EnumFacing.UP && super.shouldSideBeRendered(worldIn, pos, side) ? true : !isSlab(iblockstate.getBlock()) || !flag)) : (side == EnumFacing.UP ? true : (side == EnumFacing.DOWN && super.shouldSideBeRendered(worldIn, pos, side) ? true : !isSlab(iblockstate.getBlock()) || flag)); +- } ++ // additional logic breaks doesSideBlockRendering and is no longer useful. ++ return super.shouldSideBeRendered(worldIn, pos, side); + } + + @SideOnly(Side.CLIENT) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej new file mode 100644 index 0000000000..d0fbe7d500 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej @@ -0,0 +1,22 @@ +++++ REJECTED PATCH 1 + { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); + Block block = iblockstate.getBlock(); +- return block != Blocks.ice && block != Blocks.packed_ice ? (block.getMaterial() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; ++ return block != Blocks.ice && block != Blocks.packed_ice ? (block.isLeaves(worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; + } + + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) +++++ END PATCH +++++ REJECTED PATCH 3 + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0)); ++ super.harvestBlock(worldIn, player, pos, state, te); + worldIn.setBlockToAir(pos); +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockStairs.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockStairs.java.patch.rej new file mode 100644 index 0000000000..22661f610d --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockStairs.java.patch.rej @@ -0,0 +1,21 @@ +++++ REJECTED PATCH 1 + return false; + } + ++ @Override ++ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ if ( isOpaqueCube() ) ++ return true; ++ ++ // face is on the block being rendered, not this block. ++ IBlockState iblockstate = world.getBlockState(pos); ++ EnumHalf half = iblockstate.getValue(HALF); ++ EnumFacing side = iblockstate.getValue(FACING); ++ return side == face.getOpposite() || (half == EnumHalf.TOP && face == EnumFacing.DOWN) || (half == EnumHalf.BOTTOM && face == EnumFacing.UP); ++ } ++ + public boolean isFullCube() + { + return false; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockTallGrass.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockTallGrass.java.patch.rej new file mode 100644 index 0000000000..cd154744a2 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockTallGrass.java.patch.rej @@ -0,0 +1,25 @@ +++++ REJECTED PATCH 2 + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return super.canBlockStay(worldIn, pos, state); + } + + public boolean isReplaceable(World worldIn, BlockPos pos) +++++ END PATCH +++++ REJECTED PATCH 4 + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta())); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej new file mode 100644 index 0000000000..1039e160fd --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej @@ -0,0 +1,45 @@ +++++ REJECTED PATCH 1 + + public class BlockTrapDoor extends Block + { ++ /** Set this to allow trapdoors to remain free-floating */ ++ public static boolean disableValidation = false; + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + public static final PropertyBool OPEN = PropertyBool.create("open"); + public static final PropertyEnum HALF = PropertyEnum.create("half", BlockTrapDoor.DoorHalf.class); +++++ END PATCH +++++ REJECTED PATCH 2 + { + if (!worldIn.isRemote) + { ++ EnumFacing direction = (EnumFacing)state.getValue(FACING); + BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()); + +- if (!isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock())) ++ if (!(isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock()) || worldIn.isSideSolid(blockpos, direction, true))) + { + worldIn.setBlockToAir(pos); + this.dropBlockAsItem(worldIn, pos, state, 0); +++++ END PATCH +++++ REJECTED PATCH 3 + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { +- return !side.getAxis().isVertical() && isValidSupportBlock(worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock()); ++ if (disableValidation) return true; ++ EnumFacing dir = side.getOpposite(); ++ pos = pos.offset(dir); ++ return !side.getAxis().isVertical() && (isValidSupportBlock(worldIn.getBlockState(pos).getBlock()) || worldIn.isSideSolid(pos, side, true)); + } + + protected static EnumFacing getFacing(int meta) +++++ END PATCH +++++ REJECTED PATCH 4 + + private static boolean isValidSupportBlock(Block blockIn) + { ++ if (disableValidation) return true; + return blockIn.blockMaterial.isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs; + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej new file mode 100644 index 0000000000..1b124a1470 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej @@ -0,0 +1,28 @@ +++++ REJECTED PATCH 1 + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { +- return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock().isNormalCube(); ++ return side.getAxis().isHorizontal() && worldIn.isSideSolid(pos.offset(side.getOpposite()), side, true); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) + { +- if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube()) ++ if (worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true)) + { + return true; + } +++++ END PATCH +++++ REJECTED PATCH 2 + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + +- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock().isNormalCube()) ++ if (!worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej new file mode 100644 index 0000000000..64904484b1 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej @@ -0,0 +1,15 @@ +++++ REJECTED PATCH 2 + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0)); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej b/rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej new file mode 100644 index 0000000000..2d1af6e92b --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej @@ -0,0 +1,30 @@ +++++ REJECTED PATCH 1 + { + Block block = this.world.getBlockState(origin).getBlock(); + +- if (block.getMaterial() == Material.air) ++ if (block.isAir(world, origin)) + { + return true; + } +++++ END PATCH +++++ REJECTED PATCH 2 + BlockPos blockpos = origin.offset(this.moveDirection.getOpposite(), i); + block = this.world.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() == Material.air || !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) ++ if (block.isAir(world, blockpos)|| !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) + { + break; + } +++++ END PATCH +++++ REJECTED PATCH 3 + + block = this.world.getBlockState(blockpos1).getBlock(); + +- if (block.getMaterial() == Material.air) ++ if (block.isAir(world, blockpos1)) + { + return true; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej b/rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej new file mode 100644 index 0000000000..ae09ac8ee3 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej @@ -0,0 +1,55 @@ +++++ REJECTED PATCH 1 + + public BlockState(Block blockIn, IProperty... properties) + { ++ this(blockIn, properties, null); ++ } ++ ++ protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) ++ { ++ return new StateImplementation(block, properties); ++ } ++ ++ protected BlockState(Block blockIn, IProperty[] properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) ++ { + this.block = blockIn; + Arrays.sort(properties, new Comparator() + { +++++ END PATCH +++++ REJECTED PATCH 2 + for (List list1 : Cartesian.cartesianProduct(this.getAllowedValues())) + { + Map map1 = MapPopulator.createMap(this.properties, list1); +- BlockState.StateImplementation blockstate$stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map1)); ++ BlockState.StateImplementation blockstate$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map1), unlistedProperties); + map.put(map1, blockstate$stateimplementation); + list.add(blockstate$stateimplementation); + } +++++ END PATCH +++++ REJECTED PATCH 3 + } + } + ++ protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable) ++ { ++ this.block = blockIn; ++ this.properties = propertiesIn; ++ this.propertyValueTable = propertyValueTable; ++ } ++ + public , V extends T> IBlockState withProperty(IProperty property, V value) + { + if (!this.properties.containsKey(property)) +++++ END PATCH +++++ REJECTED PATCH 4 + map.put(property, value); + return map; + } ++ ++ public ImmutableTable getPropertyValueTable() ++ { ++ return propertyValueTable; ++ } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej b/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej new file mode 100644 index 0000000000..398b89ce8f --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej @@ -0,0 +1,347 @@ +++++ REJECTED PATCH 2 + this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_); + this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language); + this.mcResourceManager.registerReloadListener(this.mcLanguageManager); +- this.refreshResources(); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.defaultResourcePacks, this.mcResourceManager); + this.renderEngine = new TextureManager(this.mcResourceManager); + this.mcResourceManager.registerReloadListener(this.renderEngine); +- this.drawSplashScreen(this.renderEngine); ++ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.renderEngine); + this.initStream(); + this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); + this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves")); +++++ END PATCH +++++ REJECTED PATCH 4 + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + this.checkGLError("Startup"); +- this.textureMapBlocks = new TextureMap("textures"); ++ bar.step("Loading Texture Map"); ++ this.textureMapBlocks = new TextureMap("textures",true); + this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels); + this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks); + this.renderEngine.bindTexture(TextureMap.locationBlocksTexture); + this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0); ++ bar.step("Loading Model Manager"); + this.modelManager = new ModelManager(this.textureMapBlocks); + this.mcResourceManager.registerReloadListener(this.modelManager); ++ bar.step("Loading Item Renderer"); + this.renderItem = new RenderItem(this.renderEngine, this.modelManager); + this.renderManager = new RenderManager(this.renderEngine, this.renderItem); + this.itemRenderer = new ItemRenderer(this); + this.mcResourceManager.registerReloadListener(this.renderItem); ++ bar.step("Loading Entity Renderer"); + this.entityRenderer = new EntityRenderer(this, this.mcResourceManager); + this.mcResourceManager.registerReloadListener(this.entityRenderer); + this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.gameSettings); +++++ END PATCH +++++ REJECTED PATCH 5 + this.guiAchievement = new GuiAchievement(this); + GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight); + this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading(); + this.checkGLError("Post startup"); +- this.ingameGUI = new GuiIngame(this); ++ this.ingameGUI = new net.minecraftforge.client.GuiIngameForge(this); + + if (this.serverName != null) + { +- this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort)); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.serverName, this.serverPort); + } + else + { + this.displayGuiScreen(new GuiMainMenu()); + } + +- this.renderEngine.deleteTexture(this.mojangLogo); ++ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(renderEngine, mojangLogo); + this.mojangLogo = null; + this.loadingScreen = new LoadingScreenRenderer(this); + ++ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete(); + if (this.gameSettings.fullScreen && !this.fullscreen) + { + this.toggleFullscreen(); +++++ END PATCH +++++ REJECTED PATCH 8 + guiScreenIn = new GuiGameOver(); + } + ++ GuiScreen old = this.currentScreen; ++ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(guiScreenIn); ++ ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; ++ ++ guiScreenIn = event.gui; ++ if (old != null && guiScreenIn != old) ++ { ++ old.onGuiClosed(); ++ } ++ + if (guiScreenIn instanceof GuiMainMenu) + { + this.gameSettings.showDebugInfo = false; +++++ END PATCH +++++ REJECTED PATCH 10 + + if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit)) + { +- this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit); ++ this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver); + this.thePlayer.swingItem(); + } + } +++++ END PATCH +++++ REJECTED PATCH 11 + case BLOCK: + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + +- if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air) ++ if (!this.theWorld.isAirBlock(blockpos)) + { + int i = itemstack != null ? itemstack.stackSize : 0; + ++ ++ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.theWorld, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec).isCanceled(); ++ if (result) { //Forge: Kept separate to simplify patch + if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec)) + { + flag = false; + this.thePlayer.swingItem(); + } ++ } + + if (itemstack == null) + { +++++ END PATCH +++++ REJECTED PATCH 12 + { + ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); + +- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) ++ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, theWorld, null, null, null).isCanceled(); ++ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) + { + this.entityRenderer.itemRenderer.resetEquippedProgress2(); + } +++++ END PATCH +++++ REJECTED PATCH 14 + + while (Mouse.next()) + { ++ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; ++ + int i = Mouse.getEventButton(); + KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); + +++++ END PATCH +++++ REJECTED PATCH 17 + this.myNetworkManager.processReceivedPackets(); + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick(); ++ + this.mcProfiler.endSection(); + this.systemTime = getSystemTime(); + } + + public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn) + { ++ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(folderName, worldName, worldSettingsIn); + this.loadWorld((WorldClient)null); + System.gc(); + ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); +++++ END PATCH +++++ REJECTED PATCH 19 + SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); + NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); + networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); +- networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); +- networkmanager.sendPacket(new C00PacketLoginStart(this.getSession().getProfile())); ++ networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true)); ++ com.mojang.authlib.GameProfile gameProfile = this.getSession().getProfile(); ++ if (!this.getSession().hasCachedProperties()) ++ { ++ gameProfile = sessionService.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. ++ this.getSession().setProperties(gameProfile.getProperties()); ++ } ++ networkmanager.sendPacket(new C00PacketLoginStart(gameProfile)); + this.myNetworkManager = networkmanager; + } + +++++ END PATCH +++++ REJECTED PATCH 21 + { + this.theIntegratedServer.initiateShutdown(); + this.theIntegratedServer.setStaticInstance(); ++ if (loadingScreen != null) ++ { ++ this.loadingScreen.displayLoadingString(I18n.format("forge.client.shutdown.internal")); ++ } ++ while (!theIntegratedServer.isServerStopped()) ++ { ++ try ++ { ++ Thread.sleep(10); ++ } ++ catch (InterruptedException ie) {} ++ } + } + + this.theIntegratedServer = null; +++++ END PATCH +++++ REJECTED PATCH 23 + if (this.objectMouseOver != null) + { + boolean flag = this.thePlayer.capabilities.isCreativeMode; +- int i = 0; +- boolean flag1 = false; +- TileEntity tileentity = null; +- Item item; +- +- if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) +- { +- BlockPos blockpos = this.objectMouseOver.getBlockPos(); +- Block block = this.theWorld.getBlockState(blockpos).getBlock(); +- +- if (block.getMaterial() == Material.air) +- { +- return; +- } +- +- item = block.getItem(this.theWorld, blockpos); +- +- if (item == null) +- { +- return; +- } +- +- if (flag && GuiScreen.isCtrlKeyDown()) +- { +- tileentity = this.theWorld.getTileEntity(blockpos); +- } +- +- Block block1 = item instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem(item) : block; +- i = block1.getDamageValue(this.theWorld, blockpos); +- flag1 = item.getHasSubtypes(); +- } +- else +- { +- if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) +- { +- return; +- } +- +- if (this.objectMouseOver.entityHit instanceof EntityPainting) +- { +- item = Items.painting; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) +- { +- item = Items.lead; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) +- { +- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; +- ItemStack itemstack = entityitemframe.getDisplayedItem(); +- +- if (itemstack == null) +- { +- item = Items.item_frame; +- } +- else +- { +- item = itemstack.getItem(); +- i = itemstack.getMetadata(); +- flag1 = true; +- } +- } +- else if (this.objectMouseOver.entityHit instanceof EntityMinecart) +- { +- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; +- +- switch (entityminecart.getMinecartType()) +- { +- case FURNACE: +- item = Items.furnace_minecart; +- break; +- case CHEST: +- item = Items.chest_minecart; +- break; +- case TNT: +- item = Items.tnt_minecart; +- break; +- case HOPPER: +- item = Items.hopper_minecart; +- break; +- case COMMAND_BLOCK: +- item = Items.command_block_minecart; +- break; +- default: +- item = Items.minecart; +- } +- } +- else if (this.objectMouseOver.entityHit instanceof EntityBoat) +- { +- item = Items.boat; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) +- { +- item = Items.armor_stand; +- } +- else +- { +- item = Items.spawn_egg; +- i = EntityList.getEntityID(this.objectMouseOver.entityHit); +- flag1 = true; +- +- if (!EntityList.entityEggs.containsKey(Integer.valueOf(i))) +- { +- return; +- } +- } +- } +- + InventoryPlayer inventoryplayer = this.thePlayer.inventory; + +- if (tileentity == null) +- { +- inventoryplayer.setCurrentItem(item, i, flag1, flag); +- } +- else +- { +- ItemStack itemstack1 = this.func_181036_a(item, i, tileentity); +- inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1); +- } +- ++ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld)) return; ++ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions + if (flag) + { + int j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + inventoryplayer.currentItem; +++++ END PATCH +++++ REJECTED PATCH 24 + + public static int getGLMaximumTextureSize() + { +- for (int i = 16384; i > 0; i >>= 1) +- { +- GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)((ByteBuffer)null)); +- int j = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); +- +- if (j != 0) +- { +- return i; +- } +- } +- +- return -1; ++ //Forge we redirect this to our code which caches the value before any splash screen stuff is done. ++ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize(); + } + + public boolean isSnooperEnabled() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/audio/SoundManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/audio/SoundManager.java.patch.rej new file mode 100644 index 0000000000..40bbf0f88a --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/audio/SoundManager.java.patch.rej @@ -0,0 +1,25 @@ +++++ REJECTED PATCH 3 + } + else + { ++ sound = net.minecraftforge.client.ForgeHooksClient.playSound(this, sound); ++ if (sound == null) return; ++ + SoundEventAccessorComposite soundeventaccessorcomposite = this.sndHandler.getSound(sound.getSoundLocation()); + + if (soundeventaccessorcomposite == null) +++++ END PATCH +++++ REJECTED PATCH 4 + if (soundpoolentry.isStreamingSound()) + { + this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, sound, s)); + } + else + { + this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, sound, s)); + } + + logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.getSoundPoolEntryLocation(), soundeventaccessorcomposite.getSoundEventLocation(), s}); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch.rej b/rejects/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch.rej new file mode 100644 index 0000000000..18c2281ff0 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch.rej @@ -0,0 +1,14 @@ +++++ REJECTED PATCH 3 + + public void playSound(String name, float volume, float pitch) + { ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, name, volume, pitch); ++ if (event.isCanceled() || event.name == null) return; ++ name = event.name; ++ volume = event.newVolume; ++ pitch = event.newPitch; ++ + this.worldObj.playSound(this.posX, this.posY, this.posZ, name, volume, pitch, false); + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej new file mode 100644 index 0000000000..fea7625697 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej @@ -0,0 +1,33 @@ +++++ REJECTED PATCH 3 + + try + { +- bufferedimage = TextureUtil.readBufferedImage(Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture).getInputStream()); ++ bufferedimage = TextureUtil.readBufferedImage(getResourceInputStream(this.locationFontTexture)); + } + catch (IOException ioexception) + { +++++ END PATCH +++++ REJECTED PATCH 4 + + try + { +- inputstream = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin")).getInputStream(); ++ inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin")); + inputstream.read(this.glyphWidth); + } + catch (IOException ioexception) +++++ END PATCH +++++ REJECTED PATCH 13 + int j = this.glyphWidth[character] >>> 4; + int k = this.glyphWidth[character] & 15; + +- if (k > 7) +- { +- k = 15; +- j = 0; +- } + + ++k; + return (k - j) / 2 + 1; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej new file mode 100644 index 0000000000..fb030ae4df --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej @@ -0,0 +1,40 @@ +++++ REJECTED PATCH 1 + this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(stringbuilder.toString()), 1); + } + +- this.inputField.writeText((String)this.foundPlayerNames.get(this.autocompleteIndex++)); ++ this.inputField.writeText(net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes((String)this.foundPlayerNames.get(this.autocompleteIndex++))); + } + + private void sendAutocompleteRequest(String p_146405_1_, String p_146405_2_) + { + if (p_146405_1_.length() >= 1) + { ++ net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_146405_1_, p_146405_2_); + BlockPos blockpos = null; + + if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) +++++ END PATCH +++++ REJECTED PATCH 2 + this.playerNamesFound = false; + this.foundPlayerNames.clear(); + ++ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete; ++ if (complete != null) ++ { ++ p_146406_1_ = com.google.common.collect.ObjectArrays.concat(complete, p_146406_1_, String.class); ++ } ++ + for (String s : p_146406_1_) + { + if (s.length() > 0) +++++ END PATCH +++++ REJECTED PATCH 3 + + String s1 = this.inputField.getText().substring(this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false)); + String s2 = StringUtils.getCommonPrefix(p_146406_1_); ++ s2 = net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes(s2); + + if (s2.length() > 0 && !s1.equalsIgnoreCase(s2)) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej new file mode 100644 index 0000000000..e60b28cb52 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + } + } + ++ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress(); ++ + WorldSettings.GameType worldsettings$gametype = WorldSettings.GameType.getByName(this.gameMode); + WorldSettings worldsettings = new WorldSettings(i, worldsettings$gametype, this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]); + worldsettings.setWorldName(this.chunkProviderSettingsJson); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch.rej new file mode 100644 index 0000000000..d588a78c5e --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + if (this.mc.getSaveLoader().canLoadWorld(s)) + { +- this.mc.launchIntegratedServer(s, s1, (WorldSettings)null); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(this, s, s1); + } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej new file mode 100644 index 0000000000..f6c39b84e0 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 1 + GlStateManager.disableFog(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); +- this.mc.getTextureManager().bindTexture(Gui.optionsBackground); +- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +- float f = 32.0F; +- worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); +- worldrenderer.pos((double)this.left, (double)this.bottom, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); +- worldrenderer.pos((double)this.right, (double)this.bottom, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); +- worldrenderer.pos((double)this.right, (double)this.top, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); +- worldrenderer.pos((double)this.left, (double)this.top, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); +- tessellator.draw(); ++ // Forge: background rendering moved into separate method. ++ this.drawContainerBackground(tessellator); + int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; + int l = this.top + 4 - (int)this.amountScrolled; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch.rej new file mode 100644 index 0000000000..230f833b20 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + s3 = s4; + } + ++ s3 = FontRenderer.getFormatFromString(s2) + s3; //Forge: Fix chat formatting not surviving line wrapping. + ChatComponentText chatcomponenttext2 = new ChatComponentText(s3); + chatcomponenttext2.setChatStyle(ichatcomponent1.getChatStyle().createShallowCopy()); + list1.add(j + 1, chatcomponenttext2); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch.rej new file mode 100644 index 0000000000..f680758a6a --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch.rej @@ -0,0 +1,46 @@ +++++ REJECTED PATCH 2 + int j = 141; + this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - i / 2 - 12); + this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - j / 2); ++ minecraftAchievements.clear(); ++ for (Achievement achievement : AchievementList.achievementList) ++ { ++ if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement)) ++ { ++ minecraftAchievements.add(achievement); ++ } ++ } + } + + public void initGui() +++++ END PATCH +++++ REJECTED PATCH 6 + GlStateManager.depthFunc(515); + this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND); + +- for (int j5 = 0; j5 < AchievementList.achievementList.size(); ++j5) ++ java.util.List achievementList = (currentPage == -1 ? minecraftAchievements : net.minecraftforge.common.AchievementPage.getAchievementPage(currentPage).getAchievements()); ++ for (int j5 = 0; j5 < achievementList.size(); ++j5) + { +- Achievement achievement1 = (Achievement)AchievementList.achievementList.get(j5); ++ Achievement achievement1 = achievementList.get(j5); + +- if (achievement1.parentAchievement != null) ++ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement)) + { + int k5 = achievement1.displayColumn * 24 - i + 11; + int l5 = achievement1.displayRow * 24 - j + 11; +++++ END PATCH +++++ REJECTED PATCH 7 + GlStateManager.enableRescaleNormal(); + GlStateManager.enableColorMaterial(); + +- for (int i6 = 0; i6 < AchievementList.achievementList.size(); ++i6) ++ for (int i6 = 0; i6 < achievementList.size(); ++i6) + { +- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(i6); ++ Achievement achievement2 = achievementList.get(i6); + int l6 = achievement2.displayColumn * 24 - i; + int j7 = achievement2.displayRow * 24 - j; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej new file mode 100644 index 0000000000..52c077ed65 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej @@ -0,0 +1,62 @@ +++++ REJECTED PATCH 1 + import java.util.Collections; + import java.util.Comparator; + import java.util.List; ++ ++import net.minecraft.block.Block; + import net.minecraft.client.Minecraft; + import net.minecraft.client.audio.PositionedSoundRecord; + import net.minecraft.client.gui.GuiButton; +++++ END PATCH +++++ REJECTED PATCH 2 + for (StatCrafting statcrafting : StatList.objectMineStats) + { + boolean flag = false; +- int i = Item.getIdFromItem(statcrafting.func_150959_a()); ++ int i = Block.getIdFromBlock(Block.getBlockFromItem(statcrafting.func_150959_a())); ++ int itemId = Item.getIdFromItem(statcrafting.func_150959_a()); + + if (GuiStats.this.field_146546_t.readStat(statcrafting) > 0) + { + flag = true; + } +- else if (StatList.objectUseStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectUseStats[i]) > 0) ++ else if (StatList.objectUseStats[itemId] != null && GuiStats.this.field_146546_t.readStat(StatList.objectUseStats[itemId]) > 0) + { + flag = true; + } +- else if (StatList.objectCraftStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectCraftStats[i]) > 0) ++ else if (StatList.objectCraftStats[itemId] != null && GuiStats.this.field_146546_t.readStat(StatList.objectCraftStats[itemId]) > 0) + { + flag = true; + } +++++ END PATCH +++++ REJECTED PATCH 3 + { + public int compare(StatCrafting p_compare_1_, StatCrafting p_compare_2_) + { +- int j = Item.getIdFromItem(p_compare_1_.func_150959_a()); +- int k = Item.getIdFromItem(p_compare_2_.func_150959_a()); ++ int j; ++ int k; ++ if (StatsBlock.this.field_148217_o == 2) { ++ j = Block.getIdFromBlock(Block.getBlockFromItem(p_compare_1_.func_150959_a())); ++ k = Block.getIdFromBlock(Block.getBlockFromItem(p_compare_2_.func_150959_a())); ++ } else { ++ j = Item.getIdFromItem(p_compare_1_.func_150959_a()); ++ k = Item.getIdFromItem(p_compare_2_.func_150959_a()); ++ } + StatBase statbase = null; + StatBase statbase1 = null; + +++++ END PATCH +++++ REJECTED PATCH 5 + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(entryID); +- String s = I18n.format("entity." + EntityList.getStringFromID(entitylist$entityegginfo.spawnedID) + ".name", new Object[0]); ++ String s = I18n.format("entity." + entitylist$entityegginfo.name + ".name", new Object[0]); + int i = GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d); + int j = GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e); + String s1 = I18n.format("stat.entityKills", new Object[] {Integer.valueOf(i), s}); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej new file mode 100644 index 0000000000..64f2a9b28f --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej @@ -0,0 +1,25 @@ +++++ REJECTED PATCH 2 + return; + } + +- if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2)) ++ if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2) && ItemStack.areItemStackTagsEqual(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770 + { + if (clickedButton == 0) + { +++++ END PATCH +++++ REJECTED PATCH 6 + item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList); + } + } ++ updateFilteredItems(guicontainercreative$containercreative); ++ } + ++ //split from above for custom search tabs ++ private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$containercreative) ++ { ++ if (CreativeTabs.creativeTabArray[selectedTabIndex] == CreativeTabs.tabAllSearch) // FORGE: Only add enchanted books to the regular search + for (Enchantment enchantment : Enchantment.enchantmentsBookList) + { + if (enchantment != null && enchantment.type != null) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/model/ModelBox.java.patch.rej b/rejects/minecraft/net/minecraft/client/model/ModelBox.java.patch.rej new file mode 100644 index 0000000000..bb47a7107b --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/model/ModelBox.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 2 + } + } + ++ @SideOnly(Side.CLIENT) + public void render(WorldRenderer renderer, float scale) + { + for (int i = 0; i < this.quadList.length; ++i) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch.rej b/rejects/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch.rej new file mode 100644 index 0000000000..c8880a5ec7 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch.rej @@ -0,0 +1,12 @@ +++++ REJECTED PATCH 1 + package net.minecraft.client.model; + + import net.minecraft.util.Vec3; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public class PositionTextureVertex + { + public Vec3 vector3D; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/model/TexturedQuad.java.patch.rej b/rejects/minecraft/net/minecraft/client/model/TexturedQuad.java.patch.rej new file mode 100644 index 0000000000..b01f45d0fa --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/model/TexturedQuad.java.patch.rej @@ -0,0 +1,12 @@ +++++ REJECTED PATCH 1 + import net.minecraft.client.renderer.WorldRenderer; + import net.minecraft.client.renderer.vertex.DefaultVertexFormats; + import net.minecraft.util.Vec3; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public class TexturedQuad + { + public PositionTextureVertex[] vertexPositions; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch.rej b/rejects/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch.rej new file mode 100644 index 0000000000..8d8ef37b2e --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + inetaddress = InetAddress.getByName(ip); + GuiConnecting.this.networkManager = NetworkManager.func_181124_a(inetaddress, port, GuiConnecting.this.mc.gameSettings.func_181148_f()); + GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen)); +- GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN)); ++ GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN, true)); + GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile())); + } + catch (UnknownHostException unknownhostexception) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej b/rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej new file mode 100644 index 0000000000..ef2f8c7808 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej @@ -0,0 +1,77 @@ +++++ REJECTED PATCH 1 + } + } + ++ ItemStack stack = mc.thePlayer.getCurrentEquippedItem(); ++ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, pos, mc.thePlayer)) ++ { ++ return false; ++ } ++ + if (this.currentGameType.isCreative() && this.mc.thePlayer.getHeldItem() != null && this.mc.thePlayer.getHeldItem().getItem() instanceof ItemSword) + { + return false; +++++ END PATCH +++++ REJECTED PATCH 2 + else + { + world.playAuxSFX(2001, pos, Block.getStateId(iblockstate)); +- boolean flag = world.setBlockToAir(pos); + +- if (flag) +- { +- block1.onBlockDestroyedByPlayer(world, pos, iblockstate); +- } +- + this.currentBlock = new BlockPos(this.currentBlock.getX(), -1, this.currentBlock.getZ()); + + if (!this.currentGameType.isCreative()) +++++ END PATCH +++++ REJECTED PATCH 4 + { + if (this.currentGameType != WorldSettings.GameType.SPECTATOR) + { ++ ++ if (heldStack != null && ++ heldStack.getItem() != null && ++ heldStack.getItem().onItemUseFirst(heldStack, player, worldIn, hitPos, side, f, f1, f2)) ++ { ++ return true; ++ } ++ + IBlockState iblockstate = worldIn.getBlockState(hitPos); + +- if ((!player.isSneaking() || player.getHeldItem() == null) && iblockstate.getBlock().onBlockActivated(worldIn, hitPos, iblockstate, player, side, f, f1, f2)) ++ if ((!player.isSneaking() || player.getHeldItem() == null || player.getHeldItem().getItem().doesSneakBypassUse(worldIn, hitPos, player))) + { +- flag = true; ++ flag = iblockstate.getBlock().onBlockActivated(worldIn, hitPos, iblockstate, player, side, f, f1, f2); + } + + if (!flag && heldStack != null && heldStack.getItem() instanceof ItemBlock) +++++ END PATCH +++++ REJECTED PATCH 5 + } + else + { +- return heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2); ++ if (!heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2)) return false; ++ if (heldStack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, heldStack); ++ return true; + } + } + else +++++ END PATCH +++++ REJECTED PATCH 6 + { + playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack; + +- if (itemstack.stackSize == 0) ++ if (itemstack.stackSize <= 0) + { + playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(playerIn, itemstack); + } + + return true; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej b/rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej new file mode 100644 index 0000000000..24785c80a7 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej @@ -0,0 +1,23 @@ +++++ REJECTED PATCH 3 + float f = (float)(packetIn.getYaw() * 360) / 256.0F; + float f1 = (float)(packetIn.getPitch() * 360) / 256.0F; + EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.getEntityType(), this.gameController.theWorld); ++ if (entitylivingbase == null) ++ { ++ net.minecraftforge.fml.common.FMLLog.info("Server attempted to spawn an unknown entity using ID: {0} at ({1}, {2}, {3}) Skipping!", packetIn.getEntityType(), d0, d1, d2); ++ return; ++ } + entitylivingbase.serverPosX = packetIn.getX(); + entitylivingbase.serverPosY = packetIn.getY(); + entitylivingbase.serverPosZ = packetIn.getZ(); +++++ END PATCH +++++ REJECTED PATCH 5 + + if (entity instanceof EntityLivingBase) + { +- PotionEffect potioneffect = new PotionEffect(packetIn.getEffectId(), packetIn.getDuration(), packetIn.getAmplifier(), false, packetIn.func_179707_f()); ++ PotionEffect potioneffect = new PotionEffect(packetIn.getEffectId() & 0xff, packetIn.getDuration(), packetIn.getAmplifier(), false, packetIn.func_179707_f()); + potioneffect.setPotionDurationMax(packetIn.func_149429_c()); + ((EntityLivingBase)entity).addPotionEffect(potioneffect); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej b/rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej new file mode 100644 index 0000000000..b9e4af4e1b --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + server.setBase64EncodedIconData((String)null); + } + ++ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(server, serverstatusresponse); + this.field_175092_e = Minecraft.getSystemTime(); + networkmanager.sendPacket(new C01PacketPing(this.field_175092_e)); + this.field_147403_d = true; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch.rej new file mode 100644 index 0000000000..713339bfd8 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 1 + + public void addEffect(EntityFX effect) + { ++ if (effect == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs. + int i = effect.getFXLayer(); + int j = effect.getAlpha() != 1.0F ? 0 : 1; + +++++ END PATCH +++++ REJECTED PATCH 2 + + public void addBlockDestroyEffects(BlockPos pos, IBlockState state) + { +- if (state.getBlock().getMaterial() != Material.air) ++ if (!state.getBlock().isAir(worldObj, pos) && !state.getBlock().addDestroyEffects(worldObj, pos, this)) + { + state = state.getBlock().getActualState(state, this.worldObj, pos); + int i = 4; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch.rej new file mode 100644 index 0000000000..21f015f76a --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch.rej @@ -0,0 +1,23 @@ +++++ REJECTED PATCH 1 + @SideOnly(Side.CLIENT) + public static enum EnumNeighborInfo + { +- DOWN(new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.5F, false, new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0]), +- UP(new EnumFacing[]{EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH}, 1.0F, false, new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0]), ++ // -- Forge Patch to Fix Top/Bottom Lighting Interpolation -- ++ // Forge PR - https://github.com/MinecraftForge/MinecraftForge/pull/1892 ++ // Mojang Bug - https://bugs.mojang.com/browse/MC-80148 ++ DOWN( new EnumFacing[]{ EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH }, 0.5F, true, ++ new Orientation[]{ Orientation.FLIP_WEST, Orientation.SOUTH, Orientation.FLIP_WEST, Orientation.FLIP_SOUTH, Orientation.WEST, Orientation.FLIP_SOUTH, Orientation.WEST, Orientation.SOUTH }, ++ new Orientation[]{ Orientation.FLIP_WEST, Orientation.NORTH, Orientation.FLIP_WEST, Orientation.FLIP_NORTH, Orientation.WEST, Orientation.FLIP_NORTH, Orientation.WEST, Orientation.NORTH }, ++ new Orientation[]{ Orientation.FLIP_EAST, Orientation.NORTH, Orientation.FLIP_EAST, Orientation.FLIP_NORTH, Orientation.EAST, Orientation.FLIP_NORTH, Orientation.EAST, Orientation.NORTH }, ++ new Orientation[]{ Orientation.FLIP_EAST, Orientation.SOUTH, Orientation.FLIP_EAST, Orientation.FLIP_SOUTH, Orientation.EAST, Orientation.FLIP_SOUTH, Orientation.EAST, Orientation.SOUTH } ), ++ UP( new EnumFacing[]{ EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH }, 1.0F, true, ++ new Orientation[]{ Orientation.EAST, Orientation.SOUTH, Orientation.EAST, Orientation.FLIP_SOUTH, Orientation.FLIP_EAST, Orientation.FLIP_SOUTH, Orientation.FLIP_EAST, Orientation.SOUTH }, ++ new Orientation[]{ Orientation.EAST, Orientation.NORTH, Orientation.EAST, Orientation.FLIP_NORTH, Orientation.FLIP_EAST, Orientation.FLIP_NORTH, Orientation.FLIP_EAST, Orientation.NORTH }, ++ new Orientation[]{ Orientation.WEST, Orientation.NORTH, Orientation.WEST, Orientation.FLIP_NORTH, Orientation.FLIP_WEST, Orientation.FLIP_NORTH, Orientation.FLIP_WEST, Orientation.NORTH }, ++ new Orientation[]{ Orientation.WEST, Orientation.SOUTH, Orientation.WEST, Orientation.FLIP_SOUTH, Orientation.FLIP_WEST, Orientation.FLIP_SOUTH, Orientation.FLIP_WEST, Orientation.SOUTH } ), + NORTH(new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.WEST}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST}), + SOUTH(new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.DOWN, EnumFacing.UP}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST}), + WEST(new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.6F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.SOUTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.SOUTH}), +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch.rej new file mode 100644 index 0000000000..5c6e047afc --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch.rej @@ -0,0 +1,50 @@ +++++ REJECTED PATCH 1 + { + private BlockModelShapes blockModelShapes; + private final GameSettings gameSettings; +- private final BlockModelRenderer blockModelRenderer = new BlockModelRenderer(); ++ private final BlockModelRenderer blockModelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(); + private final ChestRenderer chestRenderer = new ChestRenderer(); + private final BlockFluidRenderer fluidRenderer = new BlockFluidRenderer(); + +++++ END PATCH +++++ REJECTED PATCH 2 + { + state = block.getActualState(state, blockAccess, pos); + IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(state); ++ ++ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) ++ { ++ IBlockState extendedState = block.getExtendedState(state, blockAccess, pos); ++ for ( net.minecraft.util.EnumWorldBlockLayer layer : net.minecraft.util.EnumWorldBlockLayer.values() ) ++ { ++ if ( block.canRenderInLayer( layer ) ) ++ { ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(layer); ++ ++ IBakedModel targetLayer = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); ++ IBakedModel damageModel = (new SimpleBakedModel.Builder(targetLayer, texture)).makeBakedModel(); ++ this.blockModelRenderer.renderModel(blockAccess, damageModel, state, pos, Tessellator.getInstance().getWorldRenderer()); ++ } ++ } ++ return; ++ } ++ + IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, texture)).makeBakedModel(); + this.blockModelRenderer.renderModel(blockAccess, ibakedmodel1, state, pos, Tessellator.getInstance().getWorldRenderer()); + } +++++ END PATCH +++++ REJECTED PATCH 3 + ibakedmodel = ((WeightedBakedModel)ibakedmodel).getAlternativeModel(MathHelper.getPositionRandom(pos)); + } + ++ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) ++ { ++ IBlockState extendedState = block.getExtendedState(state, worldIn, pos); ++ ibakedmodel = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); ++ } ++ + return ibakedmodel; + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej new file mode 100644 index 0000000000..c1b1b328c2 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej @@ -0,0 +1,74 @@ +++++ REJECTED PATCH 2 + + if (d3 < d2 || d2 == 0.0D) + { +- if (entity1 == entity.ridingEntity) ++ if (entity1 == entity.ridingEntity && !entity.canRiderInteract()) + { + if (d2 == 0.0D) + { +++++ END PATCH +++++ REJECTED PATCH 4 + { + BlockPos blockpos = new BlockPos(entity); + IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); +- Block block = iblockstate.getBlock(); ++ net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.mc.theWorld, blockpos, iblockstate, entity); + +- if (block == Blocks.bed) +- { +- int j = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); +- GlStateManager.rotate((float)(j * 90), 0.0F, 1.0F, 0.0F); +- } +- + GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, -1.0F, 0.0F); + GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, -1.0F, 0.0F, 0.0F); + } +++++ END PATCH +++++ REJECTED PATCH 9 + EntityPlayer entityplayer = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.getHeldItem(), partialTicks)) + renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); + GlStateManager.enableAlpha(); + } +++++ END PATCH +++++ REJECTED PATCH 10 + EntityPlayer entityplayer1 = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer1, mc.objectMouseOver, 0, entityplayer1.getHeldItem(), partialTicks)) + renderglobal.drawSelectionBox(entityplayer1, this.mc.objectMouseOver, 0, partialTicks); + GlStateManager.enableAlpha(); + } +++++ END PATCH +++++ REJECTED PATCH 11 + GlStateManager.shadeModel(7425); + this.mc.mcProfiler.endStartSection("translucent"); + renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double)partialTicks, pass, entity); ++ if (!this.debugView) //Only render if render pass 0 happens as well. ++ { ++ RenderHelper.enableStandardItemLighting(); ++ this.mc.mcProfiler.endStartSection("entities"); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); ++ renderglobal.renderEntities(entity, icamera, partialTicks); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); ++ RenderHelper.disableStandardItemLighting(); ++ } + GlStateManager.shadeModel(7424); + GlStateManager.depthMask(true); + GlStateManager.enableCull(); +++++ END PATCH +++++ REJECTED PATCH 15 + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + ++ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, block, partialTicks, 0.1F); ++ if (hook >= 0) ++ GlStateManager.setFogDensity(hook); ++ else + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.blindness)) + { + float f1 = 5.0F; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch.rej new file mode 100644 index 0000000000..c919cc702e --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 2 + for (PotionEffect potioneffect : this.mc.thePlayer.getActivePotionEffects()) + { + Potion potion = Potion.potionTypes[potioneffect.getPotionID()]; ++ if(!potion.shouldRender(potioneffect)) continue; + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(inventoryBackground); + this.drawTexturedModalRect(i, j, 0, 166, 140, 32); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej new file mode 100644 index 0000000000..d321fc02f6 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej @@ -0,0 +1,39 @@ +++++ REJECTED PATCH 1 + + if (this.itemToRender != null) + { +- if (this.itemToRender.getItem() == Items.filled_map) ++ if (this.itemToRender.getItem() instanceof net.minecraft.item.ItemMap) + { + this.renderItemMap(abstractclientplayer, f2, f, f1); + } +++++ END PATCH +++++ REJECTED PATCH 3 + if (iblockstate1.getBlock().isVisuallyOpaque()) + { + iblockstate = iblockstate1; ++ overlayPos = blockpos; + } + } + + if (iblockstate.getBlock().getRenderType() != -1) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, partialTicks, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, overlayPos)) + this.func_178108_a(partialTicks, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); + } + } +++++ END PATCH +++++ REJECTED PATCH 5 + { + if (!this.itemToRender.getIsItemStackEqual(itemstack)) + { ++ if (!this.itemToRender.getItem().shouldCauseReequipAnimation(this.itemToRender, itemstack, equippedItemSlot != entityplayer.inventory.currentItem)) ++ { ++ this.itemToRender = itemstack; ++ this.equippedItemSlot = entityplayer.inventory.currentItem; ++ return; ++ } + flag = true; + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej new file mode 100644 index 0000000000..182cfa6055 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej @@ -0,0 +1,51 @@ +++++ REJECTED PATCH 4 + for (int j = 0; j < list.size(); ++j) + { + Entity entity3 = (Entity)list.get(j); ++ if (!entity3.shouldRenderInPass(pass)) continue; + boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); + boolean flag1 = entity3.isInRangeToRender3d(d0, d1, d2) && (entity3.ignoreFrustumCheck || camera.isBoundingBoxInFrustum(entity3.getEntityBoundingBox()) || entity3.riddenByEntity == this.mc.thePlayer) && entity3 instanceof EntityPlayer; + +++++ END PATCH +++++ REJECTED PATCH 5 + } + + entity2 = (Entity)iterator.next(); ++ if (!entity2.shouldRenderInPass(pass)) continue; + flag2 = this.renderManager.shouldRender(entity2, camera, d0, d1, d2) || entity2.riddenByEntity == this.mc.thePlayer; + + if (!flag2) +++++ END PATCH +++++ REJECTED PATCH 10 + + public void renderSky(float partialTicks, int pass) + { ++ net.minecraftforge.client.IRenderHandler renderer = this.theWorld.provider.getSkyRenderer(); ++ if (renderer != null) ++ { ++ renderer.render(partialTicks, theWorld, mc); ++ return; ++ } + if (this.mc.theWorld.provider.getDimensionId() == 1) + { + this.renderSkyEnd(); +++++ END PATCH +++++ REJECTED PATCH 13 + if (recordName != null) + { + ItemRecord itemrecord = ItemRecord.getRecord(recordName); ++ ResourceLocation resource = null; + + if (itemrecord != null) + { + this.mc.ingameGUI.setRecordPlayingMessage(itemrecord.getRecordNameLocal()); ++ resource = itemrecord.getRecordResource(recordName); + } + +- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(new ResourceLocation(recordName), (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); ++ if (resource == null) resource = new ResourceLocation(recordName); ++ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(resource, (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); + this.mapSoundPositions.put(blockPosIn, positionedsoundrecord); + this.mc.getSoundHandler().playSound(positionedsoundrecord); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch.rej new file mode 100644 index 0000000000..4c835fe91b --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch.rej @@ -0,0 +1,41 @@ +++++ REJECTED PATCH 1 + break; + case USHORT: + case SHORT: +- this.byteBuffer.putShort(i, (short)((int)p_181663_1_ * 32767 & 65535)); +- this.byteBuffer.putShort(i + 2, (short)((int)p_181663_2_ * 32767 & 65535)); +- this.byteBuffer.putShort(i + 4, (short)((int)p_181663_3_ * 32767 & 65535)); ++ this.byteBuffer.putShort(i, (short)((int)(p_181663_1_ * 32767) & 65535)); ++ this.byteBuffer.putShort(i + 2, (short)((int)(p_181663_2_ * 32767) & 65535)); ++ this.byteBuffer.putShort(i + 4, (short)((int)(p_181663_3_ * 32767) & 65535)); + break; + case UBYTE: + case BYTE: +- this.byteBuffer.put(i, (byte)((int)p_181663_1_ * 127 & 255)); +- this.byteBuffer.put(i + 1, (byte)((int)p_181663_2_ * 127 & 255)); +- this.byteBuffer.put(i + 2, (byte)((int)p_181663_3_ * 127 & 255)); ++ this.byteBuffer.put(i, (byte)((int)(p_181663_1_ * 127) & 255)); ++ this.byteBuffer.put(i + 1, (byte)((int)(p_181663_2_ * 127) & 255)); ++ this.byteBuffer.put(i + 2, (byte)((int)(p_181663_3_ * 127) & 255)); + } + + this.nextVertexFormatIndex(); +++++ END PATCH +++++ REJECTED PATCH 2 + } + } + ++ public void checkAndGrow() ++ { ++ this.growBuffer(vertexFormat.getNextOffset()/* / 4 * 4 */); ++ } ++ ++ public boolean isColorDisabled() ++ { ++ return noColor; ++ } ++ + @SideOnly(Side.CLIENT) + public class State + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej new file mode 100644 index 0000000000..1aadf25404 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej @@ -0,0 +1,66 @@ +++++ REJECTED PATCH 1 + + for (int j = 0; j < list.size(); ++j) + { ++ // moved to VertexFormatElement.preDraw + VertexFormatElement vertexformatelement = (VertexFormatElement)list.get(j); +- VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.getUsage(); +- int k = vertexformatelement.getType().getGlConstant(); +- int l = vertexformatelement.getIndex(); +- bytebuffer.position(vertexformat.func_181720_d(j)); +- +- switch (vertexformatelement$enumusage) +- { +- case POSITION: +- GL11.glVertexPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); +- GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); +- break; +- case UV: +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l); +- GL11.glTexCoordPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); +- GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); +- break; +- case COLOR: +- GL11.glColorPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); +- GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); +- break; +- case NORMAL: +- GL11.glNormalPointer(k, i, bytebuffer); +- GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); +- } ++ vertexformatelement.getUsage().preDraw(vertexformat, j, i, bytebuffer); + } + + GL11.glDrawArrays(p_181679_1_.getDrawMode(), 0, p_181679_1_.getVertexCount()); +++++ END PATCH +++++ REJECTED PATCH 2 + for (int j1 = list.size(); i1 < j1; ++i1) + { + VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1); +- VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.getUsage(); +- int k1 = vertexformatelement1.getIndex(); +- +- switch (vertexformatelement$enumusage1) +- { +- case POSITION: +- GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); +- break; +- case UV: +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k1); +- GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); +- break; +- case COLOR: +- GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); +- GlStateManager.resetColor(); +- break; +- case NORMAL: +- GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); +- } ++ // moved to VertexFormatElement.postDraw ++ vertexformatelement1.getUsage().postDraw(vertexformat, i1, i, bytebuffer); + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej new file mode 100644 index 0000000000..dcf329e613 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej @@ -0,0 +1,70 @@ +++++ REJECTED PATCH 1 + + public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) + { ++ return makeBakedQuad(posFrom, posTo, face, sprite, facing, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); ++ } ++ ++ public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) ++ { + int[] aint = this.makeQuadVertexData(face, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, uvLocked, shade); + EnumFacing enumfacing = getFacingFromVertexData(aint); + +++++ END PATCH +++++ REJECTED PATCH 2 + this.func_178408_a(aint, enumfacing); + } + ++ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing); + return new BakedQuad(aint, face.tintIndex, enumfacing); + } + + private int[] makeQuadVertexData(BlockPartFace partFace, TextureAtlasSprite sprite, EnumFacing facing, float[] p_178405_4_, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) + { ++ return makeQuadVertexData(partFace, sprite, facing, p_178405_4_, modelRotationIn, partRotation, uvLocked, shade); ++ } ++ ++ private int[] makeQuadVertexData(BlockPartFace partFace, TextureAtlasSprite sprite, EnumFacing facing, float[] p_178405_4_, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) ++ { + int[] aint = new int[28]; + + for (int i = 0; i < 4; ++i) +++++ END PATCH +++++ REJECTED PATCH 3 + + private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) + { +- EnumFacing enumfacing = modelRotationIn.rotateFace(facing); ++ fillVertexData(faceData, vertexIndex, facing, partFace, p_178402_5_, sprite, modelRotationIn, partRotation, uvLocked, shade); ++ } ++ ++ private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) ++ { ++ EnumFacing enumfacing = modelRotationIn.rotate(facing); + int i = shade ? this.getFaceShadeColor(enumfacing) : -1; + EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.getFacing(facing).func_179025_a(vertexIndex); + Vector3f vector3f = new Vector3f(p_178402_5_[enumfacedirection$vertexinformation.field_179184_a], p_178402_5_[enumfacedirection$vertexinformation.field_179182_b], p_178402_5_[enumfacedirection$vertexinformation.field_179183_c]); +++++ END PATCH +++++ REJECTED PATCH 4 + + public int rotateVertex(Vector3f position, EnumFacing facing, int vertexIndex, ModelRotation modelRotationIn, boolean uvLocked) + { ++ return rotateVertex(position, facing, vertexIndex, modelRotationIn, uvLocked); ++ } ++ ++ public int rotateVertex(Vector3f position, EnumFacing facing, int vertexIndex, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) ++ { + if (modelRotationIn == ModelRotation.X0_Y0) + { + return vertexIndex; + } + else + { +- this.rotateScale(position, new Vector3f(0.5F, 0.5F, 0.5F), modelRotationIn.getMatrix4d(), new Vector3f(1.0F, 1.0F, 1.0F)); +- return modelRotationIn.rotateVertex(facing, vertexIndex); ++ net.minecraftforge.client.ForgeHooksClient.transform(position, modelRotationIn.getMatrix()); ++ return modelRotationIn.rotate(facing, vertexIndex); + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch.rej new file mode 100644 index 0000000000..6c3d4d0cad --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 2 + return this.modelLocation; + } + ++ @Deprecated + public ModelRotation getRotation() + { + return this.modelRotation; + } + ++ public net.minecraftforge.client.model.IModelState getState() ++ { ++ return this.modelRotation; ++ } ++ + public boolean isUvLocked() + { + return this.uvLock; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej new file mode 100644 index 0000000000..5c3dd1f9c9 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + } + else + { +- s = ((IProperty)this.name).getName((Comparable)map.remove(this.name)); ++ s = String.format("%s:%s", ((ResourceLocation)Block.blockRegistry.getNameForObject(state.getBlock())).getResourceDomain(), ((IProperty)this.name).getName((Comparable)map.remove(this.name))); + } + + if (this.suffix != null) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej new file mode 100644 index 0000000000..18d3267450 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej @@ -0,0 +1,12 @@ +++++ REJECTED PATCH 3 + } + } + +- EnumWorldBlockLayer enumworldblocklayer1 = block.getBlockLayer(); ++ for(EnumWorldBlockLayer enumworldblocklayer1 : EnumWorldBlockLayer.values()) { ++ if(!block.canRenderInLayer(enumworldblocklayer1)) continue; ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1); + int j = enumworldblocklayer1.ordinal(); + + if (block.getRenderType() != -1) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej new file mode 100644 index 0000000000..576671980d --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej @@ -0,0 +1,39 @@ +++++ REJECTED PATCH 2 + + for (int j = 0; j < i; ++j) + { +- if (ibakedmodel.isGui3d()) + { + GlStateManager.pushMatrix(); + +++++ END PATCH +++++ REJECTED PATCH 3 + float f = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f1 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f2 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; +- GlStateManager.translate(f, f1, f2); ++ GlStateManager.translate(shouldSpreadItems() ? f : 0.0F, shouldSpreadItems() ? f1 : 0.0F, f2); + } + ++ if (ibakedmodel.isGui3d()) + GlStateManager.scale(0.5F, 0.5F, 0.5F); +- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); ++ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND); + this.itemRenderer.renderItem(itemstack, ibakedmodel); + GlStateManager.popMatrix(); + } +- else +- { +- GlStateManager.pushMatrix(); +- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); +- this.itemRenderer.renderItem(itemstack, ibakedmodel); +- GlStateManager.popMatrix(); +- float f3 = ibakedmodel.getItemCameraTransforms().ground.scale.x; +- float f4 = ibakedmodel.getItemCameraTransforms().ground.scale.y; +- float f5 = ibakedmodel.getItemCameraTransforms().ground.scale.z; +- GlStateManager.translate(0.0F * f3, 0.0F * f4, 0.046875F * f5); +- } + } + + GlStateManager.popMatrix(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej new file mode 100644 index 0000000000..37febaf27b --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej @@ -0,0 +1,96 @@ +++++ REJECTED PATCH 1 + public RenderItem(TextureManager textureManager, ModelManager modelManager) + { + this.textureManager = textureManager; +- this.itemModelMesher = new ItemModelMesher(modelManager); ++ this.itemModelMesher = new net.minecraftforge.client.ItemModelMesherForge(modelManager); + this.registerItems(); + } + +++++ END PATCH +++++ REJECTED PATCH 2 + k = k | -16777216; + } + +- this.renderQuad(renderer, bakedquad, k); ++ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, k); + } + } + +++++ END PATCH +++++ REJECTED PATCH 3 + modelresourcelocation = new ModelResourceLocation("bow_pulling_0", "inventory"); + } + } ++ else ++ { ++ // TODO: maybe switch to the smart player model / normal smart item model? ++ modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount()); ++ } + + if (modelresourcelocation != null) + { +++++ END PATCH +++++ REJECTED PATCH 4 + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.pushMatrix(); +- ItemCameraTransforms itemcameratransforms = model.getItemCameraTransforms(); +- itemcameratransforms.applyTransform(cameraTransformType); ++ // TODO: check if negative scale is a thing ++ model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(model, cameraTransformType); + +- if (this.func_183005_a(itemcameratransforms.getTransform(cameraTransformType))) +- { +- GlStateManager.cullFace(1028); +- } +- + this.renderItem(stack, model); + GlStateManager.cullFace(1029); + GlStateManager.popMatrix(); +++++ END PATCH +++++ REJECTED PATCH 5 + GlStateManager.blendFunc(770, 771); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.setupGuiTransform(x, y, ibakedmodel.isGui3d()); +- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GUI); ++ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GUI); + this.renderItem(stack, ibakedmodel); + GlStateManager.disableAlpha(); + GlStateManager.disableRescaleNormal(); +++++ END PATCH +++++ REJECTED PATCH 6 + GlStateManager.enableDepth(); + } + +- if (stack.isItemDamaged()) ++ if (stack.getItem().showDurabilityBar(stack)) + { +- int j = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage()); +- int i = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); ++ double health = stack.getItem().getDurabilityForDisplay(stack); ++ int j = (int)Math.round(13.0D - health * 13.0D); ++ int i = (int)Math.round(255.0D - health * 255.0D); + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + GlStateManager.disableTexture2D(); +++++ END PATCH +++++ REJECTED PATCH 7 + this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255); + this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255); + this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255); +- GlStateManager.enableBlend(); ++ //GlStateManager.enableBlend(); // Forge: Disable Blend because it screws with a lot of things down the line. + GlStateManager.enableAlpha(); + GlStateManager.enableTexture2D(); + GlStateManager.enableLighting(); +++++ END PATCH +++++ REJECTED PATCH 8 + this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block"); + this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block"); + this.registerBlock(Blocks.dragon_egg, "dragon_egg"); ++ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.itemModelMesher); + } + + public void onResourceManagerReload(IResourceManager resourceManager) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch.rej new file mode 100644 index 0000000000..7bcabbdeb4 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch.rej @@ -0,0 +1,13 @@ +++++ REJECTED PATCH 2 + IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn)); + Block block = iblockstate.getBlock(); + +- if (block == Blocks.bed) ++ if (block.isBed(worldIn, new BlockPos(livingPlayerIn), (EntityLivingBase)livingPlayerIn)) + { +- int i = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); ++ int i = block.getBedDirection(worldIn, new BlockPos(livingPlayerIn)).getHorizontalIndex(); + this.playerViewY = (float)(i * 90 + 180); + this.playerViewX = 0.0F; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej new file mode 100644 index 0000000000..48ad3c48d3 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej @@ -0,0 +1,68 @@ +++++ REJECTED PATCH 1 + protected List> layerRenderers = Lists.>newArrayList(); + protected boolean renderOutlines = false; + ++ public static float NAME_TAG_RANGE = 64.0f; ++ public static float NAME_TAG_RANGE_SNEAK = 32.0f; ++ + public RendererLivingEntity(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) + { + super(renderManagerIn); +++++ END PATCH +++++ REJECTED PATCH 2 + + public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(entity, this, x, y, z))) return; + GlStateManager.pushMatrix(); + GlStateManager.disableCull(); + this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks); +- this.mainModel.isRiding = entity.isRiding(); ++ boolean shouldSit = entity.isRiding() && (entity.ridingEntity != null && entity.ridingEntity.shouldRiderSit()); ++ this.mainModel.isRiding = shouldSit; + this.mainModel.isChild = entity.isChild(); + + try +++++ END PATCH +++++ REJECTED PATCH 3 + float f1 = this.interpolateRotation(entity.prevRotationYawHead, entity.rotationYawHead, partialTicks); + float f2 = f1 - f; + +- if (entity.isRiding() && entity.ridingEntity instanceof EntityLivingBase) ++ if (shouldSit && entity.ridingEntity instanceof EntityLivingBase) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)entity.ridingEntity; + f = this.interpolateRotation(entitylivingbase.prevRenderYawOffset, entitylivingbase.renderYawOffset, partialTicks); +++++ END PATCH +++++ REJECTED PATCH 4 + { + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(entity, this, x, y, z)); + } + + protected boolean setScoreTeamColor(T entityLivingBaseIn) +++++ END PATCH +++++ REJECTED PATCH 5 + + public void renderName(T entity, double x, double y, double z) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(entity, this, x, y, z))) return; + if (this.canRenderName(entity)) + { + double d0 = entity.getDistanceSqToEntity(this.renderManager.livingPlayer); +- float f = entity.isSneaking() ? 32.0F : 64.0F; ++ float f = entity.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; + + if (d0 < (double)(f * f)) + { +++++ END PATCH +++++ REJECTED PATCH 6 + } + } + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(entity, this, x, y, z)); + } + + protected boolean canRenderName(T entity) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej new file mode 100644 index 0000000000..ed83325a86 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej @@ -0,0 +1,93 @@ +++++ REJECTED PATCH 1 + T t = this.func_177175_a(armorSlot); + t.setModelAttributes(this.renderer.getMainModel()); + t.setLivingAnimations(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_4_); ++ t = getArmorModelHook(entitylivingbaseIn, itemstack, armorSlot, t); + this.func_177179_a(t, armorSlot); + boolean flag = this.isSlotForLeggings(armorSlot); +- this.renderer.bindTexture(this.getArmorResource(itemarmor, flag)); ++ this.renderer.bindTexture(this.getArmorResource(entitylivingbaseIn, itemstack, flag ? 2 : 1, null)); + +- switch (itemarmor.getArmorMaterial()) +- { +- case LEATHER: + int i = itemarmor.getColor(itemstack); ++ { ++ if (i != -1) // Allow this for anything, not only cloth. ++ { + float f = (float)(i >> 16 & 255) / 255.0F; + float f1 = (float)(i >> 8 & 255) / 255.0F; + float f2 = (float)(i & 255) / 255.0F; + GlStateManager.color(this.colorR * f, this.colorG * f1, this.colorB * f2, this.alpha); + t.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); +- this.renderer.bindTexture(this.getArmorResource(itemarmor, flag, "overlay")); +- case CHAIN: +- case IRON: +- case GOLD: +- case DIAMOND: ++ this.renderer.bindTexture(this.getArmorResource(entitylivingbaseIn, itemstack, flag ? 2 : 1, "overlay")); ++ } ++ { // Non-colored + GlStateManager.color(this.colorR, this.colorG, this.colorB, this.alpha); + t.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); +- default: +- +- if (!this.field_177193_i && itemstack.isItemEnchanted()) ++ } ++ // Default ++ if (!this.field_177193_i && itemstack.hasEffect()) + { + this.func_177183_a(entitylivingbaseIn, t, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); + } +++++ END PATCH +++++ REJECTED PATCH 3 + protected abstract void initArmor(); + + protected abstract void func_177179_a(T p_177179_1_, int p_177179_2_); ++ ++ /*=================================== FORGE START =========================================*/ ++ ++ /** ++ * Hook to allow item-sensitive armor model. for LayerBipedArmor. ++ */ ++ protected T getArmorModelHook(EntityLivingBase entity, ItemStack itemStack, int slot, T model) ++ { ++ return model; ++ } ++ ++ /** ++ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. ++ * ++ * @param entity Entity wearing the armor ++ * @param stack ItemStack for the armor ++ * @param slot Slot ID that the item is in ++ * @param type Subtype, can be null or "overlay" ++ * @return ResourceLocation pointing at the armor's texture ++ */ ++ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, int slot, String type) ++ { ++ ItemArmor item = (ItemArmor)stack.getItem(); ++ String texture = item.getArmorMaterial().getName(); ++ String domain = "minecraft"; ++ int idx = texture.indexOf(':'); ++ if (idx != -1) ++ { ++ domain = texture.substring(0, idx); ++ texture = texture.substring(idx + 1); ++ } ++ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); ++ ++ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); ++ ResourceLocation resourcelocation = (ResourceLocation)ARMOR_TEXTURE_RES_MAP.get(s1); ++ ++ if (resourcelocation == null) ++ { ++ resourcelocation = new ResourceLocation(s1); ++ ARMOR_TEXTURE_RES_MAP.put(s1, resourcelocation); ++ } ++ ++ return resourcelocation; ++ } ++ /*=================================== FORGE END ===========================================*/ + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej new file mode 100644 index 0000000000..25b88228c7 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej @@ -0,0 +1,83 @@ +++++ REJECTED PATCH 4 + int j = Integer.MAX_VALUE; + int k = 1 << this.mipmapLevels; + ++ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this); ++ net.minecraftforge.fml.common.FMLLog.info("Max texture size: %d", i); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.mapRegisteredSprites.size()); ++ ++ if(!skipFirst) + for (Entry entry : this.mapRegisteredSprites.entrySet()) + { + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); + ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.getIconName()); + ResourceLocation resourcelocation1 = this.completeResourceLocation(resourcelocation, 0); ++ bar.step(resourcelocation1.getResourcePath()); + ++ if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) ++ { ++ if (!textureatlassprite.load(resourceManager, resourcelocation)) ++ { ++ j = Math.min(j, Math.min(textureatlassprite.getIconWidth(), textureatlassprite.getIconHeight())); ++ stitcher.addSprite(textureatlassprite); ++ } ++ continue; ++ } ++ + try + { + IResource iresource = resourceManager.getResource(resourcelocation1); +++++ END PATCH +++++ REJECTED PATCH 5 + } + catch (RuntimeException runtimeexception) + { +- logger.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception); ++ //logger.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation1, runtimeexception.getMessage()); + continue; + } + catch (IOException ioexception1) + { +- logger.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1); ++ //logger.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation1); + continue; + } + +++++ END PATCH +++++ REJECTED PATCH 6 + stitcher.addSprite(textureatlassprite); + } + ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); + int j1 = Math.min(j, k); + int k1 = MathHelper.calculateLogBaseTwo(j1); + +++++ END PATCH +++++ REJECTED PATCH 7 + this.mipmapLevels = k1; + } + ++ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.mapRegisteredSprites.size()); + for (final TextureAtlasSprite textureatlassprite1 : this.mapRegisteredSprites.values()) + { ++ if (skipFirst) break; ++ bar.step(textureatlassprite1.getIconName()); + try + { + textureatlassprite1.generateMipmaps(this.mipmapLevels); +++++ END PATCH +++++ REJECTED PATCH 9 + } + + logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); ++ bar.step("Allocating GL texture"); + TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); + Map map = Maps.newHashMap(this.mapRegisteredSprites); + ++ bar.step("Uploading GL texture"); + for (TextureAtlasSprite textureatlassprite2 : stitcher.getStichSlots()) + { + String s = textureatlassprite2.getIconName(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch.rej new file mode 100644 index 0000000000..4cd0abd615 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch.rej @@ -0,0 +1,16 @@ +++++ REJECTED PATCH 1 + { + if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared()) + { ++ if(!tileentityIn.hasFastRenderer()) ++ { + int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0); + int j = i % 65536; + int k = i / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); ++ } + BlockPos blockpos = tileentityIn.getPos(); + this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej new file mode 100644 index 0000000000..0f67502075 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + } + + currentLocale.loadLocaleDataFiles(resourceManager, list); ++ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(currentLocale.properties, this.currentLanguage); + StringTranslate.replaceWith(currentLocale.properties); + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch.rej new file mode 100644 index 0000000000..8b56b35e33 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch.rej @@ -0,0 +1,8 @@ +++++ REJECTED PATCH 1 + + TextureAtlasSprite getParticleTexture(); + ++ @Deprecated + ItemCameraTransforms getItemCameraTransforms(); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej new file mode 100644 index 0000000000..31a5207b0c --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej @@ -0,0 +1,131 @@ +++++ REJECTED PATCH 1 + } + catch (Exception var6) + { +- LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation); ++ LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, var6); + } + } + catch (Exception exception) +++++ END PATCH +++++ REJECTED PATCH 2 + + protected void registerVariantNames() + { ++ this.variantNames.clear(); //FML clear this to prevent double ups. + this.variantNames.put(Item.getItemFromBlock(Blocks.stone), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.dirt), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.planks), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); +++++ END PATCH +++++ REJECTED PATCH 3 + this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence_gate), Lists.newArrayList(new String[] {"oak_fence_gate"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence), Lists.newArrayList(new String[] {"oak_fence"})); + this.variantNames.put(Items.oak_door, Lists.newArrayList(new String[] {"oak_door"})); ++ for (Entry, Set> e : customVariantNames.entrySet()) ++ { ++ this.variantNames.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator())); ++ } + } + + protected List getVariantNames(Item p_177596_1_) +++++ END PATCH +++++ REJECTED PATCH 4 + + protected ResourceLocation getItemLocation(String p_177583_1_) + { +- ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_); ++ ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_.replaceAll("#.*", "")); + return new ResourceLocation(resourcelocation.getResourceDomain(), "item/" + resourcelocation.getResourcePath()); + } + +++++ END PATCH +++++ REJECTED PATCH 5 + for (Entry entry : this.itemLocations.entrySet()) + { + ResourceLocation resourcelocation = (ResourceLocation)entry.getValue(); +- ModelResourceLocation modelresourcelocation1 = new ModelResourceLocation((String)entry.getKey(), "inventory"); ++ ModelResourceLocation modelresourcelocation1 = net.minecraftforge.client.model.ModelLoader.getInventoryVariant(entry.getKey()); + ModelBlock modelblock1 = (ModelBlock)this.models.get(resourcelocation); + + if (modelblock1 != null && modelblock1.isResolved()) +++++ END PATCH +++++ REJECTED PATCH 6 + + private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked) + { ++ return bakeModel(modelBlockIn, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); ++ } ++ ++ protected IBakedModel bakeModel(ModelBlock modelBlockIn, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) ++ { + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle"))); + SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite); + +++++ END PATCH +++++ REJECTED PATCH 7 + BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); + TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture))); + +- if (blockpartface.cullFace == null) ++ if (blockpartface.cullFace == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix())) + { + simplebakedmodel$builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); + } + else + { +- simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); ++ simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); + } + } + } +++++ END PATCH +++++ REJECTED PATCH 8 + + private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) + { ++ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation)p_177589_5_, p_177589_6_); ++ } ++ ++ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) ++ { + return this.faceBakery.makeBakedQuad(p_177589_1_.positionFrom, p_177589_1_.positionTo, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.partRotation, p_177589_6_, p_177589_1_.shade); + } + +++++ END PATCH +++++ REJECTED PATCH 9 + MODEL_CLOCK.name = "class generation marker"; + MODEL_ENTITY.name = "block entity marker"; + } ++ ++ /*********************************************************** ++ * FML Start ++ ***********************************************************/ ++ private static Map, Set> customVariantNames = Maps.newHashMap(); ++ /** ++ * @deprecated use registerItemVariants ++ */ ++ @Deprecated ++ public static void addVariantName(Item item, String... names) ++ { ++ if (customVariantNames.containsKey(item.delegate)) ++ customVariantNames.get(item.delegate).addAll(Lists.newArrayList(names)); ++ else ++ customVariantNames.put(item.delegate, Sets.newHashSet(names)); ++ } ++ ++ public static void registerItemVariants(Item item, T... names) ++ { ++ if (!customVariantNames.containsKey(item.delegate)) ++ { ++ customVariantNames.put(item.delegate, Sets.newHashSet()); ++ } ++ for(ResourceLocation name : names) ++ { ++ customVariantNames.get(item.delegate).add(name.toString()); ++ } ++ } ++ /*********************************************************** ++ * FML End ++ ***********************************************************/ + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch.rej new file mode 100644 index 0000000000..734c561bd5 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch.rej @@ -0,0 +1,13 @@ +++++ REJECTED PATCH 1 + + public void onResourceManagerReload(IResourceManager resourceManager) + { +- ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider); ++ ModelBakery modelbakery = new net.minecraftforge.client.model.ModelLoader(resourceManager, this.texMap, this.modelProvider); + this.modelRegistry = modelbakery.setupModelRegistry(); + this.defaultModel = (IBakedModel)this.modelRegistry.getObject(ModelBakery.MODEL_MISSING); ++ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelRegistry, modelbakery); + this.modelProvider.reloadModels(); + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch.rej new file mode 100644 index 0000000000..9d9e7cc812 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch.rej @@ -0,0 +1,21 @@ +++++ REJECTED PATCH 1 + import org.lwjgl.util.vector.Vector3f; + + @SideOnly(Side.CLIENT) +-public enum ModelRotation ++public enum ModelRotation implements net.minecraftforge.client.model.IModelState, net.minecraftforge.client.model.ITransformation + { + X0_Y0(0, 0), + X0_Y90(0, 90), +++++ END PATCH +++++ REJECTED PATCH 2 + mapRotations.put(Integer.valueOf(modelrotation.combinedXY), modelrotation); + } + } ++ ++ public com.google.common.base.Optional apply(com.google.common.base.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(getMatrix(), part); } ++ public javax.vecmath.Matrix4f getMatrix() { return net.minecraftforge.client.ForgeHooksClient.getMatrix(this); } ++ public EnumFacing rotate(EnumFacing facing) { return rotateFace(facing); } ++ public int rotate(EnumFacing facing, int vertexIndex) { return rotateVertex(facing, vertexIndex); } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/command/CommandBase.java.patch.rej b/rejects/minecraft/net/minecraft/command/CommandBase.java.patch.rej new file mode 100644 index 0000000000..d826d8eee0 --- /dev/null +++ b/rejects/minecraft/net/minecraft/command/CommandBase.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + ichatcomponent.appendText(" "); + } + +- IChatComponent ichatcomponent1 = new ChatComponentText(args[i]); ++ IChatComponent ichatcomponent1 = net.minecraftforge.common.ForgeHooks.newChatWithLinks(args[i]); // Forge: links for messages + + if (p_147176_3_) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/command/CommandEnchant.java.patch.rej b/rejects/minecraft/net/minecraft/command/CommandEnchant.java.patch.rej new file mode 100644 index 0000000000..9af81aea04 --- /dev/null +++ b/rejects/minecraft/net/minecraft/command/CommandEnchant.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + { + Enchantment enchantment2 = Enchantment.getEnchantmentById(l); + +- if (!enchantment2.canApplyTogether(enchantment1)) ++ if (!enchantment2.canApplyTogether(enchantment1) || !enchantment1.canApplyTogether(enchantment2)) //Forge BugFix: Let Both enchantments veto being together + { + throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment1.getTranslatedName(j), enchantment2.getTranslatedName(nbttaglist.getCompoundTagAt(k).getShort("lvl"))}); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/command/CommandFill.java.patch.rej b/rejects/minecraft/net/minecraft/command/CommandFill.java.patch.rej new file mode 100644 index 0000000000..3d13d0aa63 --- /dev/null +++ b/rejects/minecraft/net/minecraft/command/CommandFill.java.patch.rej @@ -0,0 +1,20 @@ +++++ REJECTED PATCH 2 + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + +- if (args.length >= 10 && block.hasTileEntity()) ++ if (args.length >= 10 && block.hasTileEntity(state)) + { + String s = getChatComponentFromNthArg(sender, args, 9).getUnformattedText(); + +++++ END PATCH +++++ REJECTED PATCH 3 + continue; + } + } +- else if (args[8].equals("replace") && !block.hasTileEntity()) ++ else if (args[8].equals("replace") && !block.hasTileEntity(state)) + { + if (args.length > 9) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/command/CommandHandler.java.patch.rej b/rejects/minecraft/net/minecraft/command/CommandHandler.java.patch.rej new file mode 100644 index 0000000000..92101609e9 --- /dev/null +++ b/rejects/minecraft/net/minecraft/command/CommandHandler.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.generic.exception", new Object[0]); + chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); + sender.addChatMessage(chatcomponenttranslation); +- logger.warn("Couldn\'t process command: \'" + input + "\'"); ++ logger.warn("Couldn\'t process command: \'" + input + "\'", var9); // Forge: Log stacktrace of unknown exceptions + } + + return false; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/command/PlayerSelector.java.patch.rej b/rejects/minecraft/net/minecraft/command/PlayerSelector.java.patch.rej new file mode 100644 index 0000000000..673621f250 --- /dev/null +++ b/rejects/minecraft/net/minecraft/command/PlayerSelector.java.patch.rej @@ -0,0 +1,13 @@ +++++ REJECTED PATCH 1 + + public class PlayerSelector + { +- private static final Pattern tokenPattern = Pattern.compile("^@([pare])(?:\\[([\\w=,!-]*)\\])?$"); ++ private static final Pattern tokenPattern = Pattern.compile("^@([pare])(?:\\[([\\w\\.=,!-]*)\\])?$"); // FORGE: allow . in entity selectors + private static final Pattern intListPattern = Pattern.compile("\\G([-!]?[\\w-]*)(?:$|,)"); +- private static final Pattern keyValueListPattern = Pattern.compile("\\G(\\w+)=([-!]?[\\w-]*)(?:$|,)"); ++ private static final Pattern keyValueListPattern = Pattern.compile("\\G(\\w+)=([-!]?[\\w\\.-]*)(?:$|,)"); // FORGE: allow . in entity selectors + private static final Set WORLD_BINDING_ARGS = Sets.newHashSet(new String[] {"x", "y", "z", "dx", "dy", "dz", "rm", "r"}); + + public static EntityPlayerMP matchOnePlayer(ICommandSender sender, String token) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch.rej b/rejects/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch.rej new file mode 100644 index 0000000000..d7dd3fdf88 --- /dev/null +++ b/rejects/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch.rej @@ -0,0 +1,20 @@ +++++ REJECTED PATCH 1 + i = parseInt(args[4], 0, 15); + } + ++ IBlockState state = block.getStateFromMeta(i); ++ + World world = sender.getEntityWorld(); + + if (!world.isBlockLoaded(blockpos)) +++++ END PATCH +++++ REJECTED PATCH 2 + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + +- if (args.length >= 7 && block.hasTileEntity()) ++ if (args.length >= 7 && block.hasTileEntity(state)) + { + String s = getChatComponentFromNthArg(sender, args, 6).getUnformattedText(); + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch.rej b/rejects/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch.rej new file mode 100644 index 0000000000..1af151dc0a --- /dev/null +++ b/rejects/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + +- if (args.length >= 6 && block.hasTileEntity()) ++ if (args.length >= 6 && block.hasTileEntity(block.getStateFromMeta(i))) + { + String s = getChatComponentFromNthArg(sender, args, 5).getUnformattedText(); + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej b/rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej new file mode 100644 index 0000000000..f9ef1270f7 --- /dev/null +++ b/rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej @@ -0,0 +1,57 @@ +++++ REJECTED PATCH 1 + + if (enchantmentsList[enchID] != null) + { +- throw new IllegalArgumentException("Duplicate enchantment id!"); ++ throw new IllegalArgumentException("Duplicate enchantment id! " + this.getClass() + " and " + enchantmentsList[enchID].getClass() + " Enchantment ID:" + enchID); + } + else + { +++++ END PATCH +++++ REJECTED PATCH 3 + { + } + ++ /** ++ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)} ++ * applies for all possible enchantments. ++ * @param stack ++ * @return ++ */ ++ public boolean canApplyAtEnchantingTable(ItemStack stack) ++ { ++ return this.type.canEnchantItem(stack.getItem()); ++ } ++ ++ private static final java.lang.reflect.Field bookSetter = Enchantment.class.getDeclaredFields()[1]; ++ /** ++ * Add to the list of enchantments applicable by the anvil from a book ++ * ++ * @param enchantment ++ */ ++ public static void addToBookList(Enchantment enchantment) ++ { ++ try ++ { ++ net.minecraftforge.common.util.EnumHelper.setFailsafeFieldValue(bookSetter, null, ++ com.google.common.collect.ObjectArrays.concat(enchantmentsBookList, enchantment)); ++ } ++ catch (Exception e) ++ { ++ throw new RuntimeException(e); //Rethrow see what happens ++ } ++ } ++ ++ /** ++ * Is this enchantment allowed to be enchanted on books via Enchantment Table ++ * @return false to disable the vanilla feature ++ */ ++ public boolean isAllowedOnBooks() ++ { ++ return true; ++ } ++ + static + { + List list = Lists.newArrayList(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej b/rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej new file mode 100644 index 0000000000..69f7aae3ef --- /dev/null +++ b/rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej @@ -0,0 +1,23 @@ +++++ REJECTED PATCH 3 + + for (EnchantmentData enchantmentdata1 : list) + { +- if (!enchantmentdata1.enchantmentobj.canApplyTogether(Enchantment.getEnchantmentById(integer.intValue()))) ++ Enchantment e1 = enchantmentdata1.enchantmentobj; ++ Enchantment e2 = Enchantment.getEnchantmentById(integer.intValue()); ++ if (!e1.canApplyTogether(e2) || !e2.canApplyTogether(e1)) //Forge BugFix: Let Both enchantments veto being together + { + flag = false; + break; +++++ END PATCH +++++ REJECTED PATCH 4 + + for (Enchantment enchantment : Enchantment.enchantmentsBookList) + { +- if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) ++ if (enchantment == null) continue; ++ if (enchantment.canApplyAtEnchantingTable(p_77505_1_) || (flag && enchantment.isAllowedOnBooks())) + { + for (int i = enchantment.getMinLevel(); i <= enchantment.getMaxLevel(); ++i) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/Entity.java.patch.rej b/rejects/minecraft/net/minecraft/entity/Entity.java.patch.rej new file mode 100644 index 0000000000..ed53bc9e4e --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/Entity.java.patch.rej @@ -0,0 +1,59 @@ +++++ REJECTED PATCH 4 + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + ++ Boolean result = block.isEntityInsideMaterial(this.worldObj, blockpos, iblockstate, this, d0, materialIn, true); ++ if (result != null) return result; ++ + if (block.getMaterial() == materialIn) + { +- float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F; +- float f1 = (float)(blockpos.getY() + 1) - f; +- boolean flag = d0 < (double)f1; +- return !flag && this instanceof EntityPlayer ? false : flag; ++ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(materialIn, this, blockpos); + } + else + { +++++ END PATCH +++++ REJECTED PATCH 6 + this.setAlwaysRenderNameTag(tagCompund.getBoolean("CustomNameVisible")); + this.cmdResultStats.readStatsFromNBT(tagCompund); + this.setSilent(tagCompund.getBoolean("Silent")); ++ ++ if (tagCompund.hasKey("ForgeData")) customEntityData = tagCompund.getCompoundTag("ForgeData"); ++ for (String identifier : this.extendedProperties.keySet()) ++ { ++ try ++ { ++ net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); ++ props.loadNBTData(tagCompund); ++ } ++ catch (Throwable t) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe("Failed to load extended properties for %s. This is a mod issue.", identifier); ++ t.printStackTrace(); ++ } ++ } ++ ++ //Rawr, legacy code, Vanilla added a UUID, keep this so older maps will convert properly TODO: Remove in 1.9 ++ if (tagCompund.hasKey("PersistentIDMSB") && tagCompund.hasKey("PersistentIDLSB")) ++ { ++ this.entityUniqueID = new UUID(tagCompund.getLong("PersistentIDMSB"), tagCompund.getLong("PersistentIDLSB")); ++ } ++ ++ if (this.capabilities != null && tagCompund.hasKey("ForgeCaps")) this.capabilities.deserializeNBT(tagCompund.getCompoundTag("ForgeCaps")); ++ + this.readEntityFromNBT(tagCompund); + + if (this.shouldSetPosAfterLoading()) +++++ END PATCH +++++ REJECTED PATCH 8 + + public void mountEntity(Entity entityIn) + { ++ if(!(this instanceof EntityLivingBase) && !net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } + this.entityRiderPitchDelta = 0.0D; + this.entityRiderYawDelta = 0.0D; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/EntityAgeable.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityAgeable.java.patch.rej new file mode 100644 index 0000000000..81b980feba --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/EntityAgeable.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + { + if (!this.worldObj.isRemote) + { +- Class oclass = EntityList.getClassFromID(itemstack.getMetadata()); ++ Class oclass = EntityList.stringToClassMapping.get(net.minecraft.item.ItemMonsterPlacer.getEntityName(itemstack)); + + if (oclass != null && this.getClass() == oclass) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/EntityHanging.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityHanging.java.patch.rej new file mode 100644 index 0000000000..9b9b6da9a0 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/EntityHanging.java.patch.rej @@ -0,0 +1,11 @@ +++++ REJECTED PATCH 1 + { + BlockPos blockpos1 = blockpos.offset(enumfacing, k).up(l); + Block block = this.worldObj.getBlockState(blockpos1).getBlock(); ++ ++ if ( block.isSideSolid( this.worldObj, blockpos1, this.facingDirection )) ++ continue; + + if (!block.getMaterial().isSolid() && !BlockRedstoneDiode.isRedstoneRepeaterBlockID(block)) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej new file mode 100644 index 0000000000..81dca3b0fd --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej @@ -0,0 +1,11 @@ +++++ REJECTED PATCH 4 + + public static class EntityEggInfo + { ++ @Deprecated // This is not always a valid number in the global ID list. + public final int spawnedID; ++ public final String name; + public final int primaryColor; + public final int secondaryColor; + public final StatBase field_151512_d; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej new file mode 100644 index 0000000000..66499b8a99 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej @@ -0,0 +1,76 @@ +++++ REJECTED PATCH 1 + } + + int i = (int)(150.0D * d0); ++ if ( !block.addLandingEffects( (WorldServer)this.worldObj, pos, iblockstate, this, i ) ) + ((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.BLOCK_DUST, this.posX, this.posY, this.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] {Block.getStateId(iblockstate)}); + } + } +++++ END PATCH +++++ REJECTED PATCH 2 + } + } + +- if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase) ++ if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity != null && ridingEntity.shouldDismountInWater(this)) + { + this.mountEntity((Entity)null); + } +++++ END PATCH +++++ REJECTED PATCH 5 + return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; + } + +- @SideOnly(Side.CLIENT) + public void removePotionEffectClient(int potionId) + { + this.activePotionsMap.remove(Integer.valueOf(potionId)); +++++ END PATCH +++++ REJECTED PATCH 9 + + public void onDeath(DamageSource cause) + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; + Entity entity = cause.getEntity(); + EntityLivingBase entitylivingbase = this.func_94060_bK(); + +++++ END PATCH +++++ REJECTED PATCH 10 + i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity); + } + ++ captureDrops = true; ++ capturedDrops.clear(); ++ + if (this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot")) + { + this.dropFewItems(this.recentlyHit > 0, i); +++++ END PATCH +++++ REJECTED PATCH 12 + int j = MathHelper.floor_double(this.getEntityBoundingBox().minY); + int k = MathHelper.floor_double(this.posZ); + Block block = this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock(); +- return (block == Blocks.ladder || block == Blocks.vine) && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).isSpectator()); ++ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(block, worldObj, new BlockPos(i, j, k), this); + } + + public boolean isEntityAlive() +++++ END PATCH +++++ REJECTED PATCH 16 + + public void dismountEntity(Entity p_110145_1_) + { ++ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_110145_1_, false)){ return; } + double d0 = p_110145_1_.posX; + double d1 = p_110145_1_.getEntityBoundingBox().minY + (double)p_110145_1_.height; + double d2 = p_110145_1_.posZ; +++++ END PATCH +++++ REJECTED PATCH 19 + + public void mountEntity(Entity entityIn) + { ++ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } + if (this.ridingEntity != null && entityIn == null) + { + if (!this.worldObj.isRemote) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch.rej new file mode 100644 index 0000000000..75ed679fe7 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + this.commandBlockLogic.tryOpenEditCommandBlock(playerIn); + return false; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch.rej new file mode 100644 index 0000000000..cdbb07dee0 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch.rej @@ -0,0 +1,32 @@ +++++ REJECTED PATCH 1 + this.lastTrackedEntityMotionY = this.trackedEntity.motionY; + this.motionZ = this.trackedEntity.motionZ; + ++ int posX = MathHelper.floor_double(this.trackedEntity.posX * 32.0D); ++ int posY = MathHelper.floor_double(this.trackedEntity.posY * 32.0D); ++ int posZ = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D); ++ if (posX != this.encodedPosX || posY != this.encodedPosY || posZ != this.encodedPosZ) ++ { ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.trackedEntity, playerMP, this.encodedPosX, this.encodedPosY, this.encodedPosZ); ++ } ++ + if (this.sendVelocityUpdates && !(packet instanceof S0FPacketSpawnMob)) + { + playerMP.playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(this.trackedEntity.getEntityId(), this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ)); +++++ END PATCH +++++ REJECTED PATCH 2 + playerMP.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.trackedEntity.getEntityId(), potioneffect)); + } + } ++ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(trackedEntity, playerMP); + } + } + else if (this.trackingPlayers.contains(playerMP)) + { + this.trackingPlayers.remove(playerMP); + playerMP.removeEntity(this.trackedEntity); ++ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(trackedEntity, playerMP); + } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej b/rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej new file mode 100644 index 0000000000..2d0c7a658e --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej @@ -0,0 +1,56 @@ +++++ REJECTED PATCH 1 + private double targetX; + private double targetY; + private double targetZ; ++ private int failedPathFindingPenalty = 0; ++ private boolean canPenalize = false; + + public EntityAIAttackOnCollide(EntityCreature creature, Class targetClass, double speedIn, boolean useLongMemory) + { +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { ++ if (canPenalize) ++ { ++ if (--this.delayCounter <= 0) ++ { ++ this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); ++ this.targetX = 4 + this.attacker.getRNG().nextInt(7); ++ return this.entityPathEntity != null; ++ } ++ else ++ { ++ return true; ++ } ++ } + this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); + return this.entityPathEntity != null; + } +++++ END PATCH +++++ REJECTED PATCH 3 + this.targetZ = entitylivingbase.posZ; + this.delayCounter = 4 + this.attacker.getRNG().nextInt(7); + ++ if (this.canPenalize) ++ { ++ this.targetX += failedPathFindingPenalty; ++ if (this.attacker.getNavigator().getPath() != null) ++ { ++ net.minecraft.pathfinding.PathPoint finalPathPoint = this.attacker.getNavigator().getPath().getFinalPathPoint(); ++ if (finalPathPoint != null && entitylivingbase.getDistanceSq(finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord) < 1) ++ failedPathFindingPenalty = 0; ++ else ++ failedPathFindingPenalty += 10; ++ } ++ else ++ { ++ failedPathFindingPenalty += 10; ++ } ++ } ++ + if (d0 > 1024.0D) + { + this.delayCounter += 10; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch.rej b/rejects/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch.rej new file mode 100644 index 0000000000..baa14587a8 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch.rej @@ -0,0 +1,13 @@ +++++ REJECTED PATCH 1 + BlockPos blockpos = new BlockPos(k1, l1, i2); + Block block = this.worldObj.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(worldObj, new BlockPos(k1, l1, i2))) + { +- if (block != Blocks.barrier && block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && block != Blocks.command_block && this.worldObj.getGameRules().getBoolean("mobGriefing")) ++ if (block.canEntityDestroy(worldObj, new BlockPos(k1, l1, i2), this) && this.worldObj.getGameRules().getBoolean("mobGriefing")) + { + flag1 = this.worldObj.setBlockToAir(blockpos) || flag1; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej b/rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej new file mode 100644 index 0000000000..a357507d6a --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + BlockPos blockpos = new BlockPos(i3, k, l); + Block block = this.worldObj.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() != Material.air && func_181033_a(block)) ++ if (!block.isAir(worldObj,blockpos) && func_181033_a(block) && block.canEntityDestroy(worldObj, blockpos, this)) + { + flag = this.worldObj.destroyBlock(blockpos, true) || flag; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch.rej b/rejects/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch.rej new file mode 100644 index 0000000000..b7bedf878c --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public interface IBossDisplayData + { + float getMaxHealth(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej b/rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej new file mode 100644 index 0000000000..bab388b0db --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej @@ -0,0 +1,289 @@ +++++ REJECTED PATCH 10 + this.posX = d19 + d1 * d18; + this.posZ = d20 + d2 * d18; + this.setPosition(this.posX, this.posY, this.posZ); +- double d22 = this.motionX; +- double d23 = this.motionZ; ++ this.moveMinecartOnRail(p_180460_1_); + +- if (this.riddenByEntity != null) +- { +- d22 *= 0.75D; +- d23 *= 0.75D; +- } +- +- double d13 = this.getMaximumSpeed(); +- d22 = MathHelper.clamp_double(d22, -d13, d13); +- d23 = MathHelper.clamp_double(d23, -d13, d13); +- this.moveEntity(d22, 0.0D, d23); +- + if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - p_180460_1_.getX() == aint[0][0] && MathHelper.floor_double(this.posZ) - p_180460_1_.getZ() == aint[0][2]) + { + this.setPosition(this.posX, this.posY + (double)aint[0][1], this.posZ); +++++ END PATCH +++++ REJECTED PATCH 12 + + public void applyEntityCollision(Entity entityIn) + { ++ ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, entityIn)); ++ if (getCollisionHandler() != null) ++ { ++ getCollisionHandler().onEntityCollision(this, entityIn); ++ return; ++ } + if (!this.worldObj.isRemote) + { + if (!entityIn.noClip && !this.noClip) + { + if (entityIn != this.riddenByEntity) + { +- if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) ++ if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) + { + entityIn.mountEntity(this); + } +++++ END PATCH +++++ REJECTED PATCH 13 + double d7 = entityIn.motionX + this.motionX; + double d8 = entityIn.motionZ + this.motionZ; + +- if (((EntityMinecart)entityIn).getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE) ++ if (((EntityMinecart)entityIn).isPoweredCart() && !isPoweredCart()) + { + this.motionX *= 0.20000000298023224D; + this.motionZ *= 0.20000000298023224D; +++++ END PATCH +++++ REJECTED PATCH 14 + entityIn.motionX *= 0.949999988079071D; + entityIn.motionZ *= 0.949999988079071D; + } +- else if (((EntityMinecart)entityIn).getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE) ++ else if (((EntityMinecart)entityIn).isPoweredCart() && isPoweredCart()) + { + entityIn.motionX *= 0.20000000298023224D; + entityIn.motionZ *= 0.20000000298023224D; +++++ END PATCH +++++ REJECTED PATCH 15 + } + } + ++ /* =================================== FORGE START ===========================================*/ ++ private BlockPos getCurrentRailPosition() ++ { ++ int x = MathHelper.floor_double(this.posX); ++ int y = MathHelper.floor_double(this.posY); ++ int z = MathHelper.floor_double(this.posZ); ++ ++ if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(x, y - 1, z))) y--; ++ return new BlockPos(x, y, z); ++ } ++ ++ protected double getMaxSpeed() ++ { ++ if (!canUseRail()) return getMaximumSpeed(); ++ BlockPos pos = this.getCurrentRailPosition(); ++ IBlockState state = this.worldObj.getBlockState(pos); ++ if (!BlockRailBase.isRailBlock(state)) return getMaximumSpeed(); ++ ++ float railMaxSpeed = ((BlockRailBase)state.getBlock()).getRailMaxSpeed(worldObj, this, pos); ++ return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); ++ } ++ ++ /** ++ * Moved to allow overrides. ++ * This code handles minecart movement and speed capping when on a rail. ++ */ ++ public void moveMinecartOnRail(BlockPos pos) ++ { ++ double mX = this.motionX; ++ double mZ = this.motionZ; ++ ++ if (this.riddenByEntity != null) ++ { ++ mX *= 0.75D; ++ mZ *= 0.75D; ++ } ++ ++ double max = this.getMaxSpeed(); ++ mX = MathHelper.clamp_double(mX, -max, max); ++ mZ = MathHelper.clamp_double(mZ, -max, max); ++ this.moveEntity(mX, 0.0D, mZ); ++ } ++ ++ /** ++ * Gets the current global Minecart Collision handler if none ++ * is registered, returns null ++ * @return The collision handler or null ++ */ ++ public static net.minecraftforge.common.IMinecartCollisionHandler getCollisionHandler() ++ { ++ return collisionHandler; ++ } ++ ++ /** ++ * Sets the global Minecart Collision handler, overwrites any ++ * that is currently set. ++ * @param handler The new handler ++ */ ++ public static void setCollisionHandler(net.minecraftforge.common.IMinecartCollisionHandler handler) ++ { ++ collisionHandler = handler; ++ } ++ ++ /** ++ * This function returns an ItemStack that represents this cart. ++ * This should be an ItemStack that can be used by the player to place the cart, ++ * but is not necessary the item the cart drops when destroyed. ++ * @return An ItemStack that can be used to place the cart. ++ */ ++ public ItemStack getCartItem() ++ { ++ if (this instanceof EntityMinecartFurnace) ++ { ++ return new ItemStack(Items.furnace_minecart); ++ } ++ else if (this instanceof EntityMinecartChest) ++ { ++ return new ItemStack(Items.chest_minecart); ++ } ++ else if (this instanceof EntityMinecartTNT) ++ { ++ return new ItemStack(Items.tnt_minecart); ++ } ++ else if (this instanceof EntityMinecartHopper) ++ { ++ return new ItemStack(Items.hopper_minecart); ++ } ++ else if (this instanceof EntityMinecartCommandBlock) ++ { ++ return new ItemStack(Items.command_block_minecart); ++ } ++ return new ItemStack(Items.minecart); ++ } ++ ++ /** ++ * Returns true if this cart can currently use rails. ++ * This function is mainly used to gracefully detach a minecart from a rail. ++ * @return True if the minecart can use rails. ++ */ ++ public boolean canUseRail() ++ { ++ return canUseRail; ++ } ++ ++ /** ++ * Set whether the minecart can use rails. ++ * This function is mainly used to gracefully detach a minecart from a rail. ++ * @param use Whether the minecart can currently use rails. ++ */ ++ public void setCanUseRail(boolean use) ++ { ++ canUseRail = use; ++ } ++ ++ /** ++ * Return false if this cart should not call onMinecartPass() and should ignore Powered Rails. ++ * @return True if this cart should call onMinecartPass(). ++ */ ++ public boolean shouldDoRailFunctions() ++ { ++ return true; ++ } ++ ++ /** ++ * Returns true if this cart is self propelled. ++ * @return True if powered. ++ */ ++ public boolean isPoweredCart() ++ { ++ return getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE; ++ } ++ ++ /** ++ * Returns true if this cart can be ridden by an Entity. ++ * @return True if this cart can be ridden. ++ */ ++ public boolean canBeRidden() ++ { ++ return this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE; ++ } ++ ++ /** ++ * Getters/setters for physics variables ++ */ ++ ++ /** ++ * Returns the carts max speed when traveling on rails. Carts going faster ++ * than 1.1 cause issues with chunk loading. Carts cant traverse slopes or ++ * corners at greater than 0.5 - 0.6. This value is compared with the rails ++ * max speed and the carts current speed cap to determine the carts current ++ * max speed. A normal rail's max speed is 0.4. ++ * ++ * @return Carts max speed. ++ */ ++ public float getMaxCartSpeedOnRail() ++ { ++ return 1.2f; ++ } ++ ++ /** ++ * Returns the current speed cap for the cart when traveling on rails. This ++ * functions differs from getMaxCartSpeedOnRail() in that it controls ++ * current movement and cannot be overridden. The value however can never be ++ * higher than getMaxCartSpeedOnRail(). ++ * ++ * @return ++ */ ++ public final float getCurrentCartSpeedCapOnRail() ++ { ++ return currentSpeedRail; ++ } ++ ++ public final void setCurrentCartSpeedCapOnRail(float value) ++ { ++ value = Math.min(value, getMaxCartSpeedOnRail()); ++ currentSpeedRail = value; ++ } ++ ++ public float getMaxSpeedAirLateral() ++ { ++ return maxSpeedAirLateral; ++ } ++ ++ public void setMaxSpeedAirLateral(float value) ++ { ++ maxSpeedAirLateral = value; ++ } ++ ++ public float getMaxSpeedAirVertical() ++ { ++ return maxSpeedAirVertical; ++ } ++ ++ public void setMaxSpeedAirVertical(float value) ++ { ++ maxSpeedAirVertical = value; ++ } ++ ++ public double getDragAir() ++ { ++ return dragAir; ++ } ++ ++ public void setDragAir(double value) ++ { ++ dragAir = value; ++ } ++ ++ public double getSlopeAdjustment() ++ { ++ return 0.0078125D; ++ } ++ ++ /* =================================== FORGE END ===========================================*/ ++ + public static enum EnumMinecartType + { + RIDEABLE(0, "MinecartRideable"), +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch.rej b/rejects/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch.rej new file mode 100644 index 0000000000..c29f3c2b53 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn) + { + return true; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch.rej b/rejects/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch.rej new file mode 100644 index 0000000000..9128588fdc --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + ItemStack itemstack = playerIn.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.getItem() == Items.coal) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej b/rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej new file mode 100644 index 0000000000..2110205143 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 1 + + protected boolean teleportTo(double x, double y, double z) + { ++ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, x, y, z, 0); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; + double d0 = this.posX; + double d1 = this.posY; + double d2 = this.posZ; +- this.posX = x; +- this.posY = y; +- this.posZ = z; ++ this.posX = event.targetX; ++ this.posY = event.targetY; ++ this.posZ = event.targetZ; + boolean flag = false; + BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ); + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej b/rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej new file mode 100644 index 0000000000..2d62aecaf8 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej @@ -0,0 +1,42 @@ +++++ REJECTED PATCH 1 + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); +- this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * 0.10000000149011612D); ++ this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance); + } + + protected void entityInit() +++++ END PATCH +++++ REJECTED PATCH 2 + entitylivingbase = (EntityLivingBase)source.getEntity(); + } + +- if (entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) ++ int i = MathHelper.floor_double(this.posX); ++ int j = MathHelper.floor_double(this.posY); ++ int k = MathHelper.floor_double(this.posZ); ++ ++ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(reinforcementChance).getAttributeValue()); ++ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true; ++ ++ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || ++ entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) + { +- int i = MathHelper.floor_double(this.posX); +- int j = MathHelper.floor_double(this.posY); +- int k = MathHelper.floor_double(this.posZ); +- EntityZombie entityzombie = new EntityZombie(this.worldObj); ++ EntityZombie entityzombie; ++ if (summonAid.customSummonedAid != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) ++ { ++ entityzombie = summonAid.customSummonedAid; ++ } ++ else ++ { ++ entityzombie = new EntityZombie(this.worldObj); ++ } + + for (int l = 0; l < 50; ++l) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch.rej b/rejects/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch.rej new file mode 100644 index 0000000000..c6f68c40ed --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 2 + this.spawnableBlock = Blocks.mycelium; + } + ++ @SuppressWarnings("unused") + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); +++++ END PATCH +++++ REJECTED PATCH 3 + } + } + +- if (itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) ++ if (false && itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) //Forge Disable, Moved to onSheared + { + this.setDead(); + this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch.rej b/rejects/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch.rej new file mode 100644 index 0000000000..c6cc508db6 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + Block block = this.worldObj.getBlockState(blockpos.down()).getBlock(); + +- if (block == Blocks.grass || block.getMaterial() == Material.leaves) ++ if (block == Blocks.grass || block.isLeaves(worldObj, blockpos.down())) + { + return true; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch.rej b/rejects/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch.rej new file mode 100644 index 0000000000..cc41f21686 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch.rej @@ -0,0 +1,15 @@ +++++ REJECTED PATCH 2 + } + } + ++ @SuppressWarnings("unused") + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); + +- if (itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) ++ if (false && itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) //Forge: Moved to onSheared + { + if (!this.worldObj.isRemote) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej b/rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej new file mode 100644 index 0000000000..a9b8dc6a75 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + private boolean isLookingForHome; + private boolean areAdditionalTasksSet; + private InventoryBasic villagerInventory; ++ @Deprecated //Use VillagerRegistry + private static final EntityVillager.ITradeList[][][][] DEFAULT_TRADE_LIST_MAP = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.wheat, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.potato, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.carrot, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.bread, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.pumpkin_pie, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.apple, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.cookie, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.cake, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.fish, new EntityVillager.PriceInfo(6, 6), Items.cooked_fish, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.fishing_rod, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.shears, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 0), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.arrow, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.bow, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new EntityVillager.PriceInfo(10, 10), Items.flint, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.paper, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.book, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.compass, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.written_book, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.clock, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.name_tag, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.rotten_flesh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.gold_ingot, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.redstone, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.ender_eye, new EntityVillager.PriceInfo(7, 11)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.experience_bottle, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_helmet, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.iron_chestplate, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_chestplate, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.chainmail_boots, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_leggings, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.chainmail_helmet, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_chestplate, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_axe, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_sword, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_sword, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_axe, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_shovel, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_pickaxe, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.porkchop, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.chicken, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.cooked_porkchop, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.cooked_chicken, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.leather, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.leather_leggings, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.leather_chestplate, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.saddle, new EntityVillager.PriceInfo(8, 10))}}}}; + + public EntityVillager(World worldIn) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch.rej b/rejects/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch.rej new file mode 100644 index 0000000000..2984065a90 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch.rej @@ -0,0 +1,256 @@ +++++ REJECTED PATCH 1 + @SuppressWarnings("incomplete-switch") + public abstract class EntityPlayer extends EntityLivingBase + { ++ public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; ++ private java.util.HashMap spawnChunkMap = new java.util.HashMap(); ++ private java.util.HashMap spawnForcedMap = new java.util.HashMap(); ++ public float eyeHeight = this.getDefaultEyeHeight(); ++ + public InventoryPlayer inventory = new InventoryPlayer(this); + private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); + public Container inventoryContainer; +++++ END PATCH +++++ REJECTED PATCH 2 + { + if (this.itemInUse != null) + { +- this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); ++ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, itemInUse, this.itemInUseCount)) ++ this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); + } + + this.clearItemInUse(); +++++ END PATCH +++++ REJECTED PATCH 4 + + if (itemstack == this.itemInUse) + { ++ itemInUseCount = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, itemInUse, itemInUseCount); ++ if (itemInUseCount <= 0) ++ { ++ this.onItemUseFinish(); ++ } ++ else ++ { // Forge Keep unindented to lower patch ++ itemInUse.getItem().onUsingTick(itemInUse, this, itemInUseCount); //Forge Added + if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) + { + this.updateItemUse(itemstack, 5); +++++ END PATCH +++++ REJECTED PATCH 8 + int i = this.itemInUse.stackSize; + ItemStack itemstack = this.itemInUse.onItemUseFinish(this.worldObj, this); + ++ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, itemInUse, itemInUseCount, itemstack); + if (itemstack != this.itemInUse || itemstack != null && itemstack.stackSize != i) + { + this.inventory.mainInventory[this.inventory.currentItem] = itemstack; + +- if (itemstack.stackSize == 0) ++ if (itemstack != null && itemstack.stackSize == 0) + { + this.inventory.mainInventory[this.inventory.currentItem] = null; + } +++++ END PATCH +++++ REJECTED PATCH 9 + this.cameraYaw = 0.0F; + this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); + +- if (this.ridingEntity instanceof EntityPig) ++ if (this.ridingEntity instanceof EntityLivingBase && ((EntityLivingBase)ridingEntity).shouldRiderFaceForward(this)) + { + this.rotationPitch = f1; + this.rotationYaw = f; +- this.renderYawOffset = ((EntityPig)this.ridingEntity).renderYawOffset; ++ this.renderYawOffset = ((EntityLivingBase)this.ridingEntity).renderYawOffset; + } + } + } +++++ END PATCH +++++ REJECTED PATCH 13 + + public void joinEntityItemWithWorld(EntityItem itemIn) + { ++ if (captureDrops) ++ { ++ capturedDrops.add(itemIn); ++ return; ++ } ++ + this.worldObj.spawnEntityInWorld(itemIn); + } + ++ @Deprecated //Use location sensitive version below + public float getToolDigEfficiency(Block p_180471_1_) + { +- float f = this.inventory.getStrVsBlock(p_180471_1_); ++ return getBreakSpeed(p_180471_1_.getDefaultState(), new BlockPos(0, -1, 0)); ++ } + ++ public float getBreakSpeed(IBlockState state, BlockPos pos) ++ { ++ ItemStack stack = inventory.getCurrentItem(); ++ float f = (stack == null ? 1.0F : stack.getItem().getDigSpeed(stack, state)); + if (f > 1.0F) + { + int i = EnchantmentHelper.getEfficiencyModifier(this); +++++ END PATCH +++++ REJECTED PATCH 14 + f /= 5.0F; + } + +- return f; ++ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos); ++ return (f < 0 ? 0 : f); + } + + public boolean canHarvestBlock(Block blockToHarvest) + { +- return this.inventory.canHeldItemHarvest(blockToHarvest); ++ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, blockToHarvest, this.inventory.canHeldItemHarvest(blockToHarvest)); + } + + public void readEntityFromNBT(NBTTagCompound tagCompund) +++++ END PATCH +++++ REJECTED PATCH 18 + { + if (!this.isEntityInvulnerable(damageSrc)) + { ++ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); ++ if (damageAmount <= 0) return; + if (!damageSrc.isUnblockable() && this.isBlocking() && damageAmount > 0.0F) + { + damageAmount = (1.0F + damageAmount) * 0.5F; + } + +- damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); ++ damageAmount = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, inventory.armorInventory, damageSrc, damageAmount); ++ if (damageAmount <= 0) return; + damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); + float f = damageAmount; + damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); +++++ END PATCH +++++ REJECTED PATCH 19 + } + else + { ++ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, targetEntity)) return false; + ItemStack itemstack = this.getCurrentEquippedItem(); + ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null; + +++++ END PATCH +++++ REJECTED PATCH 20 + + public void destroyCurrentEquippedItem() + { ++ ItemStack orig = getCurrentEquippedItem(); + this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, orig); + } + + public double getYOffset() +++++ END PATCH +++++ REJECTED PATCH 23 + + this.setSize(0.2F, 0.2F); + +- if (this.worldObj.isBlockLoaded(bedLocation)) ++ if (this.worldObj.isBlockLoaded(bedLocation) && worldObj.getBlockState(bedLocation).getBlock().isBed(worldObj, bedLocation, this)) + { +- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(bedLocation).getValue(BlockDirectional.FACING); ++ EnumFacing enumfacing = this.worldObj.getBlockState(bedLocation).getBlock().getBedDirection(worldObj, bedLocation); + float f = 0.5F; + float f1 = 0.5F; + +++++ END PATCH +++++ REJECTED PATCH 27 + } + else + { +- return BlockBed.getSafeExitLocation(worldIn, bedLocation, 0); ++ return worldIn.getBlockState(bedLocation).getBlock().getBedSpawnPosition(worldIn, bedLocation, null); + } + } + + @SideOnly(Side.CLIENT) + public float getBedOrientationInDegrees() + { +- if (this.playerLocation != null) ++ if (this.playerLocation != null && worldObj.getBlockState(playerLocation).getBlock().isBed(worldObj, playerLocation, this)) + { +- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockDirectional.FACING); ++ EnumFacing enumfacing = this.worldObj.getBlockState(this.playerLocation).getBlock().getBedDirection(worldObj, playerLocation); + + switch (enumfacing) + { +++++ END PATCH +++++ REJECTED PATCH 30 + } + + EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entityLivingIn))); ++ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entityLivingIn)); + + if (entitylist$entityegginfo != null) + { +++++ END PATCH +++++ REJECTED PATCH 31 + { + if (stack != this.itemInUse) + { ++ duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, stack, duration); ++ if (duration <= 0) return; + this.itemInUse = stack; + this.itemInUseCount = duration; + +++++ END PATCH +++++ REJECTED PATCH 33 + this.xpSeed = oldPlayer.xpSeed; + this.theInventoryEnderChest = oldPlayer.theInventoryEnderChest; + this.getDataWatcher().updateObject(10, Byte.valueOf(oldPlayer.getDataWatcher().getWatchableObjectByte(10))); ++ ++ this.spawnChunkMap = oldPlayer.spawnChunkMap; ++ this.spawnForcedMap = oldPlayer.spawnForcedMap; ++ ++ //Copy over a section of the Entity Data from the old player. ++ //Allows mods to specify data that persists after players respawn. ++ NBTTagCompound old = oldPlayer.getEntityData(); ++ if (old.hasKey(PERSISTED_NBT_TAG)) ++ { ++ getEntityData().setTag(PERSISTED_NBT_TAG, old.getCompoundTag(PERSISTED_NBT_TAG)); ++ } ++ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, oldPlayer, !respawnFromEnd); + } + + protected boolean canTriggerWalking() +++++ END PATCH +++++ REJECTED PATCH 34 + + public void setCurrentItemOrArmor(int slotIn, ItemStack stack) + { +- this.inventory.armorInventory[slotIn] = stack; ++ if (slotIn == 0) //Forge: Fix issue in Player where it doen't take into account selected item ++ { ++ this.inventory.mainInventory[this.inventory.currentItem] = stack; ++ } ++ else ++ { ++ this.inventory.armorInventory[slotIn - 1] = stack; ++ } + } + + @SideOnly(Side.CLIENT) +++++ END PATCH +++++ REJECTED PATCH 35 + + public IChatComponent getDisplayName() + { +- IChatComponent ichatcomponent = new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName())); ++ IChatComponent ichatcomponent = new ChatComponentText(""); ++ if (!prefixes.isEmpty()) for (net.minecraft.util.IChatComponent prefix : prefixes) ichatcomponent.appendSibling(prefix); ++ ichatcomponent.appendSibling(new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getDisplayNameString()))); ++ if (!suffixes.isEmpty()) for (net.minecraft.util.IChatComponent suffix : suffixes) ichatcomponent.appendSibling(suffix); + ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); + ichatcomponent.getChatStyle().setChatHoverEvent(this.getHoverEvent()); + ichatcomponent.getChatStyle().setInsertion(this.getName()); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej b/rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej new file mode 100644 index 0000000000..eece032322 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej @@ -0,0 +1,55 @@ +++++ REJECTED PATCH 1 + public int ping; + public boolean playerConqueredTheEnd; + ++ @SuppressWarnings("unused") + public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager) + { + super(worldIn, profile); + interactionManager.thisPlayerMP = this; + this.theItemInWorldManager = interactionManager; +- BlockPos blockpos = worldIn.getSpawnPoint(); ++ BlockPos blockpos = worldIn.provider.getRandomizedSpawnPoint(); + +- if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) ++ if (false && !worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) + { + int i = Math.max(5, server.getSpawnProtectionSize() - 6); + int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ())); +++++ END PATCH +++++ REJECTED PATCH 3 + for (Chunk chunk1 : list) + { + this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(chunk1.getChunkCoordIntPair(), this)); + } + } + } +++++ END PATCH +++++ REJECTED PATCH 4 + + public void onDeath(DamageSource cause) + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; + if (this.worldObj.getGameRules().getBoolean("showDeathMessages")) + { + Team team = this.getTeam(); +++++ END PATCH +++++ REJECTED PATCH 6 + if (entitylivingbase != null) + { + EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entitylivingbase))); ++ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entitylivingbase)); + + if (entitylist$entityegginfo != null) + { +++++ END PATCH +++++ REJECTED PATCH 7 + + public void travelToDimension(int dimensionId) + { ++ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, dimensionId)) return; + if (this.dimension == 1 && dimensionId == 1) + { + this.triggerAchievement(AchievementList.theEnd2); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch.rej b/rejects/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch.rej new file mode 100644 index 0000000000..9fcc96b0eb --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch.rej @@ -0,0 +1,16 @@ +++++ REJECTED PATCH 1 + { + if (this.mainInventory[j] == null) + { +- this.mainInventory[j] = new ItemStack(item, 0, itemStackIn.getMetadata()); +- +- if (itemStackIn.hasTagCompound()) +- { +- this.mainInventory[j].setTagCompound((NBTTagCompound)itemStackIn.getTagCompound().copy()); +- } ++ this.mainInventory[j] = itemStackIn.copy(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up. ++ this.mainInventory[j].stackSize = 0; + } + + int k = i; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch.rej b/rejects/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch.rej new file mode 100644 index 0000000000..c55c19e5d6 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch.rej @@ -0,0 +1,21 @@ +++++ REJECTED PATCH 1 + } + } + ++ @SuppressWarnings("unused") + private ItemStack getFishingResult() + { + float f = this.worldObj.rand.nextFloat(); + int i = EnchantmentHelper.getLuckOfSeaModifier(this.angler); + int j = EnchantmentHelper.getLureModifier(this.angler); ++ ++ if (true) ++ { ++ this.angler.addStat(net.minecraftforge.common.FishingHooks.getFishableCategory(f, i, j).stat, 1); ++ return net.minecraftforge.common.FishingHooks.getRandomFishable(this.rand, f, i, j); ++ } ++ + float f1 = 0.1F - (float)i * 0.025F - (float)j * 0.01F; + float f2 = 0.05F + (float)i * 0.01F - (float)j * 0.01F; + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej b/rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej new file mode 100644 index 0000000000..f5b2d3aa16 --- /dev/null +++ b/rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + double d0 = source.getX() + (double)enumfacing.getFrontOffsetX(); + double d1 = (double)((float)source.getBlockPos().getY() + 0.2F); + double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ(); +- Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), stack.getMetadata(), d0, d1, d2); ++ Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), ItemMonsterPlacer.getEntityName(stack), d0, d1, d2); + + if (entity instanceof EntityLivingBase && stack.hasDisplayName()) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch.rej b/rejects/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch.rej new file mode 100644 index 0000000000..663f1630b4 --- /dev/null +++ b/rejects/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch.rej @@ -0,0 +1,30 @@ +++++ REJECTED PATCH 1 + + public boolean isItemValid(ItemStack stack) + { +- return stack != null ? stack.getItem().isPotionIngredient(stack) : false; ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack); + } + + public int getSlotStackLimit() +++++ END PATCH +++++ REJECTED PATCH 2 + + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + { +- if (stack.getItem() == Items.potionitem && stack.getMetadata() > 0) ++ if (stack.getItem() instanceof net.minecraft.item.ItemPotion && stack.getMetadata() > 0) + { + this.player.triggerAchievement(AchievementList.potion); + } +++++ END PATCH +++++ REJECTED PATCH 3 + + public static boolean canHoldPotion(ItemStack stack) + { +- return stack != null && (stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle); ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack); + } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch.rej b/rejects/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch.rej new file mode 100644 index 0000000000..35057e9a1a --- /dev/null +++ b/rejects/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 4 + + for (int i1 = 0; i1 < 3; ++i1) + { +- this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, l, itemstack); ++ this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, (int)power, itemstack); + this.field_178151_h[i1] = -1; + + if (this.enchantLevels[i1] < i1 + 1) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej b/rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej new file mode 100644 index 0000000000..9b89b48f7a --- /dev/null +++ b/rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej @@ -0,0 +1,11 @@ +++++ REJECTED PATCH 1 + } + public boolean isItemValid(ItemStack stack) + { +- return stack == null ? false : (stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType == k_f : (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull ? false : k_f == 0)); ++ if (stack == null) return false; ++ return stack.getItem().isValidArmor(stack, k_f, thePlayer); + } + @SideOnly(Side.CLIENT) + public String getSlotTexture() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej b/rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej new file mode 100644 index 0000000000..323e886d4f --- /dev/null +++ b/rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej @@ -0,0 +1,20 @@ +++++ REJECTED PATCH 3 + + if (itemstack2 != null) + { ++ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, i2)) return; + flag = itemstack2.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(itemstack2).tagCount() > 0; + + if (itemstack1.isItemStackDamageable() && itemstack1.getItem().getIsRepairable(itemstack, itemstack2)) +++++ END PATCH +++++ REJECTED PATCH 4 + { + int i4 = ((Integer)iterator.next()).intValue(); + +- if (i4 != i5 && !enchantment.canApplyTogether(Enchantment.getEnchantmentById(i4))) ++ Enchantment e2 = Enchantment.getEnchantmentById(i4); ++ if (i4 != i5 && !(enchantment.canApplyTogether(e2) && e2.canApplyTogether(enchantment))) //Forge BugFix: Let Both enchantments veto being together + { + flag1 = false; + ++l1; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/Item.java.patch.rej b/rejects/minecraft/net/minecraft/item/Item.java.patch.rej new file mode 100644 index 0000000000..138fb95f06 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/Item.java.patch.rej @@ -0,0 +1,735 @@ +++++ REJECTED PATCH 1 + + public class Item + { +- public static final RegistryNamespaced itemRegistry = new RegistryNamespaced(); +- private static final Map BLOCK_TO_ITEM = Maps.newHashMap(); ++ public static final RegistryNamespaced itemRegistry = net.minecraftforge.fml.common.registry.GameData.getItemRegistry(); ++ private static final Map BLOCK_TO_ITEM = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap(); + protected static final UUID itemModifierUUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + private CreativeTabs tabToDisplayOn; + protected static Random itemRand = new Random(); +++++ END PATCH +++++ REJECTED PATCH 6 + float f6 = f3 * f4; + float f7 = f2 * f4; + double d3 = 5.0D; ++ if (playerIn instanceof net.minecraft.entity.player.EntityPlayerMP) ++ { ++ d3 = ((net.minecraft.entity.player.EntityPlayerMP)playerIn).theItemInWorldManager.getBlockReachDistance(); ++ } + Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); + return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); + } +++++ END PATCH +++++ REJECTED PATCH 7 + return false; + } + ++ @Deprecated // Use ItemStack sensitive version below. + public Multimap getItemAttributeModifiers() + { + return HashMultimap.create(); + } + ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * ItemStack sensitive version of getItemAttributeModifiers ++ */ ++ public Multimap getAttributeModifiers(ItemStack stack) ++ { ++ return this.getItemAttributeModifiers(); ++ } ++ ++ /** ++ * Called when a player drops the item into the world, ++ * returning false from this will prevent the item from ++ * being removed from the players inventory and spawning ++ * in the world ++ * ++ * @param player The player that dropped the item ++ * @param item The item stack, before the item is removed. ++ */ ++ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) ++ { ++ return true; ++ } ++ ++ /** ++ * Allow the item one last chance to modify its name used for the ++ * tool highlight useful for adding something extra that can't be removed ++ * by a user in the displayed name, such as a mode of operation. ++ * ++ * @param item the ItemStack for the item. ++ * @param the name that will be displayed unless it is changed in this method. ++ */ ++ public String getHighlightTip( ItemStack item, String displayName ) ++ { ++ return displayName; ++ } ++ ++ /** ++ * This is called when the item is used, before the block is activated. ++ * @param stack The Item Stack ++ * @param player The Player that used the item ++ * @param world The Current World ++ * @param pos Target position ++ * @param side The side of the target hit ++ * @return Return true to prevent any further processing. ++ */ ++ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) ++ { ++ return false; ++ } ++ ++ /** ++ * Metadata-sensitive version of getStrVsBlock ++ * @param itemstack The Item Stack ++ * @param state The block state ++ * @return The damage strength ++ */ ++ public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state) ++ { ++ return getStrVsBlock(itemstack, state.getBlock()); ++ } ++ ++ ++ protected boolean canRepair = true; ++ /** ++ * Called by CraftingManager to determine if an item is reparable. ++ * @return True if reparable ++ */ ++ public boolean isRepairable() ++ { ++ return canRepair && isDamageable(); ++ } ++ ++ /** ++ * Call to disable repair recipes. ++ * @return The current Item instance ++ */ ++ public Item setNoRepair() ++ { ++ canRepair = false; ++ return this; ++ } ++ ++ /** ++ * Called before a block is broken. Return true to prevent default block harvesting. ++ * ++ * Note: In SMP, this is called on both client and server sides! ++ * ++ * @param itemstack The current ItemStack ++ * @param pos Block's position in world ++ * @param player The Player that is wielding the item ++ * @return True to prevent harvesting, false to continue as normal ++ */ ++ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) ++ { ++ return false; ++ } ++ ++ /** ++ * Called each tick while using an item. ++ * @param stack The Item being used ++ * @param player The Player using the item ++ * @param count The amount of time in tick the item has been used for continuously ++ */ ++ public void onUsingTick(ItemStack stack, EntityPlayer player, int count) ++ { ++ } ++ ++ /** ++ * Called when the player Left Clicks (attacks) an entity. ++ * Processed before damage is done, if return value is true further processing is canceled ++ * and the entity is not attacked. ++ * ++ * @param stack The Item being used ++ * @param player The player that is attacking ++ * @param entity The entity being attacked ++ * @return True to cancel the rest of the interaction. ++ */ ++ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) ++ { ++ return false; ++ } ++ ++ /** ++ * Player, Render pass, and item usage sensitive version of getIconIndex. ++ * ++ * @param stack The item stack to get the icon for. ++ * @param player The player holding the item ++ * @param useRemaining The ticks remaining for the active item. ++ * @return Null to use default model, or a custom ModelResourceLocation for the stage of use. ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.resources.model.ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) ++ { ++ return null; ++ } ++ ++ /** ++ * ItemStack sensitive version of getContainerItem. ++ * Returns a full ItemStack instance of the result. ++ * ++ * @param itemStack The current ItemStack ++ * @return The resulting ItemStack ++ */ ++ public ItemStack getContainerItem(ItemStack itemStack) ++ { ++ if (!hasContainerItem(itemStack)) ++ { ++ return null; ++ } ++ return new ItemStack(getContainerItem()); ++ } ++ ++ /** ++ * ItemStack sensitive version of hasContainerItem ++ * @param stack The current item stack ++ * @return True if this item has a 'container' ++ */ ++ public boolean hasContainerItem(ItemStack stack) ++ { ++ return hasContainerItem(); ++ } ++ ++ /** ++ * Retrieves the normal 'lifespan' of this item when it is dropped on the ground as a EntityItem. ++ * This is in ticks, standard result is 6000, or 5 mins. ++ * ++ * @param itemStack The current ItemStack ++ * @param world The world the entity is in ++ * @return The normal lifespan in ticks. ++ */ ++ public int getEntityLifespan(ItemStack itemStack, World world) ++ { ++ return 6000; ++ } ++ ++ /** ++ * Determines if this Item has a special entity for when they are in the world. ++ * Is called when a EntityItem is spawned in the world, if true and Item#createCustomEntity ++ * returns non null, the EntityItem will be destroyed and the new Entity will be added to the world. ++ * ++ * @param stack The current item stack ++ * @return True of the item has a custom entity, If true, Item#createCustomEntity will be called ++ */ ++ public boolean hasCustomEntity(ItemStack stack) ++ { ++ return false; ++ } ++ ++ /** ++ * This function should return a new entity to replace the dropped item. ++ * Returning null here will not kill the EntityItem and will leave it to function normally. ++ * Called when the item it placed in a world. ++ * ++ * @param world The world object ++ * @param location The EntityItem object, useful for getting the position of the entity ++ * @param itemstack The current item stack ++ * @return A new Entity object to spawn or null ++ */ ++ public Entity createEntity(World world, Entity location, ItemStack itemstack) ++ { ++ return null; ++ } ++ ++ /** ++ * Called by the default implemetation of EntityItem's onUpdate method, allowing for cleaner ++ * control over the update of the item without having to write a subclass. ++ * ++ * @param entityItem The entity Item ++ * @return Return true to skip any further update code. ++ */ ++ public boolean onEntityItemUpdate(net.minecraft.entity.item.EntityItem entityItem) ++ { ++ return false; ++ } ++ ++ /** ++ * Gets a list of tabs that items belonging to this class can display on, ++ * combined properly with getSubItems allows for a single item to span ++ * many sub-items across many tabs. ++ * ++ * @return A list of all tabs that this item could possibly be one. ++ */ ++ public CreativeTabs[] getCreativeTabs() ++ { ++ return new CreativeTabs[]{ getCreativeTab() }; ++ } ++ ++ /** ++ * Determines the base experience for a player when they remove this item from a furnace slot. ++ * This number must be between 0 and 1 for it to be valid. ++ * This number will be multiplied by the stack size to get the total experience. ++ * ++ * @param item The item stack the player is picking up. ++ * @return The amount to award for each item. ++ */ ++ public float getSmeltingExperience(ItemStack item) ++ { ++ return -1; //-1 will default to the old lookups. ++ } ++ ++ /** ++ * Return the correct icon for rendering based on the supplied ItemStack and render pass. ++ * ++ * Defers to {@link #getIconFromDamageForRenderPass(int, int)} ++ * @param stack to render for ++ * @param pass the multi-render pass ++ * @return the icon ++ * / ++ public IIcon getIcon(ItemStack stack, int pass) ++ { ++ return func_77618_c(stack.getMetadata(), pass); ++ } ++ */ ++ ++ /** ++ * Generates the base Random item for a specific instance of the chest gen, ++ * Enchanted books use this to pick a random enchantment. ++ * ++ * @param chest The chest category to generate for ++ * @param rnd World RNG ++ * @param original Original result registered with the chest gen hooks. ++ * @return New values to use as the random item, typically this will be original ++ */ ++ public net.minecraft.util.WeightedRandomChestContent getChestGenBase(net.minecraftforge.common.ChestGenHooks chest, Random rnd, net.minecraft.util.WeightedRandomChestContent original) ++ { ++ if (this instanceof ItemEnchantedBook) ++ { ++ return ((ItemEnchantedBook)this).getRandom(rnd, ++ original.minStackSize, ++ original.maxStackSize, original.itemWeight); ++ } ++ return original; ++ } ++ ++ /** ++ * ++ * Should this item, when held, allow sneak-clicks to pass through to the underlying block? ++ * ++ * @param world The world ++ * @param pos Block position in world ++ * @param player The Player that is wielding the item ++ * @return ++ */ ++ public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player) ++ { ++ return false; ++ } ++ ++ /** ++ * Called to tick armor in the armor slot. Override to do something ++ */ ++ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack){} ++ ++ /** ++ * Determines if the specific ItemStack can be placed in the specified armor slot. ++ * ++ * @param stack The ItemStack ++ * @param armorType Armor slot ID: 0: Helmet, 1: Chest, 2: Legs, 3: Boots ++ * @param entity The entity trying to equip the armor ++ * @return True if the given ItemStack can be inserted in the slot ++ */ ++ public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) ++ { ++ if (this instanceof ItemArmor) ++ { ++ return ((ItemArmor)this).armorType == armorType; ++ } ++ ++ if (armorType == 0) ++ { ++ return this == Item.getItemFromBlock(Blocks.pumpkin) || this == Items.skull; ++ } ++ ++ return false; ++ } ++ ++ /** ++ * Allow or forbid the specific book/item combination as an anvil enchant ++ * ++ * @param stack The item ++ * @param book The book ++ * @return if the enchantment is allowed ++ */ ++ public boolean isBookEnchantable(ItemStack stack, ItemStack book) ++ { ++ return true; ++ } ++ ++ /** ++ * Called by RenderBiped and RenderPlayer to determine the armor texture that ++ * should be use for the currently equipped item. ++ * This will only be called on instances of ItemArmor. ++ * ++ * Returning null from this function will use the default value. ++ * ++ * @param stack ItemStack for the equipped armor ++ * @param entity The entity wearing the armor ++ * @param slot The slot the armor is in ++ * @param type The subtype, can be null or "overlay" ++ * @return Path of texture to bind, or null to use default ++ */ ++ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) ++ { ++ return null; ++ } ++ ++ /** ++ * Returns the font renderer used to render tooltips and overlays for this item. ++ * Returning null will use the standard font renderer. ++ * ++ * @param stack The current item stack ++ * @return A instance of FontRenderer or null to use default ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack) ++ { ++ return null; ++ } ++ ++ /** ++ * @deprecated Use 4-argument version. ++ */ ++ // remove 1.9 ++ @SideOnly(Side.CLIENT) ++ @Deprecated ++ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) ++ { ++ return null; ++ } ++ ++ /** ++ * Override this method to have an item handle its own armor rendering. ++ * ++ * @param entityLiving The entity wearing the armor ++ * @param itemStack The itemStack to render the model of ++ * @param armorSlot 0=head, 1=torso, 2=legs, 3=feet ++ * @param _default Original armor model. Will have attributes set. ++ * @return A ModelBiped to render instead of the default ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot, net.minecraft.client.model.ModelBiped _default) ++ { ++ return getArmorModel(entityLiving, itemStack, armorSlot); ++ } ++ ++ /** ++ * Called when a entity tries to play the 'swing' animation. ++ * ++ * @param entityLiving The entity swinging the item. ++ * @param stack The Item stack ++ * @return True to cancel any further processing by EntityLiving ++ */ ++ public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) ++ { ++ return false; ++ } ++ ++ /** ++ * Called when the client starts rendering the HUD, for whatever item the player currently has as a helmet. ++ * This is where pumpkins would render there overlay. ++ * ++ * @param stack The ItemStack that is equipped ++ * @param player Reference to the current client entity ++ * @param resolution Resolution information about the current viewport and configured GUI Scale ++ * @param partialTicks Partial ticks for the renderer, useful for interpolation ++ */ ++ @SideOnly(Side.CLIENT) ++ public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, net.minecraft.client.gui.ScaledResolution resolution, float partialTicks){} ++ ++ /** ++ * Return the itemDamage represented by this ItemStack. Defaults to the itemDamage field on ItemStack, but can be overridden here for other sources such as NBT. ++ * ++ * @param stack The itemstack that is damaged ++ * @return the damage value ++ */ ++ public int getDamage(ItemStack stack) ++ { ++ return stack.itemDamage; ++ } ++ ++ /** ++ * This used to be 'display damage' but its really just 'aux' data in the ItemStack, usually shares the same variable as damage. ++ * @param stack ++ * @return ++ */ ++ public int getMetadata(ItemStack stack) ++ { ++ return stack.itemDamage; ++ } ++ ++ /** ++ * Determines if the durability bar should be rendered for this item. ++ * Defaults to vanilla stack.isDamaged behavior. ++ * But modders can use this for any data they wish. ++ * ++ * @param stack The current Item Stack ++ * @return True if it should render the 'durability' bar. ++ */ ++ public boolean showDurabilityBar(ItemStack stack) ++ { ++ return stack.isItemDamaged(); ++ } ++ ++ /** ++ * Queries the percentage of the 'Durability' bar that should be drawn. ++ * ++ * @param stack The current ItemStack ++ * @return 1.0 for 100% 0 for 0% ++ */ ++ public double getDurabilityForDisplay(ItemStack stack) ++ { ++ return (double)stack.getItemDamage() / (double)stack.getMaxDamage(); ++ } ++ ++ /** ++ * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item, ++ * but can be overridden here for other sources such as NBT. ++ * ++ * @param stack The itemstack that is damaged ++ * @return the damage value ++ */ ++ public int getMaxDamage(ItemStack stack) ++ { ++ return getMaxDamage(); ++ } ++ ++ /** ++ * Return if this itemstack is damaged. Note only called if {@link #isDamageable()} is true. ++ * @param stack the stack ++ * @return if the stack is damaged ++ */ ++ public boolean isDamaged(ItemStack stack) ++ { ++ return stack.itemDamage > 0; ++ } ++ ++ /** ++ * Set the damage for this itemstack. Note, this method is responsible for zero checking. ++ * @param stack the stack ++ * @param damage the new damage value ++ */ ++ public void setDamage(ItemStack stack, int damage) ++ { ++ stack.itemDamage = damage; ++ ++ if (stack.itemDamage < 0) ++ { ++ stack.itemDamage = 0; ++ } ++ } ++ ++ /** ++ * ItemStack sensitive version of {@link #canHarvestBlock(Block)} ++ * @param par1Block The block trying to harvest ++ * @param itemStack The itemstack used to harvest the block ++ * @return true if can harvest the block ++ */ ++ public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) ++ { ++ return canHarvestBlock(par1Block); ++ } ++ ++ /** ++ * Gets the maximum number of items that this stack should be able to hold. ++ * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit() ++ * ++ * @param stack The ItemStack ++ * @return THe maximum number this item can be stacked to ++ */ ++ public int getItemStackLimit(ItemStack stack) ++ { ++ return this.getItemStackLimit(); ++ } ++ ++ private java.util.Map toolClasses = new java.util.HashMap(); ++ /** ++ * Sets or removes the harvest level for the specified tool class. ++ * ++ * @param toolClass Class ++ * @param level Harvest level: ++ * Wood: 0 ++ * Stone: 1 ++ * Iron: 2 ++ * Diamond: 3 ++ * Gold: 0 ++ */ ++ public void setHarvestLevel(String toolClass, int level) ++ { ++ if (level < 0) ++ toolClasses.remove(toolClass); ++ else ++ toolClasses.put(toolClass, level); ++ } ++ ++ public java.util.Set getToolClasses(ItemStack stack) ++ { ++ return toolClasses.keySet(); ++ } ++ ++ /** ++ * Queries the harvest level of this item stack for the specifred tool class, ++ * Returns -1 if this tool is not of the specified type ++ * ++ * @param stack This item stack instance ++ * @param toolClass Tool Class ++ * @return Harvest level, or -1 if not the specified tool type. ++ */ ++ public int getHarvestLevel(ItemStack stack, String toolClass) ++ { ++ Integer ret = toolClasses.get(toolClass); ++ return ret == null ? -1 : ret; ++ } ++ ++ /** ++ * ItemStack sensitive version of getItemEnchantability ++ * ++ * @param stack The ItemStack ++ * @return the item echantability value ++ */ ++ public int getItemEnchantability(ItemStack stack) ++ { ++ return getItemEnchantability(); ++ } ++ ++ /** ++ * Whether this Item can be used as a payment to activate the vanilla beacon. ++ * @param stack the ItemStack ++ * @return true if this Item can be used ++ */ ++ public boolean isBeaconPayment(ItemStack stack) ++ { ++ return this == Items.emerald || this == Items.diamond || this == Items.gold_ingot || this == Items.iron_ingot; ++ } ++ ++ ++ /** ++ * Determine if the player switching between these two item stacks ++ * @param oldStack The old stack that was equipped ++ * @param newStack The new stack ++ * @param slotChanged If the current equipped slot was changed, ++ * Vanilla does not play the animation if you switch between two ++ * slots that hold the exact same item. ++ * @return True to play the item change animation ++ */ ++ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) ++ { ++ return !ItemStack.areItemStacksEqual(oldStack, newStack); ++ } ++ ++ ++ private ResourceLocation registryName = null; ++ /** ++ * Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item. ++ * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. ++ * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. ++ * ++ * The supplied name will be prefixed with the currently active mod's modId. ++ * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. ++ * ++ * If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown. ++ * ++ * Returns 'this' to allow for chaining. ++ * ++ * @param name Unique registry name ++ * @return This instance ++ */ ++ public final Item setRegistryName(String name) ++ { ++ if (getRegistryName() != null) ++ throw new IllegalStateException("Attempted to set registry name on block with exisiting registry name! New: " + name + " Old: " + getRegistryName()); ++ int index = name.lastIndexOf(':'); ++ String oldPrefix = index == -1 ? "" : name.substring(0, index); ++ name = index == -1 ? name : name.substring(index + 1); ++ net.minecraftforge.fml.common.ModContainer mc = net.minecraftforge.fml.common.Loader.instance().activeModContainer(); ++ String prefix = mc == null ? "minecraft" : mc.getModId(); ++ if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) ++ { ++ net.minecraftforge.fml.common.FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name); ++ prefix = oldPrefix; ++ } ++ this.registryName = new ResourceLocation(prefix, name); ++ return this; ++ } ++ public final Item setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); } ++ public final Item setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); } ++ ++ /** ++ * A unique identifier for this block, if this block is registered in the game registry it will return that name. ++ * Otherwise it will return the name set in setRegistryName(). ++ * If neither are valid null is returned. ++ * ++ * @return Unique identifier or null. ++ */ ++ public final String getRegistryName() ++ { ++ if (delegate.getResourceName() != null) return delegate.getResourceName().toString(); ++ return registryName != null ? registryName.toString() : null; ++ } ++ ++ /** ++ * Called from ItemStack.setItem, will hold extra data for the life of this ItemStack. ++ * Can be retrieved from stack.getCapabilities() ++ * The NBT can be null if this is not called from readNBT or if the item the stack is ++ * changing FROM is different then this item, or the previous item had no capabilities. ++ * ++ * This is called BEFORE the stacks item is set so you can use stack.getItem() to see the OLD item. ++ * Remember that getItem CAN return null. ++ * ++ * @param stack The ItemStack ++ * @param nbt NBT of this item serialized, or null. ++ * @return A holder instance associated with this ItemStack where you can hold capabilities for the life of this item. ++ */ ++ public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) ++ { ++ return null; ++ } ++ /* ======================================== FORGE END =====================================*/ ++ + public static void registerItems() + { + registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() +++++ END PATCH +++++ REJECTED PATCH 9 + return this.enchantability; + } + ++ @Deprecated // Use getRepairItemStack below + public Item getRepairItem() + { +- return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null)))); ++ switch (this) ++ { ++ case WOOD: return Item.getItemFromBlock(Blocks.planks); ++ case STONE: return Item.getItemFromBlock(Blocks.cobblestone); ++ case GOLD: return Items.gold_ingot; ++ case IRON: return Items.iron_ingot; ++ case EMERALD: return Items.diamond; ++ default: return customCraftingMaterial; ++ } + } ++ ++ public ToolMaterial setRepairItem(ItemStack stack) ++ { ++ if (this.repairMaterial != null || customCraftingMaterial != null) throw new RuntimeException("Can not change already set repair material"); ++ if (this == WOOD || this == STONE || this == GOLD || this == IRON || this == EMERALD) throw new RuntimeException("Can not change vanilla tool repair materials"); ++ this.repairMaterial = stack; ++ this.customCraftingMaterial = stack.getItem(); ++ return this; ++ } ++ ++ public ItemStack getRepairItemStack() ++ { ++ if (repairMaterial != null) return repairMaterial; ++ Item ret = this.getRepairItem(); ++ if (ret == null) return null; ++ repairMaterial = new ItemStack(ret, 1, net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE); ++ return repairMaterial; ++ } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemArmor.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemArmor.java.patch.rej new file mode 100644 index 0000000000..673c164bcd --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemArmor.java.patch.rej @@ -0,0 +1,31 @@ +++++ REJECTED PATCH 1 + if (list.size() > 0) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0); +- int l = entitylivingbase instanceof EntityPlayer ? 1 : 0; ++ int l = 0;// Forge: We fix the indexes. Mojang Stop hard coding this! + int i1 = EntityLiving.getArmorPosition(stack); + ItemStack itemstack = stack.copy(); + itemstack.stackSize = 1; +++++ END PATCH +++++ REJECTED PATCH 2 + + if (itemstack == null) + { +- playerIn.setCurrentItemOrArmor(i, itemStackIn.copy()); ++ playerIn.setCurrentItemOrArmor(i + 1, itemStackIn.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. + itemStackIn.stackSize = 0; + } + +++++ END PATCH +++++ REJECTED PATCH 3 + private final int[] damageReductionAmountArray; + private final int enchantability; + ++ //Added by forge for custom Armor materials. ++ public Item customCraftingMaterial = null; ++ + private ArmorMaterial(String name, int maxDamage, int[] reductionAmounts, int enchantability) + { + this.name = name; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej new file mode 100644 index 0000000000..76da5c69d8 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 1 + int i = this.getMetadata(stack.getMetadata()); + IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn); + +- if (worldIn.setBlockState(pos, iblockstate1, 3)) ++ if (placeBlockAt(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ, iblockstate1)) + { +- iblockstate1 = worldIn.getBlockState(pos); +- +- if (iblockstate1.getBlock() == this.block) +- { +- setTileEntityNBT(worldIn, playerIn, pos, stack); +- this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); +- } +- + worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F); + --stack.stackSize; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej new file mode 100644 index 0000000000..14823bc8a5 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej @@ -0,0 +1,22 @@ +++++ REJECTED PATCH 1 + if (flag || playerIn.inventory.hasItem(Items.arrow)) + { + int i = this.getMaxItemUseDuration(stack) - timeLeft; ++ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, stack, i); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; ++ i = event.charge; + float f = (float)i / 20.0F; + f = (f * f + f * 2.0F) / 3.0F; + +++++ END PATCH +++++ REJECTED PATCH 2 + + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { ++ net.minecraftforge.event.entity.player.ArrowNockEvent event = new net.minecraftforge.event.entity.player.ArrowNockEvent(playerIn, itemStackIn); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return event.result; ++ + if (playerIn.capabilities.isCreativeMode || playerIn.inventory.hasItem(Items.arrow)) + { + playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemBucket.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemBucket.java.patch.rej new file mode 100644 index 0000000000..57675df4f0 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemBucket.java.patch.rej @@ -0,0 +1,11 @@ +++++ REJECTED PATCH 1 + } + else + { ++ ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(playerIn, worldIn, itemStackIn, movingobjectposition); ++ if (ret != null) return ret; ++ + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = movingobjectposition.getBlockPos(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemDye.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemDye.java.patch.rej new file mode 100644 index 0000000000..9932bf9705 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemDye.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 3 + + Block block = worldIn.getBlockState(pos).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (block.isAir(worldIn, pos)) + { + block.setBlockBoundsBasedOnState(worldIn, pos); + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemEmptyMap.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemEmptyMap.java.patch.rej new file mode 100644 index 0000000000..350f0c56c8 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemEmptyMap.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + worldIn.setItemData(s, mapdata); + mapdata.scale = 0; + mapdata.calculateMapCenter(playerIn.posX, playerIn.posZ, mapdata.scale); +- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); ++ mapdata.dimension = worldIn.provider.getDimensionId(); + mapdata.markDirty(); + --itemStackIn.stackSize; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch.rej new file mode 100644 index 0000000000..dbdf005803 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + } + else + { +- if (worldIn.getBlockState(pos).getBlock().getMaterial() == Material.air) ++ if (worldIn.isAirBlock(pos)) + { + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); + worldIn.setBlockState(pos, Blocks.fire.getDefaultState()); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemHoe.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemHoe.java.patch.rej new file mode 100644 index 0000000000..dc31908b5b --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemHoe.java.patch.rej @@ -0,0 +1,16 @@ +++++ REJECTED PATCH 1 + } + else + { ++ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, playerIn, worldIn, pos); ++ if (hook != 0) return hook > 0; ++ + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + +- if (side != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).getBlock().getMaterial() == Material.air) ++ if (side != EnumFacing.DOWN && worldIn.isAirBlock(pos.up())) + { + if (block == Blocks.grass) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemLilyPad.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemLilyPad.java.patch.rej new file mode 100644 index 0000000000..33da610fd2 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemLilyPad.java.patch.rej @@ -0,0 +1,16 @@ +++++ REJECTED PATCH 1 + + if (iblockstate.getBlock().getMaterial() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) + { ++ // special case for handling block placement with water lilies ++ net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(worldIn, blockpos1); + worldIn.setBlockState(blockpos1, Blocks.waterlily.getDefaultState()); ++ if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(playerIn, blocksnapshot, net.minecraft.util.EnumFacing.UP).isCanceled()) ++ { ++ blocksnapshot.restore(true, false); ++ return itemStackIn; ++ } + + if (!playerIn.capabilities.isCreativeMode) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemMap.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemMap.java.patch.rej new file mode 100644 index 0000000000..38ab28060a --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemMap.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + mapdata = new MapData(s); + mapdata.scale = 3; + mapdata.calculateMapCenter((double)worldIn.getWorldInfo().getSpawnX(), (double)worldIn.getWorldInfo().getSpawnZ(), mapdata.scale); +- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); ++ mapdata.dimension = worldIn.provider.getDimensionId(); + mapdata.markDirty(); + worldIn.setItemData(s, mapdata); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej new file mode 100644 index 0000000000..cf591e4eb8 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej @@ -0,0 +1,88 @@ +++++ REJECTED PATCH 1 + public String getItemStackDisplayName(ItemStack stack) + { + String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); +- String s1 = EntityList.getStringFromID(stack.getMetadata()); ++ String s1 = ItemMonsterPlacer.getEntityName(stack); + + if (s1 != null) + { +++++ END PATCH +++++ REJECTED PATCH 2 + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int renderPass) + { +- EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(stack.getMetadata())); ++ EntityList.EntityEggInfo entitylist$entityegginfo = ItemMonsterPlacer.getEggInfo(stack); + return entitylist$entityegginfo != null ? (renderPass == 0 ? entitylist$entityegginfo.primaryColor : entitylist$entityegginfo.secondaryColor) : 16777215; + } + +++++ END PATCH +++++ REJECTED PATCH 3 + if (tileentity instanceof TileEntityMobSpawner) + { + MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic(); +- mobspawnerbaselogic.setEntityName(EntityList.getStringFromID(stack.getMetadata())); ++ mobspawnerbaselogic.setEntityName(ItemMonsterPlacer.getEntityName(stack)); + tileentity.markDirty(); + worldIn.markBlockForUpdate(pos); + +++++ END PATCH +++++ REJECTED PATCH 4 + pos = pos.offset(side); + double d0 = 0.0D; + +- if (side == EnumFacing.UP && iblockstate instanceof BlockFence) ++ if (side == EnumFacing.UP && iblockstate.getBlock() instanceof BlockFence) //Forge: Fix Vanilla bug comparing state instead of block + { + d0 = 0.5D; + } + +- Entity entity = spawnCreature(worldIn, stack.getMetadata(), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); ++ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(stack), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); + + if (entity != null) + { +++++ END PATCH +++++ REJECTED PATCH 5 + + if (worldIn.getBlockState(blockpos).getBlock() instanceof BlockLiquid) + { +- Entity entity = spawnCreature(worldIn, itemStackIn.getMetadata(), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); ++ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(itemStackIn), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); + + if (entity != null) + { +++++ END PATCH +++++ REJECTED PATCH 6 + } + } + ++ @Deprecated // Use string version below. + public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z) + { + if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID))) + { + return null; + } ++ return spawnCreature(worldIn, EntityList.getStringFromID(entityID), x, y, z); ++ } ++ ++ public static Entity spawnCreature(World worldIn, String name, double x, double y, double z) ++ { ++ if (!EntityList.stringToClassMapping.containsKey(name)) ++ { ++ return null; ++ } + else + { + Entity entity = null; + + for (int i = 0; i < 1; ++i) + { +- entity = EntityList.createEntityByID(entityID, worldIn); ++ entity = EntityList.createEntityByName(name, worldIn); + + if (entity instanceof EntityLivingBase) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemSeedFood.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemSeedFood.java.patch.rej new file mode 100644 index 0000000000..7002a40326 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemSeedFood.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + { + return false; + } +- else if (worldIn.getBlockState(pos).getBlock() == this.soilId && worldIn.isAirBlock(pos.up())) ++ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) + { + worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); + --stack.stackSize; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemSeeds.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemSeeds.java.patch.rej new file mode 100644 index 0000000000..3476adb20e --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemSeeds.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + { + return false; + } +- else if (worldIn.getBlockState(pos).getBlock() == this.soilBlockID && worldIn.isAirBlock(pos.up())) ++ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) + { + worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); + --stack.stackSize; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemShears.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemShears.java.patch.rej new file mode 100644 index 0000000000..6a6935ec60 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemShears.java.patch.rej @@ -0,0 +1,16 @@ +++++ REJECTED PATCH 1 + + public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) + { +- if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool) ++ if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool && !(blockIn instanceof net.minecraftforge.common.IShearable)) + { + return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn); + } + else + { +- stack.damageItem(1, playerIn); + return true; + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemSkull.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemSkull.java.patch.rej new file mode 100644 index 0000000000..c1aa019c08 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemSkull.java.patch.rej @@ -0,0 +1,32 @@ +++++ REJECTED PATCH 1 + + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { ++ if (worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && side != EnumFacing.DOWN) ++ { ++ side = EnumFacing.UP; ++ pos = pos.down(); ++ } + if (side == EnumFacing.DOWN) + { + return false; +++++ END PATCH +++++ REJECTED PATCH 2 + + if (!flag) + { +- if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid()) ++ if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid() && !worldIn.isSideSolid(pos, side, true)) + { + return false; + } +++++ END PATCH +++++ REJECTED PATCH 3 + { + if (!worldIn.isRemote) + { ++ if (!Blocks.skull.canPlaceBlockOnSide(worldIn, pos, side)) return false; + worldIn.setBlockState(pos, Blocks.skull.getDefaultState().withProperty(BlockSkull.FACING, side), 3); + int i = 0; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej new file mode 100644 index 0000000000..3a104b0874 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej @@ -0,0 +1,101 @@ +++++ REJECTED PATCH 4 + + public ItemStack splitStack(int amount) + { +- ItemStack itemstack = new ItemStack(this.item, amount, this.itemDamage); ++ ItemStack itemstack = new ItemStack(this.item, amount, this.itemDamage, this.capabilities != null ? this.capabilities.serializeNBT() : null); + + if (this.stackTagCompound != null) + { +++++ END PATCH +++++ REJECTED PATCH 5 + + public Item getItem() + { +- return this.item; ++ return this.delegate != null ? this.delegate.get() : null; + } + + public boolean onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { ++ if (!worldIn.isRemote) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); + boolean flag = this.getItem().onItemUse(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); + + if (flag) +++++ END PATCH +++++ REJECTED PATCH 6 + nbt.setTag("tag", this.stackTagCompound); + } + ++ if (this.capabilities != null) nbt.setTag("ForgeCaps", this.capabilities.serializeNBT()); ++ + return nbt; + } + + public void readFromNBT(NBTTagCompound nbt) + { ++ this.capNBT = nbt.hasKey("ForgeCaps") ? nbt.getCompoundTag("ForgeCaps") : null; + if (nbt.hasKey("id", 8)) + { +- this.item = Item.getByNameOrId(nbt.getString("id")); ++ this.setItem(Item.getByNameOrId(nbt.getString("id"))); + } + else + { +- this.item = Item.getItemById(nbt.getShort("id")); ++ this.setItem(Item.getItemById(nbt.getShort("id"))); + } ++ this.capNBT = null; + + this.stackSize = nbt.getByte("Count"); + this.itemDamage = nbt.getShort("Damage"); +++++ END PATCH +++++ REJECTED PATCH 9 + + public boolean isItemDamaged() + { +- return this.isItemStackDamageable() && this.itemDamage > 0; ++ return this.isItemStackDamageable() && getItem().isDamaged(this); + } + + public int getItemDamage() + { +- return this.itemDamage; ++ return getItem().getDamage(this); + } + + public int getMetadata() + { +- return this.itemDamage; ++ return getItem().getMetadata(this); + } + + public void setItemDamage(int meta) + { +- this.itemDamage = meta; +- +- if (this.itemDamage < 0) +- { +- this.itemDamage = 0; +- } ++ getItem().setDamage(this, meta); + } + + public int getMaxDamage() + { +- return this.item.getMaxDamage(); ++ return this.item.getMaxDamage(this); + } + + public boolean attemptDamageItem(int amount, Random rand) +++++ END PATCH +++++ REJECTED PATCH 14 + } + else + { +- multimap = this.getItem().getItemAttributeModifiers(); ++ multimap = this.getItem().getAttributeModifiers(this); + } + + return multimap; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch.rej b/rejects/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch.rej new file mode 100644 index 0000000000..6d8531c1bb --- /dev/null +++ b/rejects/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch.rej @@ -0,0 +1,129 @@ +++++ REJECTED PATCH 1 + this.playerEntity.ridingEntity.updateRiderPosition(); + } + ++ if (!this.hasMoved) return; //Fixes teleportation kick while riding entities ++ + this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); + + if (this.playerEntity.ridingEntity != null) +++++ END PATCH +++++ REJECTED PATCH 2 + this.playerEntity.jump(); + } + ++ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving ++ + this.playerEntity.moveEntity(d11, d12, d13); + this.playerEntity.onGround = packetIn.isOnGround(); + d11 = d8 - this.playerEntity.posX; +++++ END PATCH +++++ REJECTED PATCH 3 + logger.warn(this.playerEntity.getName() + " moved wrongly!"); + } + ++ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving ++ + this.playerEntity.setPositionAndRotation(d8, d9, d10, f1, f2); + this.playerEntity.addMovementStat(this.playerEntity.posX - d0, this.playerEntity.posY - d1, this.playerEntity.posZ - d2); + +++++ END PATCH +++++ REJECTED PATCH 4 + { + boolean flag2 = worldserver.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.getEntityBoundingBox().contract((double)f3, (double)f3, (double)f3)).isEmpty(); + +- if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping()) ++ if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping() && !this.playerEntity.noClip) + { + this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, f1, f2); + return; +++++ END PATCH +++++ REJECTED PATCH 5 + this.floatingTickCount = 0; + } + ++ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving ++ + this.playerEntity.onGround = packetIn.isOnGround(); + this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); + this.playerEntity.handleFalling(this.playerEntity.posY - d7, packetIn.isOnGround()); +++++ END PATCH +++++ REJECTED PATCH 7 + WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); + ItemStack itemstack = this.playerEntity.inventory.getCurrentItem(); + boolean flag = false; ++ boolean placeResult = true; + BlockPos blockpos = packetIn.getPosition(); + EnumFacing enumfacing = EnumFacing.getFront(packetIn.getPlacedBlockDirection()); + this.playerEntity.markPlayerActive(); +++++ END PATCH +++++ REJECTED PATCH 8 + return; + } + ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(playerEntity, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, worldserver, new BlockPos(0, 0, 0), null, new net.minecraft.util.Vec3(packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ())); ++ if (event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { + this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack); ++ } + } + else if (blockpos.getY() < this.serverController.getBuildLimit() - 1 || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit()) + { +- if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < 64.0D && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) ++ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 3; ++ dist *= dist; ++ if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < dist && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) + { +- this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); ++ // record block place result so we can update client itemstack size if place event was cancelled. ++ placeResult = this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); + } + + flag = true; +++++ END PATCH +++++ REJECTED PATCH 9 + this.playerEntity.isChangingQuantityOnly = true; + this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = ItemStack.copyItemStack(this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem]); + Slot slot = this.playerEntity.openContainer.getSlotFromInventory(this.playerEntity.inventory, this.playerEntity.inventory.currentItem); ++ int windowId = this.playerEntity.openContainer.windowId; ++ if (slot == null) // Forge: Fix 'slotless' inventories not selecting a valid slot to update ++ { ++ slot = this.playerEntity.inventoryContainer.getSlotFromInventory(this.playerEntity.inventory, this.playerEntity.inventory.currentItem); ++ windowId = this.playerEntity.inventoryContainer.windowId; ++ } + this.playerEntity.openContainer.detectAndSendChanges(); + this.playerEntity.isChangingQuantityOnly = false; + +- if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack())) ++ if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack()) || !placeResult) // force client itemstack update if place event was cancelled + { +- this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); ++ this.sendPacket(new S2FPacketSetSlot(windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); + } + } + } +++++ END PATCH +++++ REJECTED PATCH 10 + } + else + { +- IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.text", new Object[] {this.playerEntity.getDisplayName(), s}); +- this.serverController.getConfigurationManager().sendChatMsgImpl(ichatcomponent, false); ++ ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", this.playerEntity.getDisplayName(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s)); ++ IChatComponent chat = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, chatcomponenttranslation1); ++ if (chat == null) return; ++ this.serverController.getConfigurationManager().sendChatMsgImpl(chat, false); + } + + this.chatSpamThresholdCount += 20; +++++ END PATCH +++++ REJECTED PATCH 11 + return; + } + +- this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, 0, false); ++ this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, playerEntity.dimension, false); + } + + break; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej b/rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej new file mode 100644 index 0000000000..9763848eae --- /dev/null +++ b/rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + ; + } + +- p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND))); ++ p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND))); + NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); + NetworkSystem.this.networkManagers.add(networkmanager); + p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch.rej b/rejects/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch.rej new file mode 100644 index 0000000000..6302df167d --- /dev/null +++ b/rejects/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch.rej @@ -0,0 +1,13 @@ +++++ REJECTED PATCH 1 + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.channel); ++ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. ++ this.data.markReaderIndex(); + buf.writeBytes((ByteBuf)this.data); ++ this.data.resetReaderIndex(); ++ } + } + + public void processPacket(INetHandlerPlayServer handler) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch.rej b/rejects/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch.rej new file mode 100644 index 0000000000..01dcefc10b --- /dev/null +++ b/rejects/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch.rej @@ -0,0 +1,13 @@ +++++ REJECTED PATCH 1 + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.channel); ++ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. ++ this.data.markReaderIndex(); + buf.writeBytes((ByteBuf)this.data); ++ this.data.resetReaderIndex(); ++ } + } + + public void processPacket(INetHandlerPlayClient handler) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej b/rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej new file mode 100644 index 0000000000..faf51ffc77 --- /dev/null +++ b/rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + public void writePacketData(PacketBuffer buf) throws IOException + { +- buf.writeString(GSON.toJson((Object)this.response)); ++ buf.writeString(this.response.getJson()); + } + + public void processPacket(INetHandlerStatusClient handler) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/potion/Potion.java.patch.rej b/rejects/minecraft/net/minecraft/potion/Potion.java.patch.rej new file mode 100644 index 0000000000..ccb6a70e3e --- /dev/null +++ b/rejects/minecraft/net/minecraft/potion/Potion.java.patch.rej @@ -0,0 +1,46 @@ +++++ REJECTED PATCH 1 + + public class Potion + { +- public static final Potion[] potionTypes = new Potion[32]; ++ public static final Potion[] potionTypes = new Potion[256]; + private static final Map field_180150_I = Maps.newHashMap(); + public static final Potion field_180151_b = null; + public static final Potion moveSpeed = (new Potion(1, new ResourceLocation("speed"), false, 8171462)).setPotionName("potion.moveSpeed").setIconIndex(0, 0).registerPotionAttributeModifier(SharedMonsterAttributes.movementSpeed, "91AEAA56-376B-4498-935B-2F7F68070635", 0.20000000298023224D, 2); +++++ END PATCH +++++ REJECTED PATCH 2 + private double effectiveness; + private boolean usable; + ++ @Deprecated // use the Constructor without potion ID or everything will explode. + protected Potion(int potionID, ResourceLocation location, boolean badEffect, int potionColor) + { +- this.id = potionID; +- potionTypes[potionID] = this; ++ net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().register(potionID, location, this); + field_180150_I.put(location, this); + this.isBadEffect = badEffect; + +++++ END PATCH +++++ REJECTED PATCH 3 + this.liquidColor = potionColor; + } + ++ protected Potion(ResourceLocation location, boolean badEffect, int potionColor) { ++ this(-1, location, badEffect, potionColor); ++ } ++ + public static Potion getPotionFromResourceLocation(String location) + { +- return (Potion)field_180150_I.get(new ResourceLocation(location)); ++ return net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().getObject(new ResourceLocation(location)); + } + + public static Set getPotionLocations() + { +- return field_180150_I.keySet(); ++ return net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().getKeys(); + } + + protected Potion setIconIndex(int p_76399_1_, int p_76399_2_) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej b/rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej new file mode 100644 index 0000000000..cc6804782b --- /dev/null +++ b/rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej @@ -0,0 +1,39 @@ +++++ REJECTED PATCH 1 + @SideOnly(Side.CLIENT) + private boolean isPotionDurationMax; + private boolean showParticles; ++ /** List of ItemStack that can cure the potion effect **/ ++ private java.util.List curativeItems; + + public PotionEffect(int id, int effectDuration) + { +++++ END PATCH +++++ REJECTED PATCH 2 + this.amplifier = effectAmplifier; + this.isAmbient = ambient; + this.showParticles = showParticles; ++ this.curativeItems = new java.util.ArrayList(); ++ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket)); + } + + public PotionEffect(PotionEffect other) +++++ END PATCH +++++ REJECTED PATCH 3 + this.amplifier = other.amplifier; + this.isAmbient = other.isAmbient; + this.showParticles = other.showParticles; ++ this.curativeItems = other.curativeItems; + } + + public void combine(PotionEffect other) +++++ END PATCH +++++ REJECTED PATCH 4 + + public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) + { +- int i = nbt.getByte("Id"); ++ int i = nbt.getByte("Id") & 0xff; + + if (i >= 0 && i < Potion.potionTypes.length && Potion.potionTypes[i] != null) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/realms/RealmsConnect.java.patch.rej b/rejects/minecraft/net/minecraft/realms/RealmsConnect.java.patch.rej new file mode 100644 index 0000000000..aaface62da --- /dev/null +++ b/rejects/minecraft/net/minecraft/realms/RealmsConnect.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + return; + } + +- RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); ++ RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true)); + + if (RealmsConnect.this.aborted) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej new file mode 100644 index 0000000000..7c9e8ee299 --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej @@ -0,0 +1,46 @@ +++++ REJECTED PATCH 1 + @SideOnly(Side.SERVER) + private String hostname; + private int serverPort = -1; +- public WorldServer[] worldServers; ++ public WorldServer[] worldServers = new WorldServer[0]; + private ServerConfigurationManager serverConfigManager; + private boolean serverRunning = true; + private boolean serverStopped; +++++ END PATCH +++++ REJECTED PATCH 6 + + public void stopServer() + { +- if (!this.worldIsBeingDeleted) ++ if (!this.worldIsBeingDeleted && net.minecraftforge.fml.common.Loader.instance().hasReachedState(net.minecraftforge.fml.common.LoaderState.SERVER_STARTED) && !serverStopped) // make sure the save is valid and we don't save twice + { + logger.info("Stopping server"); + +++++ END PATCH +++++ REJECTED PATCH 7 + for (int i = 0; i < this.worldServers.length; ++i) + { + WorldServer worldserver = this.worldServers[i]; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); + worldserver.flush(); + } ++ ++ WorldServer[] tmp = worldServers; ++ for (WorldServer world : tmp) ++ { ++ net.minecraftforge.common.DimensionManager.setWorld(world.provider.getDimensionId(), null); ++ } + } + + if (this.usageSnooper.isSnooperRunning()) +++++ END PATCH +++++ REJECTED PATCH 22 + + if (worldserver != null) + { ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); + worldserver.flush(); + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch.rej new file mode 100644 index 0000000000..5a4f31b4c5 --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch.rej @@ -0,0 +1,18 @@ +++++ REJECTED PATCH 4 + } + else + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStarted(); + this.setConfigManager(new DedicatedPlayerList(this)); + long j = System.nanoTime(); + +++++ END PATCH +++++ REJECTED PATCH 5 + this.setBuildLimit((this.getBuildLimit() + 8) / 16 * 16); + this.setBuildLimit(MathHelper.clamp_int(this.getBuildLimit(), 64, 256)); + this.settings.setProperty("max-build-height", Integer.valueOf(this.getBuildLimit())); ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; + logger.info("Preparing level \"" + this.getFolderName() + "\""); + this.loadAllWorlds(this.getFolderName(), this.getFolderName(), k, worldtype, s2); + long i1 = System.nanoTime() - j; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej new file mode 100644 index 0000000000..621619af0a --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej @@ -0,0 +1,58 @@ +++++ REJECTED PATCH 2 + worldinfo.setWorldName(p_71247_2_); + } + +- for (int i = 0; i < this.worldServers.length; ++i) +- { +- int j = 0; ++ WorldServer overWorld = (isDemo() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init() : ++ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init()); ++ overWorld.initialize(this.theWorldSettings); + +- if (i == 1) ++ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) ++ { ++ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.theProfiler)).init()); ++ world.addWorldAccess(new WorldManager(this, world)); ++ if (!this.isSinglePlayer()) + { +- j = -1; ++ world.getWorldInfo().setGameType(getGameType()); + } +- +- if (i == 2) +- { +- j = 1; +- } +- +- if (i == 0) +- { +- if (this.isDemo()) +- { +- this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- } +- else +- { +- this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- } +- +- this.worldServers[i].initialize(this.theWorldSettings); +- } +- else +- { +- this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); +- } +- +- this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); + } + +- this.getConfigurationManager().setPlayerManager(this.worldServers); ++ this.getConfigurationManager().setPlayerManager(new WorldServer[]{ overWorld }); + +- if (this.worldServers[0].getWorldInfo().getDifficulty() == null) ++ if (overWorld.getWorldInfo().getDifficulty() == null) + { + this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch.rej b/rejects/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch.rej new file mode 100644 index 0000000000..58d956d21c --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch.rej @@ -0,0 +1,276 @@ +++++ REJECTED PATCH 1 + + public class ItemInWorldManager + { ++ /** Forge reach distance */ ++ private double blockReachDistance = 5.0d; + public World theWorld; + public EntityPlayerMP thisPlayerMP; + private WorldSettings.GameType gameType = WorldSettings.GameType.NOT_SET; +++++ END PATCH +++++ REJECTED PATCH 2 + else + { + int k = this.curblockDamage - this.initialDamage; +- float f1 = block1.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180241_i) * (float)(k + 1); ++ float f1 = block1.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180240_f) * (float)(k + 1); //Forge: Fix network break progress using wrong position + int l = (int)(f1 * 10.0F); + + if (l != this.durabilityRemainingOnBlock) +++++ END PATCH +++++ REJECTED PATCH 3 + + public void onBlockClicked(BlockPos pos, EnumFacing side) + { ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thisPlayerMP, ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, theWorld, pos, side, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(thisPlayerMP, getBlockReachDistance() + 1)); ++ if (event.isCanceled()) ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ return; ++ } ++ + if (this.isCreative()) + { + if (!this.theWorld.extinguishFire((EntityPlayer)null, pos, side)) +++++ END PATCH +++++ REJECTED PATCH 4 + } + } + +- this.theWorld.extinguishFire((EntityPlayer)null, pos, side); ++ // + this.initialDamage = this.curblockDamage; + float f = 1.0F; + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(theWorld, pos)) + { +- block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); ++ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); ++ this.theWorld.extinguishFire((EntityPlayer)null, pos, side); ++ } ++ else ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ } + f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos); + } + +- if (block.getMaterial() != Material.air && f >= 1.0F) ++ if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { ++ if (f >= 1.0F) ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ } ++ return; ++ } ++ ++ if (!block.isAir(theWorld, pos) && f >= 1.0F) ++ { + this.tryHarvestBlock(pos); + } + else +++++ END PATCH +++++ REJECTED PATCH 5 + int i = this.curblockDamage - this.initialDamage; + Block block = this.theWorld.getBlockState(pos).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(theWorld, pos)) + { + float f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos) * (float)(i + 1); + +++++ END PATCH +++++ REJECTED PATCH 6 + + private boolean removeBlock(BlockPos pos) + { ++ return removeBlock(pos, false); ++ } ++ private boolean removeBlock(BlockPos pos, boolean canHarvest) ++ { + IBlockState iblockstate = this.theWorld.getBlockState(pos); + iblockstate.getBlock().onBlockHarvested(this.theWorld, pos, iblockstate, this.thisPlayerMP); +- boolean flag = this.theWorld.setBlockToAir(pos); ++ boolean flag = iblockstate.getBlock().removedByPlayer(theWorld, pos, thisPlayerMP, canHarvest); + + if (flag) + { +++++ END PATCH +++++ REJECTED PATCH 7 + + public boolean tryHarvestBlock(BlockPos pos) + { +- if (this.gameType.isCreative() && this.thisPlayerMP.getHeldItem() != null && this.thisPlayerMP.getHeldItem().getItem() instanceof ItemSword) ++ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(theWorld, gameType, thisPlayerMP, pos); ++ if (exp == -1) + { + return false; + } +++++ END PATCH +++++ REJECTED PATCH 8 + IBlockState iblockstate = this.theWorld.getBlockState(pos); + TileEntity tileentity = this.theWorld.getTileEntity(pos); + +- if (this.gameType.isAdventure()) +- { +- if (this.gameType == WorldSettings.GameType.SPECTATOR) +- { +- return false; +- } ++ ItemStack stack = thisPlayerMP.getCurrentEquippedItem(); ++ if (stack != null && stack.getItem().onBlockStartBreak(stack, pos, thisPlayerMP)) return false; + +- if (!this.thisPlayerMP.isAllowEdit()) +- { +- ItemStack itemstack = this.thisPlayerMP.getCurrentEquippedItem(); +- +- if (itemstack == null) +- { +- return false; +- } +- +- if (!itemstack.canDestroy(iblockstate.getBlock())) +- { +- return false; +- } +- } +- } +- + this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, pos, Block.getStateId(iblockstate)); +- boolean flag1 = this.removeBlock(pos); ++ boolean flag1 = false; + + if (this.isCreative()) + { ++ flag1 = this.removeBlock(pos); + this.thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(this.theWorld, pos)); + } + else + { + ItemStack itemstack1 = this.thisPlayerMP.getCurrentEquippedItem(); +- boolean flag = this.thisPlayerMP.canHarvestBlock(iblockstate.getBlock()); ++ boolean flag = iblockstate.getBlock().canHarvestBlock(theWorld, pos, thisPlayerMP); + + if (itemstack1 != null) + { +++++ END PATCH +++++ REJECTED PATCH 9 + } + } + ++ flag1 = this.removeBlock(pos, flag); + if (flag1 && flag) + { + iblockstate.getBlock().harvestBlock(this.theWorld, this.thisPlayerMP, pos, iblockstate, tileentity); + } + } + ++ // Drop experiance ++ if (!this.isCreative() && flag1 && exp > 0) ++ { ++ iblockstate.getBlock().dropXpOnBlockBreak(theWorld, pos, exp); ++ } + return flag1; + } + } +++++ END PATCH +++++ REJECTED PATCH 10 + if (itemstack.stackSize == 0) + { + player.inventory.mainInventory[player.inventory.currentItem] = null; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemstack); + } + + if (!player.isUsingItem()) +++++ END PATCH +++++ REJECTED PATCH 11 + } + else + { +- if (!player.isSneaking() || player.getHeldItem() == null) ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(player, ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, worldIn, pos, side, new net.minecraft.util.Vec3(offsetX, offsetY, offsetZ)); ++ if (event.isCanceled()) + { +- IBlockState iblockstate = worldIn.getBlockState(pos); +- +- if (iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, offsetX, offsetY, offsetZ)) +- { +- return true; +- } ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ return false; + } + +- if (stack == null) ++ if (stack != null && stack.getItem().onItemUseFirst(stack, player, worldIn, pos, side, offsetX, offsetY, offsetZ)) + { +- return false; ++ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); ++ return true; + } +- else if (this.isCreative()) ++ ++ IBlockState iblockstate = worldIn.getBlockState(pos); ++ boolean isAir = worldIn.isAirBlock(pos); ++ boolean useBlock = !player.isSneaking() || player.getHeldItem() == null; ++ if (!useBlock) useBlock = player.getHeldItem().getItem().doesSneakBypassUse(worldIn, pos, player); ++ boolean result = false; ++ ++ if (useBlock) + { +- int j = stack.getMetadata(); +- int i = stack.stackSize; +- boolean flag = stack.onItemUse(player, worldIn, pos, side, offsetX, offsetY, offsetZ); +- stack.setItemDamage(j); +- stack.stackSize = i; +- return flag; ++ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ result = iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, offsetX, offsetY, offsetZ); ++ } ++ else ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ result = event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW; ++ } + } +- else ++ if (stack != null && !result && event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { +- return stack.onItemUse(player, worldIn, pos, side, offsetX, offsetY, offsetZ); ++ int meta = stack.getMetadata(); ++ int size = stack.stackSize; ++ result = stack.onItemUse(player, worldIn, pos, side, offsetX, offsetY, offsetZ); ++ if (isCreative()) ++ { ++ stack.setItemDamage(meta); ++ stack.stackSize = size; ++ } ++ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); + } ++ return result; + } + } + +++++ END PATCH +++++ REJECTED PATCH 12 + { + this.theWorld = serverWorld; + } ++ ++ public double getBlockReachDistance() ++ { ++ return blockReachDistance; ++ } ++ public void setBlockReachDistance(double distance) ++ { ++ blockReachDistance = distance; ++ } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej b/rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej new file mode 100644 index 0000000000..cb7cb9cca1 --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej @@ -0,0 +1,223 @@ +++++ REJECTED PATCH 1 + int j = (int)player.posZ >> 4; + player.managedPosX = player.posX; + player.managedPosZ = player.posZ; ++ // Load nearby chunks first ++ List chunkList = Lists.newArrayList(); + + for (int k = i - this.playerViewRadius; k <= i + this.playerViewRadius; ++k) + { + for (int l = j - this.playerViewRadius; l <= j + this.playerViewRadius; ++l) + { +- this.getPlayerInstance(k, l, true).addPlayer(player); ++ chunkList.add(new ChunkCoordIntPair(k, l)); + } + } + ++ java.util.Collections.sort(chunkList, new net.minecraftforge.common.util.ChunkCoordComparator(player)); ++ ++ for (ChunkCoordIntPair pair : chunkList) ++ { ++ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(player); ++ } ++ + this.players.add(player); + this.filterChunkLoadQueue(player); + } +++++ END PATCH +++++ REJECTED PATCH 3 + { + if (!this.overlaps(l1, i2, k, l, i1)) + { +- this.getPlayerInstance(l1, i2, true).addPlayer(player); ++ chunksToLoad.add(new ChunkCoordIntPair(l1, i2)); + } + + if (!this.overlaps(l1 - j1, i2 - k1, i, j, i1)) +++++ END PATCH +++++ REJECTED PATCH 4 + this.filterChunkLoadQueue(player); + player.managedPosX = player.posX; + player.managedPosZ = player.posZ; ++ // send nearest chunks first ++ java.util.Collections.sort(chunksToLoad, new net.minecraftforge.common.util.ChunkCoordComparator(player)); ++ ++ for (ChunkCoordIntPair pair : chunksToLoad) ++ { ++ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(player); ++ } ++ ++ if (i1 > 1 || i1 < -1 || j1 > 1 || j1 < -1) ++ { ++ java.util.Collections.sort(player.loadedChunks, new net.minecraftforge.common.util.ChunkCoordComparator(player)); ++ } + } + } + } +++++ END PATCH +++++ REJECTED PATCH 5 + private int numBlocksToUpdate; + private int flagsYAreasToUpdate; + private long previousWorldTime; ++ private final java.util.HashMap players = new java.util.HashMap(); ++ private boolean loaded = false; ++ private Runnable loadedRunnable = new Runnable() ++ { ++ public void run() ++ { ++ PlayerInstance.this.loaded = true; ++ } ++ }; + + public PlayerInstance(int chunkX, int chunkZ) + { + this.chunkCoords = new ChunkCoordIntPair(chunkX, chunkZ); +- PlayerManager.this.getWorldServer().theChunkProviderServer.loadChunk(chunkX, chunkZ); ++ PlayerManager.this.getWorldServer().theChunkProviderServer.loadChunk(chunkX, chunkZ, this.loadedRunnable); + } + + public void addPlayer(EntityPlayerMP player) +++++ END PATCH +++++ REJECTED PATCH 6 + } + + this.playersWatchingChunk.add(player); ++ Runnable playerRunnable = null; ++ if (this.loaded) ++ { + player.loadedChunks.add(this.chunkCoords); ++ } ++ else ++ { ++ final EntityPlayerMP tmp = player; ++ playerRunnable = new Runnable() ++ { ++ public void run() ++ { ++ tmp.loadedChunks.add(PlayerInstance.this.chunkCoords); ++ } ++ }; ++ PlayerManager.this.getWorldServer().theChunkProviderServer.loadChunk(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, playerRunnable); ++ } ++ this.players.put(player, playerRunnable); + } + } + +++++ END PATCH +++++ REJECTED PATCH 7 + { + if (this.playersWatchingChunk.contains(player)) + { ++ // If we haven't loaded yet don't load the chunk just so we can clean it up ++ if (!this.loaded) ++ { ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getWorldServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.players.get(player)); ++ this.playersWatchingChunk.remove(player); ++ this.players.remove(player); ++ ++ if (this.playersWatchingChunk.isEmpty()) ++ { ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getWorldServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.loadedRunnable); ++ long i = (long) this.chunkCoords.chunkXPos + 2147483647L | (long) this.chunkCoords.chunkZPos + 2147483647L << 32; ++ PlayerManager.this.playerInstances.remove(i); ++ PlayerManager.this.playerInstanceList.remove(this); ++ } ++ ++ return; ++ } ++ + Chunk chunk = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos); + + if (chunk.isPopulated()) +++++ END PATCH +++++ REJECTED PATCH 8 + player.playerNetServerHandler.sendPacket(new S21PacketChunkData(chunk, true, 0)); + } + ++ this.players.remove(player); + this.playersWatchingChunk.remove(player); + player.loadedChunks.remove(this.chunkCoords); + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.UnWatch(chunkCoords, player)); ++ + if (this.playersWatchingChunk.isEmpty()) + { + long i = (long)this.chunkCoords.chunkXPos + 2147483647L | (long)this.chunkCoords.chunkZPos + 2147483647L << 32; +++++ END PATCH +++++ REJECTED PATCH 9 + + this.flagsYAreasToUpdate |= 1 << (y >> 4); + +- if (this.numBlocksToUpdate < 64) ++ //Forge; Cache everything, so always run + { + short short1 = (short)(x << 12 | z << 8 | y); + +++++ END PATCH +++++ REJECTED PATCH 10 + } + } + ++ if (numBlocksToUpdate == locationOfBlockChange.length) ++ { ++ locationOfBlockChange = java.util.Arrays.copyOf(locationOfBlockChange, locationOfBlockChange.length << 1); ++ } + this.locationOfBlockChange[this.numBlocksToUpdate++] = short1; + } + } +++++ END PATCH +++++ REJECTED PATCH 11 + } + } + ++ @SuppressWarnings("unused") + public void onUpdate() + { + if (this.numBlocksToUpdate != 0) +++++ END PATCH +++++ REJECTED PATCH 12 + BlockPos blockpos = new BlockPos(i, j, k); + this.sendToAllPlayersWatchingChunk(new S23PacketBlockChange(PlayerManager.this.theWorldServer, blockpos)); + +- if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity()) ++ if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity(PlayerManager.this.theWorldServer.getBlockState(blockpos))) + { + this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos)); + } + } +- else if (this.numBlocksToUpdate == 64) ++ else if (this.numBlocksToUpdate >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) + { + int i1 = this.chunkCoords.chunkXPos * 16; + int k1 = this.chunkCoords.chunkZPos * 16; + this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), false, this.flagsYAreasToUpdate)); + +- for (int i2 = 0; i2 < 16; ++i2) ++ // Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones ++ for (int i2 = 0; false && i2 < 16; ++i2) + { + if ((this.flagsYAreasToUpdate & 1 << i2) != 0) + { +++++ END PATCH +++++ REJECTED PATCH 13 + else + { + this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos))); +- ++ } ++ { // Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small ++ WorldServer world = PlayerManager.this.theWorldServer; + for (int j1 = 0; j1 < this.numBlocksToUpdate; ++j1) + { + int l1 = (this.locationOfBlockChange[j1] >> 12 & 15) + this.chunkCoords.chunkXPos * 16; +++++ END PATCH +++++ REJECTED PATCH 14 + int l2 = (this.locationOfBlockChange[j1] >> 8 & 15) + this.chunkCoords.chunkZPos * 16; + BlockPos blockpos1 = new BlockPos(l1, j2, l2); + +- if (PlayerManager.this.theWorldServer.getBlockState(blockpos1).getBlock().hasTileEntity()) ++ if (world.getBlockState(blockpos1).getBlock().hasTileEntity(world.getBlockState(blockpos1))) + { + this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos1)); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej b/rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej new file mode 100644 index 0000000000..44d627c7e8 --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej @@ -0,0 +1,237 @@ +++++ REJECTED PATCH 1 + this.maxPlayers = 8; + } + +- public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn) ++ public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn, NetHandlerPlayServer nethandlerplayserver) + { + GameProfile gameprofile = playerIn.getGameProfile(); + PlayerProfileCache playerprofilecache = this.mcServer.getPlayerProfileCache(); +++++ END PATCH +++++ REJECTED PATCH 2 + playerprofilecache.addEntry(gameprofile); + NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(playerIn); + playerIn.setWorld(this.mcServer.worldServerForDimension(playerIn.dimension)); ++ ++ World playerWorld = this.mcServer.worldServerForDimension(playerIn.dimension); ++ if (playerWorld == null) ++ { ++ playerIn.dimension=0; ++ playerWorld=this.mcServer.worldServerForDimension(0); ++ BlockPos spawnPoint = playerWorld.provider.getRandomizedSpawnPoint(); ++ playerIn.setPosition(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ()); ++ } ++ ++ playerIn.setWorld(playerWorld); + playerIn.theItemInWorldManager.setWorld((WorldServer)playerIn.worldObj); + String s1 = "local"; + +++++ END PATCH +++++ REJECTED PATCH 3 + WorldInfo worldinfo = worldserver.getWorldInfo(); + BlockPos blockpos = worldserver.getSpawnPoint(); + this.setPlayerGameTypeBasedOnOther(playerIn, (EntityPlayerMP)null, worldserver); +- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.mcServer, netManager, playerIn); ++ playerIn.playerNetServerHandler = nethandlerplayserver; + nethandlerplayserver.sendPacket(new S01PacketJoinGame(playerIn.getEntityId(), playerIn.theItemInWorldManager.getGameType(), worldinfo.isHardcoreModeEnabled(), worldserver.provider.getDimensionId(), worldserver.getDifficulty(), this.getMaxPlayers(), worldinfo.getTerrainType(), worldserver.getGameRules().getBoolean("reducedDebugInfo"))); + nethandlerplayserver.sendPacket(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(this.getServerInstance().getServerModName()))); + nethandlerplayserver.sendPacket(new S41PacketServerDifficulty(worldinfo.getDifficulty(), worldinfo.isDifficultyLocked())); +++++ END PATCH +++++ REJECTED PATCH 4 + + playerIn.addSelfToInternalCraftingInventory(); + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(playerIn); + if (nbttagcompound != null && nbttagcompound.hasKey("Riding", 10)) + { + Entity entity = EntityList.createEntityFromNBT(nbttagcompound.getCompoundTag("Riding"), worldserver); +++++ END PATCH +++++ REJECTED PATCH 5 + playerIn.readFromNBT(nbttagcompound); + nbttagcompound1 = nbttagcompound; + logger.debug("loading single player"); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(playerIn, this.playerNBTManagerObj, playerIn.getUniqueID().toString()); + } + else + { +++++ END PATCH +++++ REJECTED PATCH 6 + return nbttagcompound1; + } + ++ public NBTTagCompound getPlayerNBT(EntityPlayerMP player) ++ { ++ // Hacky method to allow loading the NBT for a player prior to login ++ NBTTagCompound nbttagcompound = this.mcServer.worldServers[0].getWorldInfo().getPlayerNBTTagCompound(); ++ if (player.getName().equals(this.mcServer.getServerOwner()) && nbttagcompound != null) ++ { ++ return nbttagcompound; ++ } ++ else ++ { ++ return ((net.minecraft.world.storage.SaveHandler)this.playerNBTManagerObj).getPlayerNBT(player); ++ } ++ } + protected void writePlayerData(EntityPlayerMP playerIn) + { ++ if (playerIn.playerNetServerHandler == null) return; ++ + this.playerNBTManagerObj.writePlayerData(playerIn); + StatisticsFile statisticsfile = (StatisticsFile)this.playerStatFiles.get(playerIn.getUniqueID()); + +++++ END PATCH +++++ REJECTED PATCH 7 + this.uuidToPlayerMap.put(playerIn.getUniqueID(), playerIn); + this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {playerIn})); + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); + worldserver.spawnEntityInWorld(playerIn); + this.preparePlayer(playerIn, (WorldServer)null); + +++++ END PATCH +++++ REJECTED PATCH 8 + + public void playerLoggedOut(EntityPlayerMP playerIn) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(playerIn); + playerIn.triggerAchievement(StatList.leaveGameStat); + this.writePlayerData(playerIn); + WorldServer worldserver = playerIn.getServerForPlayer(); +++++ END PATCH +++++ REJECTED PATCH 9 + this.uuidToPlayerMap.remove(uuid); + this.playerStatFiles.remove(uuid); + } ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); + + this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn})); + } +++++ END PATCH +++++ REJECTED PATCH 10 + + public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd) + { ++ World world = mcServer.worldServerForDimension(dimension); ++ if (world == null) ++ { ++ dimension = 0; ++ } ++ else if (!world.provider.canRespawnHere()) ++ { ++ dimension = world.provider.getRespawnDimension(playerIn); ++ } ++ + playerIn.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(playerIn); + playerIn.getServerForPlayer().getEntityTracker().untrackEntity(playerIn); + playerIn.getServerForPlayer().getPlayerManager().removePlayer(playerIn); + this.playerEntityList.remove(playerIn); + this.mcServer.worldServerForDimension(playerIn.dimension).removePlayerEntityDangerously(playerIn); +- BlockPos blockpos = playerIn.getBedLocation(); +- boolean flag = playerIn.isSpawnForced(); ++ BlockPos blockpos = playerIn.getBedLocation(dimension); ++ boolean flag = playerIn.isSpawnForced(dimension); + playerIn.dimension = dimension; + ItemInWorldManager iteminworldmanager; + +++++ END PATCH +++++ REJECTED PATCH 11 + EntityPlayerMP entityplayermp = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), iteminworldmanager); + entityplayermp.playerNetServerHandler = playerIn.playerNetServerHandler; + entityplayermp.clonePlayer(playerIn, conqueredEnd); ++ entityplayermp.dimension = dimension; + entityplayermp.setEntityId(playerIn.getEntityId()); + entityplayermp.func_174817_o(playerIn); + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); +++++ END PATCH +++++ REJECTED PATCH 12 + this.uuidToPlayerMap.put(entityplayermp.getUniqueID(), entityplayermp); + entityplayermp.addSelfToInternalCraftingInventory(); + entityplayermp.setHealth(entityplayermp.getHealth()); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp); + return entityplayermp; + } + + public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension) + { ++ transferPlayerToDimension(playerIn, dimension, mcServer.worldServerForDimension(dimension).getDefaultTeleporter()); ++ } ++ ++ public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension, net.minecraft.world.Teleporter teleporter) ++ { + int i = playerIn.dimension; + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); + playerIn.dimension = dimension; + WorldServer worldserver1 = this.mcServer.worldServerForDimension(playerIn.dimension); +- playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, playerIn.worldObj.getDifficulty(), playerIn.worldObj.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); ++ playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); + worldserver.removePlayerEntityDangerously(playerIn); + playerIn.isDead = false; +- this.transferEntityToWorld(playerIn, i, worldserver, worldserver1); ++ this.transferEntityToWorld(playerIn, i, worldserver, worldserver1, teleporter); + this.preparePlayer(playerIn, worldserver); + playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch); + playerIn.theItemInWorldManager.setWorld(worldserver1); +++++ END PATCH +++++ REJECTED PATCH 13 + { + playerIn.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), potioneffect)); + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(playerIn, i, dimension); + } + + public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) + { +- double d0 = entityIn.posX; +- double d1 = entityIn.posZ; ++ transferEntityToWorld(entityIn, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.getDefaultTeleporter()); ++ } ++ ++ @SuppressWarnings("unused") ++ public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter) ++ { ++ net.minecraft.world.WorldProvider pOld = p_82448_3_.provider; ++ net.minecraft.world.WorldProvider pNew = p_82448_4_.provider; ++ double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor(); ++ double d0 = entityIn.posX * moveFactor; ++ double d1 = entityIn.posZ * moveFactor; + double d2 = 8.0D; + float f = entityIn.rotationYaw; + p_82448_3_.theProfiler.startSection("moving"); + +- if (entityIn.dimension == -1) ++ if (false && entityIn.dimension == -1) //Forge Kill it but dont comment out so we can rename it. + { + d0 = MathHelper.clamp_double(d0 / d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); + d1 = MathHelper.clamp_double(d1 / d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); +++++ END PATCH +++++ REJECTED PATCH 14 + p_82448_3_.updateEntityWithOptionalForce(entityIn, false); + } + } +- else if (entityIn.dimension == 0) ++ else if (false && entityIn.dimension == 0) //Forge Kill it but dont comment out so we can rename it. + { + d0 = MathHelper.clamp_double(d0 * d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); + d1 = MathHelper.clamp_double(d1 * d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); +++++ END PATCH +++++ REJECTED PATCH 15 + p_82448_3_.updateEntityWithOptionalForce(entityIn, false); + } + } +- else ++ ++ if (entityIn.dimension == 1) + { + BlockPos blockpos; + +++++ END PATCH +++++ REJECTED PATCH 16 + if (entityIn.isEntityAlive()) + { + entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch); +- p_82448_4_.getDefaultTeleporter().placeInPortal(entityIn, f); ++ teleporter.placeInPortal(entityIn, f); + p_82448_4_.spawnEntityInWorld(entityIn); + p_82448_4_.updateEntityWithOptionalForce(entityIn, false); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej new file mode 100644 index 0000000000..befc820c02 --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej @@ -0,0 +1,26 @@ +++++ REJECTED PATCH 1 + if (entityplayermp == null) + { + this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; +- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.field_181025_l); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.field_181025_l); + this.field_181025_l = null; + } + } + +- if (this.connectionTimer++ == 600) ++ if (this.connectionTimer++ == net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.LOGIN_TIMEOUT) + { + this.closeConnection("Took too long to log in"); + } +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { +- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); + } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej b/rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej new file mode 100644 index 0000000000..7fb3cab30c --- /dev/null +++ b/rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej @@ -0,0 +1,20 @@ +++++ REJECTED PATCH 1 + } + } + +- replaceAllSimilarBlocks(objectCraftStats); ++ replaceAllSimilarBlocks(objectCraftStats, true); + } + + private static void initMiningStats() +++++ END PATCH +++++ REJECTED PATCH 2 + } + } + +- replaceAllSimilarBlocks(mineBlockStatArray); ++ replaceAllSimilarBlocks(mineBlockStatArray, false); + } + + private static void initStats() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej b/rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej new file mode 100644 index 0000000000..f181d60105 --- /dev/null +++ b/rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej @@ -0,0 +1,32 @@ +++++ REJECTED PATCH 4 + { + TileEntity tileentity = null; + ++ Class oclass = null; + try + { +- Class oclass = (Class)nameToClassMap.get(nbt.getString("id")); ++ oclass = (Class)nameToClassMap.get(nbt.getString("id")); + + if (oclass != null) + { +++++ END PATCH +++++ REJECTED PATCH 5 + } + else + { ++ try ++ { + logger.warn("Skipping BlockEntity with id " + nbt.getString("id")); ++ } ++ catch (Exception ex) ++ { ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex, ++ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", ++ nbt.getString("id"), oclass.getName()); ++ tileentity = null; ++ } + } + + return tileentity; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch.rej b/rejects/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch.rej new file mode 100644 index 0000000000..e4e37859bf --- /dev/null +++ b/rejects/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch.rej @@ -0,0 +1,63 @@ +++++ REJECTED PATCH 2 + + for (int i = 0; i < 3; ++i) + { +- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) ++ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) + { + int j = this.brewingItemStacks[i].getMetadata(); + int k = this.getPotionResult(j, itemstack); +++++ END PATCH +++++ REJECTED PATCH 3 + } + else + { +- return false; ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(brewingItemStacks, brewingItemStacks[3], outputSlots); + } + } + + private void brewPotions() + { ++ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBreaw(brewingItemStacks)) return; + if (this.canBrew()) + { ++ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(brewingItemStacks, brewingItemStacks[3], outputSlots); + ItemStack itemstack = this.brewingItemStacks[3]; + ++ if (false) { // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe + for (int i = 0; i < 3; ++i) + { +- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) ++ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) + { + int j = this.brewingItemStacks[i].getMetadata(); + int k = this.getPotionResult(j, itemstack); +++++ END PATCH +++++ REJECTED PATCH 4 + } + } + } ++ } + +- if (itemstack.getItem().hasContainerItem()) ++ if (itemstack.getItem().hasContainerItem(itemstack)) + { +- this.brewingItemStacks[3] = new ItemStack(itemstack.getItem().getContainerItem()); ++ this.brewingItemStacks[3] = itemstack.getItem().getContainerItem(itemstack); + } + else + { +++++ END PATCH +++++ REJECTED PATCH 6 + + public boolean isItemValidForSlot(int index, ItemStack stack) + { +- return index == 3 ? stack.getItem().isPotionIngredient(stack) : stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle; ++ if (index == 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack)) return true; ++ else if (index != 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack)) return true; ++ return false; + } + + public boolean[] func_174902_m() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/BlockPos.java.patch.rej b/rejects/minecraft/net/minecraft/util/BlockPos.java.patch.rej new file mode 100644 index 0000000000..93fcafcef7 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/BlockPos.java.patch.rej @@ -0,0 +1,32 @@ +++++ REJECTED PATCH 1 + }; + } + ++ /** ++ * Returns a version of this BlockPos that is guaranteed to be Immutable. ++ * In most cases this will return 'this', but if 'this' is an instance of ++ * MutableBlockPos it will return a new instance of BlockPos with the same values. ++ * ++ * When storing a parameter given to you for an extended period of time, make sure you ++ * use this in case the value is changed internally. ++ * ++ * @return An immutable BlockPos. ++ */ ++ public BlockPos getImmutable() ++ { ++ return this; ++ } ++ + public static final class MutableBlockPos extends BlockPos + { + private int x; +++++ END PATCH +++++ REJECTED PATCH 2 + this.z = zIn; + return this; + } ++ ++ @Override public BlockPos getImmutable() { return new BlockPos(this); } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/ChatComponentStyle.java.patch.rej b/rejects/minecraft/net/minecraft/util/ChatComponentStyle.java.patch.rej new file mode 100644 index 0000000000..3f858e7dbe --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/ChatComponentStyle.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + return stringbuilder.toString(); + } + +- @SideOnly(Side.CLIENT) + public final String getFormattedText() + { + StringBuilder stringbuilder = new StringBuilder(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/ChatStyle.java.patch.rej b/rejects/minecraft/net/minecraft/util/ChatStyle.java.patch.rej new file mode 100644 index 0000000000..8d6713dd01 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/ChatStyle.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + return this; + } + +- @SideOnly(Side.CLIENT) + public String getFormattingCode() + { + if (this.isEmpty()) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej b/rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej new file mode 100644 index 0000000000..d204c3b681 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + import java.util.Iterator; + import java.util.Map; + import java.util.Random; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + + public enum EnumFacing implements IStringSerializable + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch.rej b/rejects/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch.rej new file mode 100644 index 0000000000..78a01be0d0 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch.rej @@ -0,0 +1,11 @@ +++++ REJECTED PATCH 1 + package net.minecraft.util; + +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; +- +-@SideOnly(Side.CLIENT) + public enum EnumWorldBlockLayer + { + SOLID("Solid"), +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/IChatComponent.java.patch.rej b/rejects/minecraft/net/minecraft/util/IChatComponent.java.patch.rej new file mode 100644 index 0000000000..bf81e15d79 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/IChatComponent.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + + String getUnformattedText(); + +- @SideOnly(Side.CLIENT) + String getFormattedText(); + + List getSiblings(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/MovingObjectPosition.java.patch.rej b/rejects/minecraft/net/minecraft/util/MovingObjectPosition.java.patch.rej new file mode 100644 index 0000000000..16da2c7739 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/MovingObjectPosition.java.patch.rej @@ -0,0 +1,14 @@ +++++ REJECTED PATCH 1 + public Vec3 hitVec; + public Entity entityHit; + ++ /** Used to determine what sub-segment is hit */ ++ public int subHit = -1; ++ ++ /** Used to add extra hit info */ ++ public Object hitInfo = null; ++ + public MovingObjectPosition(Vec3 hitVecIn, EnumFacing facing, BlockPos blockPosIn) + { + this(MovingObjectPosition.MovingObjectType.BLOCK, hitVecIn, facing, blockPosIn); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/ResourceLocation.java.patch.rej b/rejects/minecraft/net/minecraft/util/ResourceLocation.java.patch.rej new file mode 100644 index 0000000000..0f0b5b06bf --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/ResourceLocation.java.patch.rej @@ -0,0 +1,27 @@ +++++ REJECTED PATCH 1 + package net.minecraft.util; + +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.Validate; + + public class ResourceLocation +++++ END PATCH +++++ REJECTED PATCH 2 + this(0, splitObjectName(resourceName)); + } + +- @SideOnly(Side.CLIENT) + public ResourceLocation(String resourceDomainIn, String resourcePathIn) + { + this(0, new String[] {resourceDomainIn, resourcePathIn}); +++++ END PATCH +++++ REJECTED PATCH 3 + return this.resourcePath; + } + +- @SideOnly(Side.CLIENT) + public String getResourceDomain() + { + return this.resourceDomain; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/Session.java.patch.rej b/rejects/minecraft/net/minecraft/util/Session.java.patch.rej new file mode 100644 index 0000000000..d15c135b48 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/Session.java.patch.rej @@ -0,0 +1,21 @@ +++++ REJECTED PATCH 4 + return this.sessionType; + } + ++ /* ======================================== FORGE START ===================================== */ ++ //For internal use only. Modders should never need to use this. ++ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) ++ { ++ if(this.properties == null) this.properties = properties; ++ } ++ ++ public boolean hasCachedProperties() ++ { ++ return properties != null; ++ } ++ /* ========================================= FORGE END ====================================== */ ++ + @SideOnly(Side.CLIENT) + public static enum Type + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej b/rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej new file mode 100644 index 0000000000..0ab2b52be7 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej @@ -0,0 +1,54 @@ +++++ REJECTED PATCH 1 + + public StringTranslate() + { ++ InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); ++ inject(this, inputstream); ++ } ++ ++ public static void inject(InputStream inputstream) ++ { ++ inject(instance, inputstream); ++ } ++ ++ private static void inject(StringTranslate inst, InputStream inputstream) ++ { ++ java.util.HashMap map = parseLangFile(inputstream); ++ inst.languageList.putAll(map); ++ inst.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); ++ } ++ ++ public static java.util.HashMap parseLangFile(InputStream inputstream) ++ { ++ java.util.HashMap table = Maps.newHashMap(); + try + { +- InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); ++ inputstream = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(table, inputstream); ++ if (inputstream == null) return table; + + for (String s : IOUtils.readLines(inputstream, Charsets.UTF_8)) + { +++++ END PATCH +++++ REJECTED PATCH 2 + { + String s1 = astring[0]; + String s2 = numericVariablePattern.matcher(astring[1]).replaceAll("%$1s"); +- this.languageList.put(s1, s2); ++ table.put(s1, s2); + } + } + } + +- this.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); + } +- catch (IOException var7) ++ catch (Exception var7) + { + ; + } ++ return table; + } + + static StringTranslate getInstance() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/Vec3.java.patch.rej b/rejects/minecraft/net/minecraft/util/Vec3.java.patch.rej new file mode 100644 index 0000000000..69addc5632 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/Vec3.java.patch.rej @@ -0,0 +1,37 @@ +++++ REJECTED PATCH 1 + package net.minecraft.util; + +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; +- + public class Vec3 + { + public final double xCoord; +++++ END PATCH +++++ REJECTED PATCH 2 + this((double)p_i46377_1_.getX(), (double)p_i46377_1_.getY(), (double)p_i46377_1_.getZ()); + } + +- @SideOnly(Side.CLIENT) + public Vec3 subtractReverse(Vec3 vec) + { + return new Vec3(vec.xCoord - this.xCoord, vec.yCoord - this.yCoord, vec.zCoord - this.zCoord); +++++ END PATCH +++++ REJECTED PATCH 3 + return this.xCoord * vec.xCoord + this.yCoord * vec.yCoord + this.zCoord * vec.zCoord; + } + +- @SideOnly(Side.CLIENT) + public Vec3 crossProduct(Vec3 vec) + { + return new Vec3(this.yCoord * vec.zCoord - this.zCoord * vec.yCoord, this.zCoord * vec.xCoord - this.xCoord * vec.zCoord, this.xCoord * vec.yCoord - this.yCoord * vec.xCoord); +++++ END PATCH +++++ REJECTED PATCH 4 + return new Vec3(this.xCoord + x, this.yCoord + y, this.zCoord + z); + } + +- @SideOnly(Side.CLIENT) + public double distanceTo(Vec3 vec) + { + double d0 = vec.xCoord - this.xCoord; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej b/rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej new file mode 100644 index 0000000000..fe2c74000e --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej @@ -0,0 +1,67 @@ +++++ REJECTED PATCH 1 + for (int i = 0; i < max; ++i) + { + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, listIn); +- int j = weightedrandomchestcontent.minStackSize + random.nextInt(weightedrandomchestcontent.maxStackSize - weightedrandomchestcontent.minStackSize + 1); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, inv); + +- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j) ++ for (ItemStack itemstack1 : stacks) + { +- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); +- itemstack1.stackSize = j; + inv.setInventorySlotContents(random.nextInt(inv.getSizeInventory()), itemstack1); + } +- else +- { +- for (int k = 0; k < j; ++k) +- { +- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); +- itemstack.stackSize = 1; +- inv.setInventorySlotContents(random.nextInt(inv.getSizeInventory()), itemstack); +- } +- } + } + } + ++ // -- Forge hooks ++ /** ++ * Allow a mod to submit a custom implementation that can delegate item stack generation beyond simple stack lookup ++ * ++ * @param random The current random for generation ++ * @param newInventory The inventory being generated (do not populate it, but you can refer to it) ++ * @return An array of {@link ItemStack} to put into the chest ++ */ ++ protected ItemStack[] generateChestContent(Random random, IInventory newInventory) ++ { ++ return net.minecraftforge.common.ChestGenHooks.generateStacks(random, theItemId, minStackSize, maxStackSize); ++ } ++ + public static void generateDispenserContents(Random random, List listIn, TileEntityDispenser dispenser, int max) + { + for (int i = 0; i < max; ++i) + { + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, listIn); +- int j = weightedrandomchestcontent.minStackSize + random.nextInt(weightedrandomchestcontent.maxStackSize - weightedrandomchestcontent.minStackSize + 1); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, dispenser); + +- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j) ++ for (ItemStack itemstack1 : stacks) + { +- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); +- itemstack1.stackSize = j; + dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack1); + } +- else +- { +- for (int k = 0; k < j; ++k) +- { +- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); +- itemstack.stackSize = 1; +- dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack); +- } +- } + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/ChunkCache.java.patch.rej b/rejects/minecraft/net/minecraft/world/ChunkCache.java.patch.rej new file mode 100644 index 0000000000..d67a85598d --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/ChunkCache.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 3 + + public boolean isAirBlock(BlockPos pos) + { +- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; ++ return this.getBlockState(pos).getBlock().isAir(this, pos); + } + + @SideOnly(Side.CLIENT) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej b/rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej new file mode 100644 index 0000000000..a75ecd5c2c --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej @@ -0,0 +1,18 @@ +++++ REJECTED PATCH 1 + private final float explosionSize; + private final List affectedBlockPositions; + private final Map playerKnockbackMap; ++ private final Vec3 position; + + @SideOnly(Side.CLIENT) + public Explosion(World worldIn, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) +++++ END PATCH +++++ REJECTED PATCH 4 + int j2 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D); + int j1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); ++ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3); + Vec3 vec3 = new Vec3(this.explosionX, this.explosionY, this.explosionZ); + + for (int k2 = 0; k2 < list.size(); ++k2) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/SpawnerAnimals.java.patch.rej b/rejects/minecraft/net/minecraft/world/SpawnerAnimals.java.patch.rej new file mode 100644 index 0000000000..7c4fb96bd5 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/SpawnerAnimals.java.patch.rej @@ -0,0 +1,53 @@ +++++ REJECTED PATCH 1 + { + if ((!enumcreaturetype.getPeacefulCreature() || spawnPeacefulMobs) && (enumcreaturetype.getPeacefulCreature() || spawnHostileMobs) && (!enumcreaturetype.getAnimal() || p_77192_4_)) + { +- int j4 = worldServerIn.countEntities(enumcreaturetype.getCreatureClass()); ++ int j4 = worldServerIn.countEntities(enumcreaturetype, true); + int k4 = enumcreaturetype.getMaxNumberOfCreature() * i / MOB_COUNT_DIV; + + if (j4 <= k4) + { ++ java.util.ArrayList shuffled = com.google.common.collect.Lists.newArrayList(this.eligibleChunksForSpawning); ++ java.util.Collections.shuffle(shuffled); + label374: +- +- for (ChunkCoordIntPair chunkcoordintpair1 : this.eligibleChunksForSpawning) ++ for (ChunkCoordIntPair chunkcoordintpair1 : shuffled) + { + BlockPos blockpos = getRandomChunkPosition(worldServerIn, chunkcoordintpair1.chunkXPos, chunkcoordintpair1.chunkZPos); + int k1 = blockpos.getX(); +++++ END PATCH +++++ REJECTED PATCH 2 + + entityliving.setLocationAndAngles((double)f, (double)i3, (double)f1, worldServerIn.rand.nextFloat() * 360.0F, 0.0F); + +- if (entityliving.getCanSpawnHere() && entityliving.isNotColliding()) ++ net.minecraftforge.fml.common.eventhandler.Event.Result canSpawn = net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(entityliving, worldServerIn, f, i3, f1); ++ if (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT && (entityliving.getCanSpawnHere() && entityliving.isNotColliding()))) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, worldServerIn, f, l3, f1)) + ientitylivingdata = entityliving.onInitialSpawn(worldServerIn.getDifficultyForLocation(new BlockPos(entityliving)), ientitylivingdata); + + if (entityliving.isNotColliding()) +++++ END PATCH +++++ REJECTED PATCH 3 + worldServerIn.spawnEntityInWorld(entityliving); + } + +- if (j2 >= entityliving.getMaxSpawnedInChunk()) ++ if (i2 >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(entityliving)) + { + continue label374; + } +++++ END PATCH +++++ REJECTED PATCH 4 + { + BlockPos blockpos = pos.down(); + +- if (!World.doesBlockHaveSolidTopSurface(worldIn, blockpos)) ++ if (!worldIn.getBlockState(blockpos).getBlock().canCreatureSpawn(worldIn, blockpos, spawnPlacementTypeIn)) + { + return false; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/World.java.patch.rej b/rejects/minecraft/net/minecraft/world/World.java.patch.rej new file mode 100644 index 0000000000..234b4571b0 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/World.java.patch.rej @@ -0,0 +1,319 @@ +++++ REJECTED PATCH 5 + + public boolean isAirBlock(BlockPos pos) + { +- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; ++ return this.getBlockState(pos).getBlock().isAir(this, pos); + } + + public boolean isBlockLoaded(BlockPos pos) +++++ END PATCH +++++ REJECTED PATCH 6 + { + Chunk chunk = this.getChunkFromBlockCoords(pos); + Block block = newState.getBlock(); ++ ++ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; ++ if (this.captureBlockSnapshots && !this.isRemote) ++ { ++ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, pos, flags); ++ this.capturedBlockSnapshots.add(blockSnapshot); ++ } ++ Block oldBlock = getBlockState(pos).getBlock(); ++ int oldLight = oldBlock.getLightValue(this, pos); ++ int oldOpacity = oldBlock.getLightOpacity(this, pos); ++ + IBlockState iblockstate = chunk.setBlockState(pos, newState); + + if (iblockstate == null) + { ++ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); + return false; + } + else + { + Block block1 = iblockstate.getBlock(); + +- if (block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue() != block1.getLightValue()) ++ if (block.getLightOpacity(this, pos) != oldOpacity || block.getLightValue(this, pos) != oldLight) + { + this.theProfiler.startSection("checkLight"); + this.checkLight(pos); + this.theProfiler.endSection(); + } + +- if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && chunk.isPopulated()) ++ if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates + { +- this.markBlockForUpdate(pos); ++ this.markAndNotifyBlock(pos, chunk, iblockstate, newState, flags); // Modularize client and physic updates + } + ++ return true; ++ } ++ } ++ } ++ ++ // Split off from original setBlockState(BlockPos, IBlockState Block p_147465_4_, int) method in order to directly send client and physic updates ++ public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState old, IBlockState new_, int flags) ++ { ++ if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && (chunk == null || chunk.isPopulated())) ++ { ++ this.markBlockForUpdate(pos); ++ } ++ { ++ { + if (!this.isRemote && (flags & 1) != 0) + { +- this.notifyNeighborsRespectDebug(pos, iblockstate.getBlock()); ++ this.notifyNeighborsRespectDebug(pos, new_.getBlock()); + +- if (block.hasComparatorInputOverride()) ++ if (new_.getBlock().hasComparatorInputOverride()) + { +- this.updateComparatorOutputLevel(pos, block); ++ this.updateComparatorOutputLevel(pos, new_.getBlock()); + } + } +- +- return true; + } + } + } +++++ END PATCH +++++ REJECTED PATCH 14 + + public int calculateSkylightSubtracted(float p_72967_1_) + { ++ float f = provider.getSunBrightnessFactor(p_72967_1_); ++ f = 1 - f; ++ return (int)(f * 11); ++ } ++ ++ /** ++ * The current sun brightness factor for this dimension. ++ * 0.0f means no light at all, and 1.0f means maximum sunlight. ++ * Highly recommended for sunlight detection like solar panel. ++ * ++ * @return The current brightness factor ++ * */ ++ public float getSunBrightnessFactor(float p_72967_1_) ++ { + float f = this.getCelestialAngle(p_72967_1_); + float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F); + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); + f1 = 1.0F - f1; + f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength(p_72967_1_) * 5.0F) / 16.0D)); + f1 = (float)((double)f1 * (1.0D - (double)(this.getThunderStrength(p_72967_1_) * 5.0F) / 16.0D)); +- f1 = 1.0F - f1; +- return (int)(f1 * 11.0F); ++ return f1; + } + +- @SideOnly(Side.CLIENT) + public void removeWorldAccess(IWorldAccess worldAccess) + { + this.worldAccesses.remove(worldAccess); +++++ END PATCH +++++ REJECTED PATCH 20 + for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1) + { + blockpos1 = blockpos.down(); +- Material material = chunk.getBlock(blockpos1).getMaterial(); ++ Block block = chunk.getBlock(blockpos1); + +- if (material.blocksMovement() && material != Material.leaves) ++ if (block.getMaterial().blocksMovement() && !block.isLeaves(this, blockpos1) && !block.isFoliage(this, blockpos1)) + { + break; + } +++++ END PATCH +++++ REJECTED PATCH 23 + CrashReport crashreport1 = CrashReport.makeCrashReport(throwable1, "Ticking entity"); + CrashReportCategory crashreportcategory2 = crashreport1.makeCategory("Entity being ticked"); + entity2.addEntityCrashInfo(crashreportcategory2); +- throw new ReportedException(crashreport1); ++ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe(crashreport1.getCompleteReport()); ++ removeEntity(entity2); ++ } ++ else ++ { ++ throw new ReportedException(crashreport1); ++ } + } + } + +++++ END PATCH +++++ REJECTED PATCH 24 + CrashReport crashreport2 = CrashReport.makeCrashReport(throwable, "Ticking block entity"); + CrashReportCategory crashreportcategory1 = crashreport2.makeCategory("Block entity being ticked"); + tileentity.addInfoToCrashReport(crashreportcategory1); +- throw new ReportedException(crashreport2); ++ if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe(crashreport2.getCompleteReport()); ++ tileentity.invalidate(); ++ this.removeTileEntity(tileentity.getPos()); ++ } ++ else ++ { ++ throw new ReportedException(crashreport2); ++ } + } + } + } +++++ END PATCH +++++ REJECTED PATCH 28 + { + Block block = this.getBlockState(blockpos$mutableblockpos.set(k1, l1, i2)).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(this, new BlockPos(k1, l1, i2))) + { + return true; + } +++++ END PATCH +++++ REJECTED PATCH 31 + IBlockState iblockstate = this.getBlockState(blockpos$mutableblockpos.set(k1, l1, i2)); + Block block = iblockstate.getBlock(); + ++ Boolean result = block.isAABBInsideMaterial(this, blockpos$mutableblockpos, bb, materialIn); ++ if (result != null) return result; ++ + if (block.getMaterial() == materialIn) + { + int j2 = ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue(); +++++ END PATCH +++++ REJECTED PATCH 35 + { + IBlockState iblockstate = blockAccess.getBlockState(pos); + Block block = iblockstate.getBlock(); +- return block.getMaterial().isOpaque() && block.isFullCube() ? true : (block instanceof BlockStairs ? iblockstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP : (block instanceof BlockSlab ? iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue() == 7 : false)))); ++ return block.isSideSolid(blockAccess, pos, EnumFacing.UP); + } + + public boolean isBlockNormalCube(BlockPos pos, boolean _default) +++++ END PATCH +++++ REJECTED PATCH 36 + else + { + Block block = this.getBlockState(pos).getBlock(); +- return block.getMaterial().isOpaque() && block.isFullCube(); ++ return block.isNormalCube(this, pos); + } + } + } +++++ END PATCH +++++ REJECTED PATCH 40 + { + this.activeChunkSet.clear(); + this.theProfiler.startSection("buildList"); ++ this.activeChunkSet.addAll(getPersistentChunks().keySet()); + + for (int i = 0; i < this.playerEntities.size(); ++i) + { +++++ END PATCH +++++ REJECTED PATCH 41 + Block block = chunkIn.getBlock(blockpos); + j = j + p_147467_1_; + k = k + p_147467_2_; ++ BlockPos worldpos = blockpos.add(p_147467_1_, 0, p_147467_2_); + +- if (block.getMaterial() == Material.air && this.getLight(blockpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, blockpos) <= 0) ++ if (block.isAir(this, worldpos) && this.getLight(worldpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, worldpos) <= 0) //Forge: isAir, and fix arguments to world positions instead of chunk position + { + EntityPlayer entityplayer = this.getClosestPlayer((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, 8.0D); + +++++ END PATCH +++++ REJECTED PATCH 44 + { + Block block = this.getBlockState(pos).getBlock(); + +- if (block.getMaterial() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos)) ++ if (block.isAir(this, pos) && Blocks.snow_layer.canPlaceBlockAt(this, pos)) + { + return true; + } +++++ END PATCH +++++ REJECTED PATCH 45 + else + { + Block block = this.getBlockState(pos).getBlock(); +- int i = lightType == EnumSkyBlock.SKY ? 0 : block.getLightValue(); +- int j = block.getLightOpacity(); ++ int blockLight = block.getLightValue(this, pos); ++ int i = lightType == EnumSkyBlock.SKY ? 0 : blockLight; ++ int j = block.getLightOpacity(this, pos); + +- if (j >= 15 && block.getLightValue() > 0) ++ if (j >= 15 && blockLight > 0) + { + j = 1; + } +++++ END PATCH +++++ REJECTED PATCH 47 + + public List getEntitiesWithinAABB(Class clazz, AxisAlignedBB aabb, Predicate filter) + { +- int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((aabb.maxX + 2.0D) / 16.0D); +- int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D); +- int l = MathHelper.floor_double((aabb.maxZ + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((aabb.minX - MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((aabb.maxX + MAX_ENTITY_RADIUS) / 16.0D); ++ int k = MathHelper.floor_double((aabb.minZ - MAX_ENTITY_RADIUS) / 16.0D); ++ int l = MathHelper.floor_double((aabb.maxZ + MAX_ENTITY_RADIUS) / 16.0D); + List list = Lists.newArrayList(); + + for (int i1 = i; i1 <= j; ++i1) +++++ END PATCH +++++ REJECTED PATCH 49 + { + Block block = this.getBlockState(pos).getBlock(); + AxisAlignedBB axisalignedbb = p_175716_3_ ? null : blockIn.getCollisionBoundingBox(this, pos, blockIn.getDefaultState()); +- return axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, entityIn) ? false : (block.getMaterial() == Material.circuits && blockIn == Blocks.anvil ? true : block.getMaterial().isReplaceable() && blockIn.canReplace(this, pos, side, itemStackIn)); ++ if (axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, entityIn)) return false; ++ if (block.getMaterial() == Material.circuits && blockIn == Blocks.anvil) return true; ++ return block.isReplaceable(this, pos) && blockIn.canReplace(this, pos, side, itemStackIn); + } + + public int getSeaLevel() +++++ END PATCH +++++ REJECTED PATCH 50 + { + IBlockState iblockstate = this.getBlockState(pos); + Block block = iblockstate.getBlock(); +- return block.isNormalCube() ? this.getStrongPower(pos) : block.getWeakPower(this, pos, iblockstate, facing); ++ return block.shouldCheckWeakPower(this, pos, facing) ? this.getStrongPower(pos) : block.getWeakPower(this, pos, iblockstate, facing); + } + + public boolean isBlockPowered(BlockPos pos) +++++ END PATCH +++++ REJECTED PATCH 59 + { + IBlockState iblockstate = this.getBlockState(blockpos); + +- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) ++ iblockstate.getBlock().onNeighborChange(this, blockpos, pos); ++ if (iblockstate.getBlock().isNormalCube(this, blockpos)) + { +- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); +- } +- else if (iblockstate.getBlock().isNormalCube()) +- { +- blockpos = blockpos.offset(enumfacing); +- iblockstate = this.getBlockState(blockpos); +- +- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) ++ BlockPos posOther = blockpos.offset(enumfacing); ++ Block other = getBlockState(posOther).getBlock(); ++ if (other.getWeakChanges(this, posOther)) + { +- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); ++ other.onNeighborChange(this, posOther, pos); + } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej b/rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej new file mode 100644 index 0000000000..de0d6369db --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej @@ -0,0 +1,47 @@ +++++ REJECTED PATCH 1 + + protected void registerWorldChunkManager() + { +- WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType(); +- +- if (worldtype == WorldType.FLAT) +- { +- FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions()); +- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), BiomeGenBase.field_180279_ad), 0.5F); +- } +- else if (worldtype == WorldType.DEBUG_WORLD) +- { +- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.0F); +- } +- else +- { +- this.worldChunkMgr = new WorldChunkManager(this.worldObj); +- } ++ this.worldChunkMgr = terrainType.getChunkManager(worldObj); + } + + public IChunkProvider createChunkGenerator() + { +- return (IChunkProvider)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings)))); ++ return terrainType.getChunkGenerator(worldObj, generatorSettings); + } + + public boolean canCoordinateBeSpawn(int x, int z) +++++ END PATCH +++++ REJECTED PATCH 2 + + public static WorldProvider getProviderForDimension(int dimension) + { +- return (WorldProvider)(dimension == -1 ? new WorldProviderHell() : (dimension == 0 ? new WorldProviderSurface() : (dimension == 1 ? new WorldProviderEnd() : null))); ++ return net.minecraftforge.common.DimensionManager.createProviderFor(dimension); + } + + @SideOnly(Side.CLIENT) + public float getCloudHeight() + { +- return 128.0F; ++ return this.terrainType.getCloudHeight(); + } + + @SideOnly(Side.CLIENT) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej b/rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej new file mode 100644 index 0000000000..217fa3a260 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej @@ -0,0 +1,108 @@ +++++ REJECTED PATCH 1 + private static final List bonusChestContent = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.stick, 0, 1, 3, 10), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.planks), 0, 1, 3, 10), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.log), 0, 1, 3, 10), new WeightedRandomChestContent(Items.stone_axe, 0, 1, 1, 3), new WeightedRandomChestContent(Items.wooden_axe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.stone_pickaxe, 0, 1, 1, 3), new WeightedRandomChestContent(Items.wooden_pickaxe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.apple, 0, 2, 3, 5), new WeightedRandomChestContent(Items.bread, 0, 2, 3, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.log2), 0, 1, 3, 10)}); + private List pendingTickListEntriesThisTick = Lists.newArrayList(); + ++ /** Stores the recently processed (lighting) chunks */ ++ protected Set doneChunks = new java.util.HashSet(); ++ public List customTeleporters = new ArrayList(); ++ private static boolean initChest = false; ++ public static void fillChestHook() ++ { ++ if (!initChest) ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.BONUS_CHEST, bonusChestContent, 10, 10); ++ initChest = true; ++ } ++ + public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) + { + super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false); + this.mcServer = server; + this.theEntityTracker = new EntityTracker(this); + this.thePlayerManager = new PlayerManager(this); ++ // Guarantee the dimension ID was not reset by the provider ++ int providerDim = this.provider.dimensionId; + this.provider.registerWorld(this); ++ this.provider.dimensionId = providerDim; + this.chunkProvider = this.createChunkProvider(); ++ perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn)); + this.worldTeleporter = new Teleporter(this); + this.calculateInitialSkylight(); + this.calculateInitialWeather(); + this.getWorldBorder().setSize(server.getMaxWorldSize()); ++ net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this); + } + + public World init() + { + this.mapStorage = new MapStorage(this.saveHandler); + String s = VillageCollection.fileNameForProvider(this.provider); +- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); ++ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); + + if (villagecollection == null) + { + this.villageCollectionObj = new VillageCollection(this); +- this.mapStorage.setData(s, this.villageCollectionObj); ++ this.perWorldStorage.setData(s, this.villageCollectionObj); + } + else + { +++++ END PATCH +++++ REJECTED PATCH 5 + chunk.func_150804_b(false); + this.theProfiler.endStartSection("thunder"); + +- if (this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) ++ if (this.provider.canDoLightning(chunk) && this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) + { + this.updateLCG = this.updateLCG * 3 + 1013904223; + int i1 = this.updateLCG >> 2; +++++ END PATCH +++++ REJECTED PATCH 12 + + protected void createBonusChest() + { +- WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(bonusChestContent, 10); ++ WorldGeneratorBonusChest worldgeneratorbonuschest = net.minecraftforge.common.ForgeHooks.getBonusChest(rand); + + for (int i = 0; i < 10; ++i) + { +++++ END PATCH +++++ REJECTED PATCH 13 + } + + this.chunkProvider.saveChunks(p_73044_1_, progressCallback); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); + + for (Chunk chunk : Lists.newArrayList(this.theChunkProviderServer.func_152380_a())) + { +++++ END PATCH +++++ REJECTED PATCH 16 + this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionId()); + } + ++ /* The function in use here has been replaced in order to only send the weather info to players in the correct dimension, ++ * rather than to all players on the server. This is what causes the client-side rain, as the ++ * client believes that it has started raining locally, rather than in another dimension. ++ */ + if (flag != this.isRaining()) + { + if (flag) + { +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F)); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(2, 0.0F), this.provider.dimensionId); + } + else + { +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(1, 0.0F)); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(1, 0.0F), this.provider.dimensionId); + } + +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, this.rainingStrength)); +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, this.thunderingStrength)); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch.rej b/rejects/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch.rej new file mode 100644 index 0000000000..5bc356b51f --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + { + public int getColorAtPos(BiomeGenBase p_180283_1_, BlockPos blockPosition) + { +- return p_180283_1_.waterColorMultiplier; ++ return p_180283_1_.getWaterColorMultiplier(); + } + }; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch.rej b/rejects/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch.rej new file mode 100644 index 0000000000..af1943cfc9 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch.rej @@ -0,0 +1,54 @@ +++++ REJECTED PATCH 1 + + protected void genDecorations(BiomeGenBase biomeGenBaseIn) + { ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(currentWorld, randomGenerator, field_180294_c)); + this.generateOres(); + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND)) + for (int i = 0; i < this.sandPerChunk2; ++i) + { + int j = this.randomGenerator.nextInt(16) + 8; +++++ END PATCH +++++ REJECTED PATCH 12 + this.reedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j9, i19, i13)); + } + } +- ++ } // End of Reed generation ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.PUMPKIN)) + if (this.randomGenerator.nextInt(32) == 0) + { + int i5 = this.randomGenerator.nextInt(16) + 8; +++++ END PATCH +++++ REJECTED PATCH 17 + + protected void generateOres() + { ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(currentWorld, randomGenerator, field_180294_c)); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, dirtGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIRT)) + this.genStandardOre1(this.chunkProviderSettings.dirtCount, this.dirtGen, this.chunkProviderSettings.dirtMinHeight, this.chunkProviderSettings.dirtMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, gravelGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRAVEL)) + this.genStandardOre1(this.chunkProviderSettings.gravelCount, this.gravelGen, this.chunkProviderSettings.gravelMinHeight, this.chunkProviderSettings.gravelMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, dioriteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIORITE)) + this.genStandardOre1(this.chunkProviderSettings.dioriteCount, this.dioriteGen, this.chunkProviderSettings.dioriteMinHeight, this.chunkProviderSettings.dioriteMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, graniteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRANITE)) + this.genStandardOre1(this.chunkProviderSettings.graniteCount, this.graniteGen, this.chunkProviderSettings.graniteMinHeight, this.chunkProviderSettings.graniteMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, andesiteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.ANDESITE)) + this.genStandardOre1(this.chunkProviderSettings.andesiteCount, this.andesiteGen, this.chunkProviderSettings.andesiteMinHeight, this.chunkProviderSettings.andesiteMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, coalGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.COAL)) + this.genStandardOre1(this.chunkProviderSettings.coalCount, this.coalGen, this.chunkProviderSettings.coalMinHeight, this.chunkProviderSettings.coalMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, ironGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.IRON)) + this.genStandardOre1(this.chunkProviderSettings.ironCount, this.ironGen, this.chunkProviderSettings.ironMinHeight, this.chunkProviderSettings.ironMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, goldGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GOLD)) + this.genStandardOre1(this.chunkProviderSettings.goldCount, this.goldGen, this.chunkProviderSettings.goldMinHeight, this.chunkProviderSettings.goldMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, redstoneGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.REDSTONE)) + this.genStandardOre1(this.chunkProviderSettings.redstoneCount, this.redstoneGen, this.chunkProviderSettings.redstoneMinHeight, this.chunkProviderSettings.redstoneMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, diamondGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIAMOND)) + this.genStandardOre1(this.chunkProviderSettings.diamondCount, this.diamondGen, this.chunkProviderSettings.diamondMinHeight, this.chunkProviderSettings.diamondMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, lapisGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.LAPIS)) + this.genStandardOre2(this.chunkProviderSettings.lapisCount, this.lapisGen, this.chunkProviderSettings.lapisCenterHeight, this.chunkProviderSettings.lapisSpread); ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(currentWorld, randomGenerator, field_180294_c)); + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch.rej b/rejects/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch.rej new file mode 100644 index 0000000000..583ee45c17 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch.rej @@ -0,0 +1,107 @@ +++++ REJECTED PATCH 1 + + public BiomeGenBase(int id) + { ++ this(id, true); ++ } ++ public BiomeGenBase(int id, boolean register) ++ { + this.minHeight = height_Default.rootHeight; + this.maxHeight = height_Default.variation; + this.temperature = 0.5F; +++++ END PATCH +++++ REJECTED PATCH 2 + this.worldGeneratorBigTree = new WorldGenBigTree(false); + this.worldGeneratorSwamp = new WorldGenSwamp(); + this.biomeID = id; ++ if (register) + biomeList[id] = this; + this.theBiomeDecorator = this.createBiomeDecorator(); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); +++++ END PATCH +++++ REJECTED PATCH 6 + } + } + ++ /* ========================================= FORGE START ======================================*/ ++ protected List flowers = new java.util.ArrayList(); ++ ++ public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) ++ { ++ return new net.minecraftforge.event.terraingen.DeferredBiomeDecorator(original); ++ } ++ ++ public int getWaterColorMultiplier() ++ { ++ net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor(this, waterColorMultiplier); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ return event.newColor; ++ } ++ ++ public int getModdedBiomeGrassColor(int original) ++ { ++ net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor(this, original); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ return event.newColor; ++ } ++ ++ public int getModdedBiomeFoliageColor(int original) ++ { ++ net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor(this, original); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ return event.newColor; ++ } ++ ++ /** ++ * Weighted random holder class used to hold possible flowers ++ * that can spawn in this biome when bonemeal is used on grass. ++ */ ++ public static class FlowerEntry extends WeightedRandom.Item ++ { ++ public final net.minecraft.block.state.IBlockState state; ++ public FlowerEntry(net.minecraft.block.state.IBlockState state, int weight) ++ { ++ super(weight); ++ this.state = state; ++ } ++ } ++ ++ /** ++ * Adds the default flowers, as of 1.7, it is 2 yellow, and 1 red. I chose 10 to allow some wiggle room in the numbers. ++ */ ++ public void addDefaultFlowers() ++ { ++ addFlower(Blocks.yellow_flower.getDefaultState().withProperty(Blocks.yellow_flower.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 20); ++ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); ++ } ++ ++ /** Register a new plant to be planted when bonemeal is used on grass. ++ * @param state The block to place. ++ * @param weight The weight of the plant, where red flowers are ++ * 10 and yellow flowers are 20. ++ */ ++ public void addFlower(IBlockState state, int weight) ++ { ++ this.flowers.add(new FlowerEntry(state, weight)); ++ } ++ ++ public void plantFlower(World world, Random rand, BlockPos pos) ++ { ++ FlowerEntry flower = (FlowerEntry)WeightedRandom.getRandomItem(rand, flowers); ++ if (flower == null || flower.state == null || ++ (flower.state.getBlock() instanceof net.minecraft.block.BlockBush && ++ !((net.minecraft.block.BlockBush)flower.state.getBlock()).canBlockStay(world, pos, flower.state))) ++ { ++ return; ++ } ++ ++ world.setBlockState(pos, flower.state, 3); ++ } ++ ++ ++ /* ========================================= FORGE END ======================================*/ ++ + static + { + plains.createMutation(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch.rej b/rejects/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch.rej new file mode 100644 index 0000000000..dfdca41dbb --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch.rej @@ -0,0 +1,47 @@ +++++ REJECTED PATCH 1 + + public class WorldChunkManager + { ++ public static List allowedBiomes = Lists.newArrayList(BiomeGenBase.forest, BiomeGenBase.plains, BiomeGenBase.taiga, BiomeGenBase.taigaHills, BiomeGenBase.forestHills, BiomeGenBase.jungle, BiomeGenBase.jungleHills); + private GenLayer genBiomes; + private GenLayer biomeIndexLayer; + private BiomeCache biomeCache; +++++ END PATCH +++++ REJECTED PATCH 2 + this.biomeCache = new BiomeCache(this); + this.field_180301_f = ""; + this.biomesToSpawnIn = Lists.newArrayList(); +- this.biomesToSpawnIn.add(BiomeGenBase.forest); +- this.biomesToSpawnIn.add(BiomeGenBase.plains); +- this.biomesToSpawnIn.add(BiomeGenBase.taiga); +- this.biomesToSpawnIn.add(BiomeGenBase.taigaHills); +- this.biomesToSpawnIn.add(BiomeGenBase.forestHills); +- this.biomesToSpawnIn.add(BiomeGenBase.jungle); +- this.biomesToSpawnIn.add(BiomeGenBase.jungleHills); ++ this.biomesToSpawnIn.addAll(allowedBiomes); + } + + public WorldChunkManager(long seed, WorldType p_i45744_3_, String p_i45744_4_) +++++ END PATCH +++++ REJECTED PATCH 3 + this(); + this.field_180301_f = p_i45744_4_; + GenLayer[] agenlayer = GenLayer.initializeAllBiomeGenerators(seed, p_i45744_3_, p_i45744_4_); ++ agenlayer = getModdedBiomeGenerators(p_i45744_3_, seed, agenlayer); + this.genBiomes = agenlayer[0]; + this.biomeIndexLayer = agenlayer[1]; + } +++++ END PATCH +++++ REJECTED PATCH 4 + { + this.biomeCache.cleanupCache(); + } ++ ++ public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original) ++ { ++ net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens event = new net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens(worldType, seed, original); ++ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); ++ return event.newBiomeGens; ++ } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/chunk/Chunk.java.patch.rej b/rejects/minecraft/net/minecraft/world/chunk/Chunk.java.patch.rej new file mode 100644 index 0000000000..f731b5fc2f --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/chunk/Chunk.java.patch.rej @@ -0,0 +1,98 @@ +++++ REJECTED PATCH 1 + { + Block block = this.getBlock0(j, l - 1, k); + +- if (block.getLightOpacity() != 0) ++ if (getBlockLightOpacity(j, l - 1, k) != 0) + { + this.heightMap[k << 4 | j] = l; + +++++ END PATCH +++++ REJECTED PATCH 2 + + public int getBlockLightOpacity(BlockPos pos) + { +- return this.getBlock(pos).getLightOpacity(); ++ return this.getBlock(pos).getLightOpacity(worldObj, pos); + } + + private int getBlockLightOpacity(int x, int y, int z) + { +- return this.getBlock0(x, y, z).getLightOpacity(); ++ return getBlockLightOpacity(new BlockPos((xPosition << 4) + x, y, (zPosition << 4) + z)); + } + + private Block getBlock0(int x, int y, int z) +++++ END PATCH +++++ REJECTED PATCH 5 + } + else + { +- int j1 = block.getLightOpacity(); +- int k1 = block1.getLightOpacity(); ++ int j1 = block.getLightOpacity(this.worldObj, pos); + + if (j1 > 0) + { +++++ END PATCH +++++ REJECTED PATCH 8 + private TileEntity createNewTileEntity(BlockPos pos) + { + Block block = this.getBlock(pos); +- return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, this.getBlockMetadata(pos)); ++ IBlockState state = block.getStateFromMeta(this.getBlockMetadata(pos)); ++ return !block.hasTileEntity(state) ? null : block.createTileEntity(this.worldObj, state); + } + + public TileEntity getTileEntity(BlockPos pos, Chunk.EnumCreateEntityType p_177424_2_) + { + TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(pos); + ++ if (tileentity != null && tileentity.isInvalid()) ++ { ++ chunkTileEntityMap.remove(pos); ++ tileentity = null; ++ } ++ + if (tileentity == null) + { + if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) +++++ END PATCH +++++ REJECTED PATCH 10 + tileEntityIn.setWorldObj(this.worldObj); + tileEntityIn.setPos(pos); + +- if (this.getBlock(pos) instanceof ITileEntityProvider) ++ if (this.getBlock(pos).hasTileEntity(getBlock(pos).getStateFromMeta(this.getBlockMetadata(pos)))) + { + if (this.chunkTileEntityMap.containsKey(pos)) + { +++++ END PATCH +++++ REJECTED PATCH 16 + while (!this.tileEntityPosQueue.isEmpty()) + { + BlockPos blockpos = (BlockPos)this.tileEntityPosQueue.poll(); ++ Block block = this.getBlock(blockpos); ++ IBlockState state = block.getStateFromMeta(this.getBlockMetadata(blockpos)); + +- if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.getBlock(blockpos).hasTileEntity()) ++ if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && block.hasTileEntity(state)) + { + TileEntity tileentity = this.createNewTileEntity(blockpos); + this.worldObj.setTileEntity(blockpos, tileentity); +++++ END PATCH +++++ REJECTED PATCH 17 + @SideOnly(Side.CLIENT) + public void fillChunk(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_) + { ++ for(TileEntity tileEntity : chunkTileEntityMap.values()) ++ { ++ tileEntity.updateContainingBlockInfo(); ++ tileEntity.getBlockMetadata(); ++ tileEntity.getBlockType(); ++ } ++ + int i = 0; + boolean flag = !this.worldObj.provider.getHasNoSky(); + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch.rej b/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch.rej new file mode 100644 index 0000000000..57276f7df4 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch.rej @@ -0,0 +1,41 @@ +++++ REJECTED PATCH 5 + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + ++ try ++ { + if (entity.writeToNBTOptional(nbttagcompound1)) + { + chunkIn.setHasEntities(true); + nbttaglist1.appendTag(nbttagcompound1); + } ++ } ++ catch (Exception e) ++ { ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, ++ "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author", ++ entity.getClass().getName()); ++ } + } + } + +++++ END PATCH +++++ REJECTED PATCH 6 + for (TileEntity tileentity : chunkIn.getTileEntityMap().values()) + { + NBTTagCompound nbttagcompound2 = new NBTTagCompound(); ++ try ++ { + tileentity.writeToNBT(nbttagcompound2); + nbttaglist2.appendTag(nbttagcompound2); ++ } ++ catch (Exception e) ++ { ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, ++ "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author", ++ tileentity.getClass().getName()); ++ } + } + + p_75820_3_.setTag("TileEntities", nbttaglist2); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej b/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej new file mode 100644 index 0000000000..4836be7fc7 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej @@ -0,0 +1,22 @@ +++++ REJECTED PATCH 1 + { + File file1 = this.getWorldDirectory(); + +- if (provider instanceof WorldProviderHell) ++ if (provider.getSaveFolder() != null) + { +- File file3 = new File(file1, "DIM-1"); ++ File file3 = new File(file1, provider.getSaveFolder()); + file3.mkdirs(); + return new AnvilChunkLoader(file3); + } +- else if (provider instanceof WorldProviderEnd) +- { +- File file2 = new File(file1, "DIM1"); +- file2.mkdirs(); +- return new AnvilChunkLoader(file2); +- } + else + { + return new AnvilChunkLoader(file1); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch.rej new file mode 100644 index 0000000000..650a6183f6 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch.rej @@ -0,0 +1,60 @@ +++++ REJECTED PATCH 1 + double[] noiseData3; + double[] noiseData4; + double[] noiseData5; ++ // temporary variables used during event handling ++ private int chunkX = 0; ++ private int chunkZ = 0; + + public ChunkProviderEnd(World worldIn, long p_i2007_2_) + { +++++ END PATCH +++++ REJECTED PATCH 2 + this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, 8); + this.noiseGen4 = new NoiseGeneratorOctaves(this.endRNG, 10); + this.noiseGen5 = new NoiseGeneratorOctaves(this.endRNG, 16); ++ ++ NoiseGenerator[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5}; ++ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.endRNG, noiseGens); ++ this.noiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; ++ this.noiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; ++ this.noiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; ++ this.noiseGen4 = (NoiseGeneratorOctaves)noiseGens[3]; ++ this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; + } + + public void func_180520_a(int p_180520_1_, int p_180520_2_, ChunkPrimer p_180520_3_) +++++ END PATCH +++++ REJECTED PATCH 4 + + public Chunk provideChunk(int x, int z) + { ++ chunkX = x; chunkZ = z; + this.endRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L); + ChunkPrimer chunkprimer = new ChunkPrimer(); + this.biomesForGeneration = this.endWorld.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); +++++ END PATCH +++++ REJECTED PATCH 5 + + private double[] initializeNoiseField(double[] p_73187_1_, int p_73187_2_, int p_73187_3_, int p_73187_4_, int p_73187_5_, int p_73187_6_, int p_73187_7_) + { ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField(this, p_73187_1_, p_73187_2_, p_73187_3_, p_73187_4_, p_73187_5_, p_73187_6_, p_73187_7_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; ++ + if (p_73187_1_ == null) + { + p_73187_1_ = new double[p_73187_5_ * p_73187_6_ * p_73187_7_]; +++++ END PATCH +++++ REJECTED PATCH 6 + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + { + BlockFalling.fallInstantly = true; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, endWorld, endWorld.rand, p_73153_2_, p_73153_3_, false)); + BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); + this.endWorld.getBiomeGenForCoords(blockpos.add(16, 0, 16)).decorate(this.endWorld, this.endWorld.rand, blockpos); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, endWorld, endWorld.rand, p_73153_2_, p_73153_3_, false)); + BlockFalling.fallInstantly = false; + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch.rej new file mode 100644 index 0000000000..c97f247612 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch.rej @@ -0,0 +1,117 @@ +++++ REJECTED PATCH 1 + + public ChunkProviderGenerate(World worldIn, long p_i45636_2_, boolean p_i45636_4_, String p_i45636_5_) + { ++ { ++ caveGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(caveGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE); ++ strongholdGenerator = (MapGenStronghold)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(strongholdGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD); ++ villageGenerator = (MapGenVillage)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(villageGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE); ++ mineshaftGenerator = (MapGenMineshaft)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(mineshaftGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT); ++ scatteredFeatureGenerator = (MapGenScatteredFeature)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(scatteredFeatureGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE); ++ ravineGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(ravineGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE); ++ oceanMonumentGenerator = (StructureOceanMonument)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(oceanMonumentGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.OCEAN_MONUMENT); ++ } + this.worldObj = worldIn; + this.mapFeaturesEnabled = p_i45636_4_; + this.field_177475_o = worldIn.getWorldInfo().getTerrainType(); +++++ END PATCH +++++ REJECTED PATCH 2 + this.field_177476_s = this.settings.useLavaOceans ? Blocks.lava : Blocks.water; + worldIn.setSeaLevel(this.settings.seaLevel); + } ++ ++ NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, noiseGen5, noiseGen6, mobSpawnerNoise}; ++ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.rand, noiseGens); ++ this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0]; ++ this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1]; ++ this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2]; ++ this.field_147430_m = (NoiseGeneratorPerlin)noiseGens[3]; ++ this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; ++ this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; ++ this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6]; + } + + public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) +++++ END PATCH +++++ REJECTED PATCH 3 + + public void replaceBlocksForBiome(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) + { ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.worldObj); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; ++ + double d0 = 0.03125D; + this.stoneNoise = this.field_147430_m.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); + +++++ END PATCH +++++ REJECTED PATCH 4 + boolean flag = false; + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); ++ + if (this.settings.useMineShafts && this.mapFeaturesEnabled) + { + this.mineshaftGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair); +++++ END PATCH +++++ REJECTED PATCH 5 + this.oceanMonumentGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair); + } + +- if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0) ++ if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0 ++ && net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) + { + int i1 = this.rand.nextInt(16) + 8; + int j1 = this.rand.nextInt(256); +++++ END PATCH +++++ REJECTED PATCH 6 + (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, blockpos.add(i1, j1, k1)); + } + +- if (!flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes) ++ if (!flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes && ++ net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA)) + { + int i2 = this.rand.nextInt(16) + 8; + int l2 = this.rand.nextInt(this.rand.nextInt(248) + 8); +++++ END PATCH +++++ REJECTED PATCH 7 + + if (this.settings.useDungeons) + { +- for (int j2 = 0; j2 < this.settings.dungeonChance; ++j2) ++ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON); ++ for (int j2 = 0; doGen && j2 < this.settings.dungeonChance; ++j2) + { + int i3 = this.rand.nextInt(16) + 8; + int l3 = this.rand.nextInt(256); +++++ END PATCH +++++ REJECTED PATCH 8 + } + + biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(i, 0, j)); ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS)) ++ { + SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, i + 8, j + 8, 16, 16, this.rand); ++ } + blockpos = blockpos.add(8, 0, 8); + +- for (int k2 = 0; k2 < 16; ++k2) ++ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE); ++ for (int k2 = 0; doGen && k2 < 16; ++k2) + { + for (int j3 = 0; j3 < 16; ++j3) + { +++++ END PATCH +++++ REJECTED PATCH 9 + } + } + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); ++ + BlockFalling.fallInstantly = false; + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch.rej new file mode 100644 index 0000000000..5eac183f2a --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch.rej @@ -0,0 +1,144 @@ +++++ REJECTED PATCH 1 + private final WorldGenHellLava field_177472_y = new WorldGenHellLava(Blocks.flowing_lava, false); + private final GeneratorBushFeature field_177471_z = new GeneratorBushFeature(Blocks.brown_mushroom); + private final GeneratorBushFeature field_177465_A = new GeneratorBushFeature(Blocks.red_mushroom); +- private final MapGenNetherBridge genNetherBridge = new MapGenNetherBridge(); +- private final MapGenBase netherCaveGenerator = new MapGenCavesHell(); ++ private final MapGenNetherBridge genNetherBridge; ++ private final MapGenBase netherCaveGenerator; + double[] noiseData1; + double[] noiseData2; + double[] noiseData3; +++++ END PATCH +++++ REJECTED PATCH 2 + + public ChunkProviderHell(World worldIn, boolean p_i45637_2_, long p_i45637_3_) + { ++ this.genNetherBridge = (MapGenNetherBridge) net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(new MapGenNetherBridge(), net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_BRIDGE); ++ this.netherCaveGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(new MapGenCavesHell(), net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_CAVE); + this.worldObj = worldIn; + this.field_177466_i = p_i45637_2_; + this.hellRNG = new Random(p_i45637_3_); +- this.netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); +- this.netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); +- this.netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); +- this.slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); +- this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); +- this.netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); +- this.netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); ++ NoiseGeneratorOctaves netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); ++ NoiseGeneratorOctaves netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); ++ NoiseGeneratorOctaves netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); ++ NoiseGeneratorOctaves slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); ++ NoiseGeneratorOctaves netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); ++ NoiseGeneratorOctaves netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); ++ NoiseGeneratorOctaves netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); ++ NoiseGenerator[] noiseGens = new NoiseGenerator[] { ++ netherNoiseGen1, netherNoiseGen2, netherNoiseGen3, slowsandGravelNoiseGen, netherrackExculsivityNoiseGen, netherNoiseGen6, netherNoiseGen7 ++ }; ++ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.hellRNG, noiseGens); ++ this.netherNoiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; ++ this.netherNoiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; ++ this.netherNoiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; ++ this.slowsandGravelNoiseGen = (NoiseGeneratorOctaves)noiseGens[3]; ++ this.netherrackExculsivityNoiseGen = (NoiseGeneratorOctaves)noiseGens[4]; ++ this.netherNoiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; ++ this.netherNoiseGen7 = (NoiseGeneratorOctaves)noiseGens[6]; + worldIn.setSeaLevel(63); + } + +++++ END PATCH +++++ REJECTED PATCH 3 + + public void func_180516_b(int p_180516_1_, int p_180516_2_, ChunkPrimer p_180516_3_) + { ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180516_1_, p_180516_2_, p_180516_3_, this.worldObj); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; ++ + int i = this.worldObj.getSeaLevel() + 1; + double d0 = 0.03125D; + this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, p_180516_1_ * 16, p_180516_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); +++++ END PATCH +++++ REJECTED PATCH 4 + + private double[] initializeNoiseField(double[] p_73164_1_, int p_73164_2_, int p_73164_3_, int p_73164_4_, int p_73164_5_, int p_73164_6_, int p_73164_7_) + { ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField(this, p_73164_1_, p_73164_2_, p_73164_3_, p_73164_4_, p_73164_5_, p_73164_6_, p_73164_7_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; ++ + if (p_73164_1_ == null) + { + p_73164_1_ = new double[p_73164_5_ * p_73164_6_ * p_73164_7_]; +++++ END PATCH +++++ REJECTED PATCH 5 + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + { + BlockFalling.fallInstantly = true; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false)); + BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); + this.genNetherBridge.generateStructure(this.worldObj, this.hellRNG, chunkcoordintpair); + +- for (int i = 0; i < 8; ++i) ++ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA); ++ for (int i = 0; doGen && i < 8; ++i) + { + this.field_177472_y.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + } + +- for (int j = 0; j < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++j) ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.FIRE); ++ for (int j = 0; doGen && j < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++j) + { + this.field_177470_t.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + } + +- for (int k = 0; k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.GLOWSTONE); ++ for (int k = 0; doGen && k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) + { + this.field_177469_u.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + } + +- for (int l = 0; l < 10; ++l) ++ for (int l = 0; doGen && l < 10; ++l) + { + this.field_177468_v.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + } + +- if (this.hellRNG.nextBoolean()) ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(worldObj, hellRNG, blockpos)); ++ ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.decorate(worldObj, hellRNG, blockpos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM); ++ if (doGen && this.hellRNG.nextBoolean()) + { + this.field_177471_z.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + } + +- if (this.hellRNG.nextBoolean()) ++ if (doGen && this.hellRNG.nextBoolean()) + { + this.field_177465_A.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + } + +- for (int i1 = 0; i1 < 16; ++i1) ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.generateOre(worldObj, hellRNG, field_177467_w, blockpos, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.QUARTZ); ++ for (int i1 = 0; doGen && i1 < 16; ++i1) + { + this.field_177467_w.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); + } + +- for (int j1 = 0; j1 < 16; ++j1) ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA2); ++ for (int j1 = 0; doGen && j1 < 16; ++j1) + { + this.field_177473_x.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); + } + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false)); + BlockFalling.fallInstantly = false; + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch.rej new file mode 100644 index 0000000000..e4824e612c --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch.rej @@ -0,0 +1,85 @@ +++++ REJECTED PATCH 2 + + public void dropChunk(int x, int z) + { +- if (this.worldObj.provider.canRespawnHere()) ++ if (this.worldObj.provider.canRespawnHere() && net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimensionId())) + { + if (!this.worldObj.isSpawnChunk(x, z)) + { +++++ END PATCH +++++ REJECTED PATCH 3 + + public Chunk loadChunk(int p_73158_1_, int p_73158_2_) + { ++ return loadChunk(p_73158_1_, p_73158_2_, null); ++ } ++ ++ public Chunk loadChunk(int par1, int par2, Runnable runnable) ++ { ++ long k = ChunkCoordIntPair.chunkXZ2Int(par1, par2); ++ this.droppedChunksSet.remove(Long.valueOf(k)); ++ Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(k); ++ net.minecraft.world.chunk.storage.AnvilChunkLoader loader = null; ++ ++ if (this.chunkLoader instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader) ++ { ++ loader = (net.minecraft.world.chunk.storage.AnvilChunkLoader) this.chunkLoader; ++ } ++ ++ // We can only use the queue for already generated chunks ++ if (chunk == null && loader != null && loader.chunkExists(this.worldObj, par1, par2)) ++ { ++ if (runnable != null) ++ { ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.queueChunkLoad(this.worldObj, loader, this, par1, par2, runnable); ++ return null; ++ } ++ else ++ { ++ chunk = net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(this.worldObj, loader, this, par1, par2); ++ } ++ } ++ else if (chunk == null) ++ { ++ chunk = this.originalLoadChunk(par1, par2); ++ } ++ ++ // If we didn't load the chunk async and have a callback run it now ++ if (runnable != null) ++ { ++ runnable.run(); ++ } ++ ++ return chunk; ++ } ++ ++ public Chunk originalLoadChunk(int p_73158_1_, int p_73158_2_) ++ { + long i = ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_); + this.droppedChunksSet.remove(Long.valueOf(i)); + Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(i); + + if (chunk == null) + { ++ boolean added = loadingChunks.add(i); ++ if (!added) ++ { ++ net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in di >mension %d that is already being loaded. This will cause weird chunk breakages.", p_73158_1_, p_73158_2_, worldObj.provider.getDimensionId()); ++ } ++ chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(i, this.worldObj); ++ ++ if (chunk == null) + chunk = this.loadChunkFromFile(p_73158_1_, p_73158_2_); + + if (chunk == null) +++++ END PATCH +++++ REJECTED PATCH 5 + if (this.serverChunkGenerator != null) + { + this.serverChunkGenerator.populate(p_73153_1_, p_73153_2_, p_73153_3_); ++ net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(p_73153_2_, p_73153_3_, worldObj, serverChunkGenerator, p_73153_1_); + chunk.setChunkModified(); + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch.rej new file mode 100644 index 0000000000..5fce173028 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch.rej @@ -0,0 +1,37 @@ +++++ REJECTED PATCH 2 + IBlockState iblockstate1 = p_180702_5_.getBlockState(j3, j2, i2); + IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.getBlockState(j3, j2 + 1, i2), Blocks.air.getDefaultState()); + +- if (iblockstate1.getBlock() == Blocks.grass || iblockstate1.getBlock() == Blocks.mycelium) ++ if (isTopBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_)) + { + flag1 = true; + } + +- if (this.func_175793_a(iblockstate1, iblockstate2)) +- { +- if (j2 - 1 < 10) +- { +- p_180702_5_.setBlockState(j3, j2, i2, Blocks.lava.getDefaultState()); +- } +- else +- { +- p_180702_5_.setBlockState(j3, j2, i2, Blocks.air.getDefaultState()); +- +- if (iblockstate2.getBlock() == Blocks.sand) +- { +- p_180702_5_.setBlockState(j3, j2 + 1, i2, iblockstate2.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState()); +- } +- +- if (flag1 && p_180702_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) +- { +- blockpos$mutableblockpos.set(j3 + p_180702_3_ * 16, 0, i2 + p_180702_4_ * 16); +- p_180702_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock.getBlock().getDefaultState()); +- } +- } +- } ++ digBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2); + } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej new file mode 100644 index 0000000000..cf2327018b --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej @@ -0,0 +1,32 @@ +++++ REJECTED PATCH 2 + { + IBlockState iblockstate1 = p_180707_5_.getBlockState(j3, j2, i2); + +- if (iblockstate1.getBlock() == Blocks.grass) ++ if (isTopBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_)) + { + flag = true; + } + +- if (iblockstate1.getBlock() == Blocks.stone || iblockstate1.getBlock() == Blocks.dirt || iblockstate1.getBlock() == Blocks.grass) +- { +- if (j2 - 1 < 10) +- { +- p_180707_5_.setBlockState(j3, j2, i2, Blocks.flowing_lava.getDefaultState()); +- } +- else +- { +- p_180707_5_.setBlockState(j3, j2, i2, Blocks.air.getDefaultState()); +- +- if (flag && p_180707_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) +- { +- blockpos$mutableblockpos.set(j3 + p_180707_3_ * 16, 0, i2 + p_180707_4_ * 16); +- p_180707_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock); +- } +- } +- } ++ digBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_, flag); + } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej new file mode 100644 index 0000000000..9bb5153656 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej @@ -0,0 +1,34 @@ +++++ REJECTED PATCH 1 + { + Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock(); + +- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) ++ if (!block.isAir(worldIn, blockpos$mutableblockpos) && !block.isLeaves(worldIn, blockpos$mutableblockpos)) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + { + BlockPos blockpos = new BlockPos(l1, l2, i2); + +- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.mushroomType.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, blockhugemushroom$enumtype)); + } +++++ END PATCH +++++ REJECTED PATCH 3 + + for (int i3 = 0; i3 < i; ++i3) + { +- Block block2 = worldIn.getBlockState(position.up(i3)).getBlock(); ++ BlockPos upN = position.up(i3); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(upN); + +- if (!block2.isFullBlock()) ++ if (state.getBlock().canBeReplacedByLeaves(worldIn, upN)) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(i3), this.mushroomType.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, BlockHugeMushroom.EnumType.STEM)); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej new file mode 100644 index 0000000000..2dc3f7fbe6 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej @@ -0,0 +1,13 @@ +++++ REJECTED PATCH 1 + if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_181631_2_ * p_181631_2_)) + { + BlockPos blockpos = p_181631_1_.add(j, 0, k); +- Material material = this.world.getBlockState(blockpos).getBlock().getMaterial(); ++ net.minecraft.block.state.IBlockState state = this.world.getBlockState(blockpos); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(this.world, blockpos) || state.getBlock().isLeaves(this.world, blockpos)) + { + this.setBlockAndNotifyAdequately(this.world, blockpos, p_181631_3_); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej new file mode 100644 index 0000000000..f2c7e0fb92 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej @@ -0,0 +1,34 @@ +++++ REJECTED PATCH 3 + + int k2 = k + j2; + BlockPos blockpos1 = new BlockPos(k1, k2, l1); +- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ state = worldIn.getBlockState(blockpos1); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(worldIn, blockpos1) || state.getBlock().isLeaves(worldIn, blockpos1)) + { + this.func_181639_b(worldIn, blockpos1); + this.func_181639_b(worldIn, blockpos1.east()); +++++ END PATCH +++++ REJECTED PATCH 5 + private void func_150526_a(World worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) + { + BlockPos blockpos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); +- Block block = worldIn.getBlockState(blockpos).getBlock(); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); + +- if (block.getMaterial() == Material.air) ++ if (state.getBlock().isAir(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181641_b); + } + } ++ ++ //Just a helper macro ++ private void onPlantGrow(World world, BlockPos pos, BlockPos source) ++ { ++ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); ++ } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch.rej new file mode 100644 index 0000000000..114439852b --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch.rej @@ -0,0 +1,16 @@ +++++ REJECTED PATCH 1 + { + Block block; + +- while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0) ++ do + { ++ block = worldIn.getBlockState(position).getBlock(); ++ if (!block.isLeaves(worldIn, position) && !block.isLeaves(worldIn, position)) break; + position = position.down(); +- } ++ } while (position.getY() > 0); + + for (int i = 0; i < 4; ++i) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch.rej new file mode 100644 index 0000000000..e3b9ce02bd --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch.rej @@ -0,0 +1,15 @@ +++++ REJECTED PATCH 1 + if (j3 == 1) + { + worldIn.setBlockState(blockpos2, Blocks.chest.correctFacing(worldIn, blockpos2, Blocks.chest.getDefaultState()), 2); +- List list = WeightedRandomChestContent.func_177629_a(CHESTCONTENT, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(rand)}); + TileEntity tileentity1 = worldIn.getTileEntity(blockpos2); + + if (tileentity1 instanceof TileEntityChest) + { +- WeightedRandomChestContent.generateChestContents(rand, list, (TileEntityChest)tileentity1, 8); ++ WeightedRandomChestContent.generateChestContents(rand, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, rand), (TileEntityChest)tileentity1, 8); + } + + break; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej new file mode 100644 index 0000000000..2f590ff3aa --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej @@ -0,0 +1,52 @@ +++++ REJECTED PATCH 1 + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock())) ++ if (!this.isReplaceable(worldIn, blockpos$mutableblockpos.set(l, j, i1))) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { +- Block block1 = worldIn.getBlockState(position.down()).getBlock(); ++ 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)); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 256 - i - 1) ++ if (isSoil && position.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, position.down()); ++ block1.onPlantGrow(worldIn, down, position); + + for (int i2 = position.getY() - 3 + i; i2 <= position.getY() + i; ++i2) + { +++++ END PATCH +++++ REJECTED PATCH 3 + BlockPos blockpos = new BlockPos(i3, i2, k1); + Block block = worldIn.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181630_b); + } +++++ END PATCH +++++ REJECTED PATCH 4 + + for (int j2 = 0; j2 < i; ++j2) + { +- Block block2 = worldIn.getBlockState(position.up(j2)).getBlock(); +- +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) ++ BlockPos upN = position.up(j2); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(j2), field_181629_a); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej new file mode 100644 index 0000000000..140ae96593 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej @@ -0,0 +1,26 @@ +++++ REJECTED PATCH 3 + if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) + { + BlockPos blockpos = p_175925_2_.add(j, 0, k); +- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(worldIn, blockpos) || state.getBlock().isLeaves(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); + } +++++ END PATCH +++++ REJECTED PATCH 4 + if (j * j + k * k <= i) + { + BlockPos blockpos = p_175928_2_.add(j, 0, k); +- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); ++ Block block = worldIn.getBlockState(blockpos).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej new file mode 100644 index 0000000000..1009b02d7e --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej @@ -0,0 +1,63 @@ +++++ REJECTED PATCH 1 + { + Block block = worldIn.getBlockState(position.up(j)).getBlock(); + +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (isAirLeaves(worldIn,position.up(j))) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(j), this.woodMetadata); + } + + if (j < i - 1) + { +- block = worldIn.getBlockState(position.add(1, j, 0)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (isAirLeaves(worldIn,position.add(1, j, 0))) + { + this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 0), this.woodMetadata); + } + +- block = worldIn.getBlockState(position.add(1, j, 1)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (isAirLeaves(worldIn,position.add(1, j, 1))) + { + this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 1), this.woodMetadata); + } + +- block = worldIn.getBlockState(position.add(0, j, 1)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (isAirLeaves(worldIn,position.add(0, j, 1))) + { + this.setBlockAndNotifyAdequately(worldIn, position.add(0, j, 1), this.woodMetadata); + } +++++ END PATCH +++++ REJECTED PATCH 2 + BlockPos blockpos = p_175934_2_.up(i); + Block block = worldIn.getBlockState(blockpos).getBlock(); + +- if (block == Blocks.grass || block == Blocks.dirt) ++ if (block.canSustainPlant(worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181635_g); + break; + } + +- if (block.getMaterial() != Material.air && i < 0) ++ if (!block.isAir(worldIn, blockpos) && i < 0) + { + break; + } + } + } ++ ++ //Helper macro ++ private boolean isAirLeaves(World world, BlockPos pos) ++ { ++ net.minecraft.block.Block block = world.getBlockState(pos).getBlock(); ++ return block.isAir(world, pos) || block.isLeaves(world, pos); ++ } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej new file mode 100644 index 0000000000..3072ebfaf2 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej @@ -0,0 +1,39 @@ +++++ REJECTED PATCH 3 + } + + BlockPos blockpos = new BlockPos(i3, i2, j1); +- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); ++ block = worldIn.getBlockState(blockpos).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) + { + this.func_181642_b(worldIn, blockpos); + k1 = i2; +++++ END PATCH +++++ REJECTED PATCH 4 + i3 += enumfacing1.getFrontOffsetX(); + j1 += enumfacing1.getFrontOffsetZ(); + BlockPos blockpos1 = new BlockPos(i3, j2, j1); +- Material material1 = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ block = worldIn.getBlockState(blockpos1).getBlock(); + +- if (material1 == Material.air || material1 == Material.leaves) ++ if (block.isAir(worldIn, blockpos2) || block.isLeaves(worldIn, blockpos2)) + { + this.func_181642_b(worldIn, blockpos1); + k1 = j2; +++++ END PATCH +++++ REJECTED PATCH 5 + + private void func_175924_b(World worldIn, BlockPos p_175924_2_) + { +- Material material = worldIn.getBlockState(p_175924_2_).getBlock().getMaterial(); ++ Block block = worldIn.getBlockState(p_175924_2_).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, p_175924_2_) || block.isLeaves(worldIn, p_175924_2_)) + { + this.setBlockAndNotifyAdequately(worldIn, p_175924_2_, field_181644_b); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej new file mode 100644 index 0000000000..3123677dfc --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej @@ -0,0 +1,31 @@ +++++ REJECTED PATCH 1 + { + Block block; + +- while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0) ++ do + { ++ block = worldIn.getBlockState(position).getBlock(); ++ if (!block.isAir(worldIn, position) && !block.isLeaves(worldIn, position)) break; + position = position.down(); +- } ++ } while (position.getY() > 0); + + Block block1 = worldIn.getBlockState(position).getBlock(); + +- if (block1 == Blocks.dirt || block1 == Blocks.grass) ++ if (block1.canSustainPlant(worldIn, position, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) + { + position = position.up(); + this.setBlockAndNotifyAdequately(worldIn, position, this.woodMetadata); +++++ END PATCH +++++ REJECTED PATCH 2 + { + BlockPos blockpos = new BlockPos(l, i, j1); + +- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej new file mode 100644 index 0000000000..da11cee0f2 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej @@ -0,0 +1,80 @@ +++++ REJECTED PATCH 1 + { + Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock(); + +- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) ++ if (!block.isAir(worldIn, blockpos$mutableblockpos.set(l, j, i1)) && !block.isLeaves(worldIn, blockpos$mutableblockpos.set(l, j, i1))) + { + if (block != Blocks.water && block != Blocks.flowing_water) + { +++++ END PATCH +++++ REJECTED PATCH 3 + { + BlockPos blockpos = new BlockPos(k3, l1, j1); + +- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181649_b); + } +++++ END PATCH +++++ REJECTED PATCH 4 + + for (int i2 = 0; i2 < i; ++i2) + { +- Block block2 = worldIn.getBlockState(position.up(i2)).getBlock(); ++ BlockPos upN = position.up(i2); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2 == Blocks.flowing_water || block2 == Blocks.water) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2 == Blocks.flowing_water || block2 == Blocks.water) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(i2), field_181648_a); + } +++++ END PATCH +++++ REJECTED PATCH 5 + { + blockpos$mutableblockpos1.set(i4, j2, j4); + +- if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.leaves) ++ if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().isLeaves(worldIn, blockpos$mutableblockpos1)) + { + BlockPos blockpos3 = blockpos$mutableblockpos1.west(); + BlockPos blockpos4 = blockpos$mutableblockpos1.east(); + BlockPos blockpos1 = blockpos$mutableblockpos1.north(); + BlockPos blockpos2 = blockpos$mutableblockpos1.south(); + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn,blockpos3)) + { + this.func_181647_a(worldIn, blockpos3, BlockVine.EAST); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn,blockpos4)) + { + this.func_181647_a(worldIn, blockpos4, BlockVine.WEST); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn,blockpos1)) + { + this.func_181647_a(worldIn, blockpos1, BlockVine.SOUTH); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn,blockpos2)) + { + this.func_181647_a(worldIn, blockpos2, BlockVine.NORTH); + } +++++ END PATCH +++++ REJECTED PATCH 6 + this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); + int i = 4; + +- for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).getBlock().getMaterial() == Material.air && i > 0; --i) ++ for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).getBlock().isAir(p_181647_1_,p_181647_2_) && i > 0; --i) + { + this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); + p_181647_2_ = p_181647_2_.down(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej new file mode 100644 index 0000000000..69dac58c70 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej @@ -0,0 +1,24 @@ +++++ REJECTED PATCH 3 + { + BlockPos blockpos = new BlockPos(j3, l2, i2); + +- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181637_b); + } +++++ END PATCH +++++ REJECTED PATCH 4 + + for (int i3 = 0; i3 < i - 1; ++i3) + { +- Block block1 = worldIn.getBlockState(position.up(i3)).getBlock(); ++ BlockPos upN = position.up(i3); ++ Block block1 = worldIn.getBlockState(upN).getBlock(); + +- if (block1.getMaterial() == Material.air || block1.getMaterial() == Material.leaves) ++ if (block1.isAir(worldIn, upN) || block1.isLeaves(worldIn, upN)) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(i3), field_181636_a); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej new file mode 100644 index 0000000000..c239c82d24 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej @@ -0,0 +1,52 @@ +++++ REJECTED PATCH 1 + { + Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(k1, i1, l1)).getBlock(); + +- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) ++ if (!block.isAir(worldIn, blockpos$mutableblockpos) && !block.isLeaves(worldIn, blockpos$mutableblockpos)) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { +- Block block1 = worldIn.getBlockState(position.down()).getBlock(); ++ 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); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 256 - i - 1) ++ if (isSoil && position.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, position.down()); ++ block1.onPlantGrow(worldIn, down, position); + int i3 = rand.nextInt(2); + int j3 = 1; + int k3 = 0; +++++ END PATCH +++++ REJECTED PATCH 3 + { + BlockPos blockpos = new BlockPos(i2, j4, k2); + +- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181646_b); + } +++++ END PATCH +++++ REJECTED PATCH 4 + + for (int k4 = 0; k4 < i - i4; ++k4) + { +- Block block2 = worldIn.getBlockState(position.up(k4)).getBlock(); ++ BlockPos upN = position.up(k4); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(k4), field_181645_a); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch.rej new file mode 100644 index 0000000000..8e41645a26 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch.rej @@ -0,0 +1,16 @@ +++++ REJECTED PATCH 1 + { + Block block; + +- while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0) ++ do + { ++ block = worldIn.getBlockState(position).getBlock(); ++ if (!block.isAir(worldIn, position) && !block.isLeaves(worldIn, position)) break; + position = position.down(); +- } ++ } while (position.getY() > 0); + + for (int i = 0; i < 128; ++i) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej new file mode 100644 index 0000000000..4476c426aa --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej @@ -0,0 +1,88 @@ +++++ REJECTED PATCH 2 + } + else + { +- Block block1 = worldIn.getBlockState(position.down()).getBlock(); ++ 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); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 256 - i - 1) ++ if (isSoil && position.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, position.down()); ++ block1.onPlantGrow(worldIn, down, position); + int k2 = 3; + int l2 = 0; + +++++ END PATCH +++++ REJECTED PATCH 3 + BlockPos blockpos = new BlockPos(k1, i3, i2); + Block block = worldIn.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine) ++ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos) || block.getMaterial() == Material.vine) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves); + } +++++ END PATCH +++++ REJECTED PATCH 4 + + for (int j3 = 0; j3 < i; ++j3) + { +- Block block2 = worldIn.getBlockState(position.up(j3)).getBlock(); ++ BlockPos upN = position.up(j3); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2.getMaterial() == Material.vine) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2.getMaterial() == Material.vine) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood); + +++++ END PATCH +++++ REJECTED PATCH 5 + { + blockpos$mutableblockpos1.set(l4, k3, i5); + +- if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.leaves) ++ if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().isLeaves(worldIn,blockpos$mutableblockpos1)) + { + BlockPos blockpos2 = blockpos$mutableblockpos1.west(); + BlockPos blockpos3 = blockpos$mutableblockpos1.east(); + BlockPos blockpos4 = blockpos$mutableblockpos1.north(); + BlockPos blockpos1 = blockpos$mutableblockpos1.south(); + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn,blockpos2)) + { + this.func_181650_b(worldIn, blockpos2, BlockVine.EAST); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn,blockpos3)) + { + this.func_181650_b(worldIn, blockpos3, BlockVine.WEST); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn,blockpos4)) + { + this.func_181650_b(worldIn, blockpos4, BlockVine.SOUTH); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn,blockpos1)) + { + this.func_181650_b(worldIn, blockpos1, BlockVine.NORTH); + } +++++ END PATCH +++++ REJECTED PATCH 6 + this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); + int i = 4; + +- for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).getBlock().getMaterial() == Material.air && i > 0; --i) ++ for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).getBlock().isAir(p_181650_1_,p_181650_2_) && i > 0; --i) + { + this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); + p_181650_2_ = p_181650_2_.down(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch.rej new file mode 100644 index 0000000000..c80d1d0f2d --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch.rej @@ -0,0 +1,16 @@ +++++ REJECTED PATCH 1 + { + Block block; + +- while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 1) ++ do + { ++ block = worldIn.getBlockState(position).getBlock(); ++ if (!block.isAir(worldIn, position) && !block.isLeaves(worldIn, position)) break; + position = position.down(); +- } ++ } while (position.getY() > 0); + + if (position.getY() < 1) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch.rej new file mode 100644 index 0000000000..2a00cca4ab --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + + protected static boolean isBiomeOceanic(int p_151618_0_) + { +- return p_151618_0_ == BiomeGenBase.ocean.biomeID || p_151618_0_ == BiomeGenBase.deepOcean.biomeID || p_151618_0_ == BiomeGenBase.frozenOcean.biomeID; ++ return net.minecraftforge.common.BiomeManager.oceanBiomes.contains(BiomeGenBase.getBiome(p_151618_0_)); + } + + protected int selectRandom(int... p_151619_1_) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch.rej new file mode 100644 index 0000000000..e2267751c0 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch.rej @@ -0,0 +1,84 @@ +++++ REJECTED PATCH 1 + + public class GenLayerBiome extends GenLayer + { +- private BiomeGenBase[] field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.savanna, BiomeGenBase.savanna, BiomeGenBase.plains}; +- private BiomeGenBase[] field_151621_d = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.roofedForest, BiomeGenBase.extremeHills, BiomeGenBase.plains, BiomeGenBase.birchForest, BiomeGenBase.swampland}; +- private BiomeGenBase[] field_151622_e = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.taiga, BiomeGenBase.plains}; +- private BiomeGenBase[] field_151620_f = new BiomeGenBase[] {BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.coldTaiga}; ++ @SuppressWarnings("unchecked") ++ private java.util.List[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length]; ++ + private final ChunkProviderSettings field_175973_g; + + public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_) +++++ END PATCH +++++ REJECTED PATCH 2 + super(p_i45560_1_); + this.parent = p_i45560_3_; + ++ for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values()) ++ { ++ com.google.common.collect.ImmutableList biomesToAdd = net.minecraftforge.common.BiomeManager.getBiomes(type); ++ int idx = type.ordinal(); ++ ++ if (biomes[idx] == null) biomes[idx] = new java.util.ArrayList(); ++ if (biomesToAdd != null) biomes[idx].addAll(biomesToAdd); ++ } ++ ++ 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)); ++ + if (p_i45560_4_ == WorldType.DEFAULT_1_1) + { +- this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.plains, BiomeGenBase.taiga}; ++ 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)); + this.field_175973_g = null; + } + else if (p_i45560_4_ == WorldType.CUSTOMIZED) +++++ END PATCH +++++ REJECTED PATCH 3 + } + else + { +- aint1[j + i * areaWidth] = this.field_151623_c[this.nextInt(this.field_151623_c.length)].biomeID; ++ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome.biomeID; + } + } + else if (k == 2) +++++ END PATCH +++++ REJECTED PATCH 4 + } + else + { +- aint1[j + i * areaWidth] = this.field_151621_d[this.nextInt(this.field_151621_d.length)].biomeID; ++ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM).biome.biomeID; + } + } + else if (k == 3) +++++ END PATCH +++++ REJECTED PATCH 5 + } + else + { +- aint1[j + i * areaWidth] = this.field_151622_e[this.nextInt(this.field_151622_e.length)].biomeID; ++ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL).biome.biomeID; + } + } + else if (k == 4) + { +- aint1[j + i * areaWidth] = this.field_151620_f[this.nextInt(this.field_151620_f.length)].biomeID; ++ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY).biome.biomeID; + } + else + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch.rej new file mode 100644 index 0000000000..7cec77af05 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch.rej @@ -0,0 +1,55 @@ +++++ REJECTED PATCH 2 + { + int l1 = enumfacing.getFrontOffsetX() * 2; + int i2 = enumfacing.getFrontOffsetZ() * 2; +- this.field_74940_h[enumfacing.getHorizontalIndex()] = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 10 + l1, -11, 10 + i2, WeightedRandomChestContent.func_177629_a(itemsToGenerateInTemple, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(5)); ++ this.field_74940_h[enumfacing.getHorizontalIndex()] = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 10 + l1, -11, 10 + i2, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, randomIn)); + } + } + +++++ END PATCH +++++ REJECTED PATCH 4 + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 4, -3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 3, -3, 1, structureBoundingBoxIn); + ++ net.minecraftforge.common.ChestGenHooks dispenser = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_DISPENSER); ++ net.minecraftforge.common.ChestGenHooks chest = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST); ++ + if (!this.field_74945_j) + { +- this.field_74945_j = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 3, -2, 1, EnumFacing.NORTH.getIndex(), field_175815_j, 2); ++ this.field_74945_j = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 3, -2, 1, EnumFacing.NORTH.getIndex(), dispenser.getItems(randomIn), dispenser.getCount(randomIn)); + } + + this.setBlockState(worldIn, Blocks.vine.getStateFromMeta(15), 3, -2, 2, structureBoundingBoxIn); +++++ END PATCH +++++ REJECTED PATCH 5 + + if (!this.field_74946_k) + { +- this.field_74946_k = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 9, -2, 3, EnumFacing.WEST.getIndex(), field_175815_j, 2); ++ this.field_74946_k = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 9, -2, 3, EnumFacing.WEST.getIndex(), dispenser.getItems(randomIn), dispenser.getCount(randomIn)); + } + + this.setBlockState(worldIn, Blocks.vine.getStateFromMeta(15), 8, -1, 3, structureBoundingBoxIn); +++++ END PATCH +++++ REJECTED PATCH 6 + + if (!this.field_74947_h) + { +- this.field_74947_h = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 8, -3, 3, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(5)); ++ this.field_74947_h = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 8, -3, 3, chest.getItems(randomIn), chest.getCount(randomIn)); + } + + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 9, -3, 2, structureBoundingBoxIn); +++++ END PATCH +++++ REJECTED PATCH 7 + + if (!this.field_74948_i) + { +- this.field_74948_i = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 9, -3, 10, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(5)); ++ this.field_74948_i = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 9, -3, 10, chest.getItems(randomIn), chest.getCount(randomIn)); + } + + return true; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej new file mode 100644 index 0000000000..5827a1fee6 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej @@ -0,0 +1,21 @@ +++++ REJECTED PATCH 1 + + for (BiomeGenBase biomegenbase : BiomeGenBase.getBiomeGenArray()) + { +- if (biomegenbase != null && biomegenbase.minHeight > 0.0F) ++ if (biomegenbase != null && biomegenbase.minHeight > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) + { + this.field_151546_e.add(biomegenbase); + } + } ++ for (BiomeGenBase biome : net.minecraftforge.common.BiomeManager.strongHoldBiomes) ++ { ++ if (!this.field_151546_e.contains(biome)) ++ { ++ this.field_151546_e.add(biome); ++ } ++ } + } + + public MapGenStronghold(Map p_i2068_1_) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch.rej new file mode 100644 index 0000000000..5ced572b87 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 2 + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.05F, 1, 2, k1 - 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.05F, 1, 2, k1 + 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); + ++ net.minecraftforge.common.ChestGenHooks info = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR); + if (randomIn.nextInt(100) == 0) + { +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 2, 0, k1 - 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.CHEST_CONTENT_WEIGHT_LIST, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 3 + randomIn.nextInt(4)); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 2, 0, k1 - 1, info.getItems(randomIn), info.getCount(randomIn)); + } + + if (randomIn.nextInt(100) == 0) + { +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 0, 0, k1 + 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.CHEST_CONTENT_WEIGHT_LIST, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 3 + randomIn.nextInt(4)); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 0, 0, k1 + 1, info.getItems(randomIn), info.getCount(randomIn)); + } + + if (this.hasSpiders && !this.spawnerPlaced) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej new file mode 100644 index 0000000000..2307718641 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej @@ -0,0 +1,29 @@ +++++ REJECTED PATCH 1 + if (this.field_111021_b && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) + { + this.field_111021_b = false; +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, field_111019_a, 2 + randomIn.nextInt(4)); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, randomIn)); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); +++++ END PATCH +++++ REJECTED PATCH 2 + if (this.field_111020_b && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(1, 3), this.getYWithOffset(2), this.getZWithOffset(1, 3)))) + { + this.field_111020_b = false; +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 1, 2, 3, field_111019_a, 2 + randomIn.nextInt(4)); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 1, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, randomIn)); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); +++++ END PATCH +++++ REJECTED PATCH 3 + abstract static class Piece extends StructureComponent + { + protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 5), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 5), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 15), new WeightedRandomChestContent(Items.golden_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.golden_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.flint_and_steel, 0, 1, 1, 5), new WeightedRandomChestContent(Items.nether_wart, 0, 3, 7, 5), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 8), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 5), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.obsidian), 0, 2, 4, 2)}); ++ static { net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, field_111019_a, 2, 5); } + + public Piece() + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch.rej new file mode 100644 index 0000000000..6f7af3afda --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch.rej @@ -0,0 +1,37 @@ +++++ REJECTED PATCH 2 + if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) + { + this.hasMadeChest = true; +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, WeightedRandomChestContent.func_177629_a(strongholdChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(2)); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, randomIn)); + } + + return true; +++++ END PATCH +++++ REJECTED PATCH 4 + this.setBlockState(worldIn, Blocks.torch.getDefaultState(), i1, 8, j1 + 1, structureBoundingBoxIn); + } + +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 3, 5, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn, 1, 5, 2)}), 1 + randomIn.nextInt(4)); ++ net.minecraftforge.common.ChestGenHooks info = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 3, 5, info.getItems(randomIn), info.getCount(randomIn)); + + if (this.isLargeRoom) + { + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 12, 9, 1, structureBoundingBoxIn); +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 12, 8, 1, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn, 1, 5, 2)}), 1 + randomIn.nextInt(4)); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 12, 8, 1, info.getItems(randomIn), info.getCount(randomIn)); + } + + return true; +++++ END PATCH +++++ REJECTED PATCH 6 + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 1, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 3, 3, structureBoundingBoxIn); +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 4, 8, WeightedRandomChestContent.func_177629_a(strongholdRoomCrossingChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 1 + randomIn.nextInt(4)); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 4, 8, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, randomIn)); + } + + return true; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch.rej new file mode 100644 index 0000000000..bba26e14d0 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 4 + if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(5, 5), this.getYWithOffset(1), this.getZWithOffset(5, 5)))) + { + this.hasMadeChest = true; +- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 5, 1, 5, villageBlacksmithChestContents, 3 + randomIn.nextInt(6)); ++ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 5, 1, 5, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, randomIn)); + } + + for (int i = 6; i <= 8; ++i) +++++ END PATCH +++++ REJECTED PATCH 6 + this.terrainType = p_i2104_7_; + BiomeGenBase biomegenbase = chunkManagerIn.getBiomeGenerator(new BlockPos(p_i2104_4_, 0, p_i2104_5_), BiomeGenBase.field_180279_ad); + this.inDesert = biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills; ++ this.biome = biomegenbase; + this.func_175846_a(this.inDesert); + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/storage/MapData.java.patch.rej b/rejects/minecraft/net/minecraft/world/storage/MapData.java.patch.rej new file mode 100644 index 0000000000..be29e9811a --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/storage/MapData.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + { + public int xCenter; + public int zCenter; +- public byte dimension; ++ public int dimension; //FML byte -> int + public byte scale; + public byte[] colors = new byte[16384]; + public List playersArrayList = Lists.newArrayList(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej b/rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej new file mode 100644 index 0000000000..5df712317c --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej @@ -0,0 +1,57 @@ +++++ REJECTED PATCH 1 + { + File file1 = new File(this.worldDirectory, "level.dat"); + ++ WorldInfo worldInfo = null; ++ + if (file1.exists()) + { + try + { + NBTTagCompound nbttagcompound2 = CompressedStreamTools.readCompressed(new FileInputStream(file1)); + NBTTagCompound nbttagcompound3 = nbttagcompound2.getCompoundTag("Data"); +- return new WorldInfo(nbttagcompound3); ++ worldInfo = new WorldInfo(nbttagcompound3); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound2); ++ return worldInfo; + } ++ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) ++ { ++ throw e; ++ } + catch (Exception exception1) + { + exception1.printStackTrace(); + } + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); + file1 = new File(this.worldDirectory, "level.dat_old"); + + if (file1.exists()) +++++ END PATCH +++++ REJECTED PATCH 2 + { + NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); +- return new WorldInfo(nbttagcompound1); ++ worldInfo = new WorldInfo(nbttagcompound1); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); ++ return worldInfo; ++ } ++ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) ++ { ++ throw e; + } + catch (Exception exception) + { +++++ END PATCH +++++ REJECTED PATCH 5 + } + + file1.renameTo(file2); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(player, this.playersDirectory, player.getUniqueID().toString()); + } + catch (Exception var5) + { +++++ END PATCH From bf7527d3cdc57610271f7775e7055d0656e7c1f4 Mon Sep 17 00:00:00 2001 From: cpw Date: Mon, 29 Feb 2016 22:54:48 -0500 Subject: [PATCH 004/243] First few patches applied --- .../net/minecraft/block/Block.java.patch | 110 +-- .../minecraft/block/BlockBanner.java.patch | 27 +- .../net/minecraft/block/BlockBush.java.patch | 35 +- .../minecraft/block/BlockButton.java.patch | 12 - .../minecraft/block/BlockCactus.java.patch | 21 +- .../net/minecraft/block/BlockChest.java.patch | 11 - .../net/minecraft/block/BlockCocoa.java.patch | 6 +- .../net/minecraft/block/BlockCrops.java.patch | 46 +- .../minecraft/block/BlockDeadBush.java.patch | 28 +- .../net/minecraft/block/BlockDoor.java.patch | 11 +- .../block/BlockDoublePlant.java.patch | 23 +- .../minecraft/block/BlockFalling.java.patch | 10 - .../minecraft/block/BlockFarmland.java.patch | 2 +- .../net/minecraft/block/BlockFire.java.patch | 109 +-- .../minecraft/block/BlockFlowerPot.java.patch | 6 +- .../net/minecraft/block/BlockGrass.java.patch | 20 +- .../block/BlockHugeMushroom.java.patch | 4 +- .../net/minecraft/block/BlockIce.java.patch | 35 - .../minecraft/block/BlockLadder.java.patch | 25 +- .../minecraft/block/BlockLeaves.java.patch | 45 +- .../net/minecraft/block/BlockLever.java.patch | 4 +- .../net/minecraft/block/BlockLog.java.patch | 14 +- .../block/BlockMobSpawner.java.patch | 19 - .../minecraft/block/BlockMushroom.java.patch | 11 - .../minecraft/block/BlockMycelium.java.patch | 20 - .../block/BlockNetherWart.java.patch | 23 +- .../minecraft/block/BlockNewLeaf.java.patch | 24 - .../net/minecraft/block/BlockNote.java.patch | 8 +- .../minecraft/block/BlockOldLeaf.java.patch | 21 - .../net/minecraft/block/BlockOre.java.patch | 4 +- .../net/minecraft/block/BlockPane.java.patch | 21 +- .../block/BlockPistonBase.java.patch | 31 - .../block/BlockPistonMoving.java.patch | 22 +- .../minecraft/block/BlockPotato.java.patch | 25 - .../minecraft/block/BlockPumpkin.java.patch | 11 - .../minecraft/block/BlockQuartz.java.patch | 4 +- .../minecraft/block/BlockRailBase.java.patch | 24 +- .../block/BlockRedstoneComparator.java.patch | 4 +- .../block/BlockRedstoneDiode.java.patch | 4 +- .../block/BlockRedstoneOre.java.patch | 2 +- .../block/BlockRedstoneWire.java.patch | 59 -- .../net/minecraft/block/BlockReed.java.patch | 18 +- .../block/BlockRotatedPillar.java.patch | 10 +- .../minecraft/block/BlockSapling.java.patch | 2 +- .../net/minecraft/block/BlockSkull.java.patch | 17 +- .../net/minecraft/block/BlockSlab.java.patch | 20 +- .../net/minecraft/block/BlockSnow.java.patch | 36 +- .../minecraft/block/BlockStairs.java.patch | 22 - .../net/minecraft/block/BlockStem.java.patch | 6 +- .../minecraft/block/BlockTallGrass.java.patch | 29 +- .../net/minecraft/block/BlockTorch.java.patch | 8 +- .../minecraft/block/BlockTrapDoor.java.patch | 43 - .../block/BlockTripWireHook.java.patch | 28 - .../net/minecraft/block/BlockVine.java.patch | 18 +- .../BlockPistonStructureHelper.java.patch | 29 - .../block/state/BlockState.java.patch | 53 -- .../block/state/BlockStateBase.java.patch | 2 +- .../client/LoadingScreenRenderer.java.patch | 4 +- .../net/minecraft/client/Minecraft.java.patch | 366 +-------- .../client/audio/SoundManager.java.patch | 29 +- .../entity/AbstractClientPlayer.java.patch | 2 +- .../client/entity/EntityPlayerSP.java.patch | 17 +- .../client/gui/FontRenderer.java.patch | 52 +- .../minecraft/client/gui/GuiButton.java.patch | 4 +- .../minecraft/client/gui/GuiChat.java.patch | 39 - .../client/gui/GuiCreateWorld.java.patch | 13 +- .../client/gui/GuiMainMenu.java.patch | 8 +- .../client/gui/GuiOverlayDebug.java.patch | 8 +- .../minecraft/client/gui/GuiScreen.java.patch | 20 +- .../client/gui/GuiSelectWorld.java.patch | 11 - .../minecraft/client/gui/GuiSlot.java.patch | 20 +- .../gui/GuiUtilRenderComponents.java.patch | 10 - .../gui/ServerListEntryNormal.java.patch | 2 +- .../achievement/GuiAchievements.java.patch | 59 +- .../gui/achievement/GuiStats.java.patch | 60 +- .../gui/inventory/GuiContainer.java.patch | 12 +- .../inventory/GuiContainerCreative.java.patch | 53 +- .../client/model/ModelBox.java.patch | 8 - .../client/model/ModelRenderer.java.patch | 12 +- .../model/PositionTextureVertex.java.patch | 13 - .../client/model/TexturedQuad.java.patch | 13 - .../ChunkProviderClient.java.patch | 2 +- .../multiplayer/GuiConnecting.java.patch | 11 - .../multiplayer/PlayerControllerMP.java.patch | 74 +- .../client/multiplayer/WorldClient.java.patch | 4 +- .../network/NetHandlerLoginClient.java.patch | 4 +- .../network/NetHandlerPlayClient.java.patch | 31 +- .../client/network/OldServerPinger.java.patch | 10 - .../client/particle/EffectRenderer.java.patch | 19 +- .../renderer/BlockModelRenderer.java.patch | 24 - .../renderer/BlockModelShapes.java.patch | 2 +- .../BlockRendererDispatcher.java.patch | 49 -- .../client/renderer/EntityRenderer.java.patch | 88 +-- .../InventoryEffectRenderer.java.patch | 12 +- .../client/renderer/ItemRenderer.java.patch | 40 +- .../client/renderer/OpenGlHelper.java.patch | 4 +- .../client/renderer/RenderGlobal.java.patch | 69 +- .../client/renderer/WorldRenderer.java.patch | 41 - .../WorldVertexBufferUploader.java.patch | 66 -- .../renderer/block/model/BakedQuad.java.patch | 2 +- .../block/model/FaceBakery.java.patch | 68 -- .../model/ItemCameraTransforms.java.patch | 8 +- .../model/ModelBlockDefinition.java.patch | 22 +- .../block/statemap/StateMap.java.patch | 11 - .../renderer/chunk/RenderChunk.java.patch | 25 +- .../entity/RenderEntityItem.java.patch | 41 +- .../renderer/entity/RenderItem.java.patch | 90 --- .../renderer/entity/RenderManager.java.patch | 14 +- .../renderer/entity/RenderPlayer.java.patch | 6 +- .../entity/RendererLivingEntity.java.patch | 64 -- .../entity/layers/LayerArmorBase.java.patch | 93 +-- .../entity/layers/LayerBipedArmor.java.patch | 2 +- .../renderer/texture/Stitcher.java.patch | 12 +- .../texture/TextureAtlasSprite.java.patch | 2 +- .../renderer/texture/TextureMap.java.patch | 96 +-- .../renderer/texture/TextureUtil.java.patch | 4 +- .../tileentity/RenderItemFrame.java.patch | 8 +- .../TileEntityItemStackRenderer.java.patch | 2 +- .../TileEntityRendererDispatcher.java.patch | 19 +- .../FallbackResourceManager.java.patch | 2 +- .../resources/LanguageManager.java.patch | 10 - .../resources/model/IBakedModel.java.patch | 9 - .../resources/model/ModelBakery.java.patch | 124 --- .../resources/model/ModelManager.java.patch | 14 - .../resources/model/ModelRotation.java.patch | 21 - .../client/settings/GameSettings.java.patch | 2 +- .../client/shader/Framebuffer.java.patch | 4 +- .../minecraft/command/CommandBase.java.patch | 8 +- .../command/CommandEnchant.java.patch | 10 +- .../minecraft/command/CommandFill.java.patch | 20 +- .../command/CommandHandler.java.patch | 16 +- ...r.java.patch => EntitySelector.java.patch} | 6 +- .../command/server/CommandSetBlock.java.patch | 14 +- .../server/CommandTestForBlock.java.patch | 8 +- .../crash/CrashReportCategory.java.patch | 2 +- .../enchantment/Enchantment.java.patch | 57 +- .../enchantment/EnchantmentHelper.java.patch | 27 +- .../net/minecraft/entity/Entity.java.patch | 109 +-- .../minecraft/entity/EntityAgeable.java.patch | 11 - .../minecraft/entity/EntityHanging.java.patch | 12 - .../minecraft/entity/EntityList.java.patch | 24 +- .../minecraft/entity/EntityLiving.java.patch | 8 +- .../entity/EntityLivingBase.java.patch | 114 +-- .../EntityMinecartCommandBlock.java.patch | 10 - .../minecraft/entity/EntityTracker.java.patch | 12 +- .../entity/EntityTrackerEntry.java.patch | 34 +- .../ai/EntityAIAttackOnCollide.java.patch | 55 -- .../entity/boss/EntityDragon.java.patch | 14 - .../entity/boss/EntityWither.java.patch | 11 - .../entity/boss/IBossDisplayData.java.patch | 10 - .../effect/EntityLightningBolt.java.patch | 2 +- .../entity/item/EntityEnderPearl.java.patch | 6 +- .../entity/item/EntityItem.java.patch | 22 +- .../entity/item/EntityItemFrame.java.patch | 2 +- .../entity/item/EntityMinecart.java.patch | 306 +------ .../item/EntityMinecartContainer.java.patch | 16 +- .../item/EntityMinecartEmpty.java.patch | 10 - .../item/EntityMinecartFurnace.java.patch | 10 - .../item/EntityMinecartHopper.java.patch | 6 +- .../entity/item/EntityXPOrb.java.patch | 4 +- .../entity/monster/EntityEnderman.java.patch | 22 +- .../entity/monster/EntityMagmaCube.java.patch | 2 +- .../entity/monster/EntitySlime.java.patch | 10 +- .../entity/monster/EntityZombie.java.patch | 46 +- .../entity/passive/EntityHorse.java.patch | 2 +- .../entity/passive/EntityMooshroom.java.patch | 31 +- .../entity/passive/EntityOcelot.java.patch | 11 - .../entity/passive/EntitySheep.java.patch | 20 +- .../entity/passive/EntityVillager.java.patch | 24 +- .../entity/player/EntityPlayer.java.patch | 295 +------ .../entity/player/EntityPlayerMP.java.patch | 60 +- .../entity/player/InventoryPlayer.java.patch | 21 +- .../projectile/EntityFishHook.java.patch | 22 - .../net/minecraft/init/Bootstrap.java.patch | 11 +- .../minecraft/inventory/Container.java.patch | 2 +- .../ContainerBrewingStand.java.patch | 29 - .../inventory/ContainerEnchantment.java.patch | 12 +- .../inventory/ContainerPlayer.java.patch | 12 - .../inventory/ContainerRepair.java.patch | 25 +- .../inventory/SlotCrafting.java.patch | 2 +- .../inventory/SlotFurnaceOutput.java.patch | 2 +- .../net/minecraft/item/Item.java.patch | 745 +----------------- .../net/minecraft/item/ItemArmor.java.patch | 30 +- .../net/minecraft/item/ItemBlock.java.patch | 22 +- .../net/minecraft/item/ItemBow.java.patch | 22 - .../net/minecraft/item/ItemBucket.java.patch | 12 - .../minecraft/item/ItemBucketMilk.java.patch | 4 +- .../net/minecraft/item/ItemDye.java.patch | 17 +- .../minecraft/item/ItemEmptyMap.java.patch | 11 - .../item/ItemFlintAndSteel.java.patch | 11 - .../net/minecraft/item/ItemHoe.java.patch | 17 - .../net/minecraft/item/ItemLilyPad.java.patch | 17 - .../net/minecraft/item/ItemMap.java.patch | 11 - .../item/ItemMonsterPlacer.java.patch | 93 +-- .../net/minecraft/item/ItemRecord.java.patch | 12 +- .../minecraft/item/ItemSeedFood.java.patch | 17 +- .../net/minecraft/item/ItemSeeds.java.patch | 17 +- .../net/minecraft/item/ItemShears.java.patch | 21 +- .../net/minecraft/item/ItemSkull.java.patch | 31 - .../net/minecraft/item/ItemSnow.java.patch | 2 +- .../net/minecraft/item/ItemStack.java.patch | 124 +-- .../net/minecraft/item/ItemSword.java.patch | 4 +- .../net/minecraft/item/ItemTool.java.patch | 16 +- .../item/crafting/FurnaceRecipes.java.patch | 4 +- .../minecraft/nbt/NBTTagCompound.java.patch | 4 +- .../network/NetHandlerPlayServer.java.patch | 121 +-- .../network/NetworkManager.java.patch | 12 +- .../network/NetworkSystem.java.patch | 6 +- .../network/ServerStatusResponse.java.patch | 21 +- ....patch => CPacketCustomPayload.java.patch} | 4 +- ....patch => SPacketCustomPayload.java.patch} | 4 +- .../server/S00PacketServerInfo.java.patch | 11 - .../net/minecraft/potion/Potion.java.patch | 58 +- .../minecraft/potion/PotionEffect.java.patch | 37 +- .../minecraft/realms/RealmsConnect.java.patch | 9 - .../server/MinecraftServer.java.patch | 86 +- .../dedicated/DedicatedServer.java.patch | 38 +- .../server/gui/MinecraftServerGui.java.patch | 4 +- .../integrated/IntegratedServer.java.patch | 63 +- .../management/ItemInWorldManager.java.patch | 266 ------- .../management/PlayerManager.java.patch | 212 +---- .../ServerConfigurationManager.java.patch | 223 ------ .../network/NetHandlerLoginServer.java.patch | 16 +- .../net/minecraft/stats/StatList.java.patch | 24 +- .../tileentity/TileEntity.java.patch | 50 +- .../tileentity/TileEntityBeacon.java.patch | 4 +- .../TileEntityBrewingStand.java.patch | 77 +- .../tileentity/TileEntityChest.java.patch | 12 +- .../tileentity/TileEntityFurnace.java.patch | 14 +- .../tileentity/TileEntityHopper.java.patch | 8 +- .../tileentity/TileEntityLockable.java.patch | 2 +- .../tileentity/TileEntityNote.java.patch | 2 +- .../tileentity/TileEntityPiston.java.patch | 4 +- .../tileentity/TileEntitySign.java.patch | 2 +- .../net/minecraft/util/BlockPos.java.patch | 32 - .../util/ChatComponentStyle.java.patch | 10 - .../net/minecraft/util/ChatStyle.java.patch | 10 - .../net/minecraft/util/EnumFacing.java.patch | 23 +- .../util/EnumWorldBlockLayer.java.patch | 12 - .../minecraft/util/IChatComponent.java.patch | 10 - .../util/MovingObjectPosition.java.patch | 15 - .../util/ResourceLocation.java.patch | 26 - .../net/minecraft/util/Session.java.patch | 20 - .../minecraft/util/StringTranslate.java.patch | 54 -- .../net/minecraft/util/Vec3.java.patch | 35 - .../WeightedRandomChestContent.java.patch | 68 -- .../net/minecraft/world/ChunkCache.java.patch | 11 +- .../net/minecraft/world/Explosion.java.patch | 26 +- .../minecraft/world/SpawnerAnimals.java.patch | 51 -- .../net/minecraft/world/World.java.patch | 429 ++-------- .../minecraft/world/WorldProvider.java.patch | 57 +- .../minecraft/world/WorldServer.java.patch | 141 +--- .../world/WorldServerMulti.java.patch | 14 +- .../world/biome/BiomeColorHelper.java.patch | 11 - .../world/biome/BiomeDecorator.java.patch | 117 +-- .../world/biome/BiomeGenBase.java.patch | 116 +-- .../world/biome/BiomeGenForest.java.patch | 10 +- .../world/biome/BiomeGenHills.java.patch | 8 +- .../world/biome/BiomeGenPlains.java.patch | 6 +- .../world/biome/BiomeGenSwamp.java.patch | 2 +- .../world/biome/WorldChunkManager.java.patch | 45 -- .../minecraft/world/chunk/Chunk.java.patch | 117 +-- .../chunk/storage/AnvilChunkLoader.java.patch | 60 +- .../chunk/storage/AnvilSaveHandler.java.patch | 23 - .../world/chunk/storage/RegionFile.java.patch | 2 +- .../world/gen/ChunkProviderEnd.java.patch | 59 +- .../gen/ChunkProviderGenerate.java.patch | 110 --- .../world/gen/ChunkProviderHell.java.patch | 141 ---- .../world/gen/ChunkProviderServer.java.patch | 100 +-- .../world/gen/MapGenCaves.java.patch | 40 +- .../world/gen/MapGenRavine.java.patch | 35 +- .../feature/WorldGenBigMushroom.java.patch | 33 - .../gen/feature/WorldGenBigTree.java.patch | 12 - .../gen/feature/WorldGenCanopyTree.java.patch | 32 - .../gen/feature/WorldGenDeadBush.java.patch | 17 - .../gen/feature/WorldGenDungeons.java.patch | 16 +- .../gen/feature/WorldGenForest.java.patch | 50 -- .../gen/feature/WorldGenHugeTrees.java.patch | 24 - .../feature/WorldGenMegaPineTree.java.patch | 63 -- .../feature/WorldGenSavannaTree.java.patch | 36 - .../gen/feature/WorldGenShrub.java.patch | 31 - .../gen/feature/WorldGenSwamp.java.patch | 79 +- .../gen/feature/WorldGenTaiga1.java.patch | 22 - .../gen/feature/WorldGenTaiga2.java.patch | 50 -- .../gen/feature/WorldGenTallGrass.java.patch | 17 - .../gen/feature/WorldGenTrees.java.patch | 83 -- .../WorldGeneratorBonusChest.java.patch | 17 - .../world/gen/layer/GenLayer.java.patch | 13 +- .../world/gen/layer/GenLayerBiome.java.patch | 81 +- ...ComponentScatteredFeaturePieces.java.patch | 54 +- .../gen/structure/MapGenStronghold.java.patch | 22 - .../gen/structure/MapGenStructure.java.patch | 2 +- .../structure/StructureComponent.java.patch | 4 +- .../StructureMineshaftPieces.java.patch | 20 +- .../StructureNetherBridgePieces.java.patch | 28 - .../gen/structure/StructureStart.java.patch | 4 +- .../StructureStrongholdPieces.java.patch | 44 +- .../StructureVillagePieces.java.patch | 31 +- .../world/storage/MapData.java.patch | 15 +- .../world/storage/SaveHandler.java.patch | 86 +- .../world/storage/WorldInfo.java.patch | 14 +- .../command/CommandBase.java.patch.rej | 10 - .../command/CommandEnchant.java.patch.rej | 10 - .../command/CommandFill.java.patch.rej | 20 - .../command/CommandHandler.java.patch.rej | 10 - .../command/PlayerSelector.java.patch.rej | 13 - .../server/CommandSetBlock.java.patch.rej | 20 - .../server/CommandTestForBlock.java.patch.rej | 10 - .../minecraft/init/Bootstrap.java.patch.rej | 10 - .../ContainerEnchantment.java.patch.rej | 10 - .../inventory/ContainerRepair.java.patch.rej | 20 - .../network/NetworkSystem.java.patch.rej | 10 - .../C17PacketCustomPayload.java.patch.rej | 13 - .../S3FPacketCustomPayload.java.patch.rej | 13 - .../server/MinecraftServer.java.patch.rej | 46 -- .../NetHandlerLoginServer.java.patch.rej | 26 - 316 files changed, 1052 insertions(+), 9968 deletions(-) delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/state/BlockState.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/network/OldServerPinger.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch rename patches.mcp/minecraft/net/minecraft/command/{PlayerSelector.java.patch => EntitySelector.java.patch} (84%) delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityAgeable.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch rename patches.mcp/minecraft/net/minecraft/network/play/client/{C17PacketCustomPayload.java.patch => CPacketCustomPayload.java.patch} (71%) rename patches.mcp/minecraft/net/minecraft/network/play/server/{S3FPacketCustomPayload.java.patch => SPacketCustomPayload.java.patch} (71%) delete mode 100644 patches.mcp/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/BlockPos.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/ChatComponentStyle.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/ChatStyle.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/IChatComponent.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/MovingObjectPosition.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/ResourceLocation.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/StringTranslate.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/Vec3.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/SpawnerAnimals.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch delete mode 100644 rejects/minecraft/net/minecraft/command/CommandBase.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/command/CommandEnchant.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/command/CommandFill.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/command/CommandHandler.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/command/PlayerSelector.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch index c62a56071d..0b22ac7d6e 100644 --- a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch @@ -1,18 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/Block.java +++ ../src-work/minecraft/net/minecraft/block/Block.java -@@ -38,8 +38,9 @@ - public class Block - { - private static final ResourceLocation AIR_ID = new ResourceLocation("air"); -- public static final RegistryNamespacedDefaultedByKey blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID); -- public static final ObjectIntIdentityMap BLOCK_STATE_IDS = new ObjectIntIdentityMap(); -+ public static final RegistryNamespacedDefaultedByKey blockRegistry = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); -+ @Deprecated //Modders: DO NOT use this! Use GameRegistry -+ public static final ObjectIntIdentityMap BLOCK_STATE_IDS = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); - private CreativeTabs displayOnCreativeTab; - public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F); - public static final Block.SoundType soundTypeWood = new Block.SoundType("wood", 1.0F, 1.0F); -@@ -119,6 +120,9 @@ +@@ -70,6 +70,9 @@ private IBlockState defaultBlockState; private String unlocalizedName; @@ -22,7 +10,7 @@ public static int getIdFromBlock(Block blockIn) { return blockRegistry.getIDForObject(blockIn); -@@ -132,7 +136,8 @@ +@@ -83,7 +86,8 @@ public static Block getBlockById(int id) { @@ -32,16 +20,16 @@ } public static IBlockState getStateById(int id) -@@ -303,7 +308,7 @@ +@@ -268,7 +272,7 @@ - public boolean isReplaceable(World worldIn, BlockPos pos) + public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) { - return false; + return getMaterial().isReplaceable(); } public Block setHardness(float hardness) -@@ -340,9 +345,10 @@ +@@ -305,9 +309,10 @@ return this.needsRandomTick; } @@ -52,33 +40,8 @@ + return hasTileEntity(getDefaultState()); } - public final void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) -@@ -359,13 +365,13 @@ - public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos) - { - Block block = worldIn.getBlockState(pos).getBlock(); -- int i = worldIn.getCombinedLight(pos, block.getLightValue()); -+ int i = worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); - - if (i == 0 && block instanceof BlockSlab) - { - pos = pos.down(); - block = worldIn.getBlockState(pos).getBlock(); -- return worldIn.getCombinedLight(pos, block.getLightValue()); -+ return worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); - } - else - { -@@ -376,7 +382,7 @@ - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) - { -- return side == EnumFacing.DOWN && this.minY > 0.0D ? true : (side == EnumFacing.UP && this.maxY < 1.0D ? true : (side == EnumFacing.NORTH && this.minZ > 0.0D ? true : (side == EnumFacing.SOUTH && this.maxZ < 1.0D ? true : (side == EnumFacing.WEST && this.minX > 0.0D ? true : (side == EnumFacing.EAST && this.maxX < 1.0D ? true : !worldIn.getBlockState(pos).getBlock().isOpaqueCube()))))); -+ return side == EnumFacing.DOWN && this.minY > 0.0D ? true : (side == EnumFacing.UP && this.maxY < 1.0D ? true : (side == EnumFacing.NORTH && this.minZ > 0.0D ? true : (side == EnumFacing.SOUTH && this.maxZ < 1.0D ? true : (side == EnumFacing.WEST && this.minX > 0.0D ? true : (side == EnumFacing.EAST && this.maxX < 1.0D ? true : !worldIn.getBlockState(pos).getBlock().doesSideBlockRendering(worldIn, pos, side)))))); - } - - public boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side) -@@ -453,6 +459,10 @@ + public AxisAlignedBB func_185496_a(IBlockState p_185496_1_, IBlockAccess p_185496_2_, BlockPos p_185496_3_) +@@ -472,6 +477,10 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { @@ -89,17 +52,7 @@ } public int quantityDropped(Random random) -@@ -467,8 +477,7 @@ - - public float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos) - { -- float f = this.getBlockHardness(worldIn, pos); -- return f < 0.0F ? 0.0F : (!playerIn.canHarvestBlock(this) ? playerIn.getToolDigEfficiency(this) / f / 100.0F : playerIn.getToolDigEfficiency(this) / f / 30.0F); -+ return net.minecraftforge.common.ForgeHooks.blockStrength(worldIn.getBlockState(pos), playerIn, worldIn, pos); - } - - public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture) -@@ -478,20 +487,16 @@ +@@ -497,20 +506,16 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { @@ -125,7 +78,7 @@ } } } -@@ -499,8 +504,13 @@ +@@ -518,8 +523,13 @@ public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) { @@ -140,7 +93,7 @@ float f = 0.5F; double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -@@ -687,7 +697,7 @@ +@@ -588,7 +598,7 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { @@ -148,47 +101,8 @@ + return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos); } - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) -@@ -799,25 +809,35 @@ - player.triggerAchievement(StatList.mineBlockStatArray[getIdFromBlock(this)]); - player.addExhaustion(0.025F); - -- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) -+ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) - { -+ java.util.ArrayList items = new java.util.ArrayList(); - ItemStack itemstack = this.createStackedBlock(state); - - if (itemstack != null) - { -- spawnAsEntity(worldIn, pos, itemstack); -+ items.add(itemstack); - } -+ -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); -+ for (ItemStack stack : items) -+ { -+ spawnAsEntity(worldIn, pos, stack); -+ } - } - else - { -+ harvesters.set(player); - int i = EnchantmentHelper.getFortuneModifier(player); - this.dropBlockAsItem(worldIn, pos, state, i); -+ harvesters.set(null); - } - } - -+ @Deprecated //Forge: State sensitive version - protected boolean canSilkHarvest() - { -- return this.isFullCube() && !this.isBlockContainer; -+ return this.isFullCube() && !this.hasTileEntity(silk_check_state.get()); - } - - protected ItemStack createStackedBlock(IBlockState state) -@@ -1010,6 +1030,1147 @@ + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand side, ItemStack hitX, EnumFacing hitY, float hitZ, float p_180639_9_, float p_180639_10_) +@@ -844,6 +854,1147 @@ return "Block{" + blockRegistry.getNameForObject(this) + "}"; } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch index 09cf5e0464..820a9b6727 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch @@ -1,29 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockBanner.java +++ ../src-work/minecraft/net/minecraft/block/BlockBanner.java -@@ -85,22 +85,7 @@ - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- TileEntity tileentity = worldIn.getTileEntity(pos); -- -- if (tileentity instanceof TileEntityBanner) - { -- ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor()); -- NBTTagCompound nbttagcompound = new NBTTagCompound(); -- tileentity.writeToNBT(nbttagcompound); -- nbttagcompound.removeTag("x"); -- nbttagcompound.removeTag("y"); -- nbttagcompound.removeTag("z"); -- nbttagcompound.removeTag("id"); -- itemstack.setTagInfo("BlockEntityTag", nbttagcompound); -- spawnAsEntity(worldIn, pos, itemstack); -- } -- else -- { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); - } - } -@@ -133,6 +118,28 @@ +@@ -138,6 +138,28 @@ } } @@ -51,4 +28,4 @@ + public static class BlockBannerHanging extends BlockBanner { - public BlockBannerHanging() + protected static final AxisAlignedBB field_185551_d = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 0.78125D, 1.0D); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch index 26af27af21..04d7d6910b 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch @@ -1,40 +1,18 @@ --- ../src-base/minecraft/net/minecraft/block/BlockBush.java +++ ../src-work/minecraft/net/minecraft/block/BlockBush.java -@@ -13,7 +13,7 @@ +@@ -14,7 +14,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class BlockBush extends Block +public class BlockBush extends Block implements net.minecraftforge.common.IPlantable { - protected BlockBush() - { -@@ -36,7 +36,7 @@ + protected static final AxisAlignedBB field_185515_b = new AxisAlignedBB(0.30000001192092896D, 0.0D, 0.30000001192092896D, 0.699999988079071D, 0.6000000238418579D, 0.699999988079071D); - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return super.canPlaceBlockAt(worldIn, pos) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ return super.canPlaceBlockAt(worldIn, pos) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); +@@ -90,6 +90,35 @@ + return false; } - protected boolean canPlaceBlockOn(Block ground) -@@ -66,7 +66,10 @@ - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ BlockPos down = pos.down(); -+ Block soil = worldIn.getBlockState(down).getBlock(); -+ if (state.getBlock() != this) return this.canPlaceBlockOn(soil); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. -+ return soil.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, this); - } - - public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) -@@ -89,4 +92,33 @@ - { - return EnumWorldBlockLayer.CUTOUT; - } -+ + @Override + public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) + { @@ -63,4 +41,7 @@ + if (state.getBlock() != this) return getDefaultState(); + return state; + } - } ++ + @SideOnly(Side.CLIENT) + public BlockRenderLayer getBlockLayer() + { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch deleted file mode 100644 index ef2527c7b0..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockButton.java -+++ ../src-work/minecraft/net/minecraft/block/BlockButton.java -@@ -74,8 +74,7 @@ - - protected static boolean func_181088_a(World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_) - { -- BlockPos blockpos = p_181088_1_.offset(p_181088_2_); -- return p_181088_2_ == EnumFacing.DOWN ? World.doesBlockHaveSolidTopSurface(p_181088_0_, blockpos) : p_181088_0_.getBlockState(blockpos).getBlock().isNormalCube(); -+ return p_181088_2_ == EnumFacing.DOWN && World.doesBlockHaveSolidTopSurface(p_181088_0_, p_181088_1_.down()) ? true : p_181088_0_.isSideSolid(p_181088_1_.offset(p_181088_2_), p_181088_2_.getOpposite()); - } - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch index 04f56d2171..656fa2cacf 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch @@ -8,21 +8,11 @@ +public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable { public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); - -@@ -109,7 +109,7 @@ - } - - Block block = worldIn.getBlockState(pos.down()).getBlock(); -- return block == Blocks.cactus || block == Blocks.sand; -+ return block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this); + protected static final AxisAlignedBB field_185593_b = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.9375D, 0.9375D); +@@ -135,6 +135,18 @@ + return ((Integer)state.getValue(AGE)).intValue(); } - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) -@@ -137,4 +137,16 @@ - { - return new BlockState(this, new IProperty[] {AGE}); - } -+ + @Override + public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) + { @@ -34,4 +24,7 @@ + { + return getDefaultState(); + } - } ++ + protected BlockStateContainer createBlockState() + { + return new BlockStateContainer(this, new IProperty[] {AGE}); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch deleted file mode 100644 index af39114510..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockChest.java -+++ ../src-work/minecraft/net/minecraft/block/BlockChest.java -@@ -527,7 +527,7 @@ - - private boolean isBelowSolidBlock(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); -+ return worldIn.isSideSolid(pos.up(), EnumFacing.DOWN, false); - } - - private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch index e5f3922b4a..b3bd5f03ef 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java +++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java -@@ -137,6 +137,13 @@ +@@ -131,6 +131,13 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { @@ -14,7 +14,7 @@ int i = ((Integer)state.getValue(AGE)).intValue(); int j = 1; -@@ -147,8 +154,9 @@ +@@ -141,8 +148,9 @@ for (int k = 0; k < j; ++k) { @@ -24,4 +24,4 @@ + return dropped; } - @SideOnly(Side.CLIENT) + public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch index 3d2a7232a0..1295dd5070 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockCrops.java +++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java -@@ -81,11 +81,11 @@ +@@ -116,11 +116,11 @@ float f1 = 0.0F; IBlockState iblockstate = worldIn.getBlockState(blockpos.add(i, 0, j)); @@ -14,45 +14,10 @@ { f1 = 3.0F; } -@@ -126,7 +126,7 @@ - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); +@@ -174,6 +174,28 @@ + return Items.wheat; } - protected Item getSeed() -@@ -142,24 +142,6 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); -- -- if (!worldIn.isRemote) -- { -- int i = ((Integer)state.getValue(AGE)).intValue(); -- -- if (i >= 7) -- { -- int j = 3 + fortune; -- -- for (int k = 0; k < j; ++k) -- { -- if (worldIn.rand.nextInt(15) <= i) -- { -- spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0)); -- } -- } -- } -- } - } - - public Item getItemDropped(IBlockState state, Random rand, int fortune) -@@ -202,4 +184,26 @@ - { - return new BlockState(this, new IProperty[] {AGE}); - } -+ + @Override + public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { @@ -74,4 +39,7 @@ + } + return ret; + } - } ++ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch index c0c9491c97..6fe72a39d4 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch @@ -1,33 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockDeadBush.java +++ ../src-work/minecraft/net/minecraft/block/BlockDeadBush.java -@@ -14,7 +14,7 @@ - import net.minecraft.util.BlockPos; +@@ -16,7 +16,7 @@ + import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockDeadBush extends BlockBush +public class BlockDeadBush extends BlockBush implements net.minecraftforge.common.IShearable { - protected BlockDeadBush() - { -@@ -45,14 +45,15 @@ + protected static final AxisAlignedBB field_185516_a = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D); - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) - { -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0)); -- } -- else -- { - super.harvestBlock(worldIn, player, pos, state, te); - } - } -+ -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(Blocks.deadbush))); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch index ec621d11fe..66d7698e9e 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockDoor.java +++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java -@@ -154,7 +154,7 @@ +@@ -107,7 +107,7 @@ { if (this.blockMaterial == Material.iron) { @@ -9,12 +9,3 @@ } else { -@@ -272,7 +272,7 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return pos.getY() >= 255 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); -+ return pos.getY() >= worldIn.getHeight() - 1 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); - } - - public int getMobilityFlag() diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch index 8cbc62e73a..58d4de4515 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch @@ -9,7 +9,7 @@ { public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockDoublePlant.EnumPlantType.class); public static final PropertyEnum HALF = PropertyEnum.create("half", BlockDoublePlant.EnumBlockHalf.class); -@@ -90,6 +90,8 @@ +@@ -88,6 +88,8 @@ Block block = (Block)(flag ? this : worldIn.getBlockState(blockpos).getBlock()); Block block1 = (Block)(flag ? worldIn.getBlockState(blockpos1).getBlock() : this); @@ -18,7 +18,7 @@ if (block == this) { worldIn.setBlockState(blockpos, Blocks.air.getDefaultState(), 2); -@@ -98,17 +100,13 @@ +@@ -96,17 +98,13 @@ if (block1 == this) { worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3); @@ -37,24 +37,7 @@ if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) { return worldIn.getBlockState(pos.down()).getBlock() == this; -@@ -158,7 +156,6 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- if (worldIn.isRemote || player.getCurrentEquippedItem() == null || player.getCurrentEquippedItem().getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player)) - { - super.harvestBlock(worldIn, player, pos, state, te); - } -@@ -221,8 +218,6 @@ - else - { - player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta(); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i)); - return true; - } - } -@@ -293,6 +288,32 @@ +@@ -284,6 +282,32 @@ return Block.EnumOffsetType.XZ; } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch deleted file mode 100644 index 4ac1d28471..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFalling.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java -@@ -86,6 +86,7 @@ - - public static boolean canFallInto(World worldIn, BlockPos pos) - { -+ if (worldIn.isAirBlock(pos)) return true; - Block block = worldIn.getBlockState(pos).getBlock(); - Material material = block.blockMaterial; - return block == Blocks.fire || material == Material.air || material == Material.water || material == Material.lava; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch index b94b5429ec..0ebf66806f 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java +++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java -@@ -89,7 +89,7 @@ +@@ -87,7 +87,7 @@ private boolean hasCrops(World worldIn, BlockPos pos) { Block block = worldIn.getBlockState(pos.up()).getBlock(); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch index 287e8d5dd9..29ff54bf65 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch @@ -1,34 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFire.java +++ ../src-work/minecraft/net/minecraft/block/BlockFire.java -@@ -41,18 +41,24 @@ - int j = pos.getY(); - int k = pos.getZ(); - -- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) -+ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) - { - boolean flag = (i + j + k & 1) == 1; - boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1; - int l = 0; - -- if (this.canCatchFire(worldIn, pos.up())) -+ if (this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) - { - l = flag ? 1 : 2; - } - -- return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west()))).withProperty(UPPER, Integer.valueOf(l)).withProperty(FLIP, Boolean.valueOf(flag1)).withProperty(ALT, Boolean.valueOf(flag)); -+ return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH))) -+ .withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east(), EnumFacing.EAST ))) -+ .withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH))) -+ .withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST ))) -+ .withProperty(UPPER, Integer.valueOf(l)) -+ .withProperty(FLIP, Boolean.valueOf(flag1)) -+ .withProperty(ALT, Boolean.valueOf(flag)); - } - else - { -@@ -108,6 +114,7 @@ +@@ -90,6 +90,7 @@ public void setFireInfo(Block blockIn, int encouragement, int flammability) { @@ -36,22 +8,7 @@ this.encouragements.put(blockIn, Integer.valueOf(encouragement)); this.flammabilities.put(blockIn, Integer.valueOf(flammability)); } -@@ -147,13 +154,8 @@ - } - - Block block = worldIn.getBlockState(pos.down()).getBlock(); -- boolean flag = block == Blocks.netherrack; -+ boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP); - -- if (worldIn.provider instanceof WorldProviderEnd && block == Blocks.bedrock) -- { -- flag = true; -- } -- - if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos)) - { - worldIn.setBlockToAir(pos); -@@ -182,7 +184,7 @@ +@@ -164,7 +165,7 @@ return; } @@ -60,7 +17,7 @@ { worldIn.setBlockToAir(pos); return; -@@ -197,12 +199,12 @@ +@@ -179,12 +180,12 @@ j = -50; } @@ -79,7 +36,7 @@ for (int k = -1; k <= 1; ++k) { -@@ -261,22 +263,30 @@ +@@ -243,22 +244,30 @@ return false; } @@ -111,7 +68,7 @@ if (random.nextInt(chance) < i) { IBlockState iblockstate = worldIn.getBlockState(pos); -@@ -308,7 +318,7 @@ +@@ -290,7 +299,7 @@ { for (EnumFacing enumfacing : EnumFacing.values()) { @@ -120,7 +77,7 @@ { return true; } -@@ -329,7 +339,7 @@ +@@ -311,7 +320,7 @@ for (EnumFacing enumfacing : EnumFacing.values()) { @@ -129,7 +86,7 @@ } return i; -@@ -341,9 +351,10 @@ +@@ -323,9 +332,10 @@ return false; } @@ -141,57 +98,9 @@ } public boolean canPlaceBlockAt(World worldIn, BlockPos pos) -@@ -382,9 +393,9 @@ - worldIn.playSound((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false); - } - -- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) -+ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) - { -- if (Blocks.fire.canCatchFire(worldIn, pos.west())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.west(), EnumFacing.EAST)) - { - for (int j = 0; j < 2; ++j) - { -@@ -395,7 +406,7 @@ - } - } - -- if (Blocks.fire.canCatchFire(worldIn, pos.east())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.east(), EnumFacing.WEST)) - { - for (int k = 0; k < 2; ++k) - { -@@ -406,7 +417,7 @@ - } - } - -- if (Blocks.fire.canCatchFire(worldIn, pos.north())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH)) - { - for (int l = 0; l < 2; ++l) - { -@@ -417,7 +428,7 @@ - } - } - -- if (Blocks.fire.canCatchFire(worldIn, pos.south())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH)) - { - for (int i1 = 0; i1 < 2; ++i1) - { -@@ -428,7 +439,7 @@ - } - } - -- if (Blocks.fire.canCatchFire(worldIn, pos.up())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) - { - for (int j1 = 0; j1 < 2; ++j1) - { -@@ -476,4 +487,19 @@ +@@ -458,4 +468,19 @@ { - return new BlockState(this, new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER, FLIP, ALT}); + return new BlockStateContainer(this, new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER}); } + + /*================================= Forge Start ======================================*/ diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch index d4e12c92cb..526fd1507a 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java +++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java -@@ -169,13 +169,6 @@ +@@ -148,13 +148,6 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { @@ -14,8 +14,8 @@ super.breakBlock(worldIn, pos, state); } -@@ -395,6 +388,31 @@ - return EnumWorldBlockLayer.CUTOUT; +@@ -374,6 +367,31 @@ + return BlockRenderLayer.CUTOUT; } + diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch index b373fbe3aa..086230b680 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch @@ -1,24 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockGrass.java +++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java -@@ -58,7 +58,7 @@ - { - if (!worldIn.isRemote) - { -- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) -+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) - { - worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); - } -@@ -72,7 +72,7 @@ - Block block = worldIn.getBlockState(blockpos.up()).getBlock(); - IBlockState iblockstate = worldIn.getBlockState(blockpos); - -- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) -+ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2) - { - worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState()); - } -@@ -110,7 +110,7 @@ +@@ -96,7 +96,7 @@ { if (j >= i / 16) { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch index 4034822ae1..63bf78539d 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java +++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java -@@ -79,6 +79,20 @@ - return new BlockState(this, new IProperty[] {VARIANT}); +@@ -221,6 +221,20 @@ + return new BlockStateContainer(this, new IProperty[] {VARIANT}); } + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch deleted file mode 100644 index c1631128c5..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockIce.java -+++ ../src-work/minecraft/net/minecraft/block/BlockIce.java -@@ -38,14 +38,17 @@ - player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); - player.addExhaustion(0.025F); - -- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) -+ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) - { -+ java.util.List items = new java.util.ArrayList(); - ItemStack itemstack = this.createStackedBlock(state); - -- if (itemstack != null) -- { -- spawnAsEntity(worldIn, pos, itemstack); -- } -+ if (itemstack != null) items.add(itemstack); -+ -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); -+ -+ for (ItemStack is : items) -+ spawnAsEntity(worldIn, pos, is); - } - else - { -@@ -56,7 +59,9 @@ - } - - int i = EnchantmentHelper.getFortuneModifier(player); -+ harvesters.set(player); - this.dropBlockAsItem(worldIn, pos, state, i); -+ harvesters.set(null); - Material material = worldIn.getBlockState(pos.down()).getBlock().getMaterial(); - - if (material.blocksMovement() || material.isLiquid()) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch index a6e6780658..f43e36d344 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch @@ -1,29 +1,8 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLadder.java +++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java -@@ -78,7 +78,10 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) +@@ -139,4 +139,6 @@ { -- return worldIn.getBlockState(pos.west()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.east()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.north()).getBlock().isNormalCube() ? true : worldIn.getBlockState(pos.south()).getBlock().isNormalCube())); -+ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST, true) || -+ worldIn.isSideSolid(pos.east(), EnumFacing.WEST, true) || -+ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH, true) || -+ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH, true); - } - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) -@@ -116,7 +119,7 @@ - - protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing) - { -- return worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock().isNormalCube(); -+ return worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing, true); - } - - public IBlockState getStateFromMeta(int meta) -@@ -146,4 +149,6 @@ - { - return new BlockState(this, new IProperty[] {FACING}); + return new BlockStateContainer(this, new IProperty[] {FACING}); } + + @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch index e1c41a698a..0b1bfbd37b 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch @@ -1,39 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java +++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java -@@ -18,7 +18,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public abstract class BlockLeaves extends BlockLeavesBase -+public abstract class BlockLeaves extends BlockLeavesBase implements net.minecraftforge.common.IShearable - { - public static final PropertyBool DECAYABLE = PropertyBool.create("decayable"); - public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay"); -@@ -75,9 +75,9 @@ - BlockPos blockpos = pos.add(j1, k1, l1); - IBlockState iblockstate = worldIn.getBlockState(blockpos); - -- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(CHECK_DECAY)).booleanValue()) -+ if (iblockstate.getBlock().isLeaves(worldIn, blockpos)) - { -- worldIn.setBlockState(blockpos, iblockstate.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4); -+ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos); - } - } - } -@@ -117,9 +117,9 @@ - { - Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2)).getBlock(); - -- if (block != Blocks.log && block != Blocks.log2) -+ if (!block.canSustainLeaves(worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2))) - { -- if (block.getMaterial() == Material.leaves) -+ if (block.isLeaves(worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2))) - { - this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2; - } -@@ -226,40 +226,7 @@ +@@ -205,40 +205,7 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { @@ -75,11 +42,10 @@ } protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) -@@ -296,4 +263,48 @@ - } +@@ -274,6 +241,50 @@ public abstract BlockPlanks.EnumType getWoodType(int meta); -+ + + @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } + @Override public boolean isLeaves(IBlockAccess world, BlockPos pos){ return true; } + @@ -123,4 +89,7 @@ + return ret; + } + - } ++ + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockState worldIn, IBlockAccess pos, BlockPos side, EnumFacing p_176225_4_) + { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch index 21869253d1..66b146bb03 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLever.java +++ ../src-work/minecraft/net/minecraft/block/BlockLever.java -@@ -237,6 +237,12 @@ - return new BlockState(this, new IProperty[] {FACING, POWERED}); +@@ -295,6 +295,12 @@ + return new BlockStateContainer(this, new IProperty[] {FACING, POWERED}); } + diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch index e1ad4d6e70..ef4cbd840f 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch @@ -1,19 +1,7 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLog.java +++ ../src-work/minecraft/net/minecraft/block/BlockLog.java -@@ -33,9 +33,9 @@ - { - IBlockState iblockstate = worldIn.getBlockState(blockpos); - -- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(BlockLeaves.CHECK_DECAY)).booleanValue()) -+ if (iblockstate.getBlock().isLeaves(worldIn, blockpos)) - { -- worldIn.setBlockState(blockpos, iblockstate.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4); -+ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos); - } - } +@@ -69,6 +69,9 @@ } -@@ -46,6 +46,9 @@ - return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(LOG_AXIS, BlockLog.EnumAxis.fromFacingAxis(facing.getAxis())); } + @Override public boolean canSustainLeaves(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch deleted file mode 100644 index 1ea021a24c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java -+++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java -@@ -37,10 +37,14 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -- int i = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15); -- this.dropXpOnBlockBreak(worldIn, pos, i); - } - -+ @Override -+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); -+ } -+ - public boolean isOpaqueCube() - { - return false; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch deleted file mode 100644 index c8f6e6acd2..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java -+++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java -@@ -71,7 +71,7 @@ - if (pos.getY() >= 0 && pos.getY() < 256) - { - IBlockState iblockstate = worldIn.getBlockState(pos.down()); -- return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate.getBlock())); -+ return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate.getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this)); - } - else - { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch deleted file mode 100644 index 774ac70798..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java -+++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java -@@ -39,7 +39,7 @@ - { - if (!worldIn.isRemote) - { -- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) -+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) - { - worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); - } -@@ -53,7 +53,7 @@ - IBlockState iblockstate = worldIn.getBlockState(blockpos); - Block block = worldIn.getBlockState(blockpos.up()).getBlock(); - -- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) -+ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2) - { - worldIn.setBlockState(blockpos, this.getDefaultState()); - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch index 1640b0ea13..3231eb30fe 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch @@ -1,15 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java +++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java -@@ -38,7 +38,7 @@ - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ return super.canBlockStay(worldIn, pos, state); - } - - public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) -@@ -54,9 +54,11 @@ +@@ -58,9 +58,11 @@ super.updateTick(worldIn, pos, state, rand); } @@ -22,11 +13,10 @@ { int i = 1; -@@ -107,4 +109,24 @@ - { - return new BlockState(this, new IProperty[] {AGE}); +@@ -106,6 +108,26 @@ + return ((Integer)state.getValue(AGE)).intValue(); } -+ + + @Override + public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { @@ -46,4 +36,7 @@ + + return ret; + } - } ++ + protected BlockStateContainer createBlockState() + { + return new BlockStateContainer(this, new IProperty[] {AGE}); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch deleted file mode 100644 index 4696ecb981..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java -+++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java -@@ -99,14 +99,15 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) - { -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4)); -- } -- else -- { - super.harvestBlock(worldIn, player, pos, state, te); - } - } -+ -+ @Override -+ public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ IBlockState state = world.getBlockState(pos); -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4))); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch index f93eeb4289..ac733338cb 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockNote.java +++ ../src-work/minecraft/net/minecraft/block/BlockNote.java -@@ -58,7 +58,9 @@ +@@ -64,7 +64,9 @@ if (tileentity instanceof TileEntityNote) { TileEntityNote tileentitynote = (TileEntityNote)tileentity; @@ -8,9 +8,9 @@ tileentitynote.changePitch(); + if (old == tileentitynote.note) return false; tileentitynote.triggerNote(worldIn, pos); - playerIn.triggerAchievement(StatList.field_181735_S); + playerIn.triggerAchievement(StatList.field_188087_U); } -@@ -98,6 +100,10 @@ +@@ -104,6 +106,10 @@ public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) { @@ -19,5 +19,5 @@ + eventID = e.instrument.ordinal(); + eventParam = e.getVanillaNoteId(); float f = (float)Math.pow(2.0D, (double)(eventParam - 12) / 12.0D); - worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "note." + this.getInstrument(eventID), 3.0F, f); + worldIn.func_184133_a((EntityPlayer)null, pos, this.func_185576_e(eventID), SoundCategory.BLOCKS, 3.0F, f); worldIn.spawnParticle(EnumParticleTypes.NOTE, (double)pos.getX() + 0.5D, (double)pos.getY() + 1.2D, (double)pos.getZ() + 0.5D, (double)eventParam / 24.0D, 0.0D, 0.0D, new int[0]); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch deleted file mode 100644 index efca433f42..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java -+++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java -@@ -142,11 +142,17 @@ - if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) - { - player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata())); - } - else - { - super.harvestBlock(worldIn, player, pos, state, te); - } - } -+ -+ @Override -+ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) -+ { -+ IBlockState state = world.getBlockState(pos); -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata()))); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch index 28763cd3ca..c5808a94b5 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockOre.java +++ ../src-work/minecraft/net/minecraft/block/BlockOre.java -@@ -58,34 +58,40 @@ +@@ -59,34 +59,40 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); @@ -48,4 +48,4 @@ + return 0; } - public int getDamageValue(World worldIn, BlockPos pos) + public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch index c5061c08f0..b8055f42b3 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPane.java +++ ../src-work/minecraft/net/minecraft/block/BlockPane.java -@@ -38,7 +38,10 @@ +@@ -105,7 +105,10 @@ public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { @@ -12,24 +12,9 @@ } public Item getItemDropped(IBlockState state, Random rand, int fortune) -@@ -64,10 +67,10 @@ - - public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) +@@ -182,4 +185,11 @@ { -- boolean flag = this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()); -- boolean flag1 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()); -- boolean flag2 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()); -- boolean flag3 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()); -+ boolean flag = this.canPaneConnectTo(worldIn, pos, EnumFacing.NORTH); -+ boolean flag1 = this.canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH); -+ boolean flag2 = this.canPaneConnectTo(worldIn, pos, EnumFacing.WEST); -+ boolean flag3 = this.canPaneConnectTo(worldIn, pos, EnumFacing.EAST); - - if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) - { -@@ -186,4 +189,11 @@ - { - return new BlockState(this, new IProperty[] {NORTH, EAST, WEST, SOUTH}); + return new BlockStateContainer(this, new IProperty[] {NORTH, EAST, WEST, SOUTH}); } + + public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch deleted file mode 100644 index c696444afe..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java -@@ -189,7 +189,7 @@ - } - } - -- if (!flag1 && block.getMaterial() != Material.air && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) -+ if (!flag1 && !block.isAir(worldIn, blockpos) && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) - { - this.doMove(worldIn, pos, enumfacing, false); - } -@@ -333,7 +333,7 @@ - return false; - } - -- return !(blockIn instanceof ITileEntityProvider); -+ return !(blockIn.hasTileEntity(worldIn.getBlockState(pos))); - } - else - { -@@ -371,7 +371,9 @@ - { - BlockPos blockpos = (BlockPos)list1.get(j); - Block block = worldIn.getBlockState(blockpos).getBlock(); -- block.dropBlockAsItem(worldIn, blockpos, worldIn.getBlockState(blockpos), 0); -+ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. -+ float chance = block instanceof BlockSnow ? -1.0f : 1.0f; -+ block.dropBlockAsItemWithChance(worldIn, blockpos, worldIn.getBlockState(blockpos), chance, 0); - worldIn.setBlockToAir(blockpos); - --i; - ablock[i] = block; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch index c1bf64fbd4..7cb52f548b 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch @@ -1,26 +1,8 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java +++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java -@@ -109,16 +109,7 @@ - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) +@@ -190,4 +190,16 @@ { -- if (!worldIn.isRemote) -- { -- TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); -- -- if (tileentitypiston != null) -- { -- IBlockState iblockstate = tileentitypiston.getPistonState(); -- iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0); -- } -- } -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); - } - - public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) -@@ -282,4 +273,16 @@ - { - return new BlockState(this, new IProperty[] {FACING, TYPE}); + return new BlockStateContainer(this, new IProperty[] {FACING, TYPE}); } + + @Override diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch deleted file mode 100644 index 7c4e2d1991..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPotato.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java -@@ -22,13 +22,14 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -- -- if (!worldIn.isRemote) -- { -- if (((Integer)state.getValue(AGE)).intValue() >= 7 && worldIn.rand.nextInt(50) == 0) -- { -- spawnAsEntity(worldIn, pos, new ItemStack(Items.poisonous_potato)); -- } -- } - } -+ @Override -+ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = super.getDrops(world, pos, state, fortune); -+ java.util.Random rand = world instanceof World ? ((World)world).rand : new java.util.Random(); -+ if (((Integer)state.getValue(AGE)) >= 7 && rand.nextInt(50) == 0) -+ ret.add(new ItemStack(Items.poisonous_potato)); -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch deleted file mode 100644 index 6d75c0f947..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java -@@ -115,7 +115,7 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); -+ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); - } - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch index 413d42a6f4..14c8cb0545 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/block/BlockQuartz.java +++ ../src-work/minecraft/net/minecraft/block/BlockQuartz.java -@@ -90,6 +90,26 @@ - return new BlockState(this, new IProperty[] {VARIANT}); +@@ -113,6 +113,26 @@ + return new BlockStateContainer(this, new IProperty[] {VARIANT}); } + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch index 8dea2624ef..835fdb0489 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRailBase.java +++ ../src-work/minecraft/net/minecraft/block/BlockRailBase.java -@@ -31,7 +31,7 @@ +@@ -32,7 +32,7 @@ public static boolean isRailBlock(IBlockState state) { Block block = state.getBlock(); @@ -9,7 +9,7 @@ } protected BlockRailBase(boolean isPowered) -@@ -175,6 +175,81 @@ +@@ -160,6 +160,81 @@ public abstract IProperty getShapeProperty(); @@ -91,7 +91,7 @@ public static enum EnumRailDirection implements IStringSerializable { NORTH_SOUTH(0, "north_south"), -@@ -245,6 +320,7 @@ +@@ -230,6 +305,7 @@ private IBlockState state; private final boolean isPowered; private final List field_150657_g = Lists.newArrayList(); @@ -99,17 +99,7 @@ public Rail(World worldIn, BlockPos pos, IBlockState state) { -@@ -253,7 +329,8 @@ - this.state = state; - this.block = (BlockRailBase)state.getBlock(); - BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(BlockRailBase.this.getShapeProperty()); -- this.isPowered = this.block.isPowered; -+ this.isPowered = !this.block.isFlexibleRail(worldIn, pos); -+ canMakeSlopes = this.block.canMakeSlopes(worldIn, pos); - this.func_180360_a(blockrailbase$enumraildirection); - } - -@@ -439,7 +516,7 @@ +@@ -429,7 +505,7 @@ } } @@ -118,7 +108,7 @@ { if (BlockRailBase.isRailBlock(this.world, blockpos.up())) { -@@ -452,7 +529,7 @@ +@@ -442,7 +518,7 @@ } } @@ -127,7 +117,7 @@ { if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) { -@@ -595,7 +672,7 @@ +@@ -585,7 +661,7 @@ } } @@ -136,7 +126,7 @@ { if (BlockRailBase.isRailBlock(this.world, blockpos.up())) { -@@ -608,7 +685,7 @@ +@@ -598,7 +674,7 @@ } } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch index 6799d4271b..68cb203840 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java -@@ -295,6 +295,21 @@ - return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(POWERED, Boolean.valueOf(false)).withProperty(MODE, BlockRedstoneComparator.Mode.COMPARE); +@@ -310,6 +310,21 @@ + return this.getDefaultState().withProperty(field_185512_D, placer.getHorizontalFacing().getOpposite()).withProperty(POWERED, Boolean.valueOf(false)).withProperty(MODE, BlockRedstoneComparator.Mode.COMPARE); } + @Override diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch index f165b66c88..0b5a254905 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java -@@ -198,6 +198,8 @@ +@@ -204,6 +204,8 @@ { - EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + EnumFacing enumfacing = (EnumFacing)state.getValue(field_185512_D); BlockPos blockpos = pos.offset(enumfacing.getOpposite()); + if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldIn, pos, worldIn.getBlockState(pos), java.util.EnumSet.of(enumfacing.getOpposite())).isCanceled()) + return; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch index 61ff6434e5..8acd40ee8d 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java -@@ -91,12 +91,16 @@ +@@ -92,12 +92,16 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch deleted file mode 100644 index 9e635ef051..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java -@@ -58,10 +58,10 @@ - BlockPos blockpos = pos.offset(direction); - Block block = worldIn.getBlockState(pos.offset(direction)).getBlock(); - -- if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (block.isBlockNormalCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down())))) -+ if (!canRestoneConnect(worldIn, blockpos, direction) && (block.isBlockNormalCube() || !canRestoneConnect(worldIn, blockpos.down(), null))) - { - Block block1 = worldIn.getBlockState(pos.up()).getBlock(); -- return !block1.isBlockNormalCube() && block.isBlockNormalCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; -+ return !block1.isBlockNormalCube() && block.isBlockNormalCube() && canRestoneConnect(worldIn, blockpos.up(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; - } - else - { -@@ -359,35 +359,24 @@ - Block block = iblockstate.getBlock(); - boolean flag = block.isNormalCube(); - boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); -- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down()))); -+ return !flag1 && flag && canRestoneConnect(worldIn, blockpos.up(), null) ? true : (canRestoneConnect(worldIn, blockpos, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canRestoneConnect(worldIn, blockpos.down(), null))); - } - -- protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos) -+ protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side) - { -- return canConnectUpwardsTo(worldIn.getBlockState(pos)); -- } -- -- protected static boolean canConnectUpwardsTo(IBlockState state) -- { -- return canConnectTo(state, (EnumFacing)null); -- } -- -- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) -- { -- Block block = blockState.getBlock(); -- -- if (block == Blocks.redstone_wire) -+ IBlockState state = world.getBlockState(pos); -+ if (state.getBlock() == Blocks.redstone_wire) - { - return true; - } -- else if (Blocks.unpowered_repeater.isAssociated(block)) -+ else if (Blocks.unpowered_repeater.isAssociated(state.getBlock())) - { -- EnumFacing enumfacing = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING); -- return enumfacing == side || enumfacing.getOpposite() == side; -+ EnumFacing direction = (EnumFacing)state.getValue(BlockRedstoneRepeater.FACING); -+ return direction == side || direction.getOpposite() == side; - } - else - { -- return block.canProvidePower() && side != null; -+ return state.getBlock().canConnectRedstone(world, pos, side); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch index a6e2c2ae8b..73e2c0206c 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockReed.java +++ ../src-work/minecraft/net/minecraft/block/BlockReed.java -@@ -18,7 +18,7 @@ +@@ -19,7 +19,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -8,8 +8,8 @@ +public class BlockReed extends Block implements net.minecraftforge.common.IPlantable { public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); - -@@ -65,6 +65,7 @@ + protected static final AxisAlignedBB field_185701_b = new AxisAlignedBB(0.125D, 0.0D, 0.125D, 0.875D, 1.0D, 0.875D); +@@ -70,6 +70,7 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { Block block = worldIn.getBlockState(pos.down()).getBlock(); @@ -17,11 +17,10 @@ if (block == this) { -@@ -164,4 +165,15 @@ - { - return new BlockState(this, new IProperty[] {AGE}); +@@ -162,6 +163,17 @@ + return ((Integer)state.getValue(AGE)).intValue(); } -+ + + @Override + public net.minecraftforge.common.EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) + { @@ -32,4 +31,7 @@ + { + return this.getDefaultState(); + } - } ++ + protected BlockStateContainer createBlockState() + { + return new BlockStateContainer(this, new IProperty[] {AGE}); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch index e450bf9074..f7f921a9e8 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch @@ -1,10 +1,9 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRotatedPillar.java +++ ../src-work/minecraft/net/minecraft/block/BlockRotatedPillar.java -@@ -18,4 +18,18 @@ - { +@@ -28,6 +28,20 @@ super(p_i46385_1_, p_i46385_2_); } -+ + + public boolean rotateBlock(net.minecraft.world.World world, net.minecraft.util.BlockPos pos, EnumFacing axis) + { + net.minecraft.block.state.IBlockState state = world.getBlockState(pos); @@ -18,4 +17,7 @@ + } + return false; + } - } ++ + public IBlockState func_185499_a(IBlockState p_185499_1_, Rotation p_185499_2_) + { + switch (p_185499_2_) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch index ce119c1ba8..559b05cb5c 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSapling.java +++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java -@@ -71,6 +71,7 @@ +@@ -77,6 +77,7 @@ public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand) { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch index abe2893df2..6eba91dd92 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSkull.java +++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java -@@ -121,10 +121,6 @@ - return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).getSkullType() : super.getDamageValue(worldIn, pos); +@@ -116,10 +116,6 @@ + return new ItemStack(Items.skull, 1, i); } - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) @@ -11,7 +11,7 @@ public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) { if (player.capabilities.isCreativeMode) -@@ -132,13 +128,18 @@ +@@ -127,13 +123,18 @@ state = state.withProperty(NODROP, Boolean.valueOf(true)); worldIn.setBlockState(pos, state, 4); } @@ -31,16 +31,7 @@ { if (!((Boolean)state.getValue(NODROP)).booleanValue()) { -@@ -147,7 +148,7 @@ - if (tileentity instanceof TileEntitySkull) - { - TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; -- ItemStack itemstack = new ItemStack(Items.skull, 1, this.getDamageValue(worldIn, pos)); -+ ItemStack itemstack = new ItemStack(Items.skull, 1, tileentityskull.getSkullType()); - - if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null) - { -@@ -157,12 +158,11 @@ +@@ -152,12 +153,11 @@ itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound); } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch index f6b830de37..7b088c7379 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSlab.java +++ ../src-work/minecraft/net/minecraft/block/BlockSlab.java -@@ -91,6 +91,17 @@ +@@ -50,6 +50,17 @@ return this.isDouble(); } @@ -18,21 +18,3 @@ public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { IBlockState iblockstate = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM); -@@ -118,15 +129,8 @@ - { - return false; - } -- else -- { -- BlockPos blockpos = pos.offset(side.getOpposite()); -- IBlockState iblockstate = worldIn.getBlockState(pos); -- IBlockState iblockstate1 = worldIn.getBlockState(blockpos); -- boolean flag = isSlab(iblockstate.getBlock()) && iblockstate.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP; -- boolean flag1 = isSlab(iblockstate1.getBlock()) && iblockstate1.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP; -- return flag1 ? (side == EnumFacing.DOWN ? true : (side == EnumFacing.UP && super.shouldSideBeRendered(worldIn, pos, side) ? true : !isSlab(iblockstate.getBlock()) || !flag)) : (side == EnumFacing.UP ? true : (side == EnumFacing.DOWN && super.shouldSideBeRendered(worldIn, pos, side) ? true : !isSlab(iblockstate.getBlock()) || flag)); -- } -+ // additional logic breaks doesSideBlockRendering and is no longer useful. -+ return super.shouldSideBeRendered(worldIn, pos, side); - } - - @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch index 99b5ece864..3fd57bfd7d 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch @@ -1,15 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSnow.java +++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java -@@ -79,7 +79,7 @@ - { - IBlockState iblockstate = worldIn.getBlockState(pos.down()); - Block block = iblockstate.getBlock(); -- return block != Blocks.ice && block != Blocks.packed_ice ? (block.getMaterial() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; -+ return block != Blocks.ice && block != Blocks.packed_ice ? (block.isLeaves(worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; - } - - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) -@@ -91,7 +91,6 @@ +@@ -85,7 +85,6 @@ { if (!this.canPlaceBlockAt(worldIn, pos)) { @@ -17,18 +8,7 @@ worldIn.setBlockToAir(pos); return false; } -@@ -103,9 +102,8 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0)); -+ super.harvestBlock(worldIn, player, pos, state, te); - worldIn.setBlockToAir(pos); -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); - } - - public Item getItemDropped(IBlockState state, Random rand, int fortune) -@@ -115,14 +113,13 @@ +@@ -109,14 +108,13 @@ public int quantityDropped(Random random) { @@ -44,10 +24,12 @@ worldIn.setBlockToAir(pos); } } -@@ -152,4 +149,6 @@ - { - return new BlockState(this, new IProperty[] {LAYERS}); +@@ -150,6 +148,8 @@ + return ((Integer)state.getValue(LAYERS)).intValue() - 1; } -+ + + @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.getValue(LAYERS)) + 1; } - } ++ + protected BlockStateContainer createBlockState() + { + return new BlockStateContainer(this, new IProperty[] {LAYERS}); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch deleted file mode 100644 index 33a74a3c22..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockStairs.java -+++ ../src-work/minecraft/net/minecraft/block/BlockStairs.java -@@ -68,6 +68,19 @@ - return false; - } - -+ @Override -+ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ if ( isOpaqueCube() ) -+ return true; -+ -+ // face is on the block being rendered, not this block. -+ IBlockState iblockstate = world.getBlockState(pos); -+ EnumHalf half = iblockstate.getValue(HALF); -+ EnumFacing side = iblockstate.getValue(FACING); -+ return side == face.getOpposite() || (half == EnumHalf.TOP && face == EnumFacing.DOWN) || (half == EnumHalf.BOTTOM && face == EnumFacing.UP); -+ } -+ - public boolean isFullCube() - { - return false; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch index 41d70ce17d..c68f85e424 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockStem.java +++ ../src-work/minecraft/net/minecraft/block/BlockStem.java -@@ -94,7 +94,7 @@ +@@ -91,7 +91,7 @@ pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand)); Block block = worldIn.getBlockState(pos.down()).getBlock(); @@ -9,7 +9,7 @@ { worldIn.setBlockState(pos, this.crop.getDefaultState()); } -@@ -148,8 +148,12 @@ +@@ -109,8 +109,12 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); @@ -23,7 +23,7 @@ { Item item = this.getSeedItem(); -@@ -159,13 +163,14 @@ +@@ -120,13 +124,14 @@ for (int j = 0; j < 3; ++j) { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch index d0a3b75f39..f53bcd4ba0 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch @@ -8,17 +8,8 @@ +public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable { public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockTallGrass.EnumType.class); - -@@ -43,7 +43,7 @@ - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ return super.canBlockStay(worldIn, pos, state); - } - - public boolean isReplaceable(World worldIn, BlockPos pos) -@@ -53,7 +53,7 @@ + protected static final AxisAlignedBB field_185522_c = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D); +@@ -51,7 +51,7 @@ public Item getItemDropped(IBlockState state, Random rand, int fortune) { @@ -27,21 +18,7 @@ } public int quantityDroppedWithBonus(int fortune, Random random) -@@ -63,13 +63,7 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) - { -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta())); -- } -- else -- { - super.harvestBlock(worldIn, player, pos, state, te); - } - } -@@ -204,4 +198,22 @@ +@@ -181,4 +181,22 @@ } } } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch index 83c0fc29c7..9eba3ac141 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockTorch.java +++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java -@@ -63,7 +63,7 @@ +@@ -86,7 +86,7 @@ else { Block block = worldIn.getBlockState(pos).getBlock(); @@ -9,7 +9,7 @@ } } -@@ -84,7 +84,7 @@ +@@ -107,7 +107,7 @@ { BlockPos blockpos = pos.offset(facing.getOpposite()); boolean flag = facing.getAxis().isHorizontal(); @@ -18,7 +18,7 @@ } public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) -@@ -97,7 +97,7 @@ +@@ -120,7 +120,7 @@ { for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) { @@ -27,7 +27,7 @@ { return this.getDefaultState().withProperty(FACING, enumfacing); } -@@ -130,7 +130,7 @@ +@@ -153,7 +153,7 @@ EnumFacing enumfacing1 = enumfacing.getOpposite(); boolean flag = false; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch deleted file mode 100644 index 7de11cc755..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java -@@ -25,6 +25,8 @@ - - public class BlockTrapDoor extends Block - { -+ /** Set this to allow trapdoors to remain free-floating */ -+ public static boolean disableValidation = false; - public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); - public static final PropertyBool OPEN = PropertyBool.create("open"); - public static final PropertyEnum HALF = PropertyEnum.create("half", BlockTrapDoor.DoorHalf.class); -@@ -140,9 +142,10 @@ - { - if (!worldIn.isRemote) - { -+ EnumFacing direction = (EnumFacing)state.getValue(FACING); - BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()); - -- if (!isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock())) -+ if (!(isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock()) || worldIn.isSideSolid(blockpos, direction, true))) - { - worldIn.setBlockToAir(pos); - this.dropBlockAsItem(worldIn, pos, state, 0); -@@ -186,7 +189,10 @@ - - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) - { -- return !side.getAxis().isVertical() && isValidSupportBlock(worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock()); -+ if (disableValidation) return true; -+ EnumFacing dir = side.getOpposite(); -+ pos = pos.offset(dir); -+ return !side.getAxis().isVertical() && (isValidSupportBlock(worldIn.getBlockState(pos).getBlock()) || worldIn.isSideSolid(pos, side, true)); - } - - protected static EnumFacing getFacing(int meta) -@@ -223,6 +229,7 @@ - - private static boolean isValidSupportBlock(Block blockIn) - { -+ if (disableValidation) return true; - return blockIn.blockMaterial.isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs; - } - diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch deleted file mode 100644 index a8de6b96ff..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java -@@ -58,14 +58,14 @@ - - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) - { -- return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock().isNormalCube(); -+ return side.getAxis().isHorizontal() && worldIn.isSideSolid(pos.offset(side.getOpposite()), side, true); - } - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { - for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) - { -- if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube()) -+ if (worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true)) - { - return true; - } -@@ -99,7 +99,7 @@ - { - EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); - -- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock().isNormalCube()) -+ if (!worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) - { - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch index a3536a8504..cc09afa923 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockVine.java +++ ../src-work/minecraft/net/minecraft/block/BlockVine.java -@@ -25,7 +25,7 @@ +@@ -26,7 +26,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -9,21 +9,7 @@ { public static final PropertyBool UP = PropertyBool.create("up"); public static final PropertyBool NORTH = PropertyBool.create("north"); -@@ -387,13 +387,7 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) - { -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0)); -- } -- else -- { - super.harvestBlock(worldIn, player, pos, state, te); - } - } -@@ -474,4 +468,14 @@ +@@ -457,4 +457,14 @@ return i; } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch deleted file mode 100644 index a9bcee491d..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java -+++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java -@@ -78,7 +78,7 @@ - { - Block block = this.world.getBlockState(origin).getBlock(); - -- if (block.getMaterial() == Material.air) -+ if (block.isAir(world, origin)) - { - return true; - } -@@ -109,7 +109,7 @@ - BlockPos blockpos = origin.offset(this.moveDirection.getOpposite(), i); - block = this.world.getBlockState(blockpos).getBlock(); - -- if (block.getMaterial() == Material.air || !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) -+ if (block.isAir(world, blockpos)|| !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) - { - break; - } -@@ -156,7 +156,7 @@ - - block = this.world.getBlockState(blockpos1).getBlock(); - -- if (block.getMaterial() == Material.air) -+ if (block.isAir(world, blockpos1)) - { - return true; - } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockState.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockState.java.patch deleted file mode 100644 index 3572047363..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/state/BlockState.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/state/BlockState.java -+++ ../src-work/minecraft/net/minecraft/block/state/BlockState.java -@@ -38,6 +38,16 @@ - - public BlockState(Block blockIn, IProperty... properties) - { -+ this(blockIn, properties, null); -+ } -+ -+ protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) -+ { -+ return new StateImplementation(block, properties); -+ } -+ -+ protected BlockState(Block blockIn, IProperty[] properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) -+ { - this.block = blockIn; - Arrays.sort(properties, new Comparator() - { -@@ -53,7 +63,7 @@ - for (List list1 : Cartesian.cartesianProduct(this.getAllowedValues())) - { - Map map1 = MapPopulator.createMap(this.properties, list1); -- BlockState.StateImplementation blockstate$stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map1)); -+ BlockState.StateImplementation blockstate$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map1), unlistedProperties); - map.put(map1, blockstate$stateimplementation); - list.add(blockstate$stateimplementation); - } -@@ -132,6 +142,13 @@ - } - } - -+ protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable) -+ { -+ this.block = blockIn; -+ this.properties = propertiesIn; -+ this.propertyValueTable = propertyValueTable; -+ } -+ - public , V extends T> IBlockState withProperty(IProperty property, V value) - { - if (!this.properties.containsKey(property)) -@@ -199,5 +216,10 @@ - map.put(property, value); - return map; - } -+ -+ public ImmutableTable getPropertyValueTable() -+ { -+ return propertyValueTable; -+ } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch index a8c5028636..1391fcbe52 100644 --- a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/state/BlockStateBase.java +++ ../src-work/minecraft/net/minecraft/block/state/BlockStateBase.java -@@ -67,4 +67,9 @@ +@@ -71,4 +71,9 @@ return stringbuilder.toString(); } diff --git a/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch index 093758d5b0..c4f3c5cdb2 100644 --- a/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch @@ -9,10 +9,10 @@ + if (!net.minecraftforge.fml.client.FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) //FML Don't render while FML's pre-screen is rendering + { Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + VertexBuffer vertexbuffer = tessellator.getWorldRenderer(); this.mc.getTextureManager().bindTexture(Gui.optionsBackground); @@ -174,6 +178,12 @@ - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); this.mc.fontRendererObj.drawStringWithShadow(this.currentlyDisplayedText, (float)((k - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2), (float)(l / 2 - 4 - 16), 16777215); this.mc.fontRendererObj.drawStringWithShadow(this.message, (float)((k - this.mc.fontRendererObj.getStringWidth(this.message)) / 2), (float)(l / 2 - 4 + 8), 16777215); + } diff --git a/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch b/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch index 352354a013..caba83d8c0 100644 --- a/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,27 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/Minecraft.java +++ ../src-work/minecraft/net/minecraft/client/Minecraft.java -@@ -301,7 +301,6 @@ - this.sessionService = (new YggdrasilAuthenticationService(gameConfig.userInfo.proxy, UUID.randomUUID().toString())).createMinecraftSessionService(); +@@ -318,7 +318,6 @@ + this.sessionService = (new YggdrasilAuthenticationService(this.proxy, UUID.randomUUID().toString())).createMinecraftSessionService(); this.session = gameConfig.userInfo.session; logger.info("Setting user: " + this.session.getUsername()); - logger.info("(Session ID is " + this.session.getSessionID() + ")"); this.isDemo = gameConfig.gameInfo.isDemo; this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1; this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1; -@@ -415,10 +414,10 @@ - this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_); - this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language); - this.mcResourceManager.registerReloadListener(this.mcLanguageManager); -- this.refreshResources(); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.defaultResourcePacks, this.mcResourceManager); - this.renderEngine = new TextureManager(this.mcResourceManager); - this.mcResourceManager.registerReloadListener(this.renderEngine); -- this.drawSplashScreen(this.renderEngine); -+ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.renderEngine); - this.initStream(); - this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); - this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves")); -@@ -453,6 +452,8 @@ +@@ -469,6 +468,8 @@ } }); this.mouseHelper = new MouseHelper(); @@ -30,59 +17,7 @@ this.checkGLError("Pre startup"); GlStateManager.enableTexture2D(); GlStateManager.shadeModel(7425); -@@ -466,17 +467,21 @@ - GlStateManager.loadIdentity(); - GlStateManager.matrixMode(5888); - this.checkGLError("Startup"); -- this.textureMapBlocks = new TextureMap("textures"); -+ bar.step("Loading Texture Map"); -+ this.textureMapBlocks = new TextureMap("textures",true); - this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels); - this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks); - this.renderEngine.bindTexture(TextureMap.locationBlocksTexture); - this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0); -+ bar.step("Loading Model Manager"); - this.modelManager = new ModelManager(this.textureMapBlocks); - this.mcResourceManager.registerReloadListener(this.modelManager); -+ bar.step("Loading Item Renderer"); - this.renderItem = new RenderItem(this.renderEngine, this.modelManager); - this.renderManager = new RenderManager(this.renderEngine, this.renderItem); - this.itemRenderer = new ItemRenderer(this); - this.mcResourceManager.registerReloadListener(this.renderItem); -+ bar.step("Loading Entity Renderer"); - this.entityRenderer = new EntityRenderer(this, this.mcResourceManager); - this.mcResourceManager.registerReloadListener(this.entityRenderer); - this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.gameSettings); -@@ -486,22 +491,25 @@ - this.guiAchievement = new GuiAchievement(this); - GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight); - this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading(); - this.checkGLError("Post startup"); -- this.ingameGUI = new GuiIngame(this); -+ this.ingameGUI = new net.minecraftforge.client.GuiIngameForge(this); - - if (this.serverName != null) - { -- this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort)); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.serverName, this.serverPort); - } - else - { - this.displayGuiScreen(new GuiMainMenu()); - } - -- this.renderEngine.deleteTexture(this.mojangLogo); -+ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(renderEngine, mojangLogo); - this.mojangLogo = null; - this.loadingScreen = new LoadingScreenRenderer(this); - -+ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete(); - if (this.gameSettings.fullScreen && !this.fullscreen) - { - this.toggleFullscreen(); -@@ -681,21 +689,23 @@ +@@ -692,21 +693,23 @@ File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); Bootstrap.printToSYSOUT(crashReportIn.getCompleteReport()); @@ -109,7 +44,7 @@ } public boolean isUnicode() -@@ -883,11 +893,6 @@ +@@ -899,11 +902,6 @@ public void displayGuiScreen(GuiScreen guiScreenIn) { @@ -121,25 +56,7 @@ if (guiScreenIn == null && this.theWorld == null) { guiScreenIn = new GuiMainMenu(); -@@ -897,6 +902,17 @@ - guiScreenIn = new GuiGameOver(); - } - -+ GuiScreen old = this.currentScreen; -+ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(guiScreenIn); -+ -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; -+ -+ guiScreenIn = event.gui; -+ if (old != null && guiScreenIn != old) -+ { -+ old.onGuiClosed(); -+ } -+ - if (guiScreenIn instanceof GuiMainMenu) - { - this.gameSettings.showDebugInfo = false; -@@ -1030,9 +1046,11 @@ +@@ -1051,9 +1049,11 @@ if (!this.skipRenderWorld) { @@ -151,47 +68,7 @@ } this.mcProfiler.endSection(); -@@ -1377,7 +1395,7 @@ - - if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit)) - { -- this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit); -+ this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver); - this.thePlayer.swingItem(); - } - } -@@ -1463,15 +1481,19 @@ - case BLOCK: - BlockPos blockpos = this.objectMouseOver.getBlockPos(); - -- if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air) -+ if (!this.theWorld.isAirBlock(blockpos)) - { - int i = itemstack != null ? itemstack.stackSize : 0; - -+ -+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.theWorld, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec).isCanceled(); -+ if (result) { //Forge: Kept separate to simplify patch - if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec)) - { - flag = false; - this.thePlayer.swingItem(); - } -+ } - - if (itemstack == null) - { -@@ -1494,7 +1516,8 @@ - { - ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); - -- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) -+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, theWorld, null, null, null).isCanceled(); -+ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) - { - this.entityRenderer.itemRenderer.resetEquippedProgress2(); - } -@@ -1598,6 +1621,8 @@ +@@ -1623,6 +1623,8 @@ --this.rightClickDelayTimer; } @@ -200,48 +77,23 @@ this.mcProfiler.startSection("gui"); if (!this.isGamePaused) -@@ -1690,6 +1715,8 @@ - - while (Mouse.next()) - { -+ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; -+ - int i = Mouse.getEventButton(); - KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); - -@@ -1745,6 +1772,7 @@ - this.currentScreen.handleMouseInput(); - } +@@ -1734,6 +1736,7 @@ + this.joinPlayerCounter = 0; + this.theWorld.joinEntityInSurroundings(this.thePlayer); } + net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput(); } - if (this.leftClickCounter > 0) -@@ -1923,6 +1951,7 @@ - } + this.mcProfiler.endStartSection("gameRenderer"); +@@ -1926,6 +1929,7 @@ + this.gameSettings.showLagometer = this.gameSettings.showDebugInfo && GuiScreen.isAltKeyDown(); } } + net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput(); } - - for (int l = 0; l < 9; ++l) -@@ -2119,12 +2148,15 @@ - this.myNetworkManager.processReceivedPackets(); } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick(); -+ - this.mcProfiler.endSection(); - this.systemTime = getSystemTime(); - } - - public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn) - { -+ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(folderName, worldName, worldSettingsIn); - this.loadWorld((WorldClient)null); - System.gc(); - ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); -@@ -2160,6 +2192,12 @@ +@@ -2273,6 +2277,12 @@ while (!this.theIntegratedServer.serverIsInRunLoop()) { @@ -254,24 +106,7 @@ String s = this.theIntegratedServer.getUserMessage(); if (s != null) -@@ -2185,8 +2223,14 @@ - SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); - NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); - networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); -- networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); -- networkmanager.sendPacket(new C00PacketLoginStart(this.getSession().getProfile())); -+ networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true)); -+ com.mojang.authlib.GameProfile gameProfile = this.getSession().getProfile(); -+ if (!this.getSession().hasCachedProperties()) -+ { -+ gameProfile = sessionService.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. -+ this.getSession().setProperties(gameProfile.getProperties()); -+ } -+ networkmanager.sendPacket(new C00PacketLoginStart(gameProfile)); - this.myNetworkManager = networkmanager; - } - -@@ -2197,6 +2241,8 @@ +@@ -2310,6 +2320,8 @@ public void loadWorld(WorldClient worldClientIn, String loadingMessage) { @@ -280,26 +115,7 @@ if (worldClientIn == null) { NetHandlerPlayClient nethandlerplayclient = this.getNetHandler(); -@@ -2210,6 +2256,18 @@ - { - this.theIntegratedServer.initiateShutdown(); - this.theIntegratedServer.setStaticInstance(); -+ if (loadingScreen != null) -+ { -+ this.loadingScreen.displayLoadingString(I18n.format("forge.client.shutdown.internal")); -+ } -+ while (!theIntegratedServer.isServerStopped()) -+ { -+ try -+ { -+ Thread.sleep(10); -+ } -+ catch (InterruptedException ie) {} -+ } - } - - this.theIntegratedServer = null; -@@ -2232,6 +2290,7 @@ +@@ -2345,6 +2357,7 @@ this.ingameGUI.func_181029_i(); this.setServerData((ServerData)null); this.integratedServerIsRunning = false; @@ -307,153 +123,3 @@ } this.mcSoundHandler.stopSounds(); -@@ -2336,126 +2395,10 @@ - if (this.objectMouseOver != null) - { - boolean flag = this.thePlayer.capabilities.isCreativeMode; -- int i = 0; -- boolean flag1 = false; -- TileEntity tileentity = null; -- Item item; -- -- if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) -- { -- BlockPos blockpos = this.objectMouseOver.getBlockPos(); -- Block block = this.theWorld.getBlockState(blockpos).getBlock(); -- -- if (block.getMaterial() == Material.air) -- { -- return; -- } -- -- item = block.getItem(this.theWorld, blockpos); -- -- if (item == null) -- { -- return; -- } -- -- if (flag && GuiScreen.isCtrlKeyDown()) -- { -- tileentity = this.theWorld.getTileEntity(blockpos); -- } -- -- Block block1 = item instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem(item) : block; -- i = block1.getDamageValue(this.theWorld, blockpos); -- flag1 = item.getHasSubtypes(); -- } -- else -- { -- if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) -- { -- return; -- } -- -- if (this.objectMouseOver.entityHit instanceof EntityPainting) -- { -- item = Items.painting; -- } -- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) -- { -- item = Items.lead; -- } -- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) -- { -- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; -- ItemStack itemstack = entityitemframe.getDisplayedItem(); -- -- if (itemstack == null) -- { -- item = Items.item_frame; -- } -- else -- { -- item = itemstack.getItem(); -- i = itemstack.getMetadata(); -- flag1 = true; -- } -- } -- else if (this.objectMouseOver.entityHit instanceof EntityMinecart) -- { -- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; -- -- switch (entityminecart.getMinecartType()) -- { -- case FURNACE: -- item = Items.furnace_minecart; -- break; -- case CHEST: -- item = Items.chest_minecart; -- break; -- case TNT: -- item = Items.tnt_minecart; -- break; -- case HOPPER: -- item = Items.hopper_minecart; -- break; -- case COMMAND_BLOCK: -- item = Items.command_block_minecart; -- break; -- default: -- item = Items.minecart; -- } -- } -- else if (this.objectMouseOver.entityHit instanceof EntityBoat) -- { -- item = Items.boat; -- } -- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) -- { -- item = Items.armor_stand; -- } -- else -- { -- item = Items.spawn_egg; -- i = EntityList.getEntityID(this.objectMouseOver.entityHit); -- flag1 = true; -- -- if (!EntityList.entityEggs.containsKey(Integer.valueOf(i))) -- { -- return; -- } -- } -- } -- - InventoryPlayer inventoryplayer = this.thePlayer.inventory; - -- if (tileentity == null) -- { -- inventoryplayer.setCurrentItem(item, i, flag1, flag); -- } -- else -- { -- ItemStack itemstack1 = this.func_181036_a(item, i, tileentity); -- inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1); -- } -- -+ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld)) return; -+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions - if (flag) - { - int j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + inventoryplayer.currentItem; -@@ -2756,18 +2699,8 @@ - - public static int getGLMaximumTextureSize() - { -- for (int i = 16384; i > 0; i >>= 1) -- { -- GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)((ByteBuffer)null)); -- int j = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); -- -- if (j != 0) -- { -- return i; -- } -- } -- -- return -1; -+ //Forge we redirect this to our code which caches the value before any splash screen stuff is done. -+ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize(); - } - - public boolean isSnooperEnabled() diff --git a/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch index 3d4c138169..2afdefe87f 100644 --- a/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/audio/SoundManager.java +++ ../src-work/minecraft/net/minecraft/client/audio/SoundManager.java -@@ -69,6 +69,7 @@ +@@ -76,6 +76,7 @@ { SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); @@ -8,34 +8,11 @@ } catch (SoundSystemException soundsystemexception) { -@@ -80,6 +81,7 @@ - { +@@ -100,6 +101,7 @@ + this.unloadSoundSystem(); this.loadSoundSystem(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundLoadEvent(this)); } private synchronized void loadSoundSystem() -@@ -316,6 +318,9 @@ - } - else - { -+ sound = net.minecraftforge.client.ForgeHooksClient.playSound(this, sound); -+ if (sound == null) return; -+ - SoundEventAccessorComposite soundeventaccessorcomposite = this.sndHandler.getSound(sound.getSoundLocation()); - - if (soundeventaccessorcomposite == null) -@@ -357,10 +362,12 @@ - if (soundpoolentry.isStreamingSound()) - { - this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, sound, s)); - } - else - { - this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, sound, s)); - } - - logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.getSoundPoolEntryLocation(), soundeventaccessorcomposite.getSoundEventLocation(), s}); diff --git a/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch index 840d193e0f..74fca0297a 100644 --- a/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java +++ ../src-work/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java -@@ -128,6 +128,6 @@ +@@ -148,6 +148,6 @@ f *= 1.0F - f1 * 0.15F; } diff --git a/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch index 42c1d46058..88eedb390b 100644 --- a/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java +++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java -@@ -345,6 +345,15 @@ +@@ -400,6 +400,15 @@ this.mc.ingameGUI.getChatGUI().printChatMessage(chatComponent); } @@ -16,7 +16,7 @@ protected boolean pushOutOfBlocks(double x, double y, double z) { if (this.noClip) -@@ -357,30 +366,34 @@ +@@ -412,30 +421,34 @@ double d0 = x - (double)blockpos.getX(); double d1 = z - (double)blockpos.getZ(); @@ -56,16 +56,3 @@ { d2 = 1.0D - d1; i = 5; -@@ -448,6 +461,12 @@ - - public void playSound(String name, float volume, float pitch) - { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, name, volume, pitch); -+ if (event.isCanceled() || event.name == null) return; -+ name = event.name; -+ volume = event.newVolume; -+ pitch = event.newPitch; -+ - this.worldObj.playSound(this.posX, this.posY, this.posZ, name, volume, pitch, false); - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch index dff19271b4..7c4ef0a8e5 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch @@ -17,25 +17,7 @@ } private void readFontTexture() -@@ -105,7 +106,7 @@ - - try - { -- bufferedimage = TextureUtil.readBufferedImage(Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture).getInputStream()); -+ bufferedimage = TextureUtil.readBufferedImage(getResourceInputStream(this.locationFontTexture)); - } - catch (IOException ioexception) - { -@@ -165,7 +166,7 @@ - - try - { -- inputstream = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin")).getInputStream(); -+ inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin")); - inputstream.read(this.glyphWidth); - } - catch (IOException ioexception) -@@ -196,7 +197,7 @@ +@@ -202,7 +203,7 @@ int i = ch % 16 * 8; int j = ch / 16 * 8; int k = italic ? 1 : 0; @@ -43,8 +25,8 @@ + bindTexture(this.locationFontTexture); int l = this.charWidth[ch]; float f = (float)l - 0.01F; - GL11.glBegin(GL11.GL_TRIANGLE_STRIP); -@@ -224,7 +225,7 @@ + GlStateManager.func_187447_r(5); +@@ -230,7 +231,7 @@ private void loadGlyphTexture(int page) { @@ -53,7 +35,7 @@ } protected float renderUnicodeChar(char ch, boolean italic) -@@ -271,7 +272,7 @@ +@@ -279,7 +280,7 @@ public int drawString(String text, float x, float y, int color, boolean dropShadow) { @@ -62,7 +44,7 @@ this.resetStyles(); int i; -@@ -341,7 +342,7 @@ +@@ -349,7 +350,7 @@ int j1 = this.colorCode[i1]; this.textColor = j1; @@ -71,7 +53,7 @@ } else if (i1 == 16) { -@@ -370,7 +371,7 @@ +@@ -378,7 +379,7 @@ this.strikethroughStyle = false; this.underlineStyle = false; this.italicStyle = false; @@ -80,7 +62,7 @@ } ++i; -@@ -398,7 +399,7 @@ +@@ -406,7 +407,7 @@ c0 = c1; } @@ -89,7 +71,7 @@ boolean flag = (c0 == 0 || j == -1 || this.unicodeFlag) && shadow; if (flag) -@@ -436,7 +437,16 @@ +@@ -444,7 +445,16 @@ ++f; } @@ -106,7 +88,7 @@ if (this.strikethroughStyle) { Tessellator tessellator = Tessellator.getInstance(); -@@ -509,7 +519,7 @@ +@@ -517,7 +527,7 @@ this.blue = (float)(color >> 8 & 255) / 255.0F; this.green = (float)(color & 255) / 255.0F; this.alpha = (float)(color >> 24 & 255) / 255.0F; @@ -115,19 +97,7 @@ this.posX = x; this.posY = y; this.renderStringAtPos(text, dropShadow); -@@ -588,11 +598,6 @@ - int j = this.glyphWidth[character] >>> 4; - int k = this.glyphWidth[character] & 15; - -- if (k > 7) -- { -- k = 15; -- j = 0; -- } - - ++k; - return (k - j) / 2 + 1; -@@ -846,6 +851,26 @@ +@@ -848,6 +858,26 @@ return this.bidiFlag; } @@ -153,4 +123,4 @@ + public int getColorCode(char character) { - return this.colorCode["0123456789abcdef".indexOf(character)]; + int i = "0123456789abcdef".indexOf(character); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch index ee9c091800..fa7fb1ca1e 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java -@@ -21,6 +21,7 @@ +@@ -22,6 +22,7 @@ public boolean enabled; public boolean visible; protected boolean hovered; @@ -8,7 +8,7 @@ public GuiButton(int buttonId, int x, int y, String buttonText) { -@@ -74,6 +75,11 @@ +@@ -75,6 +76,11 @@ this.mouseDragged(mc, mouseX, mouseY); int j = 14737632; diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch deleted file mode 100644 index 56a8b7f493..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java -@@ -215,13 +215,14 @@ - this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(stringbuilder.toString()), 1); - } - -- this.inputField.writeText((String)this.foundPlayerNames.get(this.autocompleteIndex++)); -+ this.inputField.writeText(net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes((String)this.foundPlayerNames.get(this.autocompleteIndex++))); - } - - private void sendAutocompleteRequest(String p_146405_1_, String p_146405_2_) - { - if (p_146405_1_.length() >= 1) - { -+ net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_146405_1_, p_146405_2_); - BlockPos blockpos = null; - - if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) -@@ -281,6 +282,12 @@ - this.playerNamesFound = false; - this.foundPlayerNames.clear(); - -+ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete; -+ if (complete != null) -+ { -+ p_146406_1_ = com.google.common.collect.ObjectArrays.concat(complete, p_146406_1_, String.class); -+ } -+ - for (String s : p_146406_1_) - { - if (s.length() > 0) -@@ -291,6 +298,7 @@ - - String s1 = this.inputField.getText().substring(this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false)); - String s2 = StringUtils.getCommonPrefix(p_146406_1_); -+ s2 = net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes(s2); - - if (s2.length() > 0 && !s1.equalsIgnoreCase(s2)) - { diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch index a0dc53077d..714e647b52 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch @@ -1,15 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -@@ -205,6 +205,8 @@ - } - } - -+ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress(); -+ - WorldSettings.GameType worldsettings$gametype = WorldSettings.GameType.getByName(this.gameMode); - WorldSettings worldsettings = new WorldSettings(i, worldsettings$gametype, this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]); - worldsettings.setWorldName(this.chunkProviderSettingsJson); -@@ -312,14 +314,7 @@ +@@ -311,14 +311,7 @@ } else if (button.id == 8) { @@ -25,7 +16,7 @@ } } } -@@ -371,7 +366,7 @@ +@@ -370,7 +363,7 @@ this.btnBonusItems.visible = this.field_146344_y; this.btnMapType.visible = this.field_146344_y; this.btnAllowCommands.visible = this.field_146344_y; diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch index 264eb0ac2a..74df3b87b5 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java -@@ -223,7 +223,8 @@ +@@ -216,7 +216,8 @@ { this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer", new Object[0]))); this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0]))); @@ -10,7 +10,7 @@ } private void addDemoButtons(int p_73972_1_, int p_73972_2_) -@@ -271,6 +272,11 @@ +@@ -264,6 +265,11 @@ this.mc.shutdown(); } @@ -22,8 +22,8 @@ if (button.id == 11) { this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings); -@@ -516,7 +522,16 @@ - s = s + " Demo"; +@@ -512,7 +518,16 @@ + s = s + ("release".equalsIgnoreCase(this.mc.func_184123_d()) ? "" : "/" + this.mc.func_184123_d()); } - this.drawString(this.fontRendererObj, s, 2, this.height - 10, -1); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch index e0dae1287d..92f2f908c6 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch @@ -1,12 +1,12 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java -@@ -176,6 +176,9 @@ - long l = j - k; - List list = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.getCpu()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GL11.glGetString(GL11.GL_VENDOR)}), GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VERSION)}); +@@ -108,6 +108,9 @@ + { + BlockPos blockpos = new BlockPos(this.mc.getRenderViewEntity().posX, this.mc.getRenderViewEntity().getEntityBoundingBox().minY, this.mc.getRenderViewEntity().posZ); + list.add(""); + list.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false)); + if (this.isReducedDebug()) { - return list; + return Lists.newArrayList(new String[] {"Minecraft 1.9 (" + this.mc.getVersion() + "/" + ClientBrandRetriever.getClientModName() + ")", this.mc.debug, this.mc.renderGlobal.getDebugInfoRenders(), this.mc.renderGlobal.getDebugInfoEntities(), "P: " + this.mc.effectRenderer.getStatistics() + ". T: " + this.mc.theWorld.getDebugLoadedEntities(), this.mc.theWorld.getProviderName(), "", String.format("Chunk-relative: %d %d %d", new Object[]{Integer.valueOf(blockpos.getX() & 15), Integer.valueOf(blockpos.getY() & 15), Integer.valueOf(blockpos.getZ() & 15)})}); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch index 7503750725..302b4e3bb0 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java -@@ -143,7 +143,8 @@ +@@ -141,7 +141,8 @@ } } @@ -10,7 +10,7 @@ } protected void drawCreativeTabHoveringText(String tabName, int mouseX, int mouseY) -@@ -153,6 +154,11 @@ +@@ -151,6 +152,11 @@ protected void drawHoveringText(List textLines, int x, int y) { @@ -22,7 +22,7 @@ if (!textLines.isEmpty()) { GlStateManager.disableRescaleNormal(); -@@ -163,7 +169,7 @@ +@@ -161,7 +167,7 @@ for (String s : textLines) { @@ -31,7 +31,7 @@ if (j > i) { -@@ -208,7 +214,7 @@ +@@ -206,7 +212,7 @@ for (int k1 = 0; k1 < textLines.size(); ++k1) { String s1 = (String)textLines.get(k1); @@ -40,7 +40,7 @@ if (k1 == 0) { -@@ -436,6 +442,7 @@ +@@ -421,6 +427,7 @@ { this.mc.ingameGUI.getChatGUI().addToSentMessages(msg); } @@ -48,7 +48,7 @@ this.mc.thePlayer.sendChatMessage(msg); } -@@ -450,9 +457,15 @@ +@@ -435,9 +442,15 @@ if (guibutton.mousePressed(this.mc, mouseX, mouseY)) { @@ -64,7 +64,7 @@ } } } -@@ -482,8 +495,12 @@ +@@ -467,8 +480,12 @@ this.fontRendererObj = mc.fontRendererObj; this.width = width; this.height = height; @@ -77,7 +77,7 @@ } public void func_183500_a(int p_183500_1_, int p_183500_2_) -@@ -502,7 +519,9 @@ +@@ -487,7 +504,9 @@ { while (Mouse.next()) { @@ -87,7 +87,7 @@ } } -@@ -510,7 +529,9 @@ +@@ -495,7 +514,9 @@ { while (Keyboard.next()) { @@ -97,7 +97,7 @@ } } } -@@ -570,6 +591,7 @@ +@@ -557,6 +578,7 @@ public void drawDefaultBackground() { this.drawWorldBackground(0); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch deleted file mode 100644 index 8327deb5fb..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiSelectWorld.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSelectWorld.java -@@ -186,7 +186,7 @@ - - if (this.mc.getSaveLoader().canLoadWorld(s)) - { -- this.mc.launchIntegratedServer(s, s1, (WorldSettings)null); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(this, s, s1); - } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch index f370344408..326e92388e 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -1,24 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java -@@ -181,15 +181,8 @@ - GlStateManager.disableFog(); - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); -- this.mc.getTextureManager().bindTexture(Gui.optionsBackground); -- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -- float f = 32.0F; -- worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); -- worldrenderer.pos((double)this.left, (double)this.bottom, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -- worldrenderer.pos((double)this.right, (double)this.bottom, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -- worldrenderer.pos((double)this.right, (double)this.top, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -- worldrenderer.pos((double)this.left, (double)this.top, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -- tessellator.draw(); -+ // Forge: background rendering moved into separate method. -+ this.drawContainerBackground(tessellator); - int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; - int l = this.top + 4 - (int)this.amountScrolled; - -@@ -458,4 +451,18 @@ +@@ -458,4 +458,18 @@ { return this.slotHeight; } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch deleted file mode 100644 index abc8964e46..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java -@@ -73,6 +73,7 @@ - s3 = s4; - } - -+ s3 = FontRenderer.getFormatFromString(s2) + s3; //Forge: Fix chat formatting not surviving line wrapping. - ChatComponentText chatcomponenttext2 = new ChatComponentText(s3); - chatcomponenttext2.setChatStyle(ichatcomponent1.getChatStyle().createShallowCopy()); - list1.add(j + 1, chatcomponenttext2); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch index eaedd5e00c..9a197d3925 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java +++ ../src-work/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java @@ -82,7 +82,7 @@ - boolean flag1 = this.field_148301_e.version < 47; + boolean flag1 = this.field_148301_e.version < 107; boolean flag2 = flag || flag1; this.mc.fontRendererObj.drawString(this.field_148301_e.serverName, x + 32 + 3, y + 1, 16777215); - List list = this.mc.fontRendererObj.listFormattedStringToWidth(this.field_148301_e.serverMOTD, listWidth - 32 - 2); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch index 628bd5b875..391e1aa7c0 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch @@ -11,30 +11,15 @@ public GuiAchievements(GuiScreen parentScreenIn, StatFileWriter statFileWriterIn) { this.parentScreen = parentScreenIn; -@@ -57,6 +61,14 @@ - int j = 141; - this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - i / 2 - 12); - this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - j / 2); -+ minecraftAchievements.clear(); -+ for (Achievement achievement : AchievementList.achievementList) -+ { -+ if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement)) -+ { -+ minecraftAchievements.add(achievement); -+ } -+ } - } - - public void initGui() -@@ -64,6 +76,7 @@ - this.mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS)); +@@ -64,6 +68,7 @@ + this.mc.getNetHandler().addToSendQueue(new CPacketClientStatus(CPacketClientStatus.State.REQUEST_STATS)); this.buttonList.clear(); this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0]))); + this.buttonList.add(button = new GuiButton(2, (width - field_146555_f) / 2 + 24, height / 2 + 74, 125, 20, net.minecraftforge.common.AchievementPage.getTitle(currentPage))); } protected void actionPerformed(GuiButton button) throws IOException -@@ -74,6 +87,16 @@ +@@ -74,6 +79,16 @@ { this.mc.displayGuiScreen(this.parentScreen); } @@ -51,7 +36,7 @@ } } -@@ -257,7 +280,9 @@ +@@ -257,7 +272,9 @@ GlStateManager.depthFunc(518); GlStateManager.pushMatrix(); GlStateManager.translate((float)i1, (float)j1, -200.0F); @@ -62,35 +47,7 @@ GlStateManager.enableTexture2D(); GlStateManager.disableLighting(); GlStateManager.enableRescaleNormal(); -@@ -331,11 +356,12 @@ - GlStateManager.depthFunc(515); - this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND); - -- for (int j5 = 0; j5 < AchievementList.achievementList.size(); ++j5) -+ java.util.List achievementList = (currentPage == -1 ? minecraftAchievements : net.minecraftforge.common.AchievementPage.getAchievementPage(currentPage).getAchievements()); -+ for (int j5 = 0; j5 < achievementList.size(); ++j5) - { -- Achievement achievement1 = (Achievement)AchievementList.achievementList.get(j5); -+ Achievement achievement1 = achievementList.get(j5); - -- if (achievement1.parentAchievement != null) -+ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement)) - { - int k5 = achievement1.displayColumn * 24 - i + 11; - int l5 = achievement1.displayRow * 24 - j + 11; -@@ -389,9 +415,9 @@ - GlStateManager.enableRescaleNormal(); - GlStateManager.enableColorMaterial(); - -- for (int i6 = 0; i6 < AchievementList.achievementList.size(); ++i6) -+ for (int i6 = 0; i6 < achievementList.size(); ++i6) - { -- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(i6); -+ Achievement achievement2 = achievementList.get(i6); - int l6 = achievement2.displayColumn * 24 - i; - int j7 = achievement2.displayRow * 24 - j; - -@@ -432,6 +458,7 @@ +@@ -432,6 +449,7 @@ this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND); @@ -98,7 +55,7 @@ if (achievement2.getSpecial()) { this.drawTexturedModalRect(l6 - 2, j7 - 2, 26, 202, 26, 26); -@@ -440,6 +467,7 @@ +@@ -440,6 +458,7 @@ { this.drawTexturedModalRect(l6 - 2, j7 - 2, 0, 202, 26, 26); } @@ -106,7 +63,7 @@ if (!this.statFileWriter.canUnlockAchievement(achievement2)) { -@@ -448,7 +476,7 @@ +@@ -448,7 +467,7 @@ this.itemRender.func_175039_a(false); } @@ -114,4 +71,4 @@ + GlStateManager.disableLighting(); //Forge: Make sure Lighting is disabled. Fixes MC-33065 GlStateManager.enableCull(); this.itemRender.renderItemAndEffectIntoGUI(achievement2.theItemStack, l6 + 3, j7 + 3); - GlStateManager.blendFunc(770, 771); + GlStateManager.func_187401_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch index 7cffb600f4..d120f752da 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch @@ -1,55 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiStats.java +++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiStats.java -@@ -5,6 +5,8 @@ - import java.util.Collections; - import java.util.Comparator; - import java.util.List; -+ -+import net.minecraft.block.Block; - import net.minecraft.client.Minecraft; - import net.minecraft.client.audio.PositionedSoundRecord; - import net.minecraft.client.gui.GuiButton; -@@ -443,17 +445,18 @@ - for (StatCrafting statcrafting : StatList.objectMineStats) - { - boolean flag = false; -- int i = Item.getIdFromItem(statcrafting.func_150959_a()); -+ int i = Block.getIdFromBlock(Block.getBlockFromItem(statcrafting.func_150959_a())); -+ int itemId = Item.getIdFromItem(statcrafting.func_150959_a()); - - if (GuiStats.this.field_146546_t.readStat(statcrafting) > 0) - { - flag = true; - } -- else if (StatList.objectUseStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectUseStats[i]) > 0) -+ else if (StatList.objectUseStats[itemId] != null && GuiStats.this.field_146546_t.readStat(StatList.objectUseStats[itemId]) > 0) - { - flag = true; - } -- else if (StatList.objectCraftStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectCraftStats[i]) > 0) -+ else if (StatList.objectCraftStats[itemId] != null && GuiStats.this.field_146546_t.readStat(StatList.objectCraftStats[itemId]) > 0) - { - flag = true; - } -@@ -468,8 +471,15 @@ - { - public int compare(StatCrafting p_compare_1_, StatCrafting p_compare_2_) - { -- int j = Item.getIdFromItem(p_compare_1_.func_150959_a()); -- int k = Item.getIdFromItem(p_compare_2_.func_150959_a()); -+ int j; -+ int k; -+ if (StatsBlock.this.field_148217_o == 2) { -+ j = Block.getIdFromBlock(Block.getBlockFromItem(p_compare_1_.func_150959_a())); -+ k = Block.getIdFromBlock(Block.getBlockFromItem(p_compare_2_.func_150959_a())); -+ } else { -+ j = Item.getIdFromItem(p_compare_1_.func_150959_a()); -+ k = Item.getIdFromItem(p_compare_2_.func_150959_a()); -+ } - StatBase statbase = null; - StatBase statbase1 = null; - -@@ -748,7 +758,7 @@ +@@ -877,7 +877,7 @@ super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, GuiStats.this.fontRendererObj.FONT_HEIGHT * 4); this.setShowSelectionBox(false); @@ -58,12 +9,3 @@ { if (GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d) > 0 || GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e) > 0) { -@@ -784,7 +794,7 @@ - protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) - { - EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(entryID); -- String s = I18n.format("entity." + EntityList.getStringFromID(entitylist$entityegginfo.spawnedID) + ".name", new Object[0]); -+ String s = I18n.format("entity." + entitylist$entityegginfo.name + ".name", new Object[0]); - int i = GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d); - int j = GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e); - String s1 = I18n.format("stat.entityKills", new Object[] {Integer.valueOf(i), s}); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch index 2f5400a117..7e30615cfa 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java +++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java -@@ -175,8 +175,11 @@ +@@ -176,8 +176,11 @@ GlStateManager.translate(0.0F, 0.0F, 32.0F); this.zLevel = 200.0F; this.itemRender.zLevel = 200.0F; @@ -13,9 +13,9 @@ this.zLevel = 0.0F; this.itemRender.zLevel = 0.0F; } -@@ -239,13 +242,12 @@ +@@ -240,13 +243,12 @@ - if (itemstack == null) + if (itemstack == null && slotIn.canBeHovered()) { - String s1 = slotIn.getSlotTexture(); + TextureAtlasSprite textureatlassprite = slotIn.getBackgroundSprite(); @@ -30,7 +30,7 @@ this.drawTexturedModalRect(i, j, textureatlassprite, 16, 16); GlStateManager.enableLighting(); flag1 = true; -@@ -326,6 +328,7 @@ +@@ -327,6 +329,7 @@ int j = this.guiLeft; int k = this.guiTop; boolean flag1 = mouseX < j || mouseY < k || mouseX >= j + this.xSize || mouseY >= k + this.ySize; @@ -38,7 +38,7 @@ int l = -1; if (slot != null) -@@ -463,10 +466,12 @@ +@@ -464,10 +467,12 @@ protected void mouseReleased(int mouseX, int mouseY, int state) { @@ -51,7 +51,7 @@ int k = -1; if (slot != null) -@@ -685,4 +690,16 @@ +@@ -686,4 +691,16 @@ this.mc.thePlayer.closeScreen(); } } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch index 9faeb7374d..b752bda1d5 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java +++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java -@@ -48,6 +48,8 @@ +@@ -49,6 +49,8 @@ private Slot field_147064_C; private boolean field_147057_D; private CreativeCrafting field_147059_E; @@ -9,16 +9,7 @@ public GuiContainerCreative(EntityPlayer p_i1088_1_) { -@@ -175,7 +177,7 @@ - return; - } - -- if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2)) -+ if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2) && ItemStack.areItemStackTagsEqual(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770 - { - if (clickedButton == 0) - { -@@ -259,6 +261,13 @@ +@@ -258,6 +260,13 @@ this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]); this.field_147059_E = new CreativeCrafting(this.mc); this.mc.thePlayer.inventoryContainer.onCraftGuiOpened(this.field_147059_E); @@ -32,7 +23,7 @@ } else { -@@ -280,7 +289,7 @@ +@@ -279,7 +288,7 @@ protected void keyTyped(char typedChar, int keyCode) throws IOException { @@ -41,7 +32,7 @@ { if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)) { -@@ -318,6 +327,14 @@ +@@ -317,6 +326,14 @@ GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; guicontainercreative$containercreative.itemList.clear(); @@ -56,21 +47,7 @@ for (Item item : Item.itemRegistry) { if (item != null && item.getCreativeTab() != null) -@@ -325,7 +342,13 @@ - item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList); - } - } -+ updateFilteredItems(guicontainercreative$containercreative); -+ } - -+ //split from above for custom search tabs -+ private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$containercreative) -+ { -+ if (CreativeTabs.creativeTabArray[selectedTabIndex] == CreativeTabs.tabAllSearch) // FORGE: Only add enchanted books to the regular search - for (Enchantment enchantment : Enchantment.enchantmentsBookList) - { - if (enchantment != null && enchantment.type != null) -@@ -333,7 +356,6 @@ +@@ -332,7 +349,6 @@ Items.enchanted_book.getAll(enchantment, guicontainercreative$containercreative.itemList); } } @@ -78,7 +55,7 @@ Iterator iterator = guicontainercreative$containercreative.itemList.iterator(); String s1 = this.searchField.getText().toLowerCase(); -@@ -365,7 +387,7 @@ +@@ -364,7 +380,7 @@ { CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; @@ -87,7 +64,7 @@ { GlStateManager.disableBlend(); this.fontRendererObj.drawString(I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752); -@@ -400,7 +422,7 @@ +@@ -399,7 +415,7 @@ for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray) { @@ -96,7 +73,7 @@ { this.setCurrentCreativeTab(creativetabs); return; -@@ -413,11 +435,13 @@ +@@ -412,11 +428,13 @@ private boolean needsScrollBars() { @@ -110,7 +87,7 @@ int i = selectedTabIndex; selectedTabIndex = p_147050_1_.getTabIndex(); GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; -@@ -483,12 +507,14 @@ +@@ -487,12 +505,14 @@ if (this.searchField != null) { @@ -126,7 +103,7 @@ this.updateCreativeSearch(); } else -@@ -558,20 +584,43 @@ +@@ -562,20 +582,43 @@ } super.drawScreen(mouseX, mouseY, partialTicks); @@ -171,7 +148,7 @@ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableLighting(); } -@@ -633,16 +682,35 @@ +@@ -637,16 +680,35 @@ RenderHelper.enableGUIStandardItemLighting(); CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; @@ -208,7 +185,7 @@ this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName())); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); this.searchField.drawTextBox(); -@@ -657,6 +725,14 @@ +@@ -661,6 +723,14 @@ this.drawTexturedModalRect(i, j + (int)((float)(k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); } @@ -223,7 +200,7 @@ this.func_147051_a(creativetabs); if (creativetabs == CreativeTabs.tabInventory) -@@ -667,6 +743,14 @@ +@@ -671,6 +741,14 @@ protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) { @@ -238,7 +215,7 @@ int i = p_147049_1_.getTabColumn(); int j = 28 * i; int k = 0; -@@ -763,6 +847,8 @@ +@@ -767,6 +845,8 @@ } GlStateManager.disableLighting(); @@ -247,7 +224,7 @@ this.drawTexturedModalRect(l, i1, j, k, 28, j1); this.zLevel = 100.0F; this.itemRender.zLevel = 100.0F; -@@ -789,6 +875,15 @@ +@@ -793,6 +873,15 @@ { this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); } diff --git a/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch index e3afbc8713..a1f4c6a456 100644 --- a/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch @@ -8,11 +8,3 @@ public class ModelBox { private PositionTextureVertex[] vertexPositions; -@@ -81,6 +80,7 @@ - } - } - -+ @SideOnly(Side.CLIENT) - public void render(WorldRenderer renderer, float scale) - { - for (int i = 0; i < this.quadList.length; ++i) diff --git a/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch index b67e508a85..5e9ccffa83 100644 --- a/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/model/ModelRenderer.java +++ ../src-work/minecraft/net/minecraft/client/model/ModelRenderer.java -@@ -10,7 +10,6 @@ +@@ -9,7 +9,6 @@ + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; - import org.lwjgl.opengl.GL11; -@SideOnly(Side.CLIENT) public class ModelRenderer { public float textureWidth; -@@ -109,6 +108,7 @@ +@@ -108,6 +107,7 @@ this.rotationPointZ = rotationPointZIn; } @@ -16,7 +16,7 @@ public void render(float p_78785_1_) { if (!this.isHidden) -@@ -190,6 +190,7 @@ +@@ -189,6 +189,7 @@ } } @@ -24,7 +24,7 @@ public void renderWithRotation(float p_78791_1_) { if (!this.isHidden) -@@ -225,6 +226,7 @@ +@@ -224,6 +225,7 @@ } } @@ -32,7 +32,7 @@ public void postRender(float scale) { if (!this.isHidden) -@@ -266,6 +268,7 @@ +@@ -265,6 +267,7 @@ } } diff --git a/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch deleted file mode 100644 index c3d2571d6f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/PositionTextureVertex.java -+++ ../src-work/minecraft/net/minecraft/client/model/PositionTextureVertex.java -@@ -1,10 +1,7 @@ - package net.minecraft.client.model; - - import net.minecraft.util.Vec3; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public class PositionTextureVertex - { - public Vec3 vector3D; diff --git a/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch deleted file mode 100644 index 321941a6b1..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/TexturedQuad.java -+++ ../src-work/minecraft/net/minecraft/client/model/TexturedQuad.java -@@ -4,10 +4,7 @@ - import net.minecraft.client.renderer.WorldRenderer; - import net.minecraft.client.renderer.vertex.DefaultVertexFormats; - import net.minecraft.util.Vec3; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public class TexturedQuad - { - public PositionTextureVertex[] vertexPositions; diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch index dd87a5fddc..2fbae2903d 100644 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java -@@ -55,6 +55,7 @@ +@@ -52,6 +52,7 @@ Chunk chunk = new Chunk(this.worldObj, p_73158_1_, p_73158_2_); this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_), chunk); this.chunkListing.add(chunk); diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch deleted file mode 100644 index d19712b436..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java -@@ -67,7 +67,7 @@ - inetaddress = InetAddress.getByName(ip); - GuiConnecting.this.networkManager = NetworkManager.func_181124_a(inetaddress, port, GuiConnecting.this.mc.gameSettings.func_181148_f()); - GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen)); -- GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN)); -+ GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN, true)); - GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile())); - } - catch (UnknownHostException unknownhostexception) diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index 404b94ff21..258c41f477 100644 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -1,33 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java -@@ -111,6 +111,12 @@ - } - } - -+ ItemStack stack = mc.thePlayer.getCurrentEquippedItem(); -+ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, pos, mc.thePlayer)) -+ { -+ return false; -+ } -+ - if (this.currentGameType.isCreative() && this.mc.thePlayer.getHeldItem() != null && this.mc.thePlayer.getHeldItem().getItem() instanceof ItemSword) - { - return false; -@@ -128,13 +134,7 @@ - else - { - world.playAuxSFX(2001, pos, Block.getStateId(iblockstate)); -- boolean flag = world.setBlockToAir(pos); - -- if (flag) -- { -- block1.onBlockDestroyedByPlayer(world, pos, iblockstate); -- } -- - this.currentBlock = new BlockPos(this.currentBlock.getX(), -1, this.currentBlock.getZ()); - - if (!this.currentGameType.isCreative()) -@@ -152,6 +152,12 @@ +@@ -167,6 +167,12 @@ } } @@ -40,48 +13,3 @@ return flag; } } -@@ -356,11 +362,19 @@ - { - if (this.currentGameType != WorldSettings.GameType.SPECTATOR) - { -+ -+ if (heldStack != null && -+ heldStack.getItem() != null && -+ heldStack.getItem().onItemUseFirst(heldStack, player, worldIn, hitPos, side, f, f1, f2)) -+ { -+ return true; -+ } -+ - IBlockState iblockstate = worldIn.getBlockState(hitPos); - -- if ((!player.isSneaking() || player.getHeldItem() == null) && iblockstate.getBlock().onBlockActivated(worldIn, hitPos, iblockstate, player, side, f, f1, f2)) -+ if ((!player.isSneaking() || player.getHeldItem() == null || player.getHeldItem().getItem().doesSneakBypassUse(worldIn, hitPos, player))) - { -- flag = true; -+ flag = iblockstate.getBlock().onBlockActivated(worldIn, hitPos, iblockstate, player, side, f, f1, f2); - } - - if (!flag && heldStack != null && heldStack.getItem() instanceof ItemBlock) -@@ -393,7 +407,9 @@ - } - else - { -- return heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2); -+ if (!heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2)) return false; -+ if (heldStack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, heldStack); -+ return true; - } - } - else -@@ -420,9 +436,10 @@ - { - playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack; - -- if (itemstack.stackSize == 0) -+ if (itemstack.stackSize <= 0) - { - playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null; -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(playerIn, itemstack); - } - - return true; diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch index a0e81d0547..2d73af7075 100644 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java -@@ -52,12 +52,13 @@ - super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_5_, true); +@@ -63,12 +63,13 @@ + this.field_184157_a = Sets.newHashSet(); this.sendQueue = p_i45063_1_; this.getWorldInfo().setDifficulty(p_i45063_4_); - this.setSpawnPoint(new BlockPos(8, 64, 8)); diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch index 2c10876e58..2aff2e5ca0 100644 --- a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java +++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java -@@ -104,7 +104,10 @@ +@@ -106,7 +106,10 @@ { this.gameProfile = packetIn.getProfile(); this.networkManager.setConnectionState(EnumConnectionState.PLAY); @@ -11,4 +11,4 @@ + net.minecraftforge.fml.client.FMLClientHandler.instance().setPlayClient(nhpc); } - public void onDisconnect(IChatComponent reason) + public void onDisconnect(ITextComponent reason) diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch index 601a6a7967..131b84df66 100644 --- a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java +++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java -@@ -246,7 +246,7 @@ +@@ -267,7 +267,7 @@ { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); this.gameController.playerController = new PlayerControllerMP(this.gameController, this); @@ -9,8 +9,8 @@ this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = packetIn.getDimension(); -@@ -750,14 +750,16 @@ - public void handleChat(S02PacketChat packetIn) +@@ -785,14 +785,16 @@ + public void handleChat(SPacketChat packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + net.minecraft.util.IChatComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(packetIn.getType(), packetIn.getChatComponent()); @@ -28,21 +28,9 @@ } } -@@ -808,6 +810,11 @@ - float f = (float)(packetIn.getYaw() * 360) / 256.0F; - float f1 = (float)(packetIn.getPitch() * 360) / 256.0F; - EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.getEntityType(), this.gameController.theWorld); -+ if (entitylivingbase == null) -+ { -+ net.minecraftforge.fml.common.FMLLog.info("Server attempted to spawn an unknown entity using ID: {0} at ({1}, {2}, {3}) Skipping!", packetIn.getEntityType(), d0, d1, d2); -+ return; -+ } - entitylivingbase.serverPosX = packetIn.getX(); - entitylivingbase.serverPosY = packetIn.getY(); - entitylivingbase.serverPosZ = packetIn.getZ(); -@@ -1133,6 +1140,10 @@ +@@ -1082,6 +1084,10 @@ { - tileentity.readFromNBT(packetIn.getNbtCompound()); + entityplayer.openContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e()); } + else + { @@ -51,12 +39,3 @@ } } -@@ -1341,7 +1352,7 @@ - - if (entity instanceof EntityLivingBase) - { -- PotionEffect potioneffect = new PotionEffect(packetIn.getEffectId(), packetIn.getDuration(), packetIn.getAmplifier(), false, packetIn.func_179707_f()); -+ PotionEffect potioneffect = new PotionEffect(packetIn.getEffectId() & 0xff, packetIn.getDuration(), packetIn.getAmplifier(), false, packetIn.func_179707_f()); - potioneffect.setPotionDurationMax(packetIn.func_149429_c()); - ((EntityLivingBase)entity).addPotionEffect(potioneffect); - } diff --git a/patches.mcp/minecraft/net/minecraft/client/network/OldServerPinger.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/OldServerPinger.java.patch deleted file mode 100644 index 5631206e36..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/network/OldServerPinger.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/network/OldServerPinger.java -+++ ../src-work/minecraft/net/minecraft/client/network/OldServerPinger.java -@@ -150,6 +150,7 @@ - server.setBase64EncodedIconData((String)null); - } - -+ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(server, serverstatusresponse); - this.field_175092_e = Minecraft.getSystemTime(); - networkmanager.sendPacket(new C01PacketPing(this.field_175092_e)); - this.field_147403_d = true; diff --git a/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch index 2cb6442033..6aca35860d 100644 --- a/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch @@ -1,23 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java +++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java -@@ -133,6 +133,7 @@ - - public void addEffect(EntityFX effect) - { -+ if (effect == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs. - int i = effect.getFXLayer(); - int j = effect.getAlpha() != 1.0F ? 0 : 1; - -@@ -351,7 +352,7 @@ - - public void addBlockDestroyEffects(BlockPos pos, IBlockState state) - { -- if (state.getBlock().getMaterial() != Material.air) -+ if (!state.getBlock().isAir(worldObj, pos) && !state.getBlock().addDestroyEffects(worldObj, pos, this)) - { - state = state.getBlock().getActualState(state, this.worldObj, pos); - int i = 4; -@@ -457,4 +458,13 @@ +@@ -460,4 +460,13 @@ return "" + i; } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch deleted file mode 100644 index 39f2cb1698..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java -@@ -533,8 +533,19 @@ - @SideOnly(Side.CLIENT) - public static enum EnumNeighborInfo - { -- DOWN(new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.5F, false, new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0]), -- UP(new EnumFacing[]{EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH}, 1.0F, false, new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0]), -+ // -- Forge Patch to Fix Top/Bottom Lighting Interpolation -- -+ // Forge PR - https://github.com/MinecraftForge/MinecraftForge/pull/1892 -+ // Mojang Bug - https://bugs.mojang.com/browse/MC-80148 -+ DOWN( new EnumFacing[]{ EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH }, 0.5F, true, -+ new Orientation[]{ Orientation.FLIP_WEST, Orientation.SOUTH, Orientation.FLIP_WEST, Orientation.FLIP_SOUTH, Orientation.WEST, Orientation.FLIP_SOUTH, Orientation.WEST, Orientation.SOUTH }, -+ new Orientation[]{ Orientation.FLIP_WEST, Orientation.NORTH, Orientation.FLIP_WEST, Orientation.FLIP_NORTH, Orientation.WEST, Orientation.FLIP_NORTH, Orientation.WEST, Orientation.NORTH }, -+ new Orientation[]{ Orientation.FLIP_EAST, Orientation.NORTH, Orientation.FLIP_EAST, Orientation.FLIP_NORTH, Orientation.EAST, Orientation.FLIP_NORTH, Orientation.EAST, Orientation.NORTH }, -+ new Orientation[]{ Orientation.FLIP_EAST, Orientation.SOUTH, Orientation.FLIP_EAST, Orientation.FLIP_SOUTH, Orientation.EAST, Orientation.FLIP_SOUTH, Orientation.EAST, Orientation.SOUTH } ), -+ UP( new EnumFacing[]{ EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH }, 1.0F, true, -+ new Orientation[]{ Orientation.EAST, Orientation.SOUTH, Orientation.EAST, Orientation.FLIP_SOUTH, Orientation.FLIP_EAST, Orientation.FLIP_SOUTH, Orientation.FLIP_EAST, Orientation.SOUTH }, -+ new Orientation[]{ Orientation.EAST, Orientation.NORTH, Orientation.EAST, Orientation.FLIP_NORTH, Orientation.FLIP_EAST, Orientation.FLIP_NORTH, Orientation.FLIP_EAST, Orientation.NORTH }, -+ new Orientation[]{ Orientation.WEST, Orientation.NORTH, Orientation.WEST, Orientation.FLIP_NORTH, Orientation.FLIP_WEST, Orientation.FLIP_NORTH, Orientation.FLIP_WEST, Orientation.NORTH }, -+ new Orientation[]{ Orientation.WEST, Orientation.SOUTH, Orientation.WEST, Orientation.FLIP_SOUTH, Orientation.FLIP_WEST, Orientation.FLIP_SOUTH, Orientation.FLIP_WEST, Orientation.SOUTH } ), - NORTH(new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.WEST}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST}), - SOUTH(new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.DOWN, EnumFacing.UP}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST}), - WEST(new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.6F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.SOUTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.SOUTH}), diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch index af6ec831d7..6ff9d53b7f 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelShapes.java +++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelShapes.java -@@ -309,5 +309,6 @@ +@@ -307,5 +307,6 @@ return new ModelResourceLocation(s + "_double_slab", s1); } }); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch deleted file mode 100644 index fe9f2c0563..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java -@@ -24,7 +24,7 @@ - { - private BlockModelShapes blockModelShapes; - private final GameSettings gameSettings; -- private final BlockModelRenderer blockModelRenderer = new BlockModelRenderer(); -+ private final BlockModelRenderer blockModelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(); - private final ChestRenderer chestRenderer = new ChestRenderer(); - private final BlockFluidRenderer fluidRenderer = new BlockFluidRenderer(); - -@@ -48,6 +48,24 @@ - { - state = block.getActualState(state, blockAccess, pos); - IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(state); -+ -+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) -+ { -+ IBlockState extendedState = block.getExtendedState(state, blockAccess, pos); -+ for ( net.minecraft.util.EnumWorldBlockLayer layer : net.minecraft.util.EnumWorldBlockLayer.values() ) -+ { -+ if ( block.canRenderInLayer( layer ) ) -+ { -+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(layer); -+ -+ IBakedModel targetLayer = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); -+ IBakedModel damageModel = (new SimpleBakedModel.Builder(targetLayer, texture)).makeBakedModel(); -+ this.blockModelRenderer.renderModel(blockAccess, damageModel, state, pos, Tessellator.getInstance().getWorldRenderer()); -+ } -+ } -+ return; -+ } -+ - IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, texture)).makeBakedModel(); - this.blockModelRenderer.renderModel(blockAccess, ibakedmodel1, state, pos, Tessellator.getInstance().getWorldRenderer()); - } -@@ -128,6 +146,12 @@ - ibakedmodel = ((WeightedBakedModel)ibakedmodel).getAlternativeModel(MathHelper.getPositionRandom(pos)); - } - -+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) -+ { -+ IBlockState extendedState = block.getExtendedState(state, worldIn, pos); -+ ibakedmodel = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); -+ } -+ - return ibakedmodel; - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index 7b5b273156..acb32c3587 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java -@@ -200,6 +200,7 @@ +@@ -207,6 +207,7 @@ { this.loadShader(new ResourceLocation("shaders/post/invert.json")); } @@ -8,16 +8,7 @@ } } -@@ -419,7 +420,7 @@ - - if (d3 < d2 || d2 == 0.0D) - { -- if (entity1 == entity.ridingEntity) -+ if (entity1 == entity.ridingEntity && !entity.canRiderInteract()) - { - if (d2 == 0.0D) - { -@@ -512,7 +513,7 @@ +@@ -491,7 +492,7 @@ f = f * 60.0F / 70.0F; } @@ -26,23 +17,7 @@ } } -@@ -576,14 +577,8 @@ - { - BlockPos blockpos = new BlockPos(entity); - IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); -- Block block = iblockstate.getBlock(); -+ net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.mc.theWorld, blockpos, iblockstate, entity); - -- if (block == Blocks.bed) -- { -- int j = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); -- GlStateManager.rotate((float)(j * 90), 0.0F, 1.0F, 0.0F); -- } -- - GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, -1.0F, 0.0F); - GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, -1.0F, 0.0F, 0.0F); - } -@@ -650,17 +645,20 @@ +@@ -629,17 +630,20 @@ if (!this.mc.gameSettings.debugCamEnable) { @@ -70,7 +45,7 @@ } GlStateManager.translate(0.0F, -f, 0.0F); -@@ -1103,7 +1101,7 @@ +@@ -1092,7 +1096,7 @@ try { @@ -79,7 +54,7 @@ } catch (Throwable throwable) { -@@ -1164,7 +1162,7 @@ +@@ -1187,7 +1191,7 @@ if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR) { @@ -88,7 +63,7 @@ } else { -@@ -1314,7 +1312,9 @@ +@@ -1312,7 +1316,9 @@ GlStateManager.pushMatrix(); RenderHelper.enableStandardItemLighting(); this.mc.mcProfiler.endStartSection("entities"); @@ -97,40 +72,8 @@ + net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); RenderHelper.disableStandardItemLighting(); this.disableLightmap(); - GlStateManager.matrixMode(5888); -@@ -1326,6 +1326,7 @@ - EntityPlayer entityplayer = (EntityPlayer)entity; - GlStateManager.disableAlpha(); - this.mc.mcProfiler.endStartSection("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.getHeldItem(), partialTicks)) - renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); - GlStateManager.enableAlpha(); - } -@@ -1339,6 +1340,7 @@ - EntityPlayer entityplayer1 = (EntityPlayer)entity; - GlStateManager.disableAlpha(); - this.mc.mcProfiler.endStartSection("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer1, mc.objectMouseOver, 0, entityplayer1.getHeldItem(), partialTicks)) - renderglobal.drawSelectionBox(entityplayer1, this.mc.objectMouseOver, 0, partialTicks); - GlStateManager.enableAlpha(); } -@@ -1380,6 +1382,15 @@ - GlStateManager.shadeModel(7425); - this.mc.mcProfiler.endStartSection("translucent"); - renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double)partialTicks, pass, entity); -+ if (!this.debugView) //Only render if render pass 0 happens as well. -+ { -+ RenderHelper.enableStandardItemLighting(); -+ this.mc.mcProfiler.endStartSection("entities"); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); -+ renderglobal.renderEntities(entity, icamera, partialTicks); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); -+ RenderHelper.disableStandardItemLighting(); -+ } - GlStateManager.shadeModel(7424); - GlStateManager.depthMask(true); - GlStateManager.enableCull(); -@@ -1392,8 +1403,12 @@ +@@ -1378,8 +1384,12 @@ this.renderCloudsCheck(renderglobal, partialTicks, pass); } @@ -143,7 +86,7 @@ if (this.renderHand) { GlStateManager.clear(256); -@@ -1505,6 +1520,13 @@ +@@ -1490,6 +1500,13 @@ protected void renderRainSnow(float partialTicks) { @@ -157,7 +100,7 @@ float f = this.mc.theWorld.getRainStrength(partialTicks); if (f > 0.0F) -@@ -1830,6 +1852,13 @@ +@@ -1820,6 +1837,13 @@ this.fogColorBlue = f7; } @@ -171,18 +114,7 @@ GlStateManager.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); } -@@ -1848,6 +1877,10 @@ - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); - -+ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, block, partialTicks, 0.1F); -+ if (hook >= 0) -+ GlStateManager.setFogDensity(hook); -+ else - if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.blindness)) - { - float f1 = 5.0F; -@@ -1925,6 +1958,7 @@ +@@ -1915,6 +1939,7 @@ GlStateManager.setFogStart(f * 0.05F); GlStateManager.setFogEnd(Math.min(f, 192.0F) * 0.5F); } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch index d6f61cabd4..db8cbd4b78 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java -@@ -27,7 +27,12 @@ +@@ -28,7 +28,12 @@ protected void updateActivePotionEffects() { @@ -14,15 +14,7 @@ { this.guiLeft = 160 + (this.width - this.xSize - 200) / 2; this.hasActivePotionEffects = true; -@@ -70,6 +75,7 @@ - for (PotionEffect potioneffect : this.mc.thePlayer.getActivePotionEffects()) - { - Potion potion = Potion.potionTypes[potioneffect.getPotionID()]; -+ if(!potion.shouldRender(potioneffect)) continue; - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(inventoryBackground); - this.drawTexturedModalRect(i, j, 0, 166, 140, 32); -@@ -80,6 +86,8 @@ +@@ -81,6 +86,8 @@ this.drawTexturedModalRect(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18); } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index 4d51db24c7..208eda40c1 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -1,15 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java -@@ -313,7 +313,7 @@ - - if (this.itemToRender != null) - { -- if (this.itemToRender.getItem() == Items.filled_map) -+ if (this.itemToRender.getItem() instanceof net.minecraft.item.ItemMap) - { - this.renderItemMap(abstractclientplayer, f2, f, f1); - } -@@ -365,6 +365,7 @@ +@@ -444,6 +444,7 @@ if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) { IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer)); @@ -17,21 +8,7 @@ EntityPlayer entityplayer = this.mc.thePlayer; for (int i = 0; i < 8; ++i) -@@ -378,11 +379,13 @@ - if (iblockstate1.getBlock().isVisuallyOpaque()) - { - iblockstate = iblockstate1; -+ overlayPos = blockpos; - } - } - - if (iblockstate.getBlock().getRenderType() != -1) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, partialTicks, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, overlayPos)) - this.func_178108_a(partialTicks, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); - } - } -@@ -391,11 +394,13 @@ +@@ -470,11 +471,13 @@ { if (this.mc.thePlayer.isInsideOfMaterial(Material.water)) { @@ -45,16 +22,3 @@ this.renderFireInFirstPerson(partialTicks); } } -@@ -512,6 +517,12 @@ - { - if (!this.itemToRender.getIsItemStackEqual(itemstack)) - { -+ if (!this.itemToRender.getItem().shouldCauseReequipAnimation(this.itemToRender, itemstack, equippedItemSlot != entityplayer.inventory.currentItem)) -+ { -+ this.itemToRender = itemstack; -+ this.equippedItemSlot = entityplayer.inventory.currentItem; -+ return; -+ } - flag = true; - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch index ae77f90371..4dddb26481 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java +++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java -@@ -83,6 +83,10 @@ +@@ -92,6 +92,10 @@ public static int GL_ARRAY_BUFFER; public static int GL_STATIC_DRAW; @@ -11,7 +11,7 @@ public static void initializeTextures() { ContextCapabilities contextcapabilities = GLContext.getCapabilities(); -@@ -843,6 +847,12 @@ +@@ -852,6 +856,12 @@ { GL13.glMultiTexCoord2f(target, p_77475_1_, p_77475_2_); } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch index 2b7737d4bb..887b5b0cb1 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/RenderGlobal.java +++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java -@@ -525,8 +525,10 @@ +@@ -547,8 +547,10 @@ public void renderEntities(Entity renderViewEntity, ICamera camera, float partialTicks) { @@ -11,7 +11,7 @@ --this.renderEntitiesStartupCounter; } else -@@ -537,9 +539,12 @@ +@@ -559,9 +561,12 @@ this.theWorld.theProfiler.startSection("prepare"); TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), partialTicks); this.renderManager.cacheActiveRenderInfo(this.theWorld, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks); @@ -24,7 +24,7 @@ Entity entity = this.mc.getRenderViewEntity(); double d3 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; double d4 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; -@@ -551,11 +556,15 @@ +@@ -573,11 +578,15 @@ this.mc.entityRenderer.enableLightmap(); this.theWorld.theProfiler.endStartSection("global"); List list = this.theWorld.getLoadedEntityList(); @@ -40,39 +40,23 @@ ++this.countEntitiesRendered; if (entity1.isInRangeToRender3d(d0, d1, d2)) -@@ -577,6 +586,7 @@ - for (int j = 0; j < list.size(); ++j) - { - Entity entity3 = (Entity)list.get(j); -+ if (!entity3.shouldRenderInPass(pass)) continue; - boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); - boolean flag1 = entity3.isInRangeToRender3d(d0, d1, d2) && (entity3.ignoreFrustumCheck || camera.isBoundingBoxInFrustum(entity3.getEntityBoundingBox()) || entity3.riddenByEntity == this.mc.thePlayer) && entity3 instanceof EntityPlayer; - -@@ -626,6 +636,7 @@ - } - - entity2 = (Entity)iterator.next(); -+ if (!entity2.shouldRenderInPass(pass)) continue; - flag2 = this.renderManager.shouldRender(entity2, camera, d0, d1, d2) || entity2.riddenByEntity == this.mc.thePlayer; - - if (!flag2) -@@ -654,6 +665,7 @@ +@@ -672,6 +681,7 @@ this.theWorld.theProfiler.endStartSection("blockentities"); RenderHelper.enableStandardItemLighting(); + TileEntityRendererDispatcher.instance.preDrawBatch(); for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 : this.renderInfos) { - List list1 = renderglobal$containerlocalrenderinformation1.renderChunk.getCompiledChunk().getTileEntities(); -@@ -662,6 +674,7 @@ + List list3 = renderglobal$containerlocalrenderinformation1.renderChunk.getCompiledChunk().getTileEntities(); +@@ -680,6 +690,7 @@ { - for (TileEntity tileentity2 : list1) + for (TileEntity tileentity2 : list3) { + if (!tileentity2.shouldRenderInPass(pass) || !camera.isBoundingBoxInFrustum(tileentity2.getRenderBoundingBox())) continue; TileEntityRendererDispatcher.instance.renderTileEntity(tileentity2, partialTicks, -1); } } -@@ -671,9 +684,11 @@ +@@ -689,9 +700,11 @@ { for (TileEntity tileentity : this.setTileEntities) { @@ -84,7 +68,7 @@ this.preRenderDamagedBlocks(); -@@ -700,7 +715,7 @@ +@@ -718,7 +731,7 @@ Block block = this.theWorld.getBlockState(blockpos).getBlock(); @@ -93,20 +77,7 @@ { TileEntityRendererDispatcher.instance.renderTileEntity(tileentity1, partialTicks, destroyblockprogress.getPartialBlockDamage()); } -@@ -1161,6 +1176,12 @@ - - public void renderSky(float partialTicks, int pass) - { -+ net.minecraftforge.client.IRenderHandler renderer = this.theWorld.provider.getSkyRenderer(); -+ if (renderer != null) -+ { -+ renderer.render(partialTicks, theWorld, mc); -+ return; -+ } - if (this.mc.theWorld.provider.getDimensionId() == 1) - { - this.renderSkyEnd(); -@@ -1378,6 +1399,12 @@ +@@ -1427,6 +1440,12 @@ public void renderClouds(float partialTicks, int pass) { @@ -119,7 +90,7 @@ if (this.mc.theWorld.provider.isSurfaceWorld()) { if (this.mc.gameSettings.func_181147_e() == 2) -@@ -1793,8 +1820,11 @@ +@@ -1854,8 +1873,11 @@ double d4 = (double)blockpos.getY() - d1; double d5 = (double)blockpos.getZ() - d2; Block block = this.theWorld.getBlockState(blockpos).getBlock(); @@ -132,21 +103,3 @@ { if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) { -@@ -1949,13 +1979,16 @@ - if (recordName != null) - { - ItemRecord itemrecord = ItemRecord.getRecord(recordName); -+ ResourceLocation resource = null; - - if (itemrecord != null) - { - this.mc.ingameGUI.setRecordPlayingMessage(itemrecord.getRecordNameLocal()); -+ resource = itemrecord.getRecordResource(recordName); - } - -- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(new ResourceLocation(recordName), (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); -+ if (resource == null) resource = new ResourceLocation(recordName); -+ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(resource, (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); - this.mapSoundPositions.put(blockPosIn, positionedsoundrecord); - this.mc.getSoundHandler().playSound(positionedsoundrecord); - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch deleted file mode 100644 index 112e541b52..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/WorldRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/WorldRenderer.java -@@ -506,15 +506,15 @@ - break; - case USHORT: - case SHORT: -- this.byteBuffer.putShort(i, (short)((int)p_181663_1_ * 32767 & 65535)); -- this.byteBuffer.putShort(i + 2, (short)((int)p_181663_2_ * 32767 & 65535)); -- this.byteBuffer.putShort(i + 4, (short)((int)p_181663_3_ * 32767 & 65535)); -+ this.byteBuffer.putShort(i, (short)((int)(p_181663_1_ * 32767) & 65535)); -+ this.byteBuffer.putShort(i + 2, (short)((int)(p_181663_2_ * 32767) & 65535)); -+ this.byteBuffer.putShort(i + 4, (short)((int)(p_181663_3_ * 32767) & 65535)); - break; - case UBYTE: - case BYTE: -- this.byteBuffer.put(i, (byte)((int)p_181663_1_ * 127 & 255)); -- this.byteBuffer.put(i + 1, (byte)((int)p_181663_2_ * 127 & 255)); -- this.byteBuffer.put(i + 2, (byte)((int)p_181663_3_ * 127 & 255)); -+ this.byteBuffer.put(i, (byte)((int)(p_181663_1_ * 127) & 255)); -+ this.byteBuffer.put(i + 1, (byte)((int)(p_181663_2_ * 127) & 255)); -+ this.byteBuffer.put(i + 2, (byte)((int)(p_181663_3_ * 127) & 255)); - } - - this.nextVertexFormatIndex(); -@@ -578,6 +578,16 @@ - } - } - -+ public void checkAndGrow() -+ { -+ this.growBuffer(vertexFormat.getNextOffset()/* / 4 * 4 */); -+ } -+ -+ public boolean isColorDisabled() -+ { -+ return noColor; -+ } -+ - @SideOnly(Side.CLIENT) - public class State - { diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch deleted file mode 100644 index 2551f52b99..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java -@@ -23,32 +23,9 @@ - - for (int j = 0; j < list.size(); ++j) - { -+ // moved to VertexFormatElement.preDraw - VertexFormatElement vertexformatelement = (VertexFormatElement)list.get(j); -- VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.getUsage(); -- int k = vertexformatelement.getType().getGlConstant(); -- int l = vertexformatelement.getIndex(); -- bytebuffer.position(vertexformat.func_181720_d(j)); -- -- switch (vertexformatelement$enumusage) -- { -- case POSITION: -- GL11.glVertexPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); -- GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); -- break; -- case UV: -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l); -- GL11.glTexCoordPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); -- GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); -- break; -- case COLOR: -- GL11.glColorPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); -- GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); -- break; -- case NORMAL: -- GL11.glNormalPointer(k, i, bytebuffer); -- GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); -- } -+ vertexformatelement.getUsage().preDraw(vertexformat, j, i, bytebuffer); - } - - GL11.glDrawArrays(p_181679_1_.getDrawMode(), 0, p_181679_1_.getVertexCount()); -@@ -57,26 +34,8 @@ - for (int j1 = list.size(); i1 < j1; ++i1) - { - VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1); -- VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.getUsage(); -- int k1 = vertexformatelement1.getIndex(); -- -- switch (vertexformatelement$enumusage1) -- { -- case POSITION: -- GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); -- break; -- case UV: -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k1); -- GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); -- break; -- case COLOR: -- GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); -- GlStateManager.resetColor(); -- break; -- case NORMAL: -- GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); -- } -+ // moved to VertexFormatElement.postDraw -+ vertexformatelement1.getUsage().postDraw(vertexformat, i1, i, bytebuffer); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch index 97dc4cd38c..2c9e531fee 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java -@@ -5,8 +5,9 @@ +@@ -6,8 +6,9 @@ import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch deleted file mode 100644 index b9543da5ae..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java -@@ -20,6 +20,11 @@ - - public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) - { -+ return makeBakedQuad(posFrom, posTo, face, sprite, facing, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); -+ } -+ -+ public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) -+ { - int[] aint = this.makeQuadVertexData(face, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, uvLocked, shade); - EnumFacing enumfacing = getFacingFromVertexData(aint); - -@@ -33,11 +38,17 @@ - this.func_178408_a(aint, enumfacing); - } - -+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing); - return new BakedQuad(aint, face.tintIndex, enumfacing); - } - - private int[] makeQuadVertexData(BlockPartFace partFace, TextureAtlasSprite sprite, EnumFacing facing, float[] p_178405_4_, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) - { -+ return makeQuadVertexData(partFace, sprite, facing, p_178405_4_, modelRotationIn, partRotation, uvLocked, shade); -+ } -+ -+ private int[] makeQuadVertexData(BlockPartFace partFace, TextureAtlasSprite sprite, EnumFacing facing, float[] p_178405_4_, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) -+ { - int[] aint = new int[28]; - - for (int i = 0; i < 4; ++i) -@@ -88,7 +99,12 @@ - - private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) - { -- EnumFacing enumfacing = modelRotationIn.rotateFace(facing); -+ fillVertexData(faceData, vertexIndex, facing, partFace, p_178402_5_, sprite, modelRotationIn, partRotation, uvLocked, shade); -+ } -+ -+ private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) -+ { -+ EnumFacing enumfacing = modelRotationIn.rotate(facing); - int i = shade ? this.getFaceShadeColor(enumfacing) : -1; - EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.getFacing(facing).func_179025_a(vertexIndex); - Vector3f vector3f = new Vector3f(p_178402_5_[enumfacedirection$vertexinformation.field_179184_a], p_178402_5_[enumfacedirection$vertexinformation.field_179182_b], p_178402_5_[enumfacedirection$vertexinformation.field_179183_c]); -@@ -154,14 +170,19 @@ - - public int rotateVertex(Vector3f position, EnumFacing facing, int vertexIndex, ModelRotation modelRotationIn, boolean uvLocked) - { -+ return rotateVertex(position, facing, vertexIndex, modelRotationIn, uvLocked); -+ } -+ -+ public int rotateVertex(Vector3f position, EnumFacing facing, int vertexIndex, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) -+ { - if (modelRotationIn == ModelRotation.X0_Y0) - { - return vertexIndex; - } - else - { -- this.rotateScale(position, new Vector3f(0.5F, 0.5F, 0.5F), modelRotationIn.getMatrix4d(), new Vector3f(1.0F, 1.0F, 1.0F)); -- return modelRotationIn.rotateVertex(facing, vertexIndex); -+ net.minecraftforge.client.ForgeHooksClient.transform(position, modelRotationIn.getMatrix()); -+ return modelRotationIn.rotate(facing, vertexIndex); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch index a953b5c380..fd1bef036c 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java -@@ -10,7 +10,11 @@ - import net.minecraftforge.fml.relauncher.Side; +@@ -12,7 +12,11 @@ import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.util.vector.Quaternion; +/* + * @deprecated use {@link net.minecraftforge.client.model.IPerspectiveAwareModel} instead @@ -12,7 +12,7 @@ public class ItemCameraTransforms { public static final ItemCameraTransforms DEFAULT = new ItemCameraTransforms(); -@@ -117,7 +121,7 @@ +@@ -169,7 +173,7 @@ } @SideOnly(Side.CLIENT) @@ -20,4 +20,4 @@ + public static enum TransformType implements net.minecraftforge.client.model.IModelPart { NONE, - THIRD_PERSON, + THIRD_PERSON_LEFT_HAND, diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch index f336ff667c..5b8ebe4cd1 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java -@@ -29,7 +29,7 @@ +@@ -31,7 +31,7 @@ public static ModelBlockDefinition parseFromReader(Reader p_178331_0_) { @@ -8,22 +8,4 @@ + return net.minecraftforge.client.model.BlockStateLoader.load(p_178331_0_, GSON); } - public ModelBlockDefinition(Collection p_i46221_1_) -@@ -155,11 +155,17 @@ - return this.modelLocation; - } - -+ @Deprecated - public ModelRotation getRotation() - { - return this.modelRotation; - } - -+ public net.minecraftforge.client.model.IModelState getState() -+ { -+ return this.modelRotation; -+ } -+ - public boolean isUvLocked() - { - return this.uvLock; + public ModelBlockDefinition(Map p_i46572_1_, Multipart p_i46572_2_) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch deleted file mode 100644 index 649bea3448..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java -@@ -38,7 +38,7 @@ - } - else - { -- s = ((IProperty)this.name).getName((Comparable)map.remove(this.name)); -+ s = String.format("%s:%s", ((ResourceLocation)Block.blockRegistry.getNameForObject(state.getBlock())).getResourceDomain(), ((IProperty)this.name).getName((Comparable)map.remove(this.name))); - } - - if (this.suffix != null) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch index 521b0958b6..33082d5943 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java +++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java -@@ -131,7 +131,9 @@ +@@ -133,7 +133,9 @@ return; } @@ -11,7 +11,7 @@ generator.setCompiledChunk(compiledchunk); } finally -@@ -158,7 +160,7 @@ +@@ -160,7 +162,7 @@ lvt_10_1_.func_178606_a(blockpos$mutableblockpos); } @@ -20,27 +20,16 @@ { TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos)); TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileentity); -@@ -174,7 +176,9 @@ - } - } +@@ -191,6 +193,7 @@ -- EnumWorldBlockLayer enumworldblocklayer1 = block.getBlockLayer(); -+ for(EnumWorldBlockLayer enumworldblocklayer1 : EnumWorldBlockLayer.values()) { -+ if(!block.canRenderInLayer(enumworldblocklayer1)) continue; -+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1); - int j = enumworldblocklayer1.ordinal(); - - if (block.getRenderType() != -1) -@@ -189,6 +193,7 @@ - - aboolean[j] |= blockrendererdispatcher.renderBlock(iblockstate, blockpos$mutableblockpos, iblockaccess, worldrenderer); + aboolean[j] |= blockrendererdispatcher.renderBlock(iblockstate, blockpos$mutableblockpos, iblockaccess, vertexbuffer); } + } } - for (EnumWorldBlockLayer enumworldblocklayer : EnumWorldBlockLayer.values()) -@@ -385,6 +390,26 @@ - return this.needsUpdate; + for (BlockRenderLayer blockrenderlayer : BlockRenderLayer.values()) +@@ -413,6 +416,26 @@ + return this.needsUpdate && this.field_188284_q; } + /* ======================================== FORGE START =====================================*/ diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch index 4aea0952a7..a7d80ed880 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java -@@ -41,7 +41,7 @@ +@@ -44,7 +44,7 @@ boolean flag = p_177077_9_.isGui3d(); int i = this.func_177078_a(itemstack); float f = 0.25F; @@ -9,44 +9,7 @@ float f2 = p_177077_9_.getItemCameraTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y; GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_); -@@ -110,7 +110,6 @@ - - for (int j = 0; j < i; ++j) - { -- if (ibakedmodel.isGui3d()) - { - GlStateManager.pushMatrix(); - -@@ -119,25 +118,15 @@ - float f = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f1 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f2 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; -- GlStateManager.translate(f, f1, f2); -+ GlStateManager.translate(shouldSpreadItems() ? f : 0.0F, shouldSpreadItems() ? f1 : 0.0F, f2); - } - -+ if (ibakedmodel.isGui3d()) - GlStateManager.scale(0.5F, 0.5F, 0.5F); -- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); -+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND); - this.itemRenderer.renderItem(itemstack, ibakedmodel); - GlStateManager.popMatrix(); - } -- else -- { -- GlStateManager.pushMatrix(); -- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); -- this.itemRenderer.renderItem(itemstack, ibakedmodel); -- GlStateManager.popMatrix(); -- float f3 = ibakedmodel.getItemCameraTransforms().ground.scale.x; -- float f4 = ibakedmodel.getItemCameraTransforms().ground.scale.y; -- float f5 = ibakedmodel.getItemCameraTransforms().ground.scale.z; -- GlStateManager.translate(0.0F * f3, 0.0F * f4, 0.046875F * f5); -- } - } - - GlStateManager.popMatrix(); -@@ -157,4 +146,25 @@ +@@ -192,4 +192,25 @@ { return TextureMap.locationBlocksTexture; } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch deleted file mode 100644 index 4a76f02129..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ /dev/null @@ -1,90 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java -@@ -72,7 +72,7 @@ - public RenderItem(TextureManager textureManager, ModelManager modelManager) - { - this.textureManager = textureManager; -- this.itemModelMesher = new ItemModelMesher(modelManager); -+ this.itemModelMesher = new net.minecraftforge.client.ItemModelMesherForge(modelManager); - this.registerItems(); - } - -@@ -226,7 +226,7 @@ - k = k | -16777216; - } - -- this.renderQuad(renderer, bakedquad, k); -+ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, k); - } - } - -@@ -296,6 +296,11 @@ - modelresourcelocation = new ModelResourceLocation("bow_pulling_0", "inventory"); - } - } -+ else -+ { -+ // TODO: maybe switch to the smart player model / normal smart item model? -+ modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount()); -+ } - - if (modelresourcelocation != null) - { -@@ -317,14 +322,9 @@ - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.pushMatrix(); -- ItemCameraTransforms itemcameratransforms = model.getItemCameraTransforms(); -- itemcameratransforms.applyTransform(cameraTransformType); -+ // TODO: check if negative scale is a thing -+ model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(model, cameraTransformType); - -- if (this.func_183005_a(itemcameratransforms.getTransform(cameraTransformType))) -- { -- GlStateManager.cullFace(1028); -- } -- - this.renderItem(stack, model); - GlStateManager.cullFace(1029); - GlStateManager.popMatrix(); -@@ -352,7 +352,7 @@ - GlStateManager.blendFunc(770, 771); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.setupGuiTransform(x, y, ibakedmodel.isGui3d()); -- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GUI); -+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GUI); - this.renderItem(stack, ibakedmodel); - GlStateManager.disableAlpha(); - GlStateManager.disableRescaleNormal(); -@@ -459,10 +459,11 @@ - GlStateManager.enableDepth(); - } - -- if (stack.isItemDamaged()) -+ if (stack.getItem().showDurabilityBar(stack)) - { -- int j = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage()); -- int i = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); -+ double health = stack.getItem().getDurabilityForDisplay(stack); -+ int j = (int)Math.round(13.0D - health * 13.0D); -+ int i = (int)Math.round(255.0D - health * 255.0D); - GlStateManager.disableLighting(); - GlStateManager.disableDepth(); - GlStateManager.disableTexture2D(); -@@ -473,7 +474,7 @@ - this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255); - this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255); - this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255); -- GlStateManager.enableBlend(); -+ //GlStateManager.enableBlend(); // Forge: Disable Blend because it screws with a lot of things down the line. - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - GlStateManager.enableLighting(); -@@ -1038,6 +1039,7 @@ - this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block"); - this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block"); - this.registerBlock(Blocks.dragon_egg, "dragon_egg"); -+ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.itemModelMesher); - } - - public void onResourceManagerReload(IResourceManager resourceManager) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch index d075ecd19f..a0f8a7aeaf 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -@@ -192,7 +192,12 @@ +@@ -204,7 +204,12 @@ this.playerRenderer = new RenderPlayer(this); this.skinMap.put("default", this.playerRenderer); this.skinMap.put("slim", new RenderPlayer(this, true)); @@ -13,15 +13,3 @@ public void setRenderPosition(double renderPosXIn, double renderPosYIn, double renderPosZIn) { -@@ -241,9 +246,9 @@ - IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn)); - Block block = iblockstate.getBlock(); - -- if (block == Blocks.bed) -+ if (block.isBed(worldIn, new BlockPos(livingPlayerIn), (EntityLivingBase)livingPlayerIn)) - { -- int i = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); -+ int i = block.getBedDirection(worldIn, new BlockPos(livingPlayerIn)).getHorizontalIndex(); - this.playerViewY = (float)(i * 90 + 180); - this.playerViewX = 0.0F; - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch index 9e48e16214..77c0de3c6f 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -@@ -49,6 +49,7 @@ +@@ -55,6 +55,7 @@ public void doRender(AbstractClientPlayer entity, double x, double y, double z, float entityYaw, float partialTicks) { @@ -8,9 +8,9 @@ if (!entity.isUser() || this.renderManager.livingPlayer == entity) { double d0 = y; -@@ -61,6 +62,7 @@ - this.setModelVisibilities(entity); +@@ -69,6 +70,7 @@ super.doRender(entity, x, d0, z, entityYaw, partialTicks); + GlStateManager.func_187440_b(GlStateManager.Profile.PLAYER_SKIN); } + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(entity, this, partialTicks, x, y, z)); } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch deleted file mode 100644 index 22636f0721..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java -@@ -38,6 +38,9 @@ - protected List> layerRenderers = Lists.>newArrayList(); - protected boolean renderOutlines = false; - -+ public static float NAME_TAG_RANGE = 64.0f; -+ public static float NAME_TAG_RANGE_SNEAK = 32.0f; -+ - public RendererLivingEntity(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) - { - super(renderManagerIn); -@@ -83,10 +86,12 @@ - - public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(entity, this, x, y, z))) return; - GlStateManager.pushMatrix(); - GlStateManager.disableCull(); - this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks); -- this.mainModel.isRiding = entity.isRiding(); -+ boolean shouldSit = entity.isRiding() && (entity.ridingEntity != null && entity.ridingEntity.shouldRiderSit()); -+ this.mainModel.isRiding = shouldSit; - this.mainModel.isChild = entity.isChild(); - - try -@@ -95,7 +100,7 @@ - float f1 = this.interpolateRotation(entity.prevRotationYawHead, entity.rotationYawHead, partialTicks); - float f2 = f1 - f; - -- if (entity.isRiding() && entity.ridingEntity instanceof EntityLivingBase) -+ if (shouldSit && entity.ridingEntity instanceof EntityLivingBase) - { - EntityLivingBase entitylivingbase = (EntityLivingBase)entity.ridingEntity; - f = this.interpolateRotation(entitylivingbase.prevRenderYawOffset, entitylivingbase.renderYawOffset, partialTicks); -@@ -191,6 +196,7 @@ - { - super.doRender(entity, x, y, z, entityYaw, partialTicks); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(entity, this, x, y, z)); - } - - protected boolean setScoreTeamColor(T entityLivingBaseIn) -@@ -469,10 +475,11 @@ - - public void renderName(T entity, double x, double y, double z) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(entity, this, x, y, z))) return; - if (this.canRenderName(entity)) - { - double d0 = entity.getDistanceSqToEntity(this.renderManager.livingPlayer); -- float f = entity.isSneaking() ? 32.0F : 64.0F; -+ float f = entity.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; - - if (d0 < (double)(f * f)) - { -@@ -518,6 +525,7 @@ - } - } - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(entity, this, x, y, z)); - } - - protected boolean canRenderName(T entity) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch index d499c73f25..9f01b1daa7 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch @@ -1,47 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java -@@ -55,29 +55,28 @@ - T t = this.func_177175_a(armorSlot); - t.setModelAttributes(this.renderer.getMainModel()); - t.setLivingAnimations(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_4_); -+ t = getArmorModelHook(entitylivingbaseIn, itemstack, armorSlot, t); - this.func_177179_a(t, armorSlot); - boolean flag = this.isSlotForLeggings(armorSlot); -- this.renderer.bindTexture(this.getArmorResource(itemarmor, flag)); -+ this.renderer.bindTexture(this.getArmorResource(entitylivingbaseIn, itemstack, flag ? 2 : 1, null)); - -- switch (itemarmor.getArmorMaterial()) -- { -- case LEATHER: - int i = itemarmor.getColor(itemstack); -+ { -+ if (i != -1) // Allow this for anything, not only cloth. -+ { - float f = (float)(i >> 16 & 255) / 255.0F; - float f1 = (float)(i >> 8 & 255) / 255.0F; - float f2 = (float)(i & 255) / 255.0F; - GlStateManager.color(this.colorR * f, this.colorG * f1, this.colorB * f2, this.alpha); - t.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); -- this.renderer.bindTexture(this.getArmorResource(itemarmor, flag, "overlay")); -- case CHAIN: -- case IRON: -- case GOLD: -- case DIAMOND: -+ this.renderer.bindTexture(this.getArmorResource(entitylivingbaseIn, itemstack, flag ? 2 : 1, "overlay")); -+ } -+ { // Non-colored - GlStateManager.color(this.colorR, this.colorG, this.colorB, this.alpha); - t.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); -- default: -- -- if (!this.field_177193_i && itemstack.isItemEnchanted()) -+ } -+ // Default -+ if (!this.field_177193_i && itemstack.hasEffect()) - { - this.func_177183_a(entitylivingbaseIn, t, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); - } -@@ -135,11 +134,13 @@ +@@ -140,11 +140,13 @@ GlStateManager.disableBlend(); } @@ -55,53 +14,3 @@ private ResourceLocation getArmorResource(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) { String s = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.getArmorMaterial().getName(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); -@@ -157,4 +158,49 @@ - protected abstract void initArmor(); - - protected abstract void func_177179_a(T p_177179_1_, int p_177179_2_); -+ -+ /*=================================== FORGE START =========================================*/ -+ -+ /** -+ * Hook to allow item-sensitive armor model. for LayerBipedArmor. -+ */ -+ protected T getArmorModelHook(EntityLivingBase entity, ItemStack itemStack, int slot, T model) -+ { -+ return model; -+ } -+ -+ /** -+ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. -+ * -+ * @param entity Entity wearing the armor -+ * @param stack ItemStack for the armor -+ * @param slot Slot ID that the item is in -+ * @param type Subtype, can be null or "overlay" -+ * @return ResourceLocation pointing at the armor's texture -+ */ -+ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, int slot, String type) -+ { -+ ItemArmor item = (ItemArmor)stack.getItem(); -+ String texture = item.getArmorMaterial().getName(); -+ String domain = "minecraft"; -+ int idx = texture.indexOf(':'); -+ if (idx != -1) -+ { -+ domain = texture.substring(0, idx); -+ texture = texture.substring(idx + 1); -+ } -+ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); -+ -+ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); -+ ResourceLocation resourcelocation = (ResourceLocation)ARMOR_TEXTURE_RES_MAP.get(s1); -+ -+ if (resourcelocation == null) -+ { -+ resourcelocation = new ResourceLocation(s1); -+ ARMOR_TEXTURE_RES_MAP.put(s1, resourcelocation); -+ } -+ -+ return resourcelocation; -+ } -+ /*=================================== FORGE END ===========================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch index 50001b7701..9990cb44ad 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java -@@ -49,4 +49,10 @@ +@@ -51,4 +51,10 @@ { p_177194_1_.setInvisible(false); } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch index fdbf34c9e6..93f14a3cb3 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java -@@ -58,12 +58,17 @@ +@@ -56,12 +56,17 @@ { Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]); Arrays.sort((Object[])astitcher$holder); @@ -18,15 +18,15 @@ throw new StitcherException(stitcher$holder, s); } } -@@ -73,6 +78,7 @@ - this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth); - this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight); +@@ -182,6 +187,7 @@ + this.stitchSlots.add(stitcher$slot); + return true; } + net.minecraftforge.fml.common.ProgressManager.pop(bar); } - public List getStichSlots() -@@ -260,7 +266,7 @@ + @SideOnly(Side.CLIENT) +@@ -238,7 +244,7 @@ public String toString() { diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch index fb734bf696..8ca6b9f2f3 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java -@@ -402,4 +402,30 @@ +@@ -398,4 +398,30 @@ { return "TextureAtlasSprite{name=\'" + this.iconName + '\'' + ", frameCount=" + this.framesTextureData.size() + ", rotated=" + this.rotated + ", x=" + this.originX + ", y=" + this.originY + ", height=" + this.height + ", width=" + this.width + ", u0=" + this.minU + ", u1=" + this.maxU + ", v0=" + this.minV + ", v1=" + this.maxV + '}'; } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index a731967169..e0a4f35e60 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java -@@ -28,6 +28,7 @@ +@@ -26,6 +26,7 @@ @SideOnly(Side.CLIENT) public class TextureMap extends AbstractTexture implements ITickableTextureObject { @@ -8,7 +8,7 @@ private static final Logger logger = LogManager.getLogger(); public static final ResourceLocation LOCATION_MISSING_TEXTURE = new ResourceLocation("missingno"); public static final ResourceLocation locationBlocksTexture = new ResourceLocation("textures/atlas/blocks.png"); -@@ -38,6 +39,7 @@ +@@ -36,6 +37,7 @@ private final IIconCreator iconCreator; private int mipmapLevels; private final TextureAtlasSprite missingImage; @@ -16,7 +16,7 @@ public TextureMap(String p_i46099_1_) { -@@ -46,12 +48,23 @@ +@@ -44,12 +46,23 @@ public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn) { @@ -40,73 +40,7 @@ } private void initMissingImage() -@@ -90,12 +103,28 @@ - int j = Integer.MAX_VALUE; - int k = 1 << this.mipmapLevels; - -+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this); -+ net.minecraftforge.fml.common.FMLLog.info("Max texture size: %d", i); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.mapRegisteredSprites.size()); -+ -+ if(!skipFirst) - for (Entry entry : this.mapRegisteredSprites.entrySet()) - { - TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); - ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.getIconName()); - ResourceLocation resourcelocation1 = this.completeResourceLocation(resourcelocation, 0); -+ bar.step(resourcelocation1.getResourcePath()); - -+ if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) -+ { -+ if (!textureatlassprite.load(resourceManager, resourcelocation)) -+ { -+ j = Math.min(j, Math.min(textureatlassprite.getIconWidth(), textureatlassprite.getIconHeight())); -+ stitcher.addSprite(textureatlassprite); -+ } -+ continue; -+ } -+ - try - { - IResource iresource = resourceManager.getResource(resourcelocation1); -@@ -145,12 +174,14 @@ - } - catch (RuntimeException runtimeexception) - { -- logger.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception); -+ //logger.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation1, runtimeexception.getMessage()); - continue; - } - catch (IOException ioexception1) - { -- logger.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1); -+ //logger.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation1); - continue; - } - -@@ -166,6 +197,7 @@ - stitcher.addSprite(textureatlassprite); - } - -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); - int j1 = Math.min(j, k); - int k1 = MathHelper.calculateLogBaseTwo(j1); - -@@ -175,8 +207,11 @@ - this.mipmapLevels = k1; - } - -+ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.mapRegisteredSprites.size()); - for (final TextureAtlasSprite textureatlassprite1 : this.mapRegisteredSprites.values()) - { -+ if (skipFirst) break; -+ bar.step(textureatlassprite1.getIconName()); - try - { - textureatlassprite1.generateMipmaps(this.mipmapLevels); -@@ -213,9 +248,13 @@ +@@ -139,9 +152,13 @@ this.missingImage.generateMipmaps(this.mipmapLevels); stitcher.addSprite(this.missingImage); @@ -120,21 +54,9 @@ stitcher.doStitch(); } catch (StitcherException stitcherexception) -@@ -224,9 +263,11 @@ - } - - logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); -+ bar.step("Allocating GL texture"); - TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); - Map map = Maps.newHashMap(this.mapRegisteredSprites); - -+ bar.step("Uploading GL texture"); - for (TextureAtlasSprite textureatlassprite2 : stitcher.getStichSlots()) - { - String s = textureatlassprite2.getIconName(); -@@ -256,6 +297,13 @@ - { - textureatlassprite3.copyFrom(this.missingImage); +@@ -253,6 +270,13 @@ + crashreportcategory.addCrashSection("Mipmap levels", Integer.valueOf(this.mipmapLevels)); + throw new ReportedException(crashreport); } + + net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); @@ -145,8 +67,8 @@ + net.minecraftforge.fml.common.ProgressManager.pop(bar); } - private ResourceLocation completeResourceLocation(ResourceLocation location, int p_147634_2_) -@@ -319,4 +367,37 @@ + private ResourceLocation func_184396_a(TextureAtlasSprite p_184396_1_) +@@ -317,4 +341,37 @@ { return this.missingImage; } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch index d067a7ffb1..b561d5a3df 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java -@@ -197,9 +197,11 @@ +@@ -202,9 +202,11 @@ public static void allocateTextureImpl(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_) { @@ -12,4 +12,4 @@ + } if (p_180600_1_ >= 0) { - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, p_180600_1_); + GlStateManager.func_187421_b(3553, 33085, p_180600_1_); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch index 2ffb2ffa54..0b6520ff84 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java +++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java -@@ -99,15 +99,18 @@ +@@ -105,15 +105,18 @@ GlStateManager.disableLighting(); int i = itemFrame.getRotation(); @@ -21,9 +21,9 @@ this.renderManager.renderEngine.bindTexture(mapBackgroundTextures); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); float f = 0.0078125F; -@@ -165,6 +168,7 @@ - textureatlassprite.updateAnimation(); - } +@@ -142,6 +145,7 @@ + RenderHelper.disableStandardItemLighting(); + GlStateManager.popAttrib(); } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch index 709342ac46..bd351608ec 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java -@@ -78,6 +78,7 @@ +@@ -98,6 +98,7 @@ { TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F); } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch index 1f47f6fb49..0f22cecab2 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch @@ -1,21 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java +++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java -@@ -102,11 +102,14 @@ - { - if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared()) - { -+ if(!tileentityIn.hasFastRenderer()) -+ { - int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0); - int j = i % 65536; - int k = i / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -+ } - BlockPos blockpos = tileentityIn.getPos(); - this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage); - } -@@ -125,6 +128,11 @@ +@@ -129,6 +129,11 @@ { try { @@ -27,7 +12,7 @@ tileentityspecialrenderer.renderTileEntityAt(tileEntityIn, x, y, z, partialTicks, destroyStage); } catch (Throwable throwable) -@@ -146,4 +154,49 @@ +@@ -155,4 +160,49 @@ { return this.fontRenderer; } diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch index 3c23434d3e..89b1adcad7 100644 --- a/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/resources/FallbackResourceManager.java +++ ../src-work/minecraft/net/minecraft/client/resources/FallbackResourceManager.java -@@ -67,6 +67,7 @@ +@@ -68,6 +68,7 @@ throw new FileNotFoundException(location.toString()); } diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch deleted file mode 100644 index fa44d5f1b7..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/LanguageManager.java -+++ ../src-work/minecraft/net/minecraft/client/resources/LanguageManager.java -@@ -73,6 +73,7 @@ - } - - currentLocale.loadLocaleDataFiles(resourceManager, list); -+ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(currentLocale.properties, this.currentLanguage); - StringTranslate.replaceWith(currentLocale.properties); - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch deleted file mode 100644 index 327276eb4b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/model/IBakedModel.java -+++ ../src-work/minecraft/net/minecraft/client/resources/model/IBakedModel.java -@@ -23,5 +23,6 @@ - - TextureAtlasSprite getParticleTexture(); - -+ @Deprecated - ItemCameraTransforms getItemCameraTransforms(); - } diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch deleted file mode 100644 index cdc15c69cd..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch +++ /dev/null @@ -1,124 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/model/ModelBakery.java -+++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelBakery.java -@@ -114,7 +114,7 @@ - } - catch (Exception var6) - { -- LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation); -+ LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, var6); - } - } - catch (Exception exception) -@@ -294,6 +294,7 @@ - - protected void registerVariantNames() - { -+ this.variantNames.clear(); //FML clear this to prevent double ups. - this.variantNames.put(Item.getItemFromBlock(Blocks.stone), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); - this.variantNames.put(Item.getItemFromBlock(Blocks.dirt), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); - this.variantNames.put(Item.getItemFromBlock(Blocks.planks), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); -@@ -336,6 +337,10 @@ - this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence_gate), Lists.newArrayList(new String[] {"oak_fence_gate"})); - this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence), Lists.newArrayList(new String[] {"oak_fence"})); - this.variantNames.put(Items.oak_door, Lists.newArrayList(new String[] {"oak_door"})); -+ for (Entry, Set> e : customVariantNames.entrySet()) -+ { -+ this.variantNames.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator())); -+ } - } - - protected List getVariantNames(Item p_177596_1_) -@@ -352,7 +357,7 @@ - - protected ResourceLocation getItemLocation(String p_177583_1_) - { -- ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_); -+ ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_.replaceAll("#.*", "")); - return new ResourceLocation(resourcelocation.getResourceDomain(), "item/" + resourcelocation.getResourcePath()); - } - -@@ -395,7 +400,7 @@ - for (Entry entry : this.itemLocations.entrySet()) - { - ResourceLocation resourcelocation = (ResourceLocation)entry.getValue(); -- ModelResourceLocation modelresourcelocation1 = new ModelResourceLocation((String)entry.getKey(), "inventory"); -+ ModelResourceLocation modelresourcelocation1 = net.minecraftforge.client.model.ModelLoader.getInventoryVariant(entry.getKey()); - ModelBlock modelblock1 = (ModelBlock)this.models.get(resourcelocation); - - if (modelblock1 != null && modelblock1.isResolved()) -@@ -453,6 +458,11 @@ - - private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked) - { -+ return bakeModel(modelBlockIn, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); -+ } -+ -+ protected IBakedModel bakeModel(ModelBlock modelBlockIn, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) -+ { - TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle"))); - SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite); - -@@ -463,13 +473,13 @@ - BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); - TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture))); - -- if (blockpartface.cullFace == null) -+ if (blockpartface.cullFace == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix())) - { - simplebakedmodel$builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); - } - else - { -- simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); -+ simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); - } - } - } -@@ -479,6 +489,11 @@ - - private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) - { -+ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation)p_177589_5_, p_177589_6_); -+ } -+ -+ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) -+ { - return this.faceBakery.makeBakedQuad(p_177589_1_.positionFrom, p_177589_1_.positionTo, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.partRotation, p_177589_6_, p_177589_1_.shade); - } - -@@ -722,4 +737,35 @@ - MODEL_CLOCK.name = "class generation marker"; - MODEL_ENTITY.name = "block entity marker"; - } -+ -+ /*********************************************************** -+ * FML Start -+ ***********************************************************/ -+ private static Map, Set> customVariantNames = Maps.newHashMap(); -+ /** -+ * @deprecated use registerItemVariants -+ */ -+ @Deprecated -+ public static void addVariantName(Item item, String... names) -+ { -+ if (customVariantNames.containsKey(item.delegate)) -+ customVariantNames.get(item.delegate).addAll(Lists.newArrayList(names)); -+ else -+ customVariantNames.put(item.delegate, Sets.newHashSet(names)); -+ } -+ -+ public static void registerItemVariants(Item item, T... names) -+ { -+ if (!customVariantNames.containsKey(item.delegate)) -+ { -+ customVariantNames.put(item.delegate, Sets.newHashSet()); -+ } -+ for(ResourceLocation name : names) -+ { -+ customVariantNames.get(item.delegate).add(name.toString()); -+ } -+ } -+ /*********************************************************** -+ * FML End -+ ***********************************************************/ - } diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch deleted file mode 100644 index 62b6e2b6ee..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/model/ModelManager.java -+++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelManager.java -@@ -24,9 +24,10 @@ - - public void onResourceManagerReload(IResourceManager resourceManager) - { -- ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider); -+ ModelBakery modelbakery = new net.minecraftforge.client.model.ModelLoader(resourceManager, this.texMap, this.modelProvider); - this.modelRegistry = modelbakery.setupModelRegistry(); - this.defaultModel = (IBakedModel)this.modelRegistry.getObject(ModelBakery.MODEL_MISSING); -+ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelRegistry, modelbakery); - this.modelProvider.reloadModels(); - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch deleted file mode 100644 index c3643e8c62..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/model/ModelRotation.java -+++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelRotation.java -@@ -10,7 +10,7 @@ - import org.lwjgl.util.vector.Vector3f; - - @SideOnly(Side.CLIENT) --public enum ModelRotation -+public enum ModelRotation implements net.minecraftforge.client.model.IModelState, net.minecraftforge.client.model.ITransformation - { - X0_Y0(0, 0), - X0_Y90(0, 90), -@@ -116,4 +116,9 @@ - mapRotations.put(Integer.valueOf(modelrotation.combinedXY), modelrotation); - } - } -+ -+ public com.google.common.base.Optional apply(com.google.common.base.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(getMatrix(), part); } -+ public javax.vecmath.Matrix4f getMatrix() { return net.minecraftforge.client.ForgeHooksClient.getMatrix(this); } -+ public EnumFacing rotate(EnumFacing facing) { return rotateFace(facing); } -+ public int rotate(EnumFacing facing, int vertexIndex) { return rotateVertex(facing, vertexIndex); } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch index 10da977f0c..df746d5ea9 100644 --- a/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/settings/GameSettings.java +++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java -@@ -994,6 +994,7 @@ +@@ -887,6 +887,7 @@ public void saveOptions() { diff --git a/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch index ec5e56034d..a32bd143cb 100644 --- a/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/shader/Framebuffer.java +++ ../src-work/minecraft/net/minecraft/client/shader/Framebuffer.java -@@ -119,8 +119,17 @@ +@@ -118,8 +118,17 @@ if (this.useDepth) { OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); @@ -18,7 +18,7 @@ } this.framebufferClear(); -@@ -280,4 +289,36 @@ +@@ -279,4 +288,36 @@ GlStateManager.clear(i); this.unbindFramebuffer(); } diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandBase.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandBase.java.patch index 5355ef914b..008a1bb217 100644 --- a/patches.mcp/minecraft/net/minecraft/command/CommandBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/command/CommandBase.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/command/CommandBase.java +++ ../src-work/minecraft/net/minecraft/command/CommandBase.java -@@ -329,7 +329,7 @@ - ichatcomponent.appendText(" "); +@@ -369,7 +369,7 @@ + itextcomponent.appendText(" "); } -- IChatComponent ichatcomponent1 = new ChatComponentText(args[i]); -+ IChatComponent ichatcomponent1 = net.minecraftforge.common.ForgeHooks.newChatWithLinks(args[i]); // Forge: links for messages +- ITextComponent itextcomponent1 = new TextComponentString(args[i]); ++ ITextComponent itextcomponent1 = net.minecraftforge.common.ForgeHooks.newChatWithLinks(args[i]); // Forge: links for messages if (p_147176_3_) { diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch index 630385eaab..20f6093fd5 100644 --- a/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch +++ b/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/command/CommandEnchant.java +++ ../src-work/minecraft/net/minecraft/command/CommandEnchant.java -@@ -93,7 +93,7 @@ +@@ -85,7 +85,7 @@ { - Enchantment enchantment2 = Enchantment.getEnchantmentById(l); + Enchantment enchantment1 = Enchantment.func_185262_c(k); -- if (!enchantment2.canApplyTogether(enchantment1)) -+ if (!enchantment2.canApplyTogether(enchantment1) || !enchantment1.canApplyTogether(enchantment2)) //Forge BugFix: Let Both enchantments veto being together +- if (!enchantment.canApplyTogether(enchantment1)) ++ if (!enchantment.canApplyTogether(enchantment1) || !enchantment1.canApplyTogether(enchantment)) //Forge BugFix: Let Both enchantments veto being together { - throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment1.getTranslatedName(j), enchantment2.getTranslatedName(nbttaglist.getCompoundTagAt(k).getShort("lvl"))}); + throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment.getTranslatedName(i), enchantment1.getTranslatedName(nbttaglist.getCompoundTagAt(j).getShort("lvl"))}); } diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch index 777a3d0617..94ffd1431c 100644 --- a/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch +++ b/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch @@ -1,28 +1,28 @@ --- ../src-base/minecraft/net/minecraft/command/CommandFill.java +++ ../src-work/minecraft/net/minecraft/command/CommandFill.java -@@ -48,6 +48,7 @@ +@@ -50,6 +50,7 @@ { - i = parseInt(args[7], 0, 15); + i = parseInt(p_184881_3_[7], 0, 15); } + IBlockState state = block.getStateFromMeta(i); BlockPos blockpos2 = new BlockPos(Math.min(blockpos.getX(), blockpos1.getX()), Math.min(blockpos.getY(), blockpos1.getY()), Math.min(blockpos.getZ(), blockpos1.getZ())); BlockPos blockpos3 = new BlockPos(Math.max(blockpos.getX(), blockpos1.getX()), Math.max(blockpos.getY(), blockpos1.getY()), Math.max(blockpos.getZ(), blockpos1.getZ())); -@@ -75,7 +76,7 @@ +@@ -77,7 +78,7 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); boolean flag = false; -- if (args.length >= 10 && block.hasTileEntity()) -+ if (args.length >= 10 && block.hasTileEntity(state)) +- if (p_184881_3_.length >= 10 && block.hasTileEntity()) ++ if (p_184881_3_.length >= 10 && block.hasTileEntity(state)) { - String s = getChatComponentFromNthArg(sender, args, 9).getUnformattedText(); + String s = getChatComponentFromNthArg(p_184881_2_, p_184881_3_, 9).getUnformattedText(); -@@ -116,7 +117,7 @@ +@@ -118,7 +119,7 @@ continue; } } -- else if (args[8].equals("replace") && !block.hasTileEntity()) -+ else if (args[8].equals("replace") && !block.hasTileEntity(state)) +- else if (p_184881_3_[8].equals("replace") && !block.hasTileEntity()) ++ else if (p_184881_3_[8].equals("replace") && !block.hasTileEntity(state)) { - if (args.length > 9) + if (p_184881_3_.length > 9) { diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch index dc2cf60369..7afcafd3c1 100644 --- a/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch +++ b/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/command/CommandHandler.java +++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java -@@ -44,6 +44,16 @@ +@@ -46,6 +46,16 @@ } - else if (icommand.canCommandSenderUseCommand(sender)) + else if (icommand.func_184882_a(this.func_184879_a(), sender)) { + net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(icommand, sender, astring); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) @@ -16,13 +16,13 @@ + if (i > -1) { - List list = PlayerSelector.matchEntities(sender, astring[i], Entity.class); -@@ -107,7 +117,7 @@ - ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.generic.exception", new Object[0]); - chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); - sender.addChatMessage(chatcomponenttranslation); + List list = EntitySelector.matchEntities(sender, astring[i], Entity.class); +@@ -109,7 +119,7 @@ + TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.generic.exception", new Object[0]); + textcomponenttranslation.getChatStyle().setColor(TextFormatting.RED); + sender.addChatMessage(textcomponenttranslation); - logger.warn("Couldn\'t process command: \'" + input + "\'"); -+ logger.warn("Couldn\'t process command: \'" + input + "\'", var9); // Forge: Log stacktrace of unknown exceptions ++ logger.warn("Couldn\'t process command: \'" + input + "\'", var9); } return false; diff --git a/patches.mcp/minecraft/net/minecraft/command/PlayerSelector.java.patch b/patches.mcp/minecraft/net/minecraft/command/EntitySelector.java.patch similarity index 84% rename from patches.mcp/minecraft/net/minecraft/command/PlayerSelector.java.patch rename to patches.mcp/minecraft/net/minecraft/command/EntitySelector.java.patch index 2a904ba288..0d8cb8557e 100644 --- a/patches.mcp/minecraft/net/minecraft/command/PlayerSelector.java.patch +++ b/patches.mcp/minecraft/net/minecraft/command/EntitySelector.java.patch @@ -1,8 +1,8 @@ ---- ../src-base/minecraft/net/minecraft/command/PlayerSelector.java -+++ ../src-work/minecraft/net/minecraft/command/PlayerSelector.java +--- ../src-base/minecraft/net/minecraft/command/EntitySelector.java ++++ ../src-work/minecraft/net/minecraft/command/EntitySelector.java @@ -36,9 +36,9 @@ - public class PlayerSelector + public class EntitySelector { - private static final Pattern tokenPattern = Pattern.compile("^@([pare])(?:\\[([\\w=,!-]*)\\])?$"); + private static final Pattern tokenPattern = Pattern.compile("^@([pare])(?:\\[([\\w\\.=,!-]*)\\])?$"); // FORGE: allow . in entity selectors diff --git a/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch b/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch index b672663398..07a4ff3943 100644 --- a/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch +++ b/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch @@ -1,20 +1,20 @@ --- ../src-base/minecraft/net/minecraft/command/server/CommandSetBlock.java +++ ../src-work/minecraft/net/minecraft/command/server/CommandSetBlock.java -@@ -52,6 +52,8 @@ - i = parseInt(args[4], 0, 15); +@@ -54,6 +54,8 @@ + i = parseInt(p_184881_3_[4], 0, 15); } + IBlockState state = block.getStateFromMeta(i); + - World world = sender.getEntityWorld(); + World world = p_184881_2_.getEntityWorld(); if (!world.isBlockLoaded(blockpos)) -@@ -63,7 +65,7 @@ +@@ -65,7 +67,7 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); boolean flag = false; -- if (args.length >= 7 && block.hasTileEntity()) -+ if (args.length >= 7 && block.hasTileEntity(state)) +- if (p_184881_3_.length >= 7 && block.hasTileEntity()) ++ if (p_184881_3_.length >= 7 && block.hasTileEntity(state)) { - String s = getChatComponentFromNthArg(sender, args, 6).getUnformattedText(); + String s = getChatComponentFromNthArg(p_184881_2_, p_184881_3_, 6).getUnformattedText(); diff --git a/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch b/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch index be6dce5388..e5f4feaa62 100644 --- a/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch +++ b/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/command/server/CommandTestForBlock.java +++ ../src-work/minecraft/net/minecraft/command/server/CommandTestForBlock.java -@@ -70,7 +70,7 @@ +@@ -72,7 +72,7 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); boolean flag = false; -- if (args.length >= 6 && block.hasTileEntity()) -+ if (args.length >= 6 && block.hasTileEntity(block.getStateFromMeta(i))) +- if (p_184881_3_.length >= 6 && block.hasTileEntity()) ++ if (p_184881_3_.length >= 6 && block.hasTileEntity(block.getStateFromMeta(i))) { - String s = getChatComponentFromNthArg(sender, args, 5).getUnformattedText(); + String s = getChatComponentFromNthArg(p_184881_2_, p_184881_3_, 5).getUnformattedText(); diff --git a/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch b/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch index 3918b6866f..babe95608a 100644 --- a/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch +++ b/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/crash/CrashReportCategory.java +++ ../src-work/minecraft/net/minecraft/crash/CrashReportCategory.java -@@ -117,8 +117,11 @@ +@@ -122,8 +122,11 @@ } else { diff --git a/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch index f3dc07bd21..950a1f5b80 100644 --- a/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -1,15 +1,6 @@ --- ../src-base/minecraft/net/minecraft/enchantment/Enchantment.java +++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java -@@ -61,7 +61,7 @@ - - if (enchantmentsList[enchID] != null) - { -- throw new IllegalArgumentException("Duplicate enchantment id!"); -+ throw new IllegalArgumentException("Duplicate enchantment id! " + this.getClass() + " and " + enchantmentsList[enchID].getClass() + " Enchantment ID:" + enchID); - } - else - { -@@ -139,7 +139,7 @@ +@@ -118,7 +118,7 @@ public boolean canApply(ItemStack stack) { @@ -18,49 +9,3 @@ } public void onEntityDamaged(EntityLivingBase user, Entity target, int level) -@@ -150,6 +150,45 @@ - { - } - -+ /** -+ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)} -+ * applies for all possible enchantments. -+ * @param stack -+ * @return -+ */ -+ public boolean canApplyAtEnchantingTable(ItemStack stack) -+ { -+ return this.type.canEnchantItem(stack.getItem()); -+ } -+ -+ private static final java.lang.reflect.Field bookSetter = Enchantment.class.getDeclaredFields()[1]; -+ /** -+ * Add to the list of enchantments applicable by the anvil from a book -+ * -+ * @param enchantment -+ */ -+ public static void addToBookList(Enchantment enchantment) -+ { -+ try -+ { -+ net.minecraftforge.common.util.EnumHelper.setFailsafeFieldValue(bookSetter, null, -+ com.google.common.collect.ObjectArrays.concat(enchantmentsBookList, enchantment)); -+ } -+ catch (Exception e) -+ { -+ throw new RuntimeException(e); //Rethrow see what happens -+ } -+ } -+ -+ /** -+ * Is this enchantment allowed to be enchanted on books via Enchantment Table -+ * @return false to disable the vanilla feature -+ */ -+ public boolean isAllowedOnBooks() -+ { -+ return true; -+ } -+ - static - { - List list = Lists.newArrayList(); diff --git a/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index 854ea8d5d5..1cdc06c02d 100644 --- a/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java +++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java -@@ -296,7 +296,7 @@ +@@ -292,7 +292,7 @@ public static int calcItemStackEnchantability(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) { Item item = p_77514_3_.getItem(); @@ -9,33 +9,12 @@ if (i <= 0) { -@@ -345,7 +345,7 @@ - public static List buildEnchantmentList(Random randomIn, ItemStack itemStackIn, int p_77513_2_) +@@ -339,7 +339,7 @@ { + List list = Lists.newArrayList(); Item item = itemStackIn.getItem(); - int i = item.getItemEnchantability(); + int i = item.getItemEnchantability(itemStackIn); if (i <= 0) { -@@ -387,7 +387,9 @@ - - for (EnchantmentData enchantmentdata1 : list) - { -- if (!enchantmentdata1.enchantmentobj.canApplyTogether(Enchantment.getEnchantmentById(integer.intValue()))) -+ Enchantment e1 = enchantmentdata1.enchantmentobj; -+ Enchantment e2 = Enchantment.getEnchantmentById(integer.intValue()); -+ if (!e1.canApplyTogether(e2) || !e2.canApplyTogether(e1)) //Forge BugFix: Let Both enchantments veto being together - { - flag = false; - break; -@@ -421,7 +423,8 @@ - - for (Enchantment enchantment : Enchantment.enchantmentsBookList) - { -- if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) -+ if (enchantment == null) continue; -+ if (enchantment.canApplyAtEnchantingTable(p_77505_1_) || (flag && enchantment.isAllowedOnBooks())) - { - for (int i = enchantment.getMinLevel(); i <= enchantment.getMaxLevel(); ++i) - { diff --git a/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch b/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch index 2691d82dfc..cfdd777961 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch @@ -1,17 +1,22 @@ --- ../src-base/minecraft/net/minecraft/entity/Entity.java +++ ../src-work/minecraft/net/minecraft/entity/Entity.java -@@ -49,7 +49,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; +@@ -76,7 +76,7 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; -public abstract class Entity implements ICommandSender +public abstract class Entity implements ICommandSender, net.minecraftforge.common.capabilities.ICapabilitySerializable { + private static final Logger field_184243_a = LogManager.getLogger(); private static final AxisAlignedBB ZERO_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); - private static int nextEntityID; -@@ -129,6 +129,15 @@ - protected UUID entityUniqueID; - private final CommandResultStats cmdResultStats; +@@ -195,8 +195,20 @@ + this.dataWatcher.func_187214_a(field_184242_az, ""); + this.dataWatcher.func_187214_a(field_184234_aB, Boolean.valueOf(false)); + this.entityInit(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); ++ for (net.minecraftforge.common.IExtendedEntityProperties props : extendedProperties.values()) props.init(this, worldIn); ++ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this); + } + /** Forge: Used to store custom data for each entity. */ + private NBTTagCompound customEntityData; @@ -25,35 +30,8 @@ public int getEntityId() { return this.entityId; -@@ -172,6 +181,9 @@ - this.dataWatcher.addObject(2, ""); - this.dataWatcher.addObject(4, Byte.valueOf((byte)0)); - this.entityInit(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); -+ for (net.minecraftforge.common.IExtendedEntityProperties props : extendedProperties.values()) props.init(this, worldIn); -+ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this); - } - - protected abstract void entityInit(); -@@ -996,12 +1008,12 @@ - IBlockState iblockstate = this.worldObj.getBlockState(blockpos); - Block block = iblockstate.getBlock(); - -+ Boolean result = block.isEntityInsideMaterial(this.worldObj, blockpos, iblockstate, this, d0, materialIn, true); -+ if (result != null) return result; -+ - if (block.getMaterial() == materialIn) - { -- float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F; -- float f1 = (float)(blockpos.getY() + 1) - f; -- boolean flag = d0 < (double)f1; -- return !flag && this instanceof EntityPlayer ? false : flag; -+ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(materialIn, this, blockpos); - } - else - { -@@ -1356,6 +1368,23 @@ - tagCompund.setBoolean("Silent", this.isSilent()); +@@ -1534,6 +1546,23 @@ + tagCompund.setTag("Tags", nbttaglist); } + if (customEntityData != null) tagCompund.setTag("ForgeData", customEntityData); @@ -75,39 +53,8 @@ + this.writeEntityToNBT(tagCompund); - if (this.ridingEntity != null) -@@ -1438,6 +1467,30 @@ - this.setAlwaysRenderNameTag(tagCompund.getBoolean("CustomNameVisible")); - this.cmdResultStats.readStatsFromNBT(tagCompund); - this.setSilent(tagCompund.getBoolean("Silent")); -+ -+ if (tagCompund.hasKey("ForgeData")) customEntityData = tagCompund.getCompoundTag("ForgeData"); -+ for (String identifier : this.extendedProperties.keySet()) -+ { -+ try -+ { -+ net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); -+ props.loadNBTData(tagCompund); -+ } -+ catch (Throwable t) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe("Failed to load extended properties for %s. This is a mod issue.", identifier); -+ t.printStackTrace(); -+ } -+ } -+ -+ //Rawr, legacy code, Vanilla added a UUID, keep this so older maps will convert properly TODO: Remove in 1.9 -+ if (tagCompund.hasKey("PersistentIDMSB") && tagCompund.hasKey("PersistentIDLSB")) -+ { -+ this.entityUniqueID = new UUID(tagCompund.getLong("PersistentIDMSB"), tagCompund.getLong("PersistentIDLSB")); -+ } -+ -+ if (this.capabilities != null && tagCompund.hasKey("ForgeCaps")) this.capabilities.deserializeNBT(tagCompund.getCompoundTag("ForgeCaps")); -+ - this.readEntityFromNBT(tagCompund); - - if (this.shouldSetPosAfterLoading()) -@@ -1512,7 +1565,10 @@ + if (this.func_184207_aI()) +@@ -1715,7 +1744,10 @@ { EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, itemStackIn); entityitem.setDefaultPickupDelay(); @@ -119,23 +66,15 @@ return entityitem; } else -@@ -1655,6 +1711,7 @@ - - public void mountEntity(Entity entityIn) - { -+ if(!(this instanceof EntityLivingBase) && !net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } - this.entityRiderPitchDelta = 0.0D; - this.entityRiderYawDelta = 0.0D; - -@@ -2049,6 +2106,7 @@ +@@ -2279,6 +2311,7 @@ { if (!this.worldObj.isRemote && !this.isDead) { + if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, dimensionId)) return; this.worldObj.theProfiler.startSection("changeDimension"); - MinecraftServer minecraftserver = MinecraftServer.getServer(); + MinecraftServer minecraftserver = this.func_184102_h(); int i = this.dimension; -@@ -2092,7 +2150,7 @@ +@@ -2372,7 +2405,7 @@ public float getExplosionResistance(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn) { @@ -144,11 +83,10 @@ } public boolean verifyExplosion(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn, float p_174816_5_) -@@ -2353,4 +2411,209 @@ - +@@ -2662,6 +2695,211 @@ EnchantmentHelper.applyArthropodEnchantments(entityLivingBaseIn, entityIn); } -+ + + /* ================================== Forge Start =====================================*/ + /** + * Returns a NBTTagCompound that can be used to store custom data for this entity. @@ -353,4 +291,7 @@ + return ret; + } + /* ================================== Forge End =====================================*/ - } ++ + public void func_184178_b(EntityPlayerMP p_184178_1_) + { + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityAgeable.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityAgeable.java.patch deleted file mode 100644 index 7fa218dc7f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityAgeable.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityAgeable.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityAgeable.java -@@ -31,7 +31,7 @@ - { - if (!this.worldObj.isRemote) - { -- Class oclass = EntityList.getClassFromID(itemstack.getMetadata()); -+ Class oclass = EntityList.stringToClassMapping.get(net.minecraft.item.ItemMonsterPlacer.getEntityName(itemstack)); - - if (oclass != null && this.getClass() == oclass) - { diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch deleted file mode 100644 index a249f305a0..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityHanging.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityHanging.java -@@ -123,6 +123,9 @@ - { - BlockPos blockpos1 = blockpos.offset(enumfacing, k).up(l); - Block block = this.worldObj.getBlockState(blockpos1).getBlock(); -+ -+ if ( block.isSideSolid( this.worldObj, blockpos1, this.facingDirection )) -+ continue; - - if (!block.getMaterial().isSolid() && !BlockRedstoneDiode.isRedstoneRepeaterBlockID(block)) - { diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch index 7b099fb5e7..4fe4eddce7 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityList.java +++ ../src-work/minecraft/net/minecraft/entity/EntityList.java -@@ -88,6 +88,7 @@ +@@ -91,6 +91,7 @@ public static void addMapping(Class entityClass, String entityName, int id) { @@ -8,9 +8,9 @@ if (stringToClassMapping.containsKey(entityName)) { throw new IllegalArgumentException("ID is already registered: " + entityName); -@@ -151,9 +152,10 @@ - nbt.removeTag("Type"); - } +@@ -148,9 +149,10 @@ + { + Entity entity = null; + Class oclass = null; try @@ -20,7 +20,7 @@ if (oclass != null) { -@@ -167,7 +169,17 @@ +@@ -164,7 +166,17 @@ if (entity != null) { @@ -38,18 +38,8 @@ } else { -@@ -343,7 +355,9 @@ - - public static class EntityEggInfo - { -+ @Deprecated // This is not always a valid number in the global ID list. - public final int spawnedID; -+ public final String name; - public final int primaryColor; - public final int secondaryColor; - public final StatBase field_151512_d; -@@ -356,6 +370,17 @@ - this.secondaryColor = spotColor; +@@ -362,6 +374,17 @@ + this.secondaryColor = p_i47076_3_; this.field_151512_d = StatList.getStatKillEntity(this); this.field_151513_e = StatList.getStatEntityKilledBy(this); + this.name = EntityList.getStringFromID(id); diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch index 319c8d88ad..ab82bb636b 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java -@@ -121,6 +121,7 @@ +@@ -171,6 +171,7 @@ public void setAttackTarget(EntityLivingBase entitylivingbaseIn) { this.attackTarget = entitylivingbaseIn; @@ -8,7 +8,7 @@ } public boolean canAttackClass(Class cls) -@@ -498,10 +499,22 @@ +@@ -699,10 +700,22 @@ protected void despawnEntity() { @@ -31,8 +31,8 @@ else { Entity entity = this.worldObj.getClosestPlayerToEntity(this, -1.0D); -@@ -621,7 +634,6 @@ - return this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()); +@@ -835,7 +848,6 @@ + return !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()) && this.worldObj.func_184144_a(this, this.getEntityBoundingBox()).isEmpty() && this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this); } - @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 4dc1946473..535927f319 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -1,24 +1,7 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java -@@ -170,6 +170,7 @@ - } - - int i = (int)(150.0D * d0); -+ if ( !block.addLandingEffects( (WorldServer)this.worldObj, pos, iblockstate, this, i ) ) - ((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.BLOCK_DUST, this.posX, this.posY, this.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] {Block.getStateId(iblockstate)}); - } - } -@@ -237,7 +238,7 @@ - } - } - -- if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase) -+ if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity != null && ridingEntity.shouldDismountInWater(this)) - { - this.mountEntity((Entity)null); - } -@@ -319,7 +320,7 @@ - if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot")) +@@ -363,7 +363,7 @@ + if (!this.worldObj.isRemote && (this.isPlayer() || this.recentlyHit > 0 && this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot"))) { int i = this.getExperiencePoints(this.attackingPlayer); - @@ -26,7 +9,7 @@ while (i > 0) { int j = EntityXPOrb.getXPSplit(i); -@@ -380,6 +381,7 @@ +@@ -424,6 +424,7 @@ { this.entityLivingToAttack = livingBase; this.revengeTimer = this.ticksExisted; @@ -34,15 +17,7 @@ } public EntityLivingBase getLastAttacker() -@@ -663,7 +665,6 @@ - return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; - } - -- @SideOnly(Side.CLIENT) - public void removePotionEffectClient(int potionId) - { - this.activePotionsMap.remove(Integer.valueOf(potionId)); -@@ -712,6 +713,8 @@ +@@ -775,6 +776,8 @@ public void heal(float healAmount) { @@ -51,7 +26,7 @@ float f = this.getHealth(); if (f > 0.0F) -@@ -732,6 +735,7 @@ +@@ -795,6 +798,7 @@ public boolean attackEntityFrom(DamageSource source, float amount) { @@ -59,7 +34,7 @@ if (this.isEntityInvulnerable(source)) { return false; -@@ -797,9 +801,9 @@ +@@ -883,9 +887,9 @@ this.recentlyHit = 100; this.attackingPlayer = (EntityPlayer)entity; } @@ -71,26 +46,8 @@ if (entitywolf.isTamed()) { -@@ -883,6 +887,7 @@ - - public void onDeath(DamageSource cause) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; - Entity entity = cause.getEntity(); - EntityLivingBase entitylivingbase = this.func_94060_bK(); - -@@ -908,6 +913,9 @@ - i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity); - } - -+ captureDrops = true; -+ capturedDrops.clear(); -+ - if (this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot")) - { - this.dropFewItems(this.recentlyHit > 0, i); -@@ -918,6 +926,16 @@ - this.addRandomDrop(); +@@ -982,6 +986,16 @@ + return true; } } + @@ -105,17 +62,8 @@ + } } - this.worldObj.setEntityState(this, (byte)3); -@@ -972,7 +990,7 @@ - int j = MathHelper.floor_double(this.getEntityBoundingBox().minY); - int k = MathHelper.floor_double(this.posZ); - Block block = this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock(); -- return (block == Blocks.ladder || block == Blocks.vine) && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).isSpectator()); -+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(block, worldObj, new BlockPos(i, j, k), this); - } - - public boolean isEntityAlive() -@@ -982,6 +1000,9 @@ + return false; +@@ -1139,6 +1153,9 @@ public void fall(float distance, float damageMultiplier) { @@ -123,9 +71,9 @@ + if (ret == null) return; + distance = ret[0]; damageMultiplier = ret[1]; super.fall(distance, damageMultiplier); - PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump); - float f = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F; -@@ -1094,6 +1115,8 @@ + PotionEffect potioneffect = this.getActivePotionEffect(MobEffects.jump); + float f = potioneffect == null ? 0.0F : (float)(potioneffect.getAmplifier() + 1); +@@ -1231,6 +1248,8 @@ { if (!this.isEntityInvulnerable(damageSrc)) { @@ -134,9 +82,9 @@ damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); float f = damageAmount; -@@ -1142,6 +1165,11 @@ +@@ -1279,6 +1298,11 @@ - public void swingItem() + public void func_184609_a(EnumHand p_184609_1_) { + ItemStack stack = this.getHeldItem(); + if (stack != null && stack.getItem() != null) @@ -146,15 +94,7 @@ if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) { this.swingProgressInt = -1; -@@ -1281,6 +1309,7 @@ - - public void dismountEntity(Entity p_110145_1_) - { -+ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_110145_1_, false)){ return; } - double d0 = p_110145_1_.posX; - double d1 = p_110145_1_.getEntityBoundingBox().minY + (double)p_110145_1_.height; - double d2 = p_110145_1_.posZ; -@@ -1346,6 +1375,7 @@ +@@ -1586,6 +1610,7 @@ } this.isAirBorne = true; @@ -162,27 +102,18 @@ } protected void updateAITick() -@@ -1530,6 +1560,7 @@ +@@ -1845,6 +1870,7 @@ public void onUpdate() { + if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return; super.onUpdate(); + this.func_184608_ct(); - if (!this.worldObj.isRemote) -@@ -1817,6 +1848,7 @@ - - public void mountEntity(Entity entityIn) - { -+ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } - if (this.ridingEntity != null && entityIn == null) - { - if (!this.worldObj.isRemote) -@@ -1998,4 +2030,39 @@ - { +@@ -2351,6 +2377,41 @@ this.potionsNeedUpdate = true; } -+ + + /*** + * Removes all potion effects that have curativeItem as a curative item for its effect + * @param curativeItem The itemstack we are using to cure potion effects @@ -217,4 +148,7 @@ + { + return this instanceof net.minecraft.entity.passive.EntityPig; + } - } ++ + public abstract EnumHandSide func_184591_cq(); + + public boolean func_184587_cr() diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch deleted file mode 100644 index 20ea69bf3a..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java -@@ -109,6 +109,7 @@ - - public boolean interactFirst(EntityPlayer playerIn) - { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; - this.commandBlockLogic.tryOpenEditCommandBlock(playerIn); - return false; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch index d3e15e11d6..8901784d44 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java +++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java -@@ -56,6 +56,8 @@ +@@ -75,6 +75,8 @@ public void trackEntity(Entity p_72786_1_) { @@ -9,11 +9,10 @@ if (p_72786_1_ instanceof EntityPlayerMP) { this.trackEntity(p_72786_1_, 512, 2); -@@ -331,4 +333,23 @@ - } +@@ -329,6 +331,25 @@ } } -+ + + /* ======================================== FORGE START =====================================*/ + + // don't expose the EntityTrackerEntry directly so mods can't mess with the data in there as easily @@ -32,4 +31,7 @@ + } + + /* ======================================== FORGE END =====================================*/ - } ++ + public void func_151248_b(Entity entityIn, Packet p_151248_2_) + { + EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry)this.trackedEntityHashTable.lookup(entityIn.getEntityId()); diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch index 8f9273e0ee..8375c44cf6 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch @@ -1,36 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java +++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java -@@ -379,6 +379,14 @@ - this.lastTrackedEntityMotionY = this.trackedEntity.motionY; - this.motionZ = this.trackedEntity.motionZ; - -+ int posX = MathHelper.floor_double(this.trackedEntity.posX * 32.0D); -+ int posY = MathHelper.floor_double(this.trackedEntity.posY * 32.0D); -+ int posZ = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D); -+ if (posX != this.encodedPosX || posY != this.encodedPosY || posZ != this.encodedPosZ) -+ { -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.trackedEntity, playerMP, this.encodedPosX, this.encodedPosY, this.encodedPosZ); -+ } -+ - if (this.sendVelocityUpdates && !(packet instanceof S0FPacketSpawnMob)) - { - playerMP.playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(this.trackedEntity.getEntityId(), this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ)); -@@ -426,12 +434,14 @@ - playerMP.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.trackedEntity.getEntityId(), potioneffect)); - } - } -+ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(trackedEntity, playerMP); - } - } - else if (this.trackingPlayers.contains(playerMP)) - { - this.trackingPlayers.remove(playerMP); - playerMP.removeEntity(this.trackedEntity); -+ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(trackedEntity, playerMP); - } - } - } -@@ -463,6 +473,9 @@ +@@ -477,6 +477,9 @@ logger.warn("Fetching addPacket for removed entity"); } @@ -39,4 +9,4 @@ + if (this.trackedEntity instanceof EntityItem) { - return new S0EPacketSpawnObject(this.trackedEntity, 2, 1); + return new SPacketSpawnObject(this.trackedEntity, 2, 1); diff --git a/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch b/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch deleted file mode 100644 index 81f1b497ae..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java -+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java -@@ -20,6 +20,8 @@ - private double targetX; - private double targetY; - private double targetZ; -+ private int failedPathFindingPenalty = 0; -+ private boolean canPenalize = false; - - public EntityAIAttackOnCollide(EntityCreature creature, Class targetClass, double speedIn, boolean useLongMemory) - { -@@ -54,6 +56,19 @@ - } - else - { -+ if (canPenalize) -+ { -+ if (--this.delayCounter <= 0) -+ { -+ this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); -+ this.targetX = 4 + this.attacker.getRNG().nextInt(7); -+ return this.entityPathEntity != null; -+ } -+ else -+ { -+ return true; -+ } -+ } - this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); - return this.entityPathEntity != null; - } -@@ -91,6 +106,23 @@ - this.targetZ = entitylivingbase.posZ; - this.delayCounter = 4 + this.attacker.getRNG().nextInt(7); - -+ if (this.canPenalize) -+ { -+ this.targetX += failedPathFindingPenalty; -+ if (this.attacker.getNavigator().getPath() != null) -+ { -+ net.minecraft.pathfinding.PathPoint finalPathPoint = this.attacker.getNavigator().getPath().getFinalPathPoint(); -+ if (finalPathPoint != null && entitylivingbase.getDistanceSq(finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord) < 1) -+ failedPathFindingPenalty = 0; -+ else -+ failedPathFindingPenalty += 10; -+ } -+ else -+ { -+ failedPathFindingPenalty += 10; -+ } -+ } -+ - if (d0 > 1024.0D) - { - this.delayCounter += 10; diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch deleted file mode 100644 index b7daaa8b7b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/boss/EntityDragon.java -+++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java -@@ -479,9 +479,9 @@ - BlockPos blockpos = new BlockPos(k1, l1, i2); - Block block = this.worldObj.getBlockState(blockpos).getBlock(); - -- if (block.getMaterial() != Material.air) -+ if (!block.isAir(worldObj, new BlockPos(k1, l1, i2))) - { -- if (block != Blocks.barrier && block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && block != Blocks.command_block && this.worldObj.getGameRules().getBoolean("mobGriefing")) -+ if (block.canEntityDestroy(worldObj, new BlockPos(k1, l1, i2), this) && this.worldObj.getGameRules().getBoolean("mobGriefing")) - { - flag1 = this.worldObj.setBlockToAir(blockpos) || flag1; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch deleted file mode 100644 index c999b9d328..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/boss/EntityWither.java -+++ ../src-work/minecraft/net/minecraft/entity/boss/EntityWither.java -@@ -343,7 +343,7 @@ - BlockPos blockpos = new BlockPos(i3, k, l); - Block block = this.worldObj.getBlockState(blockpos).getBlock(); - -- if (block.getMaterial() != Material.air && func_181033_a(block)) -+ if (!block.isAir(worldObj,blockpos) && func_181033_a(block) && block.canEntityDestroy(worldObj, blockpos, this)) - { - flag = this.worldObj.destroyBlock(blockpos, true) || flag; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch deleted file mode 100644 index 98bf842696..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/boss/IBossDisplayData.java -+++ ../src-work/minecraft/net/minecraft/entity/boss/IBossDisplayData.java -@@ -4,7 +4,6 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public interface IBossDisplayData - { - float getMaxHealth(); diff --git a/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch index 662a54e4d7..e461fad3cc 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java +++ ../src-work/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java -@@ -90,7 +90,8 @@ +@@ -104,7 +104,8 @@ for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity)list.get(i); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch index 8829569eeb..4244d13761 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityEnderPearl.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java -@@ -61,6 +61,9 @@ +@@ -84,6 +84,9 @@ if (entityplayermp.playerNetServerHandler.getNetworkManager().isChannelOpen() && entityplayermp.worldObj == this.worldObj && !entityplayermp.isPlayerSleeping()) { @@ -10,8 +10,8 @@ if (this.rand.nextFloat() < 0.05F && this.worldObj.getGameRules().getBoolean("doMobSpawning")) { EntityEndermite entityendermite = new EntityEndermite(this.worldObj); -@@ -74,9 +77,10 @@ - entitylivingbase.mountEntity((Entity)null); +@@ -97,9 +100,10 @@ + this.func_184210_p(); } - entitylivingbase.setPositionAndUpdate(this.posX, this.posY, this.posZ); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch index 65666ecaac..e78393fac3 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java -@@ -29,6 +29,11 @@ +@@ -37,6 +37,11 @@ private String owner; public float hoverStart; @@ -12,7 +12,7 @@ public EntityItem(World worldIn, double x, double y, double z) { super(worldIn); -@@ -46,6 +51,7 @@ +@@ -54,6 +59,7 @@ { this(worldIn, x, y, z); this.setEntityItemStack(stack); @@ -20,7 +20,7 @@ } protected boolean canTriggerWalking() -@@ -69,6 +75,8 @@ +@@ -77,6 +83,8 @@ public void onUpdate() { @@ -29,7 +29,7 @@ if (this.getEntityItem() == null) { this.setDead(); -@@ -129,8 +137,16 @@ +@@ -137,8 +145,16 @@ this.handleWaterMovement(); @@ -47,15 +47,15 @@ this.setDead(); } } -@@ -271,6 +287,7 @@ - tagCompound.setShort("Health", (short)((byte)this.health)); +@@ -279,6 +295,7 @@ + tagCompound.setShort("Health", (short)this.health); tagCompound.setShort("Age", (short)this.age); tagCompound.setShort("PickupDelay", (short)this.delayBeforeCanPickup); + tagCompound.setInteger("Lifespan", lifespan); if (this.getThrower() != null) { -@@ -311,20 +328,23 @@ +@@ -319,20 +336,23 @@ NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Item"); this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound)); @@ -84,15 +84,15 @@ { if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log)) { -@@ -361,6 +381,7 @@ +@@ -369,6 +389,7 @@ } } + net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(entityIn, this); if (!this.isSilent()) { - this.worldObj.playSoundAtEntity(entityIn, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); -@@ -402,11 +423,6 @@ + this.worldObj.func_184148_a((EntityPlayer)null, entityIn.posX, entityIn.posY, entityIn.posZ, SoundEvents.field_187638_cR, SoundCategory.PLAYERS, 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); +@@ -414,11 +435,6 @@ if (itemstack == null) { @@ -104,7 +104,7 @@ return new ItemStack(Blocks.stone); } else -@@ -480,6 +496,6 @@ +@@ -492,6 +508,6 @@ public void func_174870_v() { this.setInfinitePickupDelay(); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch index dce70c355e..a01a4c93ab 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityItemFrame.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityItemFrame.java -@@ -122,7 +122,7 @@ +@@ -137,7 +137,7 @@ { if (p_110131_1_ != null) { diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch index 5ceb361afd..4a0a53dd36 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecart.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecart.java -@@ -50,6 +50,20 @@ +@@ -54,6 +54,20 @@ @SideOnly(Side.CLIENT) private double velocityZ; @@ -21,7 +21,7 @@ public EntityMinecart(World worldIn) { super(worldIn); -@@ -95,17 +109,19 @@ +@@ -99,17 +113,19 @@ public AxisAlignedBB getCollisionBox(Entity entityIn) { @@ -42,7 +42,7 @@ } public EntityMinecart(World worldIn, double x, double y, double z) -@@ -309,7 +325,7 @@ +@@ -315,7 +331,7 @@ BlockPos blockpos = new BlockPos(k, l, i1); IBlockState iblockstate = this.worldObj.getBlockState(blockpos); @@ -51,7 +51,7 @@ { this.func_180460_a(blockpos, iblockstate); -@@ -348,7 +364,10 @@ +@@ -354,7 +370,10 @@ this.setRotation(this.rotationYaw, this.rotationPitch); @@ -61,9 +61,9 @@ + else box = this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D); + for (Entity entity : this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box)) { - if (entity != this.riddenByEntity && entity.canBePushed() && entity instanceof EntityMinecart) + if (!this.func_184196_w(entity) && entity.canBePushed() && entity instanceof EntityMinecart) { -@@ -367,6 +386,7 @@ +@@ -363,6 +382,7 @@ } this.handleWaterMovement(); @@ -71,7 +71,7 @@ } } -@@ -381,10 +401,21 @@ +@@ -377,10 +397,21 @@ protected void moveDerailedMinecart() { @@ -94,7 +94,7 @@ if (this.onGround) { this.motionX *= 0.5D; -@@ -392,13 +423,13 @@ +@@ -388,13 +419,13 @@ this.motionZ *= 0.5D; } @@ -112,7 +112,7 @@ } } -@@ -418,25 +449,25 @@ +@@ -414,25 +445,25 @@ flag1 = !flag; } @@ -143,7 +143,7 @@ ++this.posY; } -@@ -481,7 +512,7 @@ +@@ -478,7 +509,7 @@ } } @@ -152,29 +152,7 @@ { double d17 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); -@@ -527,20 +558,8 @@ - this.posX = d19 + d1 * d18; - this.posZ = d20 + d2 * d18; - this.setPosition(this.posX, this.posY, this.posZ); -- double d22 = this.motionX; -- double d23 = this.motionZ; -+ this.moveMinecartOnRail(p_180460_1_); - -- if (this.riddenByEntity != null) -- { -- d22 *= 0.75D; -- d23 *= 0.75D; -- } -- -- double d13 = this.getMaximumSpeed(); -- d22 = MathHelper.clamp_double(d22, -d13, d13); -- d23 = MathHelper.clamp_double(d23, -d13, d13); -- this.moveEntity(d22, 0.0D, d23); -- - if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - p_180460_1_.getX() == aint[0][0] && MathHelper.floor_double(this.posZ) - p_180460_1_.getZ() == aint[0][2]) - { - this.setPosition(this.posX, this.posY + (double)aint[0][1], this.posZ); -@@ -577,8 +596,14 @@ +@@ -574,8 +605,14 @@ this.motionZ = d5 * (double)(i - p_180460_1_.getZ()); } @@ -190,265 +168,3 @@ double d15 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); if (d15 > 0.01D) -@@ -817,13 +842,20 @@ - - public void applyEntityCollision(Entity entityIn) - { -+ -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, entityIn)); -+ if (getCollisionHandler() != null) -+ { -+ getCollisionHandler().onEntityCollision(this, entityIn); -+ return; -+ } - if (!this.worldObj.isRemote) - { - if (!entityIn.noClip && !this.noClip) - { - if (entityIn != this.riddenByEntity) - { -- if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) -+ if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) - { - entityIn.mountEntity(this); - } -@@ -869,7 +901,7 @@ - double d7 = entityIn.motionX + this.motionX; - double d8 = entityIn.motionZ + this.motionZ; - -- if (((EntityMinecart)entityIn).getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE) -+ if (((EntityMinecart)entityIn).isPoweredCart() && !isPoweredCart()) - { - this.motionX *= 0.20000000298023224D; - this.motionZ *= 0.20000000298023224D; -@@ -877,7 +909,7 @@ - entityIn.motionX *= 0.949999988079071D; - entityIn.motionZ *= 0.949999988079071D; - } -- else if (((EntityMinecart)entityIn).getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE) -+ else if (((EntityMinecart)entityIn).isPoweredCart() && isPoweredCart()) - { - entityIn.motionX *= 0.20000000298023224D; - entityIn.motionZ *= 0.20000000298023224D; -@@ -1042,6 +1074,221 @@ - } - } - -+ /* =================================== FORGE START ===========================================*/ -+ private BlockPos getCurrentRailPosition() -+ { -+ int x = MathHelper.floor_double(this.posX); -+ int y = MathHelper.floor_double(this.posY); -+ int z = MathHelper.floor_double(this.posZ); -+ -+ if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(x, y - 1, z))) y--; -+ return new BlockPos(x, y, z); -+ } -+ -+ protected double getMaxSpeed() -+ { -+ if (!canUseRail()) return getMaximumSpeed(); -+ BlockPos pos = this.getCurrentRailPosition(); -+ IBlockState state = this.worldObj.getBlockState(pos); -+ if (!BlockRailBase.isRailBlock(state)) return getMaximumSpeed(); -+ -+ float railMaxSpeed = ((BlockRailBase)state.getBlock()).getRailMaxSpeed(worldObj, this, pos); -+ return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); -+ } -+ -+ /** -+ * Moved to allow overrides. -+ * This code handles minecart movement and speed capping when on a rail. -+ */ -+ public void moveMinecartOnRail(BlockPos pos) -+ { -+ double mX = this.motionX; -+ double mZ = this.motionZ; -+ -+ if (this.riddenByEntity != null) -+ { -+ mX *= 0.75D; -+ mZ *= 0.75D; -+ } -+ -+ double max = this.getMaxSpeed(); -+ mX = MathHelper.clamp_double(mX, -max, max); -+ mZ = MathHelper.clamp_double(mZ, -max, max); -+ this.moveEntity(mX, 0.0D, mZ); -+ } -+ -+ /** -+ * Gets the current global Minecart Collision handler if none -+ * is registered, returns null -+ * @return The collision handler or null -+ */ -+ public static net.minecraftforge.common.IMinecartCollisionHandler getCollisionHandler() -+ { -+ return collisionHandler; -+ } -+ -+ /** -+ * Sets the global Minecart Collision handler, overwrites any -+ * that is currently set. -+ * @param handler The new handler -+ */ -+ public static void setCollisionHandler(net.minecraftforge.common.IMinecartCollisionHandler handler) -+ { -+ collisionHandler = handler; -+ } -+ -+ /** -+ * This function returns an ItemStack that represents this cart. -+ * This should be an ItemStack that can be used by the player to place the cart, -+ * but is not necessary the item the cart drops when destroyed. -+ * @return An ItemStack that can be used to place the cart. -+ */ -+ public ItemStack getCartItem() -+ { -+ if (this instanceof EntityMinecartFurnace) -+ { -+ return new ItemStack(Items.furnace_minecart); -+ } -+ else if (this instanceof EntityMinecartChest) -+ { -+ return new ItemStack(Items.chest_minecart); -+ } -+ else if (this instanceof EntityMinecartTNT) -+ { -+ return new ItemStack(Items.tnt_minecart); -+ } -+ else if (this instanceof EntityMinecartHopper) -+ { -+ return new ItemStack(Items.hopper_minecart); -+ } -+ else if (this instanceof EntityMinecartCommandBlock) -+ { -+ return new ItemStack(Items.command_block_minecart); -+ } -+ return new ItemStack(Items.minecart); -+ } -+ -+ /** -+ * Returns true if this cart can currently use rails. -+ * This function is mainly used to gracefully detach a minecart from a rail. -+ * @return True if the minecart can use rails. -+ */ -+ public boolean canUseRail() -+ { -+ return canUseRail; -+ } -+ -+ /** -+ * Set whether the minecart can use rails. -+ * This function is mainly used to gracefully detach a minecart from a rail. -+ * @param use Whether the minecart can currently use rails. -+ */ -+ public void setCanUseRail(boolean use) -+ { -+ canUseRail = use; -+ } -+ -+ /** -+ * Return false if this cart should not call onMinecartPass() and should ignore Powered Rails. -+ * @return True if this cart should call onMinecartPass(). -+ */ -+ public boolean shouldDoRailFunctions() -+ { -+ return true; -+ } -+ -+ /** -+ * Returns true if this cart is self propelled. -+ * @return True if powered. -+ */ -+ public boolean isPoweredCart() -+ { -+ return getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE; -+ } -+ -+ /** -+ * Returns true if this cart can be ridden by an Entity. -+ * @return True if this cart can be ridden. -+ */ -+ public boolean canBeRidden() -+ { -+ return this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE; -+ } -+ -+ /** -+ * Getters/setters for physics variables -+ */ -+ -+ /** -+ * Returns the carts max speed when traveling on rails. Carts going faster -+ * than 1.1 cause issues with chunk loading. Carts cant traverse slopes or -+ * corners at greater than 0.5 - 0.6. This value is compared with the rails -+ * max speed and the carts current speed cap to determine the carts current -+ * max speed. A normal rail's max speed is 0.4. -+ * -+ * @return Carts max speed. -+ */ -+ public float getMaxCartSpeedOnRail() -+ { -+ return 1.2f; -+ } -+ -+ /** -+ * Returns the current speed cap for the cart when traveling on rails. This -+ * functions differs from getMaxCartSpeedOnRail() in that it controls -+ * current movement and cannot be overridden. The value however can never be -+ * higher than getMaxCartSpeedOnRail(). -+ * -+ * @return -+ */ -+ public final float getCurrentCartSpeedCapOnRail() -+ { -+ return currentSpeedRail; -+ } -+ -+ public final void setCurrentCartSpeedCapOnRail(float value) -+ { -+ value = Math.min(value, getMaxCartSpeedOnRail()); -+ currentSpeedRail = value; -+ } -+ -+ public float getMaxSpeedAirLateral() -+ { -+ return maxSpeedAirLateral; -+ } -+ -+ public void setMaxSpeedAirLateral(float value) -+ { -+ maxSpeedAirLateral = value; -+ } -+ -+ public float getMaxSpeedAirVertical() -+ { -+ return maxSpeedAirVertical; -+ } -+ -+ public void setMaxSpeedAirVertical(float value) -+ { -+ maxSpeedAirVertical = value; -+ } -+ -+ public double getDragAir() -+ { -+ return dragAir; -+ } -+ -+ public void setDragAir(double value) -+ { -+ dragAir = value; -+ } -+ -+ public double getSlopeAdjustment() -+ { -+ return 0.0078125D; -+ } -+ -+ /* =================================== FORGE END ===========================================*/ -+ - public static enum EnumMinecartType - { - RIDEABLE(0, "MinecartRideable"), diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch index 9ac57f9f40..5b38ca3984 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch @@ -1,18 +1,17 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java -@@ -180,6 +180,7 @@ +@@ -200,6 +200,7 @@ - public boolean interactFirst(EntityPlayer playerIn) + public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) { + if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; if (!this.worldObj.isRemote) { - playerIn.displayGUIChest(this); -@@ -232,4 +233,22 @@ - this.minecartContainerItems[i] = null; + p_184230_1_.displayGUIChest(this); +@@ -279,6 +280,24 @@ } } -+ + + public net.minecraftforge.items.IItemHandler itemHandler = new net.minecraftforge.items.wrapper.InvWrapper(this); + + @Override @@ -30,4 +29,7 @@ + { + return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); + } - } ++ + public void clear() + { + this.func_184288_f((EntityPlayer)null); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch deleted file mode 100644 index e262844ee4..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java -@@ -18,6 +18,7 @@ - - public boolean interactFirst(EntityPlayer playerIn) - { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; - if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn) - { - return true; diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch deleted file mode 100644 index 6c351329fe..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java -@@ -131,6 +131,7 @@ - - public boolean interactFirst(EntityPlayer playerIn) - { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; - ItemStack itemstack = playerIn.inventory.getCurrentItem(); - - if (itemstack != null && itemstack.getItem() == Items.coal) diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch index 79d7a4a279..12c782abdb 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java -@@ -54,6 +54,7 @@ +@@ -56,6 +56,7 @@ - public boolean interactFirst(EntityPlayer playerIn) + public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) { + if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; if (!this.worldObj.isRemote) { - playerIn.displayGUIChest(this); + p_184230_1_.displayGUIChest(this); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch index 1a1ae19dc3..733ef29822 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityXPOrb.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityXPOrb.java -@@ -199,6 +199,7 @@ +@@ -204,6 +204,7 @@ { if (this.delayBeforeCanPickup == 0 && entityIn.xpCooldown == 0) { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerPickupXpEvent(entityIn, this))) return; entityIn.xpCooldown = 2; - this.worldObj.playSoundAtEntity(entityIn, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F)); + this.worldObj.func_184148_a((EntityPlayer)null, entityIn.posX, entityIn.posY, entityIn.posZ, SoundEvents.field_187607_bg, SoundCategory.PLAYERS, 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F)); entityIn.onItemPickup(this, 1); diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch index e401e46a65..acbdcde24b 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch @@ -1,24 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java -@@ -198,12 +198,14 @@ - - protected boolean teleportTo(double x, double y, double z) - { -+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, x, y, z, 0); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; - double d0 = this.posX; - double d1 = this.posY; - double d2 = this.posZ; -- this.posX = x; -- this.posY = y; -- this.posZ = z; -+ this.posX = event.targetX; -+ this.posY = event.targetY; -+ this.posZ = event.targetZ; - boolean flag = false; - BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ); - -@@ -364,6 +366,18 @@ +@@ -342,6 +342,18 @@ } } @@ -36,4 +18,4 @@ + public boolean isScreaming() { - return this.dataWatcher.getWatchableObjectByte(18) > 0; + return ((Boolean)this.dataWatcher.func_187225_a(field_184719_bw)).booleanValue(); diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch index 722b948e03..a8959be684 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java -@@ -103,6 +103,7 @@ +@@ -86,6 +86,7 @@ { this.motionY = (double)(0.42F + (float)this.getSlimeSize() * 0.1F); this.isAirBorne = true; diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch index d7c70c78c3..07ef5a4644 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java -@@ -111,7 +111,7 @@ +@@ -125,7 +125,7 @@ if (this.onGround && !this.wasOnGround) { int i = this.getSlimeSize(); @@ -8,8 +8,8 @@ + if (spawnCustomParticles()) { i = 0; } // don't spawn particles if it's handled by the implementation itself for (int j = 0; j < i * 8; ++j) { - float f = this.rand.nextFloat() * (float)Math.PI * 2.0F; -@@ -271,7 +271,7 @@ + float f = this.rand.nextFloat() * ((float)Math.PI * 2F); +@@ -291,7 +291,7 @@ BlockPos blockpos = new BlockPos(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ)); Chunk chunk = this.worldObj.getChunkFromBlockCoords(blockpos); @@ -18,8 +18,8 @@ { return false; } -@@ -336,6 +336,14 @@ - return super.onInitialSpawn(difficulty, livingdata); +@@ -356,6 +356,14 @@ + return this.func_189101_db() ? SoundEvents.field_189110_fE : SoundEvents.field_187882_fq; } + /* ======================================== FORGE START =====================================*/ diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch index cafe8f8f1b..f62c7284ab 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch @@ -1,47 +1,7 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java -@@ -87,7 +87,7 @@ - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); -- this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * 0.10000000149011612D); -+ this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance); - } - - protected void entityInit() -@@ -229,12 +229,25 @@ - entitylivingbase = (EntityLivingBase)source.getEntity(); - } - -- if (entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) -+ int i = MathHelper.floor_double(this.posX); -+ int j = MathHelper.floor_double(this.posY); -+ int k = MathHelper.floor_double(this.posZ); -+ -+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(reinforcementChance).getAttributeValue()); -+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true; -+ -+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || -+ entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) - { -- int i = MathHelper.floor_double(this.posX); -- int j = MathHelper.floor_double(this.posY); -- int k = MathHelper.floor_double(this.posZ); -- EntityZombie entityzombie = new EntityZombie(this.worldObj); -+ EntityZombie entityzombie; -+ if (summonAid.customSummonedAid != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) -+ { -+ entityzombie = summonAid.customSummonedAid; -+ } -+ else -+ { -+ entityzombie = new EntityZombie(this.worldObj); -+ } - - for (int l = 0; l < 50; ++l) - { -@@ -249,7 +262,7 @@ - if (!this.worldObj.isAnyPlayerWithinRangeAt((double)i1, (double)j1, (double)k1, 7.0D) && this.worldObj.checkNoEntityCollision(entityzombie.getEntityBoundingBox(), entityzombie) && this.worldObj.getCollidingBoundingBoxes(entityzombie, entityzombie.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.getEntityBoundingBox())) +@@ -279,7 +279,7 @@ + if (!this.worldObj.isAnyPlayerWithinRangeAt((double)i1, (double)j1, (double)k1, 7.0D) && this.worldObj.checkNoEntityCollision(entityzombie.getEntityBoundingBox(), entityzombie) && this.worldObj.func_184144_a(entityzombie, entityzombie.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.getEntityBoundingBox())) { this.worldObj.spawnEntityInWorld(entityzombie); - entityzombie.setAttackTarget(entitylivingbase); @@ -49,7 +9,7 @@ entityzombie.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null); this.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); entityzombie.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); -@@ -465,7 +478,7 @@ +@@ -483,7 +483,7 @@ if (livingdata == null) { diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch index 172f84a75b..23074bd5b6 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityHorse.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityHorse.java -@@ -1247,6 +1247,7 @@ +@@ -1200,6 +1200,7 @@ } this.jumpPower = 0.0F; diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch index fe79857772..10eafe85ac 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch @@ -1,36 +1,18 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityMooshroom.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityMooshroom.java -@@ -9,7 +9,7 @@ - import net.minecraft.util.EnumParticleTypes; +@@ -13,7 +13,7 @@ import net.minecraft.world.World; + import net.minecraft.world.storage.loot.LootTableList; -public class EntityMooshroom extends EntityCow +public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable { public EntityMooshroom(World worldIn) { -@@ -18,6 +18,7 @@ - this.spawnableBlock = Blocks.mycelium; - } - -+ @SuppressWarnings("unused") - public boolean interact(EntityPlayer player) - { - ItemStack itemstack = player.inventory.getCurrentItem(); -@@ -37,7 +38,7 @@ - } - } - -- if (itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) -+ if (false && itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) //Forge Disable, Moved to onSheared - { - this.setDead(); - this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); -@@ -77,4 +78,33 @@ - { +@@ -78,6 +78,35 @@ return new EntityMooshroom(this.worldObj); } -+ + + @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos){ return getGrowingAge() >= 0; } + @Override + public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos, int fortune) @@ -59,4 +41,7 @@ + this.playSound("mob.sheep.shear", 1.0F, 1.0F); + return ret; + } - } ++ + protected ResourceLocation func_184647_J() + { + return LootTableList.field_186400_H; diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch deleted file mode 100644 index 247ecdbad1..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java -@@ -279,7 +279,7 @@ - - Block block = this.worldObj.getBlockState(blockpos.down()).getBlock(); - -- if (block == Blocks.grass || block.getMaterial() == Material.leaves) -+ if (block == Blocks.grass || block.isLeaves(worldObj, blockpos.down())) - { - return true; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch index 97fe930d79..762f03bcda 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch @@ -1,29 +1,15 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntitySheep.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntitySheep.java -@@ -35,7 +35,7 @@ +@@ -42,7 +42,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class EntitySheep extends EntityAnimal +public class EntitySheep extends EntityAnimal implements net.minecraftforge.common.IShearable { + private static final DataParameter field_184774_bv = EntityDataManager.func_187226_a(EntitySheep.class, DataSerializers.field_187191_a); private final InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() - { -@@ -140,11 +140,12 @@ - } - } - -+ @SuppressWarnings("unused") - public boolean interact(EntityPlayer player) - { - ItemStack itemstack = player.inventory.getCurrentItem(); - -- if (itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) -+ if (false && itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) //Forge: Moved to onSheared - { - if (!this.worldObj.isRemote) - { -@@ -327,4 +328,19 @@ +@@ -356,4 +356,19 @@ DYE_TO_RGB.put(EnumDyeColor.RED, new float[] {0.6F, 0.2F, 0.2F}); DYE_TO_RGB.put(EnumDyeColor.BLACK, new float[] {0.1F, 0.1F, 0.1F}); } diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch index e744501189..53207949d7 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -1,23 +1,15 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java -@@ -81,6 +81,7 @@ - private boolean isLookingForHome; - private boolean areAdditionalTasksSet; - private InventoryBasic villagerInventory; -+ @Deprecated //Use VillagerRegistry - private static final EntityVillager.ITradeList[][][][] DEFAULT_TRADE_LIST_MAP = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.wheat, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.potato, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.carrot, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.bread, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.pumpkin_pie, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.apple, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.cookie, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.cake, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.fish, new EntityVillager.PriceInfo(6, 6), Items.cooked_fish, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.fishing_rod, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.shears, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 0), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.arrow, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.bow, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new EntityVillager.PriceInfo(10, 10), Items.flint, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.paper, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.book, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.compass, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.written_book, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.clock, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.name_tag, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.rotten_flesh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.gold_ingot, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.redstone, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.ender_eye, new EntityVillager.PriceInfo(7, 11)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.experience_bottle, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_helmet, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.iron_chestplate, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_chestplate, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.chainmail_boots, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_leggings, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.chainmail_helmet, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_chestplate, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_axe, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_sword, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_sword, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_axe, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_shovel, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_pickaxe, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.porkchop, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.chicken, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.cooked_porkchop, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.cooked_chicken, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.leather, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.leather_leggings, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.leather_chestplate, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.saddle, new EntityVillager.PriceInfo(8, 10))}}}}; - - public EntityVillager(World worldIn) -@@ -210,7 +211,7 @@ - ItemStack itemstack = player.inventory.getCurrentItem(); - boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg; +@@ -221,7 +221,7 @@ + { + boolean flag = p_184645_3_ != null && p_184645_3_.getItem() == Items.spawn_egg; - if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild()) + if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking()) { - if (!this.worldObj.isRemote && (this.buyingList == null || this.buyingList.size() > 0)) + if (!this.worldObj.isRemote && (this.buyingList == null || !this.buyingList.isEmpty())) { -@@ -522,6 +523,7 @@ +@@ -533,6 +533,7 @@ private void populateBuyingList() { @@ -25,15 +17,15 @@ EntityVillager.ITradeList[][][] aentityvillager$itradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()]; if (this.careerId != 0 && this.careerLevel != 0) -@@ -635,6 +637,7 @@ +@@ -647,6 +648,7 @@ } } + //TODO: Hook into VillagerRegistry to get name if (s1 != null) { - ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("entity.Villager." + s1, new Object[0]); -@@ -697,7 +700,7 @@ + TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("entity.Villager." + s1, new Object[0]); +@@ -708,7 +710,7 @@ public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) { livingdata = super.onInitialSpawn(difficulty, livingdata); diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index 66f4725bfb..913f63e486 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -1,28 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java +++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java -@@ -80,6 +80,11 @@ - @SuppressWarnings("incomplete-switch") - public abstract class EntityPlayer extends EntityLivingBase - { -+ public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; -+ private java.util.HashMap spawnChunkMap = new java.util.HashMap(); -+ private java.util.HashMap spawnForcedMap = new java.util.HashMap(); -+ public float eyeHeight = this.getDefaultEyeHeight(); -+ - public InventoryPlayer inventory = new InventoryPlayer(this); - private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); - public Container inventoryContainer; -@@ -175,7 +180,8 @@ - { - if (this.itemInUse != null) - { -- this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); -+ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, itemInUse, this.itemInUseCount)) -+ this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); - } - - this.clearItemInUse(); -@@ -199,6 +205,7 @@ +@@ -174,6 +174,7 @@ public void onUpdate() { @@ -30,30 +8,15 @@ this.noClip = this.isSpectator(); if (this.isSpectator()) -@@ -212,6 +219,14 @@ - - if (itemstack == this.itemInUse) - { -+ itemInUseCount = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, itemInUse, itemInUseCount); -+ if (itemInUseCount <= 0) -+ { -+ this.onItemUseFinish(); -+ } -+ else -+ { // Forge Keep unindented to lower patch -+ itemInUse.getItem().onUsingTick(itemInUse, this, itemInUseCount); //Forge Added - if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) +@@ -205,6 +206,7 @@ { - this.updateItemUse(itemstack, 5); -@@ -221,6 +236,7 @@ - { - this.onItemUseFinish(); + this.wakeUpPlayer(false, true, true); } + } } - else - { -@@ -266,7 +282,7 @@ + } + else if (this.sleepTimer > 0) +@@ -219,7 +221,7 @@ super.onUpdate(); @@ -62,43 +25,15 @@ { this.closeScreen(); this.openContainer = this.inventoryContainer; -@@ -343,6 +359,7 @@ - { - this.setPosition(d3, this.posY, d4); +@@ -360,6 +362,7 @@ + this.setSize(f, f1); + } } + net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPostTick(this); } public int getMaxInPortalTime() -@@ -412,11 +429,12 @@ - int i = this.itemInUse.stackSize; - ItemStack itemstack = this.itemInUse.onItemUseFinish(this.worldObj, this); - -+ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, itemInUse, itemInUseCount, itemstack); - if (itemstack != this.itemInUse || itemstack != null && itemstack.stackSize != i) - { - this.inventory.mainInventory[this.inventory.currentItem] = itemstack; - -- if (itemstack.stackSize == 0) -+ if (itemstack != null && itemstack.stackSize == 0) - { - this.inventory.mainInventory[this.inventory.currentItem] = null; - } -@@ -476,11 +494,11 @@ - this.cameraYaw = 0.0F; - this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); - -- if (this.ridingEntity instanceof EntityPig) -+ if (this.ridingEntity instanceof EntityLivingBase && ((EntityLivingBase)ridingEntity).shouldRiderFaceForward(this)) - { - this.rotationPitch = f1; - this.rotationYaw = f; -- this.renderYawOffset = ((EntityPig)this.ridingEntity).renderYawOffset; -+ this.renderYawOffset = ((EntityLivingBase)this.ridingEntity).renderYawOffset; - } - } - } -@@ -610,11 +628,15 @@ +@@ -576,11 +579,15 @@ public void onDeath(DamageSource cause) { @@ -114,7 +49,7 @@ if (this.getName().equals("Notch")) { this.dropItem(new ItemStack(Items.apple, 1), true, false); -@@ -625,6 +647,9 @@ +@@ -591,6 +598,9 @@ this.inventory.dropAllItems(); } @@ -123,8 +58,8 @@ + if (cause != null) { - this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F); -@@ -707,12 +732,25 @@ + this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * 0.017453292F) * 0.1F); +@@ -678,12 +688,25 @@ public EntityItem dropOneItem(boolean dropAll) { @@ -152,50 +87,7 @@ } public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem) -@@ -770,13 +808,25 @@ - - public void joinEntityItemWithWorld(EntityItem itemIn) - { -+ if (captureDrops) -+ { -+ capturedDrops.add(itemIn); -+ return; -+ } -+ - this.worldObj.spawnEntityInWorld(itemIn); - } - -+ @Deprecated //Use location sensitive version below - public float getToolDigEfficiency(Block p_180471_1_) - { -- float f = this.inventory.getStrVsBlock(p_180471_1_); -+ return getBreakSpeed(p_180471_1_.getDefaultState(), new BlockPos(0, -1, 0)); -+ } - -+ public float getBreakSpeed(IBlockState state, BlockPos pos) -+ { -+ ItemStack stack = inventory.getCurrentItem(); -+ float f = (stack == null ? 1.0F : stack.getItem().getDigSpeed(stack, state)); - if (f > 1.0F) - { - int i = EnchantmentHelper.getEfficiencyModifier(this); -@@ -826,12 +876,13 @@ - f /= 5.0F; - } - -- return f; -+ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos); -+ return (f < 0 ? 0 : f); - } - - public boolean canHarvestBlock(Block blockToHarvest) - { -- return this.inventory.canHeldItemHarvest(blockToHarvest); -+ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, blockToHarvest, this.inventory.canHeldItemHarvest(blockToHarvest)); - } - - public void readEntityFromNBT(NBTTagCompound tagCompund) -@@ -867,6 +918,16 @@ +@@ -845,6 +868,16 @@ this.spawnForced = tagCompund.getBoolean("SpawnForced"); } @@ -212,7 +104,7 @@ this.foodStats.readNBT(tagCompund); this.capabilities.readCapabilitiesFromNBT(tagCompund); -@@ -898,6 +959,23 @@ +@@ -877,6 +910,23 @@ tagCompound.setBoolean("SpawnForced", this.spawnForced); } @@ -236,7 +128,7 @@ this.foodStats.writeNBT(tagCompound); this.capabilities.writeCapabilitiesToNBT(tagCompound); tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT()); -@@ -911,6 +989,7 @@ +@@ -884,6 +934,7 @@ public boolean attackEntityFrom(DamageSource source, float amount) { @@ -244,42 +136,7 @@ if (this.isEntityInvulnerable(source)) { return false; -@@ -1007,12 +1086,15 @@ - { - if (!this.isEntityInvulnerable(damageSrc)) - { -+ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); -+ if (damageAmount <= 0) return; - if (!damageSrc.isUnblockable() && this.isBlocking() && damageAmount > 0.0F) - { - damageAmount = (1.0F + damageAmount) * 0.5F; - } - -- damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); -+ damageAmount = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, inventory.armorInventory, damageSrc, damageAmount); -+ if (damageAmount <= 0) return; - damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); - float f = damageAmount; - damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); -@@ -1074,6 +1156,7 @@ - } - else - { -+ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, targetEntity)) return false; - ItemStack itemstack = this.getCurrentEquippedItem(); - ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null; - -@@ -1125,7 +1208,9 @@ - - public void destroyCurrentEquippedItem() - { -+ ItemStack orig = getCurrentEquippedItem(); - this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, orig); - } - - public double getYOffset() -@@ -1135,6 +1220,7 @@ +@@ -1123,6 +1174,7 @@ public void attackTargetEntityWithCurrentItem(Entity targetEntity) { @@ -287,7 +144,7 @@ if (targetEntity.canAttackWithItem()) { if (!targetEntity.hitByEntity(this)) -@@ -1311,6 +1397,8 @@ +@@ -1410,6 +1462,8 @@ public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation) { @@ -296,19 +153,7 @@ if (!this.worldObj.isRemote) { if (this.isPlayerSleeping() || !this.isEntityAlive()) -@@ -1350,9 +1438,9 @@ - - this.setSize(0.2F, 0.2F); - -- if (this.worldObj.isBlockLoaded(bedLocation)) -+ if (this.worldObj.isBlockLoaded(bedLocation) && worldObj.getBlockState(bedLocation).getBlock().isBed(worldObj, bedLocation, this)) - { -- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(bedLocation).getValue(BlockDirectional.FACING); -+ EnumFacing enumfacing = this.worldObj.getBlockState(bedLocation).getBlock().getBedDirection(worldObj, bedLocation); - float f = 0.5F; - float f1 = 0.5F; - -@@ -1415,13 +1503,14 @@ +@@ -1514,13 +1568,14 @@ public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn) { @@ -326,7 +171,7 @@ if (blockpos == null) { -@@ -1430,6 +1519,10 @@ +@@ -1529,6 +1584,10 @@ this.setPosition((double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.1F), (double)((float)blockpos.getZ() + 0.5F)); } @@ -337,7 +182,7 @@ this.sleeping = false; -@@ -1448,14 +1541,14 @@ +@@ -1547,14 +1606,14 @@ private boolean isInBed() { @@ -354,27 +199,7 @@ { if (!forceSpawn) { -@@ -1470,16 +1563,16 @@ - } - else - { -- return BlockBed.getSafeExitLocation(worldIn, bedLocation, 0); -+ return worldIn.getBlockState(bedLocation).getBlock().getBedSpawnPosition(worldIn, bedLocation, null); - } - } - - @SideOnly(Side.CLIENT) - public float getBedOrientationInDegrees() - { -- if (this.playerLocation != null) -+ if (this.playerLocation != null && worldObj.getBlockState(playerLocation).getBlock().isBed(worldObj, playerLocation, this)) - { -- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockDirectional.FACING); -+ EnumFacing enumfacing = this.worldObj.getBlockState(this.playerLocation).getBlock().getBedDirection(worldObj, playerLocation); - - switch (enumfacing) - { -@@ -1519,16 +1612,24 @@ +@@ -1618,16 +1677,24 @@ public BlockPos getBedLocation() { @@ -401,7 +226,7 @@ if (pos != null) { this.spawnChunk = pos; -@@ -1712,6 +1813,10 @@ +@@ -1822,6 +1889,10 @@ super.fall(distance, damageMultiplier); } @@ -412,24 +237,7 @@ } protected void resetHeight() -@@ -1735,6 +1840,7 @@ - } - - EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entityLivingIn))); -+ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entityLivingIn)); - - if (entitylist$entityegginfo != null) - { -@@ -1847,6 +1953,8 @@ - { - if (stack != this.itemInUse) - { -+ duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, stack, duration); -+ if (duration <= 0) return; - this.itemInUse = stack; - this.itemInUseCount = duration; - -@@ -1918,6 +2026,10 @@ +@@ -2009,6 +2080,10 @@ this.field_181016_an = oldPlayer.field_181016_an; this.field_181017_ao = oldPlayer.field_181017_ao; this.field_181018_ap = oldPlayer.field_181018_ap; @@ -438,56 +246,9 @@ + for (net.minecraftforge.common.IExtendedEntityProperties p : this.extendedProperties.values()) + p.init(this, this.worldObj); } - else if (this.worldObj.getGameRules().getBoolean("keepInventory")) + else if (this.worldObj.getGameRules().getBoolean("keepInventory") || oldPlayer.isSpectator()) { -@@ -1931,6 +2043,18 @@ - this.xpSeed = oldPlayer.xpSeed; - this.theInventoryEnderChest = oldPlayer.theInventoryEnderChest; - this.getDataWatcher().updateObject(10, Byte.valueOf(oldPlayer.getDataWatcher().getWatchableObjectByte(10))); -+ -+ this.spawnChunkMap = oldPlayer.spawnChunkMap; -+ this.spawnForcedMap = oldPlayer.spawnForcedMap; -+ -+ //Copy over a section of the Entity Data from the old player. -+ //Allows mods to specify data that persists after players respawn. -+ NBTTagCompound old = oldPlayer.getEntityData(); -+ if (old.hasKey(PERSISTED_NBT_TAG)) -+ { -+ getEntityData().setTag(PERSISTED_NBT_TAG, old.getCompoundTag(PERSISTED_NBT_TAG)); -+ } -+ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, oldPlayer, !respawnFromEnd); - } - - protected boolean canTriggerWalking() -@@ -1968,7 +2092,14 @@ - - public void setCurrentItemOrArmor(int slotIn, ItemStack stack) - { -- this.inventory.armorInventory[slotIn] = stack; -+ if (slotIn == 0) //Forge: Fix issue in Player where it doen't take into account selected item -+ { -+ this.inventory.mainInventory[this.inventory.currentItem] = stack; -+ } -+ else -+ { -+ this.inventory.armorInventory[slotIn - 1] = stack; -+ } - } - - @SideOnly(Side.CLIENT) -@@ -2013,7 +2144,10 @@ - - public IChatComponent getDisplayName() - { -- IChatComponent ichatcomponent = new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName())); -+ IChatComponent ichatcomponent = new ChatComponentText(""); -+ if (!prefixes.isEmpty()) for (net.minecraft.util.IChatComponent prefix : prefixes) ichatcomponent.appendSibling(prefix); -+ ichatcomponent.appendSibling(new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getDisplayNameString()))); -+ if (!suffixes.isEmpty()) for (net.minecraft.util.IChatComponent suffix : suffixes) ichatcomponent.appendSibling(suffix); - ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); - ichatcomponent.getChatStyle().setChatHoverEvent(this.getHoverEvent()); - ichatcomponent.getChatStyle().setInsertion(this.getName()); -@@ -2022,7 +2156,7 @@ +@@ -2129,7 +2204,7 @@ public float getEyeHeight() { @@ -496,8 +257,8 @@ if (this.isPlayerSleeping()) { -@@ -2155,6 +2289,136 @@ - this.hasReducedDebug = reducedDebug; +@@ -2340,6 +2415,136 @@ + return (float)this.getEntityAttribute(SharedMonsterAttributes.field_188792_h).getAttributeValue(); } + /** diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch index 0adab5b6c7..e5c9a28a24 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -1,24 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java +++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -@@ -123,14 +123,15 @@ - public int ping; - public boolean playerConqueredTheEnd; - -+ @SuppressWarnings("unused") - public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager) - { - super(worldIn, profile); - interactionManager.thisPlayerMP = this; - this.theItemInWorldManager = interactionManager; -- BlockPos blockpos = worldIn.getSpawnPoint(); -+ BlockPos blockpos = worldIn.provider.getRandomizedSpawnPoint(); - -- if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) -+ if (false && !worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) - { - int i = Math.max(5, server.getSpawnProtectionSize() - 6); - int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ())); -@@ -223,7 +224,7 @@ +@@ -250,7 +250,7 @@ this.openContainer.detectAndSendChanges(); @@ -27,25 +9,9 @@ { this.closeScreen(); this.openContainer = this.inventoryContainer; -@@ -294,6 +295,7 @@ - for (Chunk chunk1 : list) - { - this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk1); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(chunk1.getChunkCoordIntPair(), this)); - } - } - } -@@ -424,6 +426,7 @@ +@@ -459,7 +459,20 @@ - public void onDeath(DamageSource cause) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; - if (this.worldObj.getGameRules().getBoolean("showDeathMessages")) - { - Team team = this.getTeam(); -@@ -447,7 +450,20 @@ - - if (!this.worldObj.getGameRules().getBoolean("keepInventory")) + if (!this.worldObj.getGameRules().getBoolean("keepInventory") && !this.isSpectator()) { + captureDrops = true; + capturedDrops.clear(); @@ -63,24 +29,8 @@ + } } - for (ScoreObjective scoreobjective : this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.deathCount)) -@@ -461,6 +477,7 @@ - if (entitylivingbase != null) - { - EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entitylivingbase))); -+ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entitylivingbase)); - - if (entitylist$entityegginfo != null) - { -@@ -528,6 +545,7 @@ - - public void travelToDimension(int dimensionId) - { -+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, dimensionId)) return; - if (this.dimension == 1 && dimensionId == 1) - { - this.triggerAchievement(AchievementList.theEnd2); -@@ -831,6 +849,7 @@ + for (ScoreObjective scoreobjective : this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreCriteria.deathCount)) +@@ -921,6 +934,7 @@ { if (stat != null) { diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch index 7639ca0cc9..26b44efcd6 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch @@ -1,22 +1,7 @@ --- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java +++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java -@@ -272,12 +272,8 @@ - { - if (this.mainInventory[j] == null) - { -- this.mainInventory[j] = new ItemStack(item, 0, itemStackIn.getMetadata()); -- -- if (itemStackIn.hasTagCompound()) -- { -- this.mainInventory[j].setTagCompound((NBTTagCompound)itemStackIn.getTagCompound().copy()); -- } -+ this.mainInventory[j] = itemStackIn.copy(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up. -+ this.mainInventory[j].stackSize = 0; - } - - int k = i; -@@ -315,6 +311,14 @@ - this.mainInventory[i].updateAnimation(this.player.worldObj, this.player, i, this.currentItem == i); +@@ -304,6 +304,14 @@ + return i; } } + @@ -29,4 +14,4 @@ + } } - public boolean consumeInventoryItem(Item itemIn) + private int storeItemStack(ItemStack itemStackIn) diff --git a/patches.mcp/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch b/patches.mcp/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch deleted file mode 100644 index fa1e0f4b7c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/projectile/EntityFishHook.java -+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityFishHook.java -@@ -567,11 +567,19 @@ - } - } - -+ @SuppressWarnings("unused") - private ItemStack getFishingResult() - { - float f = this.worldObj.rand.nextFloat(); - int i = EnchantmentHelper.getLuckOfSeaModifier(this.angler); - int j = EnchantmentHelper.getLureModifier(this.angler); -+ -+ if (true) -+ { -+ this.angler.addStat(net.minecraftforge.common.FishingHooks.getFishableCategory(f, i, j).stat, 1); -+ return net.minecraftforge.common.FishingHooks.getRandomFishable(this.rand, f, i, j); -+ } -+ - float f1 = 0.1F - (float)i * 0.025F - (float)j * 0.01F; - float f2 = 0.05F + (float)i * 0.01F - (float)j * 0.01F; - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); diff --git a/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch b/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch index c1ce77797c..7033d745ae 100644 --- a/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch +++ b/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/init/Bootstrap.java +++ ../src-work/minecraft/net/minecraft/init/Bootstrap.java -@@ -65,6 +65,7 @@ +@@ -74,6 +74,7 @@ return alreadyRegistered; } @@ -8,12 +8,3 @@ static void registerDispenserBehaviors() { BlockDispenser.dispenseBehaviorRegistry.putObject(Items.arrow, new BehaviorProjectileDispense() -@@ -135,7 +136,7 @@ - double d0 = source.getX() + (double)enumfacing.getFrontOffsetX(); - double d1 = (double)((float)source.getBlockPos().getY() + 0.2F); - double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ(); -- Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), stack.getMetadata(), d0, d1, d2); -+ Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), ItemMonsterPlacer.getEntityName(stack), d0, d1, d2); - - if (entity instanceof EntityLivingBase && stack.hasDisplayName()) - { diff --git a/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch index 84a24da4df..0c7a86b06c 100644 --- a/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch +++ b/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/Container.java +++ ../src-work/minecraft/net/minecraft/inventory/Container.java -@@ -608,7 +608,7 @@ +@@ -646,7 +646,7 @@ Slot slot1 = (Slot)this.inventorySlots.get(i); ItemStack itemstack1 = slot1.getStack(); diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch deleted file mode 100644 index fa6d5d0171..0000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerBrewingStand.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java -@@ -154,7 +154,7 @@ - - public boolean isItemValid(ItemStack stack) - { -- return stack != null ? stack.getItem().isPotionIngredient(stack) : false; -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack); - } - - public int getSlotStackLimit() -@@ -185,7 +185,7 @@ - - public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) - { -- if (stack.getItem() == Items.potionitem && stack.getMetadata() > 0) -+ if (stack.getItem() instanceof net.minecraft.item.ItemPotion && stack.getMetadata() > 0) - { - this.player.triggerAchievement(AchievementList.potion); - } -@@ -195,7 +195,7 @@ - - public static boolean canHoldPotion(ItemStack stack) - { -- return stack != null && (stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle); -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack); - } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch index 292d16a78e..41a1e9c6f1 100644 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch +++ b/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerEnchantment.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerEnchantment.java -@@ -65,9 +65,12 @@ +@@ -68,9 +68,12 @@ }); this.addSlotToContainer(new Slot(this.tableInventory, 1, 35, 47) { @@ -14,7 +14,7 @@ } }); -@@ -146,6 +149,7 @@ +@@ -155,6 +158,7 @@ if (!this.worldPointer.isRemote) { int l = 0; @@ -22,7 +22,7 @@ for (int j = -1; j <= 1; ++j) { -@@ -153,37 +157,14 @@ +@@ -162,37 +166,14 @@ { if ((j != 0 || k != 0) && this.worldPointer.isAirBlock(this.position.add(k, 0, j)) && this.worldPointer.isAirBlock(this.position.add(k, 1, j))) { @@ -66,12 +66,12 @@ } } } -@@ -193,7 +174,7 @@ +@@ -202,7 +183,7 @@ for (int i1 = 0; i1 < 3; ++i1) { - this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, l, itemstack); + this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, (int)power, itemstack); - this.field_178151_h[i1] = -1; + this.field_185001_h[i1] = -1; + this.field_185002_i[i1] = -1; - if (this.enchantLevels[i1] < i1 + 1) diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch deleted file mode 100644 index 2b87f8433e..0000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerPlayer.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerPlayer.java -@@ -43,7 +43,8 @@ - } - public boolean isItemValid(ItemStack stack) - { -- return stack == null ? false : (stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType == k_f : (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull ? false : k_f == 0)); -+ if (stack == null) return false; -+ return stack.getItem().isValidArmor(stack, k_f, thePlayer); - } - @SideOnly(Side.CLIENT) - public String getSlotTexture() diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch index 8ca672062a..3d5e67896d 100644 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch +++ b/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerRepair.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerRepair.java -@@ -70,6 +70,8 @@ +@@ -69,6 +69,8 @@ playerIn.addExperienceLevel(-ContainerRepair.this.maximumCost); } @@ -9,7 +9,7 @@ ContainerRepair.this.inputSlots.setInventorySlotContents(0, (ItemStack)null); if (ContainerRepair.this.materialCost > 0) -@@ -94,7 +96,7 @@ +@@ -93,7 +95,7 @@ ContainerRepair.this.maximumCost = 0; IBlockState iblockstate = worldIn.getBlockState(blockPosIn); @@ -18,25 +18,24 @@ { int l = ((Integer)iblockstate.getValue(BlockAnvil.DAMAGE)).intValue(); ++l; -@@ -172,6 +174,7 @@ +@@ -163,6 +165,7 @@ if (itemstack2 != null) { -+ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, i2)) return; - flag = itemstack2.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(itemstack2).tagCount() > 0; ++ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, j)) return; + boolean flag = itemstack2.getItem() == Items.enchanted_book && !Items.enchanted_book.getEnchantments(itemstack2).hasNoTags(); if (itemstack1.isItemStackDamageable() && itemstack1.getItem().getIsRepairable(itemstack, itemstack2)) -@@ -264,7 +267,8 @@ - { - int i4 = ((Integer)iterator.next()).intValue(); +@@ -235,7 +238,7 @@ -- if (i4 != i5 && !enchantment.canApplyTogether(Enchantment.getEnchantmentById(i4))) -+ Enchantment e2 = Enchantment.getEnchantmentById(i4); -+ if (i4 != i5 && !(enchantment.canApplyTogether(e2) && e2.canApplyTogether(enchantment))) //Forge BugFix: Let Both enchantments veto being together + for (Enchantment enchantment : map.keySet()) + { +- if (enchantment != enchantment1 && !enchantment1.canApplyTogether(enchantment)) ++ if (enchantment != enchantment1 && !(enchantment1.canApplyTogether(enchantment) && enchantment.canApplyTogether(enchantment1))) //Forge BugFix: Let Both enchantments veto being together { flag1 = false; - ++l1; -@@ -315,6 +319,8 @@ + ++i; +@@ -279,6 +282,8 @@ } } diff --git a/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch index 59cf4f6175..e4aff0d46a 100644 --- a/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch +++ b/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/SlotCrafting.java +++ ../src-work/minecraft/net/minecraft/inventory/SlotCrafting.java -@@ -112,8 +112,11 @@ +@@ -107,8 +107,11 @@ public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) { diff --git a/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch index 5de127a2d0..c184789a0b 100644 --- a/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch +++ b/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch @@ -8,4 +8,4 @@ + if (stack.getItem() == Items.iron_ingot) { - this.thePlayer.triggerAchievement(AchievementList.acquireIron); + this.thePlayer.triggerAchievement(AchievementList.field_187987_k); diff --git a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch index 518fc5a37b..39507cbe8b 100644 --- a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch @@ -1,18 +1,7 @@ --- ../src-base/minecraft/net/minecraft/item/Item.java +++ ../src-work/minecraft/net/minecraft/item/Item.java -@@ -48,8 +48,8 @@ - - public class Item - { -- public static final RegistryNamespaced itemRegistry = new RegistryNamespaced(); -- private static final Map BLOCK_TO_ITEM = Maps.newHashMap(); -+ public static final RegistryNamespaced itemRegistry = net.minecraftforge.fml.common.registry.GameData.getItemRegistry(); -+ private static final Map BLOCK_TO_ITEM = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap(); - protected static final UUID itemModifierUUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); - private CreativeTabs tabToDisplayOn; - protected static Random itemRand = new Random(); -@@ -61,6 +61,9 @@ - private String potionEffect; +@@ -104,6 +104,9 @@ + private Item containerItem; private String unlocalizedName; + public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = @@ -21,7 +10,7 @@ public static int getIdFromItem(Item itemIn) { return itemIn == null ? 0 : itemRegistry.getIDForObject(itemIn); -@@ -126,6 +129,7 @@ +@@ -192,6 +195,7 @@ return stack; } @@ -29,7 +18,7 @@ public int getItemStackLimit() { return this.maxStackSize; -@@ -239,6 +243,7 @@ +@@ -312,6 +316,7 @@ return this.containerItem; } @@ -37,7 +26,7 @@ public boolean hasContainerItem() { return this.containerItem != null; -@@ -316,7 +321,7 @@ +@@ -367,7 +372,7 @@ public boolean isItemTool(ItemStack stack) { @@ -45,690 +34,8 @@ + return this.getItemStackLimit(stack) == 1 && this.isDamageable(); } - protected MovingObjectPosition getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids) -@@ -334,6 +339,10 @@ - float f6 = f3 * f4; - float f7 = f2 * f4; - double d3 = 5.0D; -+ if (playerIn instanceof net.minecraft.entity.player.EntityPlayerMP) -+ { -+ d3 = ((net.minecraft.entity.player.EntityPlayerMP)playerIn).theItemInWorldManager.getBlockReachDistance(); -+ } - Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); - return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); - } -@@ -371,11 +380,670 @@ - return false; - } - -+ @Deprecated // Use ItemStack sensitive version below. - public Multimap getItemAttributeModifiers() - { - return HashMultimap.create(); - } - -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * ItemStack sensitive version of getItemAttributeModifiers -+ */ -+ public Multimap getAttributeModifiers(ItemStack stack) -+ { -+ return this.getItemAttributeModifiers(); -+ } -+ -+ /** -+ * Called when a player drops the item into the world, -+ * returning false from this will prevent the item from -+ * being removed from the players inventory and spawning -+ * in the world -+ * -+ * @param player The player that dropped the item -+ * @param item The item stack, before the item is removed. -+ */ -+ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) -+ { -+ return true; -+ } -+ -+ /** -+ * Allow the item one last chance to modify its name used for the -+ * tool highlight useful for adding something extra that can't be removed -+ * by a user in the displayed name, such as a mode of operation. -+ * -+ * @param item the ItemStack for the item. -+ * @param the name that will be displayed unless it is changed in this method. -+ */ -+ public String getHighlightTip( ItemStack item, String displayName ) -+ { -+ return displayName; -+ } -+ -+ /** -+ * This is called when the item is used, before the block is activated. -+ * @param stack The Item Stack -+ * @param player The Player that used the item -+ * @param world The Current World -+ * @param pos Target position -+ * @param side The side of the target hit -+ * @return Return true to prevent any further processing. -+ */ -+ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) -+ { -+ return false; -+ } -+ -+ /** -+ * Metadata-sensitive version of getStrVsBlock -+ * @param itemstack The Item Stack -+ * @param state The block state -+ * @return The damage strength -+ */ -+ public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state) -+ { -+ return getStrVsBlock(itemstack, state.getBlock()); -+ } -+ -+ -+ protected boolean canRepair = true; -+ /** -+ * Called by CraftingManager to determine if an item is reparable. -+ * @return True if reparable -+ */ -+ public boolean isRepairable() -+ { -+ return canRepair && isDamageable(); -+ } -+ -+ /** -+ * Call to disable repair recipes. -+ * @return The current Item instance -+ */ -+ public Item setNoRepair() -+ { -+ canRepair = false; -+ return this; -+ } -+ -+ /** -+ * Called before a block is broken. Return true to prevent default block harvesting. -+ * -+ * Note: In SMP, this is called on both client and server sides! -+ * -+ * @param itemstack The current ItemStack -+ * @param pos Block's position in world -+ * @param player The Player that is wielding the item -+ * @return True to prevent harvesting, false to continue as normal -+ */ -+ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) -+ { -+ return false; -+ } -+ -+ /** -+ * Called each tick while using an item. -+ * @param stack The Item being used -+ * @param player The Player using the item -+ * @param count The amount of time in tick the item has been used for continuously -+ */ -+ public void onUsingTick(ItemStack stack, EntityPlayer player, int count) -+ { -+ } -+ -+ /** -+ * Called when the player Left Clicks (attacks) an entity. -+ * Processed before damage is done, if return value is true further processing is canceled -+ * and the entity is not attacked. -+ * -+ * @param stack The Item being used -+ * @param player The player that is attacking -+ * @param entity The entity being attacked -+ * @return True to cancel the rest of the interaction. -+ */ -+ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) -+ { -+ return false; -+ } -+ -+ /** -+ * Player, Render pass, and item usage sensitive version of getIconIndex. -+ * -+ * @param stack The item stack to get the icon for. -+ * @param player The player holding the item -+ * @param useRemaining The ticks remaining for the active item. -+ * @return Null to use default model, or a custom ModelResourceLocation for the stage of use. -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.resources.model.ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) -+ { -+ return null; -+ } -+ -+ /** -+ * ItemStack sensitive version of getContainerItem. -+ * Returns a full ItemStack instance of the result. -+ * -+ * @param itemStack The current ItemStack -+ * @return The resulting ItemStack -+ */ -+ public ItemStack getContainerItem(ItemStack itemStack) -+ { -+ if (!hasContainerItem(itemStack)) -+ { -+ return null; -+ } -+ return new ItemStack(getContainerItem()); -+ } -+ -+ /** -+ * ItemStack sensitive version of hasContainerItem -+ * @param stack The current item stack -+ * @return True if this item has a 'container' -+ */ -+ public boolean hasContainerItem(ItemStack stack) -+ { -+ return hasContainerItem(); -+ } -+ -+ /** -+ * Retrieves the normal 'lifespan' of this item when it is dropped on the ground as a EntityItem. -+ * This is in ticks, standard result is 6000, or 5 mins. -+ * -+ * @param itemStack The current ItemStack -+ * @param world The world the entity is in -+ * @return The normal lifespan in ticks. -+ */ -+ public int getEntityLifespan(ItemStack itemStack, World world) -+ { -+ return 6000; -+ } -+ -+ /** -+ * Determines if this Item has a special entity for when they are in the world. -+ * Is called when a EntityItem is spawned in the world, if true and Item#createCustomEntity -+ * returns non null, the EntityItem will be destroyed and the new Entity will be added to the world. -+ * -+ * @param stack The current item stack -+ * @return True of the item has a custom entity, If true, Item#createCustomEntity will be called -+ */ -+ public boolean hasCustomEntity(ItemStack stack) -+ { -+ return false; -+ } -+ -+ /** -+ * This function should return a new entity to replace the dropped item. -+ * Returning null here will not kill the EntityItem and will leave it to function normally. -+ * Called when the item it placed in a world. -+ * -+ * @param world The world object -+ * @param location The EntityItem object, useful for getting the position of the entity -+ * @param itemstack The current item stack -+ * @return A new Entity object to spawn or null -+ */ -+ public Entity createEntity(World world, Entity location, ItemStack itemstack) -+ { -+ return null; -+ } -+ -+ /** -+ * Called by the default implemetation of EntityItem's onUpdate method, allowing for cleaner -+ * control over the update of the item without having to write a subclass. -+ * -+ * @param entityItem The entity Item -+ * @return Return true to skip any further update code. -+ */ -+ public boolean onEntityItemUpdate(net.minecraft.entity.item.EntityItem entityItem) -+ { -+ return false; -+ } -+ -+ /** -+ * Gets a list of tabs that items belonging to this class can display on, -+ * combined properly with getSubItems allows for a single item to span -+ * many sub-items across many tabs. -+ * -+ * @return A list of all tabs that this item could possibly be one. -+ */ -+ public CreativeTabs[] getCreativeTabs() -+ { -+ return new CreativeTabs[]{ getCreativeTab() }; -+ } -+ -+ /** -+ * Determines the base experience for a player when they remove this item from a furnace slot. -+ * This number must be between 0 and 1 for it to be valid. -+ * This number will be multiplied by the stack size to get the total experience. -+ * -+ * @param item The item stack the player is picking up. -+ * @return The amount to award for each item. -+ */ -+ public float getSmeltingExperience(ItemStack item) -+ { -+ return -1; //-1 will default to the old lookups. -+ } -+ -+ /** -+ * Return the correct icon for rendering based on the supplied ItemStack and render pass. -+ * -+ * Defers to {@link #getIconFromDamageForRenderPass(int, int)} -+ * @param stack to render for -+ * @param pass the multi-render pass -+ * @return the icon -+ * / -+ public IIcon getIcon(ItemStack stack, int pass) -+ { -+ return func_77618_c(stack.getMetadata(), pass); -+ } -+ */ -+ -+ /** -+ * Generates the base Random item for a specific instance of the chest gen, -+ * Enchanted books use this to pick a random enchantment. -+ * -+ * @param chest The chest category to generate for -+ * @param rnd World RNG -+ * @param original Original result registered with the chest gen hooks. -+ * @return New values to use as the random item, typically this will be original -+ */ -+ public net.minecraft.util.WeightedRandomChestContent getChestGenBase(net.minecraftforge.common.ChestGenHooks chest, Random rnd, net.minecraft.util.WeightedRandomChestContent original) -+ { -+ if (this instanceof ItemEnchantedBook) -+ { -+ return ((ItemEnchantedBook)this).getRandom(rnd, -+ original.minStackSize, -+ original.maxStackSize, original.itemWeight); -+ } -+ return original; -+ } -+ -+ /** -+ * -+ * Should this item, when held, allow sneak-clicks to pass through to the underlying block? -+ * -+ * @param world The world -+ * @param pos Block position in world -+ * @param player The Player that is wielding the item -+ * @return -+ */ -+ public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player) -+ { -+ return false; -+ } -+ -+ /** -+ * Called to tick armor in the armor slot. Override to do something -+ */ -+ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack){} -+ -+ /** -+ * Determines if the specific ItemStack can be placed in the specified armor slot. -+ * -+ * @param stack The ItemStack -+ * @param armorType Armor slot ID: 0: Helmet, 1: Chest, 2: Legs, 3: Boots -+ * @param entity The entity trying to equip the armor -+ * @return True if the given ItemStack can be inserted in the slot -+ */ -+ public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) -+ { -+ if (this instanceof ItemArmor) -+ { -+ return ((ItemArmor)this).armorType == armorType; -+ } -+ -+ if (armorType == 0) -+ { -+ return this == Item.getItemFromBlock(Blocks.pumpkin) || this == Items.skull; -+ } -+ -+ return false; -+ } -+ -+ /** -+ * Allow or forbid the specific book/item combination as an anvil enchant -+ * -+ * @param stack The item -+ * @param book The book -+ * @return if the enchantment is allowed -+ */ -+ public boolean isBookEnchantable(ItemStack stack, ItemStack book) -+ { -+ return true; -+ } -+ -+ /** -+ * Called by RenderBiped and RenderPlayer to determine the armor texture that -+ * should be use for the currently equipped item. -+ * This will only be called on instances of ItemArmor. -+ * -+ * Returning null from this function will use the default value. -+ * -+ * @param stack ItemStack for the equipped armor -+ * @param entity The entity wearing the armor -+ * @param slot The slot the armor is in -+ * @param type The subtype, can be null or "overlay" -+ * @return Path of texture to bind, or null to use default -+ */ -+ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) -+ { -+ return null; -+ } -+ -+ /** -+ * Returns the font renderer used to render tooltips and overlays for this item. -+ * Returning null will use the standard font renderer. -+ * -+ * @param stack The current item stack -+ * @return A instance of FontRenderer or null to use default -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack) -+ { -+ return null; -+ } -+ -+ /** -+ * @deprecated Use 4-argument version. -+ */ -+ // remove 1.9 -+ @SideOnly(Side.CLIENT) -+ @Deprecated -+ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) -+ { -+ return null; -+ } -+ -+ /** -+ * Override this method to have an item handle its own armor rendering. -+ * -+ * @param entityLiving The entity wearing the armor -+ * @param itemStack The itemStack to render the model of -+ * @param armorSlot 0=head, 1=torso, 2=legs, 3=feet -+ * @param _default Original armor model. Will have attributes set. -+ * @return A ModelBiped to render instead of the default -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot, net.minecraft.client.model.ModelBiped _default) -+ { -+ return getArmorModel(entityLiving, itemStack, armorSlot); -+ } -+ -+ /** -+ * Called when a entity tries to play the 'swing' animation. -+ * -+ * @param entityLiving The entity swinging the item. -+ * @param stack The Item stack -+ * @return True to cancel any further processing by EntityLiving -+ */ -+ public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) -+ { -+ return false; -+ } -+ -+ /** -+ * Called when the client starts rendering the HUD, for whatever item the player currently has as a helmet. -+ * This is where pumpkins would render there overlay. -+ * -+ * @param stack The ItemStack that is equipped -+ * @param player Reference to the current client entity -+ * @param resolution Resolution information about the current viewport and configured GUI Scale -+ * @param partialTicks Partial ticks for the renderer, useful for interpolation -+ */ -+ @SideOnly(Side.CLIENT) -+ public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, net.minecraft.client.gui.ScaledResolution resolution, float partialTicks){} -+ -+ /** -+ * Return the itemDamage represented by this ItemStack. Defaults to the itemDamage field on ItemStack, but can be overridden here for other sources such as NBT. -+ * -+ * @param stack The itemstack that is damaged -+ * @return the damage value -+ */ -+ public int getDamage(ItemStack stack) -+ { -+ return stack.itemDamage; -+ } -+ -+ /** -+ * This used to be 'display damage' but its really just 'aux' data in the ItemStack, usually shares the same variable as damage. -+ * @param stack -+ * @return -+ */ -+ public int getMetadata(ItemStack stack) -+ { -+ return stack.itemDamage; -+ } -+ -+ /** -+ * Determines if the durability bar should be rendered for this item. -+ * Defaults to vanilla stack.isDamaged behavior. -+ * But modders can use this for any data they wish. -+ * -+ * @param stack The current Item Stack -+ * @return True if it should render the 'durability' bar. -+ */ -+ public boolean showDurabilityBar(ItemStack stack) -+ { -+ return stack.isItemDamaged(); -+ } -+ -+ /** -+ * Queries the percentage of the 'Durability' bar that should be drawn. -+ * -+ * @param stack The current ItemStack -+ * @return 1.0 for 100% 0 for 0% -+ */ -+ public double getDurabilityForDisplay(ItemStack stack) -+ { -+ return (double)stack.getItemDamage() / (double)stack.getMaxDamage(); -+ } -+ -+ /** -+ * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item, -+ * but can be overridden here for other sources such as NBT. -+ * -+ * @param stack The itemstack that is damaged -+ * @return the damage value -+ */ -+ public int getMaxDamage(ItemStack stack) -+ { -+ return getMaxDamage(); -+ } -+ -+ /** -+ * Return if this itemstack is damaged. Note only called if {@link #isDamageable()} is true. -+ * @param stack the stack -+ * @return if the stack is damaged -+ */ -+ public boolean isDamaged(ItemStack stack) -+ { -+ return stack.itemDamage > 0; -+ } -+ -+ /** -+ * Set the damage for this itemstack. Note, this method is responsible for zero checking. -+ * @param stack the stack -+ * @param damage the new damage value -+ */ -+ public void setDamage(ItemStack stack, int damage) -+ { -+ stack.itemDamage = damage; -+ -+ if (stack.itemDamage < 0) -+ { -+ stack.itemDamage = 0; -+ } -+ } -+ -+ /** -+ * ItemStack sensitive version of {@link #canHarvestBlock(Block)} -+ * @param par1Block The block trying to harvest -+ * @param itemStack The itemstack used to harvest the block -+ * @return true if can harvest the block -+ */ -+ public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) -+ { -+ return canHarvestBlock(par1Block); -+ } -+ -+ /** -+ * Gets the maximum number of items that this stack should be able to hold. -+ * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit() -+ * -+ * @param stack The ItemStack -+ * @return THe maximum number this item can be stacked to -+ */ -+ public int getItemStackLimit(ItemStack stack) -+ { -+ return this.getItemStackLimit(); -+ } -+ -+ private java.util.Map toolClasses = new java.util.HashMap(); -+ /** -+ * Sets or removes the harvest level for the specified tool class. -+ * -+ * @param toolClass Class -+ * @param level Harvest level: -+ * Wood: 0 -+ * Stone: 1 -+ * Iron: 2 -+ * Diamond: 3 -+ * Gold: 0 -+ */ -+ public void setHarvestLevel(String toolClass, int level) -+ { -+ if (level < 0) -+ toolClasses.remove(toolClass); -+ else -+ toolClasses.put(toolClass, level); -+ } -+ -+ public java.util.Set getToolClasses(ItemStack stack) -+ { -+ return toolClasses.keySet(); -+ } -+ -+ /** -+ * Queries the harvest level of this item stack for the specifred tool class, -+ * Returns -1 if this tool is not of the specified type -+ * -+ * @param stack This item stack instance -+ * @param toolClass Tool Class -+ * @return Harvest level, or -1 if not the specified tool type. -+ */ -+ public int getHarvestLevel(ItemStack stack, String toolClass) -+ { -+ Integer ret = toolClasses.get(toolClass); -+ return ret == null ? -1 : ret; -+ } -+ -+ /** -+ * ItemStack sensitive version of getItemEnchantability -+ * -+ * @param stack The ItemStack -+ * @return the item echantability value -+ */ -+ public int getItemEnchantability(ItemStack stack) -+ { -+ return getItemEnchantability(); -+ } -+ -+ /** -+ * Whether this Item can be used as a payment to activate the vanilla beacon. -+ * @param stack the ItemStack -+ * @return true if this Item can be used -+ */ -+ public boolean isBeaconPayment(ItemStack stack) -+ { -+ return this == Items.emerald || this == Items.diamond || this == Items.gold_ingot || this == Items.iron_ingot; -+ } -+ -+ -+ /** -+ * Determine if the player switching between these two item stacks -+ * @param oldStack The old stack that was equipped -+ * @param newStack The new stack -+ * @param slotChanged If the current equipped slot was changed, -+ * Vanilla does not play the animation if you switch between two -+ * slots that hold the exact same item. -+ * @return True to play the item change animation -+ */ -+ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) -+ { -+ return !ItemStack.areItemStacksEqual(oldStack, newStack); -+ } -+ -+ -+ private ResourceLocation registryName = null; -+ /** -+ * Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item. -+ * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. -+ * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. -+ * -+ * The supplied name will be prefixed with the currently active mod's modId. -+ * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. -+ * -+ * If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown. -+ * -+ * Returns 'this' to allow for chaining. -+ * -+ * @param name Unique registry name -+ * @return This instance -+ */ -+ public final Item setRegistryName(String name) -+ { -+ if (getRegistryName() != null) -+ throw new IllegalStateException("Attempted to set registry name on block with exisiting registry name! New: " + name + " Old: " + getRegistryName()); -+ int index = name.lastIndexOf(':'); -+ String oldPrefix = index == -1 ? "" : name.substring(0, index); -+ name = index == -1 ? name : name.substring(index + 1); -+ net.minecraftforge.fml.common.ModContainer mc = net.minecraftforge.fml.common.Loader.instance().activeModContainer(); -+ String prefix = mc == null ? "minecraft" : mc.getModId(); -+ if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) -+ { -+ net.minecraftforge.fml.common.FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name); -+ prefix = oldPrefix; -+ } -+ this.registryName = new ResourceLocation(prefix, name); -+ return this; -+ } -+ public final Item setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); } -+ public final Item setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); } -+ -+ /** -+ * A unique identifier for this block, if this block is registered in the game registry it will return that name. -+ * Otherwise it will return the name set in setRegistryName(). -+ * If neither are valid null is returned. -+ * -+ * @return Unique identifier or null. -+ */ -+ public final String getRegistryName() -+ { -+ if (delegate.getResourceName() != null) return delegate.getResourceName().toString(); -+ return registryName != null ? registryName.toString() : null; -+ } -+ -+ /** -+ * Called from ItemStack.setItem, will hold extra data for the life of this ItemStack. -+ * Can be retrieved from stack.getCapabilities() -+ * The NBT can be null if this is not called from readNBT or if the item the stack is -+ * changing FROM is different then this item, or the previous item had no capabilities. -+ * -+ * This is called BEFORE the stacks item is set so you can use stack.getItem() to see the OLD item. -+ * Remember that getItem CAN return null. -+ * -+ * @param stack The ItemStack -+ * @param nbt NBT of this item serialized, or null. -+ * @return A holder instance associated with this ItemStack where you can hold capabilities for the life of this item. -+ */ -+ public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) -+ { -+ return null; -+ } -+ /* ======================================== FORGE END =====================================*/ -+ - public static void registerItems() - { - registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() -@@ -855,6 +1523,10 @@ + protected RayTraceResult getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids) +@@ -935,6 +940,10 @@ private final float damageVsEntity; private final int enchantability; @@ -739,41 +46,3 @@ private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) { this.harvestLevel = harvestLevel; -@@ -889,9 +1561,36 @@ - return this.enchantability; - } - -+ @Deprecated // Use getRepairItemStack below - public Item getRepairItem() - { -- return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null)))); -+ switch (this) -+ { -+ case WOOD: return Item.getItemFromBlock(Blocks.planks); -+ case STONE: return Item.getItemFromBlock(Blocks.cobblestone); -+ case GOLD: return Items.gold_ingot; -+ case IRON: return Items.iron_ingot; -+ case EMERALD: return Items.diamond; -+ default: return customCraftingMaterial; -+ } - } -+ -+ public ToolMaterial setRepairItem(ItemStack stack) -+ { -+ if (this.repairMaterial != null || customCraftingMaterial != null) throw new RuntimeException("Can not change already set repair material"); -+ if (this == WOOD || this == STONE || this == GOLD || this == IRON || this == EMERALD) throw new RuntimeException("Can not change vanilla tool repair materials"); -+ this.repairMaterial = stack; -+ this.customCraftingMaterial = stack.getItem(); -+ return this; -+ } -+ -+ public ItemStack getRepairItemStack() -+ { -+ if (repairMaterial != null) return repairMaterial; -+ Item ret = this.getRepairItem(); -+ if (ret == null) return null; -+ repairMaterial = new ItemStack(ret, 1, net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE); -+ return repairMaterial; -+ } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch index 1c97a02e1a..b8191a6915 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch @@ -1,34 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemArmor.java +++ ../src-work/minecraft/net/minecraft/item/ItemArmor.java -@@ -37,7 +37,7 @@ - if (list.size() > 0) - { - EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0); -- int l = entitylivingbase instanceof EntityPlayer ? 1 : 0; -+ int l = 0;// Forge: We fix the indexes. Mojang Stop hard coding this! - int i1 = EntityLiving.getArmorPosition(stack); - ItemStack itemstack = stack.copy(); - itemstack.stackSize = 1; -@@ -190,7 +190,7 @@ - - if (itemstack == null) - { -- playerIn.setCurrentItemOrArmor(i, itemStackIn.copy()); -+ playerIn.setCurrentItemOrArmor(i + 1, itemStackIn.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. - itemStackIn.stackSize = 0; - } - -@@ -210,6 +210,9 @@ - private final int[] damageReductionAmountArray; - private final int enchantability; - -+ //Added by forge for custom Armor materials. -+ public Item customCraftingMaterial = null; -+ - private ArmorMaterial(String name, int maxDamage, int[] reductionAmounts, int enchantability) - { - this.name = name; -@@ -235,7 +238,15 @@ +@@ -267,7 +267,15 @@ public Item getRepairItem() { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch index 6ee6336091..20c49cd78f 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch @@ -1,24 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBlock.java +++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java -@@ -54,16 +54,8 @@ - int i = this.getMetadata(stack.getMetadata()); - IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn); - -- if (worldIn.setBlockState(pos, iblockstate1, 3)) -+ if (placeBlockAt(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ, iblockstate1)) - { -- iblockstate1 = worldIn.getBlockState(pos); -- -- if (iblockstate1.getBlock() == this.block) -- { -- setTileEntityNBT(worldIn, playerIn, pos, stack); -- this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); -- } -- - worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F); - --stack.stackSize; - } -@@ -124,7 +116,7 @@ +@@ -121,7 +121,7 @@ { Block block = worldIn.getBlockState(pos).getBlock(); @@ -27,7 +9,7 @@ { side = EnumFacing.UP; } -@@ -162,4 +154,26 @@ +@@ -159,4 +159,26 @@ { return this.block; } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch deleted file mode 100644 index 751ab83674..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBow.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBow.java -@@ -27,6 +27,9 @@ - if (flag || playerIn.inventory.hasItem(Items.arrow)) - { - int i = this.getMaxItemUseDuration(stack) - timeLeft; -+ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, stack, i); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; -+ i = event.charge; - float f = (float)i / 20.0F; - f = (f * f + f * 2.0F) / 3.0F; - -@@ -104,6 +107,9 @@ - - public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) - { -+ net.minecraftforge.event.entity.player.ArrowNockEvent event = new net.minecraftforge.event.entity.player.ArrowNockEvent(playerIn, itemStackIn); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return event.result; -+ - if (playerIn.capabilities.isCreativeMode || playerIn.inventory.hasItem(Items.arrow)) - { - playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch deleted file mode 100644 index 490b216773..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBucket.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBucket.java -@@ -36,6 +36,9 @@ - } - else - { -+ ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(playerIn, worldIn, itemStackIn, movingobjectposition); -+ if (ret != null) return ret; -+ - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - BlockPos blockpos = movingobjectposition.getBlockPos(); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch index e1b1013f42..02318fa887 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBucketMilk.java +++ ../src-work/minecraft/net/minecraft/item/ItemBucketMilk.java -@@ -23,7 +23,7 @@ +@@ -27,7 +27,7 @@ if (!worldIn.isRemote) { @@ -8,4 +8,4 @@ + playerIn.curePotionEffects(stack); } - playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + if (playerIn instanceof EntityPlayer) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch index fa9033555e..94f89322ff 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemDye.java +++ ../src-work/minecraft/net/minecraft/item/ItemDye.java -@@ -47,7 +47,7 @@ +@@ -50,7 +50,7 @@ if (enumdyecolor == EnumDyeColor.WHITE) { @@ -28,17 +28,8 @@ if (iblockstate.getBlock() instanceof IGrowable) { IGrowable igrowable = (IGrowable)iblockstate.getBlock(); -@@ -132,7 +142,7 @@ - - Block block = worldIn.getBlockState(pos).getBlock(); - -- if (block.getMaterial() != Material.air) -+ if (block.isAir(worldIn, pos)) - { - block.setBlockBoundsBasedOnState(worldIn, pos); - -@@ -144,6 +154,16 @@ - worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); +@@ -142,6 +152,16 @@ + worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * iblockstate.func_185900_c(worldIn, pos).maxY, (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); } } + else @@ -53,4 +44,4 @@ + } } - public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target) + public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target, EnumHand p_111207_4_) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch deleted file mode 100644 index 6fc09d1de6..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemEmptyMap.java -+++ ../src-work/minecraft/net/minecraft/item/ItemEmptyMap.java -@@ -22,7 +22,7 @@ - worldIn.setItemData(s, mapdata); - mapdata.scale = 0; - mapdata.calculateMapCenter(playerIn.posX, playerIn.posZ, mapdata.scale); -- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); -+ mapdata.dimension = worldIn.provider.getDimensionId(); - mapdata.markDirty(); - --itemStackIn.stackSize; - diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch deleted file mode 100644 index 17bd77146c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemFlintAndSteel.java -+++ ../src-work/minecraft/net/minecraft/item/ItemFlintAndSteel.java -@@ -27,7 +27,7 @@ - } - else - { -- if (worldIn.getBlockState(pos).getBlock().getMaterial() == Material.air) -+ if (worldIn.isAirBlock(pos)) - { - worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - worldIn.setBlockState(pos, Blocks.fire.getDefaultState()); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch deleted file mode 100644 index 28920005fb..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemHoe.java -+++ ../src-work/minecraft/net/minecraft/item/ItemHoe.java -@@ -34,10 +34,13 @@ - } - else - { -+ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, playerIn, worldIn, pos); -+ if (hook != 0) return hook > 0; -+ - IBlockState iblockstate = worldIn.getBlockState(pos); - Block block = iblockstate.getBlock(); - -- if (side != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).getBlock().getMaterial() == Material.air) -+ if (side != EnumFacing.DOWN && worldIn.isAirBlock(pos.up())) - { - if (block == Blocks.grass) - { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch deleted file mode 100644 index 86d27a4436..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemLilyPad.java -+++ ../src-work/minecraft/net/minecraft/item/ItemLilyPad.java -@@ -49,7 +49,14 @@ - - if (iblockstate.getBlock().getMaterial() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) - { -+ // special case for handling block placement with water lilies -+ net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(worldIn, blockpos1); - worldIn.setBlockState(blockpos1, Blocks.waterlily.getDefaultState()); -+ if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(playerIn, blocksnapshot, net.minecraft.util.EnumFacing.UP).isCanceled()) -+ { -+ blocksnapshot.restore(true, false); -+ return itemStackIn; -+ } - - if (!playerIn.capabilities.isCreativeMode) - { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch deleted file mode 100644 index 4df592c19b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemMap.java -+++ ../src-work/minecraft/net/minecraft/item/ItemMap.java -@@ -57,7 +57,7 @@ - mapdata = new MapData(s); - mapdata.scale = 3; - mapdata.calculateMapCenter((double)worldIn.getWorldInfo().getSpawnX(), (double)worldIn.getWorldInfo().getSpawnZ(), mapdata.scale); -- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); -+ mapdata.dimension = worldIn.provider.getDimensionId(); - mapdata.markDirty(); - worldIn.setItemData(s, mapdata); - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch index ba116ba1e7..dd7b0ff031 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch @@ -1,90 +1,8 @@ --- ../src-base/minecraft/net/minecraft/item/ItemMonsterPlacer.java +++ ../src-work/minecraft/net/minecraft/item/ItemMonsterPlacer.java -@@ -36,7 +36,7 @@ - public String getItemStackDisplayName(ItemStack stack) - { - String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); -- String s1 = EntityList.getStringFromID(stack.getMetadata()); -+ String s1 = ItemMonsterPlacer.getEntityName(stack); - - if (s1 != null) - { -@@ -49,7 +49,7 @@ - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int renderPass) - { -- EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(stack.getMetadata())); -+ EntityList.EntityEggInfo entitylist$entityegginfo = ItemMonsterPlacer.getEggInfo(stack); - return entitylist$entityegginfo != null ? (renderPass == 0 ? entitylist$entityegginfo.primaryColor : entitylist$entityegginfo.secondaryColor) : 16777215; - } - -@@ -74,7 +74,7 @@ - if (tileentity instanceof TileEntityMobSpawner) - { - MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic(); -- mobspawnerbaselogic.setEntityName(EntityList.getStringFromID(stack.getMetadata())); -+ mobspawnerbaselogic.setEntityName(ItemMonsterPlacer.getEntityName(stack)); - tileentity.markDirty(); - worldIn.markBlockForUpdate(pos); - -@@ -90,12 +90,12 @@ - pos = pos.offset(side); - double d0 = 0.0D; - -- if (side == EnumFacing.UP && iblockstate instanceof BlockFence) -+ if (side == EnumFacing.UP && iblockstate.getBlock() instanceof BlockFence) //Forge: Fix Vanilla bug comparing state instead of block - { - d0 = 0.5D; +@@ -193,8 +193,31 @@ + return new ActionResult(EnumActionResult.PASS, itemStackIn); } - -- Entity entity = spawnCreature(worldIn, stack.getMetadata(), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); -+ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(stack), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); - - if (entity != null) - { -@@ -146,7 +146,7 @@ - - if (worldIn.getBlockState(blockpos).getBlock() instanceof BlockLiquid) - { -- Entity entity = spawnCreature(worldIn, itemStackIn.getMetadata(), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); -+ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(itemStackIn), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); - - if (entity != null) - { -@@ -170,19 +170,29 @@ - } - } - -+ @Deprecated // Use string version below. - public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z) - { - if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID))) - { - return null; - } -+ return spawnCreature(worldIn, EntityList.getStringFromID(entityID), x, y, z); -+ } -+ -+ public static Entity spawnCreature(World worldIn, String name, double x, double y, double z) -+ { -+ if (!EntityList.stringToClassMapping.containsKey(name)) -+ { -+ return null; -+ } - else - { - Entity entity = null; - - for (int i = 0; i < 1; ++i) - { -- entity = EntityList.createEntityByID(entityID, worldIn); -+ entity = EntityList.createEntityByName(name, worldIn); - - if (entity instanceof EntityLivingBase) - { -@@ -207,5 +217,28 @@ - { - subItems.add(new ItemStack(itemIn, 1, entitylist$entityegginfo.spawnedID)); } + + for (String name : net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().keySet()) @@ -96,7 +14,7 @@ + subItems.add(stack); + } } -+ + + public static String getEntityName(ItemStack stack) + { + if (stack.hasTagCompound() && stack.getTagCompound().hasKey("entity_name", 8)) @@ -110,4 +28,7 @@ + return net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(stack.getTagCompound().getString("entity_name")); + return (EntityList.EntityEggInfo)EntityList.entityEggs.get(stack.getMetadata()); + } - } ++ + public static Entity spawnCreature(World worldIn, String entityID, double x, double y, double z) + { + if (entityID != null && EntityList.entityEggs.containsKey(entityID)) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch index e6bf3bf5d1..16e050b5be 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch @@ -1,10 +1,9 @@ --- ../src-base/minecraft/net/minecraft/item/ItemRecord.java +++ ../src-work/minecraft/net/minecraft/item/ItemRecord.java -@@ -76,4 +76,15 @@ - { - return (ItemRecord)RECORDS.get(name); +@@ -73,6 +73,17 @@ + return EnumRarity.RARE; } -+ + + /** + * Retrieves the resource location of the sound to play for this record. + * @@ -15,4 +14,7 @@ + { + return new net.minecraft.util.ResourceLocation(name); + } - } ++ + @SideOnly(Side.CLIENT) + public static ItemRecord func_185074_a(SoundEvent p_185074_0_) + { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch index 53391bf0b0..ade0e57383 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSeedFood.java +++ ../src-work/minecraft/net/minecraft/item/ItemSeedFood.java -@@ -6,7 +6,7 @@ - import net.minecraft.util.EnumFacing; +@@ -8,7 +8,7 @@ + import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -public class ItemSeedFood extends ItemFood @@ -9,17 +9,8 @@ { private Block crops; private Block soilId; -@@ -28,7 +28,7 @@ - { - return false; - } -- else if (worldIn.getBlockState(pos).getBlock() == this.soilId && worldIn.isAirBlock(pos.up())) -+ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) - { - worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); - --stack.stackSize; -@@ -39,4 +39,16 @@ - return false; +@@ -33,4 +33,16 @@ + return EnumActionResult.FAIL; } } + diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch index 053649392d..1d5d89be8b 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSeeds.java +++ ../src-work/minecraft/net/minecraft/item/ItemSeeds.java -@@ -7,7 +7,7 @@ - import net.minecraft.util.EnumFacing; +@@ -9,7 +9,7 @@ + import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -public class ItemSeeds extends Item @@ -9,17 +9,8 @@ { private Block crops; private Block soilBlockID; -@@ -29,7 +29,7 @@ - { - return false; - } -- else if (worldIn.getBlockState(pos).getBlock() == this.soilBlockID && worldIn.isAirBlock(pos.up())) -+ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) - { - worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); - --stack.stackSize; -@@ -40,4 +40,16 @@ - return false; +@@ -34,4 +34,16 @@ + return EnumActionResult.FAIL; } } + diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch index 6c0e839312..8ec9fd7fae 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch @@ -1,23 +1,8 @@ --- ../src-base/minecraft/net/minecraft/item/ItemShears.java +++ ../src-work/minecraft/net/minecraft/item/ItemShears.java -@@ -19,13 +19,12 @@ - - public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) - { -- if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool) -+ if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool && !(blockIn instanceof net.minecraftforge.common.IShearable)) - { - return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn); - } - else - { -- stack.damageItem(1, playerIn); - return true; - } - } -@@ -39,4 +38,71 @@ - { - return block != Blocks.web && block.getMaterial() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, block)) : 15.0F; +@@ -36,4 +36,71 @@ + Block block = block.getBlock(); + return block != Blocks.web && block.func_185904_a() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, block)) : 15.0F; } + + diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch deleted file mode 100644 index 4e8acb4a5a..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSkull.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSkull.java -@@ -34,6 +34,11 @@ - - public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) - { -+ if (worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && side != EnumFacing.DOWN) -+ { -+ side = EnumFacing.UP; -+ pos = pos.down(); -+ } - if (side == EnumFacing.DOWN) - { - return false; -@@ -46,7 +51,7 @@ - - if (!flag) - { -- if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid()) -+ if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid() && !worldIn.isSideSolid(pos, side, true)) - { - return false; - } -@@ -66,6 +71,7 @@ - { - if (!worldIn.isRemote) - { -+ if (!Blocks.skull.canPlaceBlockOnSide(worldIn, pos, side)) return false; - worldIn.setBlockState(pos, Blocks.skull.getDefaultState().withProperty(BlockSkull.FACING, side), 3); - int i = 0; - diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch index 3d986ba7ba..951947b54e 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSnow.java +++ ../src-work/minecraft/net/minecraft/item/ItemSnow.java -@@ -67,4 +67,10 @@ +@@ -68,4 +68,10 @@ { return damage; } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch index 0414b92f39..b05c2b68a0 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/item/ItemStack.java +++ ../src-work/minecraft/net/minecraft/item/ItemStack.java -@@ -35,7 +35,7 @@ +@@ -41,7 +41,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public final class ItemStack +public final class ItemStack implements net.minecraftforge.common.capabilities.ICapabilitySerializable { - public static final DecimalFormat DECIMALFORMAT = new DecimalFormat("#.###"); + public static final DecimalFormat DECIMALFORMAT = new DecimalFormat("#.##"); public int stackSize; -@@ -49,6 +49,10 @@ +@@ -55,6 +55,10 @@ private Block canPlaceOnCacheBlock; private boolean canPlaceOnCacheResult; @@ -20,7 +20,7 @@ public ItemStack(Block blockIn) { this((Block)blockIn, 1); -@@ -74,13 +78,15 @@ +@@ -80,13 +84,15 @@ this((Item)itemIn, amount, 0); } @@ -38,56 +38,7 @@ this.stackSize = amount; this.itemDamage = meta; -@@ -107,7 +113,7 @@ - - public ItemStack splitStack(int amount) - { -- ItemStack itemstack = new ItemStack(this.item, amount, this.itemDamage); -+ ItemStack itemstack = new ItemStack(this.item, amount, this.itemDamage, this.capabilities != null ? this.capabilities.serializeNBT() : null); - - if (this.stackTagCompound != null) - { -@@ -120,11 +126,12 @@ - - public Item getItem() - { -- return this.item; -+ return this.delegate != null ? this.delegate.get() : null; - } - - public boolean onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) - { -+ if (!worldIn.isRemote) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); - boolean flag = this.getItem().onItemUse(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); - - if (flag) -@@ -162,19 +169,23 @@ - nbt.setTag("tag", this.stackTagCompound); - } - -+ if (this.capabilities != null) nbt.setTag("ForgeCaps", this.capabilities.serializeNBT()); -+ - return nbt; - } - - public void readFromNBT(NBTTagCompound nbt) - { -+ this.capNBT = nbt.hasKey("ForgeCaps") ? nbt.getCompoundTag("ForgeCaps") : null; - if (nbt.hasKey("id", 8)) - { -- this.item = Item.getByNameOrId(nbt.getString("id")); -+ this.setItem(Item.getByNameOrId(nbt.getString("id"))); - } - else - { -- this.item = Item.getItemById(nbt.getShort("id")); -+ this.setItem(Item.getItemById(nbt.getShort("id"))); - } -+ this.capNBT = null; - - this.stackSize = nbt.getByte("Count"); - this.itemDamage = nbt.getShort("Damage"); -@@ -197,7 +208,7 @@ +@@ -196,7 +202,7 @@ public int getMaxStackSize() { @@ -96,7 +47,7 @@ } public boolean isStackable() -@@ -207,7 +218,7 @@ +@@ -206,7 +212,7 @@ public boolean isItemStackDamageable() { @@ -105,45 +56,7 @@ } public boolean getHasSubtypes() -@@ -217,32 +228,27 @@ - - public boolean isItemDamaged() - { -- return this.isItemStackDamageable() && this.itemDamage > 0; -+ return this.isItemStackDamageable() && getItem().isDamaged(this); - } - - public int getItemDamage() - { -- return this.itemDamage; -+ return getItem().getDamage(this); - } - - public int getMetadata() - { -- return this.itemDamage; -+ return getItem().getMetadata(this); - } - - public void setItemDamage(int meta) - { -- this.itemDamage = meta; -- -- if (this.itemDamage < 0) -- { -- this.itemDamage = 0; -- } -+ getItem().setDamage(this, meta); - } - - public int getMaxDamage() - { -- return this.item.getMaxDamage(); -+ return this.item.getMaxDamage(this); - } - - public boolean attemptDamageItem(int amount, Random rand) -@@ -274,8 +280,8 @@ +@@ -273,8 +279,8 @@ } } @@ -154,16 +67,16 @@ } } -@@ -334,7 +340,7 @@ +@@ -328,7 +334,7 @@ - public boolean canHarvestBlock(Block blockIn) + public boolean canHarvestBlock(IBlockState blockIn) { - return this.item.canHarvestBlock(blockIn); + return getItem().canHarvestBlock(blockIn, this); } - public boolean interactWithEntity(EntityPlayer playerIn, EntityLivingBase entityIn) -@@ -344,7 +350,7 @@ + public boolean interactWithEntity(EntityPlayer playerIn, EntityLivingBase entityIn, EnumHand p_111282_3_) +@@ -338,7 +344,7 @@ public ItemStack copy() { @@ -172,7 +85,7 @@ if (this.stackTagCompound != null) { -@@ -742,6 +748,7 @@ +@@ -759,6 +765,7 @@ } } @@ -180,16 +93,7 @@ return list; } -@@ -852,7 +859,7 @@ - } - else - { -- multimap = this.getItem().getItemAttributeModifiers(); -+ multimap = this.getItem().getAttributeModifiers(this); - } - - return multimap; -@@ -860,6 +867,18 @@ +@@ -901,6 +908,18 @@ public void setItem(Item newItem) { @@ -208,7 +112,7 @@ this.item = newItem; } -@@ -946,4 +965,26 @@ +@@ -987,4 +1006,26 @@ return false; } } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch index 3b7d5e0e08..f52fd59428 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSword.java +++ ../src-work/minecraft/net/minecraft/item/ItemSword.java -@@ -101,7 +101,9 @@ +@@ -88,7 +88,9 @@ public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { @@ -10,4 +10,4 @@ + return super.getIsRepairable(toRepair, repair); } - public Multimap getItemAttributeModifiers() + public Multimap getItemAttributeModifiers(EntityEquipmentSlot p_111205_1_) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch index cb93922328..7ddec241ba 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/item/ItemTool.java +++ ../src-work/minecraft/net/minecraft/item/ItemTool.java -@@ -28,6 +28,18 @@ - this.efficiencyOnProperMaterial = material.getEfficiencyOnProperMaterial(); - this.damageVsEntity = attackDamage + material.getDamageVsEntity(); +@@ -33,6 +33,18 @@ + this.damageVsEntity = p_i46745_1_ + p_i46745_3_.getDamageVsEntity(); + this.field_185065_c = p_i46745_2_; this.setCreativeTab(CreativeTabs.tabTools); + if (this instanceof ItemPickaxe) + { @@ -18,8 +18,8 @@ + } } - public float getStrVsBlock(ItemStack stack, Block block) -@@ -74,7 +86,9 @@ + protected ItemTool(Item.ToolMaterial p_i46746_1_, Set p_i46746_2_) +@@ -84,7 +96,9 @@ public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { @@ -29,9 +29,9 @@ + return super.getIsRepairable(toRepair, repair); } - public Multimap getItemAttributeModifiers() -@@ -83,4 +97,38 @@ - multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Tool modifier", (double)this.damageVsEntity, 0)); + public Multimap getItemAttributeModifiers(EntityEquipmentSlot p_111205_1_) +@@ -99,4 +113,38 @@ + return multimap; } + diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch index 7275586224..5f38ff6047 100644 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java +++ ../src-work/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java -@@ -72,6 +72,7 @@ +@@ -73,6 +73,7 @@ public void addSmeltingRecipe(ItemStack input, ItemStack stack, float experience) { @@ -8,7 +8,7 @@ this.smeltingList.put(input, stack); this.experienceList.put(stack, Float.valueOf(experience)); } -@@ -101,6 +102,9 @@ +@@ -102,6 +103,9 @@ public float getSmeltingExperience(ItemStack stack) { diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch index a5014d15a5..8b17ab96cb 100644 --- a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch +++ b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/nbt/NBTTagCompound.java +++ ../src-work/minecraft/net/minecraft/nbt/NBTTagCompound.java -@@ -395,6 +395,7 @@ +@@ -454,6 +454,7 @@ private static byte readType(DataInput input, NBTSizeTracker sizeTracker) throws IOException { @@ -8,7 +8,7 @@ return input.readByte(); } -@@ -405,6 +406,7 @@ +@@ -464,6 +465,7 @@ static NBTBase readNBT(byte id, String key, DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException { diff --git a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch index 91465a327f..e61c493305 100644 --- a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -1,51 +1,6 @@ --- ../src-base/minecraft/net/minecraft/network/NetHandlerPlayServer.java +++ ../src-work/minecraft/net/minecraft/network/NetHandlerPlayServer.java -@@ -254,6 +254,8 @@ - this.playerEntity.ridingEntity.updateRiderPosition(); - } - -+ if (!this.hasMoved) return; //Fixes teleportation kick while riding entities -+ - this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); - - if (this.playerEntity.ridingEntity != null) -@@ -350,6 +352,8 @@ - this.playerEntity.jump(); - } - -+ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving -+ - this.playerEntity.moveEntity(d11, d12, d13); - this.playerEntity.onGround = packetIn.isOnGround(); - d11 = d8 - this.playerEntity.posX; -@@ -370,6 +374,8 @@ - logger.warn(this.playerEntity.getName() + " moved wrongly!"); - } - -+ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving -+ - this.playerEntity.setPositionAndRotation(d8, d9, d10, f1, f2); - this.playerEntity.addMovementStat(this.playerEntity.posX - d0, this.playerEntity.posY - d1, this.playerEntity.posZ - d2); - -@@ -377,7 +383,7 @@ - { - boolean flag2 = worldserver.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.getEntityBoundingBox().contract((double)f3, (double)f3, (double)f3)).isEmpty(); - -- if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping()) -+ if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping() && !this.playerEntity.noClip) - { - this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, f1, f2); - return; -@@ -405,6 +411,8 @@ - this.floatingTickCount = 0; - } - -+ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving -+ - this.playerEntity.onGround = packetIn.isOnGround(); - this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); - this.playerEntity.handleFalling(this.playerEntity.posY - d7, packetIn.isOnGround()); -@@ -497,7 +505,10 @@ +@@ -612,7 +612,10 @@ double d2 = this.playerEntity.posZ - ((double)blockpos.getZ() + 0.5D); double d3 = d0 * d0 + d1 * d1 + d2 * d2; @@ -57,77 +12,3 @@ { return; } -@@ -549,6 +560,7 @@ - WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); - ItemStack itemstack = this.playerEntity.inventory.getCurrentItem(); - boolean flag = false; -+ boolean placeResult = true; - BlockPos blockpos = packetIn.getPosition(); - EnumFacing enumfacing = EnumFacing.getFront(packetIn.getPlacedBlockDirection()); - this.playerEntity.markPlayerActive(); -@@ -560,13 +572,20 @@ - return; - } - -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(playerEntity, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, worldserver, new BlockPos(0, 0, 0), null, new net.minecraft.util.Vec3(packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ())); -+ if (event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { - this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack); -+ } - } - else if (blockpos.getY() < this.serverController.getBuildLimit() - 1 || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit()) - { -- if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < 64.0D && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) -+ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 3; -+ dist *= dist; -+ if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < dist && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) - { -- this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); -+ // record block place result so we can update client itemstack size if place event was cancelled. -+ placeResult = this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); - } - - flag = true; -@@ -598,12 +617,18 @@ - this.playerEntity.isChangingQuantityOnly = true; - this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = ItemStack.copyItemStack(this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem]); - Slot slot = this.playerEntity.openContainer.getSlotFromInventory(this.playerEntity.inventory, this.playerEntity.inventory.currentItem); -+ int windowId = this.playerEntity.openContainer.windowId; -+ if (slot == null) // Forge: Fix 'slotless' inventories not selecting a valid slot to update -+ { -+ slot = this.playerEntity.inventoryContainer.getSlotFromInventory(this.playerEntity.inventory, this.playerEntity.inventory.currentItem); -+ windowId = this.playerEntity.inventoryContainer.windowId; -+ } - this.playerEntity.openContainer.detectAndSendChanges(); - this.playerEntity.isChangingQuantityOnly = false; - -- if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack())) -+ if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack()) || !placeResult) // force client itemstack update if place event was cancelled - { -- this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); -+ this.sendPacket(new S2FPacketSetSlot(windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); - } - } - } -@@ -770,8 +795,10 @@ - } - else - { -- IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.text", new Object[] {this.playerEntity.getDisplayName(), s}); -- this.serverController.getConfigurationManager().sendChatMsgImpl(ichatcomponent, false); -+ ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", this.playerEntity.getDisplayName(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s)); -+ IChatComponent chat = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, chatcomponenttranslation1); -+ if (chat == null) return; -+ this.serverController.getConfigurationManager().sendChatMsgImpl(chat, false); - } - - this.chatSpamThresholdCount += 20; -@@ -916,7 +943,7 @@ - return; - } - -- this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, 0, false); -+ this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, playerEntity.dimension, false); - } - - break; diff --git a/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch index 6578510e08..454485ec47 100644 --- a/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/network/NetworkManager.java +++ ../src-work/minecraft/net/minecraft/network/NetworkManager.java -@@ -93,6 +93,11 @@ +@@ -89,6 +89,11 @@ this.direction = packetDirection; } @@ -12,7 +12,7 @@ public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception { super.channelActive(p_channelActive_1_); -@@ -208,7 +213,7 @@ +@@ -205,7 +210,7 @@ final EnumConnectionState enumconnectionstate = EnumConnectionState.getFromPacket(inPacket); final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.channel.attr(attrKeyConnectionState).get(); @@ -21,7 +21,7 @@ { logger.debug("Disabled auto read"); this.channel.config().setAutoRead(false); -@@ -216,7 +221,7 @@ +@@ -213,7 +218,7 @@ if (this.channel.eventLoop().inEventLoop()) { @@ -30,7 +30,7 @@ { this.setConnectionState(enumconnectionstate); } -@@ -236,7 +241,7 @@ +@@ -233,7 +238,7 @@ { public void run() { @@ -39,7 +39,7 @@ { NetworkManager.this.setConnectionState(enumconnectionstate); } -@@ -455,6 +460,11 @@ +@@ -452,6 +457,11 @@ } } @@ -50,4 +50,4 @@ + static class InboundHandlerTuplePacketListener { - private final Packet packet; + private final Packet packet; diff --git a/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch index 218327728f..2f2e97b705 100644 --- a/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch +++ b/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/network/NetworkSystem.java +++ ../src-work/minecraft/net/minecraft/network/NetworkSystem.java -@@ -115,7 +115,7 @@ +@@ -111,7 +111,7 @@ ; } -- p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND))); -+ p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND))); +- p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"legacy_query", (ChannelHandler)(new LegacyPingHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new NettyVarint21FrameDecoder())).addLast((String)"decoder", (ChannelHandler)(new NettyPacketDecoder(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new NettyVarint21FrameEncoder())).addLast((String)"encoder", (ChannelHandler)(new NettyPacketEncoder(EnumPacketDirection.CLIENTBOUND))); ++ p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT))).addLast((String)"legacy_query", (ChannelHandler)(new LegacyPingHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new NettyVarint21FrameDecoder())).addLast((String)"decoder", (ChannelHandler)(new NettyPacketDecoder(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new NettyVarint21FrameEncoder())).addLast((String)"encoder", (ChannelHandler)(new NettyPacketEncoder(EnumPacketDirection.CLIENTBOUND))); NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); NetworkSystem.this.networkManagers.add(networkmanager); p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager); diff --git a/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch b/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch index b46a1356ff..e893acae61 100644 --- a/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch +++ b/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch @@ -1,23 +1,23 @@ --- ../src-base/minecraft/net/minecraft/network/ServerStatusResponse.java +++ ../src-work/minecraft/net/minecraft/network/ServerStatusResponse.java @@ -29,6 +29,7 @@ - public void setServerDescription(IChatComponent motd) + public void setServerDescription(ITextComponent motd) { this.serverMotd = motd; + invalidateJson(); } - public ServerStatusResponse.PlayerCountData getPlayerCountData() + public ServerStatusResponse.Players getPlayerCountData() @@ -39,6 +40,7 @@ - public void setPlayerCountData(ServerStatusResponse.PlayerCountData countData) + public void setPlayerCountData(ServerStatusResponse.Players countData) { this.playerCount = countData; + invalidateJson(); } - public ServerStatusResponse.MinecraftProtocolVersionIdentifier getProtocolVersionInfo() + public ServerStatusResponse.Version getProtocolVersionInfo() @@ -49,11 +51,13 @@ - public void setProtocolVersionInfo(ServerStatusResponse.MinecraftProtocolVersionIdentifier protocolVersionData) + public void setProtocolVersionInfo(ServerStatusResponse.Version protocolVersionData) { this.protocolVersion = protocolVersionData; + invalidateJson(); @@ -30,7 +30,7 @@ } public String getFavicon() -@@ -215,6 +219,7 @@ +@@ -176,6 +180,7 @@ serverstatusresponse.setFavicon(JsonUtils.getString(jsonobject, "favicon")); } @@ -38,7 +38,7 @@ return serverstatusresponse; } -@@ -242,7 +247,47 @@ +@@ -203,10 +208,50 @@ jsonobject.addProperty("favicon", p_serialize_1_.getFavicon()); } @@ -46,7 +46,7 @@ return jsonobject; } } -+ + + private java.util.concurrent.Semaphore mutex = new java.util.concurrent.Semaphore(1); + private String json = null; + /** @@ -85,4 +85,7 @@ + { + this.json = null; + } - } ++ + public static class Version + { + private final String name; diff --git a/patches.mcp/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch b/patches.mcp/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java.patch similarity index 71% rename from patches.mcp/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch rename to patches.mcp/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java.patch index 331306c787..1e6382e7d3 100644 --- a/patches.mcp/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch +++ b/patches.mcp/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java.patch @@ -1,5 +1,5 @@ ---- ../src-base/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java -+++ ../src-work/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java +--- ../src-base/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java ++++ ../src-work/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java @@ -47,7 +47,11 @@ public void writePacketData(PacketBuffer buf) throws IOException { diff --git a/patches.mcp/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch b/patches.mcp/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java.patch similarity index 71% rename from patches.mcp/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch rename to patches.mcp/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java.patch index 8218d2cac5..3ec2e8b499 100644 --- a/patches.mcp/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch +++ b/patches.mcp/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java.patch @@ -1,5 +1,5 @@ ---- ../src-base/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java -+++ ../src-work/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java +--- ../src-base/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java ++++ ../src-work/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java @@ -46,7 +46,11 @@ public void writePacketData(PacketBuffer buf) throws IOException { diff --git a/patches.mcp/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch b/patches.mcp/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch deleted file mode 100644 index 086221d574..0000000000 --- a/patches.mcp/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java -+++ ../src-work/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java -@@ -34,7 +34,7 @@ - - public void writePacketData(PacketBuffer buf) throws IOException - { -- buf.writeString(GSON.toJson((Object)this.response)); -+ buf.writeString(this.response.getJson()); - } - - public void processPacket(INetHandlerStatusClient handler) diff --git a/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch b/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch index ed45cdb843..98abf7344b 100644 --- a/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch @@ -1,49 +1,6 @@ --- ../src-base/minecraft/net/minecraft/potion/Potion.java +++ ../src-work/minecraft/net/minecraft/potion/Potion.java -@@ -21,7 +21,7 @@ - - public class Potion - { -- public static final Potion[] potionTypes = new Potion[32]; -+ public static final Potion[] potionTypes = new Potion[256]; - private static final Map field_180150_I = Maps.newHashMap(); - public static final Potion field_180151_b = null; - public static final Potion moveSpeed = (new Potion(1, new ResourceLocation("speed"), false, 8171462)).setPotionName("potion.moveSpeed").setIconIndex(0, 0).registerPotionAttributeModifier(SharedMonsterAttributes.movementSpeed, "91AEAA56-376B-4498-935B-2F7F68070635", 0.20000000298023224D, 2); -@@ -64,10 +64,10 @@ - private double effectiveness; - private boolean usable; - -+ @Deprecated // use the Constructor without potion ID or everything will explode. - protected Potion(int potionID, ResourceLocation location, boolean badEffect, int potionColor) - { -- this.id = potionID; -- potionTypes[potionID] = this; -+ net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().register(potionID, location, this); - field_180150_I.put(location, this); - this.isBadEffect = badEffect; - -@@ -83,14 +83,18 @@ - this.liquidColor = potionColor; - } - -+ protected Potion(ResourceLocation location, boolean badEffect, int potionColor) { -+ this(-1, location, badEffect, potionColor); -+ } -+ - public static Potion getPotionFromResourceLocation(String location) - { -- return (Potion)field_180150_I.get(new ResourceLocation(location)); -+ return net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().getObject(new ResourceLocation(location)); - } - - public static Set getPotionLocations() - { -- return field_180150_I.keySet(); -+ return net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().getKeys(); - } - - protected Potion setIconIndex(int p_76399_1_, int p_76399_2_) -@@ -230,7 +234,6 @@ +@@ -195,7 +195,6 @@ return this.statusIconIndex; } @@ -51,11 +8,10 @@ public boolean isBadEffect() { return this.isBadEffect; -@@ -310,4 +313,34 @@ - { +@@ -266,7 +265,37 @@ return modifier.getAmount() * (double)(p_111183_1_ + 1); } -+ + + /* ======================================== FORGE START =====================================*/ + + /** @@ -83,6 +39,10 @@ + * @param effect the active PotionEffect + * @param mc the Minecraft instance, for convenience + */ -+ @SideOnly(Side.CLIENT) + @SideOnly(Side.CLIENT) + public void renderInventoryEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc) { } - } ++ ++ @SideOnly(Side.CLIENT) + public boolean func_188408_i() + { + return this.field_188415_h; diff --git a/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch index 9ba184d035..ce1861eb1d 100644 --- a/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ b/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch @@ -1,41 +1,6 @@ --- ../src-base/minecraft/net/minecraft/potion/PotionEffect.java +++ ../src-work/minecraft/net/minecraft/potion/PotionEffect.java -@@ -18,6 +18,8 @@ - @SideOnly(Side.CLIENT) - private boolean isPotionDurationMax; - private boolean showParticles; -+ /** List of ItemStack that can cure the potion effect **/ -+ private java.util.List curativeItems; - - public PotionEffect(int id, int effectDuration) - { -@@ -36,6 +38,8 @@ - this.amplifier = effectAmplifier; - this.isAmbient = ambient; - this.showParticles = showParticles; -+ this.curativeItems = new java.util.ArrayList(); -+ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket)); - } - - public PotionEffect(PotionEffect other) -@@ -45,6 +49,7 @@ - this.amplifier = other.amplifier; - this.isAmbient = other.isAmbient; - this.showParticles = other.showParticles; -+ this.curativeItems = other.curativeItems; - } - - public void combine(PotionEffect other) -@@ -190,7 +195,7 @@ - - public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) - { -- int i = nbt.getByte("Id"); -+ int i = nbt.getByte("Id") & 0xff; - - if (i >= 0 && i < Potion.potionTypes.length && Potion.potionTypes[i] != null) - { -@@ -223,4 +228,53 @@ +@@ -240,4 +240,53 @@ { return this.isPotionDurationMax; } diff --git a/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch b/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch index 2aab40a377..43111345ac 100644 --- a/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch +++ b/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch @@ -8,12 +8,3 @@ inetaddress = InetAddress.getByName(p_connect_1_); if (RealmsConnect.this.aborted) -@@ -59,7 +60,7 @@ - return; - } - -- RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); -+ RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true)); - - if (RealmsConnect.this.aborted) - { diff --git a/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch index 8fe34998e9..00b9ef570d 100644 --- a/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java +++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java -@@ -98,7 +98,7 @@ +@@ -100,7 +100,7 @@ @SideOnly(Side.SERVER) private String hostname; private int serverPort = -1; - public WorldServer[] worldServers; + public WorldServer[] worldServers = new WorldServer[0]; - private ServerConfigurationManager serverConfigManager; + private PlayerList serverConfigManager; private boolean serverRunning = true; private boolean serverStopped; -@@ -115,7 +115,8 @@ +@@ -117,7 +117,8 @@ private int buildLimit; private int maxPlayerIdleMinutes = 0; public final long[] tickTimeArray = new long[100]; @@ -19,7 +19,7 @@ private KeyPair serverKeyPair; private String serverOwner; private String folderName; -@@ -227,8 +228,6 @@ +@@ -215,8 +216,6 @@ { this.convertMapIfNeeded(p_71247_1_); this.setUserMessage("menu.loadingLevel"); @@ -28,7 +28,7 @@ ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true); this.setResourcePackFromWorld(this.getFolderName(), isavehandler); WorldInfo worldinfo = isavehandler.loadWorldInfo(); -@@ -259,47 +258,21 @@ +@@ -247,47 +246,21 @@ worldsettings = new WorldSettings(worldinfo); } @@ -84,7 +84,7 @@ this.setDifficultyForAllWorlds(this.getDifficulty()); this.initialWorldChunkLoad(); } -@@ -314,7 +287,7 @@ +@@ -302,7 +275,7 @@ this.setUserMessage("menu.generatingTerrain"); int j1 = 0; logger.info("Preparing start region for level " + j1); @@ -93,40 +93,32 @@ BlockPos blockpos = worldserver.getSpawnPoint(); long k1 = getCurrentTimeMillis(); -@@ -403,7 +376,7 @@ - - public void stopServer() - { -- if (!this.worldIsBeingDeleted) -+ if (!this.worldIsBeingDeleted && net.minecraftforge.fml.common.Loader.instance().hasReachedState(net.minecraftforge.fml.common.LoaderState.SERVER_STARTED) && !serverStopped) // make sure the save is valid and we don't save twice - { - logger.info("Stopping server"); - -@@ -427,8 +400,15 @@ - for (int i = 0; i < this.worldServers.length; ++i) +@@ -420,9 +393,15 @@ + { + if (this.worldServers[j] != null) { - WorldServer worldserver = this.worldServers[i]; -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); - worldserver.flush(); - } -+ -+ WorldServer[] tmp = worldServers; -+ for (WorldServer world : tmp) -+ { -+ net.minecraftforge.common.DimensionManager.setWorld(world.provider.getDimensionId(), null); -+ } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(this.worldServers[j])); } + this.worldServers[j].flush(); +- } } ++ ++ WorldServer[] tmp = worldServers; ++ for (WorldServer world : tmp) ++ { ++ net.minecraftforge.common.DimensionManager.setWorld(world.provider.getDimensionId(), null); ++ } + } - if (this.usageSnooper.isSnooperRunning()) -@@ -460,6 +440,7 @@ + if (this.usageSnooper.isSnooperRunning()) +@@ -447,6 +426,7 @@ { if (this.startServer()) { + net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarted(); this.currentTime = getCurrentTimeMillis(); long i = 0L; - this.statusResponse.setServerDescription(new ChatComponentText(this.motd)); -@@ -504,12 +485,20 @@ + this.statusResponse.setServerDescription(new TextComponentString(this.motd)); +@@ -491,12 +471,20 @@ Thread.sleep(Math.max(1L, 50L - i)); this.serverIsRunning = true; } @@ -147,7 +139,7 @@ catch (Throwable throwable1) { logger.error("Encountered an unexpected exception", throwable1); -@@ -535,14 +524,15 @@ +@@ -522,14 +510,15 @@ logger.error("We were unable to save this crash report to disk."); } @@ -164,7 +156,7 @@ } catch (Throwable throwable) { -@@ -550,6 +540,8 @@ +@@ -537,6 +526,8 @@ } finally { @@ -173,7 +165,7 @@ this.systemExitNow(); } } -@@ -599,6 +591,7 @@ +@@ -604,6 +595,7 @@ public void tick() { long i = System.nanoTime(); @@ -181,7 +173,7 @@ ++this.tickCounter; if (this.startProfiling) -@@ -625,6 +618,7 @@ +@@ -630,6 +622,7 @@ Collections.shuffle(Arrays.asList(agameprofile)); this.statusResponse.getPlayerCountData().setPlayers(agameprofile); @@ -189,7 +181,7 @@ } if (this.tickCounter % 900 == 0) -@@ -652,6 +646,7 @@ +@@ -657,6 +650,7 @@ this.theProfiler.endSection(); this.theProfiler.endSection(); @@ -197,7 +189,7 @@ } public void updateTimeLightAndEntities() -@@ -667,14 +662,17 @@ +@@ -672,14 +666,17 @@ } this.theProfiler.endStartSection("levels"); @@ -218,7 +210,7 @@ this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); if (this.tickCounter % 20 == 0) -@@ -685,6 +683,7 @@ +@@ -690,6 +687,7 @@ } this.theProfiler.startSection("tick"); @@ -226,7 +218,7 @@ try { -@@ -708,6 +707,7 @@ +@@ -713,6 +711,7 @@ throw new ReportedException(crashreport1); } @@ -234,7 +226,7 @@ this.theProfiler.endSection(); this.theProfiler.startSection("tracker"); worldserver.getEntityTracker().updateTrackedEntities(); -@@ -715,9 +715,11 @@ +@@ -720,9 +719,11 @@ this.theProfiler.endSection(); } @@ -247,7 +239,7 @@ this.theProfiler.endStartSection("connection"); this.getNetworkSystem().networkTick(); this.theProfiler.endStartSection("players"); -@@ -739,6 +741,7 @@ +@@ -744,6 +745,7 @@ public void startServerThread() { @@ -255,7 +247,7 @@ this.serverThread = new Thread(this, "Server thread"); this.serverThread.start(); } -@@ -755,7 +758,13 @@ +@@ -760,7 +762,13 @@ public WorldServer worldServerForDimension(int dimension) { @@ -270,7 +262,7 @@ } public String getMinecraftVersion() -@@ -785,7 +794,7 @@ +@@ -790,7 +798,7 @@ public String getServerModName() { @@ -279,11 +271,3 @@ } public CrashReport addServerInfoToCrashReport(CrashReport report) -@@ -996,6 +1005,7 @@ - - if (worldserver != null) - { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); - worldserver.flush(); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index 770752bbb7..f2415104a2 100644 --- a/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java +++ ../src-work/minecraft/net/minecraft/server/dedicated/DedicatedServer.java -@@ -49,6 +49,7 @@ +@@ -56,6 +56,7 @@ private boolean canSpawnStructures; private WorldSettings.GameType gameType; private boolean guiIsEnabled; + public static boolean allowPlayerLogins = false; - public DedicatedServer(File workDir) + public DedicatedServer(File p_i47086_1_, DataFixer p_i47086_2_, YggdrasilAuthenticationService p_i47086_3_, MinecraftSessionService p_i47086_4_, GameProfileRepository p_i47086_5_, PlayerProfileCache p_i47086_6_) { -@@ -82,6 +83,7 @@ +@@ -89,6 +90,7 @@ { public void run() { @@ -16,7 +16,7 @@ BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in)); String s4; -@@ -107,6 +109,8 @@ +@@ -114,6 +116,8 @@ logger.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } @@ -25,23 +25,7 @@ logger.info("Loading properties"); this.settings = new PropertyManager(new File("server.properties")); this.eula = new ServerEula(new File("eula.txt")); -@@ -198,6 +202,7 @@ - } - else - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStarted(); - this.setConfigManager(new DedicatedPlayerList(this)); - long j = System.nanoTime(); - -@@ -244,6 +249,7 @@ - this.setBuildLimit((this.getBuildLimit() + 8) / 16 * 16); - this.setBuildLimit(MathHelper.clamp_int(this.getBuildLimit(), 64, 256)); - this.settings.setProperty("max-build-height", Integer.valueOf(this.getBuildLimit())); -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; - logger.info("Preparing level \"" + this.getFolderName() + "\""); - this.loadAllWorlds(this.getFolderName(), this.getFolderName(), k, worldtype, s2); - long i1 = System.nanoTime() - j; -@@ -272,7 +278,7 @@ +@@ -282,7 +286,7 @@ thread1.start(); } @@ -50,11 +34,13 @@ } } } -@@ -621,4 +627,7 @@ - this.commandManager.executeCommand(RConConsoleSource.getInstance(), command); - return RConConsoleSource.getInstance().getLogContents(); +@@ -580,6 +584,9 @@ + return this.settings.getIntProperty("network-compression-threshold", super.getNetworkCompressionTreshold()); } -+ + + //Forge: Enable formated text for colors in console. + @Override public void addChatMessage(net.minecraft.util.IChatComponent message) { logger.info(message.getFormattedText()); } - } ++ + protected boolean convertFiles() throws IOException + { + boolean flag = false; diff --git a/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch index 1aca6a5bcf..36c6157638 100644 --- a/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch +++ b/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/server/gui/MinecraftServerGui.java +++ ../src-work/minecraft/net/minecraft/server/gui/MinecraftServerGui.java -@@ -78,6 +78,7 @@ +@@ -77,6 +77,7 @@ System.exit(0); } }); @@ -8,7 +8,7 @@ } public MinecraftServerGui(DedicatedServer serverIn) -@@ -162,8 +163,13 @@ +@@ -161,8 +162,13 @@ return jpanel; } diff --git a/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch index 6b4e353d1e..51bc84dfe0 100644 --- a/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java +++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java -@@ -71,8 +71,6 @@ +@@ -68,8 +68,6 @@ protected void loadAllWorlds(String p_71247_1_, String p_71247_2_, long seed, WorldType type, String p_71247_6_) { this.convertMapIfNeeded(p_71247_1_); @@ -9,64 +9,7 @@ ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(p_71247_1_, true); this.setResourcePackFromWorld(this.getFolderName(), isavehandler); WorldInfo worldinfo = isavehandler.loadWorldInfo(); -@@ -86,44 +84,24 @@ - worldinfo.setWorldName(p_71247_2_); - } - -- for (int i = 0; i < this.worldServers.length; ++i) -- { -- int j = 0; -+ WorldServer overWorld = (isDemo() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init() : -+ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init()); -+ overWorld.initialize(this.theWorldSettings); - -- if (i == 1) -+ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) -+ { -+ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.theProfiler)).init()); -+ world.addWorldAccess(new WorldManager(this, world)); -+ if (!this.isSinglePlayer()) - { -- j = -1; -+ world.getWorldInfo().setGameType(getGameType()); - } -- -- if (i == 2) -- { -- j = 1; -- } -- -- if (i == 0) -- { -- if (this.isDemo()) -- { -- this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); -- } -- else -- { -- this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); -- } -- -- this.worldServers[i].initialize(this.theWorldSettings); -- } -- else -- { -- this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); -- } -- -- this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); - } - -- this.getConfigurationManager().setPlayerManager(this.worldServers); -+ this.getConfigurationManager().setPlayerManager(new WorldServer[]{ overWorld }); - -- if (this.worldServers[0].getWorldInfo().getDifficulty() == null) -+ if (overWorld.getWorldInfo().getDifficulty() == null) - { - this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); - } -@@ -141,9 +119,10 @@ +@@ -138,9 +136,10 @@ this.setAllowFlight(true); logger.info("Generating keypair"); this.setKeyPair(CryptManager.generateKeyPair()); @@ -78,7 +21,7 @@ } public void tick() -@@ -216,6 +195,7 @@ +@@ -213,6 +212,7 @@ public EnumDifficulty getDifficulty() { diff --git a/patches.mcp/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch deleted file mode 100644 index 6d0ff4dda3..0000000000 --- a/patches.mcp/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch +++ /dev/null @@ -1,266 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/ItemInWorldManager.java -+++ ../src-work/minecraft/net/minecraft/server/management/ItemInWorldManager.java -@@ -22,6 +22,8 @@ - - public class ItemInWorldManager - { -+ /** Forge reach distance */ -+ private double blockReachDistance = 5.0d; - public World theWorld; - public EntityPlayerMP thisPlayerMP; - private WorldSettings.GameType gameType = WorldSettings.GameType.NOT_SET; -@@ -116,7 +118,7 @@ - else - { - int k = this.curblockDamage - this.initialDamage; -- float f1 = block1.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180241_i) * (float)(k + 1); -+ float f1 = block1.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180240_f) * (float)(k + 1); //Forge: Fix network break progress using wrong position - int l = (int)(f1 * 10.0F); - - if (l != this.durabilityRemainingOnBlock) -@@ -130,6 +132,14 @@ - - public void onBlockClicked(BlockPos pos, EnumFacing side) - { -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thisPlayerMP, -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, theWorld, pos, side, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(thisPlayerMP, getBlockReachDistance() + 1)); -+ if (event.isCanceled()) -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); -+ return; -+ } -+ - if (this.isCreative()) - { - if (!this.theWorld.extinguishFire((EntityPlayer)null, pos, side)) -@@ -164,18 +174,35 @@ - } - } - -- this.theWorld.extinguishFire((EntityPlayer)null, pos, side); -+ // - this.initialDamage = this.curblockDamage; - float f = 1.0F; - -- if (block.getMaterial() != Material.air) -+ if (!block.isAir(theWorld, pos)) - { -- block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); -+ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); -+ this.theWorld.extinguishFire((EntityPlayer)null, pos, side); -+ } -+ else -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); -+ } - f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos); - } - -- if (block.getMaterial() != Material.air && f >= 1.0F) -+ if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) - { -+ if (f >= 1.0F) -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); -+ } -+ return; -+ } -+ -+ if (!block.isAir(theWorld, pos) && f >= 1.0F) -+ { - this.tryHarvestBlock(pos); - } - else -@@ -196,7 +223,7 @@ - int i = this.curblockDamage - this.initialDamage; - Block block = this.theWorld.getBlockState(pos).getBlock(); - -- if (block.getMaterial() != Material.air) -+ if (!block.isAir(theWorld, pos)) - { - float f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos) * (float)(i + 1); - -@@ -225,9 +252,13 @@ - - private boolean removeBlock(BlockPos pos) - { -+ return removeBlock(pos, false); -+ } -+ private boolean removeBlock(BlockPos pos, boolean canHarvest) -+ { - IBlockState iblockstate = this.theWorld.getBlockState(pos); - iblockstate.getBlock().onBlockHarvested(this.theWorld, pos, iblockstate, this.thisPlayerMP); -- boolean flag = this.theWorld.setBlockToAir(pos); -+ boolean flag = iblockstate.getBlock().removedByPlayer(theWorld, pos, thisPlayerMP, canHarvest); - - if (flag) - { -@@ -239,7 +270,8 @@ - - public boolean tryHarvestBlock(BlockPos pos) - { -- if (this.gameType.isCreative() && this.thisPlayerMP.getHeldItem() != null && this.thisPlayerMP.getHeldItem().getItem() instanceof ItemSword) -+ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(theWorld, gameType, thisPlayerMP, pos); -+ if (exp == -1) - { - return false; - } -@@ -248,40 +280,21 @@ - IBlockState iblockstate = this.theWorld.getBlockState(pos); - TileEntity tileentity = this.theWorld.getTileEntity(pos); - -- if (this.gameType.isAdventure()) -- { -- if (this.gameType == WorldSettings.GameType.SPECTATOR) -- { -- return false; -- } -+ ItemStack stack = thisPlayerMP.getCurrentEquippedItem(); -+ if (stack != null && stack.getItem().onBlockStartBreak(stack, pos, thisPlayerMP)) return false; - -- if (!this.thisPlayerMP.isAllowEdit()) -- { -- ItemStack itemstack = this.thisPlayerMP.getCurrentEquippedItem(); -- -- if (itemstack == null) -- { -- return false; -- } -- -- if (!itemstack.canDestroy(iblockstate.getBlock())) -- { -- return false; -- } -- } -- } -- - this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, pos, Block.getStateId(iblockstate)); -- boolean flag1 = this.removeBlock(pos); -+ boolean flag1 = false; - - if (this.isCreative()) - { -+ flag1 = this.removeBlock(pos); - this.thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(this.theWorld, pos)); - } - else - { - ItemStack itemstack1 = this.thisPlayerMP.getCurrentEquippedItem(); -- boolean flag = this.thisPlayerMP.canHarvestBlock(iblockstate.getBlock()); -+ boolean flag = iblockstate.getBlock().canHarvestBlock(theWorld, pos, thisPlayerMP); - - if (itemstack1 != null) - { -@@ -293,12 +306,18 @@ - } - } - -+ flag1 = this.removeBlock(pos, flag); - if (flag1 && flag) - { - iblockstate.getBlock().harvestBlock(this.theWorld, this.thisPlayerMP, pos, iblockstate, tileentity); - } - } - -+ // Drop experiance -+ if (!this.isCreative() && flag1 && exp > 0) -+ { -+ iblockstate.getBlock().dropXpOnBlockBreak(theWorld, pos, exp); -+ } - return flag1; - } - } -@@ -332,6 +351,7 @@ - if (itemstack.stackSize == 0) - { - player.inventory.mainInventory[player.inventory.currentItem] = null; -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemstack); - } - - if (!player.isUsingItem()) -@@ -380,33 +400,51 @@ - } - else - { -- if (!player.isSneaking() || player.getHeldItem() == null) -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(player, -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, worldIn, pos, side, new net.minecraft.util.Vec3(offsetX, offsetY, offsetZ)); -+ if (event.isCanceled()) - { -- IBlockState iblockstate = worldIn.getBlockState(pos); -- -- if (iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, offsetX, offsetY, offsetZ)) -- { -- return true; -- } -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); -+ return false; - } - -- if (stack == null) -+ if (stack != null && stack.getItem().onItemUseFirst(stack, player, worldIn, pos, side, offsetX, offsetY, offsetZ)) - { -- return false; -+ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); -+ return true; - } -- else if (this.isCreative()) -+ -+ IBlockState iblockstate = worldIn.getBlockState(pos); -+ boolean isAir = worldIn.isAirBlock(pos); -+ boolean useBlock = !player.isSneaking() || player.getHeldItem() == null; -+ if (!useBlock) useBlock = player.getHeldItem().getItem().doesSneakBypassUse(worldIn, pos, player); -+ boolean result = false; -+ -+ if (useBlock) - { -- int j = stack.getMetadata(); -- int i = stack.stackSize; -- boolean flag = stack.onItemUse(player, worldIn, pos, side, offsetX, offsetY, offsetZ); -- stack.setItemDamage(j); -- stack.stackSize = i; -- return flag; -+ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ result = iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, offsetX, offsetY, offsetZ); -+ } -+ else -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); -+ result = event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW; -+ } - } -- else -+ if (stack != null && !result && event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) - { -- return stack.onItemUse(player, worldIn, pos, side, offsetX, offsetY, offsetZ); -+ int meta = stack.getMetadata(); -+ int size = stack.stackSize; -+ result = stack.onItemUse(player, worldIn, pos, side, offsetX, offsetY, offsetZ); -+ if (isCreative()) -+ { -+ stack.setItemDamage(meta); -+ stack.stackSize = size; -+ } -+ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); - } -+ return result; - } - } - -@@ -414,4 +452,13 @@ - { - this.theWorld = serverWorld; - } -+ -+ public double getBlockReachDistance() -+ { -+ return blockReachDistance; -+ } -+ public void setBlockReachDistance(double distance) -+ { -+ blockReachDistance = distance; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch index d0bc684553..a4e9541950 100644 --- a/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch @@ -1,32 +1,6 @@ --- ../src-base/minecraft/net/minecraft/server/management/PlayerManager.java +++ ../src-work/minecraft/net/minecraft/server/management/PlayerManager.java -@@ -117,15 +117,24 @@ - int j = (int)player.posZ >> 4; - player.managedPosX = player.posX; - player.managedPosZ = player.posZ; -+ // Load nearby chunks first -+ List chunkList = Lists.newArrayList(); - - for (int k = i - this.playerViewRadius; k <= i + this.playerViewRadius; ++k) - { - for (int l = j - this.playerViewRadius; l <= j + this.playerViewRadius; ++l) - { -- this.getPlayerInstance(k, l, true).addPlayer(player); -+ chunkList.add(new ChunkCoordIntPair(k, l)); - } - } - -+ java.util.Collections.sort(chunkList, new net.minecraftforge.common.util.ChunkCoordComparator(player)); -+ -+ for (ChunkCoordIntPair pair : chunkList) -+ { -+ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(player); -+ } -+ - this.players.add(player); - this.filterChunkLoadQueue(player); - } -@@ -225,6 +234,7 @@ +@@ -338,6 +338,7 @@ int i1 = this.playerViewRadius; int j1 = i - k; int k1 = j - l; @@ -34,187 +8,3 @@ if (j1 != 0 || k1 != 0) { -@@ -234,7 +244,7 @@ - { - if (!this.overlaps(l1, i2, k, l, i1)) - { -- this.getPlayerInstance(l1, i2, true).addPlayer(player); -+ chunksToLoad.add(new ChunkCoordIntPair(l1, i2)); - } - - if (!this.overlaps(l1 - j1, i2 - k1, i, j, i1)) -@@ -252,6 +262,18 @@ - this.filterChunkLoadQueue(player); - player.managedPosX = player.posX; - player.managedPosZ = player.posZ; -+ // send nearest chunks first -+ java.util.Collections.sort(chunksToLoad, new net.minecraftforge.common.util.ChunkCoordComparator(player)); -+ -+ for (ChunkCoordIntPair pair : chunksToLoad) -+ { -+ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(player); -+ } -+ -+ if (i1 > 1 || i1 < -1 || j1 > 1 || j1 < -1) -+ { -+ java.util.Collections.sort(player.loadedChunks, new net.minecraftforge.common.util.ChunkCoordComparator(player)); -+ } - } - } - } -@@ -322,11 +344,20 @@ - private int numBlocksToUpdate; - private int flagsYAreasToUpdate; - private long previousWorldTime; -+ private final java.util.HashMap players = new java.util.HashMap(); -+ private boolean loaded = false; -+ private Runnable loadedRunnable = new Runnable() -+ { -+ public void run() -+ { -+ PlayerInstance.this.loaded = true; -+ } -+ }; - - public PlayerInstance(int chunkX, int chunkZ) - { - this.chunkCoords = new ChunkCoordIntPair(chunkX, chunkZ); -- PlayerManager.this.getWorldServer().theChunkProviderServer.loadChunk(chunkX, chunkZ); -+ PlayerManager.this.getWorldServer().theChunkProviderServer.loadChunk(chunkX, chunkZ, this.loadedRunnable); - } - - public void addPlayer(EntityPlayerMP player) -@@ -343,7 +374,24 @@ - } - - this.playersWatchingChunk.add(player); -+ Runnable playerRunnable = null; -+ if (this.loaded) -+ { - player.loadedChunks.add(this.chunkCoords); -+ } -+ else -+ { -+ final EntityPlayerMP tmp = player; -+ playerRunnable = new Runnable() -+ { -+ public void run() -+ { -+ tmp.loadedChunks.add(PlayerInstance.this.chunkCoords); -+ } -+ }; -+ PlayerManager.this.getWorldServer().theChunkProviderServer.loadChunk(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, playerRunnable); -+ } -+ this.players.put(player, playerRunnable); - } - } - -@@ -351,6 +399,24 @@ - { - if (this.playersWatchingChunk.contains(player)) - { -+ // If we haven't loaded yet don't load the chunk just so we can clean it up -+ if (!this.loaded) -+ { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getWorldServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.players.get(player)); -+ this.playersWatchingChunk.remove(player); -+ this.players.remove(player); -+ -+ if (this.playersWatchingChunk.isEmpty()) -+ { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getWorldServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.loadedRunnable); -+ long i = (long) this.chunkCoords.chunkXPos + 2147483647L | (long) this.chunkCoords.chunkZPos + 2147483647L << 32; -+ PlayerManager.this.playerInstances.remove(i); -+ PlayerManager.this.playerInstanceList.remove(this); -+ } -+ -+ return; -+ } -+ - Chunk chunk = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos); - - if (chunk.isPopulated()) -@@ -358,9 +424,12 @@ - player.playerNetServerHandler.sendPacket(new S21PacketChunkData(chunk, true, 0)); - } - -+ this.players.remove(player); - this.playersWatchingChunk.remove(player); - player.loadedChunks.remove(this.chunkCoords); - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.UnWatch(chunkCoords, player)); -+ - if (this.playersWatchingChunk.isEmpty()) - { - long i = (long)this.chunkCoords.chunkXPos + 2147483647L | (long)this.chunkCoords.chunkZPos + 2147483647L << 32; -@@ -398,7 +467,7 @@ - - this.flagsYAreasToUpdate |= 1 << (y >> 4); - -- if (this.numBlocksToUpdate < 64) -+ //Forge; Cache everything, so always run - { - short short1 = (short)(x << 12 | z << 8 | y); - -@@ -410,6 +479,10 @@ - } - } - -+ if (numBlocksToUpdate == locationOfBlockChange.length) -+ { -+ locationOfBlockChange = java.util.Arrays.copyOf(locationOfBlockChange, locationOfBlockChange.length << 1); -+ } - this.locationOfBlockChange[this.numBlocksToUpdate++] = short1; - } - } -@@ -427,6 +500,7 @@ - } - } - -+ @SuppressWarnings("unused") - public void onUpdate() - { - if (this.numBlocksToUpdate != 0) -@@ -439,18 +513,19 @@ - BlockPos blockpos = new BlockPos(i, j, k); - this.sendToAllPlayersWatchingChunk(new S23PacketBlockChange(PlayerManager.this.theWorldServer, blockpos)); - -- if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity()) -+ if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity(PlayerManager.this.theWorldServer.getBlockState(blockpos))) - { - this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos)); - } - } -- else if (this.numBlocksToUpdate == 64) -+ else if (this.numBlocksToUpdate >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) - { - int i1 = this.chunkCoords.chunkXPos * 16; - int k1 = this.chunkCoords.chunkZPos * 16; - this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), false, this.flagsYAreasToUpdate)); - -- for (int i2 = 0; i2 < 16; ++i2) -+ // Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones -+ for (int i2 = 0; false && i2 < 16; ++i2) - { - if ((this.flagsYAreasToUpdate & 1 << i2) != 0) - { -@@ -467,7 +542,9 @@ - else - { - this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos))); -- -+ } -+ { // Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small -+ WorldServer world = PlayerManager.this.theWorldServer; - for (int j1 = 0; j1 < this.numBlocksToUpdate; ++j1) - { - int l1 = (this.locationOfBlockChange[j1] >> 12 & 15) + this.chunkCoords.chunkXPos * 16; -@@ -475,7 +552,7 @@ - int l2 = (this.locationOfBlockChange[j1] >> 8 & 15) + this.chunkCoords.chunkZPos * 16; - BlockPos blockpos1 = new BlockPos(l1, j2, l2); - -- if (PlayerManager.this.theWorldServer.getBlockState(blockpos1).getBlock().hasTileEntity()) -+ if (world.getBlockState(blockpos1).getBlock().hasTileEntity(world.getBlockState(blockpos1))) - { - this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos1)); - } diff --git a/patches.mcp/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch deleted file mode 100644 index 14c98b3ca8..0000000000 --- a/patches.mcp/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ /dev/null @@ -1,223 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java -+++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java -@@ -99,7 +99,7 @@ - this.maxPlayers = 8; - } - -- public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn) -+ public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn, NetHandlerPlayServer nethandlerplayserver) - { - GameProfile gameprofile = playerIn.getGameProfile(); - PlayerProfileCache playerprofilecache = this.mcServer.getPlayerProfileCache(); -@@ -108,6 +108,17 @@ - playerprofilecache.addEntry(gameprofile); - NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(playerIn); - playerIn.setWorld(this.mcServer.worldServerForDimension(playerIn.dimension)); -+ -+ World playerWorld = this.mcServer.worldServerForDimension(playerIn.dimension); -+ if (playerWorld == null) -+ { -+ playerIn.dimension=0; -+ playerWorld=this.mcServer.worldServerForDimension(0); -+ BlockPos spawnPoint = playerWorld.provider.getRandomizedSpawnPoint(); -+ playerIn.setPosition(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ()); -+ } -+ -+ playerIn.setWorld(playerWorld); - playerIn.theItemInWorldManager.setWorld((WorldServer)playerIn.worldObj); - String s1 = "local"; - -@@ -121,7 +132,7 @@ - WorldInfo worldinfo = worldserver.getWorldInfo(); - BlockPos blockpos = worldserver.getSpawnPoint(); - this.setPlayerGameTypeBasedOnOther(playerIn, (EntityPlayerMP)null, worldserver); -- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.mcServer, netManager, playerIn); -+ playerIn.playerNetServerHandler = nethandlerplayserver; - nethandlerplayserver.sendPacket(new S01PacketJoinGame(playerIn.getEntityId(), playerIn.theItemInWorldManager.getGameType(), worldinfo.isHardcoreModeEnabled(), worldserver.provider.getDimensionId(), worldserver.getDifficulty(), this.getMaxPlayers(), worldinfo.getTerrainType(), worldserver.getGameRules().getBoolean("reducedDebugInfo"))); - nethandlerplayserver.sendPacket(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(this.getServerInstance().getServerModName()))); - nethandlerplayserver.sendPacket(new S41PacketServerDifficulty(worldinfo.getDifficulty(), worldinfo.isDifficultyLocked())); -@@ -161,6 +172,7 @@ - - playerIn.addSelfToInternalCraftingInventory(); - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(playerIn); - if (nbttagcompound != null && nbttagcompound.hasKey("Riding", 10)) - { - Entity entity = EntityList.createEntityFromNBT(nbttagcompound.getCompoundTag("Riding"), worldserver); -@@ -262,6 +274,7 @@ - playerIn.readFromNBT(nbttagcompound); - nbttagcompound1 = nbttagcompound; - logger.debug("loading single player"); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(playerIn, this.playerNBTManagerObj, playerIn.getUniqueID().toString()); - } - else - { -@@ -271,8 +284,23 @@ - return nbttagcompound1; - } - -+ public NBTTagCompound getPlayerNBT(EntityPlayerMP player) -+ { -+ // Hacky method to allow loading the NBT for a player prior to login -+ NBTTagCompound nbttagcompound = this.mcServer.worldServers[0].getWorldInfo().getPlayerNBTTagCompound(); -+ if (player.getName().equals(this.mcServer.getServerOwner()) && nbttagcompound != null) -+ { -+ return nbttagcompound; -+ } -+ else -+ { -+ return ((net.minecraft.world.storage.SaveHandler)this.playerNBTManagerObj).getPlayerNBT(player); -+ } -+ } - protected void writePlayerData(EntityPlayerMP playerIn) - { -+ if (playerIn.playerNetServerHandler == null) return; -+ - this.playerNBTManagerObj.writePlayerData(playerIn); - StatisticsFile statisticsfile = (StatisticsFile)this.playerStatFiles.get(playerIn.getUniqueID()); - -@@ -288,6 +316,7 @@ - this.uuidToPlayerMap.put(playerIn.getUniqueID(), playerIn); - this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {playerIn})); - WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); - worldserver.spawnEntityInWorld(playerIn); - this.preparePlayer(playerIn, (WorldServer)null); - -@@ -305,6 +334,7 @@ - - public void playerLoggedOut(EntityPlayerMP playerIn) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(playerIn); - playerIn.triggerAchievement(StatList.leaveGameStat); - this.writePlayerData(playerIn); - WorldServer worldserver = playerIn.getServerForPlayer(); -@@ -326,6 +356,7 @@ - this.uuidToPlayerMap.remove(uuid); - this.playerStatFiles.remove(uuid); - } -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); - - this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn})); - } -@@ -409,13 +440,23 @@ - - public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd) - { -+ World world = mcServer.worldServerForDimension(dimension); -+ if (world == null) -+ { -+ dimension = 0; -+ } -+ else if (!world.provider.canRespawnHere()) -+ { -+ dimension = world.provider.getRespawnDimension(playerIn); -+ } -+ - playerIn.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(playerIn); - playerIn.getServerForPlayer().getEntityTracker().untrackEntity(playerIn); - playerIn.getServerForPlayer().getPlayerManager().removePlayer(playerIn); - this.playerEntityList.remove(playerIn); - this.mcServer.worldServerForDimension(playerIn.dimension).removePlayerEntityDangerously(playerIn); -- BlockPos blockpos = playerIn.getBedLocation(); -- boolean flag = playerIn.isSpawnForced(); -+ BlockPos blockpos = playerIn.getBedLocation(dimension); -+ boolean flag = playerIn.isSpawnForced(dimension); - playerIn.dimension = dimension; - ItemInWorldManager iteminworldmanager; - -@@ -431,6 +472,7 @@ - EntityPlayerMP entityplayermp = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), iteminworldmanager); - entityplayermp.playerNetServerHandler = playerIn.playerNetServerHandler; - entityplayermp.clonePlayer(playerIn, conqueredEnd); -+ entityplayermp.dimension = dimension; - entityplayermp.setEntityId(playerIn.getEntityId()); - entityplayermp.func_174817_o(playerIn); - WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); -@@ -470,19 +512,25 @@ - this.uuidToPlayerMap.put(entityplayermp.getUniqueID(), entityplayermp); - entityplayermp.addSelfToInternalCraftingInventory(); - entityplayermp.setHealth(entityplayermp.getHealth()); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp); - return entityplayermp; - } - - public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension) - { -+ transferPlayerToDimension(playerIn, dimension, mcServer.worldServerForDimension(dimension).getDefaultTeleporter()); -+ } -+ -+ public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension, net.minecraft.world.Teleporter teleporter) -+ { - int i = playerIn.dimension; - WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); - playerIn.dimension = dimension; - WorldServer worldserver1 = this.mcServer.worldServerForDimension(playerIn.dimension); -- playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, playerIn.worldObj.getDifficulty(), playerIn.worldObj.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); -+ playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); - worldserver.removePlayerEntityDangerously(playerIn); - playerIn.isDead = false; -- this.transferEntityToWorld(playerIn, i, worldserver, worldserver1); -+ this.transferEntityToWorld(playerIn, i, worldserver, worldserver1, teleporter); - this.preparePlayer(playerIn, worldserver); - playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch); - playerIn.theItemInWorldManager.setWorld(worldserver1); -@@ -493,17 +541,27 @@ - { - playerIn.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), potioneffect)); - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(playerIn, i, dimension); - } - - public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) - { -- double d0 = entityIn.posX; -- double d1 = entityIn.posZ; -+ transferEntityToWorld(entityIn, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.getDefaultTeleporter()); -+ } -+ -+ @SuppressWarnings("unused") -+ public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter) -+ { -+ net.minecraft.world.WorldProvider pOld = p_82448_3_.provider; -+ net.minecraft.world.WorldProvider pNew = p_82448_4_.provider; -+ double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor(); -+ double d0 = entityIn.posX * moveFactor; -+ double d1 = entityIn.posZ * moveFactor; - double d2 = 8.0D; - float f = entityIn.rotationYaw; - p_82448_3_.theProfiler.startSection("moving"); - -- if (entityIn.dimension == -1) -+ if (false && entityIn.dimension == -1) //Forge Kill it but dont comment out so we can rename it. - { - d0 = MathHelper.clamp_double(d0 / d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); - d1 = MathHelper.clamp_double(d1 / d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); -@@ -514,7 +572,7 @@ - p_82448_3_.updateEntityWithOptionalForce(entityIn, false); - } - } -- else if (entityIn.dimension == 0) -+ else if (false && entityIn.dimension == 0) //Forge Kill it but dont comment out so we can rename it. - { - d0 = MathHelper.clamp_double(d0 * d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); - d1 = MathHelper.clamp_double(d1 * d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); -@@ -525,7 +583,8 @@ - p_82448_3_.updateEntityWithOptionalForce(entityIn, false); - } - } -- else -+ -+ if (entityIn.dimension == 1) - { - BlockPos blockpos; - -@@ -560,7 +619,7 @@ - if (entityIn.isEntityAlive()) - { - entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch); -- p_82448_4_.getDefaultTeleporter().placeInPortal(entityIn, f); -+ teleporter.placeInPortal(entityIn, f); - p_82448_4_.spawnEntityInWorld(entityIn); - p_82448_4_.updateEntityWithOptionalForce(entityIn, false); - } diff --git a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch index 207663b904..eab396c8e8 100644 --- a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch @@ -1,26 +1,20 @@ --- ../src-base/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java +++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java -@@ -66,12 +66,12 @@ +@@ -66,7 +66,7 @@ if (entityplayermp == null) { this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; -- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.field_181025_l); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.field_181025_l); +- this.server.func_184103_al().initializeConnectionToPlayer(this.networkManager, this.field_181025_l); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.func_184103_al(), this.networkManager, this.field_181025_l); this.field_181025_l = null; } } - -- if (this.connectionTimer++ == 600) -+ if (this.connectionTimer++ == net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.LOGIN_TIMEOUT) - { - this.closeConnection("Took too long to log in"); - } @@ -130,7 +130,7 @@ } else { -- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); +- this.server.func_184103_al().initializeConnectionToPlayer(this.networkManager, this.server.func_184103_al().createPlayerForUser(this.loginGameProfile)); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.func_184103_al(), this.networkManager, this.server.func_184103_al().createPlayerForUser(this.loginGameProfile)); } } } diff --git a/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch b/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch index 1a464c5e9a..07dbb29fe2 100644 --- a/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch +++ b/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch @@ -1,24 +1,6 @@ --- ../src-base/minecraft/net/minecraft/stats/StatList.java +++ ../src-work/minecraft/net/minecraft/stats/StatList.java -@@ -119,7 +119,7 @@ - } - } - -- replaceAllSimilarBlocks(objectCraftStats); -+ replaceAllSimilarBlocks(objectCraftStats, true); - } - - private static void initMiningStats() -@@ -141,7 +141,7 @@ - } - } - -- replaceAllSimilarBlocks(mineBlockStatArray); -+ replaceAllSimilarBlocks(mineBlockStatArray, false); - } - - private static void initStats() -@@ -165,7 +165,7 @@ +@@ -201,7 +201,7 @@ } } @@ -27,7 +9,7 @@ } private static void initItemDepleteStats() -@@ -184,7 +184,7 @@ +@@ -240,7 +240,7 @@ } } @@ -36,7 +18,7 @@ } private static String func_180204_a(Item p_180204_0_) -@@ -193,28 +193,35 @@ +@@ -249,28 +249,35 @@ return resourcelocation != null ? resourcelocation.toString().replace(':', '.') : null; } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch index 241001f4b5..61a5ea7079 100644 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java -@@ -17,7 +17,7 @@ +@@ -18,7 +18,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,7 +9,7 @@ { private static final Logger logger = LogManager.getLogger(); private static Map < String, Class > nameToClassMap = Maps. < String, Class > newHashMap(); -@@ -59,6 +59,8 @@ +@@ -60,6 +60,8 @@ public void readFromNBT(NBTTagCompound compound) { this.pos = new BlockPos(compound.getInteger("x"), compound.getInteger("y"), compound.getInteger("z")); @@ -18,7 +18,7 @@ } public void writeToNBT(NBTTagCompound compound) -@@ -75,6 +77,8 @@ +@@ -76,6 +78,8 @@ compound.setInteger("x", this.pos.getX()); compound.setInteger("y", this.pos.getY()); compound.setInteger("z", this.pos.getZ()); @@ -27,37 +27,7 @@ } } -@@ -82,9 +86,10 @@ - { - TileEntity tileentity = null; - -+ Class oclass = null; - try - { -- Class oclass = (Class)nameToClassMap.get(nbt.getString("id")); -+ oclass = (Class)nameToClassMap.get(nbt.getString("id")); - - if (oclass != null) - { -@@ -102,7 +107,17 @@ - } - else - { -+ try -+ { - logger.warn("Skipping BlockEntity with id " + nbt.getString("id")); -+ } -+ catch (Exception ex) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex, -+ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ nbt.getString("id"), oclass.getName()); -+ tileentity = null; -+ } - } - - return tileentity; -@@ -134,7 +149,6 @@ +@@ -144,7 +148,6 @@ } } @@ -65,11 +35,10 @@ public double getDistanceSq(double x, double y, double z) { double d0 = (double)this.pos.getX() + 0.5D - x; -@@ -279,4 +293,183 @@ - addMapping(TileEntityFlowerPot.class, "FlowerPot"); - addMapping(TileEntityBanner.class, "Banner"); +@@ -271,6 +274,185 @@ + return false; } -+ + + // -- BEGIN FORGE PATCHES -- + /** + * Called when you receive a TileEntityData packet for the location this @@ -248,4 +217,7 @@ + this.writeToNBT(ret); + return ret; + } - } ++ + static + { + addMapping(TileEntityFurnace.class, "Furnace"); diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch index f6606e0c9d..9323da9f29 100644 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -@@ -169,7 +169,7 @@ +@@ -179,7 +179,7 @@ { Block block = this.worldObj.getBlockState(new BlockPos(j1, i2, k1)).getBlock(); @@ -9,7 +9,7 @@ { flag1 = false; break; -@@ -368,7 +368,7 @@ +@@ -371,7 +371,7 @@ public boolean isItemValidForSlot(int index, ItemStack stack) { diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch index 099972726e..6c21afb925 100644 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java -@@ -104,7 +104,7 @@ +@@ -140,7 +140,7 @@ private boolean canBrew() { @@ -9,78 +9,18 @@ { ItemStack itemstack = this.brewingItemStacks[3]; -@@ -118,7 +118,7 @@ - - for (int i = 0; i < 3; ++i) - { -- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) -+ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) - { - int j = this.brewingItemStacks[i].getMetadata(); - int k = this.getPotionResult(j, itemstack); -@@ -145,19 +145,22 @@ - } - else - { -- return false; -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(brewingItemStacks, brewingItemStacks[3], outputSlots); - } - } - - private void brewPotions() - { -+ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBreaw(brewingItemStacks)) return; - if (this.canBrew()) - { -+ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(brewingItemStacks, brewingItemStacks[3], outputSlots); - ItemStack itemstack = this.brewingItemStacks[3]; - -+ if (false) { // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe - for (int i = 0; i < 3; ++i) +@@ -193,6 +193,7 @@ { -- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) -+ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) - { - int j = this.brewingItemStacks[i].getMetadata(); - int k = this.getPotionResult(j, itemstack); -@@ -177,10 +180,11 @@ - } - } - } -+ } - -- if (itemstack.getItem().hasContainerItem()) -+ if (itemstack.getItem().hasContainerItem(itemstack)) - { -- this.brewingItemStacks[3] = new ItemStack(itemstack.getItem().getContainerItem()); -+ this.brewingItemStacks[3] = itemstack.getItem().getContainerItem(itemstack); - } - else - { -@@ -191,6 +195,7 @@ - this.brewingItemStacks[3] = null; - } + InventoryHelper.spawnItemStack(this.worldObj, (double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), itemstack1); } + net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(brewingItemStacks); } - } -@@ -310,7 +315,9 @@ - - public boolean isItemValidForSlot(int index, ItemStack stack) - { -- return index == 3 ? stack.getItem().isPotionIngredient(stack) : stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle; -+ if (index == 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack)) return true; -+ else if (index != 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack)) return true; -+ return false; - } - - public boolean[] func_174902_m() -@@ -386,4 +393,18 @@ - this.brewingItemStacks[i] = null; + if (itemstack.stackSize <= 0) +@@ -362,6 +363,20 @@ } } -+ + + net.minecraftforge.items.IItemHandler handlerInput = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.UP); + net.minecraftforge.items.IItemHandler handlerOutput = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.DOWN); + @@ -94,4 +34,7 @@ + return (T) handlerOutput; + return super.getCapability(capability, facing); + } - } ++ + public int getFieldCount() + { + return 2; diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch index 3e3327995d..7fb580f300 100644 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityChest.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityChest.java -@@ -186,6 +186,7 @@ +@@ -171,6 +171,7 @@ { super.updateContainingBlockInfo(); this.adjacentChestChecked = false; @@ -8,11 +8,10 @@ } @SuppressWarnings("incomplete-switch") -@@ -468,4 +469,24 @@ - this.chestContents[i] = null; +@@ -457,6 +458,26 @@ } } -+ + + public net.minecraftforge.items.VanillaDoubleChestItemHandler doubleChestHandler; + + @Override @@ -32,4 +31,7 @@ + { + return super.getCapability(net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); + } - } ++ + public void func_184287_a(ResourceLocation p_184287_1_, long p_184287_2_) + { + this.field_184284_m = p_184287_1_; diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch index 3fcdeb5ebd..32746de74a 100644 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java -@@ -141,9 +141,9 @@ +@@ -110,9 +110,9 @@ } } @@ -13,7 +13,7 @@ this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]); if (compound.hasKey("CustomName", 8)) -@@ -155,9 +155,9 @@ +@@ -124,9 +124,9 @@ public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); @@ -26,7 +26,7 @@ NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.furnaceItemStacks.length; ++i) -@@ -223,8 +223,7 @@ +@@ -192,8 +192,7 @@ if (this.furnaceItemStacks[1].stackSize == 0) { @@ -36,7 +36,7 @@ } } } -@@ -279,7 +278,11 @@ +@@ -248,7 +247,11 @@ else { ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]); @@ -49,7 +49,7 @@ } } -@@ -295,7 +298,7 @@ +@@ -264,7 +267,7 @@ } else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem()) { @@ -58,7 +58,7 @@ } if (this.furnaceItemStacks[0].getItem() == Item.getItemFromBlock(Blocks.sponge) && this.furnaceItemStacks[0].getMetadata() == 1 && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].getItem() == Items.bucket) -@@ -342,7 +345,15 @@ +@@ -311,7 +314,15 @@ } } @@ -75,7 +75,7 @@ } } -@@ -451,4 +462,21 @@ +@@ -432,4 +443,21 @@ this.furnaceItemStacks[i] = null; } } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch index b74a494e6c..2b856f03d0 100644 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java -@@ -260,6 +260,7 @@ +@@ -237,6 +237,7 @@ private boolean transferItemsOut() { @@ -8,7 +8,7 @@ IInventory iinventory = this.getInventoryForHopperTransfer(); if (iinventory == null) -@@ -366,6 +367,7 @@ +@@ -343,6 +344,7 @@ public static boolean captureDroppedItems(IHopper p_145891_0_) { @@ -16,7 +16,7 @@ IInventory iinventory = getHopperInventory(p_145891_0_); if (iinventory != null) -@@ -515,17 +517,31 @@ +@@ -492,17 +494,31 @@ if (itemstack == null) { @@ -49,7 +49,7 @@ } if (flag) -@@ -668,4 +684,10 @@ +@@ -648,4 +664,10 @@ this.inventory[i] = null; } } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch index d62f80aaf4..1c12efd06f 100644 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch @@ -2,7 +2,7 @@ +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityLockable.java @@ -47,4 +47,25 @@ { - return (IChatComponent)(this.hasCustomName() ? new ChatComponentText(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); + return (ITextComponent)(this.hasCustomName() ? new TextComponentString(this.getName()) : new TextComponentTranslation(this.getName(), new Object[0])); } + + private net.minecraftforge.items.IItemHandler itemHandler; diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch index 01099d4508..b1c9e4aa44 100644 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityNote.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityNote.java -@@ -27,7 +27,9 @@ +@@ -29,7 +29,9 @@ public void changePitch() { diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch index 4595567a7b..d571436407 100644 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityPiston.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityPiston.java -@@ -148,7 +148,8 @@ +@@ -201,7 +201,8 @@ if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) { this.worldObj.setBlockState(this.pos, this.pistonState, 3); @@ -10,7 +10,7 @@ } } } -@@ -166,7 +167,8 @@ +@@ -219,7 +220,8 @@ if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) { this.worldObj.setBlockState(this.pos, this.pistonState, 3); diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch index b95942d3ed..4c4f169df7 100644 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntitySign.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntitySign.java -@@ -61,7 +61,7 @@ +@@ -60,7 +60,7 @@ } public boolean canCommandSenderUseCommand(int permLevel, String commandName) { diff --git a/patches.mcp/minecraft/net/minecraft/util/BlockPos.java.patch b/patches.mcp/minecraft/net/minecraft/util/BlockPos.java.patch deleted file mode 100644 index d8fbe33d7e..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/BlockPos.java.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/BlockPos.java -+++ ../src-work/minecraft/net/minecraft/util/BlockPos.java -@@ -257,6 +257,21 @@ - }; - } - -+ /** -+ * Returns a version of this BlockPos that is guaranteed to be Immutable. -+ * In most cases this will return 'this', but if 'this' is an instance of -+ * MutableBlockPos it will return a new instance of BlockPos with the same values. -+ * -+ * When storing a parameter given to you for an extended period of time, make sure you -+ * use this in case the value is changed internally. -+ * -+ * @return An immutable BlockPos. -+ */ -+ public BlockPos getImmutable() -+ { -+ return this; -+ } -+ - public static final class MutableBlockPos extends BlockPos - { - private int x; -@@ -298,5 +313,7 @@ - this.z = zIn; - return this; - } -+ -+ @Override public BlockPos getImmutable() { return new BlockPos(this); } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/util/ChatComponentStyle.java.patch b/patches.mcp/minecraft/net/minecraft/util/ChatComponentStyle.java.patch deleted file mode 100644 index a694725b19..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/ChatComponentStyle.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/ChatComponentStyle.java -+++ ../src-work/minecraft/net/minecraft/util/ChatComponentStyle.java -@@ -74,7 +74,6 @@ - return stringbuilder.toString(); - } - -- @SideOnly(Side.CLIENT) - public final String getFormattedText() - { - StringBuilder stringbuilder = new StringBuilder(); diff --git a/patches.mcp/minecraft/net/minecraft/util/ChatStyle.java.patch b/patches.mcp/minecraft/net/minecraft/util/ChatStyle.java.patch deleted file mode 100644 index f9f7a30098..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/ChatStyle.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/ChatStyle.java -+++ ../src-work/minecraft/net/minecraft/util/ChatStyle.java -@@ -229,7 +229,6 @@ - return this; - } - -- @SideOnly(Side.CLIENT) - public String getFormattingCode() - { - if (this.isEmpty()) diff --git a/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch b/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch index 5f5717bf96..fecbe4e748 100644 --- a/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch +++ b/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch @@ -1,15 +1,6 @@ --- ../src-base/minecraft/net/minecraft/util/EnumFacing.java +++ ../src-work/minecraft/net/minecraft/util/EnumFacing.java -@@ -6,8 +6,6 @@ - import java.util.Iterator; - import java.util.Map; - import java.util.Random; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - - public enum EnumFacing implements IStringSerializable - { -@@ -60,7 +58,6 @@ +@@ -62,7 +62,6 @@ return getFront(this.opposite); } @@ -17,7 +8,7 @@ public EnumFacing rotateAround(EnumFacing.Axis axis) { switch (axis) -@@ -111,7 +108,6 @@ +@@ -113,7 +112,6 @@ } } @@ -25,7 +16,7 @@ private EnumFacing rotateX() { switch (this) -@@ -131,7 +127,6 @@ +@@ -133,7 +131,6 @@ } } @@ -33,7 +24,7 @@ private EnumFacing rotateZ() { switch (this) -@@ -192,7 +187,6 @@ +@@ -194,7 +191,6 @@ return this.axis; } @@ -41,7 +32,7 @@ public static EnumFacing byName(String name) { return name == null ? null : (EnumFacing)NAME_LOOKUP.get(name.toLowerCase()); -@@ -218,7 +212,6 @@ +@@ -225,7 +221,6 @@ return values()[rand.nextInt(values().length)]; } @@ -49,7 +40,7 @@ public static EnumFacing getFacingFromVector(float p_176737_0_, float p_176737_1_, float p_176737_2_) { EnumFacing enumfacing = NORTH; -@@ -261,7 +254,6 @@ +@@ -268,7 +263,6 @@ throw new IllegalArgumentException("No such direction: " + p_181076_0_ + " " + p_181076_1_); } @@ -57,7 +48,7 @@ public Vec3i getDirectionVec() { return this.directionVec; -@@ -297,7 +289,6 @@ +@@ -304,7 +298,6 @@ this.plane = plane; } diff --git a/patches.mcp/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch b/patches.mcp/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch deleted file mode 100644 index 7bb192c6d1..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/EnumWorldBlockLayer.java -+++ ../src-work/minecraft/net/minecraft/util/EnumWorldBlockLayer.java -@@ -1,9 +1,5 @@ - package net.minecraft.util; - --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; -- --@SideOnly(Side.CLIENT) - public enum EnumWorldBlockLayer - { - SOLID("Solid"), diff --git a/patches.mcp/minecraft/net/minecraft/util/IChatComponent.java.patch b/patches.mcp/minecraft/net/minecraft/util/IChatComponent.java.patch deleted file mode 100644 index 6a73ab2ebb..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/IChatComponent.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/IChatComponent.java -+++ ../src-work/minecraft/net/minecraft/util/IChatComponent.java -@@ -31,7 +31,6 @@ - - String getUnformattedText(); - -- @SideOnly(Side.CLIENT) - String getFormattedText(); - - List getSiblings(); diff --git a/patches.mcp/minecraft/net/minecraft/util/MovingObjectPosition.java.patch b/patches.mcp/minecraft/net/minecraft/util/MovingObjectPosition.java.patch deleted file mode 100644 index 56494d05e6..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/MovingObjectPosition.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/MovingObjectPosition.java -+++ ../src-work/minecraft/net/minecraft/util/MovingObjectPosition.java -@@ -10,6 +10,12 @@ - public Vec3 hitVec; - public Entity entityHit; - -+ /** Used to determine what sub-segment is hit */ -+ public int subHit = -1; -+ -+ /** Used to add extra hit info */ -+ public Object hitInfo = null; -+ - public MovingObjectPosition(Vec3 hitVecIn, EnumFacing facing, BlockPos blockPosIn) - { - this(MovingObjectPosition.MovingObjectType.BLOCK, hitVecIn, facing, blockPosIn); diff --git a/patches.mcp/minecraft/net/minecraft/util/ResourceLocation.java.patch b/patches.mcp/minecraft/net/minecraft/util/ResourceLocation.java.patch deleted file mode 100644 index 737a367859..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/ResourceLocation.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/ResourceLocation.java -+++ ../src-work/minecraft/net/minecraft/util/ResourceLocation.java -@@ -1,7 +1,5 @@ - package net.minecraft.util; - --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - import org.apache.commons.lang3.Validate; - - public class ResourceLocation -@@ -21,7 +19,6 @@ - this(0, splitObjectName(resourceName)); - } - -- @SideOnly(Side.CLIENT) - public ResourceLocation(String resourceDomainIn, String resourcePathIn) - { - this(0, new String[] {resourceDomainIn, resourcePathIn}); -@@ -50,7 +47,6 @@ - return this.resourcePath; - } - -- @SideOnly(Side.CLIENT) - public String getResourceDomain() - { - return this.resourceDomain; diff --git a/patches.mcp/minecraft/net/minecraft/util/Session.java.patch b/patches.mcp/minecraft/net/minecraft/util/Session.java.patch index 48492d58dc..b0432b81ec 100644 --- a/patches.mcp/minecraft/net/minecraft/util/Session.java.patch +++ b/patches.mcp/minecraft/net/minecraft/util/Session.java.patch @@ -50,23 +50,3 @@ } } -@@ -62,6 +81,19 @@ - return this.sessionType; - } - -+ /* ======================================== FORGE START ===================================== */ -+ //For internal use only. Modders should never need to use this. -+ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) -+ { -+ if(this.properties == null) this.properties = properties; -+ } -+ -+ public boolean hasCachedProperties() -+ { -+ return properties != null; -+ } -+ /* ========================================= FORGE END ====================================== */ -+ - @SideOnly(Side.CLIENT) - public static enum Type - { diff --git a/patches.mcp/minecraft/net/minecraft/util/StringTranslate.java.patch b/patches.mcp/minecraft/net/minecraft/util/StringTranslate.java.patch deleted file mode 100644 index f6d51a843f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/StringTranslate.java.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/StringTranslate.java -+++ ../src-work/minecraft/net/minecraft/util/StringTranslate.java -@@ -23,9 +23,29 @@ - - public StringTranslate() - { -+ InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); -+ inject(this, inputstream); -+ } -+ -+ public static void inject(InputStream inputstream) -+ { -+ inject(instance, inputstream); -+ } -+ -+ private static void inject(StringTranslate inst, InputStream inputstream) -+ { -+ java.util.HashMap map = parseLangFile(inputstream); -+ inst.languageList.putAll(map); -+ inst.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); -+ } -+ -+ public static java.util.HashMap parseLangFile(InputStream inputstream) -+ { -+ java.util.HashMap table = Maps.newHashMap(); - try - { -- InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); -+ inputstream = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(table, inputstream); -+ if (inputstream == null) return table; - - for (String s : IOUtils.readLines(inputstream, Charsets.UTF_8)) - { -@@ -37,17 +57,17 @@ - { - String s1 = astring[0]; - String s2 = numericVariablePattern.matcher(astring[1]).replaceAll("%$1s"); -- this.languageList.put(s1, s2); -+ table.put(s1, s2); - } - } - } - -- this.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); - } -- catch (IOException var7) -+ catch (Exception var7) - { - ; - } -+ return table; - } - - static StringTranslate getInstance() diff --git a/patches.mcp/minecraft/net/minecraft/util/Vec3.java.patch b/patches.mcp/minecraft/net/minecraft/util/Vec3.java.patch deleted file mode 100644 index 43a23f3c84..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/Vec3.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/Vec3.java -+++ ../src-work/minecraft/net/minecraft/util/Vec3.java -@@ -1,8 +1,5 @@ - package net.minecraft.util; - --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; -- - public class Vec3 - { - public final double xCoord; -@@ -36,7 +33,6 @@ - this((double)p_i46377_1_.getX(), (double)p_i46377_1_.getY(), (double)p_i46377_1_.getZ()); - } - -- @SideOnly(Side.CLIENT) - public Vec3 subtractReverse(Vec3 vec) - { - return new Vec3(vec.xCoord - this.xCoord, vec.yCoord - this.yCoord, vec.zCoord - this.zCoord); -@@ -53,7 +49,6 @@ - return this.xCoord * vec.xCoord + this.yCoord * vec.yCoord + this.zCoord * vec.zCoord; - } - -- @SideOnly(Side.CLIENT) - public Vec3 crossProduct(Vec3 vec) - { - return new Vec3(this.yCoord * vec.zCoord - this.zCoord * vec.yCoord, this.zCoord * vec.xCoord - this.xCoord * vec.zCoord, this.xCoord * vec.yCoord - this.yCoord * vec.xCoord); -@@ -79,7 +74,6 @@ - return new Vec3(this.xCoord + x, this.yCoord + y, this.zCoord + z); - } - -- @SideOnly(Side.CLIENT) - public double distanceTo(Vec3 vec) - { - double d0 = vec.xCoord - this.xCoord; diff --git a/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch b/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch deleted file mode 100644 index 5c01e52079..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/WeightedRandomChestContent.java -+++ ../src-work/minecraft/net/minecraft/util/WeightedRandomChestContent.java -@@ -36,48 +36,39 @@ - for (int i = 0; i < max; ++i) - { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, listIn); -- int j = weightedrandomchestcontent.minStackSize + random.nextInt(weightedrandomchestcontent.maxStackSize - weightedrandomchestcontent.minStackSize + 1); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, inv); - -- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j) -+ for (ItemStack itemstack1 : stacks) - { -- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); -- itemstack1.stackSize = j; - inv.setInventorySlotContents(random.nextInt(inv.getSizeInventory()), itemstack1); - } -- else -- { -- for (int k = 0; k < j; ++k) -- { -- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); -- itemstack.stackSize = 1; -- inv.setInventorySlotContents(random.nextInt(inv.getSizeInventory()), itemstack); -- } -- } - } - } - -+ // -- Forge hooks -+ /** -+ * Allow a mod to submit a custom implementation that can delegate item stack generation beyond simple stack lookup -+ * -+ * @param random The current random for generation -+ * @param newInventory The inventory being generated (do not populate it, but you can refer to it) -+ * @return An array of {@link ItemStack} to put into the chest -+ */ -+ protected ItemStack[] generateChestContent(Random random, IInventory newInventory) -+ { -+ return net.minecraftforge.common.ChestGenHooks.generateStacks(random, theItemId, minStackSize, maxStackSize); -+ } -+ - public static void generateDispenserContents(Random random, List listIn, TileEntityDispenser dispenser, int max) - { - for (int i = 0; i < max; ++i) - { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, listIn); -- int j = weightedrandomchestcontent.minStackSize + random.nextInt(weightedrandomchestcontent.maxStackSize - weightedrandomchestcontent.minStackSize + 1); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, dispenser); - -- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j) -+ for (ItemStack itemstack1 : stacks) - { -- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); -- itemstack1.stackSize = j; - dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack1); - } -- else -- { -- for (int k = 0; k < j; ++k) -- { -- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); -- itemstack.stackSize = 1; -- dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack); -- } -- } - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch index c8595ac68b..3f5cc6f748 100644 --- a/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch @@ -18,15 +18,6 @@ return this.chunkArray[i][j].getLightFor(p_175629_1_, pos); } } -@@ -150,7 +154,7 @@ - - public boolean isAirBlock(BlockPos pos) - { -- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; -+ return this.getBlockState(pos).getBlock().isAir(this, pos); - } - - @SideOnly(Side.CLIENT) @@ -160,6 +164,7 @@ { int i = (pos.getX() >> 4) - this.chunkX; @@ -35,7 +26,7 @@ return this.chunkArray[i][j].getLightFor(p_175628_1_, pos); } else -@@ -179,4 +184,16 @@ +@@ -178,4 +183,16 @@ { return this.worldObj.getWorldType(); } diff --git a/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch b/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch index 5e8458644a..3a8d6d929d 100644 --- a/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch @@ -1,14 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/Explosion.java +++ ../src-work/minecraft/net/minecraft/world/Explosion.java -@@ -38,6 +38,7 @@ - private final float explosionSize; - private final List affectedBlockPositions; - private final Map playerKnockbackMap; -+ private final Vec3 position; - - @SideOnly(Side.CLIENT) - public Explosion(World worldIn, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) -@@ -65,6 +66,7 @@ +@@ -67,6 +67,7 @@ this.explosionZ = p_i45754_7_; this.isFlaming = p_i45754_10_; this.isSmoking = p_i45754_11_; @@ -16,24 +8,16 @@ } public void doExplosionA() -@@ -99,7 +101,7 @@ +@@ -101,7 +102,7 @@ - if (iblockstate.getBlock().getMaterial() != Material.air) + if (iblockstate.func_185904_a() != Material.air) { - float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance((Entity)null); + float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance(worldObj, blockpos, (Entity)null, this); f -= (f2 + 0.3F) * 0.3F; } -@@ -126,6 +128,7 @@ - int j2 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D); - int j1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D); - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); -+ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3); - Vec3 vec3 = new Vec3(this.explosionX, this.explosionY, this.explosionZ); - - for (int k2 = 0; k2 < list.size(); ++k2) -@@ -213,8 +216,7 @@ +@@ -227,8 +228,7 @@ block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos), 1.0F / this.explosionSize, 0); } @@ -43,7 +27,7 @@ } } } -@@ -250,4 +252,6 @@ +@@ -264,4 +264,6 @@ { return this.affectedBlockPositions; } diff --git a/patches.mcp/minecraft/net/minecraft/world/SpawnerAnimals.java.patch b/patches.mcp/minecraft/net/minecraft/world/SpawnerAnimals.java.patch deleted file mode 100644 index 135ef3d399..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/SpawnerAnimals.java.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/SpawnerAnimals.java -+++ ../src-work/minecraft/net/minecraft/world/SpawnerAnimals.java -@@ -69,14 +69,15 @@ - { - if ((!enumcreaturetype.getPeacefulCreature() || spawnPeacefulMobs) && (enumcreaturetype.getPeacefulCreature() || spawnHostileMobs) && (!enumcreaturetype.getAnimal() || p_77192_4_)) - { -- int j4 = worldServerIn.countEntities(enumcreaturetype.getCreatureClass()); -+ int j4 = worldServerIn.countEntities(enumcreaturetype, true); - int k4 = enumcreaturetype.getMaxNumberOfCreature() * i / MOB_COUNT_DIV; - - if (j4 <= k4) - { -+ java.util.ArrayList shuffled = com.google.common.collect.Lists.newArrayList(this.eligibleChunksForSpawning); -+ java.util.Collections.shuffle(shuffled); - label374: -- -- for (ChunkCoordIntPair chunkcoordintpair1 : this.eligibleChunksForSpawning) -+ for (ChunkCoordIntPair chunkcoordintpair1 : shuffled) - { - BlockPos blockpos = getRandomChunkPosition(worldServerIn, chunkcoordintpair1.chunkXPos, chunkcoordintpair1.chunkZPos); - int k1 = blockpos.getX(); -@@ -134,8 +135,10 @@ - - entityliving.setLocationAndAngles((double)f, (double)i3, (double)f1, worldServerIn.rand.nextFloat() * 360.0F, 0.0F); - -- if (entityliving.getCanSpawnHere() && entityliving.isNotColliding()) -+ net.minecraftforge.fml.common.eventhandler.Event.Result canSpawn = net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(entityliving, worldServerIn, f, i3, f1); -+ if (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT && (entityliving.getCanSpawnHere() && entityliving.isNotColliding()))) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, worldServerIn, f, l3, f1)) - ientitylivingdata = entityliving.onInitialSpawn(worldServerIn.getDifficultyForLocation(new BlockPos(entityliving)), ientitylivingdata); - - if (entityliving.isNotColliding()) -@@ -144,7 +147,7 @@ - worldServerIn.spawnEntityInWorld(entityliving); - } - -- if (j2 >= entityliving.getMaxSpawnedInChunk()) -+ if (i2 >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(entityliving)) - { - continue label374; - } -@@ -193,7 +196,7 @@ - { - BlockPos blockpos = pos.down(); - -- if (!World.doesBlockHaveSolidTopSurface(worldIn, blockpos)) -+ if (!worldIn.getBlockState(blockpos).getBlock().canCreatureSpawn(worldIn, blockpos, spawnPlacementTypeIn)) - { - return false; - } diff --git a/patches.mcp/minecraft/net/minecraft/world/World.java.patch b/patches.mcp/minecraft/net/minecraft/world/World.java.patch index 273dc98c57..4b28a89dfe 100644 --- a/patches.mcp/minecraft/net/minecraft/world/World.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/World.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/World.java +++ ../src-work/minecraft/net/minecraft/world/World.java -@@ -57,6 +57,13 @@ +@@ -60,6 +60,13 @@ public abstract class World implements IBlockAccess { @@ -14,7 +14,7 @@ private int seaLevel = 63; protected boolean scheduledUpdatesAreImmediate; public final List loadedEntityList = Lists.newArrayList(); -@@ -98,6 +105,10 @@ +@@ -101,6 +108,10 @@ private final WorldBorder worldBorder; int[] lightUpdateBlockList; @@ -24,8 +24,8 @@ + protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) { - this.ambientTickCountdown = this.rand.nextInt(12000); -@@ -110,6 +121,7 @@ + this.worldAccesses = Lists.newArrayList(new IWorldEventListener[] {this.field_184152_t}); +@@ -115,6 +126,7 @@ this.provider = providerIn; this.isRemote = client; this.worldBorder = providerIn.getWorldBorder(); @@ -33,7 +33,7 @@ } public World init() -@@ -119,6 +131,11 @@ +@@ -124,6 +136,11 @@ public BiomeGenBase getBiomeGenForCoords(final BlockPos pos) { @@ -45,88 +45,7 @@ if (this.isBlockLoaded(pos)) { Chunk chunk = this.getChunkFromBlockCoords(pos); -@@ -184,7 +201,7 @@ - - public boolean isAirBlock(BlockPos pos) - { -- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; -+ return this.getBlockState(pos).getBlock().isAir(this, pos); - } - - public boolean isBlockLoaded(BlockPos pos) -@@ -284,39 +301,63 @@ - { - Chunk chunk = this.getChunkFromBlockCoords(pos); - Block block = newState.getBlock(); -+ -+ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; -+ if (this.captureBlockSnapshots && !this.isRemote) -+ { -+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, pos, flags); -+ this.capturedBlockSnapshots.add(blockSnapshot); -+ } -+ Block oldBlock = getBlockState(pos).getBlock(); -+ int oldLight = oldBlock.getLightValue(this, pos); -+ int oldOpacity = oldBlock.getLightOpacity(this, pos); -+ - IBlockState iblockstate = chunk.setBlockState(pos, newState); - - if (iblockstate == null) - { -+ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); - return false; - } - else - { - Block block1 = iblockstate.getBlock(); - -- if (block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue() != block1.getLightValue()) -+ if (block.getLightOpacity(this, pos) != oldOpacity || block.getLightValue(this, pos) != oldLight) - { - this.theProfiler.startSection("checkLight"); - this.checkLight(pos); - this.theProfiler.endSection(); - } - -- if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && chunk.isPopulated()) -+ if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates - { -- this.markBlockForUpdate(pos); -+ this.markAndNotifyBlock(pos, chunk, iblockstate, newState, flags); // Modularize client and physic updates - } - -+ return true; -+ } -+ } -+ } -+ -+ // Split off from original setBlockState(BlockPos, IBlockState Block p_147465_4_, int) method in order to directly send client and physic updates -+ public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState old, IBlockState new_, int flags) -+ { -+ if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && (chunk == null || chunk.isPopulated())) -+ { -+ this.markBlockForUpdate(pos); -+ } -+ { -+ { - if (!this.isRemote && (flags & 1) != 0) - { -- this.notifyNeighborsRespectDebug(pos, iblockstate.getBlock()); -+ this.notifyNeighborsRespectDebug(pos, new_.getBlock()); - -- if (block.hasComparatorInputOverride()) -+ if (new_.getBlock().hasComparatorInputOverride()) - { -- this.updateComparatorOutputLevel(pos, block); -+ this.updateComparatorOutputLevel(pos, new_.getBlock()); - } - } -- -- return true; - } - } - } -@@ -404,6 +445,9 @@ +@@ -409,6 +426,9 @@ public void notifyNeighborsOfStateChange(BlockPos pos, Block blockType) { @@ -136,7 +55,7 @@ this.notifyBlockOfStateChange(pos.west(), blockType); this.notifyBlockOfStateChange(pos.east(), blockType); this.notifyBlockOfStateChange(pos.down(), blockType); -@@ -414,6 +458,11 @@ +@@ -419,6 +439,11 @@ public void notifyNeighborsOfStateExcept(BlockPos pos, Block blockType, EnumFacing skipSide) { @@ -148,7 +67,7 @@ if (skipSide != EnumFacing.WEST) { this.notifyBlockOfStateChange(pos.west(), blockType); -@@ -777,7 +826,7 @@ +@@ -782,7 +807,7 @@ public boolean isDaytime() { @@ -156,10 +75,10 @@ + return this.provider.isDaytime(); } - public MovingObjectPosition rayTraceBlocks(Vec3 p_72933_1_, Vec3 p_72933_2_) -@@ -972,6 +1021,12 @@ + public RayTraceResult rayTraceBlocks(Vec3d p_72933_1_, Vec3d p_72933_2_) +@@ -994,6 +1019,12 @@ - public void playSoundAtEntity(Entity entityIn, String name, float volume, float pitch) + public void func_184149_a(BlockPos p_184149_1_, SoundEvent p_184149_2_) { + net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(entityIn, name, volume, pitch); + if (event.isCanceled() || event.name == null) return; @@ -169,10 +88,10 @@ + for (int i = 0; i < this.worldAccesses.size(); ++i) { - ((IWorldAccess)this.worldAccesses.get(i)).playSound(name, entityIn.posX, entityIn.posY, entityIn.posZ, volume, pitch); -@@ -980,6 +1035,12 @@ + ((IWorldEventListener)this.worldAccesses.get(i)).func_184377_a(p_184149_2_, p_184149_1_); +@@ -1013,6 +1044,12 @@ - public void playSoundToNearExcept(EntityPlayer player, String name, float volume, float pitch) + private void spawnParticle(int particleID, boolean p_175720_2_, double xCood, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int... p_175720_15_) { + net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(player, name, volume, pitch); + if (event.isCanceled() || event.name == null) return; @@ -182,8 +101,8 @@ + for (int i = 0; i < this.worldAccesses.size(); ++i) { - ((IWorldAccess)this.worldAccesses.get(i)).playSoundToNearExcept(player, name, player.posX, player.posY, player.posZ, volume, pitch); -@@ -1033,6 +1094,9 @@ + ((IWorldEventListener)this.worldAccesses.get(i)).spawnParticle(particleID, p_175720_2_, xCood, yCoord, zCoord, xOffset, yOffset, zOffset, p_175720_15_); +@@ -1027,6 +1064,9 @@ public boolean spawnEntityInWorld(Entity entityIn) { @@ -193,7 +112,7 @@ int i = MathHelper.floor_double(entityIn.posX / 16.0D); int j = MathHelper.floor_double(entityIn.posZ / 16.0D); boolean flag = entityIn.forceSpawn; -@@ -1055,6 +1119,8 @@ +@@ -1049,6 +1089,8 @@ this.updateAllPlayersSleepingFlag(); } @@ -202,40 +121,7 @@ this.getChunkFromChunkCoords(i, j).addEntity(entityIn); this.loadedEntityList.add(entityIn); this.onEntityAdded(entityIn); -@@ -1267,17 +1333,29 @@ - - public int calculateSkylightSubtracted(float p_72967_1_) - { -+ float f = provider.getSunBrightnessFactor(p_72967_1_); -+ f = 1 - f; -+ return (int)(f * 11); -+ } -+ -+ /** -+ * The current sun brightness factor for this dimension. -+ * 0.0f means no light at all, and 1.0f means maximum sunlight. -+ * Highly recommended for sunlight detection like solar panel. -+ * -+ * @return The current brightness factor -+ * */ -+ public float getSunBrightnessFactor(float p_72967_1_) -+ { - float f = this.getCelestialAngle(p_72967_1_); - float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F); - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); - f1 = 1.0F - f1; - f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength(p_72967_1_) * 5.0F) / 16.0D)); - f1 = (float)((double)f1 * (1.0D - (double)(this.getThunderStrength(p_72967_1_) * 5.0F) / 16.0D)); -- f1 = 1.0F - f1; -- return (int)(f1 * 11.0F); -+ return f1; - } - -- @SideOnly(Side.CLIENT) - public void removeWorldAccess(IWorldAccess worldAccess) - { - this.worldAccesses.remove(worldAccess); -@@ -1286,6 +1364,12 @@ +@@ -1361,6 +1403,12 @@ @SideOnly(Side.CLIENT) public float getSunBrightness(float p_72971_1_) { @@ -246,11 +132,11 @@ + public float getSunBrightnessBody(float p_72971_1_) + { float f = this.getCelestialAngle(p_72971_1_); - float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.2F); + float f1 = 1.0F - (MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.2F); f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1298,6 +1382,12 @@ +@@ -1373,6 +1421,12 @@ @SideOnly(Side.CLIENT) - public Vec3 getSkyColor(Entity entityIn, float partialTicks) + public Vec3d getSkyColor(Entity entityIn, float partialTicks) { + return this.provider.getSkyColor(entityIn, partialTicks); + } @@ -259,9 +145,9 @@ + public Vec3 getSkyColorBody(Entity entityIn, float partialTicks) + { float f = this.getCelestialAngle(partialTicks); - float f1 = MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + float f1 = MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F; f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1305,9 +1395,7 @@ +@@ -1380,9 +1434,7 @@ int j = MathHelper.floor_double(entityIn.posY); int k = MathHelper.floor_double(entityIn.posZ); BlockPos blockpos = new BlockPos(i, j, k); @@ -272,7 +158,7 @@ float f3 = (float)(l >> 16 & 255) / 255.0F; float f4 = (float)(l >> 8 & 255) / 255.0F; float f5 = (float)(l & 255) / 255.0F; -@@ -1367,6 +1455,11 @@ +@@ -1442,11 +1494,22 @@ public float getCurrentMoonPhaseFactor() { @@ -284,9 +170,7 @@ return WorldProvider.moonPhaseFactors[this.provider.getMoonPhase(this.worldInfo.getWorldTime())]; } -@@ -1379,6 +1472,12 @@ - @SideOnly(Side.CLIENT) - public Vec3 getCloudColour(float partialTicks) + public float getCelestialAngleRadians(float partialTicks) { + return this.provider.drawClouds(partialTicks); + } @@ -295,23 +179,11 @@ + public Vec3 drawCloudsBody(float partialTicks) + { float f = this.getCelestialAngle(partialTicks); - float f1 = MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1434,9 +1533,9 @@ - for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1) - { - blockpos1 = blockpos.down(); -- Material material = chunk.getBlock(blockpos1).getMaterial(); -+ Block block = chunk.getBlock(blockpos1); - -- if (material.blocksMovement() && material != Material.leaves) -+ if (block.getMaterial().blocksMovement() && !block.isLeaves(this, blockpos1) && !block.isFoliage(this, blockpos1)) - { - break; - } -@@ -1448,6 +1547,12 @@ + return f * ((float)Math.PI * 2F); + } +@@ -1454,6 +1517,12 @@ @SideOnly(Side.CLIENT) - public float getStarBrightness(float partialTicks) + public Vec3d getCloudColour(float partialTicks) { + return this.provider.getStarBrightness(partialTicks); + } @@ -320,9 +192,9 @@ + public float getStarBrightnessBody(float partialTicks) + { float f = this.getCelestialAngle(partialTicks); - float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.25F); + float f1 = MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F; f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1494,7 +1599,15 @@ +@@ -1574,7 +1643,15 @@ entity.addEntityCrashInfo(crashreportcategory); } @@ -339,42 +211,7 @@ } if (entity.isDead) -@@ -1554,7 +1667,15 @@ - CrashReport crashreport1 = CrashReport.makeCrashReport(throwable1, "Ticking entity"); - CrashReportCategory crashreportcategory2 = crashreport1.makeCategory("Entity being ticked"); - entity2.addEntityCrashInfo(crashreportcategory2); -- throw new ReportedException(crashreport1); -+ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe(crashreport1.getCompleteReport()); -+ removeEntity(entity2); -+ } -+ else -+ { -+ throw new ReportedException(crashreport1); -+ } - } - } - -@@ -1601,7 +1722,16 @@ - CrashReport crashreport2 = CrashReport.makeCrashReport(throwable, "Ticking block entity"); - CrashReportCategory crashreportcategory1 = crashreport2.makeCategory("Block entity being ticked"); - tileentity.addInfoToCrashReport(crashreportcategory1); -- throw new ReportedException(crashreport2); -+ if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe(crashreport2.getCompleteReport()); -+ tileentity.invalidate(); -+ this.removeTileEntity(tileentity.getPos()); -+ } -+ else -+ { -+ throw new ReportedException(crashreport2); -+ } - } - } - } -@@ -1618,15 +1748,20 @@ +@@ -1701,15 +1778,20 @@ } } @@ -397,7 +234,7 @@ this.theProfiler.endStartSection("pendingBlockEntities"); if (!this.addedTileEntityList.isEmpty()) -@@ -1660,7 +1795,8 @@ +@@ -1748,7 +1830,8 @@ public boolean addTileEntity(TileEntity tile) { @@ -407,7 +244,7 @@ if (flag && tile instanceof ITickable) { -@@ -1699,9 +1835,13 @@ +@@ -1782,9 +1865,13 @@ { int i = MathHelper.floor_double(entityIn.posX); int j = MathHelper.floor_double(entityIn.posZ); @@ -423,17 +260,8 @@ { entityIn.lastTickPosX = entityIn.posX; entityIn.lastTickPosY = entityIn.posY; -@@ -1829,7 +1969,7 @@ - { - Block block = this.getBlockState(blockpos$mutableblockpos.set(k1, l1, i2)).getBlock(); - -- if (block.getMaterial() != Material.air) -+ if (!block.isAir(this, new BlockPos(k1, l1, i2))) - { - return true; - } -@@ -1894,6 +2034,10 @@ - { +@@ -1983,6 +2070,10 @@ + blockpos$pooledmutableblockpos.func_185344_t(); return true; } + else if (block.isBurning(this, new BlockPos(k1, l1, i2))) @@ -443,9 +271,9 @@ } } } -@@ -1930,6 +2074,16 @@ - blockpos$mutableblockpos.set(k1, l1, i2); - IBlockState iblockstate = this.getBlockState(blockpos$mutableblockpos); +@@ -2021,6 +2112,16 @@ + blockpos$pooledmutableblockpos.func_185343_d(k1, l1, i2); + IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos); Block block = iblockstate.getBlock(); + + Boolean result = block.isEntityInsideMaterial(this, blockpos$mutableblockpos, iblockstate, entityIn, (double)l, materialIn, false); @@ -458,19 +286,9 @@ + } + else if (result != null && result == false) continue; - if (block.getMaterial() == materialIn) + if (iblockstate.func_185904_a() == materialIn) { -@@ -2004,6 +2158,9 @@ - IBlockState iblockstate = this.getBlockState(blockpos$mutableblockpos.set(k1, l1, i2)); - Block block = iblockstate.getBlock(); - -+ Boolean result = block.isAABBInsideMaterial(this, blockpos$mutableblockpos, bb, materialIn); -+ if (result != null) return result; -+ - if (block.getMaterial() == materialIn) - { - int j2 = ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue(); -@@ -2034,6 +2191,7 @@ +@@ -2130,6 +2231,7 @@ public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) { Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking); @@ -478,7 +296,7 @@ explosion.doExplosionA(); explosion.doExplosionB(true); return explosion; -@@ -2180,19 +2338,27 @@ +@@ -2276,19 +2378,27 @@ else { this.addTileEntity(tileEntityIn); @@ -507,7 +325,7 @@ } else { -@@ -2205,6 +2371,7 @@ +@@ -2301,6 +2411,7 @@ this.getChunkFromBlockCoords(pos).removeTileEntity(pos); } @@ -515,25 +333,7 @@ } public void markTileEntityForRemoval(TileEntity tileEntityIn) -@@ -2223,7 +2390,7 @@ - { - IBlockState iblockstate = blockAccess.getBlockState(pos); - Block block = iblockstate.getBlock(); -- return block.getMaterial().isOpaque() && block.isFullCube() ? true : (block instanceof BlockStairs ? iblockstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP : (block instanceof BlockSlab ? iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue() == 7 : false)))); -+ return block.isSideSolid(blockAccess, pos, EnumFacing.UP); - } - - public boolean isBlockNormalCube(BlockPos pos, boolean _default) -@@ -2243,7 +2410,7 @@ - else - { - Block block = this.getBlockState(pos).getBlock(); -- return block.getMaterial().isOpaque() && block.isFullCube(); -+ return block.isNormalCube(this, pos); - } - } - } -@@ -2262,6 +2429,7 @@ +@@ -2350,6 +2461,7 @@ { this.spawnHostileMobs = hostile; this.spawnPeacefulMobs = peaceful; @@ -541,7 +341,7 @@ } public void tick() -@@ -2271,6 +2439,11 @@ +@@ -2359,6 +2471,11 @@ protected void calculateInitialWeather() { @@ -553,7 +353,7 @@ if (this.worldInfo.isRaining()) { this.rainingStrength = 1.0F; -@@ -2284,6 +2457,11 @@ +@@ -2372,6 +2489,11 @@ protected void updateWeather() { @@ -565,26 +365,7 @@ if (!this.provider.getHasNoSky()) { if (!this.isRemote) -@@ -2378,6 +2556,7 @@ - { - this.activeChunkSet.clear(); - this.theProfiler.startSection("buildList"); -+ this.activeChunkSet.addAll(getPersistentChunks().keySet()); - - for (int i = 0; i < this.playerEntities.size(); ++i) - { -@@ -2434,8 +2613,9 @@ - Block block = chunkIn.getBlock(blockpos); - j = j + p_147467_1_; - k = k + p_147467_2_; -+ BlockPos worldpos = blockpos.add(p_147467_1_, 0, p_147467_2_); - -- if (block.getMaterial() == Material.air && this.getLight(blockpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, blockpos) <= 0) -+ if (block.isAir(this, worldpos) && this.getLight(worldpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, worldpos) <= 0) //Forge: isAir, and fix arguments to world positions instead of chunk position - { - EntityPlayer entityplayer = this.getClosestPlayer((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, 8.0D); - -@@ -2475,6 +2655,11 @@ +@@ -2491,6 +2613,11 @@ public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj) { @@ -596,7 +377,7 @@ BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); float f = biomegenbase.getFloatTemperature(pos); -@@ -2516,6 +2701,11 @@ +@@ -2532,6 +2659,11 @@ public boolean canSnowAt(BlockPos pos, boolean checkLight) { @@ -608,31 +389,7 @@ BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); float f = biomegenbase.getFloatTemperature(pos); -@@ -2533,7 +2723,7 @@ - { - Block block = this.getBlockState(pos).getBlock(); - -- if (block.getMaterial() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos)) -+ if (block.isAir(this, pos) && Blocks.snow_layer.canPlaceBlockAt(this, pos)) - { - return true; - } -@@ -2565,10 +2755,11 @@ - else - { - Block block = this.getBlockState(pos).getBlock(); -- int i = lightType == EnumSkyBlock.SKY ? 0 : block.getLightValue(); -- int j = block.getLightOpacity(); -+ int blockLight = block.getLightValue(this, pos); -+ int i = lightType == EnumSkyBlock.SKY ? 0 : blockLight; -+ int j = block.getLightOpacity(this, pos); - -- if (j >= 15 && block.getLightValue() > 0) -+ if (j >= 15 && blockLight > 0) - { - j = 1; - } -@@ -2768,10 +2959,10 @@ +@@ -2789,10 +2921,10 @@ public List getEntitiesInAABBexcluding(Entity entityIn, AxisAlignedBB boundingBox, Predicate predicate) { List list = Lists.newArrayList(); @@ -647,22 +404,7 @@ for (int i1 = i; i1 <= j; ++i1) { -@@ -2824,10 +3015,10 @@ - - public List getEntitiesWithinAABB(Class clazz, AxisAlignedBB aabb, Predicate filter) - { -- int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D); -- int j = MathHelper.floor_double((aabb.maxX + 2.0D) / 16.0D); -- int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D); -- int l = MathHelper.floor_double((aabb.maxZ + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((aabb.minX - MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.floor_double((aabb.maxX + MAX_ENTITY_RADIUS) / 16.0D); -+ int k = MathHelper.floor_double((aabb.minZ - MAX_ENTITY_RADIUS) / 16.0D); -+ int l = MathHelper.floor_double((aabb.maxZ + MAX_ENTITY_RADIUS) / 16.0D); - List list = Lists.newArrayList(); - - for (int i1 = i; i1 <= j; ++i1) -@@ -2905,11 +3096,13 @@ +@@ -2926,11 +3058,13 @@ public void loadEntities(Collection entityCollection) { @@ -679,27 +421,7 @@ } } -@@ -2922,7 +3115,9 @@ - { - Block block = this.getBlockState(pos).getBlock(); - AxisAlignedBB axisalignedbb = p_175716_3_ ? null : blockIn.getCollisionBoundingBox(this, pos, blockIn.getDefaultState()); -- return axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, entityIn) ? false : (block.getMaterial() == Material.circuits && blockIn == Blocks.anvil ? true : block.getMaterial().isReplaceable() && blockIn.canReplace(this, pos, side, itemStackIn)); -+ if (axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, entityIn)) return false; -+ if (block.getMaterial() == Material.circuits && blockIn == Blocks.anvil) return true; -+ return block.isReplaceable(this, pos) && blockIn.canReplace(this, pos, side, itemStackIn); - } - - public int getSeaLevel() -@@ -3007,7 +3202,7 @@ - { - IBlockState iblockstate = this.getBlockState(pos); - Block block = iblockstate.getBlock(); -- return block.isNormalCube() ? this.getStrongPower(pos) : block.getWeakPower(this, pos, iblockstate, facing); -+ return block.shouldCheckWeakPower(this, pos, facing) ? this.getStrongPower(pos) : block.getWeakPower(this, pos, iblockstate, facing); - } - - public boolean isBlockPowered(BlockPos pos) -@@ -3134,7 +3329,7 @@ +@@ -3215,7 +3349,7 @@ public long getSeed() { @@ -708,7 +430,7 @@ } public long getTotalWorldTime() -@@ -3144,17 +3339,17 @@ +@@ -3225,17 +3359,17 @@ public long getWorldTime() { @@ -729,7 +451,7 @@ if (!this.getWorldBorder().contains(blockpos)) { -@@ -3166,7 +3361,7 @@ +@@ -3247,7 +3381,7 @@ public void setSpawnPoint(BlockPos pos) { @@ -738,7 +460,7 @@ } @SideOnly(Side.CLIENT) -@@ -3186,12 +3381,18 @@ +@@ -3267,12 +3401,18 @@ if (!this.loadedEntityList.contains(entityIn)) { @@ -757,7 +479,7 @@ return true; } -@@ -3285,8 +3486,7 @@ +@@ -3366,8 +3506,7 @@ public boolean isBlockinHighHumidity(BlockPos pos) { @@ -767,7 +489,7 @@ } public MapStorage getMapStorage() -@@ -3345,12 +3545,12 @@ +@@ -3426,12 +3565,12 @@ public int getHeight() { @@ -782,7 +504,7 @@ } public Random setRandomSeed(int p_72843_1_, int p_72843_2_, int p_72843_3_) -@@ -3405,7 +3605,7 @@ +@@ -3481,7 +3620,7 @@ @SideOnly(Side.CLIENT) public double getHorizon() { @@ -791,7 +513,7 @@ } public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) -@@ -3439,7 +3639,7 @@ +@@ -3515,7 +3654,7 @@ public void updateComparatorOutputLevel(BlockPos pos, Block blockIn) { @@ -800,36 +522,10 @@ { BlockPos blockpos = pos.offset(enumfacing); -@@ -3447,18 +3647,14 @@ - { - IBlockState iblockstate = this.getBlockState(blockpos); - -- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) -+ iblockstate.getBlock().onNeighborChange(this, blockpos, pos); -+ if (iblockstate.getBlock().isNormalCube(this, blockpos)) - { -- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); -- } -- else if (iblockstate.getBlock().isNormalCube()) -- { -- blockpos = blockpos.offset(enumfacing); -- iblockstate = this.getBlockState(blockpos); -- -- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) -+ BlockPos posOther = blockpos.offset(enumfacing); -+ Block other = getBlockState(posOther).getBlock(); -+ if (other.getWeakChanges(this, posOther)) - { -- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); -+ other.onNeighborChange(this, posOther, pos); - } - } - } -@@ -3528,4 +3724,81 @@ - int k = 128; +@@ -3600,6 +3739,83 @@ return i >= -k && i <= k && j >= -k && j <= k; } -+ + + /* ======================================== FORGE START =====================================*/ + /** + * Determine if the given block is considered solid on the @@ -906,4 +602,7 @@ + { + return perWorldStorage; + } - } ++ + public void func_184135_a(Packet p_184135_1_) + { + throw new UnsupportedOperationException("Can\'t send packets to server unless you\'re on the client."); diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch index d281192b68..3995f98c23 100644 --- a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -1,51 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/WorldProvider.java +++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java -@@ -51,26 +51,12 @@ - - protected void registerWorldChunkManager() - { -- WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType(); -- -- if (worldtype == WorldType.FLAT) -- { -- FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions()); -- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), BiomeGenBase.field_180279_ad), 0.5F); -- } -- else if (worldtype == WorldType.DEBUG_WORLD) -- { -- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.0F); -- } -- else -- { -- this.worldChunkMgr = new WorldChunkManager(this.worldObj); -- } -+ this.worldChunkMgr = terrainType.getChunkManager(worldObj); - } - - public IChunkProvider createChunkGenerator() - { -- return (IChunkProvider)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings)))); -+ return terrainType.getChunkGenerator(worldObj, generatorSettings); - } - - public boolean canCoordinateBeSpawn(int x, int z) -@@ -153,13 +139,13 @@ - - public static WorldProvider getProviderForDimension(int dimension) - { -- return (WorldProvider)(dimension == -1 ? new WorldProviderHell() : (dimension == 0 ? new WorldProviderSurface() : (dimension == 1 ? new WorldProviderEnd() : null))); -+ return net.minecraftforge.common.DimensionManager.createProviderFor(dimension); - } - - @SideOnly(Side.CLIENT) - public float getCloudHeight() - { -- return 128.0F; -+ return this.terrainType.getCloudHeight(); - } - - @SideOnly(Side.CLIENT) -@@ -175,13 +161,13 @@ +@@ -172,13 +172,13 @@ public int getAverageGroundLevel() { @@ -61,11 +16,10 @@ } @SideOnly(Side.CLIENT) -@@ -223,4 +209,319 @@ - { +@@ -212,6 +212,321 @@ return new WorldBorder(); } -+ + + /*======================================= Forge Start =========================================*/ + private net.minecraftforge.client.IRenderHandler skyRenderer = null; + private net.minecraftforge.client.IRenderHandler cloudRenderer = null; @@ -380,4 +334,7 @@ + { + return true; + } - } ++ + public void func_186061_a(EntityPlayerMP p_186061_1_) + { + } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch index a37fdd7e46..3e6d94c700 100644 --- a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch @@ -1,55 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/WorldServer.java +++ ../src-work/minecraft/net/minecraft/world/WorldServer.java -@@ -94,30 +94,46 @@ - private static final List bonusChestContent = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.stick, 0, 1, 3, 10), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.planks), 0, 1, 3, 10), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.log), 0, 1, 3, 10), new WeightedRandomChestContent(Items.stone_axe, 0, 1, 1, 3), new WeightedRandomChestContent(Items.wooden_axe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.stone_pickaxe, 0, 1, 1, 3), new WeightedRandomChestContent(Items.wooden_pickaxe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.apple, 0, 2, 3, 5), new WeightedRandomChestContent(Items.bread, 0, 2, 3, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.log2), 0, 1, 3, 10)}); - private List pendingTickListEntriesThisTick = Lists.newArrayList(); - -+ /** Stores the recently processed (lighting) chunks */ -+ protected Set doneChunks = new java.util.HashSet(); -+ public List customTeleporters = new ArrayList(); -+ private static boolean initChest = false; -+ public static void fillChestHook() -+ { -+ if (!initChest) -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.BONUS_CHEST, bonusChestContent, 10, 10); -+ initChest = true; -+ } -+ - public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) - { - super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false); - this.mcServer = server; - this.theEntityTracker = new EntityTracker(this); - this.thePlayerManager = new PlayerManager(this); -+ // Guarantee the dimension ID was not reset by the provider -+ int providerDim = this.provider.dimensionId; - this.provider.registerWorld(this); -+ this.provider.dimensionId = providerDim; - this.chunkProvider = this.createChunkProvider(); -+ perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn)); - this.worldTeleporter = new Teleporter(this); - this.calculateInitialSkylight(); - this.calculateInitialWeather(); - this.getWorldBorder().setSize(server.getMaxWorldSize()); -+ net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this); - } - - public World init() - { - this.mapStorage = new MapStorage(this.saveHandler); - String s = VillageCollection.fileNameForProvider(this.provider); -- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); -+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); - - if (villagecollection == null) - { - this.villageCollectionObj = new VillageCollection(this); -- this.mapStorage.setData(s, this.villageCollectionObj); -+ this.perWorldStorage.setData(s, this.villageCollectionObj); - } - else - { -@@ -210,6 +226,10 @@ +@@ -214,6 +214,10 @@ this.villageSiege.tick(); this.theProfiler.endStartSection("portalForcer"); this.worldTeleporter.removeStalePortalLocations(this.getTotalWorldTime()); @@ -60,7 +11,7 @@ this.theProfiler.endSection(); this.sendQueuedBlockEvents(); } -@@ -217,12 +237,14 @@ +@@ -221,12 +225,14 @@ public BiomeGenBase.SpawnListEntry getSpawnListEntryForTypeAt(EnumCreatureType creatureType, BlockPos pos) { List list = this.getChunkProvider().getPossibleCreatures(creatureType, pos); @@ -75,7 +26,7 @@ return list != null && !list.isEmpty() ? list.contains(spawnListEntry) : false; } -@@ -268,10 +290,7 @@ +@@ -272,10 +278,7 @@ private void resetRainAndThunder() { @@ -87,16 +38,7 @@ } public boolean areAllPlayersAsleep() -@@ -349,7 +368,7 @@ - chunk.func_150804_b(false); - this.theProfiler.endStartSection("thunder"); - -- if (this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) -+ if (this.provider.canDoLightning(chunk) && this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) - { - this.updateLCG = this.updateLCG * 3 + 1013904223; - int i1 = this.updateLCG >> 2; -@@ -363,7 +382,7 @@ +@@ -409,7 +412,7 @@ this.theProfiler.endStartSection("iceandsnow"); @@ -104,8 +46,8 @@ + if (this.provider.canDoRainSnowIce(chunk) && this.rand.nextInt(16) == 0) { this.updateLCG = this.updateLCG * 3 + 1013904223; - int k2 = this.updateLCG >> 2; -@@ -456,6 +475,9 @@ + int j2 = this.updateLCG >> 2; +@@ -527,6 +530,9 @@ if (blockIn.requiresUpdates()) { i = 8; @@ -113,18 +55,18 @@ + boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.position.getX() >> 4, nextticklistentry.position.getZ() >> 4)); + i = isForced ? 0 : 8; - if (this.isAreaLoaded(nextticklistentry.position.add(-i, -i, -i), nextticklistentry.position.add(i, i, i))) + if (this.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i))) { -@@ -508,7 +530,7 @@ +@@ -588,7 +594,7 @@ public void updateEntities() { - if (this.playerEntities.isEmpty()) + if (this.playerEntities.isEmpty() && getPersistentChunks().isEmpty()) { - if (this.updateEntityTick++ >= 1200) + if (this.updateEntityTick++ >= 300) { -@@ -573,6 +595,9 @@ +@@ -712,6 +718,9 @@ { NextTickListEntry nextticklistentry1 = (NextTickListEntry)iterator.next(); iterator.remove(); @@ -134,7 +76,7 @@ int k = 0; if (this.isAreaLoaded(nextticklistentry1.position.add(-k, -k, -k), nextticklistentry1.position.add(k, k, k))) -@@ -696,22 +721,40 @@ +@@ -838,22 +847,40 @@ { List list = Lists.newArrayList(); @@ -182,40 +124,23 @@ return !this.mcServer.isBlockProtected(this, pos, player) && this.getWorldBorder().contains(pos); } -@@ -777,6 +820,7 @@ +@@ -919,6 +946,7 @@ } else { + if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; this.findingSpawnPoint = true; - WorldChunkManager worldchunkmanager = this.provider.getWorldChunkManager(); - List list = worldchunkmanager.getBiomesToSpawnIn(); -@@ -822,7 +866,7 @@ - - protected void createBonusChest() - { -- WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(bonusChestContent, 10); -+ WorldGeneratorBonusChest worldgeneratorbonuschest = net.minecraftforge.common.ForgeHooks.getBonusChest(rand); - - for (int i = 0; i < 10; ++i) - { -@@ -859,6 +903,7 @@ - } - - this.chunkProvider.saveChunks(p_73044_1_, progressCallback); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); - - for (Chunk chunk : Lists.newArrayList(this.theChunkProviderServer.func_152380_a())) - { -@@ -892,6 +937,7 @@ + BiomeProvider biomeprovider = this.provider.getWorldChunkManager(); + List list = biomeprovider.getBiomesToSpawnIn(); +@@ -1047,6 +1075,7 @@ this.worldInfo.setBorderLerpTime(this.getWorldBorder().getTimeUntilTarget()); - this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getHostPlayerData()); + this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.func_184103_al().getHostPlayerData()); this.mapStorage.saveAllData(); + this.perWorldStorage.saveAllData(); } - public void onEntityAdded(Entity entityIn) -@@ -947,6 +993,7 @@ + public boolean spawnEntityInWorld(Entity entityIn) +@@ -1161,6 +1190,7 @@ public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) { Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking); @@ -223,35 +148,7 @@ explosion.doExplosionA(); explosion.doExplosionB(false); -@@ -1026,19 +1073,23 @@ - this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionId()); - } - -+ /* The function in use here has been replaced in order to only send the weather info to players in the correct dimension, -+ * rather than to all players on the server. This is what causes the client-side rain, as the -+ * client believes that it has started raining locally, rather than in another dimension. -+ */ - if (flag != this.isRaining()) - { - if (flag) - { -- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F)); -+ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(2, 0.0F), this.provider.dimensionId); - } - else - { -- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(1, 0.0F)); -+ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(1, 0.0F), this.provider.dimensionId); - } - -- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, this.rainingStrength)); -- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, this.thunderingStrength)); -+ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); -+ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); - } - } - -@@ -1104,6 +1155,11 @@ +@@ -1329,6 +1359,11 @@ return this.mcServer.isCallingFromMinecraftThread(); } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch index 92ad1ae538..e99624d765 100644 --- a/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch @@ -30,9 +30,9 @@ } public World init() -@@ -58,12 +61,12 @@ - this.mapStorage = this.delegate.getMapStorage(); +@@ -59,12 +62,12 @@ this.worldScoreboard = this.delegate.getScoreboard(); + this.field_184151_B = this.delegate.func_184146_ak(); String s = VillageCollection.fileNameForProvider(this.provider); - VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); + VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); @@ -45,11 +45,10 @@ } else { -@@ -73,4 +76,12 @@ - +@@ -75,6 +78,14 @@ return this; } -+ + + + @Override + public void flush() @@ -57,4 +56,7 @@ + super.flush(); + this.delegate.getWorldBorder().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak. + } - } ++ + public void func_184166_c() + { + this.provider.func_186057_q(); diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch deleted file mode 100644 index 87ff307bcc..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeColorHelper.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeColorHelper.java -@@ -26,7 +26,7 @@ - { - public int getColorAtPos(BiomeGenBase p_180283_1_, BlockPos blockPosition) - { -- return p_180283_1_.waterColorMultiplier; -+ return p_180283_1_.getWaterColorMultiplier(); - } - }; - diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch index 9d510ede63..95281792f3 100644 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch @@ -1,81 +1,70 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeDecorator.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeDecorator.java -@@ -105,8 +105,10 @@ - - protected void genDecorations(BiomeGenBase biomeGenBaseIn) - { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(currentWorld, randomGenerator, field_180294_c)); - this.generateOres(); - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND)) - for (int i = 0; i < this.sandPerChunk2; ++i) - { - int j = this.randomGenerator.nextInt(16) + 8; -@@ -114,6 +116,7 @@ - this.sandGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(j, 0, k))); +@@ -100,6 +100,7 @@ + this.sandGen.generate(p_150513_2_, p_150513_3_, p_150513_2_.getTopSolidOrLiquidBlock(this.field_180294_c.add(j, 0, k))); } + if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CLAY)) for (int i1 = 0; i1 < this.clayPerChunk; ++i1) { - int l1 = this.randomGenerator.nextInt(16) + 8; -@@ -121,6 +124,7 @@ - this.clayGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(l1, 0, i6))); + int l1 = p_150513_3_.nextInt(16) + 8; +@@ -107,6 +108,7 @@ + this.clayGen.generate(p_150513_2_, p_150513_3_, p_150513_2_.getTopSolidOrLiquidBlock(this.field_180294_c.add(l1, 0, i6))); } + if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND_PASS2)) for (int j1 = 0; j1 < this.sandPerChunk; ++j1) { - int i2 = this.randomGenerator.nextInt(16) + 8; -@@ -135,6 +139,7 @@ + int i2 = p_150513_3_.nextInt(16) + 8; +@@ -121,6 +123,7 @@ ++k1; } + if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE)) for (int j2 = 0; j2 < k1; ++j2) { - int k6 = this.randomGenerator.nextInt(16) + 8; -@@ -149,6 +154,7 @@ + int k6 = p_150513_3_.nextInt(16) + 8; +@@ -135,6 +138,7 @@ } } + if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.BIG_SHROOM)) for (int k2 = 0; k2 < this.bigMushroomsPerChunk; ++k2) { - int l6 = this.randomGenerator.nextInt(16) + 8; -@@ -156,6 +162,7 @@ - this.bigMushroomGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getHeight(this.field_180294_c.add(l6, 0, k10))); + int l6 = p_150513_3_.nextInt(16) + 8; +@@ -142,6 +146,7 @@ + this.bigMushroomGen.generate(p_150513_2_, p_150513_3_, p_150513_2_.getHeight(this.field_180294_c.add(l6, 0, k10))); } + if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS)) for (int l2 = 0; l2 < this.flowersPerChunk; ++l2) { - int i7 = this.randomGenerator.nextInt(16) + 8; -@@ -177,6 +184,7 @@ + int i7 = p_150513_3_.nextInt(16) + 8; +@@ -163,6 +168,7 @@ } } + if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) for (int i3 = 0; i3 < this.grassPerChunk; ++i3) { - int j7 = this.randomGenerator.nextInt(16) + 8; -@@ -190,6 +198,7 @@ + int j7 = p_150513_3_.nextInt(16) + 8; +@@ -176,6 +182,7 @@ } } + if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.DEAD_BUSH)) for (int j3 = 0; j3 < this.deadBushPerChunk; ++j3) { - int k7 = this.randomGenerator.nextInt(16) + 8; -@@ -203,6 +212,7 @@ + int k7 = p_150513_3_.nextInt(16) + 8; +@@ -189,6 +196,7 @@ } } + if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LILYPAD)) for (int k3 = 0; k3 < this.waterlilyPerChunk; ++k3) { - int l7 = this.randomGenerator.nextInt(16) + 8; -@@ -229,6 +239,8 @@ + int l7 = p_150513_3_.nextInt(16) + 8; +@@ -215,6 +223,8 @@ } } @@ -83,9 +72,9 @@ + { for (int l3 = 0; l3 < this.mushroomsPerChunk; ++l3) { - if (this.randomGenerator.nextInt(4) == 0) -@@ -279,7 +291,9 @@ - this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j4, l15, l8)); + if (p_150513_3_.nextInt(4) == 0) +@@ -265,7 +275,9 @@ + this.mushroomRedGen.generate(p_150513_2_, p_150513_3_, this.field_180294_c.add(j4, l15, l8)); } } - @@ -94,76 +83,36 @@ + { for (int k4 = 0; k4 < this.reedsPerChunk; ++k4) { - int i9 = this.randomGenerator.nextInt(16) + 8; -@@ -305,7 +319,8 @@ - this.reedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j9, i19, i13)); - } - } -- -+ } // End of Reed generation -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.PUMPKIN)) - if (this.randomGenerator.nextInt(32) == 0) - { - int i5 = this.randomGenerator.nextInt(16) + 8; -@@ -319,6 +334,7 @@ + int i9 = p_150513_3_.nextInt(16) + 8; +@@ -305,6 +317,7 @@ } } + if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CACTUS)) for (int j5 = 0; j5 < this.cactiPerChunk; ++j5) { - int l9 = this.randomGenerator.nextInt(16) + 8; -@@ -334,6 +350,7 @@ + int l9 = p_150513_3_.nextInt(16) + 8; +@@ -320,6 +333,7 @@ if (this.generateLakes) { + if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_WATER)) for (int k5 = 0; k5 < 50; ++k5) { - int i10 = this.randomGenerator.nextInt(16) + 8; -@@ -348,6 +365,7 @@ + int i10 = p_150513_3_.nextInt(16) + 8; +@@ -334,6 +348,7 @@ } } + if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_LAVA)) for (int l5 = 0; l5 < 20; ++l5) { - int j10 = this.randomGenerator.nextInt(16) + 8; -@@ -357,6 +375,7 @@ - (new WorldGenLiquids(Blocks.flowing_lava)).generate(this.currentWorld, this.randomGenerator, blockpos3); + int j10 = p_150513_3_.nextInt(16) + 8; +@@ -343,6 +358,7 @@ + (new WorldGenLiquids(Blocks.flowing_lava)).generate(p_150513_2_, p_150513_3_, blockpos3); } } + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post(currentWorld, randomGenerator, field_180294_c)); } - protected void genStandardOre1(int blockCount, WorldGenerator generator, int minHeight, int maxHeight) -@@ -397,16 +416,29 @@ - - protected void generateOres() - { -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(currentWorld, randomGenerator, field_180294_c)); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, dirtGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIRT)) - this.genStandardOre1(this.chunkProviderSettings.dirtCount, this.dirtGen, this.chunkProviderSettings.dirtMinHeight, this.chunkProviderSettings.dirtMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, gravelGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRAVEL)) - this.genStandardOre1(this.chunkProviderSettings.gravelCount, this.gravelGen, this.chunkProviderSettings.gravelMinHeight, this.chunkProviderSettings.gravelMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, dioriteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIORITE)) - this.genStandardOre1(this.chunkProviderSettings.dioriteCount, this.dioriteGen, this.chunkProviderSettings.dioriteMinHeight, this.chunkProviderSettings.dioriteMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, graniteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRANITE)) - this.genStandardOre1(this.chunkProviderSettings.graniteCount, this.graniteGen, this.chunkProviderSettings.graniteMinHeight, this.chunkProviderSettings.graniteMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, andesiteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.ANDESITE)) - this.genStandardOre1(this.chunkProviderSettings.andesiteCount, this.andesiteGen, this.chunkProviderSettings.andesiteMinHeight, this.chunkProviderSettings.andesiteMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, coalGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.COAL)) - this.genStandardOre1(this.chunkProviderSettings.coalCount, this.coalGen, this.chunkProviderSettings.coalMinHeight, this.chunkProviderSettings.coalMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, ironGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.IRON)) - this.genStandardOre1(this.chunkProviderSettings.ironCount, this.ironGen, this.chunkProviderSettings.ironMinHeight, this.chunkProviderSettings.ironMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, goldGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GOLD)) - this.genStandardOre1(this.chunkProviderSettings.goldCount, this.goldGen, this.chunkProviderSettings.goldMinHeight, this.chunkProviderSettings.goldMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, redstoneGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.REDSTONE)) - this.genStandardOre1(this.chunkProviderSettings.redstoneCount, this.redstoneGen, this.chunkProviderSettings.redstoneMinHeight, this.chunkProviderSettings.redstoneMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, diamondGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIAMOND)) - this.genStandardOre1(this.chunkProviderSettings.diamondCount, this.diamondGen, this.chunkProviderSettings.diamondMinHeight, this.chunkProviderSettings.diamondMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, lapisGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.LAPIS)) - this.genStandardOre2(this.chunkProviderSettings.lapisCount, this.lapisGen, this.chunkProviderSettings.lapisCenterHeight, this.chunkProviderSettings.lapisSpread); -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(currentWorld, randomGenerator, field_180294_c)); - } - } + protected void generateOres(World p_76797_1_, Random p_76797_2_) diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch index e06baf0cab..59181c502c 100644 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch @@ -1,25 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenBase.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenBase.java -@@ -138,6 +138,10 @@ - - public BiomeGenBase(int id) - { -+ this(id, true); -+ } -+ public BiomeGenBase(int id, boolean register) -+ { - this.minHeight = height_Default.rootHeight; - this.maxHeight = height_Default.variation; - this.temperature = 0.5F; -@@ -152,6 +156,7 @@ - this.worldGeneratorBigTree = new WorldGenBigTree(false); - this.worldGeneratorSwamp = new WorldGenSwamp(); - this.biomeID = id; -+ if (register) - biomeList[id] = this; - this.theBiomeDecorator = this.createBiomeDecorator(); - this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); -@@ -168,11 +173,12 @@ +@@ -128,11 +128,12 @@ this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1)); this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); @@ -32,8 +13,8 @@ + return getModdedBiomeDecorator(new BiomeDecorator()); } - public BiomeGenBase setTemperatureRainfall(float temperatureIn, float rainfallIn) -@@ -342,7 +348,7 @@ + public boolean func_185363_b() +@@ -228,7 +229,7 @@ { double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(pos), 0.0F, 1.0F); double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); @@ -41,8 +22,8 @@ + return getModdedBiomeGrassColor(ColorizerGrass.getGrassColor(d0, d1)); } - @SideOnly(Side.CLIENT) -@@ -350,7 +356,7 @@ + public final void generateBiomeTerrain(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180628_4_, int p_180628_5_, double p_180628_6_) +@@ -321,7 +322,7 @@ { double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(pos), 0.0F, 1.0F); double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); @@ -50,89 +31,4 @@ + return getModdedBiomeFoliageColor(ColorizerFoliage.getFoliageColor(d0, d1)); } - public boolean isSnowyBiome() -@@ -497,6 +503,84 @@ - } - } - -+ /* ========================================= FORGE START ======================================*/ -+ protected List flowers = new java.util.ArrayList(); -+ -+ public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) -+ { -+ return new net.minecraftforge.event.terraingen.DeferredBiomeDecorator(original); -+ } -+ -+ public int getWaterColorMultiplier() -+ { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor(this, waterColorMultiplier); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; -+ } -+ -+ public int getModdedBiomeGrassColor(int original) -+ { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor(this, original); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; -+ } -+ -+ public int getModdedBiomeFoliageColor(int original) -+ { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor(this, original); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; -+ } -+ -+ /** -+ * Weighted random holder class used to hold possible flowers -+ * that can spawn in this biome when bonemeal is used on grass. -+ */ -+ public static class FlowerEntry extends WeightedRandom.Item -+ { -+ public final net.minecraft.block.state.IBlockState state; -+ public FlowerEntry(net.minecraft.block.state.IBlockState state, int weight) -+ { -+ super(weight); -+ this.state = state; -+ } -+ } -+ -+ /** -+ * Adds the default flowers, as of 1.7, it is 2 yellow, and 1 red. I chose 10 to allow some wiggle room in the numbers. -+ */ -+ public void addDefaultFlowers() -+ { -+ addFlower(Blocks.yellow_flower.getDefaultState().withProperty(Blocks.yellow_flower.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 20); -+ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); -+ } -+ -+ /** Register a new plant to be planted when bonemeal is used on grass. -+ * @param state The block to place. -+ * @param weight The weight of the plant, where red flowers are -+ * 10 and yellow flowers are 20. -+ */ -+ public void addFlower(IBlockState state, int weight) -+ { -+ this.flowers.add(new FlowerEntry(state, weight)); -+ } -+ -+ public void plantFlower(World world, Random rand, BlockPos pos) -+ { -+ FlowerEntry flower = (FlowerEntry)WeightedRandom.getRandomItem(rand, flowers); -+ if (flower == null || flower.state == null || -+ (flower.state.getBlock() instanceof net.minecraft.block.BlockBush && -+ !((net.minecraft.block.BlockBush)flower.state.getBlock()).canBlockStay(world, pos, flower.state))) -+ { -+ return; -+ } -+ -+ world.setBlockState(pos, flower.state, 3); -+ } -+ -+ -+ /* ========================================= FORGE END ======================================*/ -+ - static - { - plains.createMutation(); + public Class getBiomeClass() diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch index 4ec3410dc6..5b14837f4e 100644 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch @@ -1,10 +1,9 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenForest.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenForest.java -@@ -201,4 +201,20 @@ - }; +@@ -147,6 +147,22 @@ } } -+ + + @Override + public void addDefaultFlowers() + { @@ -20,4 +19,7 @@ + addFlower(net.minecraft.init.Blocks.red_flower.getDefaultState().withProperty(net.minecraft.init.Blocks.red_flower.getTypeProperty(), type), 10); + } + } - } ++ + public Class getBiomeClass() + { + return BiomeGenForest.class; diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch index 0f57bd0731..c349e0c2e9 100644 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenHills.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java -@@ -40,28 +40,20 @@ +@@ -37,28 +37,20 @@ public void decorate(World worldIn, Random rand, BlockPos pos) { super.decorate(worldIn, rand, pos); @@ -36,9 +36,9 @@ } public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_) -@@ -97,4 +89,23 @@ - { - return (new BiomeGenHills(p_180277_1_, false)).mutateHills(this); +@@ -86,4 +78,23 @@ + EXTRA_TREES, + MUTATED; } + + private static class EmeraldGenerator extends WorldGenerator diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch index db3f9dfa0b..af1488b9c4 100644 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenPlains.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenPlains.java -@@ -103,4 +103,19 @@ - biomegenplains.field_150609_ah = 14273354; - return biomegenplains; +@@ -92,4 +92,19 @@ + + super.decorate(worldIn, rand, pos); } + + @Override diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch index 298d372c22..c4cea2dc19 100644 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java -@@ -84,4 +84,10 @@ +@@ -86,4 +86,10 @@ { return 6975545; } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch deleted file mode 100644 index 34cb9dd866..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/WorldChunkManager.java -+++ ../src-work/minecraft/net/minecraft/world/biome/WorldChunkManager.java -@@ -16,6 +16,7 @@ - - public class WorldChunkManager - { -+ public static List allowedBiomes = Lists.newArrayList(BiomeGenBase.forest, BiomeGenBase.plains, BiomeGenBase.taiga, BiomeGenBase.taigaHills, BiomeGenBase.forestHills, BiomeGenBase.jungle, BiomeGenBase.jungleHills); - private GenLayer genBiomes; - private GenLayer biomeIndexLayer; - private BiomeCache biomeCache; -@@ -27,13 +28,7 @@ - this.biomeCache = new BiomeCache(this); - this.field_180301_f = ""; - this.biomesToSpawnIn = Lists.newArrayList(); -- this.biomesToSpawnIn.add(BiomeGenBase.forest); -- this.biomesToSpawnIn.add(BiomeGenBase.plains); -- this.biomesToSpawnIn.add(BiomeGenBase.taiga); -- this.biomesToSpawnIn.add(BiomeGenBase.taigaHills); -- this.biomesToSpawnIn.add(BiomeGenBase.forestHills); -- this.biomesToSpawnIn.add(BiomeGenBase.jungle); -- this.biomesToSpawnIn.add(BiomeGenBase.jungleHills); -+ this.biomesToSpawnIn.addAll(allowedBiomes); - } - - public WorldChunkManager(long seed, WorldType p_i45744_3_, String p_i45744_4_) -@@ -41,6 +36,7 @@ - this(); - this.field_180301_f = p_i45744_4_; - GenLayer[] agenlayer = GenLayer.initializeAllBiomeGenerators(seed, p_i45744_3_, p_i45744_4_); -+ agenlayer = getModdedBiomeGenerators(p_i45744_3_, seed, agenlayer); - this.genBiomes = agenlayer[0]; - this.biomeIndexLayer = agenlayer[1]; - } -@@ -249,4 +245,11 @@ - { - this.biomeCache.cleanupCache(); - } -+ -+ public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original) -+ { -+ net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens event = new net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens(worldType, seed, original); -+ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ return event.newBiomeGens; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch index b3437136c0..c9ec58283a 100644 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -1,30 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java +++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java -@@ -167,7 +167,7 @@ - { - Block block = this.getBlock0(j, l - 1, k); - -- if (block.getLightOpacity() != 0) -+ if (getBlockLightOpacity(j, l - 1, k) != 0) - { - this.heightMap[k << 4 | j] = l; - -@@ -440,12 +440,12 @@ - - public int getBlockLightOpacity(BlockPos pos) - { -- return this.getBlock(pos).getLightOpacity(); -+ return this.getBlock(pos).getLightOpacity(worldObj, pos); - } - - private int getBlockLightOpacity(int x, int y, int z) - { -- return this.getBlock0(x, y, z).getLightOpacity(); -+ return getBlockLightOpacity(new BlockPos((xPosition << 4) + x, y, (zPosition << 4) + z)); - } - - private Block getBlock0(int x, int y, int z) -@@ -607,6 +607,7 @@ +@@ -534,6 +534,7 @@ { Block block = state.getBlock(); Block block1 = iblockstate.getBlock(); @@ -32,7 +8,7 @@ ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4]; boolean flag = false; -@@ -623,14 +624,19 @@ +@@ -550,14 +551,19 @@ extendedblockstorage.set(i, j & 15, k, state); @@ -54,17 +30,7 @@ this.worldObj.removeTileEntity(pos); } } -@@ -647,8 +653,7 @@ - } - else - { -- int j1 = block.getLightOpacity(); -- int k1 = block1.getLightOpacity(); -+ int j1 = block.getLightOpacity(this.worldObj, pos); - - if (j1 > 0) - { -@@ -668,28 +673,18 @@ +@@ -595,28 +601,18 @@ } } @@ -95,7 +61,7 @@ this.worldObj.setTileEntity(pos, tileentity1); } -@@ -792,6 +787,7 @@ +@@ -719,6 +715,7 @@ k = this.entityLists.length - 1; } @@ -103,29 +69,7 @@ entityIn.addedToChunk = true; entityIn.chunkCoordX = this.xPosition; entityIn.chunkCoordY = k; -@@ -830,13 +826,20 @@ - private TileEntity createNewTileEntity(BlockPos pos) - { - Block block = this.getBlock(pos); -- return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, this.getBlockMetadata(pos)); -+ IBlockState state = block.getStateFromMeta(this.getBlockMetadata(pos)); -+ return !block.hasTileEntity(state) ? null : block.createTileEntity(this.worldObj, state); - } - - public TileEntity getTileEntity(BlockPos pos, Chunk.EnumCreateEntityType p_177424_2_) - { - TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(pos); - -+ if (tileentity != null && tileentity.isInvalid()) -+ { -+ chunkTileEntityMap.remove(pos); -+ tileentity = null; -+ } -+ - if (tileentity == null) - { - if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) -@@ -846,14 +849,9 @@ +@@ -774,14 +771,9 @@ } else if (p_177424_2_ == Chunk.EnumCreateEntityType.QUEUED) { @@ -141,16 +85,7 @@ return tileentity; } -@@ -873,7 +871,7 @@ - tileEntityIn.setWorldObj(this.worldObj); - tileEntityIn.setPos(pos); - -- if (this.getBlock(pos) instanceof ITileEntityProvider) -+ if (this.getBlock(pos).hasTileEntity(getBlock(pos).getStateFromMeta(this.getBlockMetadata(pos)))) - { - if (this.chunkTileEntityMap.containsKey(pos)) - { -@@ -882,6 +880,7 @@ +@@ -810,6 +802,7 @@ tileEntityIn.validate(); this.chunkTileEntityMap.put(pos, tileEntityIn); @@ -158,7 +93,7 @@ } } -@@ -910,8 +909,9 @@ +@@ -838,8 +831,9 @@ entity.onChunkLoad(); } @@ -169,7 +104,7 @@ } public void onChunkUnload() -@@ -927,6 +927,7 @@ +@@ -855,6 +849,7 @@ { this.worldObj.unloadEntities(this.entityLists[i]); } @@ -177,7 +112,7 @@ } public void setChunkModified() -@@ -936,8 +937,8 @@ +@@ -864,8 +859,8 @@ public void getEntitiesWithinAABBForEntity(Entity entityIn, AxisAlignedBB aabb, List listToFill, Predicate p_177414_4_) { @@ -188,7 +123,7 @@ i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); -@@ -976,8 +977,8 @@ +@@ -904,8 +899,8 @@ public void getEntitiesOfTypeWithinAAAB(Class entityClass, AxisAlignedBB aabb, List listToFill, Predicate p_177430_4_) { @@ -199,33 +134,7 @@ i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); -@@ -1137,8 +1138,10 @@ - while (!this.tileEntityPosQueue.isEmpty()) - { - BlockPos blockpos = (BlockPos)this.tileEntityPosQueue.poll(); -+ Block block = this.getBlock(blockpos); -+ IBlockState state = block.getStateFromMeta(this.getBlockMetadata(blockpos)); - -- if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.getBlock(blockpos).hasTileEntity()) -+ if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && block.hasTileEntity(state)) - { - TileEntity tileentity = this.createNewTileEntity(blockpos); - this.worldObj.setTileEntity(blockpos, tileentity); -@@ -1200,6 +1203,13 @@ - @SideOnly(Side.CLIENT) - public void fillChunk(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_) - { -+ for(TileEntity tileEntity : chunkTileEntityMap.values()) -+ { -+ tileEntity.updateContainingBlockInfo(); -+ tileEntity.getBlockMetadata(); -+ tileEntity.getBlockType(); -+ } -+ - int i = 0; - boolean flag = !this.worldObj.provider.getHasNoSky(); - -@@ -1267,10 +1277,16 @@ +@@ -1162,10 +1157,16 @@ this.isTerrainPopulated = true; this.generateHeightMap(); @@ -241,8 +150,8 @@ + for (TileEntity te : invalidList) te.invalidate(); } - public BiomeGenBase getBiome(BlockPos pos, WorldChunkManager chunkManager) -@@ -1583,4 +1599,20 @@ + public BiomeGenBase getBiome(BlockPos pos, BiomeProvider chunkManager) +@@ -1481,4 +1482,20 @@ QUEUED, CHECK; } diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch index 2be4b4a6a9..0b1799fd46 100644 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java -@@ -42,8 +42,41 @@ - this.chunkSaveLocation = chunkSaveLocationIn; +@@ -46,8 +46,41 @@ + this.field_186055_e = p_i46673_2_; } + public boolean chunkExists(World world, int x, int z) @@ -42,8 +42,8 @@ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); NBTTagCompound nbttagcompound = (NBTTagCompound)this.chunksToRemove.get(chunkcoordintpair); -@@ -59,11 +92,17 @@ - nbttagcompound = CompressedStreamTools.read(datainputstream); +@@ -63,11 +96,17 @@ + nbttagcompound = this.field_186055_e.func_188257_a(FixTypes.CHUNK, CompressedStreamTools.read(datainputstream)); } - return this.checkedReadChunkFromNBT(worldIn, x, z, nbttagcompound); @@ -61,7 +61,7 @@ if (!p_75822_4_.hasKey("Level", 10)) { logger.error("Chunk file at " + x + "," + z + " is missing level data, skipping"); -@@ -87,10 +126,29 @@ +@@ -91,10 +130,29 @@ logger.error("Chunk file at " + x + "," + z + " is in the wrong location; relocating. (Expected " + x + ", " + z + ", got " + chunk.xPosition + ", " + chunk.zPosition + ")"); nbttagcompound.setInteger("xPos", x); nbttagcompound.setInteger("zPos", z); @@ -92,54 +92,15 @@ } } } -@@ -105,6 +163,7 @@ - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); +@@ -110,6 +168,7 @@ nbttagcompound.setTag("Level", nbttagcompound1); + nbttagcompound.setInteger("DataVersion", 169); this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(chunkIn, nbttagcompound)); this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound); } catch (Exception exception) -@@ -281,11 +340,20 @@ - { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - -+ try -+ { - if (entity.writeToNBTOptional(nbttagcompound1)) - { - chunkIn.setHasEntities(true); - nbttaglist1.appendTag(nbttagcompound1); - } -+ } -+ catch (Exception e) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, -+ "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author", -+ entity.getClass().getName()); -+ } - } - } - -@@ -295,8 +363,17 @@ - for (TileEntity tileentity : chunkIn.getTileEntityMap().values()) - { - NBTTagCompound nbttagcompound2 = new NBTTagCompound(); -+ try -+ { - tileentity.writeToNBT(nbttagcompound2); - nbttaglist2.appendTag(nbttagcompound2); -+ } -+ catch (Exception e) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, -+ "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author", -+ tileentity.getClass().getName()); -+ } - } - - p_75820_3_.setTag("TileEntities", nbttaglist2); -@@ -376,6 +453,12 @@ +@@ -347,6 +406,12 @@ chunk.setBiomeArray(p_75823_2_.getByteArray("Biomes")); } @@ -152,11 +113,12 @@ NBTTagList nbttaglist1 = p_75823_2_.getTagList("Entities", 10); if (nbttaglist1 != null) -@@ -447,7 +530,5 @@ +@@ -399,8 +464,6 @@ } } } - - return chunk; } - } + + public static Entity func_186050_a(NBTTagCompound p_186050_0_, World p_186050_1_, Chunk p_186050_2_) diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch deleted file mode 100644 index 8252f45490..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java -@@ -20,18 +20,12 @@ - { - File file1 = this.getWorldDirectory(); - -- if (provider instanceof WorldProviderHell) -+ if (provider.getSaveFolder() != null) - { -- File file3 = new File(file1, "DIM-1"); -+ File file3 = new File(file1, provider.getSaveFolder()); - file3.mkdirs(); - return new AnvilChunkLoader(file3); - } -- else if (provider instanceof WorldProviderEnd) -- { -- File file2 = new File(file1, "DIM1"); -- file2.mkdirs(); -- return new AnvilChunkLoader(file2); -- } - else - { - return new AnvilChunkLoader(file1); diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch index 01c861ed3d..bb5d0c2111 100644 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/storage/RegionFile.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/RegionFile.java -@@ -101,6 +101,39 @@ +@@ -94,6 +94,39 @@ } } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch index 45b2a8d71a..9f87f08fa4 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch @@ -1,33 +1,8 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java -@@ -32,6 +32,9 @@ - double[] noiseData3; - double[] noiseData4; - double[] noiseData5; -+ // temporary variables used during event handling -+ private int chunkX = 0; -+ private int chunkZ = 0; +@@ -123,6 +123,9 @@ - public ChunkProviderEnd(World worldIn, long p_i2007_2_) - { -@@ -42,6 +45,14 @@ - this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, 8); - this.noiseGen4 = new NoiseGeneratorOctaves(this.endRNG, 10); - this.noiseGen5 = new NoiseGeneratorOctaves(this.endRNG, 16); -+ -+ NoiseGenerator[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5}; -+ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.endRNG, noiseGens); -+ this.noiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.noiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.noiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.noiseGen4 = (NoiseGeneratorOctaves)noiseGens[3]; -+ this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; - } - - public void func_180520_a(int p_180520_1_, int p_180520_2_, ChunkPrimer p_180520_3_) -@@ -114,6 +125,9 @@ - - public void func_180519_a(ChunkPrimer p_180519_1_) + public void func_185962_a(ChunkPrimer p_185962_1_) { + net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, p_180519_1_, this.endWorld); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); @@ -35,33 +10,3 @@ for (int i = 0; i < 16; ++i) { for (int j = 0; j < 16; ++j) -@@ -165,6 +179,7 @@ - - public Chunk provideChunk(int x, int z) - { -+ chunkX = x; chunkZ = z; - this.endRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L); - ChunkPrimer chunkprimer = new ChunkPrimer(); - this.biomesForGeneration = this.endWorld.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); -@@ -184,6 +199,10 @@ - - private double[] initializeNoiseField(double[] p_73187_1_, int p_73187_2_, int p_73187_3_, int p_73187_4_, int p_73187_5_, int p_73187_6_, int p_73187_7_) - { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField(this, p_73187_1_, p_73187_2_, p_73187_3_, p_73187_4_, p_73187_5_, p_73187_6_, p_73187_7_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; -+ - if (p_73187_1_ == null) - { - p_73187_1_ = new double[p_73187_5_ * p_73187_6_ * p_73187_7_]; -@@ -273,8 +292,10 @@ - public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) - { - BlockFalling.fallInstantly = true; -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, endWorld, endWorld.rand, p_73153_2_, p_73153_3_, false)); - BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); - this.endWorld.getBiomeGenForCoords(blockpos.add(16, 0, 16)).decorate(this.endWorld, this.endWorld.rand, blockpos); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, endWorld, endWorld.rand, p_73153_2_, p_73153_3_, false)); - BlockFalling.fallInstantly = false; - } - diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch deleted file mode 100644 index e1cdf2321c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch +++ /dev/null @@ -1,110 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java -@@ -58,6 +58,15 @@ - - public ChunkProviderGenerate(World worldIn, long p_i45636_2_, boolean p_i45636_4_, String p_i45636_5_) - { -+ { -+ caveGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(caveGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE); -+ strongholdGenerator = (MapGenStronghold)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(strongholdGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD); -+ villageGenerator = (MapGenVillage)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(villageGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE); -+ mineshaftGenerator = (MapGenMineshaft)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(mineshaftGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT); -+ scatteredFeatureGenerator = (MapGenScatteredFeature)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(scatteredFeatureGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE); -+ ravineGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(ravineGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE); -+ oceanMonumentGenerator = (StructureOceanMonument)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(oceanMonumentGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.OCEAN_MONUMENT); -+ } - this.worldObj = worldIn; - this.mapFeaturesEnabled = p_i45636_4_; - this.field_177475_o = worldIn.getWorldInfo().getTerrainType(); -@@ -87,6 +96,16 @@ - this.field_177476_s = this.settings.useLavaOceans ? Blocks.lava : Blocks.water; - worldIn.setSeaLevel(this.settings.seaLevel); - } -+ -+ NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, noiseGen5, noiseGen6, mobSpawnerNoise}; -+ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.rand, noiseGens); -+ this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.field_147430_m = (NoiseGeneratorPerlin)noiseGens[3]; -+ this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; -+ this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; -+ this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6]; - } - - public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) -@@ -160,6 +179,10 @@ - - public void replaceBlocksForBiome(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) - { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.worldObj); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; -+ - double d0 = 0.03125D; - this.stoneNoise = this.field_147430_m.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); - -@@ -366,6 +389,8 @@ - boolean flag = false; - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); -+ - if (this.settings.useMineShafts && this.mapFeaturesEnabled) - { - this.mineshaftGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair); -@@ -391,7 +416,8 @@ - this.oceanMonumentGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair); - } - -- if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0) -+ if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0 -+ && net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) - { - int i1 = this.rand.nextInt(16) + 8; - int j1 = this.rand.nextInt(256); -@@ -399,7 +425,8 @@ - (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, blockpos.add(i1, j1, k1)); - } - -- if (!flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes) -+ if (!flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes && -+ net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA)) - { - int i2 = this.rand.nextInt(16) + 8; - int l2 = this.rand.nextInt(this.rand.nextInt(248) + 8); -@@ -413,7 +440,8 @@ - - if (this.settings.useDungeons) - { -- for (int j2 = 0; j2 < this.settings.dungeonChance; ++j2) -+ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON); -+ for (int j2 = 0; doGen && j2 < this.settings.dungeonChance; ++j2) - { - int i3 = this.rand.nextInt(16) + 8; - int l3 = this.rand.nextInt(256); -@@ -423,10 +451,14 @@ - } - - biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(i, 0, j)); -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS)) -+ { - SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, i + 8, j + 8, 16, 16, this.rand); -+ } - blockpos = blockpos.add(8, 0, 8); - -- for (int k2 = 0; k2 < 16; ++k2) -+ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE); -+ for (int k2 = 0; doGen && k2 < 16; ++k2) - { - for (int j3 = 0; j3 < 16; ++j3) - { -@@ -445,6 +477,8 @@ - } - } - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); -+ - BlockFalling.fallInstantly = false; - } - diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch deleted file mode 100644 index 1e86f817c1..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch +++ /dev/null @@ -1,141 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderHell.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderHell.java -@@ -49,8 +49,8 @@ - private final WorldGenHellLava field_177472_y = new WorldGenHellLava(Blocks.flowing_lava, false); - private final GeneratorBushFeature field_177471_z = new GeneratorBushFeature(Blocks.brown_mushroom); - private final GeneratorBushFeature field_177465_A = new GeneratorBushFeature(Blocks.red_mushroom); -- private final MapGenNetherBridge genNetherBridge = new MapGenNetherBridge(); -- private final MapGenBase netherCaveGenerator = new MapGenCavesHell(); -+ private final MapGenNetherBridge genNetherBridge; -+ private final MapGenBase netherCaveGenerator; - double[] noiseData1; - double[] noiseData2; - double[] noiseData3; -@@ -59,16 +59,29 @@ - - public ChunkProviderHell(World worldIn, boolean p_i45637_2_, long p_i45637_3_) - { -+ this.genNetherBridge = (MapGenNetherBridge) net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(new MapGenNetherBridge(), net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_BRIDGE); -+ this.netherCaveGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(new MapGenCavesHell(), net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_CAVE); - this.worldObj = worldIn; - this.field_177466_i = p_i45637_2_; - this.hellRNG = new Random(p_i45637_3_); -- this.netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); -- this.netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); -- this.netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); -- this.slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); -- this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); -- this.netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); -- this.netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); -+ NoiseGeneratorOctaves netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); -+ NoiseGeneratorOctaves netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); -+ NoiseGeneratorOctaves netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); -+ NoiseGeneratorOctaves slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); -+ NoiseGeneratorOctaves netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); -+ NoiseGeneratorOctaves netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); -+ NoiseGeneratorOctaves netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); -+ NoiseGenerator[] noiseGens = new NoiseGenerator[] { -+ netherNoiseGen1, netherNoiseGen2, netherNoiseGen3, slowsandGravelNoiseGen, netherrackExculsivityNoiseGen, netherNoiseGen6, netherNoiseGen7 -+ }; -+ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.hellRNG, noiseGens); -+ this.netherNoiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.netherNoiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.netherNoiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.slowsandGravelNoiseGen = (NoiseGeneratorOctaves)noiseGens[3]; -+ this.netherrackExculsivityNoiseGen = (NoiseGeneratorOctaves)noiseGens[4]; -+ this.netherNoiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; -+ this.netherNoiseGen7 = (NoiseGeneratorOctaves)noiseGens[6]; - worldIn.setSeaLevel(63); - } - -@@ -148,6 +161,10 @@ - - public void func_180516_b(int p_180516_1_, int p_180516_2_, ChunkPrimer p_180516_3_) - { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180516_1_, p_180516_2_, p_180516_3_, this.worldObj); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; -+ - int i = this.worldObj.getSeaLevel() + 1; - double d0 = 0.03125D; - this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, p_180516_1_ * 16, p_180516_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); -@@ -265,6 +282,10 @@ - - private double[] initializeNoiseField(double[] p_73164_1_, int p_73164_2_, int p_73164_3_, int p_73164_4_, int p_73164_5_, int p_73164_6_, int p_73164_7_) - { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField(this, p_73164_1_, p_73164_2_, p_73164_3_, p_73164_4_, p_73164_5_, p_73164_6_, p_73164_7_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; -+ - if (p_73164_1_ == null) - { - p_73164_1_ = new double[p_73164_5_ * p_73164_6_ * p_73164_7_]; -@@ -356,50 +377,60 @@ - public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) - { - BlockFalling.fallInstantly = true; -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false)); - BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); - this.genNetherBridge.generateStructure(this.worldObj, this.hellRNG, chunkcoordintpair); - -- for (int i = 0; i < 8; ++i) -+ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA); -+ for (int i = 0; doGen && i < 8; ++i) - { - this.field_177472_y.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); - } - -- for (int j = 0; j < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++j) -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.FIRE); -+ for (int j = 0; doGen && j < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++j) - { - this.field_177470_t.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); - } - -- for (int k = 0; k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.GLOWSTONE); -+ for (int k = 0; doGen && k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) - { - this.field_177469_u.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); - } - -- for (int l = 0; l < 10; ++l) -+ for (int l = 0; doGen && l < 10; ++l) - { - this.field_177468_v.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); - } - -- if (this.hellRNG.nextBoolean()) -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(worldObj, hellRNG, blockpos)); -+ -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.decorate(worldObj, hellRNG, blockpos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM); -+ if (doGen && this.hellRNG.nextBoolean()) - { - this.field_177471_z.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); - } - -- if (this.hellRNG.nextBoolean()) -+ if (doGen && this.hellRNG.nextBoolean()) - { - this.field_177465_A.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); - } - -- for (int i1 = 0; i1 < 16; ++i1) -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.generateOre(worldObj, hellRNG, field_177467_w, blockpos, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.QUARTZ); -+ for (int i1 = 0; doGen && i1 < 16; ++i1) - { - this.field_177467_w.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); - } - -- for (int j1 = 0; j1 < 16; ++j1) -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA2); -+ for (int j1 = 0; doGen && j1 < 16; ++j1) - { - this.field_177473_x.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); - } - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false)); - BlockFalling.fallInstantly = false; - } - diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch index fa818727df..3899f6d81e 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch @@ -1,104 +1,22 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderServer.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderServer.java -@@ -36,6 +36,7 @@ - public LongHashMap id2ChunkMap = new LongHashMap(); - public List loadedChunks = Lists.newArrayList(); - public WorldServer worldObj; +@@ -33,6 +33,7 @@ + public final LongHashMap id2ChunkMap = new LongHashMap(); + public final List loadedChunks = Lists.newArrayList(); + public final WorldServer worldObj; + private Set loadingChunks = com.google.common.collect.Sets.newHashSet(); - public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) + public ChunkProviderServer(WorldServer p_i46838_1_, IChunkLoader p_i46838_2_, IChunkGenerator p_i46838_3_) { -@@ -57,7 +58,7 @@ - - public void dropChunk(int x, int z) - { -- if (this.worldObj.provider.canRespawnHere()) -+ if (this.worldObj.provider.canRespawnHere() && net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimensionId())) - { - if (!this.worldObj.isSpawnChunk(x, z)) - { -@@ -80,12 +81,64 @@ - - public Chunk loadChunk(int p_73158_1_, int p_73158_2_) - { -+ return loadChunk(p_73158_1_, p_73158_2_, null); -+ } -+ -+ public Chunk loadChunk(int par1, int par2, Runnable runnable) -+ { -+ long k = ChunkCoordIntPair.chunkXZ2Int(par1, par2); -+ this.droppedChunksSet.remove(Long.valueOf(k)); -+ Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(k); -+ net.minecraft.world.chunk.storage.AnvilChunkLoader loader = null; -+ -+ if (this.chunkLoader instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader) -+ { -+ loader = (net.minecraft.world.chunk.storage.AnvilChunkLoader) this.chunkLoader; -+ } -+ -+ // We can only use the queue for already generated chunks -+ if (chunk == null && loader != null && loader.chunkExists(this.worldObj, par1, par2)) -+ { -+ if (runnable != null) -+ { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.queueChunkLoad(this.worldObj, loader, this, par1, par2, runnable); -+ return null; -+ } -+ else -+ { -+ chunk = net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(this.worldObj, loader, this, par1, par2); -+ } -+ } -+ else if (chunk == null) -+ { -+ chunk = this.originalLoadChunk(par1, par2); -+ } -+ -+ // If we didn't load the chunk async and have a callback run it now -+ if (runnable != null) -+ { -+ runnable.run(); -+ } -+ -+ return chunk; -+ } -+ -+ public Chunk originalLoadChunk(int p_73158_1_, int p_73158_2_) -+ { - long i = ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_); - this.droppedChunksSet.remove(Long.valueOf(i)); - Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(i); - - if (chunk == null) - { -+ boolean added = loadingChunks.add(i); -+ if (!added) -+ { -+ net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in di >mension %d that is already being loaded. This will cause weird chunk breakages.", p_73158_1_, p_73158_2_, worldObj.provider.getDimensionId()); -+ } -+ chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(i, this.worldObj); -+ -+ if (chunk == null) - chunk = this.loadChunkFromFile(p_73158_1_, p_73158_2_); - - if (chunk == null) -@@ -114,6 +167,7 @@ +@@ -118,6 +119,7 @@ this.id2ChunkMap.add(i, chunk); this.loadedChunks.add(chunk); + loadingChunks.remove(i); chunk.onChunkLoad(); - chunk.populateChunk(this, this, p_73158_1_, p_73158_2_); + chunk.func_186030_a(this, this.field_186029_c); } -@@ -205,6 +259,7 @@ - if (this.serverChunkGenerator != null) - { - this.serverChunkGenerator.populate(p_73153_1_, p_73153_2_, p_73153_3_); -+ net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(p_73153_2_, p_73153_3_, worldObj, serverChunkGenerator, p_73153_1_); - chunk.setChunkModified(); - } - } -@@ -266,6 +321,11 @@ +@@ -214,6 +216,11 @@ { if (!this.worldObj.disableLevelSaving) { @@ -110,7 +28,7 @@ for (int i = 0; i < 100; ++i) { if (!this.droppedChunksSet.isEmpty()) -@@ -280,6 +340,12 @@ +@@ -228,6 +235,12 @@ this.saveChunkExtraData(chunk); this.id2ChunkMap.remove(olong.longValue()); this.loadedChunks.remove(chunk); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch index 61a4e86c32..432cee4847 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/MapGenCaves.java +++ ../src-work/minecraft/net/minecraft/world/gen/MapGenCaves.java -@@ -138,7 +138,7 @@ +@@ -143,7 +143,7 @@ { IBlockState iblockstate = p_180702_5_.getBlockState(j1, l1, k1); @@ -9,43 +9,7 @@ { flag3 = true; } -@@ -176,33 +176,12 @@ - IBlockState iblockstate1 = p_180702_5_.getBlockState(j3, j2, i2); - IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.getBlockState(j3, j2 + 1, i2), Blocks.air.getDefaultState()); - -- if (iblockstate1.getBlock() == Blocks.grass || iblockstate1.getBlock() == Blocks.mycelium) -+ if (isTopBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_)) - { - flag1 = true; - } - -- if (this.func_175793_a(iblockstate1, iblockstate2)) -- { -- if (j2 - 1 < 10) -- { -- p_180702_5_.setBlockState(j3, j2, i2, Blocks.lava.getDefaultState()); -- } -- else -- { -- p_180702_5_.setBlockState(j3, j2, i2, Blocks.air.getDefaultState()); -- -- if (iblockstate2.getBlock() == Blocks.sand) -- { -- p_180702_5_.setBlockState(j3, j2 + 1, i2, iblockstate2.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState()); -- } -- -- if (flag1 && p_180702_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) -- { -- blockpos$mutableblockpos.set(j3 + p_180702_3_ * 16, 0, i2 + p_180702_4_ * 16); -- p_180702_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock.getBlock().getDefaultState()); -- } -- } -- } -+ digBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2); - } - } - } -@@ -261,4 +240,71 @@ +@@ -266,4 +266,71 @@ } } } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch index c8b15c2be3..030975e7fe 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/MapGenRavine.java +++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java -@@ -128,7 +128,7 @@ +@@ -130,7 +130,7 @@ { IBlockState iblockstate = p_180707_5_.getBlockState(j1, l1, k1); @@ -9,38 +9,7 @@ { flag2 = true; } -@@ -165,28 +165,12 @@ - { - IBlockState iblockstate1 = p_180707_5_.getBlockState(j3, j2, i2); - -- if (iblockstate1.getBlock() == Blocks.grass) -+ if (isTopBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_)) - { - flag = true; - } - -- if (iblockstate1.getBlock() == Blocks.stone || iblockstate1.getBlock() == Blocks.dirt || iblockstate1.getBlock() == Blocks.grass) -- { -- if (j2 - 1 < 10) -- { -- p_180707_5_.setBlockState(j3, j2, i2, Blocks.flowing_lava.getDefaultState()); -- } -- else -- { -- p_180707_5_.setBlockState(j3, j2, i2, Blocks.air.getDefaultState()); -- -- if (flag && p_180707_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) -- { -- blockpos$mutableblockpos.set(j3 + p_180707_3_ * 16, 0, i2 + p_180707_4_ * 16); -- p_180707_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock); -- } -- } -- } -+ digBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_, flag); - } - } - } -@@ -221,4 +205,68 @@ +@@ -223,4 +223,68 @@ } } } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch deleted file mode 100644 index 692f00c09b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java -@@ -54,7 +54,7 @@ - { - Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock(); - -- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) -+ if (!block.isAir(worldIn, blockpos$mutableblockpos) && !block.isLeaves(worldIn, blockpos$mutableblockpos)) - { - flag = false; - } -@@ -190,7 +190,7 @@ - { - BlockPos blockpos = new BlockPos(l1, l2, i2); - -- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.mushroomType.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, blockhugemushroom$enumtype)); - } -@@ -201,9 +201,10 @@ - - for (int i3 = 0; i3 < i; ++i3) - { -- Block block2 = worldIn.getBlockState(position.up(i3)).getBlock(); -+ BlockPos upN = position.up(i3); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(upN); - -- if (!block2.isFullBlock()) -+ if (state.getBlock().canBeReplacedByLeaves(worldIn, upN)) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(i3), this.mushroomType.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, BlockHugeMushroom.EnumType.STEM)); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch index 02e90923a2..00b08fad2a 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch @@ -1,17 +1,5 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java -@@ -99,9 +99,9 @@ - if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_181631_2_ * p_181631_2_)) - { - BlockPos blockpos = p_181631_1_.add(j, 0, k); -- Material material = this.world.getBlockState(blockpos).getBlock().getMaterial(); -+ net.minecraft.block.state.IBlockState state = this.world.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(this.world, blockpos) || state.getBlock().isLeaves(this.world, blockpos)) - { - this.setBlockAndNotifyAdequately(this.world, blockpos, p_181631_3_); - } @@ -254,7 +254,7 @@ { BlockPos blockpos1 = posOne.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch index 34b0130e80..6d4ac28c88 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch @@ -28,18 +28,6 @@ EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand); int i1 = i - rand.nextInt(4); int j1 = 2 - rand.nextInt(3); -@@ -67,9 +68,9 @@ - - int k2 = k + j2; - BlockPos blockpos1 = new BlockPos(k1, k2, l1); -- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); -+ state = worldIn.getBlockState(blockpos1); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(worldIn, blockpos1) || state.getBlock().isLeaves(worldIn, blockpos1)) - { - this.func_181639_b(worldIn, blockpos1); - this.func_181639_b(worldIn, blockpos1.east()); @@ -187,7 +188,7 @@ { for (int k1 = -i1; k1 <= i1; ++k1) @@ -49,23 +37,3 @@ { return false; } -@@ -209,11 +210,17 @@ - private void func_150526_a(World worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) - { - BlockPos blockpos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); -- Block block = worldIn.getBlockState(blockpos).getBlock(); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); - -- if (block.getMaterial() == Material.air) -+ if (state.getBlock().isAir(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181641_b); - } - } -+ -+ //Just a helper macro -+ private void onPlantGrow(World world, BlockPos pos, BlockPos source) -+ { -+ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch deleted file mode 100644 index a31133713a..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java -@@ -13,10 +13,12 @@ - { - Block block; - -- while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0) -+ do - { -+ block = worldIn.getBlockState(position).getBlock(); -+ if (!block.isLeaves(worldIn, position) && !block.isLeaves(worldIn, position)) break; - position = position.down(); -- } -+ } while (position.getY() > 0); - - for (int i = 0; i < 4; ++i) - { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch index 90ee807b75..32a26829cf 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch @@ -1,20 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java -@@ -123,12 +123,11 @@ - if (j3 == 1) - { - worldIn.setBlockState(blockpos2, Blocks.chest.correctFacing(worldIn, blockpos2, Blocks.chest.getDefaultState()), 2); -- List list = WeightedRandomChestContent.func_177629_a(CHESTCONTENT, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(rand)}); - TileEntity tileentity1 = worldIn.getTileEntity(blockpos2); - - if (tileentity1 instanceof TileEntityChest) - { -- WeightedRandomChestContent.generateChestContents(rand, list, (TileEntityChest)tileentity1, 8); -+ WeightedRandomChestContent.generateChestContents(rand, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, rand), (TileEntityChest)tileentity1, 8); - } - - break; -@@ -159,6 +158,12 @@ +@@ -154,6 +154,12 @@ private String pickMobSpawner(Random p_76543_1_) { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch deleted file mode 100644 index 5c7ad93a54..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java -@@ -58,7 +58,7 @@ - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock())) -+ if (!this.isReplaceable(worldIn, blockpos$mutableblockpos.set(l, j, i1))) - { - flag = false; - } -@@ -77,11 +77,13 @@ - } - else - { -- Block block1 = worldIn.getBlockState(position.down()).getBlock(); -+ 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)); - -- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 256 - i - 1) -+ if (isSoil && position.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, position.down()); -+ block1.onPlantGrow(worldIn, down, position); - - for (int i2 = position.getY() - 3 + i; i2 <= position.getY() + i; ++i2) - { -@@ -101,7 +103,7 @@ - BlockPos blockpos = new BlockPos(i3, i2, k1); - Block block = worldIn.getBlockState(blockpos).getBlock(); - -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181630_b); - } -@@ -112,9 +114,9 @@ - - for (int j2 = 0; j2 < i; ++j2) - { -- Block block2 = worldIn.getBlockState(position.up(j2)).getBlock(); -- -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) -+ BlockPos upN = position.up(j2); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(j2), field_181629_a); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch index dd3577bbdc..fde943faa8 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch @@ -29,30 +29,6 @@ return true; } else -@@ -113,9 +114,9 @@ - if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) - { - BlockPos blockpos = p_175925_2_.add(j, 0, k); -- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(worldIn, blockpos) || state.getBlock().isLeaves(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); - } -@@ -135,9 +136,9 @@ - if (j * j + k * k <= i) - { - BlockPos blockpos = p_175928_2_.add(j, 0, k); -- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); -+ Block block = worldIn.getBlockState(blockpos).getBlock(); - -- if (material == Material.air || material == Material.leaves) -+ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); - } @@ -145,4 +146,10 @@ } } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch deleted file mode 100644 index 91e7fe7bb0..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java -@@ -43,30 +43,24 @@ - { - Block block = worldIn.getBlockState(position.up(j)).getBlock(); - -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (isAirLeaves(worldIn,position.up(j))) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(j), this.woodMetadata); - } - - if (j < i - 1) - { -- block = worldIn.getBlockState(position.add(1, j, 0)).getBlock(); -- -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (isAirLeaves(worldIn,position.add(1, j, 0))) - { - this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 0), this.woodMetadata); - } - -- block = worldIn.getBlockState(position.add(1, j, 1)).getBlock(); -- -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (isAirLeaves(worldIn,position.add(1, j, 1))) - { - this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 1), this.woodMetadata); - } - -- block = worldIn.getBlockState(position.add(0, j, 1)).getBlock(); -- -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (isAirLeaves(worldIn,position.add(0, j, 1))) - { - this.setBlockAndNotifyAdequately(worldIn, position.add(0, j, 1), this.woodMetadata); - } -@@ -132,16 +126,23 @@ - BlockPos blockpos = p_175934_2_.up(i); - Block block = worldIn.getBlockState(blockpos).getBlock(); - -- if (block == Blocks.grass || block == Blocks.dirt) -+ if (block.canSustainPlant(worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181635_g); - break; - } - -- if (block.getMaterial() != Material.air && i < 0) -+ if (!block.isAir(worldIn, blockpos) && i < 0) - { - break; - } - } - } -+ -+ //Helper macro -+ private boolean isAirLeaves(World world, BlockPos pos) -+ { -+ net.minecraft.block.Block block = world.getBlockState(pos).getBlock(); -+ return block.isAir(world, pos) || block.isLeaves(world, pos); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch index 6309e7413f..474cdd7db7 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch @@ -26,39 +26,3 @@ EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand); int k2 = i - rand.nextInt(4) - 1; int l2 = 3 - rand.nextInt(3); -@@ -95,9 +97,9 @@ - } - - BlockPos blockpos = new BlockPos(i3, i2, j1); -- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); -+ block = worldIn.getBlockState(blockpos).getBlock(); - -- if (material == Material.air || material == Material.leaves) -+ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) - { - this.func_181642_b(worldIn, blockpos); - k1 = i2; -@@ -149,9 +151,9 @@ - i3 += enumfacing1.getFrontOffsetX(); - j1 += enumfacing1.getFrontOffsetZ(); - BlockPos blockpos1 = new BlockPos(i3, j2, j1); -- Material material1 = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); -+ block = worldIn.getBlockState(blockpos1).getBlock(); - -- if (material1 == Material.air || material1 == Material.leaves) -+ if (block.isAir(worldIn, blockpos2) || block.isLeaves(worldIn, blockpos2)) - { - this.func_181642_b(worldIn, blockpos1); - k1 = j2; -@@ -209,9 +211,9 @@ - - private void func_175924_b(World worldIn, BlockPos p_175924_2_) - { -- Material material = worldIn.getBlockState(p_175924_2_).getBlock().getMaterial(); -+ Block block = worldIn.getBlockState(p_175924_2_).getBlock(); - -- if (material == Material.air || material == Material.leaves) -+ if (block.isAir(worldIn, p_175924_2_) || block.isLeaves(worldIn, p_175924_2_)) - { - this.setBlockAndNotifyAdequately(worldIn, p_175924_2_, field_181644_b); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch deleted file mode 100644 index c2f9fa4309..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java -@@ -24,14 +24,16 @@ - { - Block block; - -- while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0) -+ do - { -+ block = worldIn.getBlockState(position).getBlock(); -+ if (!block.isAir(worldIn, position) && !block.isLeaves(worldIn, position)) break; - position = position.down(); -- } -+ } while (position.getY() > 0); - - Block block1 = worldIn.getBlockState(position).getBlock(); - -- if (block1 == Blocks.dirt || block1 == Blocks.grass) -+ if (block1.canSustainPlant(worldIn, position, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) - { - position = position.up(); - this.setBlockAndNotifyAdequately(worldIn, position, this.woodMetadata); -@@ -53,7 +55,7 @@ - { - BlockPos blockpos = new BlockPos(l, i, j1); - -- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch index 83021d5b60..6f44c997b1 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch @@ -1,15 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java -@@ -60,7 +60,7 @@ - { - Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock(); - -- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) -+ if (!block.isAir(worldIn, blockpos$mutableblockpos.set(l, j, i1)) && !block.isLeaves(worldIn, blockpos$mutableblockpos.set(l, j, i1))) - { - if (block != Blocks.water && block != Blocks.flowing_water) - { -@@ -86,11 +86,13 @@ +@@ -87,11 +87,13 @@ } else { @@ -24,71 +15,5 @@ - this.func_175921_a(worldIn, position.down()); + block1.onPlantGrow(worldIn, position.down(),position); - for (int l1 = position.getY() - 3 + i; l1 <= position.getY() + i; ++l1) + for (int k1 = position.getY() - 3 + i; k1 <= position.getY() + i; ++k1) { -@@ -109,7 +111,7 @@ - { - BlockPos blockpos = new BlockPos(k3, l1, j1); - -- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181649_b); - } -@@ -120,9 +122,10 @@ - - for (int i2 = 0; i2 < i; ++i2) - { -- Block block2 = worldIn.getBlockState(position.up(i2)).getBlock(); -+ BlockPos upN = position.up(i2); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); - -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2 == Blocks.flowing_water || block2 == Blocks.water) -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2 == Blocks.flowing_water || block2 == Blocks.water) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(i2), field_181648_a); - } -@@ -140,29 +143,29 @@ - { - blockpos$mutableblockpos1.set(i4, j2, j4); - -- if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.leaves) -+ if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().isLeaves(worldIn, blockpos$mutableblockpos1)) - { - BlockPos blockpos3 = blockpos$mutableblockpos1.west(); - BlockPos blockpos4 = blockpos$mutableblockpos1.east(); - BlockPos blockpos1 = blockpos$mutableblockpos1.north(); - BlockPos blockpos2 = blockpos$mutableblockpos1.south(); - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn,blockpos3)) - { - this.func_181647_a(worldIn, blockpos3, BlockVine.EAST); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn,blockpos4)) - { - this.func_181647_a(worldIn, blockpos4, BlockVine.WEST); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn,blockpos1)) - { - this.func_181647_a(worldIn, blockpos1, BlockVine.SOUTH); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn,blockpos2)) - { - this.func_181647_a(worldIn, blockpos2, BlockVine.NORTH); - } -@@ -191,7 +194,7 @@ - this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); - int i = 4; - -- for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).getBlock().getMaterial() == Material.air && i > 0; --i) -+ for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).getBlock().isAir(p_181647_1_,p_181647_2_) && i > 0; --i) - { - this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); - p_181647_2_ = p_181647_2_.down(); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch index ae9752c7f3..e6b3a7d26a 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch @@ -26,25 +26,3 @@ int k2 = 0; for (int l2 = position.getY() + i; l2 >= position.getY() + j; --l2) -@@ -93,7 +95,7 @@ - { - BlockPos blockpos = new BlockPos(j3, l2, i2); - -- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181637_b); - } -@@ -113,9 +115,10 @@ - - for (int i3 = 0; i3 < i - 1; ++i3) - { -- Block block1 = worldIn.getBlockState(position.up(i3)).getBlock(); -+ BlockPos upN = position.up(i3); -+ Block block1 = worldIn.getBlockState(upN).getBlock(); - -- if (block1.getMaterial() == Material.air || block1.getMaterial() == Material.leaves) -+ if (block1.isAir(worldIn, upN) || block1.isLeaves(worldIn, upN)) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(i3), field_181636_a); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch deleted file mode 100644 index f30f960d23..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java -@@ -55,7 +55,7 @@ - { - Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(k1, i1, l1)).getBlock(); - -- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) -+ if (!block.isAir(worldIn, blockpos$mutableblockpos) && !block.isLeaves(worldIn, blockpos$mutableblockpos)) - { - flag = false; - } -@@ -74,11 +74,13 @@ - } - else - { -- Block block1 = worldIn.getBlockState(position.down()).getBlock(); -+ 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); - -- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 256 - i - 1) -+ if (isSoil && position.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, position.down()); -+ block1.onPlantGrow(worldIn, down, position); - int i3 = rand.nextInt(2); - int j3 = 1; - int k3 = 0; -@@ -99,7 +101,7 @@ - { - BlockPos blockpos = new BlockPos(i2, j4, k2); - -- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181646_b); - } -@@ -128,9 +130,10 @@ - - for (int k4 = 0; k4 < i - i4; ++k4) - { -- Block block2 = worldIn.getBlockState(position.up(k4)).getBlock(); -+ BlockPos upN = position.up(k4); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); - -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(k4), field_181645_a); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch deleted file mode 100644 index 92401d444d..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java -@@ -22,10 +22,12 @@ - { - Block block; - -- while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0) -+ do - { -+ block = worldIn.getBlockState(position).getBlock(); -+ if (!block.isAir(worldIn, position) && !block.isLeaves(worldIn, position)) break; - position = position.down(); -- } -+ } while (position.getY() > 0); - - for (int i = 0; i < 128; ++i) - { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch index b8493e86d1..bddc8b598a 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch @@ -9,86 +9,3 @@ { flag = false; } -@@ -87,11 +87,13 @@ - } - else - { -- Block block1 = worldIn.getBlockState(position.down()).getBlock(); -+ 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); - -- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 256 - i - 1) -+ if (isSoil && position.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, position.down()); -+ block1.onPlantGrow(worldIn, down, position); - int k2 = 3; - int l2 = 0; - -@@ -113,7 +115,7 @@ - BlockPos blockpos = new BlockPos(k1, i3, i2); - Block block = worldIn.getBlockState(blockpos).getBlock(); - -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine) -+ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos) || block.getMaterial() == Material.vine) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves); - } -@@ -124,9 +126,10 @@ - - for (int j3 = 0; j3 < i; ++j3) - { -- Block block2 = worldIn.getBlockState(position.up(j3)).getBlock(); -+ BlockPos upN = position.up(j3); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); - -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2.getMaterial() == Material.vine) -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2.getMaterial() == Material.vine) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood); - -@@ -169,29 +172,29 @@ - { - blockpos$mutableblockpos1.set(l4, k3, i5); - -- if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.leaves) -+ if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().isLeaves(worldIn,blockpos$mutableblockpos1)) - { - BlockPos blockpos2 = blockpos$mutableblockpos1.west(); - BlockPos blockpos3 = blockpos$mutableblockpos1.east(); - BlockPos blockpos4 = blockpos$mutableblockpos1.north(); - BlockPos blockpos1 = blockpos$mutableblockpos1.south(); - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn,blockpos2)) - { - this.func_181650_b(worldIn, blockpos2, BlockVine.EAST); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn,blockpos3)) - { - this.func_181650_b(worldIn, blockpos3, BlockVine.WEST); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn,blockpos4)) - { - this.func_181650_b(worldIn, blockpos4, BlockVine.SOUTH); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn,blockpos1)) - { - this.func_181650_b(worldIn, blockpos1, BlockVine.NORTH); - } -@@ -245,7 +248,7 @@ - this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); - int i = 4; - -- for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).getBlock().getMaterial() == Material.air && i > 0; --i) -+ for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).getBlock().isAir(p_181650_1_,p_181650_2_) && i > 0; --i) - { - this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); - p_181650_2_ = p_181650_2_.down(); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch deleted file mode 100644 index 389e5a4de2..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java -@@ -26,10 +26,12 @@ - { - Block block; - -- while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 1) -+ do - { -+ block = worldIn.getBlockState(position).getBlock(); -+ if (!block.isAir(worldIn, position) && !block.isLeaves(worldIn, position)) break; - position = position.down(); -- } -+ } while (position.getY() > 0); - - if (position.getY() < 1) - { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch index a159c3ec14..8bd908b08a 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayer.java +++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayer.java -@@ -52,12 +52,12 @@ +@@ -49,12 +49,12 @@ i = 6; } @@ -16,16 +16,7 @@ GenLayer genlayerhills = new GenLayerHills(1000L, genlayerbiomeedge, lvt_10_1_); GenLayer genlayer5 = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); genlayer5 = GenLayerZoom.magnify(1000L, genlayer5, j); -@@ -191,7 +191,7 @@ - - protected static boolean isBiomeOceanic(int p_151618_0_) - { -- return p_151618_0_ == BiomeGenBase.ocean.biomeID || p_151618_0_ == BiomeGenBase.deepOcean.biomeID || p_151618_0_ == BiomeGenBase.frozenOcean.biomeID; -+ return net.minecraftforge.common.BiomeManager.oceanBiomes.contains(BiomeGenBase.getBiome(p_151618_0_)); - } - - protected int selectRandom(int... p_151619_1_) -@@ -203,4 +203,27 @@ +@@ -171,4 +171,27 @@ { 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_})))))))))); } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch index 28a968bdde..91c084e9cf 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch @@ -1,85 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java +++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java -@@ -6,10 +6,9 @@ - - public class GenLayerBiome extends GenLayer - { -- private BiomeGenBase[] field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.savanna, BiomeGenBase.savanna, BiomeGenBase.plains}; -- private BiomeGenBase[] field_151621_d = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.roofedForest, BiomeGenBase.extremeHills, BiomeGenBase.plains, BiomeGenBase.birchForest, BiomeGenBase.swampland}; -- private BiomeGenBase[] field_151622_e = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.taiga, BiomeGenBase.plains}; -- private BiomeGenBase[] field_151620_f = new BiomeGenBase[] {BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.coldTaiga}; -+ @SuppressWarnings("unchecked") -+ private java.util.List[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length]; -+ - private final ChunkProviderSettings field_175973_g; - - public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_) -@@ -17,9 +16,30 @@ - super(p_i45560_1_); - this.parent = p_i45560_3_; - -+ for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values()) -+ { -+ com.google.common.collect.ImmutableList biomesToAdd = net.minecraftforge.common.BiomeManager.getBiomes(type); -+ int idx = type.ordinal(); -+ -+ if (biomes[idx] == null) biomes[idx] = new java.util.ArrayList(); -+ if (biomesToAdd != null) biomes[idx].addAll(biomesToAdd); -+ } -+ -+ 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)); -+ - if (p_i45560_4_ == WorldType.DEFAULT_1_1) - { -- this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.plains, BiomeGenBase.taiga}; -+ 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)); - this.field_175973_g = null; - } - else if (p_i45560_4_ == WorldType.CUSTOMIZED) -@@ -73,7 +93,7 @@ - } - else - { -- aint1[j + i * areaWidth] = this.field_151623_c[this.nextInt(this.field_151623_c.length)].biomeID; -+ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome.biomeID; - } - } - else if (k == 2) -@@ -84,7 +104,7 @@ - } - else - { -- aint1[j + i * areaWidth] = this.field_151621_d[this.nextInt(this.field_151621_d.length)].biomeID; -+ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM).biome.biomeID; - } - } - else if (k == 3) -@@ -95,12 +115,12 @@ - } - else - { -- aint1[j + i * areaWidth] = this.field_151622_e[this.nextInt(this.field_151622_e.length)].biomeID; -+ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL).biome.biomeID; - } - } - else if (k == 4) - { -- aint1[j + i * areaWidth] = this.field_151620_f[this.nextInt(this.field_151620_f.length)].biomeID; -+ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY).biome.biomeID; - } - else - { -@@ -111,4 +131,12 @@ +@@ -112,4 +112,12 @@ return aint1; } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch index a32b6d0c99..1bcaeb316e 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java -@@ -40,6 +40,12 @@ +@@ -57,6 +57,12 @@ { } @@ -13,16 +13,7 @@ public DesertPyramid(Random p_i2062_1_, int p_i2062_2_, int p_i2062_3_) { super(p_i2062_1_, p_i2062_2_, 64, p_i2062_3_, 21, 15, 21); -@@ -258,7 +264,7 @@ - { - int l1 = enumfacing.getFrontOffsetX() * 2; - int i2 = enumfacing.getFrontOffsetZ() * 2; -- this.field_74940_h[enumfacing.getHorizontalIndex()] = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 10 + l1, -11, 10 + i2, WeightedRandomChestContent.func_177629_a(itemsToGenerateInTemple, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(5)); -+ this.field_74940_h[enumfacing.getHorizontalIndex()] = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 10 + l1, -11, 10 + i2, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, randomIn)); - } - } - -@@ -362,6 +368,13 @@ +@@ -451,6 +457,13 @@ private static final List field_175815_j = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.arrow, 0, 2, 7, 30)}); private static ComponentScatteredFeaturePieces.JunglePyramid.Stones junglePyramidsRandomScatteredStones = new ComponentScatteredFeaturePieces.JunglePyramid.Stones(); @@ -36,44 +27,3 @@ public JunglePyramid() { } -@@ -518,9 +531,12 @@ - this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 4, -3, 1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 3, -3, 1, structureBoundingBoxIn); - -+ net.minecraftforge.common.ChestGenHooks dispenser = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_DISPENSER); -+ net.minecraftforge.common.ChestGenHooks chest = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST); -+ - if (!this.field_74945_j) - { -- this.field_74945_j = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 3, -2, 1, EnumFacing.NORTH.getIndex(), field_175815_j, 2); -+ this.field_74945_j = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 3, -2, 1, EnumFacing.NORTH.getIndex(), dispenser.getItems(randomIn), dispenser.getCount(randomIn)); - } - - this.setBlockState(worldIn, Blocks.vine.getStateFromMeta(15), 3, -2, 2, structureBoundingBoxIn); -@@ -537,7 +553,7 @@ - - if (!this.field_74946_k) - { -- this.field_74946_k = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 9, -2, 3, EnumFacing.WEST.getIndex(), field_175815_j, 2); -+ this.field_74946_k = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 9, -2, 3, EnumFacing.WEST.getIndex(), dispenser.getItems(randomIn), dispenser.getCount(randomIn)); - } - - this.setBlockState(worldIn, Blocks.vine.getStateFromMeta(15), 8, -1, 3, structureBoundingBoxIn); -@@ -545,7 +561,7 @@ - - if (!this.field_74947_h) - { -- this.field_74947_h = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 8, -3, 3, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(5)); -+ this.field_74947_h = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 8, -3, 3, chest.getItems(randomIn), chest.getCount(randomIn)); - } - - this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 9, -3, 2, structureBoundingBoxIn); -@@ -578,7 +594,7 @@ - - if (!this.field_74948_i) - { -- this.field_74948_i = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 9, -3, 10, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(5)); -+ this.field_74948_i = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 9, -3, 10, chest.getItems(randomIn), chest.getCount(randomIn)); - } - - return true; diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch deleted file mode 100644 index d64cd44000..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java -@@ -28,11 +28,18 @@ - - for (BiomeGenBase biomegenbase : BiomeGenBase.getBiomeGenArray()) - { -- if (biomegenbase != null && biomegenbase.minHeight > 0.0F) -+ if (biomegenbase != null && biomegenbase.minHeight > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) - { - this.field_151546_e.add(biomegenbase); - } - } -+ for (BiomeGenBase biome : net.minecraftforge.common.BiomeManager.strongHoldBiomes) -+ { -+ if (!this.field_151546_e.contains(biome)) -+ { -+ this.field_151546_e.add(biome); -+ } -+ } - } - - public MapGenStronghold(Map p_i2068_1_) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch index 9e0994ba85..ee60e931b9 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java -@@ -217,12 +217,12 @@ +@@ -221,12 +221,12 @@ { if (this.structureData == null) { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch index 3763ac470f..53fa790aea 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureComponent.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureComponent.java -@@ -35,6 +35,10 @@ +@@ -38,6 +38,10 @@ - public NBTTagCompound createStructureBaseNBT() + public final NBTTagCompound createStructureBaseNBT() { + if (MapGenStructureIO.getStructureComponentName(this) == null) // Friendlier error then the Null String error below. + { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch index f7d5fa0b94..34db35ce02 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java -@@ -32,6 +32,12 @@ +@@ -31,6 +31,12 @@ MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Stairs.class, "MSStairs"); } @@ -13,21 +13,3 @@ private static StructureComponent func_175892_a(List listIn, Random rand, int x, int y, int z, EnumFacing facing, int type) { int i = rand.nextInt(100); -@@ -351,14 +357,15 @@ - this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.05F, 1, 2, k1 - 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); - this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.05F, 1, 2, k1 + 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); - -+ net.minecraftforge.common.ChestGenHooks info = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR); - if (randomIn.nextInt(100) == 0) - { -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 2, 0, k1 - 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.CHEST_CONTENT_WEIGHT_LIST, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 3 + randomIn.nextInt(4)); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 2, 0, k1 - 1, info.getItems(randomIn), info.getCount(randomIn)); - } - - if (randomIn.nextInt(100) == 0) - { -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 0, 0, k1 + 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.CHEST_CONTENT_WEIGHT_LIST, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 3 + randomIn.nextInt(4)); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 0, 0, k1 + 1, info.getItems(randomIn), info.getCount(randomIn)); - } - - if (this.hasSpiders && !this.spawnerPlaced) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch deleted file mode 100644 index 75826c803f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java -@@ -154,7 +154,7 @@ - if (this.field_111021_b && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) - { - this.field_111021_b = false; -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, field_111019_a, 2 + randomIn.nextInt(4)); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, randomIn)); - } - - this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); -@@ -225,7 +225,7 @@ - if (this.field_111020_b && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(1, 3), this.getYWithOffset(2), this.getZWithOffset(1, 3)))) - { - this.field_111020_b = false; -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 1, 2, 3, field_111019_a, 2 + randomIn.nextInt(4)); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 1, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, randomIn)); - } - - this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); -@@ -943,6 +943,7 @@ - abstract static class Piece extends StructureComponent - { - protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 5), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 5), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 15), new WeightedRandomChestContent(Items.golden_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.golden_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.flint_and_steel, 0, 1, 1, 5), new WeightedRandomChestContent(Items.nether_wart, 0, 3, 7, 5), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 8), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 5), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.obsidian), 0, 2, 4, 2)}); -+ static { net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, field_111019_a, 2, 5); } - - public Piece() - { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch index 04a7017a0f..1d7352db01 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStart.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStart.java -@@ -62,6 +62,10 @@ +@@ -63,6 +63,10 @@ public NBTTagCompound writeStructureComponentsToNBT(int chunkX, int chunkZ) { @@ -11,7 +11,7 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); nbttagcompound.setString("id", MapGenStructureIO.getStructureStartName(this)); nbttagcompound.setInteger("ChunkX", chunkX); -@@ -97,7 +101,8 @@ +@@ -98,7 +102,8 @@ for (int i = 0; i < nbttaglist.tagCount(); ++i) { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch index 63362a9378..7ebeaa9a79 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java -@@ -240,6 +240,12 @@ +@@ -244,6 +244,12 @@ { } @@ -13,17 +13,8 @@ public ChestCorridor(int p_i45582_1_, Random p_i45582_2_, StructureBoundingBox p_i45582_3_, EnumFacing p_i45582_4_) { super(p_i45582_1_); -@@ -296,7 +302,7 @@ - if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) - { - this.hasMadeChest = true; -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, WeightedRandomChestContent.func_177629_a(strongholdChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(2)); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, randomIn)); - } - - return true; -@@ -592,6 +598,12 @@ - private static final List strongholdLibraryChestContents = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.book, 0, 1, 3, 20), new WeightedRandomChestContent(Items.paper, 0, 2, 7, 20), new WeightedRandomChestContent(Items.map, 0, 1, 1, 1), new WeightedRandomChestContent(Items.compass, 0, 1, 1, 1)}); +@@ -599,6 +605,12 @@ + { private boolean isLargeRoom; + static @@ -35,24 +26,8 @@ public Library() { } -@@ -736,12 +748,13 @@ - this.setBlockState(worldIn, Blocks.torch.getDefaultState(), i1, 8, j1 + 1, structureBoundingBoxIn); - } - -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 3, 5, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn, 1, 5, 2)}), 1 + randomIn.nextInt(4)); -+ net.minecraftforge.common.ChestGenHooks info = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 3, 5, info.getItems(randomIn), info.getCount(randomIn)); - - if (this.isLargeRoom) - { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), 12, 9, 1, structureBoundingBoxIn); -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 12, 8, 1, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn, 1, 5, 2)}), 1 + randomIn.nextInt(4)); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 12, 8, 1, info.getItems(randomIn), info.getCount(randomIn)); - } - - return true; -@@ -1013,6 +1026,12 @@ - private static final List strongholdRoomCrossingChestContents = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 10), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 5), new WeightedRandomChestContent(Items.redstone, 0, 4, 9, 5), new WeightedRandomChestContent(Items.coal, 0, 3, 8, 10), new WeightedRandomChestContent(Items.bread, 0, 1, 3, 15), new WeightedRandomChestContent(Items.apple, 0, 1, 3, 15), new WeightedRandomChestContent(Items.iron_pickaxe, 0, 1, 1, 1)}); +@@ -1025,6 +1037,12 @@ + { protected int roomType; + static @@ -64,12 +39,3 @@ public RoomCrossing() { } -@@ -1151,7 +1170,7 @@ - this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 1, 3, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 2, 3, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 3, 3, structureBoundingBoxIn); -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 4, 8, WeightedRandomChestContent.func_177629_a(strongholdRoomCrossingChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 1 + randomIn.nextInt(4)); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 4, 8, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, randomIn)); - } - - return true; diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch index 0491f7afe0..8dc9017c25 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java -@@ -57,6 +57,7 @@ +@@ -58,6 +58,7 @@ list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field2.class, 3, MathHelper.getRandomIntegerInRange(random, 2 + p_75084_1_, 4 + p_75084_1_ * 2))); list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House2.class, 15, MathHelper.getRandomIntegerInRange(random, 0, 1 + p_75084_1_))); list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House3.class, 8, MathHelper.getRandomIntegerInRange(random, 0 + p_75084_1_, 3 + p_75084_1_ * 2))); @@ -8,7 +8,7 @@ Iterator iterator = list.iterator(); while (iterator.hasNext()) -@@ -129,6 +130,10 @@ +@@ -130,6 +131,10 @@ { structurevillagepieces$village = StructureVillagePieces.House3.func_175849_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_); } @@ -19,7 +19,7 @@ return structurevillagepieces$village; } -@@ -833,6 +838,11 @@ +@@ -875,6 +880,11 @@ { } @@ -31,16 +31,7 @@ public House2(StructureVillagePieces.Start start, int p_i45563_2_, Random rand, StructureBoundingBox p_i45563_4_, EnumFacing facing) { super(start, p_i45563_2_); -@@ -911,7 +921,7 @@ - if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(5, 5), this.getYWithOffset(1), this.getZWithOffset(5, 5)))) - { - this.hasMadeChest = true; -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 5, 1, 5, villageBlacksmithChestContents, 3 + randomIn.nextInt(6)); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 5, 1, 5, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, randomIn)); - } - - for (int i = 6; i <= 8; ++i) -@@ -1403,6 +1413,7 @@ +@@ -1447,6 +1457,7 @@ public List structureVillageWeightedPieceList; public List field_74932_i = Lists.newArrayList(); public List field_74930_j = Lists.newArrayList(); @@ -48,15 +39,7 @@ public Start() { -@@ -1416,6 +1427,7 @@ - this.terrainType = p_i2104_7_; - BiomeGenBase biomegenbase = chunkManagerIn.getBiomeGenerator(new BlockPos(p_i2104_4_, 0, p_i2104_5_), BiomeGenBase.field_180279_ad); - this.inDesert = biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills; -+ this.biome = biomegenbase; - this.func_175846_a(this.inDesert); - } - -@@ -1477,6 +1489,7 @@ +@@ -1520,6 +1531,7 @@ protected int field_143015_k = -1; private int villagersSpawned; private boolean isDesertVillage; @@ -64,7 +47,7 @@ public Village() { -@@ -1489,6 +1502,7 @@ +@@ -1532,6 +1544,7 @@ if (start != null) { this.isDesertVillage = start.inDesert; @@ -72,7 +55,7 @@ } } -@@ -1613,6 +1627,9 @@ +@@ -1660,6 +1673,9 @@ protected IBlockState func_175847_a(IBlockState p_175847_1_) { diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch index f354ddc7b3..c6a72a010d 100644 --- a/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch @@ -1,15 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/storage/MapData.java +++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java -@@ -21,7 +21,7 @@ - { - public int xCenter; - public int zCenter; -- public byte dimension; -+ public int dimension; //FML byte -> int - public byte scale; - public byte[] colors = new byte[16384]; - public List playersArrayList = Lists.newArrayList(); -@@ -44,7 +44,17 @@ +@@ -45,7 +45,17 @@ public void readFromNBT(NBTTagCompound nbt) { @@ -28,7 +19,7 @@ this.xCenter = nbt.getInteger("xCenter"); this.zCenter = nbt.getInteger("zCenter"); this.scale = nbt.getByte("scale"); -@@ -85,7 +95,7 @@ +@@ -96,7 +106,7 @@ public void writeToNBT(NBTTagCompound nbt) { @@ -37,7 +28,7 @@ nbt.setInteger("xCenter", this.xCenter); nbt.setInteger("zCenter", this.zCenter); nbt.setByte("scale", this.scale); -@@ -164,7 +174,7 @@ +@@ -176,7 +186,7 @@ rotation = rotation + (rotation < 0.0D ? -8.0D : 8.0D); b2 = (byte)((int)(rotation * 16.0D / 360.0D)); diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch index c42cfe274e..9e57e2d0be 100644 --- a/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch @@ -1,88 +1,34 @@ --- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java +++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java -@@ -104,20 +104,29 @@ +@@ -135,6 +135,8 @@ + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setTag("Data", nbttagcompound); + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound1); ++ + try + { + File file1 = new File(this.worldDirectory, "level.dat_new"); +@@ -199,6 +201,8 @@ { - File file1 = new File(this.worldDirectory, "level.dat"); - -+ WorldInfo worldInfo = null; -+ - if (file1.exists()) - { - try - { - NBTTagCompound nbttagcompound2 = CompressedStreamTools.readCompressed(new FileInputStream(file1)); - NBTTagCompound nbttagcompound3 = nbttagcompound2.getCompoundTag("Data"); -- return new WorldInfo(nbttagcompound3); -+ worldInfo = new WorldInfo(nbttagcompound3); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound2); -+ return worldInfo; - } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) -+ { -+ throw e; -+ } - catch (Exception exception1) - { - exception1.printStackTrace(); - } - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); - file1 = new File(this.worldDirectory, "level.dat_old"); - - if (file1.exists()) -@@ -126,7 +135,13 @@ - { - NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); - NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); -- return new WorldInfo(nbttagcompound1); -+ worldInfo = new WorldInfo(nbttagcompound1); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); -+ return worldInfo; -+ } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) -+ { -+ throw e; - } - catch (Exception exception) - { -@@ -143,6 +158,8 @@ - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setTag("Data", nbttagcompound); + NBTTagCompound nbttagcompound = null; + net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound1); + try { - File file1 = new File(this.worldDirectory, "level.dat_new"); -@@ -181,6 +198,8 @@ - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setTag("Data", nbttagcompound); - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound1); -+ - try - { - File file1 = new File(this.worldDirectory, "level.dat_new"); -@@ -229,6 +248,7 @@ - } - - file1.renameTo(file2); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(player, this.playersDirectory, player.getUniqueID().toString()); - } - catch (Exception var5) - { -@@ -259,6 +279,7 @@ - player.readFromNBT(nbttagcompound); + File file1 = new File(this.playersDirectory, player.getUniqueID().toString() + ".dat"); +@@ -218,6 +222,7 @@ + player.readFromNBT(this.field_186341_a.func_188257_a(FixTypes.PLAYER, nbttagcompound)); } + net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(player, playersDirectory, player.getUniqueID().toString()); return nbttagcompound; } -@@ -300,4 +321,22 @@ +@@ -259,4 +264,22 @@ { - return this.saveDirectoryName; + return this.field_186342_h; } + + public NBTTagCompound getPlayerNBT(net.minecraft.entity.player.EntityPlayerMP player) diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch index a95b7f74e6..f0459b69cf 100644 --- a/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch @@ -1,18 +1,17 @@ --- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java +++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java -@@ -51,6 +51,7 @@ - private int borderWarningDistance = 5; +@@ -60,6 +60,7 @@ private int borderWarningTime = 15; + private final Map field_186348_N = Maps.newEnumMap(DimensionType.class); private GameRules theGameRules = new GameRules(); + private java.util.Map additionalProperties; protected WorldInfo() { -@@ -745,4 +746,24 @@ - } +@@ -785,6 +786,26 @@ }); } -+ + + /** + * Allow access to additional mod specific world based properties + * Used by FML to store mod list associated with a world, and maybe an id map @@ -32,4 +31,7 @@ + { + return this.additionalProperties!=null? this.additionalProperties.get(additionalProperty) : null; + } - } ++ + public NBTTagCompound func_186347_a(DimensionType p_186347_1_) + { + NBTTagCompound nbttagcompound = (NBTTagCompound)this.field_186348_N.get(p_186347_1_); diff --git a/rejects/minecraft/net/minecraft/command/CommandBase.java.patch.rej b/rejects/minecraft/net/minecraft/command/CommandBase.java.patch.rej deleted file mode 100644 index d826d8eee0..0000000000 --- a/rejects/minecraft/net/minecraft/command/CommandBase.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - ichatcomponent.appendText(" "); - } - -- IChatComponent ichatcomponent1 = new ChatComponentText(args[i]); -+ IChatComponent ichatcomponent1 = net.minecraftforge.common.ForgeHooks.newChatWithLinks(args[i]); // Forge: links for messages - - if (p_147176_3_) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/command/CommandEnchant.java.patch.rej b/rejects/minecraft/net/minecraft/command/CommandEnchant.java.patch.rej deleted file mode 100644 index 9af81aea04..0000000000 --- a/rejects/minecraft/net/minecraft/command/CommandEnchant.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - { - Enchantment enchantment2 = Enchantment.getEnchantmentById(l); - -- if (!enchantment2.canApplyTogether(enchantment1)) -+ if (!enchantment2.canApplyTogether(enchantment1) || !enchantment1.canApplyTogether(enchantment2)) //Forge BugFix: Let Both enchantments veto being together - { - throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment1.getTranslatedName(j), enchantment2.getTranslatedName(nbttaglist.getCompoundTagAt(k).getShort("lvl"))}); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/command/CommandFill.java.patch.rej b/rejects/minecraft/net/minecraft/command/CommandFill.java.patch.rej deleted file mode 100644 index 3d13d0aa63..0000000000 --- a/rejects/minecraft/net/minecraft/command/CommandFill.java.patch.rej +++ /dev/null @@ -1,20 +0,0 @@ -++++ REJECTED PATCH 2 - NBTTagCompound nbttagcompound = new NBTTagCompound(); - boolean flag = false; - -- if (args.length >= 10 && block.hasTileEntity()) -+ if (args.length >= 10 && block.hasTileEntity(state)) - { - String s = getChatComponentFromNthArg(sender, args, 9).getUnformattedText(); - -++++ END PATCH -++++ REJECTED PATCH 3 - continue; - } - } -- else if (args[8].equals("replace") && !block.hasTileEntity()) -+ else if (args[8].equals("replace") && !block.hasTileEntity(state)) - { - if (args.length > 9) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/command/CommandHandler.java.patch.rej b/rejects/minecraft/net/minecraft/command/CommandHandler.java.patch.rej deleted file mode 100644 index 92101609e9..0000000000 --- a/rejects/minecraft/net/minecraft/command/CommandHandler.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 2 - ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.generic.exception", new Object[0]); - chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); - sender.addChatMessage(chatcomponenttranslation); -- logger.warn("Couldn\'t process command: \'" + input + "\'"); -+ logger.warn("Couldn\'t process command: \'" + input + "\'", var9); // Forge: Log stacktrace of unknown exceptions - } - - return false; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/command/PlayerSelector.java.patch.rej b/rejects/minecraft/net/minecraft/command/PlayerSelector.java.patch.rej deleted file mode 100644 index 673621f250..0000000000 --- a/rejects/minecraft/net/minecraft/command/PlayerSelector.java.patch.rej +++ /dev/null @@ -1,13 +0,0 @@ -++++ REJECTED PATCH 1 - - public class PlayerSelector - { -- private static final Pattern tokenPattern = Pattern.compile("^@([pare])(?:\\[([\\w=,!-]*)\\])?$"); -+ private static final Pattern tokenPattern = Pattern.compile("^@([pare])(?:\\[([\\w\\.=,!-]*)\\])?$"); // FORGE: allow . in entity selectors - private static final Pattern intListPattern = Pattern.compile("\\G([-!]?[\\w-]*)(?:$|,)"); -- private static final Pattern keyValueListPattern = Pattern.compile("\\G(\\w+)=([-!]?[\\w-]*)(?:$|,)"); -+ private static final Pattern keyValueListPattern = Pattern.compile("\\G(\\w+)=([-!]?[\\w\\.-]*)(?:$|,)"); // FORGE: allow . in entity selectors - private static final Set WORLD_BINDING_ARGS = Sets.newHashSet(new String[] {"x", "y", "z", "dx", "dy", "dz", "rm", "r"}); - - public static EntityPlayerMP matchOnePlayer(ICommandSender sender, String token) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch.rej b/rejects/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch.rej deleted file mode 100644 index d7dd3fdf88..0000000000 --- a/rejects/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch.rej +++ /dev/null @@ -1,20 +0,0 @@ -++++ REJECTED PATCH 1 - i = parseInt(args[4], 0, 15); - } - -+ IBlockState state = block.getStateFromMeta(i); -+ - World world = sender.getEntityWorld(); - - if (!world.isBlockLoaded(blockpos)) -++++ END PATCH -++++ REJECTED PATCH 2 - NBTTagCompound nbttagcompound = new NBTTagCompound(); - boolean flag = false; - -- if (args.length >= 7 && block.hasTileEntity()) -+ if (args.length >= 7 && block.hasTileEntity(state)) - { - String s = getChatComponentFromNthArg(sender, args, 6).getUnformattedText(); - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch.rej b/rejects/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch.rej deleted file mode 100644 index 1af151dc0a..0000000000 --- a/rejects/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - NBTTagCompound nbttagcompound = new NBTTagCompound(); - boolean flag = false; - -- if (args.length >= 6 && block.hasTileEntity()) -+ if (args.length >= 6 && block.hasTileEntity(block.getStateFromMeta(i))) - { - String s = getChatComponentFromNthArg(sender, args, 5).getUnformattedText(); - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej b/rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej deleted file mode 100644 index f5b2d3aa16..0000000000 --- a/rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 2 - double d0 = source.getX() + (double)enumfacing.getFrontOffsetX(); - double d1 = (double)((float)source.getBlockPos().getY() + 0.2F); - double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ(); -- Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), stack.getMetadata(), d0, d1, d2); -+ Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), ItemMonsterPlacer.getEntityName(stack), d0, d1, d2); - - if (entity instanceof EntityLivingBase && stack.hasDisplayName()) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch.rej b/rejects/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch.rej deleted file mode 100644 index 35057e9a1a..0000000000 --- a/rejects/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 4 - - for (int i1 = 0; i1 < 3; ++i1) - { -- this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, l, itemstack); -+ this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, (int)power, itemstack); - this.field_178151_h[i1] = -1; - - if (this.enchantLevels[i1] < i1 + 1) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej b/rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej deleted file mode 100644 index 323e886d4f..0000000000 --- a/rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej +++ /dev/null @@ -1,20 +0,0 @@ -++++ REJECTED PATCH 3 - - if (itemstack2 != null) - { -+ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, i2)) return; - flag = itemstack2.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(itemstack2).tagCount() > 0; - - if (itemstack1.isItemStackDamageable() && itemstack1.getItem().getIsRepairable(itemstack, itemstack2)) -++++ END PATCH -++++ REJECTED PATCH 4 - { - int i4 = ((Integer)iterator.next()).intValue(); - -- if (i4 != i5 && !enchantment.canApplyTogether(Enchantment.getEnchantmentById(i4))) -+ Enchantment e2 = Enchantment.getEnchantmentById(i4); -+ if (i4 != i5 && !(enchantment.canApplyTogether(e2) && e2.canApplyTogether(enchantment))) //Forge BugFix: Let Both enchantments veto being together - { - flag1 = false; - ++l1; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej b/rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej deleted file mode 100644 index 9763848eae..0000000000 --- a/rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - ; - } - -- p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND))); -+ p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND))); - NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); - NetworkSystem.this.networkManagers.add(networkmanager); - p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch.rej b/rejects/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch.rej deleted file mode 100644 index 6302df167d..0000000000 --- a/rejects/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch.rej +++ /dev/null @@ -1,13 +0,0 @@ -++++ REJECTED PATCH 1 - public void writePacketData(PacketBuffer buf) throws IOException - { - buf.writeString(this.channel); -+ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. -+ this.data.markReaderIndex(); - buf.writeBytes((ByteBuf)this.data); -+ this.data.resetReaderIndex(); -+ } - } - - public void processPacket(INetHandlerPlayServer handler) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch.rej b/rejects/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch.rej deleted file mode 100644 index 01dcefc10b..0000000000 --- a/rejects/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch.rej +++ /dev/null @@ -1,13 +0,0 @@ -++++ REJECTED PATCH 1 - public void writePacketData(PacketBuffer buf) throws IOException - { - buf.writeString(this.channel); -+ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. -+ this.data.markReaderIndex(); - buf.writeBytes((ByteBuf)this.data); -+ this.data.resetReaderIndex(); -+ } - } - - public void processPacket(INetHandlerPlayClient handler) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej deleted file mode 100644 index 7c9e8ee299..0000000000 --- a/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej +++ /dev/null @@ -1,46 +0,0 @@ -++++ REJECTED PATCH 1 - @SideOnly(Side.SERVER) - private String hostname; - private int serverPort = -1; -- public WorldServer[] worldServers; -+ public WorldServer[] worldServers = new WorldServer[0]; - private ServerConfigurationManager serverConfigManager; - private boolean serverRunning = true; - private boolean serverStopped; -++++ END PATCH -++++ REJECTED PATCH 6 - - public void stopServer() - { -- if (!this.worldIsBeingDeleted) -+ if (!this.worldIsBeingDeleted && net.minecraftforge.fml.common.Loader.instance().hasReachedState(net.minecraftforge.fml.common.LoaderState.SERVER_STARTED) && !serverStopped) // make sure the save is valid and we don't save twice - { - logger.info("Stopping server"); - -++++ END PATCH -++++ REJECTED PATCH 7 - for (int i = 0; i < this.worldServers.length; ++i) - { - WorldServer worldserver = this.worldServers[i]; -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); - worldserver.flush(); - } -+ -+ WorldServer[] tmp = worldServers; -+ for (WorldServer world : tmp) -+ { -+ net.minecraftforge.common.DimensionManager.setWorld(world.provider.getDimensionId(), null); -+ } - } - - if (this.usageSnooper.isSnooperRunning()) -++++ END PATCH -++++ REJECTED PATCH 22 - - if (worldserver != null) - { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); - worldserver.flush(); - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej deleted file mode 100644 index befc820c02..0000000000 --- a/rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej +++ /dev/null @@ -1,26 +0,0 @@ -++++ REJECTED PATCH 1 - if (entityplayermp == null) - { - this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; -- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.field_181025_l); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.field_181025_l); - this.field_181025_l = null; - } - } - -- if (this.connectionTimer++ == 600) -+ if (this.connectionTimer++ == net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.LOGIN_TIMEOUT) - { - this.closeConnection("Took too long to log in"); - } -++++ END PATCH -++++ REJECTED PATCH 2 - } - else - { -- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); - } - } - } -++++ END PATCH From f654157adbaca8885abdcef463b86b3e8c3ab7c3 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 1 Mar 2016 00:31:58 -0800 Subject: [PATCH 005/243] net.minecraft.block.* patches --- .../net/minecraft/block/Block.java.patch | 169 ++++++++++++++---- .../minecraft/block/BlockBanner.java.patch | 17 +- .../net/minecraft/block/BlockBush.java.patch | 24 ++- .../minecraft/block/BlockButton.java.patch | 11 ++ .../minecraft/block/BlockCactus.java.patch | 11 ++ .../net/minecraft/block/BlockChest.java.patch | 11 ++ .../net/minecraft/block/BlockCrops.java.patch | 20 ++- .../minecraft/block/BlockDeadBush.java.patch | 21 +++ .../net/minecraft/block/BlockDoor.java.patch | 9 + .../block/BlockDoublePlant.java.patch | 19 +- .../minecraft/block/BlockDragonEgg.java.patch | 20 +++ .../minecraft/block/BlockFalling.java.patch | 20 +++ .../minecraft/block/BlockFarmland.java.patch | 2 +- .../net/minecraft/block/BlockFire.java.patch | 105 ++++++++++- .../minecraft/block/BlockFlowerPot.java.patch | 4 +- .../net/minecraft/block/BlockGrass.java.patch | 18 ++ .../block/BlockHugeMushroom.java.patch | 2 +- .../net/minecraft/block/BlockIce.java.patch | 34 ++++ .../minecraft/block/BlockLadder.java.patch | 23 ++- .../minecraft/block/BlockLeaves.java.patch | 40 ++++- .../net/minecraft/block/BlockLog.java.patch | 14 +- .../block/BlockMobSpawner.java.patch | 9 +- .../minecraft/block/BlockMushroom.java.patch | 9 +- .../minecraft/block/BlockMycelium.java.patch | 18 +- .../block/BlockNetherWart.java.patch | 9 + .../minecraft/block/BlockNewLeaf.java.patch | 22 +++ .../minecraft/block/BlockOldLeaf.java.patch | 28 +++ .../net/minecraft/block/BlockOre.java.patch | 5 +- .../net/minecraft/block/BlockPane.java.patch | 4 +- .../block/BlockPistonBase.java.patch | 31 ++++ .../block/BlockPistonMoving.java.patch | 21 ++- .../minecraft/block/BlockPotato.java.patch | 25 +++ .../minecraft/block/BlockPumpkin.java.patch | 11 ++ .../minecraft/block/BlockQuartz.java.patch | 2 +- .../minecraft/block/BlockRailBase.java.patch | 59 +++++- .../block/BlockRedstoneOre.java.patch | 4 +- .../block/BlockRedstoneWire.java.patch | 55 ++++++ .../net/minecraft/block/BlockReed.java.patch | 11 +- .../block/BlockRotatedPillar.java.patch | 5 +- .../net/minecraft/block/BlockSkull.java.patch | 9 + .../net/minecraft/block/BlockSlab.java.patch | 24 ++- .../net/minecraft/block/BlockSnow.java.patch | 24 ++- .../minecraft/block/BlockStairs.java.patch | 22 +++ .../net/minecraft/block/BlockStem.java.patch | 14 +- .../minecraft/block/BlockTallGrass.java.patch | 18 ++ .../block/BlockTripWireHook.java.patch | 28 +++ .../net/minecraft/block/BlockVine.java.patch | 9 + .../BlockPistonStructureHelper.java.patch | 29 +++ .../block/state/BlockStateBase.java.patch | 4 +- .../state/BlockStateContainer.java.patch | 77 ++++++++ .../block/state/IBlockProperties.java.patch | 27 +++ .../entity/item/EntityFallingBlock.java.patch | 10 ++ .../entity/player/EntityPlayer.java.patch | 52 ++++-- .../net/minecraft/block/Block.java.patch.rej | 91 ---------- .../block/BlockBanner.java.patch.rej | 24 --- .../minecraft/block/BlockBush.java.patch.rej | 23 --- .../block/BlockButton.java.patch.rej | 11 -- .../block/BlockCactus.java.patch.rej | 10 -- .../minecraft/block/BlockChest.java.patch.rej | 10 -- .../minecraft/block/BlockCrops.java.patch.rej | 36 ---- .../block/BlockDeadBush.java.patch.rej | 23 --- .../minecraft/block/BlockDoor.java.patch.rej | 10 -- .../block/BlockDoublePlant.java.patch.rej | 19 -- .../block/BlockFalling.java.patch.rej | 9 - .../minecraft/block/BlockFire.java.patch.rej | 98 ---------- .../minecraft/block/BlockGrass.java.patch.rej | 20 --- .../minecraft/block/BlockIce.java.patch.rej | 35 ---- .../block/BlockLadder.java.patch.rej | 23 --- .../block/BlockLeaves.java.patch.rej | 36 ---- .../minecraft/block/BlockLog.java.patch.rej | 13 -- .../block/BlockNetherWart.java.patch.rej | 10 -- .../block/BlockNewLeaf.java.patch.rej | 23 --- .../block/BlockOldLeaf.java.patch.rej | 20 --- .../minecraft/block/BlockPane.java.patch.rej | 16 -- .../block/BlockPistonBase.java.patch.rej | 32 ---- .../block/BlockPistonMoving.java.patch.rej | 19 -- .../block/BlockPotato.java.patch.rej | 24 --- .../block/BlockPumpkin.java.patch.rej | 10 -- .../block/BlockRailBase.java.patch.rej | 11 -- .../block/BlockRedstoneWire.java.patch.rej | 59 ------ .../minecraft/block/BlockSkull.java.patch.rej | 10 -- .../minecraft/block/BlockSlab.java.patch.rej | 19 -- .../minecraft/block/BlockSnow.java.patch.rej | 22 --- .../block/BlockStairs.java.patch.rej | 21 --- .../block/BlockTallGrass.java.patch.rej | 25 --- .../block/BlockTrapDoor.java.patch.rej | 45 ----- .../block/BlockTripWireHook.java.patch.rej | 28 --- .../minecraft/block/BlockVine.java.patch.rej | 15 -- .../BlockPistonStructureHelper.java.patch.rej | 30 ---- .../block/state/BlockState.java.patch.rej | 55 ------ .../entity/player/EntityPlayer.java.patch.rej | 28 --- .../net/minecraftforge/common/ForgeHooks.java | 15 +- .../net/minecraftforge/common/IPlantable.java | 2 +- .../net/minecraftforge/common/IShearable.java | 2 +- .../event/ForgeEventFactory.java | 5 +- .../event/terraingen/DecorateBiomeEvent.java | 2 +- .../event/terraingen/OreGenEvent.java | 2 +- .../terraingen/SaplingGrowTreeEvent.java | 2 +- .../event/terraingen/TerrainGen.java | 2 +- .../event/world/BlockEvent.java | 14 +- .../event/world/NoteBlockEvent.java | 2 +- .../items/VanillaInventoryCodeHooks.java | 2 +- src/main/resources/forge.exc | 2 + 103 files changed, 1167 insertions(+), 1167 deletions(-) create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockDragonEgg.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch rename rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej => patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch (58%) rename rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej => patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch (68%) rename rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej => patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch (66%) create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/state/IBlockProperties.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch delete mode 100644 rejects/minecraft/net/minecraft/block/Block.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockBanner.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockBush.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockButton.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockCactus.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockChest.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockDeadBush.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockDoor.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockFalling.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockIce.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockNetherWart.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockNewLeaf.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockOldLeaf.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockPane.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockPotato.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockPumpkin.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockSlab.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockStairs.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockTallGrass.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch index 0b22ac7d6e..921d8e7bdc 100644 --- a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch @@ -1,6 +1,18 @@ --- ../src-base/minecraft/net/minecraft/block/Block.java +++ ../src-work/minecraft/net/minecraft/block/Block.java -@@ -70,6 +70,9 @@ +@@ -46,8 +46,9 @@ + public class Block + { + private static final ResourceLocation AIR_ID = new ResourceLocation("air"); +- public static final RegistryNamespacedDefaultedByKey blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID); +- public static final ObjectIntIdentityMap BLOCK_STATE_IDS = new ObjectIntIdentityMap(); ++ public static final RegistryNamespacedDefaultedByKey blockRegistry = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); ++ @Deprecated //Modders: DO NOT use this! Use GameRegistry ++ public static final ObjectIntIdentityMap BLOCK_STATE_IDS = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); + public static final AxisAlignedBB field_185505_j = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + public static final AxisAlignedBB field_185506_k = null; + private CreativeTabs displayOnCreativeTab; +@@ -70,6 +71,9 @@ private IBlockState defaultBlockState; private String unlocalizedName; @@ -10,7 +22,7 @@ public static int getIdFromBlock(Block blockIn) { return blockRegistry.getIDForObject(blockIn); -@@ -83,7 +86,8 @@ +@@ -83,7 +87,8 @@ public static Block getBlockById(int id) { @@ -20,7 +32,7 @@ } public static IBlockState getStateById(int id) -@@ -268,7 +272,7 @@ +@@ -268,7 +273,7 @@ public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) { @@ -29,7 +41,7 @@ } public Block setHardness(float hardness) -@@ -305,9 +309,10 @@ +@@ -305,9 +310,10 @@ return this.needsRandomTick; } @@ -41,7 +53,32 @@ } public AxisAlignedBB func_185496_a(IBlockState p_185496_1_, IBlockAccess p_185496_2_, BlockPos p_185496_3_) -@@ -472,6 +477,10 @@ +@@ -346,13 +352,13 @@ + @SideOnly(Side.CLIENT) + public int func_185484_c(IBlockState p_185484_1_, IBlockAccess p_185484_2_, BlockPos p_185484_3_) + { +- int i = p_185484_2_.getCombinedLight(p_185484_3_, p_185484_1_.func_185906_d()); ++ int i = p_185484_2_.getCombinedLight(p_185484_3_, p_185484_1_.getLightValue(p_185484_2_, p_185484_3_)); + + if (i == 0 && p_185484_1_.getBlock() instanceof BlockSlab) + { + p_185484_3_ = p_185484_3_.down(); + p_185484_1_ = p_185484_2_.getBlockState(p_185484_3_); +- return p_185484_2_.getCombinedLight(p_185484_3_, p_185484_1_.func_185906_d()); ++ return p_185484_2_.getCombinedLight(p_185484_3_, p_185484_1_.getLightValue(p_185484_2_, p_185484_3_)); + } + else + { +@@ -415,7 +421,7 @@ + } + } + +- return !pos.getBlockState(side.offset(p_176225_4_)).func_185914_p(); ++ return !pos.getBlockState(side.offset(p_176225_4_)).doesSideBlockRendering(pos, side, p_176225_4_); + } + + @SideOnly(Side.CLIENT) +@@ -472,6 +478,10 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { @@ -52,6 +89,16 @@ } public int quantityDropped(Random random) +@@ -486,8 +496,7 @@ + + public float getPlayerRelativeBlockHardness(IBlockState playerIn, EntityPlayer worldIn, World pos, BlockPos p_180647_4_) + { +- float f = playerIn.func_185887_b(pos, p_180647_4_); +- return f < 0.0F ? 0.0F : (!worldIn.func_184823_b(playerIn) ? worldIn.func_184813_a(playerIn) / f / 100.0F : worldIn.func_184813_a(playerIn) / f / 30.0F); ++ return net.minecraftforge.common.ForgeHooks.blockStrength(playerIn, worldIn, pos, p_180647_4_); + } + + public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture) @@ -497,20 +506,16 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) @@ -102,7 +149,46 @@ } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand side, ItemStack hitX, EnumFacing hitY, float hitZ, float p_180639_9_, float p_180639_10_) -@@ -844,6 +854,1147 @@ +@@ -638,25 +648,35 @@ + player.triggerAchievement(StatList.func_188055_a(this)); + player.addExhaustion(0.025F); + +- if (this.canSilkHarvest() && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0) ++ if (this.canSilkHarvest(worldIn, pos, state, player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0) + { ++ java.util.List items = new java.util.ArrayList(); + ItemStack itemstack = this.createStackedBlock(state); + + if (itemstack != null) + { +- spawnAsEntity(worldIn, pos, itemstack); ++ items.add(itemstack); + } ++ ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, 0, 1.0f, true, player); ++ for (ItemStack stack : items) ++ { ++ spawnAsEntity(worldIn, pos, stack); ++ } + } + else + { ++ harvesters.set(player); + int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185308_t, p_180657_6_); + this.dropBlockAsItem(worldIn, pos, state, i); ++ harvesters.set(null); + } + } + ++ @Deprecated //Forge: State sensitive version + protected boolean canSilkHarvest() + { +- return this.getDefaultState().func_185917_h() && !this.isBlockContainer; ++ return this.getDefaultState().func_185917_h() && !this.hasTileEntity(silk_check_state.get()); + } + + protected ItemStack createStackedBlock(IBlockState state) +@@ -844,6 +864,1160 @@ return "Block{" + blockRegistry.getNameForObject(this) + "}"; } @@ -114,18 +200,19 @@ + /** + * Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15 + * ++ * @param state Block state + * @param world The current world + * @param pos Block position in world + * @return The light value + */ -+ public int getLightValue(IBlockAccess world, BlockPos pos) ++ public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ Block block = world.getBlockState(pos).getBlock(); -+ if (block != this) ++ IBlockState other = world.getBlockState(pos); ++ if (other.getBlock() != this) + { -+ return block.getLightValue(world, pos); ++ return other.getLightValue(world, pos); + } -+ return getLightValue(); ++ return state.func_185906_d(); + } + + /** @@ -143,13 +230,15 @@ + * determines indirect power state, entity ejection from blocks, and a few + * others. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @return True if the block is a full cube + */ -+ public boolean isNormalCube(IBlockAccess world, BlockPos pos) ++ public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ return getMaterial().isOpaque() && isFullCube() && !canProvidePower(); ++ return getMaterial().isOpaque() && isFullCube() && !canProvidePower(); ++ return state.func_185904_a().isOpaque() && state.func_185917_h() && !state.func_185897_m(); + } + + /** @@ -163,22 +252,26 @@ + * @param side The side to check + * @return True if the block is opaque on the specified side. + */ -+ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face) ++ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) + { -+ return isOpaqueCube(); ++ return state.func_185914_p(); + } + + /** + * Checks if the block is a solid face on the given side, used by placement logic. + * ++ * @param base_state The base state, getActualState should be called first + * @param world The current world + * @param pos Block position in world + * @param side The side to check + * @return True if the block is solid on the specified side. + */ -+ public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) ++ public boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side) + { -+ IBlockState state = this.getActualState(world.getBlockState(pos), world, pos); ++ if (base_state.func_185896_q()) // Short circuit to vanilla function if its true ++ return true; ++ ++ IBlockState state = this.getActualState(base_state, world, pos); + + if (this instanceof BlockSlab) + { @@ -222,7 +315,7 @@ + { + return true; + } -+ return isNormalCube(world, pos); ++ return isNormalCube(state, world, pos); + } + + /** @@ -244,13 +337,14 @@ + * useful for creating pure logic-blocks that will be invisible + * to the player and otherwise interact as air would. + * ++ * @param sata The current state + * @param world The current world + * @param pos Block position in world + * @return True if the block considered air + */ -+ public boolean isAir(IBlockAccess world, BlockPos pos) ++ public boolean isAir(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ return getMaterial() == Material.air; ++ return state.func_185904_a() == Material.air; + } + + /** @@ -546,19 +640,20 @@ + /** + * Called when a leaf should start its decay process. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + */ -+ public void beginLeavesDecay(World world, BlockPos pos){} ++ public void beginLeavesDecay(IBlockState state, World world, BlockPos pos){} + + /** + * Determines if this block can prevent leaves connected to it from decaying. -+ * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @return true if the presence this block can prevent leaves from decaying. + */ -+ public boolean canSustainLeaves(IBlockAccess world, BlockPos pos) ++ public boolean canSustainLeaves(IBlockState state, IBlockAccess world, BlockPos pos) + { + return false; + } @@ -566,13 +661,14 @@ + /** + * Determines if this block is considered a leaf block, used to apply the leaf decay and generation system. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @return true if this block is considered leaves. + */ -+ public boolean isLeaves(IBlockAccess world, BlockPos pos) ++ public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ return getMaterial() == Material.leaves; ++ return state.func_185904_a() == Material.leaves; + } + + /** @@ -645,14 +741,15 @@ + * Determine if this block can make a redstone connection on the side provided, + * Useful to control which sides are inputs and outputs for redstone wires. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @param side The side that is trying to make the connection, CAN BE NULL + * @return True to make the connection + */ -+ public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side) ++ public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) + { -+ return canProvidePower() && side != null; ++ return state.func_185897_m() && side != null; + } + + /** @@ -785,15 +882,15 @@ + * Plains check if its grass or dirt + * Water check if its still water + * ++ * @param state The Current state + * @param world The current world + * @param pos Block position in world + * @param direction The direction relative to the given position the plant wants to be, typically its UP + * @param plantable The plant that wants to check + * @return True to allow the plant to be planted/stay. + */ -+ 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, net.minecraftforge.common.IPlantable plantable) + { -+ IBlockState state = world.getBlockState(pos); + IBlockState plant = plantable.getPlant(world, pos.offset(direction)); + net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); + @@ -880,13 +977,14 @@ + * Recommended that you have your tile entity call relight after being placed if you + * rely on it for light info. + * ++ * @param state The Block state + * @param world The current world + * @param pos Block position in world + * @return The amount of light to block, 0 for air, 255 for fully opaque. + */ -+ public int getLightOpacity(IBlockAccess world, BlockPos pos) ++ public int getLightOpacity(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ return getLightOpacity(); ++ return state.func_185891_c(); + } + + /** @@ -1005,12 +1103,13 @@ + /** + * Gathers how much experience this block drops when broken. + * ++ * @param state The current state + * @param world The world + * @param pos Block position + * @param fortune + * @return Amount of XP from breaking this block. + */ -+ public int getExpDrop(IBlockAccess world, BlockPos pos, int fortune) ++ public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune) + { + return 0; + } @@ -1134,7 +1233,7 @@ + /** + * Called when the entity is inside this block, may be used to determined if the entity can breathing, + * display material overlays, or if the entity can swim inside a block. -+ * ++ * + * @param world that is being tested. + * @param blockpos position thats being tested. + * @param iblockstate state at world/blockpos @@ -1148,11 +1247,11 @@ + { + return null; + } -+ ++ + /** + * Called when boats or fishing hooks are inside the block to check if they are inside + * the material requested. -+ * ++ * + * @param world world that is being tested. + * @param pos block thats being tested. + * @param boundingBox box to test, generally the bounds of an entity that are besting tested. diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch index 820a9b6727..6a8da5c926 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch @@ -1,6 +1,21 @@ --- ../src-base/minecraft/net/minecraft/block/BlockBanner.java +++ ../src-work/minecraft/net/minecraft/block/BlockBanner.java -@@ -138,6 +138,28 @@ +@@ -104,14 +104,7 @@ + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- ItemStack itemstack = this.func_185549_e(worldIn, pos, state); +- +- if (itemstack != null) + { +- spawnAsEntity(worldIn, pos, itemstack); +- } +- else +- { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + } +@@ -138,6 +131,28 @@ } } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch index 04d7d6910b..ec7e1b3282 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch @@ -9,7 +9,29 @@ { protected static final AxisAlignedBB field_185515_b = new AxisAlignedBB(0.30000001192092896D, 0.0D, 0.30000001192092896D, 0.699999988079071D, 0.6000000238418579D, 0.699999988079071D); -@@ -90,6 +90,35 @@ +@@ -37,7 +37,8 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return super.canPlaceBlockAt(worldIn, pos) && this.func_185514_i(worldIn.getBlockState(pos.down())); ++ IBlockState soil = worldIn.getBlockState(pos.down()); ++ return super.canPlaceBlockAt(worldIn, pos) && soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); + } + + protected boolean func_185514_i(IBlockState p_185514_1_) +@@ -67,6 +68,11 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { ++ if (state.getBlock() == this) //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. ++ { ++ IBlockState soil = worldIn.getBlockState(pos.down()); ++ return soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); ++ } + return this.func_185514_i(worldIn.getBlockState(pos.down())); + } + +@@ -90,6 +96,35 @@ return false; } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch new file mode 100644 index 0000000000..965be0f0ca --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockButton.java ++++ ../src-work/minecraft/net/minecraft/block/BlockButton.java +@@ -89,7 +89,7 @@ + protected static boolean func_181088_a(World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_) + { + BlockPos blockpos = p_181088_1_.offset(p_181088_2_); +- return p_181088_2_ == EnumFacing.DOWN ? p_181088_0_.getBlockState(blockpos).func_185896_q() : p_181088_0_.getBlockState(blockpos).func_185915_l(); ++ return p_181088_0_.getBlockState(blockpos).isSideSolid(p_181088_0_, blockpos, p_181088_2_.getOpposite()); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch index 656fa2cacf..c6b8cd71c8 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch @@ -9,6 +9,17 @@ { public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); protected static final AxisAlignedBB field_185593_b = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.9375D, 0.9375D); +@@ -110,8 +110,8 @@ + } + } + +- Block block = worldIn.getBlockState(pos.down()).getBlock(); +- return block == Blocks.cactus || block == Blocks.sand && !worldIn.getBlockState(pos.up()).func_185904_a().isLiquid(); ++ IBlockState state = worldIn.getBlockState(pos.down()); ++ return state.getBlock().canSustainPlant(state, worldIn, pos, EnumFacing.UP, this) && !worldIn.getBlockState(pos.up()).func_185904_a().isLiquid(); + } + + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) @@ -135,6 +135,18 @@ return ((Integer)state.getValue(AGE)).intValue(); } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch new file mode 100644 index 0000000000..80f84aa25f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockChest.java ++++ ../src-work/minecraft/net/minecraft/block/BlockChest.java +@@ -506,7 +506,7 @@ + + private boolean isBelowSolidBlock(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos.up()).func_185915_l(); ++ return worldIn.getBlockState(pos.up()).isSideSolid(worldIn, pos, EnumFacing.DOWN); + } + + private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch index 1295dd5070..07b5ee3046 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch @@ -5,7 +5,7 @@ IBlockState iblockstate = worldIn.getBlockState(blockpos.add(i, 0, j)); - if (iblockstate.getBlock() == Blocks.farmland) -+ if (iblockstate.getBlock().canSustainPlant(worldIn, blockpos.add(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)blockIn)) ++ if (iblockstate.getBlock().canSustainPlant(iblockstate, worldIn, blockpos.add(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)blockIn)) { f1 = 1.0F; @@ -14,7 +14,17 @@ { f1 = 3.0F; } -@@ -174,6 +174,28 @@ +@@ -161,7 +161,8 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.func_185514_i(worldIn.getBlockState(pos.down())); ++ IBlockState soil = worldIn.getBlockState(pos.down()); ++ return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); + } + + protected Item getSeed() +@@ -174,11 +175,33 @@ return Items.wheat; } @@ -43,3 +53,9 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); + +- if (!worldIn.isRemote) ++ if (false && !worldIn.isRemote) // Forge: NOP all this. + { + int i = this.func_185527_x(state); + diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch index 6fe72a39d4..6e163176ec 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch @@ -9,3 +9,24 @@ { protected static final AxisAlignedBB field_185516_a = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D); +@@ -57,7 +57,7 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) + { +- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) ++ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) // Forge: Noop + { + player.triggerAchievement(StatList.func_188055_a(this)); + spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0)); +@@ -67,4 +67,11 @@ + super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_); + } + } ++ ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } ++ @Override ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return java.util.Arrays.asList(new ItemStack(Blocks.deadbush)); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch index 66d7698e9e..f0c530774e 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch @@ -9,3 +9,12 @@ } else { +@@ -219,7 +219,7 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return pos.getY() >= 255 ? false : worldIn.getBlockState(pos.down()).func_185896_q() && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); ++ return pos.getY() >= worldIn.getHeight() - 1 ? false : worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); + } + + public EnumPushReaction getMobilityFlag(IBlockState p_149656_1_) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch index 58d4de4515..d8814ad416 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch @@ -37,7 +37,24 @@ if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) { return worldIn.getBlockState(pos.down()).getBlock() == this; -@@ -284,6 +282,32 @@ +@@ -149,7 +147,6 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) + { +- if (worldIn.isRemote || p_180657_6_ == null || p_180657_6_.getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player)) + { + super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_); + } +@@ -212,8 +209,6 @@ + else + { + player.triggerAchievement(StatList.func_188055_a(this)); +- int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta(); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i)); + return true; + } + } +@@ -284,6 +279,32 @@ return Block.EnumOffsetType.XZ; } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDragonEgg.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDragonEgg.java.patch new file mode 100644 index 0000000000..537d71b3f7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockDragonEgg.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockDragonEgg.java ++++ ../src-work/minecraft/net/minecraft/block/BlockDragonEgg.java +@@ -48,7 +48,7 @@ + + private void checkFall(World worldIn, BlockPos pos) + { +- if (BlockFalling.func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0) ++ if (worldIn.isAirBlock(pos.down()) && BlockFalling.func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0) + { + int i = 32; + +@@ -61,7 +61,7 @@ + worldIn.setBlockToAir(pos); + BlockPos blockpos; + +- for (blockpos = pos; BlockFalling.func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down()) ++ for (blockpos = pos; worldIn.isAirBlock(blockpos) && BlockFalling.func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down()) + { + ; + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch new file mode 100644 index 0000000000..1df616bbac --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFalling.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java +@@ -44,7 +44,7 @@ + + private void checkFallable(World worldIn, BlockPos pos) + { +- if (func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0) ++ if (worldIn.isAirBlock(pos) && func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0) + { + int i = 32; + +@@ -62,7 +62,7 @@ + worldIn.setBlockToAir(pos); + BlockPos blockpos; + +- for (blockpos = pos.down(); func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down()) ++ for (blockpos = pos.down(); worldIn.isAirBlock(blockpos) && func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down()) + { + ; + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch index 0ebf66806f..a41931a440 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch @@ -5,7 +5,7 @@ { Block block = worldIn.getBlockState(pos.up()).getBlock(); - return block instanceof BlockCrops || block instanceof BlockStem; -+ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(worldIn, pos, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block); ++ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(worldIn.getBlockState(pos), worldIn, pos, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block); } private boolean hasWater(World worldIn, BlockPos pos) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch index 29ff54bf65..d8ce1b5fa7 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch @@ -1,6 +1,23 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFire.java +++ ../src-work/minecraft/net/minecraft/block/BlockFire.java -@@ -90,6 +90,7 @@ +@@ -37,7 +37,15 @@ + + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { +- return !worldIn.getBlockState(pos.down()).func_185896_q() && !Blocks.fire.canCatchFire(worldIn, pos.down()) ? state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west()))).withProperty(UPPER, Boolean.valueOf(this.canCatchFire(worldIn, pos.up()))) : this.getDefaultState(); ++ if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) ++ { ++ return state.withProperty(NORTH, this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH)) ++ .withProperty(EAST, this.canCatchFire(worldIn, pos.east(), EnumFacing.WEST)) ++ .withProperty(SOUTH, this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH)) ++ .withProperty(WEST, this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST)) ++ .withProperty(UPPER, this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)); ++ } ++ return this.getDefaultState(); + } + + protected BlockFire() +@@ -90,6 +98,7 @@ public void setFireInfo(Block blockIn, int encouragement, int flammability) { @@ -8,7 +25,31 @@ this.encouragements.put(blockIn, Integer.valueOf(encouragement)); this.flammabilities.put(blockIn, Integer.valueOf(flammability)); } -@@ -164,7 +165,7 @@ +@@ -129,13 +138,8 @@ + } + + Block block = worldIn.getBlockState(pos.down()).getBlock(); +- boolean flag = block == Blocks.netherrack; ++ boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP); + +- if (worldIn.provider instanceof WorldProviderEnd && block == Blocks.bedrock) +- { +- flag = true; +- } +- + int i = ((Integer)state.getValue(AGE)).intValue(); + + if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos) && rand.nextFloat() < 0.2F + (float)i * 0.03F) +@@ -156,7 +160,7 @@ + { + if (!this.canNeighborCatchFire(worldIn, pos)) + { +- if (!worldIn.getBlockState(pos.down()).func_185896_q() || i > 3) ++ if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) || i > 3) + { + worldIn.setBlockToAir(pos); + } +@@ -164,7 +168,7 @@ return; } @@ -17,7 +58,7 @@ { worldIn.setBlockToAir(pos); return; -@@ -179,12 +180,12 @@ +@@ -179,12 +183,12 @@ j = -50; } @@ -36,7 +77,7 @@ for (int k = -1; k <= 1; ++k) { -@@ -243,22 +244,30 @@ +@@ -243,22 +247,30 @@ return false; } @@ -68,7 +109,7 @@ if (random.nextInt(chance) < i) { IBlockState iblockstate = worldIn.getBlockState(pos); -@@ -290,7 +299,7 @@ +@@ -290,7 +302,7 @@ { for (EnumFacing enumfacing : EnumFacing.values()) { @@ -77,7 +118,7 @@ { return true; } -@@ -311,7 +320,7 @@ +@@ -311,7 +323,7 @@ for (EnumFacing enumfacing : EnumFacing.values()) { @@ -86,7 +127,7 @@ } return i; -@@ -323,9 +332,10 @@ +@@ -323,9 +335,10 @@ return false; } @@ -98,7 +139,55 @@ } public boolean canPlaceBlockAt(World worldIn, BlockPos pos) -@@ -458,4 +468,19 @@ +@@ -364,9 +377,9 @@ + pos.func_184134_a((double)((float)state.getX() + 0.5F), (double)((float)state.getY() + 0.5F), (double)((float)state.getZ() + 0.5F), SoundEvents.field_187643_bs, SoundCategory.BLOCKS, 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false); + } + +- if (!pos.getBlockState(state.down()).func_185896_q() && !Blocks.fire.canCatchFire(pos, state.down())) ++ if (!pos.getBlockState(state.down()).isSideSolid(pos, state.down(), EnumFacing.UP) && !Blocks.fire.canCatchFire(pos, state.down(), EnumFacing.UP)) + { +- if (Blocks.fire.canCatchFire(pos, state.west())) ++ if (Blocks.fire.canCatchFire(pos, state.west(), EnumFacing.EAST)) + { + for (int j = 0; j < 2; ++j) + { +@@ -377,7 +390,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(pos, state.east())) ++ if (Blocks.fire.canCatchFire(pos, state.east(), EnumFacing.WEST)) + { + for (int k = 0; k < 2; ++k) + { +@@ -388,7 +401,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(pos, state.north())) ++ if (Blocks.fire.canCatchFire(pos, state.north(), EnumFacing.SOUTH)) + { + for (int l = 0; l < 2; ++l) + { +@@ -399,7 +412,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(pos, state.south())) ++ if (Blocks.fire.canCatchFire(pos, state.south(), EnumFacing.NORTH)) + { + for (int i1 = 0; i1 < 2; ++i1) + { +@@ -410,7 +423,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(pos, state.up())) ++ if (Blocks.fire.canCatchFire(pos, state.up(), EnumFacing.DOWN)) + { + for (int j1 = 0; j1 < 2; ++j1) + { +@@ -458,4 +471,19 @@ { return new BlockStateContainer(this, new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER}); } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch index 526fd1507a..f5dff58105 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch @@ -36,9 +36,9 @@ + return super.removedByPlayer(world, pos, player, willHarvest); + } + @Override -+ public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) ++ public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack tool) + { -+ super.harvestBlock(world, player, pos, state, te); ++ super.harvestBlock(world, player, pos, state, te, tool); + world.setBlockToAir(pos); + } + /*===========================FORGE END==========================================*/ diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch index 086230b680..6ead8373d9 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch @@ -1,5 +1,23 @@ --- ../src-base/minecraft/net/minecraft/block/BlockGrass.java +++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java +@@ -38,7 +38,7 @@ + { + if (!worldIn.isRemote) + { +- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).func_185891_c() > 2) ++ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getLightOpacity(worldIn, pos.up()) > 2) + { + worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); + } +@@ -58,7 +58,7 @@ + IBlockState iblockstate = worldIn.getBlockState(blockpos.up()); + IBlockState iblockstate1 = worldIn.getBlockState(blockpos); + +- if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate.func_185891_c() <= 2) ++ if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate.getLightOpacity(worldIn, pos.up()) <= 2) + { + worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState()); + } @@ -96,7 +96,7 @@ { if (j >= i / 16) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch index 63bf78539d..063f3fcbf9 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch @@ -7,7 +7,7 @@ + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { + IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ for (IProperty prop : (java.util.Set>)state.getProperties().keySet()) + { + if (prop.getName().equals("variant")) + { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch new file mode 100644 index 0000000000..4ecf2b559c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch @@ -0,0 +1,34 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockIce.java ++++ ../src-work/minecraft/net/minecraft/block/BlockIce.java +@@ -40,14 +40,19 @@ + player.triggerAchievement(StatList.func_188055_a(this)); + player.addExhaustion(0.025F); + +- if (this.canSilkHarvest() && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0) ++ if (this.canSilkHarvest(worldIn, pos, state, player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0) + { ++ java.util.List items = new java.util.ArrayList(); + ItemStack itemstack = this.createStackedBlock(state); + + if (itemstack != null) + { +- spawnAsEntity(worldIn, pos, itemstack); ++ items.add(itemstack); + } ++ ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, 0, 1.0f, true, player); ++ for (ItemStack is : items) ++ spawnAsEntity(worldIn, pos, is); + } + else + { +@@ -58,7 +63,9 @@ + } + + int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185308_t, p_180657_6_); ++ harvesters.set(player); + this.dropBlockAsItem(worldIn, pos, state, i); ++ harvesters.set(null); + Material material = worldIn.getBlockState(pos.down()).func_185904_a(); + + if (material.blocksMovement() || material.isLiquid()) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch index f43e36d344..ee66a27545 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch @@ -1,6 +1,27 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLadder.java +++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java -@@ -139,4 +139,6 @@ +@@ -61,7 +61,10 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos.west()).func_185915_l() ? true : (worldIn.getBlockState(pos.east()).func_185915_l() ? true : (worldIn.getBlockState(pos.north()).func_185915_l() ? true : worldIn.getBlockState(pos.south()).func_185915_l())); ++ return worldIn.getBlockState(pos.west()).isSideSolid(worldIn, pos.west(), EnumFacing.EAST) || ++ worldIn.getBlockState(pos.east()).isSideSolid(worldIn, pos.east(), EnumFacing.WEST) || ++ worldIn.getBlockState(pos.north()).isSideSolid(worldIn, pos.north(), EnumFacing.SOUTH) || ++ worldIn.getBlockState(pos.south()).isSideSolid(worldIn, pos.south(), EnumFacing.NORTH); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) +@@ -99,7 +102,7 @@ + + protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing) + { +- return worldIn.getBlockState(pos.offset(facing.getOpposite())).func_185915_l(); ++ return worldIn.getBlockState(pos.offset(facing.getOpposite())).isSideSolid(worldIn, pos.offset(facing.getOpposite()), facing); + } + + public IBlockState getStateFromMeta(int meta) +@@ -139,4 +142,6 @@ { return new BlockStateContainer(this, new IProperty[] {FACING}); } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch index 0b1bfbd37b..41697f0afa 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch @@ -1,5 +1,38 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java +++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java +@@ -17,7 +17,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public abstract class BlockLeaves extends Block ++public abstract class BlockLeaves extends Block implements net.minecraftforge.common.IShearable + { + public static final PropertyBool DECAYABLE = PropertyBool.create("decayable"); + public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay"); +@@ -53,9 +53,9 @@ + BlockPos blockpos = pos.add(j1, k1, l1); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + +- if (iblockstate.func_185904_a() == Material.leaves && !((Boolean)iblockstate.getValue(CHECK_DECAY)).booleanValue()) ++ if (iblockstate.getBlock().isLeaves(iblockstate, worldIn, blockpos)) + { +- worldIn.setBlockState(blockpos, iblockstate.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4); ++ iblockstate.getBlock().beginLeavesDecay(iblockstate, worldIn, blockpos); + } + } + } +@@ -96,9 +96,9 @@ + IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2)); + Block block = iblockstate.getBlock(); + +- if (block != Blocks.log && block != Blocks.log2) ++ if (!block.canSustainLeaves(iblockstate, worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2))) + { +- if (iblockstate.func_185904_a() == Material.leaves) ++ if (block.isLeaves(iblockstate, worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2))) + { + this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2; + } @@ -205,40 +205,7 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) @@ -42,17 +75,16 @@ } protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) -@@ -274,6 +241,50 @@ +@@ -274,6 +241,49 @@ public abstract BlockPlanks.EnumType getWoodType(int meta); + @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } -+ @Override public boolean isLeaves(IBlockAccess world, BlockPos pos){ return true; } ++ @Override public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos){ return true; } + + @Override -+ public void beginLeavesDecay(World world, BlockPos pos) ++ public void beginLeavesDecay(IBlockState state, World world, BlockPos pos) + { -+ IBlockState state = world.getBlockState(pos); + if (!(Boolean)state.getValue(CHECK_DECAY)) + { + world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch index ef4cbd840f..1476f20508 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch @@ -1,10 +1,22 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLog.java +++ ../src-work/minecraft/net/minecraft/block/BlockLog.java +@@ -34,9 +34,9 @@ + { + IBlockState iblockstate = worldIn.getBlockState(blockpos); + +- if (iblockstate.func_185904_a() == Material.leaves && !((Boolean)iblockstate.getValue(BlockLeaves.CHECK_DECAY)).booleanValue()) ++ if (iblockstate.getBlock().isLeaves(iblockstate, worldIn, blockpos)) + { +- worldIn.setBlockState(blockpos, iblockstate.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4); ++ iblockstate.getBlock().beginLeavesDecay(iblockstate, worldIn, blockpos); + } + } + } @@ -69,6 +69,9 @@ } } -+ @Override public boolean canSustainLeaves(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } ++ @Override public boolean canSustainLeaves(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } + @Override public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } + public static enum EnumAxis implements IStringSerializable diff --git a/rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej b/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch similarity index 58% rename from rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch index 4d2b2a44dc..ecb65c7e07 100644 --- a/rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch @@ -1,4 +1,6 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java ++++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java +@@ -39,10 +39,14 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); @@ -7,12 +9,11 @@ } + @Override -+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { + return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); + } + - public boolean isOpaqueCube() + public boolean isOpaqueCube(IBlockState p_149662_1_) { return false; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej b/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch similarity index 68% rename from rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch index 3f22ed398a..ce3f419f53 100644 --- a/rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch @@ -1,10 +1,11 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java ++++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java +@@ -78,7 +78,7 @@ if (pos.getY() >= 0 && pos.getY() < 256) { IBlockState iblockstate = worldIn.getBlockState(pos.down()); -- return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate.getBlock())); -+ return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate.getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this)); +- return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.func_185514_i(iblockstate)); ++ return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate.getBlock().canSustainPlant(iblockstate, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this)); } else { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej b/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch similarity index 66% rename from rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch index 0124ec07f0..985648601b 100644 --- a/rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch @@ -1,20 +1,20 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java ++++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java +@@ -39,7 +39,7 @@ { if (!worldIn.isRemote) { -- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) -+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) +- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).func_185891_c() > 2) ++ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getLightOpacity(worldIn, pos.up()) > 2) { worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); } -++++ END PATCH -++++ REJECTED PATCH 2 +@@ -53,7 +53,7 @@ IBlockState iblockstate = worldIn.getBlockState(blockpos); - Block block = worldIn.getBlockState(blockpos.up()).getBlock(); + IBlockState iblockstate1 = worldIn.getBlockState(blockpos.up()); -- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) -+ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2) +- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate1.func_185891_c() <= 2) ++ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate1.getLightOpacity(worldIn, blockpos.up()) <= 2) { worldIn.setBlockState(blockpos, this.getDefaultState()); } -++++ END PATCH diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch index 3231eb30fe..b266cf7bdc 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch @@ -1,5 +1,14 @@ --- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java +++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java +@@ -42,7 +42,7 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.func_185514_i(worldIn.getBlockState(pos.down())); ++ return super.canBlockStay(worldIn, pos, state); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) @@ -58,9 +58,11 @@ super.updateTick(worldIn, pos, state, rand); } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch new file mode 100644 index 0000000000..d40cba379b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java ++++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java +@@ -98,7 +98,7 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) + { +- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) ++ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) //Forge: Noop this + { + player.triggerAchievement(StatList.func_188055_a(this)); + spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4)); +@@ -108,4 +108,10 @@ + super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_); + } + } ++ ++ @Override ++ public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return java.util.Arrays.asList(new ItemStack(this, 1, world.getBlockState(pos).getValue(VARIANT).getMetadata() - 4)); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch new file mode 100644 index 0000000000..8cbcaa92ab --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java ++++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java +@@ -14,6 +14,7 @@ + import net.minecraft.stats.StatList; + import net.minecraft.tileentity.TileEntity; + 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; +@@ -103,11 +104,16 @@ + if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) + { + player.triggerAchievement(StatList.func_188055_a(this)); +- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata())); + } + else + { + super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_); + } + } ++ ++ @Override ++ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return java.util.Arrays.asList(new ItemStack(this, 1, world.getBlockState(pos).getValue(VARIANT).getMetadata())); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch index c5808a94b5..7e269a4d5d 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockOre.java +++ ../src-work/minecraft/net/minecraft/block/BlockOre.java -@@ -59,34 +59,40 @@ +@@ -59,34 +59,39 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); @@ -8,9 +8,8 @@ - if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) + } + @Override -+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ IBlockState state = world.getBlockState(pos); + Random rand = world instanceof World ? ((World)world).rand : new Random(); + if (this.getItemDropped(state, rand, fortune) != Item.getItemFromBlock(this)) { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch index b8055f42b3..aed4a64de4 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch @@ -20,7 +20,7 @@ + public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir) + { + BlockPos off = pos.offset(dir); -+ Block block = world.getBlockState(off).getBlock(); -+ return canPaneConnectToBlock(block) || block.isSideSolid(world, off, dir.getOpposite()); ++ IBlockState state = world.getBlockState(off); ++ return canPaneConnectToBlock(state.getBlock()) || state.isSideSolid(world, off, dir.getOpposite()); + } } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch new file mode 100644 index 0000000000..450fc64601 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java +@@ -235,7 +235,7 @@ + } + } + +- if (!flag1 && iblockstate.func_185904_a() != Material.air && func_185646_a(iblockstate, worldIn, blockpos, enumfacing.getOpposite(), false) && (iblockstate.func_185905_o() == EnumPushReaction.NORMAL || block == Blocks.piston || block == Blocks.sticky_piston)) ++ if (!flag1 && !iblockstate.getBlock().isAir(iblockstate, worldIn, blockpos) && func_185646_a(iblockstate, worldIn, blockpos, enumfacing.getOpposite(), false) && (iblockstate.func_185905_o() == EnumPushReaction.NORMAL || block == Blocks.piston || block == Blocks.sticky_piston)) + { + this.doMove(worldIn, pos, enumfacing, false); + } +@@ -320,7 +320,7 @@ + return false; + } + +- return !block.hasTileEntity(); ++ return !block.hasTileEntity(p_185646_0_); + } + else + { +@@ -366,7 +366,9 @@ + { + BlockPos blockpos1 = (BlockPos)list2.get(j); + IBlockState iblockstate = worldIn.getBlockState(blockpos1); +- iblockstate.getBlock().dropBlockAsItem(worldIn, blockpos1, iblockstate, 0); ++ // Forge: With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. ++ float chance = iblockstate.getBlock() instanceof BlockSnow ? -1.0f : 1.0f; ++ iblockstate.getBlock().dropBlockAsItemWithChance(worldIn, blockpos1, iblockstate, chance, 0); + worldIn.setBlockToAir(blockpos1); + --k; + aiblockstate[k] = iblockstate; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch index 7cb52f548b..38167e9bfd 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch @@ -1,6 +1,23 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java +++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java -@@ -190,4 +190,16 @@ +@@ -110,7 +110,7 @@ + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) ++ if (false && !worldIn.isRemote) // Forge: Noop this out + { + TileEntityPiston tileentitypiston = this.func_185589_c(worldIn, pos); + +@@ -120,6 +120,7 @@ + iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0); + } + } ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + + public RayTraceResult collisionRayTrace(IBlockState worldIn, World pos, BlockPos start, Vec3d end, Vec3d p_180636_5_) +@@ -190,4 +191,16 @@ { return new BlockStateContainer(this, new IProperty[] {FACING, TYPE}); } @@ -8,7 +25,7 @@ + @Override + public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { -+ TileEntityPiston tileentitypiston = this.getTileEntity(world, pos); ++ TileEntityPiston tileentitypiston = this.func_185589_c(world, pos); + if (tileentitypiston != null) + { + IBlockState pushed = tileentitypiston.getPistonState(); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch new file mode 100644 index 0000000000..adc939ebab --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch @@ -0,0 +1,25 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPotato.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java +@@ -27,7 +27,7 @@ + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + +- if (!worldIn.isRemote) ++ if (false && !worldIn.isRemote) //Forge: Moved to getDrops + { + if (this.func_185525_y(state) && worldIn.rand.nextInt(50) == 0) + { +@@ -40,4 +40,13 @@ + { + return field_185534_a[((Integer)p_185496_1_.getValue(this.func_185524_e())).intValue()]; + } ++ ++ @Override ++ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = super.getDrops(world, pos, state, fortune); ++ if (this.func_185525_y(state) && RANDOM.nextInt(50) == 0) ++ ret.add(new ItemStack(Items.poisonous_potato)); ++ return ret; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch new file mode 100644 index 0000000000..06903e2d89 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java +@@ -117,7 +117,7 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && worldIn.getBlockState(pos.down()).func_185896_q(); ++ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos, EnumFacing.UP); + } + + public IBlockState func_185499_a(IBlockState p_185499_1_, Rotation p_185499_2_) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch index 14c8cb0545..ba67d27d57 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch @@ -7,7 +7,7 @@ + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { + IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ for (IProperty prop : state.getProperties().keySet()) + { + if (prop.getName().equals("variant") && prop.getValueClass() == EnumType.class) + { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch index 835fdb0489..bc05960c5c 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch @@ -9,6 +9,45 @@ } protected BlockRailBase(boolean isPowered) +@@ -65,7 +65,7 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos.down()).func_185896_q(); ++ return worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos, EnumFacing.UP); + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) +@@ -88,24 +88,24 @@ + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(this.getShapeProperty()); + boolean flag = false; + +- if (!worldIn.getBlockState(pos.down()).func_185896_q()) ++ if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP)) + { + flag = true; + } + +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !worldIn.getBlockState(pos.east()).func_185896_q()) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !worldIn.getBlockState(pos.east()).isSideSolid(worldIn, pos.east(), EnumFacing.UP)) + { + flag = true; + } +- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !worldIn.getBlockState(pos.west()).func_185896_q()) ++ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !worldIn.getBlockState(pos.west()).isSideSolid(worldIn, pos.west(), EnumFacing.UP)) + { + flag = true; + } +- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !worldIn.getBlockState(pos.north()).func_185896_q()) ++ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !worldIn.getBlockState(pos.north()).isSideSolid(worldIn, pos.north(), EnumFacing.UP)) + { + flag = true; + } +- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !worldIn.getBlockState(pos.south()).func_185896_q()) ++ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !worldIn.getBlockState(pos.south()).isSideSolid(worldIn, pos.south(), EnumFacing.UP)) + { + flag = true; + } @@ -160,6 +160,81 @@ public abstract IProperty getShapeProperty(); @@ -75,7 +114,7 @@ + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { + IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ for (IProperty prop : state.getProperties().keySet()) + { + if (prop.getName().equals("shape")) + { @@ -99,7 +138,17 @@ public Rail(World worldIn, BlockPos pos, IBlockState state) { -@@ -429,7 +505,7 @@ +@@ -238,7 +314,8 @@ + this.state = state; + this.block = (BlockRailBase)state.getBlock(); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(this.block.getShapeProperty()); +- this.isPowered = this.block.isPowered; ++ this.isPowered = !this.block.isFlexibleRail(worldIn, pos); ++ this.canMakeSlopes = this.block.canMakeSlopes(worldIn, pos); + this.func_180360_a(blockrailbase$enumraildirection); + } + +@@ -429,7 +506,7 @@ } } @@ -108,7 +157,7 @@ { if (BlockRailBase.isRailBlock(this.world, blockpos.up())) { -@@ -442,7 +518,7 @@ +@@ -442,7 +519,7 @@ } } @@ -117,7 +166,7 @@ { if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) { -@@ -585,7 +661,7 @@ +@@ -585,7 +662,7 @@ } } @@ -126,7 +175,7 @@ { if (BlockRailBase.isRailBlock(this.world, blockpos.up())) { -@@ -598,7 +674,7 @@ +@@ -598,7 +675,7 @@ } } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch index 8acd40ee8d..7ef87d176d 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch @@ -8,9 +8,9 @@ - if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) + @Override -+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ if (this.getItemDropped(world.getBlockState(pos), RANDOM, fortune) != Item.getItemFromBlock(this)) ++ if (this.getItemDropped(state, RANDOM, fortune) != Item.getItemFromBlock(this)) { - int i = 1 + worldIn.rand.nextInt(5); - this.dropXpOnBlockBreak(worldIn, pos, i); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch new file mode 100644 index 0000000000..0862f370aa --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch @@ -0,0 +1,55 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java +@@ -97,15 +97,15 @@ + BlockPos blockpos = pos.offset(direction); + IBlockState iblockstate = worldIn.getBlockState(pos.offset(direction)); + +- if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (iblockstate.func_185915_l() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down())))) ++ if (!canConnectTo(worldIn.getBlockState(blockpos), direction, worldIn, blockpos) && (iblockstate.func_185915_l() || !canConnectUpwardsTo(worldIn, blockpos.down()))) + { + IBlockState iblockstate1 = worldIn.getBlockState(pos.up()); + + if (!iblockstate1.func_185915_l()) + { +- boolean flag = worldIn.getBlockState(blockpos).func_185896_q() || worldIn.getBlockState(blockpos).getBlock() == Blocks.glowstone; ++ boolean flag = worldIn.getBlockState(blockpos).isSideSolid(worldIn, blockpos, EnumFacing.UP) || worldIn.getBlockState(blockpos).getBlock() == Blocks.glowstone; + +- if (flag && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up()))) ++ if (flag && canConnectUpwardsTo(worldIn, blockpos.up())) + { + if (iblockstate.func_185898_k()) + { +@@ -406,21 +406,16 @@ + IBlockState iblockstate = worldIn.getBlockState(blockpos); + boolean flag = iblockstate.func_185915_l(); + boolean flag1 = worldIn.getBlockState(pos.up()).func_185915_l(); +- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (iblockstate.getBlock() == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.field_185512_D) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down()))); ++ return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side, worldIn, pos) ? true : (iblockstate.getBlock() == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.field_185512_D) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down()))); + } + + protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos) + { +- return canConnectUpwardsTo(worldIn.getBlockState(pos)); ++ return canConnectTo(worldIn.getBlockState(pos), null, worldIn, pos); + } + +- protected static boolean canConnectUpwardsTo(IBlockState state) ++ protected static boolean canConnectTo(IBlockState blockState, EnumFacing side, IBlockAccess world, BlockPos pos) + { +- return canConnectTo(state, (EnumFacing)null); +- } +- +- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) +- { + Block block = blockState.getBlock(); + + if (block == Blocks.redstone_wire) +@@ -434,7 +429,7 @@ + } + else + { +- return blockState.func_185897_m() && side != null; ++ return blockState.getBlock().canConnectRedstone(blockState, world, pos, side); + } + } + diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch index 73e2c0206c..904112b90c 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch @@ -9,15 +9,18 @@ { public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); protected static final AxisAlignedBB field_185701_b = new AxisAlignedBB(0.125D, 0.0D, 0.125D, 0.875D, 1.0D, 0.875D); -@@ -70,6 +70,7 @@ +@@ -69,7 +69,9 @@ + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { - Block block = worldIn.getBlockState(pos.down()).getBlock(); -+ if (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this)) return true; +- Block block = worldIn.getBlockState(pos.down()).getBlock(); ++ IBlockState state = worldIn.getBlockState(pos.down()); ++ Block block = state.getBlock(); ++ if (block.canSustainPlant(state, worldIn, pos.down(), EnumFacing.UP, this)) return true; if (block == this) { -@@ -162,6 +163,17 @@ +@@ -162,6 +164,17 @@ return ((Integer)state.getValue(AGE)).intValue(); } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch index f7f921a9e8..75bcd35ce3 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch @@ -1,10 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRotatedPillar.java +++ ../src-work/minecraft/net/minecraft/block/BlockRotatedPillar.java -@@ -28,6 +28,20 @@ +@@ -28,6 +28,21 @@ super(p_i46385_1_, p_i46385_2_); } -+ public boolean rotateBlock(net.minecraft.world.World world, net.minecraft.util.BlockPos pos, EnumFacing axis) ++ @Override ++ public boolean rotateBlock(net.minecraft.world.World world, BlockPos pos, EnumFacing axis) + { + net.minecraft.block.state.IBlockState state = world.getBlockState(pos); + for (net.minecraft.block.properties.IProperty prop : state.getProperties().keySet()) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch index 6eba91dd92..9aeff23d66 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch @@ -31,6 +31,15 @@ { if (!((Boolean)state.getValue(NODROP)).booleanValue()) { +@@ -142,7 +143,7 @@ + if (tileentity instanceof TileEntitySkull) + { + TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; +- ItemStack itemstack = this.func_185473_a(worldIn, pos, state); ++ ItemStack itemstack = new ItemStack(Items.skull, 1, tileentityskull.getSkullType()); + + if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null) + { @@ -152,12 +153,11 @@ itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound); } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch index 7b088c7379..3091b3bbe9 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch @@ -5,11 +5,11 @@ } + @Override -+ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ if ( isOpaqueCube() ) ++ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ if ( state.func_185914_p() ) + return true; -+ ++ + // face is on the block being rendered, not this block. + EnumBlockHalf side = world.getBlockState(pos).getValue(HALF); + return (side == EnumBlockHalf.TOP && face == EnumFacing.DOWN) || (side == EnumBlockHalf.BOTTOM && face == EnumFacing.UP); @@ -18,3 +18,19 @@ public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { IBlockState iblockstate = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM); +@@ -77,13 +88,14 @@ + { + return false; + } +- else ++ else if (false) // Forge: Additional logic breaks doesSideBlockRendering and is no longer useful. + { + IBlockState iblockstate = pos.getBlockState(side.offset(p_176225_4_)); + boolean flag = func_185675_i(iblockstate) && iblockstate.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP; + boolean flag1 = func_185675_i(worldIn) && worldIn.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP; + return flag1 ? (p_176225_4_ == EnumFacing.DOWN ? true : (p_176225_4_ == EnumFacing.UP && super.shouldSideBeRendered(worldIn, pos, side, p_176225_4_) ? true : !func_185675_i(iblockstate) || !flag)) : (p_176225_4_ == EnumFacing.UP ? true : (p_176225_4_ == EnumFacing.DOWN && super.shouldSideBeRendered(worldIn, pos, side, p_176225_4_) ? true : !func_185675_i(iblockstate) || flag)); + } ++ return super.shouldSideBeRendered(worldIn, pos, side, p_176225_4_); + } + + @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch index 3fd57bfd7d..c8f2925fef 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch @@ -1,5 +1,14 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSnow.java +++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java +@@ -73,7 +73,7 @@ + { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); + Block block = iblockstate.getBlock(); +- return block != Blocks.ice && block != Blocks.packed_ice ? (iblockstate.func_185904_a() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : iblockstate.func_185914_p() && iblockstate.func_185904_a().blocksMovement())) : false; ++ return block != Blocks.ice && block != Blocks.packed_ice ? (iblockstate.getBlock().isLeaves(iblockstate, worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : iblockstate.func_185914_p() && iblockstate.func_185904_a().blocksMovement())) : false; + } + + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) @@ -85,7 +85,6 @@ { if (!this.canPlaceBlockAt(worldIn, pos)) @@ -8,7 +17,18 @@ worldIn.setBlockToAir(pos); return false; } -@@ -109,14 +108,13 @@ +@@ -97,9 +96,8 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) + { +- spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0)); ++ super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_); + worldIn.setBlockToAir(pos); +- player.triggerAchievement(StatList.func_188055_a(this)); + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) +@@ -109,14 +107,13 @@ public int quantityDropped(Random random) { @@ -24,7 +44,7 @@ worldIn.setBlockToAir(pos); } } -@@ -150,6 +148,8 @@ +@@ -150,6 +147,8 @@ return ((Integer)state.getValue(LAYERS)).intValue() - 1; } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch new file mode 100644 index 0000000000..be4923a137 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockStairs.java ++++ ../src-work/minecraft/net/minecraft/block/BlockStairs.java +@@ -443,6 +443,19 @@ + return new BlockStateContainer(this, new IProperty[] {FACING, HALF, SHAPE}); + } + ++ @Override ++ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ if ( state.func_185914_p() ) ++ return true; ++ ++ // face is on the block being rendered, not this block. ++ IBlockState iblockstate = world.getBlockState(pos); ++ EnumHalf half = iblockstate.getValue(HALF); ++ EnumFacing side = iblockstate.getValue(FACING); ++ return side == face.getOpposite() || (half == EnumHalf.TOP && face == EnumFacing.DOWN) || (half == EnumHalf.BOTTOM && face == EnumFacing.UP); ++ } ++ + public static enum EnumHalf implements IStringSerializable + { + TOP("top"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch index c68f85e424..66121bb000 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch @@ -1,15 +1,19 @@ --- ../src-base/minecraft/net/minecraft/block/BlockStem.java +++ ../src-work/minecraft/net/minecraft/block/BlockStem.java -@@ -91,7 +91,7 @@ +@@ -89,9 +89,10 @@ + } + pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand)); - Block block = worldIn.getBlockState(pos.down()).getBlock(); +- Block block = worldIn.getBlockState(pos.down()).getBlock(); ++ IBlockState soil = worldIn.getBlockState(pos.down()); ++ Block block = soil.getBlock(); - if (worldIn.getBlockState(pos).getBlock().blockMaterial == Material.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass)) -+ if (worldIn.isAirBlock(pos) && (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this) || block == Blocks.dirt || block == Blocks.grass)) ++ if (worldIn.isAirBlock(pos) && (block.canSustainPlant(soil, worldIn, pos.down(), EnumFacing.UP, this) || block == Blocks.dirt || block == Blocks.grass)) { worldIn.setBlockState(pos, this.crop.getDefaultState()); } -@@ -109,8 +109,12 @@ +@@ -109,8 +110,12 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); @@ -23,7 +27,7 @@ { Item item = this.getSeedItem(); -@@ -120,13 +124,14 @@ +@@ -120,13 +125,14 @@ for (int j = 0; j < 3; ++j) { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch index f53bcd4ba0..3698569fb0 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch @@ -9,6 +9,15 @@ { public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockTallGrass.EnumType.class); protected static final AxisAlignedBB field_185522_c = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D); +@@ -41,7 +41,7 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.func_185514_i(worldIn.getBlockState(pos.down())); ++ return super.canBlockStay(worldIn, pos, state); + } + + public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) @@ -51,7 +51,7 @@ public Item getItemDropped(IBlockState state, Random rand, int fortune) @@ -18,6 +27,15 @@ } public int quantityDroppedWithBonus(int fortune, Random random) +@@ -61,7 +61,7 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) + { +- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) ++ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) // Forge: Noop Taken care of by IShearable + { + player.triggerAchievement(StatList.func_188055_a(this)); + spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta())); @@ -181,4 +181,22 @@ } } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch new file mode 100644 index 0000000000..8f71d8c096 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java +@@ -77,14 +77,14 @@ + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { +- return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).func_185915_l(); ++ return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).isSideSolid(worldIn, pos.offset(side.getOpposite()), side); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) + { +- if (worldIn.getBlockState(pos.offset(enumfacing)).func_185915_l()) ++ if (worldIn.getBlockState(pos.offset(enumfacing)).isSideSolid(worldIn, pos.offset(enumfacing), enumfacing.getOpposite())) + { + return true; + } +@@ -118,7 +118,7 @@ + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + +- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).func_185915_l()) ++ if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).isSideSolid(worldIn, pos.offset(enumfacing.getOpposite()), enumfacing)) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch index cc09afa923..e939dca263 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch @@ -9,6 +9,15 @@ { public static final PropertyBool UP = PropertyBool.create("up"); public static final PropertyBool NORTH = PropertyBool.create("north"); +@@ -342,7 +342,7 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) + { +- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) ++ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) // Forge: Noop, Covered by IShearable + { + player.triggerAchievement(StatList.func_188055_a(this)); + spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0)); @@ -457,4 +457,14 @@ return i; diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch new file mode 100644 index 0000000000..a847006055 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java ++++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java +@@ -80,7 +80,7 @@ + IBlockState iblockstate = this.world.getBlockState(origin); + Block block = iblockstate.getBlock(); + +- if (iblockstate.func_185904_a() == Material.air) ++ if (iblockstate.getBlock().isAir(iblockstate, this.world, origin)) + { + return true; + } +@@ -112,7 +112,7 @@ + iblockstate = this.world.getBlockState(blockpos); + block = iblockstate.getBlock(); + +- if (iblockstate.func_185904_a() == Material.air || !BlockPistonBase.func_185646_a(iblockstate, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) ++ if (iblockstate.getBlock().isAir(iblockstate, this.world, blockpos) || !BlockPistonBase.func_185646_a(iblockstate, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) + { + break; + } +@@ -159,7 +159,7 @@ + + iblockstate = this.world.getBlockState(blockpos1); + +- if (iblockstate.func_185904_a() == Material.air) ++ if (iblockstate.getBlock().isAir(iblockstate, this.world, blockpos1)) + { + return true; + } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch index 1391fcbe52..e6d4fff7f3 100644 --- a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch @@ -4,8 +4,8 @@ return stringbuilder.toString(); } -+ -+ public com.google.common.collect.ImmutableTable getPropertyValueTable() ++ ++ public com.google.common.collect.ImmutableTable, Comparable, IBlockState> getPropertyValueTable() + { + return null; + } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch new file mode 100644 index 0000000000..0bb60ecf51 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch @@ -0,0 +1,77 @@ +--- ../src-base/minecraft/net/minecraft/block/state/BlockStateContainer.java ++++ ../src-work/minecraft/net/minecraft/block/state/BlockStateContainer.java +@@ -55,6 +55,16 @@ + + public BlockStateContainer(Block blockIn, IProperty... properties) + { ++ this(blockIn, properties, null); ++ } ++ ++ protected StateImplementation createState(Block block, ImmutableMap, Comparable> properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) ++ { ++ return new StateImplementation(block, properties); ++ } ++ ++ protected BlockStateContainer(Block blockIn, IProperty[] properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) ++ { + this.block = blockIn; + Map < String, IProperty> map = Maps. < String, IProperty> newHashMap(); + +@@ -71,7 +81,7 @@ + for (List < Comparable> list : Cartesian.cartesianProduct(this.getAllowedValues())) + { + Map < IProperty, Comparable> map1 = MapPopulator. < IProperty, Comparable> createMap(this.properties.values(), list); +- BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation = new BlockStateContainer.StateImplementation(blockIn, ImmutableMap.copyOf(map1)); ++ BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map1), unlistedProperties); + map2.put(map1, blockstatecontainer$stateimplementation); + list1.add(blockstatecontainer$stateimplementation); + } +@@ -163,6 +173,13 @@ + this.properties = propertiesIn; + } + ++ protected StateImplementation(Block blockIn, ImmutableMap, Comparable> propertiesIn, ImmutableTable, Comparable, IBlockState> propertyValueTable) ++ { ++ this.block = blockIn; ++ this.properties = propertiesIn; ++ this.propertyValueTable = propertyValueTable; ++ } ++ + public Collection < IProperty> getPropertyNames() + { + return Collections. < IProperty> unmodifiableCollection(this.properties.keySet()); +@@ -414,5 +431,34 @@ + { + return this.block.func_185481_k(this); + } ++ ++ //Forge Start ++ public ImmutableTable, Comparable, IBlockState> getPropertyValueTable() ++ { ++ return propertyValueTable; ++ } ++ ++ @Override ++ public int getLightOpacity(IBlockAccess world, BlockPos pos) ++ { ++ return this.block.getLightOpacity(this, world, pos); ++ } ++ ++ @Override ++ public int getLightValue(IBlockAccess world, BlockPos pos) ++ { ++ return this.block.getLightValue(this, world, pos); ++ } ++ ++ public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) ++ { ++ return this.block.isSideSolid(this, world, pos, side); ++ } ++ ++ @Override ++ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing side) ++ { ++ return this.block.doesSideBlockRendering(this, world, pos, side); ++ } + } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/IBlockProperties.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/IBlockProperties.java.patch new file mode 100644 index 0000000000..e90318ea8f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/state/IBlockProperties.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/block/state/IBlockProperties.java ++++ ../src-work/minecraft/net/minecraft/block/state/IBlockProperties.java +@@ -25,9 +25,13 @@ + + boolean func_185913_b(); + ++ @Deprecated //Forge location aware version below + int func_185891_c(); ++ int getLightOpacity(IBlockAccess world, BlockPos pos); + ++ @Deprecated //Forge location aware version below + int func_185906_d(); ++ int getLightValue(IBlockAccess world, BlockPos pos); + + @SideOnly(Side.CLIENT) + boolean func_185895_e(); +@@ -88,5 +92,10 @@ + + RayTraceResult func_185910_a(World p_185910_1_, BlockPos p_185910_2_, Vec3d p_185910_3_, Vec3d p_185910_4_); + ++ @Deprecated // Forge: Use isSideSolid(IBlockAccess, BlockPos, EnumFacing.UP) instead + boolean func_185896_q(); ++ ++ //Forge added functions ++ boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing side); ++ boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side); + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch new file mode 100644 index 0000000000..fca72641b7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityFallingBlock.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityFallingBlock.java +@@ -129,6 +129,7 @@ + { + IBlockState iblockstate = this.worldObj.getBlockState(blockpos1); + ++ if (this.worldObj.isAirBlock(new BlockPos(this.posX, this.posY - 0.009999999776482582D, this.posZ))) //Forge: Don't indent below. + if (BlockFalling.func_185759_i(this.worldObj.getBlockState(new BlockPos(this.posX, this.posY - 0.009999999776482582D, this.posZ)))) + { + this.onGround = false; diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index 913f63e486..1c16e0ee1f 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -87,7 +87,33 @@ } public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem) -@@ -845,6 +868,16 @@ +@@ -746,15 +769,24 @@ + + protected ItemStack func_184816_a(EntityItem p_184816_1_) + { ++ if (captureDrops) capturedDrops.add(p_184816_1_); ++ else // Forge: Don't indent to keep patch smaller. + this.worldObj.spawnEntityInWorld(p_184816_1_); + ItemStack itemstack = p_184816_1_.getEntityItem(); + return itemstack; + } + ++ @Deprecated //Use location sensitive version below + public float func_184813_a(IBlockState p_184813_1_) + { +- float f = this.inventory.func_184438_a(p_184813_1_); ++ return getBreakSpeed(p_184813_1_, new BlockPos(0, -1, 0)); ++ } + ++ public float getBreakSpeed(IBlockState state, BlockPos pos) ++ { ++ ItemStack stack = this.inventory.getCurrentItem(); ++ float f = (stack == null ? 1.0F : stack.getItem().getDigSpeed(stack, state)); ++ + if (f > 1.0F) + { + int i = EnchantmentHelper.func_185293_e(this); +@@ -845,6 +877,16 @@ this.spawnForced = tagCompund.getBoolean("SpawnForced"); } @@ -104,7 +130,7 @@ this.foodStats.readNBT(tagCompund); this.capabilities.readCapabilitiesFromNBT(tagCompund); -@@ -877,6 +910,23 @@ +@@ -877,6 +919,23 @@ tagCompound.setBoolean("SpawnForced", this.spawnForced); } @@ -128,7 +154,7 @@ this.foodStats.writeNBT(tagCompound); this.capabilities.writeCapabilitiesToNBT(tagCompound); tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT()); -@@ -884,6 +934,7 @@ +@@ -884,6 +943,7 @@ public boolean attackEntityFrom(DamageSource source, float amount) { @@ -136,7 +162,7 @@ if (this.isEntityInvulnerable(source)) { return false; -@@ -1123,6 +1174,7 @@ +@@ -1123,6 +1183,7 @@ public void attackTargetEntityWithCurrentItem(Entity targetEntity) { @@ -144,7 +170,7 @@ if (targetEntity.canAttackWithItem()) { if (!targetEntity.hitByEntity(this)) -@@ -1410,6 +1462,8 @@ +@@ -1410,6 +1471,8 @@ public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation) { @@ -153,7 +179,7 @@ if (!this.worldObj.isRemote) { if (this.isPlayerSleeping() || !this.isEntityAlive()) -@@ -1514,13 +1568,14 @@ +@@ -1514,13 +1577,14 @@ public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn) { @@ -171,7 +197,7 @@ if (blockpos == null) { -@@ -1529,6 +1584,10 @@ +@@ -1529,6 +1593,10 @@ this.setPosition((double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.1F), (double)((float)blockpos.getZ() + 0.5F)); } @@ -182,7 +208,7 @@ this.sleeping = false; -@@ -1547,14 +1606,14 @@ +@@ -1547,14 +1615,14 @@ private boolean isInBed() { @@ -199,7 +225,7 @@ { if (!forceSpawn) { -@@ -1618,16 +1677,24 @@ +@@ -1618,16 +1686,24 @@ public BlockPos getBedLocation() { @@ -226,7 +252,7 @@ if (pos != null) { this.spawnChunk = pos; -@@ -1822,6 +1889,10 @@ +@@ -1822,6 +1898,10 @@ super.fall(distance, damageMultiplier); } @@ -237,7 +263,7 @@ } protected void resetHeight() -@@ -2009,6 +2080,10 @@ +@@ -2009,6 +2089,10 @@ this.field_181016_an = oldPlayer.field_181016_an; this.field_181017_ao = oldPlayer.field_181017_ao; this.field_181018_ap = oldPlayer.field_181018_ap; @@ -248,7 +274,7 @@ } else if (this.worldObj.getGameRules().getBoolean("keepInventory") || oldPlayer.isSpectator()) { -@@ -2129,7 +2204,7 @@ +@@ -2129,7 +2213,7 @@ public float getEyeHeight() { @@ -257,7 +283,7 @@ if (this.isPlayerSleeping()) { -@@ -2340,6 +2415,136 @@ +@@ -2340,6 +2424,136 @@ return (float)this.getEntityAttribute(SharedMonsterAttributes.field_188792_h).getAttributeValue(); } diff --git a/rejects/minecraft/net/minecraft/block/Block.java.patch.rej b/rejects/minecraft/net/minecraft/block/Block.java.patch.rej deleted file mode 100644 index d61ccd936f..0000000000 --- a/rejects/minecraft/net/minecraft/block/Block.java.patch.rej +++ /dev/null @@ -1,91 +0,0 @@ -++++ REJECTED PATCH 1 - public class Block - { - private static final ResourceLocation AIR_ID = new ResourceLocation("air"); -- public static final RegistryNamespacedDefaultedByKey blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID); -- public static final ObjectIntIdentityMap BLOCK_STATE_IDS = new ObjectIntIdentityMap(); -+ public static final RegistryNamespacedDefaultedByKey blockRegistry = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); -+ @Deprecated //Modders: DO NOT use this! Use GameRegistry -+ public static final ObjectIntIdentityMap BLOCK_STATE_IDS = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); - private CreativeTabs displayOnCreativeTab; - public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F); - public static final Block.SoundType soundTypeWood = new Block.SoundType("wood", 1.0F, 1.0F); -++++ END PATCH -++++ REJECTED PATCH 6 - public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos) - { - Block block = worldIn.getBlockState(pos).getBlock(); -- int i = worldIn.getCombinedLight(pos, block.getLightValue()); -+ int i = worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); - - if (i == 0 && block instanceof BlockSlab) - { - pos = pos.down(); - block = worldIn.getBlockState(pos).getBlock(); -- return worldIn.getCombinedLight(pos, block.getLightValue()); -+ return worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); - } - else - { -++++ END PATCH -++++ REJECTED PATCH 7 - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) - { -- return side == EnumFacing.DOWN && this.minY > 0.0D ? true : (side == EnumFacing.UP && this.maxY < 1.0D ? true : (side == EnumFacing.NORTH && this.minZ > 0.0D ? true : (side == EnumFacing.SOUTH && this.maxZ < 1.0D ? true : (side == EnumFacing.WEST && this.minX > 0.0D ? true : (side == EnumFacing.EAST && this.maxX < 1.0D ? true : !worldIn.getBlockState(pos).getBlock().isOpaqueCube()))))); -+ return side == EnumFacing.DOWN && this.minY > 0.0D ? true : (side == EnumFacing.UP && this.maxY < 1.0D ? true : (side == EnumFacing.NORTH && this.minZ > 0.0D ? true : (side == EnumFacing.SOUTH && this.maxZ < 1.0D ? true : (side == EnumFacing.WEST && this.minX > 0.0D ? true : (side == EnumFacing.EAST && this.maxX < 1.0D ? true : !worldIn.getBlockState(pos).getBlock().doesSideBlockRendering(worldIn, pos, side)))))); - } - - public boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side) -++++ END PATCH -++++ REJECTED PATCH 9 - - public float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos) - { -- float f = this.getBlockHardness(worldIn, pos); -- return f < 0.0F ? 0.0F : (!playerIn.canHarvestBlock(this) ? playerIn.getToolDigEfficiency(this) / f / 100.0F : playerIn.getToolDigEfficiency(this) / f / 30.0F); -+ return net.minecraftforge.common.ForgeHooks.blockStrength(worldIn.getBlockState(pos), playerIn, worldIn, pos); - } - - public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture) -++++ END PATCH -++++ REJECTED PATCH 13 - player.triggerAchievement(StatList.mineBlockStatArray[getIdFromBlock(this)]); - player.addExhaustion(0.025F); - -- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) -+ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) - { -+ java.util.ArrayList items = new java.util.ArrayList(); - ItemStack itemstack = this.createStackedBlock(state); - - if (itemstack != null) - { -- spawnAsEntity(worldIn, pos, itemstack); -+ items.add(itemstack); - } -+ -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); -+ for (ItemStack stack : items) -+ { -+ spawnAsEntity(worldIn, pos, stack); -+ } - } - else - { -+ harvesters.set(player); - int i = EnchantmentHelper.getFortuneModifier(player); - this.dropBlockAsItem(worldIn, pos, state, i); -+ harvesters.set(null); - } - } - -+ @Deprecated //Forge: State sensitive version - protected boolean canSilkHarvest() - { -- return this.isFullCube() && !this.isBlockContainer; -+ return this.isFullCube() && !this.hasTileEntity(silk_check_state.get()); - } - - protected ItemStack createStackedBlock(IBlockState state) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockBanner.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockBanner.java.patch.rej deleted file mode 100644 index f9e04393ab..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockBanner.java.patch.rej +++ /dev/null @@ -1,24 +0,0 @@ -++++ REJECTED PATCH 1 - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- TileEntity tileentity = worldIn.getTileEntity(pos); -- -- if (tileentity instanceof TileEntityBanner) - { -- ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor()); -- NBTTagCompound nbttagcompound = new NBTTagCompound(); -- tileentity.writeToNBT(nbttagcompound); -- nbttagcompound.removeTag("x"); -- nbttagcompound.removeTag("y"); -- nbttagcompound.removeTag("z"); -- nbttagcompound.removeTag("id"); -- itemstack.setTagInfo("BlockEntityTag", nbttagcompound); -- spawnAsEntity(worldIn, pos, itemstack); -- } -- else -- { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockBush.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockBush.java.patch.rej deleted file mode 100644 index 486e8a9c09..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockBush.java.patch.rej +++ /dev/null @@ -1,23 +0,0 @@ -++++ REJECTED PATCH 2 - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return super.canPlaceBlockAt(worldIn, pos) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ return super.canPlaceBlockAt(worldIn, pos) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); - } - - protected boolean canPlaceBlockOn(Block ground) -++++ END PATCH -++++ REJECTED PATCH 3 - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ BlockPos down = pos.down(); -+ Block soil = worldIn.getBlockState(down).getBlock(); -+ if (state.getBlock() != this) return this.canPlaceBlockOn(soil); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. -+ return soil.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, this); - } - - public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockButton.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockButton.java.patch.rej deleted file mode 100644 index c5be66b879..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockButton.java.patch.rej +++ /dev/null @@ -1,11 +0,0 @@ -++++ REJECTED PATCH 1 - - protected static boolean func_181088_a(World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_) - { -- BlockPos blockpos = p_181088_1_.offset(p_181088_2_); -- return p_181088_2_ == EnumFacing.DOWN ? World.doesBlockHaveSolidTopSurface(p_181088_0_, blockpos) : p_181088_0_.getBlockState(blockpos).getBlock().isNormalCube(); -+ return p_181088_2_ == EnumFacing.DOWN && World.doesBlockHaveSolidTopSurface(p_181088_0_, p_181088_1_.down()) ? true : p_181088_0_.isSideSolid(p_181088_1_.offset(p_181088_2_), p_181088_2_.getOpposite()); - } - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockCactus.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockCactus.java.patch.rej deleted file mode 100644 index 1ee2a7d58e..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockCactus.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 2 - } - - Block block = worldIn.getBlockState(pos.down()).getBlock(); -- return block == Blocks.cactus || block == Blocks.sand; -+ return block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this); - } - - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockChest.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockChest.java.patch.rej deleted file mode 100644 index 04c3b7337d..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockChest.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - - private boolean isBelowSolidBlock(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); -+ return worldIn.isSideSolid(pos.up(), EnumFacing.DOWN, false); - } - - private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej deleted file mode 100644 index a7266477b9..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej +++ /dev/null @@ -1,36 +0,0 @@ -++++ REJECTED PATCH 2 - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); - } - - protected Item getSeed() -++++ END PATCH -++++ REJECTED PATCH 3 - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); -- -- if (!worldIn.isRemote) -- { -- int i = ((Integer)state.getValue(AGE)).intValue(); -- -- if (i >= 7) -- { -- int j = 3 + fortune; -- -- for (int k = 0; k < j; ++k) -- { -- if (worldIn.rand.nextInt(15) <= i) -- { -- spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0)); -- } -- } -- } -- } - } - - public Item getItemDropped(IBlockState state, Random rand, int fortune) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockDeadBush.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockDeadBush.java.patch.rej deleted file mode 100644 index 4f374066a5..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockDeadBush.java.patch.rej +++ /dev/null @@ -1,23 +0,0 @@ -++++ REJECTED PATCH 2 - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) - { -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0)); -- } -- else -- { - super.harvestBlock(worldIn, player, pos, state, te); - } - } -+ -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(Blocks.deadbush))); -+ } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockDoor.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockDoor.java.patch.rej deleted file mode 100644 index 52398567de..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockDoor.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 2 - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return pos.getY() >= 255 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); -+ return pos.getY() >= worldIn.getHeight() - 1 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); - } - - public int getMobilityFlag() -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej deleted file mode 100644 index 3ee0513663..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej +++ /dev/null @@ -1,19 +0,0 @@ -++++ REJECTED PATCH 4 - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- if (worldIn.isRemote || player.getCurrentEquippedItem() == null || player.getCurrentEquippedItem().getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player)) - { - super.harvestBlock(worldIn, player, pos, state, te); - } -++++ END PATCH -++++ REJECTED PATCH 5 - else - { - player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta(); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i)); - return true; - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockFalling.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockFalling.java.patch.rej deleted file mode 100644 index 1e3ea5ded9..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockFalling.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - - public static boolean canFallInto(World worldIn, BlockPos pos) - { -+ if (worldIn.isAirBlock(pos)) return true; - Block block = worldIn.getBlockState(pos).getBlock(); - Material material = block.blockMaterial; - return block == Blocks.fire || material == Material.air || material == Material.water || material == Material.lava; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej deleted file mode 100644 index f7a3c601f9..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej +++ /dev/null @@ -1,98 +0,0 @@ -++++ REJECTED PATCH 1 - int j = pos.getY(); - int k = pos.getZ(); - -- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) -+ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) - { - boolean flag = (i + j + k & 1) == 1; - boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1; - int l = 0; - -- if (this.canCatchFire(worldIn, pos.up())) -+ if (this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) - { - l = flag ? 1 : 2; - } - -- return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west()))).withProperty(UPPER, Integer.valueOf(l)).withProperty(FLIP, Boolean.valueOf(flag1)).withProperty(ALT, Boolean.valueOf(flag)); -+ return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH))) -+ .withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east(), EnumFacing.EAST ))) -+ .withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH))) -+ .withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST ))) -+ .withProperty(UPPER, Integer.valueOf(l)) -+ .withProperty(FLIP, Boolean.valueOf(flag1)) -+ .withProperty(ALT, Boolean.valueOf(flag)); - } - else - { -++++ END PATCH -++++ REJECTED PATCH 3 - } - - Block block = worldIn.getBlockState(pos.down()).getBlock(); -- boolean flag = block == Blocks.netherrack; -+ boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP); - -- if (worldIn.provider instanceof WorldProviderEnd && block == Blocks.bedrock) -- { -- flag = true; -- } -- - if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos)) - { - worldIn.setBlockToAir(pos); -++++ END PATCH -++++ REJECTED PATCH 10 - worldIn.playSound((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false); - } - -- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) -+ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) - { -- if (Blocks.fire.canCatchFire(worldIn, pos.west())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.west(), EnumFacing.EAST)) - { - for (int j = 0; j < 2; ++j) - { -++++ END PATCH -++++ REJECTED PATCH 11 - } - } - -- if (Blocks.fire.canCatchFire(worldIn, pos.east())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.east(), EnumFacing.WEST)) - { - for (int k = 0; k < 2; ++k) - { -++++ END PATCH -++++ REJECTED PATCH 12 - } - } - -- if (Blocks.fire.canCatchFire(worldIn, pos.north())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH)) - { - for (int l = 0; l < 2; ++l) - { -++++ END PATCH -++++ REJECTED PATCH 13 - } - } - -- if (Blocks.fire.canCatchFire(worldIn, pos.south())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH)) - { - for (int i1 = 0; i1 < 2; ++i1) - { -++++ END PATCH -++++ REJECTED PATCH 14 - } - } - -- if (Blocks.fire.canCatchFire(worldIn, pos.up())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) - { - for (int j1 = 0; j1 < 2; ++j1) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej deleted file mode 100644 index 279e147efb..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej +++ /dev/null @@ -1,20 +0,0 @@ -++++ REJECTED PATCH 1 - { - if (!worldIn.isRemote) - { -- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) -+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) - { - worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); - } -++++ END PATCH -++++ REJECTED PATCH 2 - Block block = worldIn.getBlockState(blockpos.up()).getBlock(); - IBlockState iblockstate = worldIn.getBlockState(blockpos); - -- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) -+ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2) - { - worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState()); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockIce.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockIce.java.patch.rej deleted file mode 100644 index f817b3e8d2..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockIce.java.patch.rej +++ /dev/null @@ -1,35 +0,0 @@ -++++ REJECTED PATCH 1 - player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); - player.addExhaustion(0.025F); - -- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) -+ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) - { -+ java.util.List items = new java.util.ArrayList(); - ItemStack itemstack = this.createStackedBlock(state); - -- if (itemstack != null) -- { -- spawnAsEntity(worldIn, pos, itemstack); -- } -+ if (itemstack != null) items.add(itemstack); -+ -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); -+ -+ for (ItemStack is : items) -+ spawnAsEntity(worldIn, pos, is); - } - else - { -++++ END PATCH -++++ REJECTED PATCH 2 - } - - int i = EnchantmentHelper.getFortuneModifier(player); -+ harvesters.set(player); - this.dropBlockAsItem(worldIn, pos, state, i); -+ harvesters.set(null); - Material material = worldIn.getBlockState(pos.down()).getBlock().getMaterial(); - - if (material.blocksMovement() || material.isLiquid()) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej deleted file mode 100644 index 505d3e36f3..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej +++ /dev/null @@ -1,23 +0,0 @@ -++++ REJECTED PATCH 1 - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos.west()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.east()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.north()).getBlock().isNormalCube() ? true : worldIn.getBlockState(pos.south()).getBlock().isNormalCube())); -+ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST, true) || -+ worldIn.isSideSolid(pos.east(), EnumFacing.WEST, true) || -+ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH, true) || -+ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH, true); - } - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) -++++ END PATCH -++++ REJECTED PATCH 2 - - protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing) - { -- return worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock().isNormalCube(); -+ return worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing, true); - } - - public IBlockState getStateFromMeta(int meta) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej deleted file mode 100644 index a5f1a72c8b..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej +++ /dev/null @@ -1,36 +0,0 @@ -++++ REJECTED PATCH 1 - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public abstract class BlockLeaves extends BlockLeavesBase -+public abstract class BlockLeaves extends BlockLeavesBase implements net.minecraftforge.common.IShearable - { - public static final PropertyBool DECAYABLE = PropertyBool.create("decayable"); - public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay"); -++++ END PATCH -++++ REJECTED PATCH 2 - BlockPos blockpos = pos.add(j1, k1, l1); - IBlockState iblockstate = worldIn.getBlockState(blockpos); - -- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(CHECK_DECAY)).booleanValue()) -+ if (iblockstate.getBlock().isLeaves(worldIn, blockpos)) - { -- worldIn.setBlockState(blockpos, iblockstate.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4); -+ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos); - } - } - } -++++ END PATCH -++++ REJECTED PATCH 3 - { - Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2)).getBlock(); - -- if (block != Blocks.log && block != Blocks.log2) -+ if (!block.canSustainLeaves(worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2))) - { -- if (block.getMaterial() == Material.leaves) -+ if (block.isLeaves(worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2))) - { - this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2; - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej deleted file mode 100644 index b6f0ea738f..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej +++ /dev/null @@ -1,13 +0,0 @@ -++++ REJECTED PATCH 1 - { - IBlockState iblockstate = worldIn.getBlockState(blockpos); - -- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(BlockLeaves.CHECK_DECAY)).booleanValue()) -+ if (iblockstate.getBlock().isLeaves(worldIn, blockpos)) - { -- worldIn.setBlockState(blockpos, iblockstate.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4); -+ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos); - } - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockNetherWart.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockNetherWart.java.patch.rej deleted file mode 100644 index 21e6728f20..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockNetherWart.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ return super.canBlockStay(worldIn, pos, state); - } - - public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockNewLeaf.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockNewLeaf.java.patch.rej deleted file mode 100644 index 5718e98e1f..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockNewLeaf.java.patch.rej +++ /dev/null @@ -1,23 +0,0 @@ -++++ REJECTED PATCH 1 - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) - { -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4)); -- } -- else -- { - super.harvestBlock(worldIn, player, pos, state, te); - } - } -+ -+ @Override -+ public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ IBlockState state = world.getBlockState(pos); -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4))); -+ } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockOldLeaf.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockOldLeaf.java.patch.rej deleted file mode 100644 index 3b338ffd49..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockOldLeaf.java.patch.rej +++ /dev/null @@ -1,20 +0,0 @@ -++++ REJECTED PATCH 1 - if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) - { - player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata())); - } - else - { - super.harvestBlock(worldIn, player, pos, state, te); - } - } -+ -+ @Override -+ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) -+ { -+ IBlockState state = world.getBlockState(pos); -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata()))); -+ } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockPane.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockPane.java.patch.rej deleted file mode 100644 index d8053e475a..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockPane.java.patch.rej +++ /dev/null @@ -1,16 +0,0 @@ -++++ REJECTED PATCH 2 - - public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) - { -- boolean flag = this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()); -- boolean flag1 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()); -- boolean flag2 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()); -- boolean flag3 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()); -+ boolean flag = this.canPaneConnectTo(worldIn, pos, EnumFacing.NORTH); -+ boolean flag1 = this.canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH); -+ boolean flag2 = this.canPaneConnectTo(worldIn, pos, EnumFacing.WEST); -+ boolean flag3 = this.canPaneConnectTo(worldIn, pos, EnumFacing.EAST); - - if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej deleted file mode 100644 index fa4f50663f..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej +++ /dev/null @@ -1,32 +0,0 @@ -++++ REJECTED PATCH 1 - } - } - -- if (!flag1 && block.getMaterial() != Material.air && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) -+ if (!flag1 && !block.isAir(worldIn, blockpos) && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) - { - this.doMove(worldIn, pos, enumfacing, false); - } -++++ END PATCH -++++ REJECTED PATCH 2 - return false; - } - -- return !(blockIn instanceof ITileEntityProvider); -+ return !(blockIn.hasTileEntity(worldIn.getBlockState(pos))); - } - else - { -++++ END PATCH -++++ REJECTED PATCH 3 - { - BlockPos blockpos = (BlockPos)list1.get(j); - Block block = worldIn.getBlockState(blockpos).getBlock(); -- block.dropBlockAsItem(worldIn, blockpos, worldIn.getBlockState(blockpos), 0); -+ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. -+ float chance = block instanceof BlockSnow ? -1.0f : 1.0f; -+ block.dropBlockAsItemWithChance(worldIn, blockpos, worldIn.getBlockState(blockpos), chance, 0); - worldIn.setBlockToAir(blockpos); - --i; - ablock[i] = block; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej deleted file mode 100644 index 7d2e63e434..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej +++ /dev/null @@ -1,19 +0,0 @@ -++++ REJECTED PATCH 1 - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- if (!worldIn.isRemote) -- { -- TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); -- -- if (tileentitypiston != null) -- { -- IBlockState iblockstate = tileentitypiston.getPistonState(); -- iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0); -- } -- } -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); - } - - public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockPotato.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockPotato.java.patch.rej deleted file mode 100644 index 2296b2add8..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockPotato.java.patch.rej +++ /dev/null @@ -1,24 +0,0 @@ -++++ REJECTED PATCH 1 - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -- -- if (!worldIn.isRemote) -- { -- if (((Integer)state.getValue(AGE)).intValue() >= 7 && worldIn.rand.nextInt(50) == 0) -- { -- spawnAsEntity(worldIn, pos, new ItemStack(Items.poisonous_potato)); -- } -- } - } -+ @Override -+ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = super.getDrops(world, pos, state, fortune); -+ java.util.Random rand = world instanceof World ? ((World)world).rand : new java.util.Random(); -+ if (((Integer)state.getValue(AGE)) >= 7 && rand.nextInt(50) == 0) -+ ret.add(new ItemStack(Items.poisonous_potato)); -+ return ret; -+ } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockPumpkin.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockPumpkin.java.patch.rej deleted file mode 100644 index 8680c643dc..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockPumpkin.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); -+ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); - } - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej deleted file mode 100644 index 3163ebffd9..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej +++ /dev/null @@ -1,11 +0,0 @@ -++++ REJECTED PATCH 4 - this.state = state; - this.block = (BlockRailBase)state.getBlock(); - BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(BlockRailBase.this.getShapeProperty()); -- this.isPowered = this.block.isPowered; -+ this.isPowered = !this.block.isFlexibleRail(worldIn, pos); -+ canMakeSlopes = this.block.canMakeSlopes(worldIn, pos); - this.func_180360_a(blockrailbase$enumraildirection); - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej deleted file mode 100644 index e415ab709c..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej +++ /dev/null @@ -1,59 +0,0 @@ -++++ REJECTED PATCH 1 - BlockPos blockpos = pos.offset(direction); - Block block = worldIn.getBlockState(pos.offset(direction)).getBlock(); - -- if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (block.isBlockNormalCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down())))) -+ if (!canRestoneConnect(worldIn, blockpos, direction) && (block.isBlockNormalCube() || !canRestoneConnect(worldIn, blockpos.down(), null))) - { - Block block1 = worldIn.getBlockState(pos.up()).getBlock(); -- return !block1.isBlockNormalCube() && block.isBlockNormalCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; -+ return !block1.isBlockNormalCube() && block.isBlockNormalCube() && canRestoneConnect(worldIn, blockpos.up(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; - } - else - { -++++ END PATCH -++++ REJECTED PATCH 2 - Block block = iblockstate.getBlock(); - boolean flag = block.isNormalCube(); - boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); -- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down()))); -+ return !flag1 && flag && canRestoneConnect(worldIn, blockpos.up(), null) ? true : (canRestoneConnect(worldIn, blockpos, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canRestoneConnect(worldIn, blockpos.down(), null))); - } - -- protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos) -+ protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side) - { -- return canConnectUpwardsTo(worldIn.getBlockState(pos)); -- } -- -- protected static boolean canConnectUpwardsTo(IBlockState state) -- { -- return canConnectTo(state, (EnumFacing)null); -- } -- -- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) -- { -- Block block = blockState.getBlock(); -- -- if (block == Blocks.redstone_wire) -+ IBlockState state = world.getBlockState(pos); -+ if (state.getBlock() == Blocks.redstone_wire) - { - return true; - } -- else if (Blocks.unpowered_repeater.isAssociated(block)) -+ else if (Blocks.unpowered_repeater.isAssociated(state.getBlock())) - { -- EnumFacing enumfacing = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING); -- return enumfacing == side || enumfacing.getOpposite() == side; -+ EnumFacing direction = (EnumFacing)state.getValue(BlockRedstoneRepeater.FACING); -+ return direction == side || direction.getOpposite() == side; - } - else - { -- return block.canProvidePower() && side != null; -+ return state.getBlock().canConnectRedstone(world, pos, side); - } - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej deleted file mode 100644 index 25769e9b82..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 3 - if (tileentity instanceof TileEntitySkull) - { - TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; -- ItemStack itemstack = new ItemStack(Items.skull, 1, this.getDamageValue(worldIn, pos)); -+ ItemStack itemstack = new ItemStack(Items.skull, 1, tileentityskull.getSkullType()); - - if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockSlab.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockSlab.java.patch.rej deleted file mode 100644 index bd8488f6da..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockSlab.java.patch.rej +++ /dev/null @@ -1,19 +0,0 @@ -++++ REJECTED PATCH 2 - { - return false; - } -- else -- { -- BlockPos blockpos = pos.offset(side.getOpposite()); -- IBlockState iblockstate = worldIn.getBlockState(pos); -- IBlockState iblockstate1 = worldIn.getBlockState(blockpos); -- boolean flag = isSlab(iblockstate.getBlock()) && iblockstate.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP; -- boolean flag1 = isSlab(iblockstate1.getBlock()) && iblockstate1.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP; -- return flag1 ? (side == EnumFacing.DOWN ? true : (side == EnumFacing.UP && super.shouldSideBeRendered(worldIn, pos, side) ? true : !isSlab(iblockstate.getBlock()) || !flag)) : (side == EnumFacing.UP ? true : (side == EnumFacing.DOWN && super.shouldSideBeRendered(worldIn, pos, side) ? true : !isSlab(iblockstate.getBlock()) || flag)); -- } -+ // additional logic breaks doesSideBlockRendering and is no longer useful. -+ return super.shouldSideBeRendered(worldIn, pos, side); - } - - @SideOnly(Side.CLIENT) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej deleted file mode 100644 index d0fbe7d500..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej +++ /dev/null @@ -1,22 +0,0 @@ -++++ REJECTED PATCH 1 - { - IBlockState iblockstate = worldIn.getBlockState(pos.down()); - Block block = iblockstate.getBlock(); -- return block != Blocks.ice && block != Blocks.packed_ice ? (block.getMaterial() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; -+ return block != Blocks.ice && block != Blocks.packed_ice ? (block.isLeaves(worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; - } - - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) -++++ END PATCH -++++ REJECTED PATCH 3 - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0)); -+ super.harvestBlock(worldIn, player, pos, state, te); - worldIn.setBlockToAir(pos); -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); - } - - public Item getItemDropped(IBlockState state, Random rand, int fortune) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockStairs.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockStairs.java.patch.rej deleted file mode 100644 index 22661f610d..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockStairs.java.patch.rej +++ /dev/null @@ -1,21 +0,0 @@ -++++ REJECTED PATCH 1 - return false; - } - -+ @Override -+ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ if ( isOpaqueCube() ) -+ return true; -+ -+ // face is on the block being rendered, not this block. -+ IBlockState iblockstate = world.getBlockState(pos); -+ EnumHalf half = iblockstate.getValue(HALF); -+ EnumFacing side = iblockstate.getValue(FACING); -+ return side == face.getOpposite() || (half == EnumHalf.TOP && face == EnumFacing.DOWN) || (half == EnumHalf.BOTTOM && face == EnumFacing.UP); -+ } -+ - public boolean isFullCube() - { - return false; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockTallGrass.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockTallGrass.java.patch.rej deleted file mode 100644 index cd154744a2..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockTallGrass.java.patch.rej +++ /dev/null @@ -1,25 +0,0 @@ -++++ REJECTED PATCH 2 - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ return super.canBlockStay(worldIn, pos, state); - } - - public boolean isReplaceable(World worldIn, BlockPos pos) -++++ END PATCH -++++ REJECTED PATCH 4 - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) - { -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta())); -- } -- else -- { - super.harvestBlock(worldIn, player, pos, state, te); - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej deleted file mode 100644 index 1039e160fd..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej +++ /dev/null @@ -1,45 +0,0 @@ -++++ REJECTED PATCH 1 - - public class BlockTrapDoor extends Block - { -+ /** Set this to allow trapdoors to remain free-floating */ -+ public static boolean disableValidation = false; - public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); - public static final PropertyBool OPEN = PropertyBool.create("open"); - public static final PropertyEnum HALF = PropertyEnum.create("half", BlockTrapDoor.DoorHalf.class); -++++ END PATCH -++++ REJECTED PATCH 2 - { - if (!worldIn.isRemote) - { -+ EnumFacing direction = (EnumFacing)state.getValue(FACING); - BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()); - -- if (!isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock())) -+ if (!(isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock()) || worldIn.isSideSolid(blockpos, direction, true))) - { - worldIn.setBlockToAir(pos); - this.dropBlockAsItem(worldIn, pos, state, 0); -++++ END PATCH -++++ REJECTED PATCH 3 - - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) - { -- return !side.getAxis().isVertical() && isValidSupportBlock(worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock()); -+ if (disableValidation) return true; -+ EnumFacing dir = side.getOpposite(); -+ pos = pos.offset(dir); -+ return !side.getAxis().isVertical() && (isValidSupportBlock(worldIn.getBlockState(pos).getBlock()) || worldIn.isSideSolid(pos, side, true)); - } - - protected static EnumFacing getFacing(int meta) -++++ END PATCH -++++ REJECTED PATCH 4 - - private static boolean isValidSupportBlock(Block blockIn) - { -+ if (disableValidation) return true; - return blockIn.blockMaterial.isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs; - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej deleted file mode 100644 index 1b124a1470..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej +++ /dev/null @@ -1,28 +0,0 @@ -++++ REJECTED PATCH 1 - - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) - { -- return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock().isNormalCube(); -+ return side.getAxis().isHorizontal() && worldIn.isSideSolid(pos.offset(side.getOpposite()), side, true); - } - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { - for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) - { -- if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube()) -+ if (worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true)) - { - return true; - } -++++ END PATCH -++++ REJECTED PATCH 2 - { - EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); - -- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock().isNormalCube()) -+ if (!worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) - { - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej deleted file mode 100644 index 64904484b1..0000000000 --- a/rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej +++ /dev/null @@ -1,15 +0,0 @@ -++++ REJECTED PATCH 2 - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) - { -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0)); -- } -- else -- { - super.harvestBlock(worldIn, player, pos, state, te); - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej b/rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej deleted file mode 100644 index 2d1af6e92b..0000000000 --- a/rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej +++ /dev/null @@ -1,30 +0,0 @@ -++++ REJECTED PATCH 1 - { - Block block = this.world.getBlockState(origin).getBlock(); - -- if (block.getMaterial() == Material.air) -+ if (block.isAir(world, origin)) - { - return true; - } -++++ END PATCH -++++ REJECTED PATCH 2 - BlockPos blockpos = origin.offset(this.moveDirection.getOpposite(), i); - block = this.world.getBlockState(blockpos).getBlock(); - -- if (block.getMaterial() == Material.air || !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) -+ if (block.isAir(world, blockpos)|| !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) - { - break; - } -++++ END PATCH -++++ REJECTED PATCH 3 - - block = this.world.getBlockState(blockpos1).getBlock(); - -- if (block.getMaterial() == Material.air) -+ if (block.isAir(world, blockpos1)) - { - return true; - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej b/rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej deleted file mode 100644 index ae09ac8ee3..0000000000 --- a/rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej +++ /dev/null @@ -1,55 +0,0 @@ -++++ REJECTED PATCH 1 - - public BlockState(Block blockIn, IProperty... properties) - { -+ this(blockIn, properties, null); -+ } -+ -+ protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) -+ { -+ return new StateImplementation(block, properties); -+ } -+ -+ protected BlockState(Block blockIn, IProperty[] properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) -+ { - this.block = blockIn; - Arrays.sort(properties, new Comparator() - { -++++ END PATCH -++++ REJECTED PATCH 2 - for (List list1 : Cartesian.cartesianProduct(this.getAllowedValues())) - { - Map map1 = MapPopulator.createMap(this.properties, list1); -- BlockState.StateImplementation blockstate$stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map1)); -+ BlockState.StateImplementation blockstate$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map1), unlistedProperties); - map.put(map1, blockstate$stateimplementation); - list.add(blockstate$stateimplementation); - } -++++ END PATCH -++++ REJECTED PATCH 3 - } - } - -+ protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable) -+ { -+ this.block = blockIn; -+ this.properties = propertiesIn; -+ this.propertyValueTable = propertyValueTable; -+ } -+ - public , V extends T> IBlockState withProperty(IProperty property, V value) - { - if (!this.properties.containsKey(property)) -++++ END PATCH -++++ REJECTED PATCH 4 - map.put(property, value); - return map; - } -+ -+ public ImmutableTable getPropertyValueTable() -+ { -+ return propertyValueTable; -+ } - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch.rej b/rejects/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch.rej index 2984065a90..ccf686cf35 100644 --- a/rejects/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch.rej +++ b/rejects/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch.rej @@ -68,34 +68,6 @@ } } ++++ END PATCH -++++ REJECTED PATCH 13 - - public void joinEntityItemWithWorld(EntityItem itemIn) - { -+ if (captureDrops) -+ { -+ capturedDrops.add(itemIn); -+ return; -+ } -+ - this.worldObj.spawnEntityInWorld(itemIn); - } - -+ @Deprecated //Use location sensitive version below - public float getToolDigEfficiency(Block p_180471_1_) - { -- float f = this.inventory.getStrVsBlock(p_180471_1_); -+ return getBreakSpeed(p_180471_1_.getDefaultState(), new BlockPos(0, -1, 0)); -+ } - -+ public float getBreakSpeed(IBlockState state, BlockPos pos) -+ { -+ ItemStack stack = inventory.getCurrentItem(); -+ float f = (stack == null ? 1.0F : stack.getItem().getDigSpeed(stack, state)); - if (f > 1.0F) - { - int i = EnchantmentHelper.getEfficiencyModifier(this); -++++ END PATCH ++++ REJECTED PATCH 14 f /= 5.0F; } diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 398ef3ee9d..fc6fb725a7 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -29,7 +29,6 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityMinecartContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.event.ClickEvent; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.Container; @@ -49,23 +48,13 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagString; import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S23PacketBlockChange; import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityNote; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.DamageSource; -import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumFacing; -import net.minecraft.util.IChatComponent; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.MovingObjectPosition.MovingObjectType; -import net.minecraft.util.Vec3; import net.minecraft.util.WeightedRandom; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraft.world.WorldSettings; @@ -157,7 +146,7 @@ public class ForgeHooks public static float blockStrength(IBlockState state, EntityPlayer player, World world, BlockPos pos) { - float hardness = state.getBlock().getBlockHardness(world, pos); + float hardness = state.func_185887_b(world, pos); if (hardness < 0.0F) { return 0.0F; diff --git a/src/main/java/net/minecraftforge/common/IPlantable.java b/src/main/java/net/minecraftforge/common/IPlantable.java index d3e40d451d..e8bfabbfba 100644 --- a/src/main/java/net/minecraftforge/common/IPlantable.java +++ b/src/main/java/net/minecraftforge/common/IPlantable.java @@ -1,7 +1,7 @@ package net.minecraftforge.common; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; public interface IPlantable diff --git a/src/main/java/net/minecraftforge/common/IShearable.java b/src/main/java/net/minecraftforge/common/IShearable.java index acd0be858d..429ed9ed58 100644 --- a/src/main/java/net/minecraftforge/common/IShearable.java +++ b/src/main/java/net/minecraftforge/common/IShearable.java @@ -3,7 +3,7 @@ package net.minecraftforge.common; import java.util.List; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; /** diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index 46d6f1acb6..ba9ed21da2 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -19,12 +19,9 @@ import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumFacing; -import net.minecraft.util.IChatComponent; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.Explosion; import net.minecraft.world.World; import net.minecraft.world.WorldServer; diff --git a/src/main/java/net/minecraftforge/event/terraingen/DecorateBiomeEvent.java b/src/main/java/net/minecraftforge/event/terraingen/DecorateBiomeEvent.java index 1e6f0a1cf7..f284e21e35 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/DecorateBiomeEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/DecorateBiomeEvent.java @@ -3,7 +3,7 @@ package net.minecraftforge.event.terraingen; import java.util.Random; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.common.eventhandler.Event.HasResult; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /**DecorateBiomeEvent is fired when a BiomeDecorator is created. diff --git a/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java b/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java index de737b9048..32b6d5c4c7 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java @@ -3,7 +3,7 @@ package net.minecraftforge.event.terraingen; import java.util.Random; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.common.eventhandler.Event.HasResult; -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/net/minecraftforge/event/terraingen/SaplingGrowTreeEvent.java b/src/main/java/net/minecraftforge/event/terraingen/SaplingGrowTreeEvent.java index 5e95749354..af7b458d6b 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/SaplingGrowTreeEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/SaplingGrowTreeEvent.java @@ -2,7 +2,7 @@ package net.minecraftforge.event.terraingen; import java.util.Random; import net.minecraftforge.fml.common.eventhandler.Event.HasResult; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.event.world.WorldEvent; diff --git a/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java b/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java index 881cc63a70..9ca4e97b4d 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java +++ b/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java @@ -2,7 +2,7 @@ package net.minecraftforge.event.terraingen; import java.util.Random; import net.minecraftforge.fml.common.eventhandler.Event.*; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.MapGenBase; diff --git a/src/main/java/net/minecraftforge/event/world/BlockEvent.java b/src/main/java/net/minecraftforge/event/world/BlockEvent.java index bd33fe17db..9ad5a61ebc 100644 --- a/src/main/java/net/minecraftforge/event/world/BlockEvent.java +++ b/src/main/java/net/minecraftforge/event/world/BlockEvent.java @@ -7,7 +7,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.enchantment.EnchantmentHelper; 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.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; @@ -177,29 +177,29 @@ public class BlockEvent extends Event return blockSnapshots; } } - + /** * Fired when a physics update occurs on a block. This event acts as * a way for mods to detect physics updates, in the same way a BUD switch * does. This event is only called on the server. */ @Cancelable - public static class NeighborNotifyEvent extends BlockEvent + public static class NeighborNotifyEvent extends BlockEvent { private final EnumSet notifiedSides; - + public NeighborNotifyEvent(World world, BlockPos pos, IBlockState state, EnumSet notifiedSides) { super(world, pos, state); this.notifiedSides = notifiedSides; } - + /** * Gets a list of directions from the base block that updates will occur upon. - * + * * @return list of notified directions */ - public EnumSet getNotifiedSides() + public EnumSet getNotifiedSides() { return notifiedSides; } diff --git a/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java b/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java index 5df225e85d..3253f8a53e 100644 --- a/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java +++ b/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java @@ -5,7 +5,7 @@ import com.google.common.base.Preconditions; import net.minecraft.block.Block; 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.minecraftforge.event.world.BlockEvent; import net.minecraftforge.fml.common.eventhandler.Cancelable; diff --git a/src/main/java/net/minecraftforge/items/VanillaInventoryCodeHooks.java b/src/main/java/net/minecraftforge/items/VanillaInventoryCodeHooks.java index 2f35e9b83f..d49bf6f9c2 100644 --- a/src/main/java/net/minecraftforge/items/VanillaInventoryCodeHooks.java +++ b/src/main/java/net/minecraftforge/items/VanillaInventoryCodeHooks.java @@ -7,7 +7,7 @@ import net.minecraft.tileentity.IHopper; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityDispenser; import net.minecraft.tileentity.TileEntityHopper; -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/resources/forge.exc b/src/main/resources/forge.exc index 26194f107c..f1a87873ae 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -43,3 +43,5 @@ net/minecraft/item/ItemMonsterPlacer.spawnCreature(Lnet/minecraft/world/World;Lj net/minecraft/stats/StatList.mergeStatBases([Lnet/minecraft/stats/StatBase;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Z)V=|p_151180_0_,p_151180_1_,p_151180_2_,useItemIds net/minecraft/item/ItemStack.(Lnet/minecraft/item/Item;IILnet/minecraft/nbt/NBTTagCompound;)V=|p_i1881_1_,p_i1881_2_,p_i1881_3_,capNBT + +net/minecraft/block/BlockRedstoneWire.canConnectTo(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/EnumFacing;Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;)Z=p_176343_0_,p_176343_1_,world,pos From 1f80eb17dfd656e13b30b813c044846d7c05fb95 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 1 Mar 2016 04:07:00 -0800 Subject: [PATCH 006/243] util, tileentity, stats, realms. Potions got an overhaul and out registry will need to be adapted. --- .../minecraft/realms/RealmsConnect.java.patch | 9 +++ .../net/minecraft/stats/StatList.java.patch | 27 ++++++++ .../tileentity/TileEntity.java.patch | 55 ++++++++++++--- .../TileEntityBrewingStand.java.patch | 60 +++++++++++++++-- .../util/BlockRenderLayer.java.patch | 7 +- .../net/minecraft/util/EnumFacing.java.patch | 23 +++++-- .../net/minecraft/util/Session.java.patch | 18 ++++- .../WeightedRandomChestContent.java.patch | 32 +++++++++ .../minecraft/util/math/BlockPos.java.patch | 21 ++++-- .../util/math/RayTraceResult.java.patch | 15 +++++ .../net/minecraft/util/math/Vec3d.java.patch | 19 ++++++ .../util/text/ITextComponent.java.patch | 10 +++ .../net/minecraft/util/text/Style.java.patch | 10 +++ .../util/text/TextComponentBase.java.patch | 5 +- .../text/translation/LanguageMap.java.patch | 28 ++++---- .../realms/RealmsConnect.java.patch.rej | 10 --- .../minecraft/stats/StatList.java.patch.rej | 20 ------ .../tileentity/TileEntity.java.patch.rej | 32 --------- .../TileEntityBrewingStand.java.patch.rej | 63 ----------------- .../minecraft/util/ChatStyle.java.patch.rej | 9 --- .../minecraft/util/EnumFacing.java.patch.rej | 10 --- .../util/IChatComponent.java.patch.rej | 9 --- .../util/MovingObjectPosition.java.patch.rej | 14 ---- .../util/ResourceLocation.java.patch.rej | 27 -------- .../net/minecraft/util/Session.java.patch.rej | 21 ------ .../net/minecraft/util/Vec3.java.patch.rej | 37 ---------- .../WeightedRandomChestContent.java.patch.rej | 67 ------------------- .../common/brewing/VanillaBrewingRecipe.java | 40 +++-------- .../fml/common/registry/LanguageRegistry.java | 12 ++-- 29 files changed, 303 insertions(+), 407 deletions(-) rename rejects/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch.rej => patches.mcp/minecraft/net/minecraft/util/BlockRenderLayer.java.patch (50%) create mode 100644 patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch rename rejects/minecraft/net/minecraft/util/BlockPos.java.patch.rej => patches.mcp/minecraft/net/minecraft/util/math/BlockPos.java.patch (54%) create mode 100644 patches.mcp/minecraft/net/minecraft/util/math/RayTraceResult.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/math/Vec3d.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/text/ITextComponent.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/text/Style.java.patch rename rejects/minecraft/net/minecraft/util/ChatComponentStyle.java.patch.rej => patches.mcp/minecraft/net/minecraft/util/text/TextComponentBase.java.patch (53%) rename rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej => patches.mcp/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch (59%) delete mode 100644 rejects/minecraft/net/minecraft/realms/RealmsConnect.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/util/ChatStyle.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/util/IChatComponent.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/util/MovingObjectPosition.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/util/ResourceLocation.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/util/Session.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/util/Vec3.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch b/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch index 43111345ac..8fa2dc50d6 100644 --- a/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch +++ b/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch @@ -8,3 +8,12 @@ inetaddress = InetAddress.getByName(p_connect_1_); if (RealmsConnect.this.aborted) +@@ -59,7 +60,7 @@ + return; + } + +- RealmsConnect.this.connection.sendPacket(new C00Handshake(107, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); ++ RealmsConnect.this.connection.sendPacket(new C00Handshake(107, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true)); + + if (RealmsConnect.this.aborted) + { diff --git a/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch b/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch index 07dbb29fe2..e925f22b96 100644 --- a/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch +++ b/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch @@ -1,5 +1,23 @@ --- ../src-base/minecraft/net/minecraft/stats/StatList.java +++ ../src-work/minecraft/net/minecraft/stats/StatList.java +@@ -155,7 +155,7 @@ + } + } + +- replaceAllSimilarBlocks(field_188066_af); ++ replaceAllSimilarBlocks(field_188066_af, true); + } + + private static void initMiningStats() +@@ -177,7 +177,7 @@ + } + } + +- replaceAllSimilarBlocks(field_188065_ae); ++ replaceAllSimilarBlocks(field_188065_ae, false); + } + + private static void initStats() @@ -201,7 +201,7 @@ } } @@ -9,6 +27,15 @@ } private static void initItemDepleteStats() +@@ -220,7 +220,7 @@ + } + } + +- replaceAllSimilarBlocks(objectBreakStats); ++ replaceAllSimilarBlocks(objectBreakStats, true); + } + + private static void func_188054_f() @@ -240,7 +240,7 @@ } } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch index 61a5ea7079..2f9115e8de 100644 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -27,7 +27,40 @@ } } -@@ -144,7 +148,6 @@ +@@ -83,10 +87,11 @@ + { + TileEntity tileentity = null; + String s = p_184246_1_.getString("id"); ++ Class oclass = null; + + try + { +- Class oclass = (Class)nameToClassMap.get(s); ++ oclass = (Class)nameToClassMap.get(s); + + if (oclass != null) + { +@@ -96,6 +101,9 @@ + catch (Throwable throwable1) + { + logger.error("Failed to create block entity " + s, throwable1); ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, throwable1, ++ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", ++ s, oclass.getName()); + } + + if (tileentity != null) +@@ -107,6 +115,9 @@ + catch (Throwable throwable) + { + logger.error("Failed to load data for block entity " + s, throwable); ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, throwable, ++ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", ++ s, oclass.getName()); + tileentity = null; + } + } +@@ -144,7 +155,6 @@ } } @@ -35,7 +68,7 @@ public double getDistanceSq(double x, double y, double z) { double d0 = (double)this.pos.getX() + 0.5D - x; -@@ -271,6 +274,185 @@ +@@ -271,6 +281,185 @@ return false; } @@ -49,7 +82,7 @@ + * @param net The NetworkManager the packet originated from + * @param pkt The data packet + */ -+ public void onDataPacket(net.minecraft.network.NetworkManager net, net.minecraft.network.play.server.S35PacketUpdateTileEntity pkt) ++ public void onDataPacket(net.minecraft.network.NetworkManager net, net.minecraft.network.play.server.SPacketUpdateTileEntity pkt) + { + } + @@ -84,7 +117,7 @@ + /** + * Sometimes default render bounding box: infinite in scope. Used to control rendering on {@link TileEntitySpecialRenderer}. + */ -+ public static final net.minecraft.util.AxisAlignedBB INFINITE_EXTENT_AABB = new net.minecraft.util.AxisAlignedBB(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); ++ public static final net.minecraft.util.math.AxisAlignedBB INFINITE_EXTENT_AABB = new net.minecraft.util.math.AxisAlignedBB(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); + /** + * Return an {@link AxisAlignedBB} that controls the visible scope of a {@link TileEntitySpecialRenderer} associated with this {@link TileEntity} + * Defaults to the collision bounding box {@link Block#getCollisionBoundingBoxFromPool(World, int, int, int)} associated with the block @@ -93,24 +126,24 @@ + * @return an appropriately size {@link AxisAlignedBB} for the {@link TileEntity} + */ + @SideOnly(Side.CLIENT) -+ public net.minecraft.util.AxisAlignedBB getRenderBoundingBox() ++ public net.minecraft.util.math.AxisAlignedBB getRenderBoundingBox() + { -+ net.minecraft.util.AxisAlignedBB bb = INFINITE_EXTENT_AABB; ++ net.minecraft.util.math.AxisAlignedBB bb = INFINITE_EXTENT_AABB; + Block type = getBlockType(); + if (type == Blocks.enchanting_table) + { -+ bb = new net.minecraft.util.AxisAlignedBB(getPos(), getPos().add(1, 1, 1)); ++ bb = new net.minecraft.util.math.AxisAlignedBB(getPos(), getPos().add(1, 1, 1)); + } + else if (type == Blocks.chest || type == Blocks.trapped_chest) + { -+ bb = new net.minecraft.util.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(2, 2, 2)); ++ bb = new net.minecraft.util.math.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(2, 2, 2)); + } + else if (type != null && type != Blocks.beacon) + { -+ net.minecraft.util.AxisAlignedBB cbb = null; ++ net.minecraft.util.math.AxisAlignedBB cbb = null; + try + { -+ cbb = type.getCollisionBoundingBox(worldObj, getPos(), worldObj.getBlockState(getPos())); ++ cbb = worldObj.getBlockState(getPos()).func_185890_d(worldObj, getPos()); + } + catch (Exception e) + { @@ -120,7 +153,7 @@ + // So, once again in the long line of US having to accommodate BUKKIT breaking things, + // here it is, assume that the TE is only 1 cubic block. Problem with this is that it may + // cause the TileEntity renderer to error further down the line! But alas, nothing we can do. -+ cbb = new net.minecraft.util.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(1, 1, 1)); ++ cbb = new net.minecraft.util.math.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(1, 1, 1)); + } + if (cbb != null) bb = cbb; + } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch index 6c21afb925..6fc6691e52 100644 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -9,15 +9,61 @@ { ItemStack itemstack = this.brewingItemStacks[3]; -@@ -193,6 +193,7 @@ - { - InventoryHelper.spawnItemStack(this.worldObj, (double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), itemstack1); - } -+ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(brewingItemStacks); +@@ -165,25 +165,23 @@ } + else + { +- return false; ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(brewingItemStacks, brewingItemStacks[3], outputSlots); + } + } - if (itemstack.stackSize <= 0) -@@ -362,6 +363,20 @@ + private void brewPotions() + { ++ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBreaw(brewingItemStacks)) return; + ItemStack itemstack = this.brewingItemStacks[3]; + +- for (int i = 0; i < 3; ++i) +- { +- this.brewingItemStacks[i] = PotionHelper.func_185212_d(itemstack, this.brewingItemStacks[i]); +- } ++ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(brewingItemStacks, brewingItemStacks[3], outputSlots); + + --itemstack.stackSize; + BlockPos blockpos = this.getPos(); + +- if (itemstack.getItem().hasContainerItem()) ++ if (itemstack.getItem().hasContainerItem(itemstack)) + { +- ItemStack itemstack1 = new ItemStack(itemstack.getItem().getContainerItem()); ++ ItemStack itemstack1 = new ItemStack(itemstack.getItem().getContainerItem(itemstack)); + + if (itemstack.stackSize <= 0) + { +@@ -202,6 +200,7 @@ + + this.brewingItemStacks[3] = itemstack; + this.worldObj.playAuxSFX(1035, blockpos, 0); ++ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(brewingItemStacks); + } + + public void readFromNBT(NBTTagCompound compound) +@@ -303,12 +302,12 @@ + { + if (index == 3) + { +- return PotionHelper.func_185205_a(stack); ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack); + } + else + { + Item item = stack.getItem(); +- return index == 4 ? item == Items.blaze_powder : item == Items.potionitem || item == Items.field_185155_bH || item == Items.field_185156_bI || item == Items.glass_bottle; ++ return index == 4 ? item == Items.blaze_powder : net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack); + } + } + +@@ -362,6 +361,20 @@ } } diff --git a/rejects/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch.rej b/patches.mcp/minecraft/net/minecraft/util/BlockRenderLayer.java.patch similarity index 50% rename from rejects/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/util/BlockRenderLayer.java.patch index 78a01be0d0..80055839ac 100644 --- a/rejects/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/util/BlockRenderLayer.java.patch @@ -1,11 +1,12 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/util/BlockRenderLayer.java ++++ ../src-work/minecraft/net/minecraft/util/BlockRenderLayer.java +@@ -1,9 +1,5 @@ package net.minecraft.util; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) - public enum EnumWorldBlockLayer + public enum BlockRenderLayer { SOLID("Solid"), -++++ END PATCH diff --git a/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch b/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch index fecbe4e748..2102e3cc95 100644 --- a/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch +++ b/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch @@ -1,6 +1,15 @@ --- ../src-base/minecraft/net/minecraft/util/EnumFacing.java +++ ../src-work/minecraft/net/minecraft/util/EnumFacing.java -@@ -62,7 +62,6 @@ +@@ -8,8 +8,6 @@ + import java.util.Random; + import net.minecraft.util.math.MathHelper; + import net.minecraft.util.math.Vec3i; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + + public enum EnumFacing implements IStringSerializable + { +@@ -62,7 +60,6 @@ return getFront(this.opposite); } @@ -8,7 +17,7 @@ public EnumFacing rotateAround(EnumFacing.Axis axis) { switch (axis) -@@ -113,7 +112,6 @@ +@@ -113,7 +110,6 @@ } } @@ -16,7 +25,7 @@ private EnumFacing rotateX() { switch (this) -@@ -133,7 +131,6 @@ +@@ -133,7 +129,6 @@ } } @@ -24,7 +33,7 @@ private EnumFacing rotateZ() { switch (this) -@@ -194,7 +191,6 @@ +@@ -194,7 +189,6 @@ return this.axis; } @@ -32,7 +41,7 @@ public static EnumFacing byName(String name) { return name == null ? null : (EnumFacing)NAME_LOOKUP.get(name.toLowerCase()); -@@ -225,7 +221,6 @@ +@@ -225,7 +219,6 @@ return values()[rand.nextInt(values().length)]; } @@ -40,7 +49,7 @@ public static EnumFacing getFacingFromVector(float p_176737_0_, float p_176737_1_, float p_176737_2_) { EnumFacing enumfacing = NORTH; -@@ -268,7 +263,6 @@ +@@ -268,7 +261,6 @@ throw new IllegalArgumentException("No such direction: " + p_181076_0_ + " " + p_181076_1_); } @@ -48,7 +57,7 @@ public Vec3i getDirectionVec() { return this.directionVec; -@@ -304,7 +298,6 @@ +@@ -304,7 +296,6 @@ this.plane = plane; } diff --git a/patches.mcp/minecraft/net/minecraft/util/Session.java.patch b/patches.mcp/minecraft/net/minecraft/util/Session.java.patch index b0432b81ec..cd6f37383f 100644 --- a/patches.mcp/minecraft/net/minecraft/util/Session.java.patch +++ b/patches.mcp/minecraft/net/minecraft/util/Session.java.patch @@ -34,7 +34,7 @@ this.username = usernameIn; this.playerID = playerIDIn; this.token = tokenIn; -@@ -49,11 +66,13 @@ +@@ -49,14 +66,29 @@ try { UUID uuid = UUIDTypeAdapter.fromString(this.getPlayerID()); @@ -50,3 +50,19 @@ } } ++ /* ======================================== FORGE START ===================================== */ ++ //For internal use only. Modders should never need to use this. ++ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) ++ { ++ if(this.properties == null) this.properties = properties; ++ } ++ ++ public boolean hasCachedProperties() ++ { ++ return properties != null; ++ } ++ /* ========================================= FORGE END ====================================== */ ++ + @SideOnly(Side.CLIENT) + public static enum Type + { diff --git a/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch b/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch new file mode 100644 index 0000000000..577624b951 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch @@ -0,0 +1,32 @@ +--- ../src-base/minecraft/net/minecraft/util/WeightedRandomChestContent.java ++++ ../src-work/minecraft/net/minecraft/util/WeightedRandomChestContent.java +@@ -20,11 +20,29 @@ + this.maxStackSize = maximumChance; + } + ++ // -- Forge hooks ++ /** ++ * Allow a mod to submit a custom implementation that can delegate item stack generation beyond simple stack lookup ++ * ++ * @param random The current random for generation ++ * @param newInventory The inventory being generated (do not populate it, but you can refer to it) ++ * @return An array of {@link ItemStack} to put into the chest ++ */ ++ @Deprecated // New loottable system shouldn't need this. Need to research more. ++ protected ItemStack[] generateChestContent(Random random, net.minecraft.inventory.IInventory newInventory) ++ { ++ return net.minecraftforge.common.ChestGenHooks.generateStacks(random, theItemId, minStackSize, maxStackSize); ++ } ++ + public static void generateDispenserContents(Random random, List listIn, TileEntityDispenser dispenser, int max) + { + for (int i = 0; i < max; ++i) + { + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, listIn); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, dispenser); ++ for (ItemStack stack : stacks) ++ dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), stack); ++ if (true) continue; // Forge: Skip the rest we replace it. + int j = weightedrandomchestcontent.minStackSize + random.nextInt(weightedrandomchestcontent.maxStackSize - weightedrandomchestcontent.minStackSize + 1); + + if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j) diff --git a/rejects/minecraft/net/minecraft/util/BlockPos.java.patch.rej b/patches.mcp/minecraft/net/minecraft/util/math/BlockPos.java.patch similarity index 54% rename from rejects/minecraft/net/minecraft/util/BlockPos.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/util/math/BlockPos.java.patch index 93fcafcef7..5c3362674b 100644 --- a/rejects/minecraft/net/minecraft/util/BlockPos.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/util/math/BlockPos.java.patch @@ -1,4 +1,6 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/util/math/BlockPos.java ++++ ../src-work/minecraft/net/minecraft/util/math/BlockPos.java +@@ -270,6 +270,21 @@ }; } @@ -20,13 +22,20 @@ public static final class MutableBlockPos extends BlockPos { private int x; -++++ END PATCH -++++ REJECTED PATCH 2 - this.z = zIn; - return this; +@@ -333,6 +348,8 @@ + { + return new BlockPos(this); + } ++ ++ @Override public BlockPos getImmutable() { return new BlockPos(this); } + } + + public static final class PooledMutableBlockPos extends BlockPos +@@ -443,5 +460,7 @@ + { + return this.func_185343_d(this.field_185347_c + p_185341_1_.getFrontOffsetX(), this.field_185348_d + p_185341_1_.getFrontOffsetY(), this.field_185349_e + p_185341_1_.getFrontOffsetZ()); } + + @Override public BlockPos getImmutable() { return new BlockPos(this); } } } -++++ END PATCH diff --git a/patches.mcp/minecraft/net/minecraft/util/math/RayTraceResult.java.patch b/patches.mcp/minecraft/net/minecraft/util/math/RayTraceResult.java.patch new file mode 100644 index 0000000000..4f56eb74e0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/math/RayTraceResult.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/util/math/RayTraceResult.java ++++ ../src-work/minecraft/net/minecraft/util/math/RayTraceResult.java +@@ -5,6 +5,12 @@ + + public class RayTraceResult + { ++ /** Used to determine what sub-segment is hit */ ++ public int subHit = -1; ++ ++ /** Used to add extra hit info */ ++ public Object hitInfo = null; ++ + private BlockPos blockPos; + public RayTraceResult.Type typeOfHit; + public EnumFacing sideHit; diff --git a/patches.mcp/minecraft/net/minecraft/util/math/Vec3d.java.patch b/patches.mcp/minecraft/net/minecraft/util/math/Vec3d.java.patch new file mode 100644 index 0000000000..6f9856cfef --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/math/Vec3d.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/util/math/Vec3d.java ++++ ../src-work/minecraft/net/minecraft/util/math/Vec3d.java +@@ -1,8 +1,5 @@ + package net.minecraft.util.math; + +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; +- + public class Vec3d + { + public static final Vec3d field_186680_a = new Vec3d(0.0D, 0.0D, 0.0D); +@@ -53,7 +50,6 @@ + return this.xCoord * vec.xCoord + this.yCoord * vec.yCoord + this.zCoord * vec.zCoord; + } + +- @SideOnly(Side.CLIENT) + public Vec3d crossProduct(Vec3d vec) + { + return new Vec3d(this.yCoord * vec.zCoord - this.zCoord * vec.yCoord, this.zCoord * vec.xCoord - this.xCoord * vec.zCoord, this.xCoord * vec.yCoord - this.yCoord * vec.xCoord); diff --git a/patches.mcp/minecraft/net/minecraft/util/text/ITextComponent.java.patch b/patches.mcp/minecraft/net/minecraft/util/text/ITextComponent.java.patch new file mode 100644 index 0000000000..d5497dbbcd --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/text/ITextComponent.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/util/text/ITextComponent.java ++++ ../src-work/minecraft/net/minecraft/util/text/ITextComponent.java +@@ -33,7 +33,6 @@ + + String getUnformattedText(); + +- @SideOnly(Side.CLIENT) + String getFormattedText(); + + List getSiblings(); diff --git a/patches.mcp/minecraft/net/minecraft/util/text/Style.java.patch b/patches.mcp/minecraft/net/minecraft/util/text/Style.java.patch new file mode 100644 index 0000000000..8a3317bdc6 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/text/Style.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/util/text/Style.java ++++ ../src-work/minecraft/net/minecraft/util/text/Style.java +@@ -229,7 +229,6 @@ + return this; + } + +- @SideOnly(Side.CLIENT) + public String getFormattingCode() + { + if (this.isEmpty()) diff --git a/rejects/minecraft/net/minecraft/util/ChatComponentStyle.java.patch.rej b/patches.mcp/minecraft/net/minecraft/util/text/TextComponentBase.java.patch similarity index 53% rename from rejects/minecraft/net/minecraft/util/ChatComponentStyle.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/util/text/TextComponentBase.java.patch index 3f858e7dbe..e2a95ad34e 100644 --- a/rejects/minecraft/net/minecraft/util/ChatComponentStyle.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/util/text/TextComponentBase.java.patch @@ -1,4 +1,6 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/util/text/TextComponentBase.java ++++ ../src-work/minecraft/net/minecraft/util/text/TextComponentBase.java +@@ -74,7 +74,6 @@ return stringbuilder.toString(); } @@ -6,4 +8,3 @@ public final String getFormattedText() { StringBuilder stringbuilder = new StringBuilder(); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej b/patches.mcp/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch similarity index 59% rename from rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch index 0ab2b52be7..332e5a6edb 100644 --- a/rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch @@ -1,8 +1,10 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/util/text/translation/LanguageMap.java ++++ ../src-work/minecraft/net/minecraft/util/text/translation/LanguageMap.java +@@ -23,9 +23,29 @@ - public StringTranslate() + public LanguageMap() { -+ InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); ++ InputStream inputstream = LanguageMap.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); + inject(this, inputstream); + } + @@ -11,26 +13,25 @@ + inject(instance, inputstream); + } + -+ private static void inject(StringTranslate inst, InputStream inputstream) ++ private static void inject(LanguageMap inst, InputStream inputstream) + { -+ java.util.HashMap map = parseLangFile(inputstream); ++ Map map = parseLangFile(inputstream); + inst.languageList.putAll(map); + inst.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); + } + -+ public static java.util.HashMap parseLangFile(InputStream inputstream) ++ public static Map parseLangFile(InputStream inputstream) + { -+ java.util.HashMap table = Maps.newHashMap(); ++ Map table = Maps.newHashMap(); try { -- InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); +- InputStream inputstream = LanguageMap.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); + inputstream = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(table, inputstream); + if (inputstream == null) return table; for (String s : IOUtils.readLines(inputstream, Charsets.UTF_8)) { -++++ END PATCH -++++ REJECTED PATCH 2 +@@ -37,17 +57,18 @@ { String s1 = astring[0]; String s2 = numericVariablePattern.matcher(astring[1]).replaceAll("%$1s"); @@ -42,13 +43,12 @@ - this.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); } -- catch (IOException var7) -+ catch (Exception var7) + catch (IOException var7) { ; } ++ catch (Exception ex) {} + return table; } - static StringTranslate getInstance() -++++ END PATCH + static LanguageMap getInstance() diff --git a/rejects/minecraft/net/minecraft/realms/RealmsConnect.java.patch.rej b/rejects/minecraft/net/minecraft/realms/RealmsConnect.java.patch.rej deleted file mode 100644 index aaface62da..0000000000 --- a/rejects/minecraft/net/minecraft/realms/RealmsConnect.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 2 - return; - } - -- RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); -+ RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true)); - - if (RealmsConnect.this.aborted) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej b/rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej deleted file mode 100644 index 7fb3cab30c..0000000000 --- a/rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej +++ /dev/null @@ -1,20 +0,0 @@ -++++ REJECTED PATCH 1 - } - } - -- replaceAllSimilarBlocks(objectCraftStats); -+ replaceAllSimilarBlocks(objectCraftStats, true); - } - - private static void initMiningStats() -++++ END PATCH -++++ REJECTED PATCH 2 - } - } - -- replaceAllSimilarBlocks(mineBlockStatArray); -+ replaceAllSimilarBlocks(mineBlockStatArray, false); - } - - private static void initStats() -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej b/rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej deleted file mode 100644 index f181d60105..0000000000 --- a/rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej +++ /dev/null @@ -1,32 +0,0 @@ -++++ REJECTED PATCH 4 - { - TileEntity tileentity = null; - -+ Class oclass = null; - try - { -- Class oclass = (Class)nameToClassMap.get(nbt.getString("id")); -+ oclass = (Class)nameToClassMap.get(nbt.getString("id")); - - if (oclass != null) - { -++++ END PATCH -++++ REJECTED PATCH 5 - } - else - { -+ try -+ { - logger.warn("Skipping BlockEntity with id " + nbt.getString("id")); -+ } -+ catch (Exception ex) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex, -+ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ nbt.getString("id"), oclass.getName()); -+ tileentity = null; -+ } - } - - return tileentity; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch.rej b/rejects/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch.rej deleted file mode 100644 index e4e37859bf..0000000000 --- a/rejects/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch.rej +++ /dev/null @@ -1,63 +0,0 @@ -++++ REJECTED PATCH 2 - - for (int i = 0; i < 3; ++i) - { -- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) -+ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) - { - int j = this.brewingItemStacks[i].getMetadata(); - int k = this.getPotionResult(j, itemstack); -++++ END PATCH -++++ REJECTED PATCH 3 - } - else - { -- return false; -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(brewingItemStacks, brewingItemStacks[3], outputSlots); - } - } - - private void brewPotions() - { -+ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBreaw(brewingItemStacks)) return; - if (this.canBrew()) - { -+ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(brewingItemStacks, brewingItemStacks[3], outputSlots); - ItemStack itemstack = this.brewingItemStacks[3]; - -+ if (false) { // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe - for (int i = 0; i < 3; ++i) - { -- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) -+ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) - { - int j = this.brewingItemStacks[i].getMetadata(); - int k = this.getPotionResult(j, itemstack); -++++ END PATCH -++++ REJECTED PATCH 4 - } - } - } -+ } - -- if (itemstack.getItem().hasContainerItem()) -+ if (itemstack.getItem().hasContainerItem(itemstack)) - { -- this.brewingItemStacks[3] = new ItemStack(itemstack.getItem().getContainerItem()); -+ this.brewingItemStacks[3] = itemstack.getItem().getContainerItem(itemstack); - } - else - { -++++ END PATCH -++++ REJECTED PATCH 6 - - public boolean isItemValidForSlot(int index, ItemStack stack) - { -- return index == 3 ? stack.getItem().isPotionIngredient(stack) : stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle; -+ if (index == 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack)) return true; -+ else if (index != 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack)) return true; -+ return false; - } - - public boolean[] func_174902_m() -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/ChatStyle.java.patch.rej b/rejects/minecraft/net/minecraft/util/ChatStyle.java.patch.rej deleted file mode 100644 index 8d6713dd01..0000000000 --- a/rejects/minecraft/net/minecraft/util/ChatStyle.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - return this; - } - -- @SideOnly(Side.CLIENT) - public String getFormattingCode() - { - if (this.isEmpty()) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej b/rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej deleted file mode 100644 index d204c3b681..0000000000 --- a/rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - import java.util.Iterator; - import java.util.Map; - import java.util.Random; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - - public enum EnumFacing implements IStringSerializable - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/IChatComponent.java.patch.rej b/rejects/minecraft/net/minecraft/util/IChatComponent.java.patch.rej deleted file mode 100644 index bf81e15d79..0000000000 --- a/rejects/minecraft/net/minecraft/util/IChatComponent.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - - String getUnformattedText(); - -- @SideOnly(Side.CLIENT) - String getFormattedText(); - - List getSiblings(); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/MovingObjectPosition.java.patch.rej b/rejects/minecraft/net/minecraft/util/MovingObjectPosition.java.patch.rej deleted file mode 100644 index 16da2c7739..0000000000 --- a/rejects/minecraft/net/minecraft/util/MovingObjectPosition.java.patch.rej +++ /dev/null @@ -1,14 +0,0 @@ -++++ REJECTED PATCH 1 - public Vec3 hitVec; - public Entity entityHit; - -+ /** Used to determine what sub-segment is hit */ -+ public int subHit = -1; -+ -+ /** Used to add extra hit info */ -+ public Object hitInfo = null; -+ - public MovingObjectPosition(Vec3 hitVecIn, EnumFacing facing, BlockPos blockPosIn) - { - this(MovingObjectPosition.MovingObjectType.BLOCK, hitVecIn, facing, blockPosIn); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/ResourceLocation.java.patch.rej b/rejects/minecraft/net/minecraft/util/ResourceLocation.java.patch.rej deleted file mode 100644 index 0f0b5b06bf..0000000000 --- a/rejects/minecraft/net/minecraft/util/ResourceLocation.java.patch.rej +++ /dev/null @@ -1,27 +0,0 @@ -++++ REJECTED PATCH 1 - package net.minecraft.util; - --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - import org.apache.commons.lang3.Validate; - - public class ResourceLocation -++++ END PATCH -++++ REJECTED PATCH 2 - this(0, splitObjectName(resourceName)); - } - -- @SideOnly(Side.CLIENT) - public ResourceLocation(String resourceDomainIn, String resourcePathIn) - { - this(0, new String[] {resourceDomainIn, resourcePathIn}); -++++ END PATCH -++++ REJECTED PATCH 3 - return this.resourcePath; - } - -- @SideOnly(Side.CLIENT) - public String getResourceDomain() - { - return this.resourceDomain; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/Session.java.patch.rej b/rejects/minecraft/net/minecraft/util/Session.java.patch.rej deleted file mode 100644 index d15c135b48..0000000000 --- a/rejects/minecraft/net/minecraft/util/Session.java.patch.rej +++ /dev/null @@ -1,21 +0,0 @@ -++++ REJECTED PATCH 4 - return this.sessionType; - } - -+ /* ======================================== FORGE START ===================================== */ -+ //For internal use only. Modders should never need to use this. -+ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) -+ { -+ if(this.properties == null) this.properties = properties; -+ } -+ -+ public boolean hasCachedProperties() -+ { -+ return properties != null; -+ } -+ /* ========================================= FORGE END ====================================== */ -+ - @SideOnly(Side.CLIENT) - public static enum Type - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/Vec3.java.patch.rej b/rejects/minecraft/net/minecraft/util/Vec3.java.patch.rej deleted file mode 100644 index 69addc5632..0000000000 --- a/rejects/minecraft/net/minecraft/util/Vec3.java.patch.rej +++ /dev/null @@ -1,37 +0,0 @@ -++++ REJECTED PATCH 1 - package net.minecraft.util; - --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; -- - public class Vec3 - { - public final double xCoord; -++++ END PATCH -++++ REJECTED PATCH 2 - this((double)p_i46377_1_.getX(), (double)p_i46377_1_.getY(), (double)p_i46377_1_.getZ()); - } - -- @SideOnly(Side.CLIENT) - public Vec3 subtractReverse(Vec3 vec) - { - return new Vec3(vec.xCoord - this.xCoord, vec.yCoord - this.yCoord, vec.zCoord - this.zCoord); -++++ END PATCH -++++ REJECTED PATCH 3 - return this.xCoord * vec.xCoord + this.yCoord * vec.yCoord + this.zCoord * vec.zCoord; - } - -- @SideOnly(Side.CLIENT) - public Vec3 crossProduct(Vec3 vec) - { - return new Vec3(this.yCoord * vec.zCoord - this.zCoord * vec.yCoord, this.zCoord * vec.xCoord - this.xCoord * vec.zCoord, this.xCoord * vec.yCoord - this.yCoord * vec.xCoord); -++++ END PATCH -++++ REJECTED PATCH 4 - return new Vec3(this.xCoord + x, this.yCoord + y, this.zCoord + z); - } - -- @SideOnly(Side.CLIENT) - public double distanceTo(Vec3 vec) - { - double d0 = vec.xCoord - this.xCoord; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej b/rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej deleted file mode 100644 index fe2c74000e..0000000000 --- a/rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej +++ /dev/null @@ -1,67 +0,0 @@ -++++ REJECTED PATCH 1 - for (int i = 0; i < max; ++i) - { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, listIn); -- int j = weightedrandomchestcontent.minStackSize + random.nextInt(weightedrandomchestcontent.maxStackSize - weightedrandomchestcontent.minStackSize + 1); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, inv); - -- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j) -+ for (ItemStack itemstack1 : stacks) - { -- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); -- itemstack1.stackSize = j; - inv.setInventorySlotContents(random.nextInt(inv.getSizeInventory()), itemstack1); - } -- else -- { -- for (int k = 0; k < j; ++k) -- { -- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); -- itemstack.stackSize = 1; -- inv.setInventorySlotContents(random.nextInt(inv.getSizeInventory()), itemstack); -- } -- } - } - } - -+ // -- Forge hooks -+ /** -+ * Allow a mod to submit a custom implementation that can delegate item stack generation beyond simple stack lookup -+ * -+ * @param random The current random for generation -+ * @param newInventory The inventory being generated (do not populate it, but you can refer to it) -+ * @return An array of {@link ItemStack} to put into the chest -+ */ -+ protected ItemStack[] generateChestContent(Random random, IInventory newInventory) -+ { -+ return net.minecraftforge.common.ChestGenHooks.generateStacks(random, theItemId, minStackSize, maxStackSize); -+ } -+ - public static void generateDispenserContents(Random random, List listIn, TileEntityDispenser dispenser, int max) - { - for (int i = 0; i < max; ++i) - { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, listIn); -- int j = weightedrandomchestcontent.minStackSize + random.nextInt(weightedrandomchestcontent.maxStackSize - weightedrandomchestcontent.minStackSize + 1); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, dispenser); - -- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j) -+ for (ItemStack itemstack1 : stacks) - { -- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); -- itemstack1.stackSize = j; - dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack1); - } -- else -- { -- for (int k = 0; k < j; ++k) -- { -- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); -- itemstack.stackSize = 1; -- dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack); -- } -- } - } - } - -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/common/brewing/VanillaBrewingRecipe.java b/src/main/java/net/minecraftforge/common/brewing/VanillaBrewingRecipe.java index bf00b6fe33..16dc3b9603 100644 --- a/src/main/java/net/minecraftforge/common/brewing/VanillaBrewingRecipe.java +++ b/src/main/java/net/minecraftforge/common/brewing/VanillaBrewingRecipe.java @@ -1,11 +1,8 @@ package net.minecraftforge.common.brewing; -import java.util.List; - import net.minecraft.init.Items; -import net.minecraft.item.ItemPotion; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionHelper; /** @@ -21,7 +18,8 @@ public class VanillaBrewingRecipe implements IBrewingRecipe { @Override public boolean isInput(ItemStack stack) { - return stack.getItem() instanceof ItemPotion || stack.getItem() == Items.glass_bottle; + Item item = stack.getItem(); + return item == Items.potionitem || item == Items.field_185155_bH || item == Items.field_185156_bI || item == Items.glass_bottle; } /** @@ -30,7 +28,7 @@ public class VanillaBrewingRecipe implements IBrewingRecipe { @Override public boolean isIngredient(ItemStack stack) { - return stack.getItem().isPotionIngredient(stack); + return PotionHelper.func_185205_a(stack); } /** @@ -41,34 +39,14 @@ public class VanillaBrewingRecipe implements IBrewingRecipe { @Override public ItemStack getOutput(ItemStack input, ItemStack ingredient) { - if (ingredient != null && input != null && input.getItem() instanceof ItemPotion && isIngredient(ingredient)) + if (ingredient != null && input != null && isIngredient(ingredient)) { - int inputMeta = input.getMetadata(); - int outputMeta = PotionHelper.applyIngredient(inputMeta, ingredient.getItem().getPotionEffect(ingredient)); - if (inputMeta == outputMeta) + ItemStack result = PotionHelper.func_185212_d(ingredient, input); + if (result != input) { - return null; - } - - List oldEffects = Items.potionitem.getEffects(inputMeta); - List newEffects = Items.potionitem.getEffects(outputMeta); - - boolean hasResult = false; - if ((inputMeta <= 0 || oldEffects != newEffects) && (oldEffects == null || !oldEffects.equals(newEffects) && newEffects != null)) - { - hasResult = true; - } - else if (!ItemPotion.isSplash(inputMeta) && ItemPotion.isSplash(outputMeta)) - { - hasResult = true; - } - - if (hasResult) - { - ItemStack output = input.copy(); - output.setItemDamage(outputMeta); - return output; + return result; } + return null; } return null; diff --git a/src/main/java/net/minecraftforge/fml/common/registry/LanguageRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/LanguageRegistry.java index 217495171b..3b2a369f80 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/LanguageRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/LanguageRegistry.java @@ -34,7 +34,7 @@ import org.apache.logging.log4j.Level; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.StringTranslate; +import net.minecraft.util.text.translation.LanguageMap; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Loader; @@ -241,7 +241,7 @@ public class LanguageRegistry } } - public void injectLanguage(String language, HashMap parsedLangFile) + public void injectLanguage(String language, Map parsedLangFile) { Properties p = modLanguageData.get(language); @@ -285,11 +285,11 @@ public class LanguageRegistry String lang = matcher.group(2); //FMLLog.fine("Injecting found translation data for lang %s in zip file %s at %s into language system", lang, source.getName(), ze.getName()); added.add(lang); - LanguageRegistry.instance().injectLanguage(lang, StringTranslate.parseLangFile(zf.getInputStream(ze))); + LanguageRegistry.instance().injectLanguage(lang, LanguageMap.parseLangFile(zf.getInputStream(ze))); // Ensure en_US is available to StringTranslate on the server if ("en_US".equals(lang) && side == Side.SERVER) { - StringTranslate.inject(zf.getInputStream(ze)); + LanguageMap.inject(zf.getInputStream(ze)); } } } @@ -312,11 +312,11 @@ public class LanguageRegistry { String lang = matcher.group(2); FMLLog.fine("Injecting found translation assets for lang %s at %s into language system", lang, currPath); - LanguageRegistry.instance().injectLanguage(lang, StringTranslate.parseLangFile(new FileInputStream(file))); + LanguageRegistry.instance().injectLanguage(lang, LanguageMap.parseLangFile(new FileInputStream(file))); // Ensure en_US is available to StringTranslate on the server if ("en_US".equals(lang) && side == Side.SERVER) { - StringTranslate.inject(new FileInputStream(file)); + LanguageMap.inject(new FileInputStream(file)); } } } From ac7c4d2f6c64efdf16e189722c7488046edd08d3 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 1 Mar 2016 04:58:03 -0800 Subject: [PATCH 007/243] Some import renames and compile error fixes, killed ~800. --- .../feature/WorldGenAbstractTree.java.patch | 2 +- .../gen/feature/WorldGenBigTree.java.patch | 2 +- .../gen/feature/WorldGenCanopyTree.java.patch | 2 +- .../gen/feature/WorldGenHugeTrees.java.patch | 8 +- .../gen/feature/WorldGenMegaJungle.java.patch | 4 +- .../feature/WorldGenSavannaTree.java.patch | 6 +- .../gen/feature/WorldGenSwamp.java.patch | 6 +- .../gen/feature/WorldGenTaiga1.java.patch | 6 +- .../StructureMineshaftPieces.java.patch | 2 +- .../client/ClientCommandHandler.java | 20 +- .../client/ForgeHooksClient.java | 50 ++-- .../minecraftforge/client/GuiIngameForge.java | 6 +- .../client/ItemModelMesherForge.java | 6 +- .../client/MinecraftForgeClient.java | 6 +- .../client/event/ClientChatReceivedEvent.java | 6 +- .../client/event/DrawBlockHighlightEvent.java | 8 +- .../client/event/ModelBakeEvent.java | 10 +- .../client/event/RenderBlockOverlayEvent.java | 2 +- .../client/event/RenderLivingEvent.java | 16 +- .../client/event/RenderWorldEvent.java | 10 +- .../client/model/BlockStateLoader.java | 2 +- .../client/model/ForgeBlockStateV1.java | 2 +- .../client/model/IFlexibleBakedModel.java | 2 +- .../client/model/ISmartBlockModel.java | 2 +- .../client/model/ISmartItemModel.java | 2 +- .../client/model/ModelDynBucket.java | 4 +- .../client/model/ModelFluid.java | 4 +- .../client/model/ModelLoader.java | 14 +- .../client/model/ModelLoaderRegistry.java | 2 +- .../client/model/MultiLayerModel.java | 36 +-- .../client/model/TRSRTransformation.java | 2 +- .../model/animation/AnimationModelBase.java | 26 +- .../client/model/animation/AnimationTESR.java | 8 +- .../client/model/animation/Clips.java | 2 +- .../client/model/animation/FastTESR.java | 12 +- .../client/model/obj/OBJModel.java | 2 +- .../client/model/pipeline/BlockInfo.java | 2 +- .../pipeline/ForgeBlockModelRenderer.java | 24 +- .../client/model/pipeline/LightUtil.java | 14 +- .../model/pipeline/VertexLighterFlat.java | 4 +- .../model/pipeline/WorldRendererConsumer.java | 10 +- .../net/minecraftforge/common/ForgeHooks.java | 16 +- .../common/property/ExtendedBlockState.java | 10 +- .../common/util/BlockSnapshot.java | 2 +- .../common/util/FakePlayer.java | 4 +- .../event/ForgeEventFactory.java | 2 +- .../minecraftforge/event/ServerChatEvent.java | 6 +- .../entity/minecart/MinecartUpdateEvent.java | 2 +- .../event/entity/player/BonemealEvent.java | 2 +- .../event/entity/player/PlayerEvent.java | 2 +- .../entity/player/PlayerInteractEvent.java | 8 +- .../entity/player/PlayerSetSpawnEvent.java | 2 +- .../entity/player/PlayerSleepInBedEvent.java | 2 +- .../player/SleepingLocationCheckEvent.java | 2 +- .../event/entity/player/UseHoeEvent.java | 2 +- .../terraingen/DeferredBiomeDecorator.java | 2 +- .../event/world/ExplosionEvent.java | 2 +- .../event/world/WorldEvent.java | 2 +- .../minecraftforge/fluids/BlockFluidBase.java | 10 +- .../fluids/BlockFluidClassic.java | 2 +- .../fluids/BlockFluidFinite.java | 2 +- .../java/net/minecraftforge/fluids/Fluid.java | 2 +- .../net/minecraftforge/fluids/FluidEvent.java | 2 +- .../net/minecraftforge/fluids/FluidUtil.java | 2 +- .../minecraftforge/fluids/IFluidBlock.java | 2 +- .../fluids/UniversalBucket.java | 2 +- .../minecraftforge/fml/client/GuiModList.java | 26 +- .../fml/client/GuiScrollingList.java | 16 +- .../fml/client/config/GuiConfig.java | 4 +- .../fml/client/config/GuiMessageDialog.java | 4 +- .../fml/client/config/GuiUtils.java | 4 +- .../fml/common/FMLCommonHandler.java | 6 +- .../network/handshake/NetworkDispatcher.java | 12 +- .../items/VanillaDoubleChestItemHandler.java | 2 +- .../server/command/ForgeCommand.java | 2 +- src/main/resources/forge_at.cfg | 6 +- .../minecraftforge/debug/DynBucketTest.java | 18 +- .../debug/ForgeBlockStatesLoaderDebug.java | 8 +- .../debug/ItemLayerModelDebug.java | 2 +- .../minecraftforge/debug/ItemTileDebug.java | 2 +- .../debug/LayerBreakingTest.java | 12 +- .../debug/ModelAnimationDebug.java | 4 +- .../debug/ModelBakeEventDebug.java | 48 ++-- .../minecraftforge/debug/ModelFluidDebug.java | 4 +- .../debug/ModelLoaderRegistryDebug.java | 222 +++++++++--------- .../debug/MultiLayerModelDebug.java | 8 +- .../debug/PotionRegistryDebug.java | 14 +- .../test/ClientCommandTest.java | 11 +- .../test/TestCapabilityMod.java | 10 +- .../net/minecraftforge/test/WRNormalMod.java | 4 +- 90 files changed, 454 insertions(+), 441 deletions(-) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch index 79d808460b..aa33cb6073 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch @@ -8,6 +8,6 @@ + public boolean isReplaceable(World world, BlockPos pos) + { + net.minecraft.block.state.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.getBlock()); + } } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch index 00b08fad2a..9f7ba74535 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch @@ -31,7 +31,7 @@ - Block block = this.world.getBlockState(this.basePos.down()).getBlock(); + BlockPos down = this.basePos.down(); + net.minecraft.block.state.IBlockState state = this.world.getBlockState(down); -+ boolean isSoil = state.getBlock().canSustainPlant(this.world, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); ++ boolean isSoil = state.getBlock().canSustainPlant(state, this.world, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - if (block != Blocks.dirt && block != Blocks.grass && block != Blocks.farmland) + if (!isSoil) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch index 6d4ac28c88..be05389737 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch @@ -6,7 +6,7 @@ BlockPos blockpos = position.down(); - Block block = worldIn.getBlockState(blockpos).getBlock(); + net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); -+ boolean isSoil = state.getBlock().canSustainPlant(worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); ++ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - if (block != Blocks.grass && block != Blocks.dirt) + if (!(isSoil && position.getY() < 256 - i - 1)) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch index fde943faa8..bfa8df76e4 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch @@ -9,11 +9,13 @@ { flag = false; } -@@ -79,13 +79,14 @@ +@@ -78,14 +78,15 @@ + private boolean func_175927_a(BlockPos p_175927_1_, World worldIn) { BlockPos blockpos = p_175927_1_.down(); - Block block = worldIn.getBlockState(blockpos).getBlock(); -+ boolean isSoil = block.canSustainPlant(worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); +- Block block = worldIn.getBlockState(blockpos).getBlock(); ++ IBlockState state = worldIn.getBlockState(blockpos); ++ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - if ((block == Blocks.grass || block == Blocks.dirt) && p_175927_1_.getY() >= 2) + if (isSoil && p_175927_1_.getY() >= 2) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch index c6dc8efd21..54882ef4d3 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch @@ -44,7 +44,7 @@ + //Helper macro + private boolean isAirLeaves(World world, BlockPos pos) + { -+ net.minecraft.block.Block block = world.getBlockState(pos).getBlock(); -+ return block.isAir(world, pos) || block.isLeaves(world, pos); ++ IBlockState state = world.getBlockState(pos); ++ return state.getBlock().isAir(state, world, pos) || state.getBlock().isLeaves(state, world, pos); + } } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch index 474cdd7db7..a40dcd852f 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch @@ -15,14 +15,14 @@ { - Block block = worldIn.getBlockState(position.down()).getBlock(); + BlockPos down = position.down(); -+ Block block = worldIn.getBlockState(down).getBlock(); -+ boolean isSoil = block.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); ++ IBlockState state = worldIn.getBlockState(down); ++ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - if ((block == Blocks.grass || block == Blocks.dirt) && position.getY() < 256 - i - 1) + if (isSoil && position.getY() < 256 - i - 1) { - this.func_175921_a(worldIn, position.down()); -+ block.onPlantGrow(worldIn, down, position); ++ state.getBlock().onPlantGrow(worldIn, down, position); EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand); int k2 = i - rand.nextInt(4) - 1; int l2 = 3 - rand.nextInt(3); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch index 6f44c997b1..d8362186c5 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch @@ -6,14 +6,14 @@ { - Block block1 = worldIn.getBlockState(position.down()).getBlock(); + 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)); ++ IBlockState state = worldIn.getBlockState(down); ++ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - if ((block1 == Blocks.grass || block1 == Blocks.dirt) && position.getY() < 256 - i - 1) + if (isSoil && position.getY() < 256 - i - 1) { - this.func_175921_a(worldIn, position.down()); -+ block1.onPlantGrow(worldIn, position.down(),position); ++ state.getBlock().onPlantGrow(worldIn, position.down(),position); for (int k1 = position.getY() - 3 + i; k1 <= position.getY() + i; ++k1) { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch index e6b3a7d26a..fa469e6c4b 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch @@ -15,14 +15,14 @@ { - Block block = worldIn.getBlockState(position.down()).getBlock(); + BlockPos down = position.down(); -+ Block block = worldIn.getBlockState(down).getBlock(); -+ boolean isSoil = block.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); ++ IBlockState state = worldIn.getBlockState(down); ++ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); - if ((block == Blocks.grass || block == Blocks.dirt) && position.getY() < 256 - i - 1) + if (isSoil && position.getY() < 256 - i - 1) { - this.func_175921_a(worldIn, position.down()); -+ block.onPlantGrow(worldIn, down, position); ++ state.getBlock().onPlantGrow(worldIn, down, position); int k2 = 0; for (int l2 = position.getY() + i; l2 >= position.getY() + j; --l2) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch index 34db35ce02..b0dfd7a8c0 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch @@ -7,7 +7,7 @@ + static + { + net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR, CHEST_CONTENT_WEIGHT_LIST, 8, 8); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(net.minecraft.init.Items.enchanted_book, 1, 0), 1, 1, 1)); + } + private static StructureComponent func_175892_a(List listIn, Random rand, int x, int y, int z, EnumFacing facing, int type) diff --git a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java index 87a196e485..1b8b994326 100644 --- a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java +++ b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java @@ -9,12 +9,13 @@ import net.minecraft.command.CommandHandler; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; -import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.server.MinecraftServer; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.CommandEvent; import net.minecraftforge.fml.client.FMLClientHandler; -import net.minecraft.util.EnumChatFormatting; -import static net.minecraft.util.EnumChatFormatting.*; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; +import static net.minecraft.util.text.TextFormatting.*; /** * The class that handles client-side chat commands. You should register any @@ -57,7 +58,7 @@ public class ClientCommandHandler extends CommandHandler return 0; } - if (icommand.canCommandSenderUseCommand(sender)) + if (icommand.func_184882_a(this.func_184879_a(), sender)) { CommandEvent event = new CommandEvent(icommand, sender, args); if (MinecraftForge.EVENT_BUS.post(event)) @@ -69,7 +70,7 @@ public class ClientCommandHandler extends CommandHandler return 0; } - icommand.processCommand(sender, args); + this.tryExecute(sender, args, icommand, message); return 1; } else @@ -95,9 +96,9 @@ public class ClientCommandHandler extends CommandHandler } //Couple of helpers because the mcp names are stupid and long... - private ChatComponentTranslation format(EnumChatFormatting color, String str, Object... args) + private TextComponentTranslation format(TextFormatting color, String str, Object... args) { - ChatComponentTranslation ret = new ChatComponentTranslation(str, args); + TextComponentTranslation ret = new TextComponentTranslation(str, args); ret.getChatStyle().setColor(color); return ret; } @@ -136,4 +137,9 @@ public class ClientCommandHandler extends CommandHandler } } } + + @Override + protected MinecraftServer func_184879_a() { + return Minecraft.getMinecraft().getIntegratedServer(); + } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 4a184c8116..9c32496f81 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -17,7 +17,6 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.ISound; -import net.minecraft.client.audio.SoundEventAccessorComposite; import net.minecraft.client.audio.SoundManager; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiMainMenu; @@ -27,10 +26,14 @@ import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderGlobal; -import net.minecraft.client.renderer.WorldRenderer; 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.ItemTransformVec3f; +import net.minecraft.client.renderer.block.model.ModelBakery; +import net.minecraft.client.renderer.block.model.ModelManager; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelRotation; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; @@ -39,11 +42,6 @@ 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.client.resources.I18n; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.model.ModelManager; -import net.minecraft.client.resources.model.ModelResourceLocation; -import net.minecraft.client.resources.model.ModelRotation; import net.minecraft.client.settings.GameSettings; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -52,6 +50,10 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.registry.IRegistry; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -113,7 +115,7 @@ public class ForgeHooksClient } } - public static boolean onDrawBlockHighlight(RenderGlobal context, EntityPlayer player, MovingObjectPosition target, int subID, ItemStack currentItem, float partialTicks) + public static boolean onDrawBlockHighlight(RenderGlobal context, EntityPlayer player, RayTraceResult target, int subID, ItemStack currentItem, float partialTicks) { return MinecraftForge.EVENT_BUS.post(new DrawBlockHighlightEvent(context, player, target, subID, currentItem, partialTicks)); } @@ -145,15 +147,15 @@ public class ForgeHooksClient renderPass = pass; } - static final ThreadLocal renderLayer = new ThreadLocal() + static final ThreadLocal renderLayer = new ThreadLocal() { - protected EnumWorldBlockLayer initialValue() + protected BlockRenderLayer initialValue() { - return EnumWorldBlockLayer.SOLID; + return BlockRenderLayer.SOLID; } }; - public static void setRenderLayer(EnumWorldBlockLayer layer) + public static void setRenderLayer(BlockRenderLayer layer) { renderLayer.set(layer); } @@ -196,7 +198,7 @@ public class ForgeHooksClient MinecraftForge.EVENT_BUS.post(fovUpdateEvent); return fovUpdateEvent.newfov; } - + public static float getFOVModifier(EntityRenderer renderer, Entity entity, Block block, double renderPartialTicks, float fov) { EntityViewRenderEvent.FOVModifier event = new EntityViewRenderEvent.FOVModifier(renderer, entity, block, renderPartialTicks, fov); MinecraftForge.EVENT_BUS.post(event); @@ -265,7 +267,7 @@ public class ForgeHooksClient if (status == BETA || status == BETA_OUTDATED) { // render a warning at the top of the screen, - String line = I18n.format("forge.update.beta.1", EnumChatFormatting.RED, EnumChatFormatting.RESET); + String line = I18n.format("forge.update.beta.1", TextFormatting.RED, TextFormatting.RESET); gui.drawString(font, line, (width - font.getStringWidth(line)) / 2, 4 + (0 * (font.FONT_HEIGHT + 1)), -1); line = I18n.format("forge.update.beta.2"); gui.drawString(font, line, (width - font.getStringWidth(line)) / 2, 4 + (1 * (font.FONT_HEIGHT + 1)), -1); @@ -297,7 +299,7 @@ public class ForgeHooksClient return e.result; } - //static RenderBlocks worldRendererRB; + //static RenderBlocks VertexBufferRB; static int worldRenderPass; public static int getWorldRenderPass() @@ -325,25 +327,25 @@ public class ForgeHooksClient } /* - public static void setWorldRendererRB(RenderBlocks renderBlocks) + public static void setVertexBufferRB(RenderBlocks renderBlocks) { - worldRendererRB = renderBlocks; + VertexBufferRB = renderBlocks; } - public static void onPreRenderWorld(WorldRenderer worldRenderer, int pass) + public static void onPreRenderWorld(VertexBuffer VertexBuffer, int pass) { - if(worldRendererRB != null) + if(VertexBufferRB != null) { worldRenderPass = pass; - MinecraftForge.EVENT_BUS.post(new RenderWorldEvent.Pre(worldRenderer, (ChunkCache)worldRendererRB.blockAccess, worldRendererRB, pass)); + MinecraftForge.EVENT_BUS.post(new RenderWorldEvent.Pre(VertexBuffer, (ChunkCache)VertexBufferRB.blockAccess, VertexBufferRB, pass)); } } - public static void onPostRenderWorld(WorldRenderer worldRenderer, int pass) + public static void onPostRenderWorld(VertexBuffer VertexBuffer, int pass) { - if(worldRendererRB != null) + if(VertexBufferRB != null) { - MinecraftForge.EVENT_BUS.post(new RenderWorldEvent.Post(worldRenderer, (ChunkCache)worldRendererRB.blockAccess, worldRendererRB, pass)); + MinecraftForge.EVENT_BUS.post(new RenderWorldEvent.Post(VertexBuffer, (ChunkCache)VertexBufferRB.blockAccess, VertexBufferRB, pass)); worldRenderPass = -1; } } @@ -501,7 +503,7 @@ public class ForgeHooksClient return ret; } - public static void putQuadColor(WorldRenderer renderer, BakedQuad quad, int color) + public static void putQuadColor(VertexBuffer renderer, BakedQuad quad, int color) { float cr = color & 0xFF; float cg = (color >>> 8) & 0xFF; diff --git a/src/main/java/net/minecraftforge/client/GuiIngameForge.java b/src/main/java/net/minecraftforge/client/GuiIngameForge.java index 2b3140382f..9e43403110 100644 --- a/src/main/java/net/minecraftforge/client/GuiIngameForge.java +++ b/src/main/java/net/minecraftforge/client/GuiIngameForge.java @@ -29,11 +29,11 @@ import net.minecraft.potion.Potion; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.scoreboard.Scoreboard; -import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.FoodStats; -import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StringUtils; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.common.ForgeHooks; @@ -596,7 +596,7 @@ public class GuiIngameForge extends GuiIngame { String name = this.highlightingItemStack.getDisplayName(); if (this.highlightingItemStack.hasDisplayName()) - name = EnumChatFormatting.ITALIC + name; + name = TextFormatting.ITALIC + name; name = this.highlightingItemStack.getItem().getHighlightTip(this.highlightingItemStack, name); diff --git a/src/main/java/net/minecraftforge/client/ItemModelMesherForge.java b/src/main/java/net/minecraftforge/client/ItemModelMesherForge.java index b65665f685..c5ed224d56 100644 --- a/src/main/java/net/minecraftforge/client/ItemModelMesherForge.java +++ b/src/main/java/net/minecraftforge/client/ItemModelMesherForge.java @@ -8,9 +8,9 @@ import com.google.common.collect.Maps; import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.procedure.TIntObjectProcedure; import net.minecraft.client.renderer.ItemModelMesher; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelManager; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ModelManager; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; /** diff --git a/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java b/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java index 53801cb18a..5315c81fb2 100644 --- a/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java +++ b/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java @@ -9,8 +9,8 @@ import java.util.BitSet; import java.util.concurrent.TimeUnit; import net.minecraft.client.renderer.RegionRenderCache; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import org.apache.commons.lang3.tuple.Pair; @@ -26,7 +26,7 @@ public class MinecraftForgeClient return ForgeHooksClient.renderPass; } - public static EnumWorldBlockLayer getRenderLayer() + public static BlockRenderLayer getRenderLayer() { return ForgeHooksClient.renderLayer.get(); } diff --git a/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java b/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java index 8f57af949f..36d67987a9 100644 --- a/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java @@ -1,13 +1,13 @@ package net.minecraftforge.client.event; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; @Cancelable public class ClientChatReceivedEvent extends Event { - public IChatComponent message; + public ITextComponent message; /** * Introduced in 1.8: * 0 : Standard Text Message @@ -15,7 +15,7 @@ public class ClientChatReceivedEvent extends Event * 2 : 'Status' message, displayed above action bar, where song notifications are. */ public final byte type; - public ClientChatReceivedEvent(byte type, IChatComponent message) + public ClientChatReceivedEvent(byte type, ITextComponent message) { this.type = type; this.message = message; diff --git a/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java b/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java index 242fb3d541..ea53c22562 100644 --- a/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java +++ b/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java @@ -4,7 +4,7 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; 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.client.renderer.RenderGlobal; @Cancelable @@ -12,12 +12,12 @@ public class DrawBlockHighlightEvent extends Event { public final RenderGlobal context; public final EntityPlayer player; - public final MovingObjectPosition target; + public final RayTraceResult target; public final int subID; public final ItemStack currentItem; public final float partialTicks; - - public DrawBlockHighlightEvent(RenderGlobal context, EntityPlayer player, MovingObjectPosition target, int subID, ItemStack currentItem, float partialTicks) + + public DrawBlockHighlightEvent(RenderGlobal context, EntityPlayer player, RayTraceResult target, int subID, ItemStack currentItem, float partialTicks) { this.context = context; this.player = player; diff --git a/src/main/java/net/minecraftforge/client/event/ModelBakeEvent.java b/src/main/java/net/minecraftforge/client/event/ModelBakeEvent.java index d4ac470b04..4a0210ec3e 100644 --- a/src/main/java/net/minecraftforge/client/event/ModelBakeEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ModelBakeEvent.java @@ -1,10 +1,10 @@ package net.minecraftforge.client.event; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.model.ModelManager; -import net.minecraft.client.resources.model.ModelResourceLocation; -import net.minecraft.util.IRegistry; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ModelBakery; +import net.minecraft.client.renderer.block.model.ModelManager; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.util.registry.IRegistry; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.eventhandler.Event; diff --git a/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java b/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java index 97d7d5fdee..7a192802da 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java @@ -3,7 +3,7 @@ package net.minecraftforge.client.event; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; diff --git a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java index d7491eca60..409917da94 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java @@ -2,18 +2,18 @@ package net.minecraftforge.client.event; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; -import net.minecraft.client.renderer.entity.RendererLivingEntity; +import net.minecraft.client.renderer.entity.RenderLivingBase; import net.minecraft.entity.EntityLivingBase; public abstract class RenderLivingEvent extends Event { public final EntityLivingBase entity; - public final RendererLivingEntity renderer; + public final RenderLivingBase renderer; public final double x; public final double y; public final double z; - public RenderLivingEvent(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z) + public RenderLivingEvent(EntityLivingBase entity, RenderLivingBase renderer, double x, double y, double z) { this.entity = entity; this.renderer = renderer; @@ -25,25 +25,25 @@ public abstract class RenderLivingEvent extends Even @Cancelable public static class Pre extends RenderLivingEvent { - public Pre(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } + public Pre(EntityLivingBase entity, RenderLivingBase renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } } public static class Post extends RenderLivingEvent { - public Post(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } + public Post(EntityLivingBase entity, RenderLivingBase renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } } public abstract static class Specials extends RenderLivingEvent { - public Specials(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } + public Specials(EntityLivingBase entity, RenderLivingBase renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } @Cancelable public static class Pre extends Specials { - public Pre(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } + public Pre(EntityLivingBase entity, RenderLivingBase renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } } public static class Post extends Specials { - public Post(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } + public Post(EntityLivingBase entity, RenderLivingBase renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } } } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderWorldEvent.java b/src/main/java/net/minecraftforge/client/event/RenderWorldEvent.java index 1e3d1b026b..dbe60ff67b 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderWorldEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderWorldEvent.java @@ -2,17 +2,17 @@ package net.minecraftforge.client.event; import net.minecraftforge.fml.common.eventhandler.Event; //import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.world.ChunkCache; public abstract class RenderWorldEvent extends Event { - public final WorldRenderer renderer; + public final VertexBuffer renderer; public final ChunkCache chunkCache; //public final RenderBlocks renderBlocks; public final int pass; - public RenderWorldEvent(WorldRenderer renderer, ChunkCache chunkCache, /*RenderBlocks renderBlocks,*/ int pass) + public RenderWorldEvent(VertexBuffer renderer, ChunkCache chunkCache, /*RenderBlocks renderBlocks,*/ int pass) { this.renderer = renderer; this.chunkCache = chunkCache; @@ -26,7 +26,7 @@ public abstract class RenderWorldEvent extends Event */ public static class Pre extends RenderWorldEvent { - public Pre(WorldRenderer renderer, ChunkCache chunkCache, /*RenderBlocks renderBlocks,*/ int pass){ super(renderer, chunkCache, /*renderBlocks,*/ pass); } + public Pre(VertexBuffer renderer, ChunkCache chunkCache, /*RenderBlocks renderBlocks,*/ int pass){ super(renderer, chunkCache, /*renderBlocks,*/ pass); } } /** @@ -34,6 +34,6 @@ public abstract class RenderWorldEvent extends Event */ public static class Post extends RenderWorldEvent { - public Post(WorldRenderer renderer, ChunkCache chunkCache, /*RenderBlocks renderBlocks,*/ int pass){ super(renderer, chunkCache, /*renderBlocks,*/ pass); } + public Post(VertexBuffer renderer, ChunkCache chunkCache, /*RenderBlocks renderBlocks,*/ int pass){ super(renderer, chunkCache, /*renderBlocks,*/ pass); } } } diff --git a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java index 958a21344a..2a5a1322a4 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java +++ b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java @@ -9,7 +9,7 @@ import java.util.List; import java.util.Map.Entry; import net.minecraft.client.renderer.block.model.ModelBlockDefinition; -import net.minecraft.client.resources.model.ModelRotation; +import net.minecraft.client.renderer.block.model.ModelRotation; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLLog; diff --git a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java index c079687925..fd915c7564 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java @@ -17,7 +17,7 @@ import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.resources.model.ModelRotation; +import net.minecraft.client.renderer.block.model.ModelRotation; import net.minecraft.util.JsonUtils; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.BlockStateLoader.Marker; diff --git a/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java b/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java index 371f236743..3ea4c32645 100644 --- a/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java +++ b/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java @@ -6,7 +6,7 @@ import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.util.EnumFacing; /* diff --git a/src/main/java/net/minecraftforge/client/model/ISmartBlockModel.java b/src/main/java/net/minecraftforge/client/model/ISmartBlockModel.java index 4ad91757fe..797456109d 100644 --- a/src/main/java/net/minecraftforge/client/model/ISmartBlockModel.java +++ b/src/main/java/net/minecraftforge/client/model/ISmartBlockModel.java @@ -10,7 +10,7 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.util.EnumFacing; import org.apache.commons.lang3.tuple.Pair; diff --git a/src/main/java/net/minecraftforge/client/model/ISmartItemModel.java b/src/main/java/net/minecraftforge/client/model/ISmartItemModel.java index 7973271d44..46703fc83c 100644 --- a/src/main/java/net/minecraftforge/client/model/ISmartItemModel.java +++ b/src/main/java/net/minecraftforge/client/model/ISmartItemModel.java @@ -1,7 +1,7 @@ package net.minecraftforge.client.model; import net.minecraft.item.ItemStack; -import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.renderer.block.model.IBakedModel; public interface ISmartItemModel extends IBakedModel { diff --git a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java index 983b2854ad..93fa9aaf59 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java +++ b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java @@ -13,8 +13,8 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformT import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index fdd3cda7f0..e6235e30dc 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -15,8 +15,8 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformT import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelRotation; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ModelRotation; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 4a42453054..2b327cc79b 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -41,13 +41,13 @@ import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.model.BuiltInModel; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.model.ModelResourceLocation; -import net.minecraft.client.resources.model.ModelRotation; -import net.minecraft.client.resources.model.SimpleBakedModel; -import net.minecraft.client.resources.model.WeightedBakedModel; +import net.minecraft.client.renderer.block.model.BuiltInModel; +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.model.ModelRotation; +import net.minecraft.client.renderer.block.model.SimpleBakedModel; +import net.minecraft.client.renderer.block.model.WeightedBakedModel; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index 33fdf8531a..ae6a230f48 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -10,7 +10,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.resources.IReloadableResourceManager; import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.IResourceManagerReloadListener; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader.VanillaLoader; import net.minecraftforge.client.model.b3d.B3DLoader; diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index 8a67e2a750..c04dd6e07d 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -14,10 +14,10 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformT import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.fml.common.FMLLog; @@ -34,11 +34,11 @@ import com.google.gson.JsonParser; public class MultiLayerModel implements IModelCustomData { - public static final MultiLayerModel instance = new MultiLayerModel(ImmutableMap., ModelResourceLocation>of()); + public static final MultiLayerModel instance = new MultiLayerModel(ImmutableMap., ModelResourceLocation>of()); - private final ImmutableMap, ModelResourceLocation> models; + private final ImmutableMap, ModelResourceLocation> models; - public MultiLayerModel(ImmutableMap, ModelResourceLocation> models) + public MultiLayerModel(ImmutableMap, ModelResourceLocation> models) { this.models = models; } @@ -55,10 +55,10 @@ public class MultiLayerModel implements IModelCustomData return ImmutableList.of(); } - private static ImmutableMap, IFlexibleBakedModel> buildModels(ImmutableMap, ModelResourceLocation> models, IModelState state, VertexFormat format, Function bakedTextureGetter) + private static ImmutableMap, IFlexibleBakedModel> buildModels(ImmutableMap, ModelResourceLocation> models, IModelState state, VertexFormat format, Function bakedTextureGetter) { - ImmutableMap.Builder, IFlexibleBakedModel> builder = ImmutableMap.builder(); - for(Optional key : models.keySet()) + ImmutableMap.Builder, IFlexibleBakedModel> builder = ImmutableMap.builder(); + for(Optional key : models.keySet()) { IModel model; try @@ -96,14 +96,14 @@ public class MultiLayerModel implements IModelCustomData @Override public IModel process(ImmutableMap customData) { - ImmutableMap.Builder, ModelResourceLocation> builder = ImmutableMap.builder(); + ImmutableMap.Builder, ModelResourceLocation> builder = ImmutableMap.builder(); for(String key : customData.keySet()) { if("base".equals(key)) { - builder.put(Optional.absent(), getLocation(customData.get(key))); + builder.put(Optional.absent(), getLocation(customData.get(key))); } - for(EnumWorldBlockLayer layer : EnumWorldBlockLayer.values()) + for(BlockRenderLayer layer : BlockRenderLayer.values()) { if(layer.toString().equals(key)) { @@ -111,7 +111,7 @@ public class MultiLayerModel implements IModelCustomData } } } - ImmutableMap, ModelResourceLocation> models = builder.build(); + ImmutableMap, ModelResourceLocation> models = builder.build(); if(models.isEmpty()) return instance; return new MultiLayerModel(models); } @@ -129,7 +129,7 @@ public class MultiLayerModel implements IModelCustomData public static class MultiLayerBakedModel implements IFlexibleBakedModel, ISmartBlockModel, IPerspectiveAwareModel { - private final ImmutableMap, IFlexibleBakedModel> models; + private final ImmutableMap, IFlexibleBakedModel> models; private final VertexFormat format; private final ImmutableMap cameraTransforms;; private final IFlexibleBakedModel base; @@ -145,7 +145,7 @@ public class MultiLayerModel implements IModelCustomData }; @Deprecated // remove 1.9 - public MultiLayerBakedModel(ImmutableMap, ModelResourceLocation> models, VertexFormat format, ImmutableMap cameraTransforms) + public MultiLayerBakedModel(ImmutableMap, ModelResourceLocation> models, VertexFormat format, ImmutableMap cameraTransforms) { this( buildModels(models, TRSRTransformation.identity(), format, defaultTextureGetter), @@ -155,7 +155,7 @@ public class MultiLayerModel implements IModelCustomData ); } - public MultiLayerBakedModel(ImmutableMap, IFlexibleBakedModel> models, IFlexibleBakedModel missing, VertexFormat format, ImmutableMap cameraTransforms) + public MultiLayerBakedModel(ImmutableMap, IFlexibleBakedModel> models, IFlexibleBakedModel missing, VertexFormat format, ImmutableMap cameraTransforms) { this.models = models; this.format = format; @@ -178,7 +178,7 @@ public class MultiLayerModel implements IModelCustomData quads = quadBuilder.build(); } - private static ImmutableList buildQuads(ImmutableMap, IFlexibleBakedModel> models, Optional side) + private static ImmutableList buildQuads(ImmutableMap, IFlexibleBakedModel> models, Optional side) { ImmutableList.Builder builder = ImmutableList.builder(); for(IBakedModel model : models.values()) @@ -240,7 +240,7 @@ public class MultiLayerModel implements IModelCustomData @Override public IBakedModel handleBlockState(IBlockState state) { - Optional layer = Optional.of(MinecraftForgeClient.getRenderLayer()); + Optional layer = Optional.of(MinecraftForgeClient.getRenderLayer()); if(!models.containsKey(layer)) { return missing; diff --git a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java index 83167e84f4..05492f7bee 100644 --- a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java +++ b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java @@ -9,7 +9,7 @@ import javax.vecmath.Vector3f; import javax.vecmath.Vector4f; import net.minecraft.client.renderer.block.model.ItemTransformVec3f; -import net.minecraft.client.resources.model.ModelRotation; +import net.minecraft.client.renderer.block.model.ModelRotation; import net.minecraft.util.EnumFacing; import net.minecraft.util.Vec3i; diff --git a/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java b/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java index a688aa0fda..dbdc076294 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java +++ b/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java @@ -6,19 +6,19 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraftforge.client.model.IModel; import net.minecraftforge.client.model.IModelState; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.pipeline.VertexLighterFlat; -import net.minecraftforge.client.model.pipeline.WorldRendererConsumer; +import net.minecraftforge.client.model.pipeline.VertexBufferConsumer; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.opengl.GL11; @@ -58,11 +58,11 @@ public class AnimationModelBase extends M GlStateManager.pushMatrix(); GlStateManager.rotate(180, 0, 0, 1); Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldRenderer = tessellator.getWorldRenderer(); - worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); - worldRenderer.setTranslation(-0.5, -1.5, -0.5); + VertexBuffer VertexBuffer = tessellator.getVertexBuffer(); + VertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); + VertexBuffer.setTranslation(-0.5, -1.5, -0.5); - lighter.setParent(new WorldRendererConsumer(worldRenderer)); + lighter.setParent(new VertexBufferConsumer(VertexBuffer)); lighter.setWorld(entity.worldObj); lighter.setBlock(Blocks.air); lighter.setBlockPos(pos); @@ -92,12 +92,12 @@ public class AnimationModelBase extends M } // debug quad - /*worldRenderer.pos(0, 1, 0).color(0xFF, 0xFF, 0xFF, 0xFF).tex(0, 0).lightmap(240, 0).endVertex(); - worldRenderer.pos(0, 1, 1).color(0xFF, 0xFF, 0xFF, 0xFF).tex(0, 1).lightmap(240, 0).endVertex(); - worldRenderer.pos(1, 1, 1).color(0xFF, 0xFF, 0xFF, 0xFF).tex(1, 1).lightmap(240, 0).endVertex(); - worldRenderer.pos(1, 1, 0).color(0xFF, 0xFF, 0xFF, 0xFF).tex(1, 0).lightmap(240, 0).endVertex();*/ + /*VertexBuffer.pos(0, 1, 0).color(0xFF, 0xFF, 0xFF, 0xFF).tex(0, 0).lightmap(240, 0).endVertex(); + VertexBuffer.pos(0, 1, 1).color(0xFF, 0xFF, 0xFF, 0xFF).tex(0, 1).lightmap(240, 0).endVertex(); + VertexBuffer.pos(1, 1, 1).color(0xFF, 0xFF, 0xFF, 0xFF).tex(1, 1).lightmap(240, 0).endVertex(); + VertexBuffer.pos(1, 1, 0).color(0xFF, 0xFF, 0xFF, 0xFF).tex(1, 0).lightmap(240, 0).endVertex();*/ - worldRenderer.setTranslation(0, 0, 0); + VertexBuffer.setTranslation(0, 0, 0); tessellator.draw(); GlStateManager.popMatrix(); diff --git a/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java b/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java index 56a6d89644..62224462cd 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java +++ b/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java @@ -5,10 +5,10 @@ import java.util.concurrent.TimeUnit; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.model.IModelState; @@ -47,7 +47,7 @@ public class AnimationTESR extends Fa return modelCache.getUnchecked(Pair.of(state, modelState)); } - public void renderTileEntityFast(T te, double x, double y, double z, float partialTick, int breakStage, WorldRenderer renderer) + public void renderTileEntityFast(T te, double x, double y, double z, float partialTick, int breakStage, VertexBuffer renderer) { if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); BlockPos pos = te.getPos(); diff --git a/src/main/java/net/minecraftforge/client/model/animation/Clips.java b/src/main/java/net/minecraftforge/client/model/animation/Clips.java index c673ff60bb..1fbb8711f3 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/Clips.java +++ b/src/main/java/net/minecraftforge/client/model/animation/Clips.java @@ -2,7 +2,7 @@ package net.minecraftforge.client.model.animation; import java.io.IOException; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.IStringSerializable; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/net/minecraftforge/client/model/animation/FastTESR.java b/src/main/java/net/minecraftforge/client/model/animation/FastTESR.java index ed3baad490..3b8bcdd452 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/FastTESR.java +++ b/src/main/java/net/minecraftforge/client/model/animation/FastTESR.java @@ -6,7 +6,7 @@ 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.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; @@ -18,7 +18,7 @@ public abstract class FastTESR extends TileEntitySpecialRe public final void renderTileEntityAt(T te, double x, double y, double z, float partialTicks, int destroyStage) { Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldRenderer = tessellator.getWorldRenderer(); + VertexBuffer VertexBuffer = tessellator.getVertexBuffer(); this.bindTexture(TextureMap.locationBlocksTexture); RenderHelper.disableStandardItemLighting(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); @@ -34,10 +34,10 @@ public abstract class FastTESR extends TileEntitySpecialRe GlStateManager.shadeModel(GL11.GL_FLAT); } - worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); + VertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); - renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, worldRenderer); - worldRenderer.setTranslation(0, 0, 0); + renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, VertexBuffer); + VertexBuffer.setTranslation(0, 0, 0); tessellator.draw(); @@ -45,5 +45,5 @@ public abstract class FastTESR extends TileEntitySpecialRe } @Override - public abstract void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, WorldRenderer worldRenderer); + public abstract void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, VertexBuffer VertexBuffer); } diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index b988721468..1c6cb7a585 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -28,7 +28,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.IResource; import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java b/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java index 2ea9676e55..abc813a1e8 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java @@ -2,7 +2,7 @@ package net.minecraftforge.client.model.pipeline; import net.minecraft.block.Block; import net.minecraft.block.Block.EnumOffsetType; -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; diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java b/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java index f7c7cf1965..e6efd48a45 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java @@ -4,10 +4,10 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.renderer.BlockModelRenderer; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.util.BlockPos; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.ForgeModContainer; @@ -32,20 +32,20 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer } }; - private final ThreadLocal wrFlat = new ThreadLocal(); - private final ThreadLocal wrSmooth = new ThreadLocal(); - private final ThreadLocal lastRendererFlat = new ThreadLocal(); - private final ThreadLocal lastRendererSmooth = new ThreadLocal(); + private final ThreadLocal wrFlat = new ThreadLocal(); + private final ThreadLocal wrSmooth = new ThreadLocal(); + private final ThreadLocal lastRendererFlat = new ThreadLocal(); + private final ThreadLocal lastRendererSmooth = new ThreadLocal(); @Override - public boolean renderModelStandard(IBlockAccess world, IBakedModel model, Block block, BlockPos pos, WorldRenderer wr, boolean checkSides) + public boolean renderModelStandard(IBlockAccess world, IBakedModel model, Block block, BlockPos pos, VertexBuffer wr, boolean checkSides) { if(ForgeModContainer.forgeLightPipelineEnabled) { if(wr != lastRendererFlat.get()) { lastRendererFlat.set(wr); - WorldRendererConsumer newCons = new WorldRendererConsumer(wr); + VertexBufferConsumer newCons = new VertexBufferConsumer(wr); wrFlat.set(newCons); lighterFlat.get().setParent(newCons); } @@ -59,14 +59,14 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer } @Override - public boolean renderModelAmbientOcclusion(IBlockAccess world, IBakedModel model, Block block, BlockPos pos, WorldRenderer wr, boolean checkSides) + public boolean renderModelAmbientOcclusion(IBlockAccess world, IBakedModel model, Block block, BlockPos pos, VertexBuffer wr, boolean checkSides) { if(ForgeModContainer.forgeLightPipelineEnabled) { if(wr != lastRendererSmooth.get()) { lastRendererSmooth.set(wr); - WorldRendererConsumer newCons = new WorldRendererConsumer(wr); + VertexBufferConsumer newCons = new VertexBufferConsumer(wr); wrSmooth.set(newCons); lighterSmooth.get().setParent(newCons); } @@ -79,7 +79,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer } } - public static boolean render(VertexLighterFlat lighter, IBlockAccess world, IBakedModel model, Block block, BlockPos pos, WorldRenderer wr, boolean checkSides) + public static boolean render(VertexLighterFlat lighter, IBlockAccess world, IBakedModel model, Block block, BlockPos pos, VertexBuffer wr, boolean checkSides) { lighter.setWorld(world); lighter.setBlock(block); diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java index 9a23a1109a..cd5cfa5dab 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java @@ -1,7 +1,7 @@ package net.minecraftforge.client.model.pipeline; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; @@ -240,8 +240,8 @@ public class LightUtil if(tessellator == null) { Tessellator tes = Tessellator.getInstance(); - WorldRenderer wr = tes.getWorldRenderer(); - tessellator = new WorldRendererConsumer(wr); + VertexBuffer wr = tes.getVertexBuffer(); + tessellator = new VertexBufferConsumer(wr); } return tessellator; } @@ -257,16 +257,16 @@ public class LightUtil } // renders quad in any Vertex Format, but is slower - public static void renderQuadColorSlow(WorldRenderer wr, BakedQuad quad, int auxColor) + public static void renderQuadColorSlow(VertexBuffer wr, BakedQuad quad, int auxColor) { ItemConsumer cons; - if(wr == Tessellator.getInstance().getWorldRenderer()) + if(wr == Tessellator.getInstance().getVertexBuffer()) { cons = getItemConsumer(); } else { - cons = new ItemConsumer(new WorldRendererConsumer(wr)); + cons = new ItemConsumer(new VertexBufferConsumer(wr)); } float b = (float)(auxColor & 0xFF) / 0xFF; float g = (float)((auxColor >>> 8) & 0xFF) / 0xFF; @@ -277,7 +277,7 @@ public class LightUtil quad.pipe(cons); } - public static void renderQuadColor(WorldRenderer wr, BakedQuad quad, int auxColor) + public static void renderQuadColor(VertexBuffer wr, BakedQuad quad, int auxColor) { wr.addVertexData(quad.getVertexData()); if(quad instanceof IColoredBakedQuad) diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java index ca23d9fc09..2e6bec66b1 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java @@ -8,7 +8,7 @@ import net.minecraft.block.Block; import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; @@ -154,7 +154,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer switch(element.getUsage()) { case POSITION: - // position adding moved to WorldRendererConsumer due to x and z not fitting completely into a float + // position adding moved to VertexBufferConsumer due to x and z not fitting completely into a float /*float[] pos = new float[4]; System.arraycopy(position[v], 0, pos, 0, position[v].length); pos[0] += blockInfo.getBlockPos().getX(); diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/WorldRendererConsumer.java b/src/main/java/net/minecraftforge/client/model/pipeline/WorldRendererConsumer.java index 9822afdac1..a1b9537110 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/WorldRendererConsumer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/WorldRendererConsumer.java @@ -1,23 +1,23 @@ package net.minecraftforge.client.model.pipeline; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; /** * Assumes VertexFormatElement is present in the WorlRenderer's vertex format. */ -public class WorldRendererConsumer implements IVertexConsumer +public class VertexBufferConsumer implements IVertexConsumer { private static final float[] dummyColor = new float[]{ 1, 1, 1, 1 }; - private final WorldRenderer renderer; + private final VertexBuffer renderer; private final int[] quadData; private int v = 0; private BlockPos offset = BlockPos.ORIGIN; - public WorldRendererConsumer(WorldRenderer renderer) + public VertexBufferConsumer(VertexBuffer renderer) { super(); this.renderer = renderer; diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index fc6fb725a7..28f7a00192 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -557,13 +557,13 @@ public class ForgeHooks "((?:[a-z0-9]{2,}:\\/\\/)?(?:(?:[0-9]{1,3}\\.){3}[0-9]{1,3}|(?:[-\\w_\\.]{1,}\\.[a-z]{2,}?))(?::[0-9]{1,5})?.*?(?=[!\"\u00A7 \n]|$))", Pattern.CASE_INSENSITIVE); - public static IChatComponent newChatWithLinks(String string){ return newChatWithLinks(string, true); } - public static IChatComponent newChatWithLinks(String string, boolean allowMissingHeader) + public static ITextComponent newChatWithLinks(String string){ return newChatWithLinks(string, true); } + public static ITextComponent newChatWithLinks(String string, boolean allowMissingHeader) { // Includes ipv4 and domain pattern // Matches an ip (xx.xxx.xx.xxx) or a domain (something.com) with or // without a protocol or path. - IChatComponent ichat = null; + ITextComponent ichat = null; Matcher matcher = URL_PATTERN.matcher(string); int lastEnd = 0; @@ -578,13 +578,13 @@ public class ForgeHooks if (part.length() > 0) { if (ichat == null) - ichat = new ChatComponentText(part); + ichat = new TextComponentString(part); else ichat.appendText(part); } lastEnd = end; String url = string.substring(start, end); - IChatComponent link = new ChatComponentText(url); + ITextComponent link = new TextComponentString(url); try { @@ -594,7 +594,7 @@ public class ForgeHooks if (!allowMissingHeader) { if (ichat == null) - ichat = new ChatComponentText(url); + ichat = new TextComponentString(url); else ichat.appendText(url); continue; @@ -605,7 +605,7 @@ public class ForgeHooks catch (URISyntaxException e) { // Bad syntax bail out! - if (ichat == null) ichat = new ChatComponentText(url); + if (ichat == null) ichat = new TextComponentString(url); else ichat.appendText(url); continue; } @@ -624,7 +624,7 @@ public class ForgeHooks // Append the rest of the message. String end = string.substring(lastEnd); if (ichat == null) - ichat = new ChatComponentText(end); + ichat = new TextComponentString(end); else if (end.length() > 0) ichat.appendText(string.substring(lastEnd)); return ichat; diff --git a/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java b/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java index 25166eec9a..5a5978428f 100644 --- a/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java +++ b/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java @@ -7,7 +7,7 @@ import java.util.Map; import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import com.google.common.base.Optional; @@ -18,7 +18,7 @@ import com.google.common.collect.ImmutableTable; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; -public class ExtendedBlockState extends BlockState +public class ExtendedBlockState extends BlockStateContainer { private final ImmutableSet> unlistedProperties; @@ -32,7 +32,7 @@ public class ExtendedBlockState extends BlockState } this.unlistedProperties = builder.build(); } - + public Collection> getUnlistedProperties() { return unlistedProperties; @@ -143,13 +143,13 @@ public class ExtendedBlockState extends BlockState this.normalMap = map; super.buildPropertyValueTable(map); } - + private ExtendedStateImplementation setMap(@SuppressWarnings("rawtypes") Map, BlockState.StateImplementation> map) { this.normalMap = map; return this; } - + public IBlockState getClean() { return this.normalMap.get(getProperties()); diff --git a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java index fc58bb62bf..60104a0f7e 100644 --- a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java +++ b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java @@ -5,7 +5,7 @@ import java.io.Serializable; import net.minecraft.block.state.IBlockState; 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 net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.common.registry.GameRegistry; diff --git a/src/main/java/net/minecraftforge/common/util/FakePlayer.java b/src/main/java/net/minecraftforge/common/util/FakePlayer.java index 3cbb21eb21..27223a93e5 100644 --- a/src/main/java/net/minecraftforge/common/util/FakePlayer.java +++ b/src/main/java/net/minecraftforge/common/util/FakePlayer.java @@ -9,7 +9,7 @@ import net.minecraft.network.play.client.C15PacketClientSettings; import net.minecraft.server.management.ItemInWorldManager; import net.minecraft.stats.StatBase; import net.minecraft.util.DamageSource; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraft.world.WorldServer; @@ -24,7 +24,7 @@ public class FakePlayer extends EntityPlayerMP @Override public Vec3 getPositionVector(){ return new Vec3(0, 0, 0); } @Override public boolean canCommandSenderUseCommand(int i, String s){ return false; } - @Override public void addChatComponentMessage(IChatComponent chatmessagecomponent){} + @Override public void addChatComponentMessage(ITextComponent chatmessagecomponent){} @Override public void addStat(StatBase par1StatBase, int par2){} @Override public void openGui(Object mod, int modGuiId, World world, int x, int y, int z){} @Override public boolean isEntityInvulnerable(DamageSource source){ return true; } diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index ba9ed21da2..378a5106dc 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -263,7 +263,7 @@ public class ForgeEventFactory MinecraftForge.EVENT_BUS.post(new PlayerEvent.LoadFromFile(player, dir, uuidString)); } - public static IChatComponent onClientChat(byte type, IChatComponent message) + public static ITextComponent onClientChat(byte type, ITextComponent message) { ClientChatReceivedEvent event = new ClientChatReceivedEvent(type, message); return MinecraftForge.EVENT_BUS.post(event) ? null : event.message; diff --git a/src/main/java/net/minecraftforge/event/ServerChatEvent.java b/src/main/java/net/minecraftforge/event/ServerChatEvent.java index 69f9ce56c5..71e615573c 100644 --- a/src/main/java/net/minecraftforge/event/ServerChatEvent.java +++ b/src/main/java/net/minecraftforge/event/ServerChatEvent.java @@ -4,7 +4,7 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; /** * ServerChatEvent is fired whenever a C01PacketChatMessage is processed.
@@ -39,7 +39,7 @@ public class ServerChatEvent extends Event this.component = component; } - public void setComponent(IChatComponent e) + public void setComponent(ITextComponent e) { if (e instanceof ChatComponentTranslation) this.component = (ChatComponentTranslation)e; @@ -47,7 +47,7 @@ public class ServerChatEvent extends Event this.component = new ChatComponentTranslation("%s", e); } - public IChatComponent getComponent() + public ITextComponent getComponent() { return this.component; } diff --git a/src/main/java/net/minecraftforge/event/entity/minecart/MinecartUpdateEvent.java b/src/main/java/net/minecraftforge/event/entity/minecart/MinecartUpdateEvent.java index 23d247f1b1..7b458958c8 100644 --- a/src/main/java/net/minecraftforge/event/entity/minecart/MinecartUpdateEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/minecart/MinecartUpdateEvent.java @@ -1,7 +1,7 @@ package net.minecraftforge.event.entity.minecart; import net.minecraft.entity.item.EntityMinecart; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; /** * MinecartUpdateEvent is fired when a minecart is updated.
diff --git a/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java b/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java index efd23ace5c..d849c4ce68 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java @@ -4,7 +4,7 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @Cancelable diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java index 50b3857834..6b8ee48e7b 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java @@ -6,7 +6,7 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.event.entity.living.LivingEvent; /** diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java index 3eb8d28d61..76fa00d5c6 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java @@ -3,9 +3,9 @@ package net.minecraftforge.event.entity.player; import static net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT; import static net.minecraftforge.fml.common.eventhandler.Event.Result.DENY; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.fml.common.eventhandler.Cancelable; @@ -46,7 +46,7 @@ public class PlayerInteractEvent extends PlayerEvent public final World world; public final BlockPos pos; public final EnumFacing face; // Can be null if unknown - public final Vec3 localPos; // Can be null if unknown + public final Vec3d localPos; // Can be null if unknown public Result useBlock = DEFAULT; public Result useItem = DEFAULT; @@ -57,7 +57,7 @@ public class PlayerInteractEvent extends PlayerEvent this(player, action, pos, face, world, null); } - public PlayerInteractEvent(EntityPlayer player, Action action, BlockPos pos, EnumFacing face, World world, Vec3 localPos) + public PlayerInteractEvent(EntityPlayer player, Action action, BlockPos pos, EnumFacing face, World world, Vec3d localPos) { super(player); this.action = action; diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerSetSpawnEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerSetSpawnEvent.java index e2d059a25b..b2e047eac7 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerSetSpawnEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerSetSpawnEvent.java @@ -2,7 +2,7 @@ package net.minecraftforge.event.entity.player; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; @Cancelable public class PlayerSetSpawnEvent extends PlayerEvent diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerSleepInBedEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerSleepInBedEvent.java index 0d256b6ac3..d41d5abeaf 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerSleepInBedEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerSleepInBedEvent.java @@ -2,7 +2,7 @@ package net.minecraftforge.event.entity.player; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer.EnumStatus; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; /** * PlayerSleepInBedEvent is fired when a player sleeps in a bed. diff --git a/src/main/java/net/minecraftforge/event/entity/player/SleepingLocationCheckEvent.java b/src/main/java/net/minecraftforge/event/entity/player/SleepingLocationCheckEvent.java index 0dbd832e19..c7ffaecc56 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/SleepingLocationCheckEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/SleepingLocationCheckEvent.java @@ -1,7 +1,7 @@ package net.minecraftforge.event.entity.player; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.common.eventhandler.Event.HasResult; /** diff --git a/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java b/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java index bc9f50f053..5db0b54f41 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java @@ -2,7 +2,7 @@ package net.minecraftforge.event.entity.player; 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; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; diff --git a/src/main/java/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java b/src/main/java/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java index 67974e3f9e..05c43e4b6a 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java +++ b/src/main/java/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java @@ -1,7 +1,7 @@ package net.minecraftforge.event.terraingen; import java.util.Random; -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/net/minecraftforge/event/world/ExplosionEvent.java b/src/main/java/net/minecraftforge/event/world/ExplosionEvent.java index 167c09724b..03751b0124 100644 --- a/src/main/java/net/minecraftforge/event/world/ExplosionEvent.java +++ b/src/main/java/net/minecraftforge/event/world/ExplosionEvent.java @@ -5,7 +5,7 @@ import java.util.List; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.entity.Entity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.Explosion; import net.minecraft.world.World; diff --git a/src/main/java/net/minecraftforge/event/world/WorldEvent.java b/src/main/java/net/minecraftforge/event/world/WorldEvent.java index 9e8bc166be..23779dc153 100644 --- a/src/main/java/net/minecraftforge/event/world/WorldEvent.java +++ b/src/main/java/net/minecraftforge/event/world/WorldEvent.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.entity.EnumCreatureType; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldSettings; import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry; diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java b/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java index b5828a447f..9080d6dae2 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java @@ -13,9 +13,9 @@ import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.util.AxisAlignedBB; -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.Vec3; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -113,7 +113,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock protected int temperature = 295; protected int tickRate = 20; - protected EnumWorldBlockLayer renderLayer = EnumWorldBlockLayer.TRANSLUCENT; + protected BlockRenderLayer renderLayer = BlockRenderLayer.TRANSLUCENT; protected int maxScaledLight = 0; protected final String fluidName; @@ -185,7 +185,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return this; } - public BlockFluidBase setRenderLayer(EnumWorldBlockLayer renderLayer) + public BlockFluidBase setRenderLayer(BlockRenderLayer renderLayer) { this.renderLayer = renderLayer; return this; @@ -404,7 +404,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer() { return this.renderLayer; } diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java b/src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java index 3cd307bfe8..e982879e29 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java @@ -6,7 +6,7 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; 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.IBlockAccess; import net.minecraft.world.World; diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java b/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java index 83c2f1a570..6c048ce545 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java @@ -5,7 +5,7 @@ import java.util.Random; 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.util.MathHelper; import net.minecraft.world.IBlockAccess; diff --git a/src/main/java/net/minecraftforge/fluids/Fluid.java b/src/main/java/net/minecraftforge/fluids/Fluid.java index c533506fa5..4ecfd4a408 100644 --- a/src/main/java/net/minecraftforge/fluids/Fluid.java +++ b/src/main/java/net/minecraftforge/fluids/Fluid.java @@ -2,7 +2,7 @@ package net.minecraftforge.fluids; import java.util.Locale; import net.minecraft.block.Block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraft.world.World; diff --git a/src/main/java/net/minecraftforge/fluids/FluidEvent.java b/src/main/java/net/minecraftforge/fluids/FluidEvent.java index 9c4a2124ff..7bb34f14ea 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidEvent.java +++ b/src/main/java/net/minecraftforge/fluids/FluidEvent.java @@ -1,7 +1,7 @@ package net.minecraftforge.fluids; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.Event; diff --git a/src/main/java/net/minecraftforge/fluids/FluidUtil.java b/src/main/java/net/minecraftforge/fluids/FluidUtil.java index 7368df3a95..02b1fae1d5 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidUtil.java +++ b/src/main/java/net/minecraftforge/fluids/FluidUtil.java @@ -8,7 +8,7 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; 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.ReportedException; import net.minecraft.world.World; diff --git a/src/main/java/net/minecraftforge/fluids/IFluidBlock.java b/src/main/java/net/minecraftforge/fluids/IFluidBlock.java index da78c9fb80..49b8dfc37f 100644 --- a/src/main/java/net/minecraftforge/fluids/IFluidBlock.java +++ b/src/main/java/net/minecraftforge/fluids/IFluidBlock.java @@ -1,6 +1,6 @@ package net.minecraftforge.fluids; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** diff --git a/src/main/java/net/minecraftforge/fluids/UniversalBucket.java b/src/main/java/net/minecraftforge/fluids/UniversalBucket.java index c6f51a97a0..86a4452808 100644 --- a/src/main/java/net/minecraftforge/fluids/UniversalBucket.java +++ b/src/main/java/net/minecraftforge/fluids/UniversalBucket.java @@ -11,7 +11,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; 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.EnumParticleTypes; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; diff --git a/src/main/java/net/minecraftforge/fml/client/GuiModList.java b/src/main/java/net/minecraftforge/fml/client/GuiModList.java index dadb2a257f..c30b9365f7 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiModList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiModList.java @@ -34,14 +34,14 @@ import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.GuiUtilRenderComponents; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.IResourcePack; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.TextComponentString; +import net.minecraft.util.text.ITextComponent; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StringUtils; import net.minecraftforge.common.ForgeHooks; @@ -451,7 +451,7 @@ public class GuiModList extends GuiScreen { private ResourceLocation logoPath; private Dimension logoDims; - private List lines = null; + private List lines = null; public Info(int width, List lines, ResourceLocation logoPath, Dimension logoDims) { @@ -475,9 +475,9 @@ public class GuiModList extends GuiScreen @Override protected void drawBackground() {} @Override protected void drawSlot(int slotIdx, int entryRight, int slotTop, int slotBuffer, Tessellator tess) { } - private List resizeContent(List lines) + private List resizeContent(List lines) { - List ret = new ArrayList(); + List ret = new ArrayList(); for (String line : lines) { if (line == null) @@ -486,7 +486,7 @@ public class GuiModList extends GuiScreen continue; } - IChatComponent chat = ForgeHooks.newChatWithLinks(line, false); + ITextComponent chat = ForgeHooks.newChatWithLinks(line, false); ret.addAll(GuiUtilRenderComponents.func_178908_a(chat, this.listWidth-8, GuiModList.this.fontRendererObj, false, true)); } return ret; @@ -524,7 +524,7 @@ public class GuiModList extends GuiScreen { GlStateManager.enableBlend(); GuiModList.this.mc.renderEngine.bindTexture(logoPath); - WorldRenderer wr = tess.getWorldRenderer(); + VertexBuffer wr = tess.getVertexBuffer(); int offset = (this.left + this.listWidth/2) - (logoDims.width / 2); wr.begin(7, DefaultVertexFormats.POSITION_TEX); wr.pos(offset, top + logoDims.height, zLevel).tex(0, 1).endVertex(); @@ -536,7 +536,7 @@ public class GuiModList extends GuiScreen top += logoDims.height + 10; } - for (IChatComponent line : lines) + for (ITextComponent line : lines) { if (line != null) { @@ -563,14 +563,14 @@ public class GuiModList extends GuiScreen if (lineIdx >= lines.size()) return; - IChatComponent line = lines.get(lineIdx); + ITextComponent line = lines.get(lineIdx); if (line != null) { int k = -4; - for (IChatComponent part : (Iterable)line) { - if (!(part instanceof ChatComponentText)) + for (ITextComponent part : (Iterable)line) { + if (!(part instanceof TextComponentString)) continue; - k += GuiModList.this.fontRendererObj.getStringWidth(((ChatComponentText)part).getChatComponentText_TextValue()); + k += GuiModList.this.fontRendererObj.getStringWidth(((TextComponentString)part).getTextComponentString_TextValue()); if (k >= x) { GuiModList.this.handleComponentClick(part); diff --git a/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java b/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java index 1e602680ff..825e85d019 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java @@ -20,7 +20,7 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import org.lwjgl.input.Mouse; @@ -263,7 +263,7 @@ public abstract class GuiScrollingList this.applyScrollLimits(); Tessellator tess = Tessellator.getInstance(); - WorldRenderer worldr = tess.getWorldRenderer(); + VertexBuffer worldr = tess.getVertexBuffer(); ScaledResolution res = new ScaledResolution(client); double scaleW = client.displayWidth / res.getScaledWidth_double(); @@ -390,12 +390,12 @@ public abstract class GuiScrollingList GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); - worldrenderer.pos(right, top, 0.0D).color(r1, g1, b1, a1).endVertex(); - worldrenderer.pos(left, top, 0.0D).color(r1, g1, b1, a1).endVertex(); - worldrenderer.pos(left, bottom, 0.0D).color(r2, g2, b2, a2).endVertex(); - worldrenderer.pos(right, bottom, 0.0D).color(r2, g2, b2, a2).endVertex(); + VertexBuffer VertexBuffer = tessellator.getVertexBuffer(); + VertexBuffer.begin(7, DefaultVertexFormats.POSITION_COLOR); + VertexBuffer.pos(right, top, 0.0D).color(r1, g1, b1, a1).endVertex(); + VertexBuffer.pos(left, top, 0.0D).color(r1, g1, b1, a1).endVertex(); + VertexBuffer.pos(left, bottom, 0.0D).color(r2, g2, b2, a2).endVertex(); + VertexBuffer.pos(right, bottom, 0.0D).color(r2, g2, b2, a2).endVertex(); tessellator.draw(); GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.disableBlend(); diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java b/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java index 7b10713640..c24ebd8403 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java @@ -23,7 +23,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; -import net.minecraft.util.ChatComponentText; +import net.minecraft.util.TextComponentString; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.config.GuiConfigEntries.IConfigEntry; import net.minecraftforge.fml.client.event.ConfigChangedEvent; @@ -247,7 +247,7 @@ public class GuiConfig extends GuiScreen { flag = false; mc.displayGuiScreen(new GuiMessageDialog(parentScreen, "fml.configgui.gameRestartTitle", - new ChatComponentText(I18n.format("fml.configgui.gameRestartRequired")), "fml.configgui.confirmRestartMessage")); + new TextComponentString(I18n.format("fml.configgui.gameRestartRequired")), "fml.configgui.confirmRestartMessage")); } if (this.parentScreen instanceof GuiConfig) diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiMessageDialog.java b/src/main/java/net/minecraftforge/fml/client/config/GuiMessageDialog.java index 863229afc4..bb34783706 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiMessageDialog.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiMessageDialog.java @@ -4,13 +4,13 @@ import net.minecraft.client.gui.GuiDisconnected; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; public class GuiMessageDialog extends GuiDisconnected { protected String buttonText; - public GuiMessageDialog(GuiScreen nextScreen, String title, IChatComponent message, String buttonText) + public GuiMessageDialog(GuiScreen nextScreen, String title, ITextComponent message, String buttonText) { super(nextScreen, title, message); this.buttonText = buttonText; diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java b/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java index ecf5f36d9a..d8fde51914 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java @@ -15,7 +15,7 @@ package net.minecraftforge.fml.client.config; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.ResourceLocation; @@ -184,7 +184,7 @@ public class GuiUtils float uScale = 1f / 0x100; float vScale = 1f / 0x100; Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer wr = tessellator.getWorldRenderer(); + VertexBuffer wr = tessellator.getVertexBuffer(); wr.begin(7, DefaultVertexFormats.POSITION_TEX); wr.pos(x , y + height, zLevel).tex( u * uScale, ((v + height) * vScale)).endVertex(); wr.pos(x + width, y + height, zLevel).tex((u + width) * uScale, ((v + height) * vScale)).endVertex(); diff --git a/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java b/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java index d42da0f323..29183959f2 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java @@ -42,7 +42,7 @@ import net.minecraft.network.NetworkManager; import net.minecraft.network.handshake.client.C00Handshake; import net.minecraft.network.login.server.S00PacketDisconnect; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.ChatComponentText; +import net.minecraft.util.TextComponentString; import net.minecraft.util.IThreadListener; import net.minecraft.world.World; import net.minecraft.world.storage.SaveHandler; @@ -609,7 +609,7 @@ public class FMLCommonHandler { if (!shouldAllowPlayerLogins()) { - ChatComponentText text = new ChatComponentText("Server is still starting! Please wait before reconnecting."); + TextComponentString text = new TextComponentString("Server is still starting! Please wait before reconnecting."); FMLLog.info("Disconnecting Player: " + text.getUnformattedText()); manager.sendPacket(new S00PacketDisconnect(text)); manager.closeChannel(text); @@ -619,7 +619,7 @@ public class FMLCommonHandler if (packet.getRequestedState() == EnumConnectionState.LOGIN && (!NetworkRegistry.INSTANCE.isVanillaAccepted(Side.CLIENT) && !packet.hasFMLMarker())) { manager.setConnectionState(EnumConnectionState.LOGIN); - ChatComponentText text = new ChatComponentText("This server requires FML/Forge to be installed. Contact your server admin for more details."); + TextComponentString text = new TextComponentString("This server requires FML/Forge to be installed. Contact your server admin for more details."); FMLLog.info("Disconnecting Player: " + text.getUnformattedText()); manager.sendPacket(new S00PacketDisconnect(text)); manager.closeChannel(text); diff --git a/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java b/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java index cf37465851..a88abe4cf8 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java +++ b/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java @@ -32,7 +32,7 @@ import net.minecraft.network.play.server.S01PacketJoinGame; import net.minecraft.network.play.server.S3FPacketCustomPayload; import net.minecraft.network.play.server.S40PacketDisconnect; import net.minecraft.server.management.ServerConfigurationManager; -import net.minecraft.util.ChatComponentText; +import net.minecraft.util.TextComponentString; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -235,7 +235,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple this.state = ConnectionState.CONNECTED; MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ServerConnectionFromClientEvent(manager)); if (DEBUG_HANDSHAKE) - manager.closeChannel(new ChatComponentText("Handshake Complete review log file for details.")); + manager.closeChannel(new TextComponentString("Handshake Complete review log file for details.")); scm.initializeConnectionToPlayer(manager, player, serverHandler); } @@ -306,19 +306,19 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple @SuppressWarnings("unchecked") private void kickWithMessage(String message) { - final ChatComponentText chatcomponenttext = new ChatComponentText(message); + final TextComponentString TextComponentString = new TextComponentString(message); if (side == Side.CLIENT) { - manager.closeChannel(chatcomponenttext); + manager.closeChannel(TextComponentString); } else { - manager.sendPacket(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener>() + manager.sendPacket(new S40PacketDisconnect(TextComponentString), new GenericFutureListener>() { @Override public void operationComplete(Future result) { - manager.closeChannel(chatcomponenttext); + manager.closeChannel(TextComponentString); } }, new GenericFutureListener[0]); } diff --git a/src/main/java/net/minecraftforge/items/VanillaDoubleChestItemHandler.java b/src/main/java/net/minecraftforge/items/VanillaDoubleChestItemHandler.java index 09100c7f04..90232a6757 100644 --- a/src/main/java/net/minecraftforge/items/VanillaDoubleChestItemHandler.java +++ b/src/main/java/net/minecraftforge/items/VanillaDoubleChestItemHandler.java @@ -4,7 +4,7 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; -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/net/minecraftforge/server/command/ForgeCommand.java b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java index 93cadbb844..39556c8597 100644 --- a/src/main/java/net/minecraftforge/server/command/ForgeCommand.java +++ b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java @@ -9,7 +9,7 @@ import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentTranslation; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.server.ForgeTimeTracker; diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index c454024ee4..229cde6951 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -141,12 +141,12 @@ public net.minecraft.client.renderer.block.model.ModelBlock field_178322_i # amb # EnumFacing public net.minecraft.util.EnumFacing field_82609_l # VALUES public net.minecraft.util.EnumFacing field_176754_o # HORIZONTALS -#public net.minecraft.client.renderer.WorldRenderer func_78909_a(I)I # getColorIndex -#public net.minecraft.client.renderer.WorldRenderer func_178972_a(IIIII)V # putColorRGBA +#public net.minecraft.client.renderer.VertexBuffer func_78909_a(I)I # getColorIndex +#public net.minecraft.client.renderer.VertexBuffer func_178972_a(IIIII)V # putColorRGBA # ModelBlock Constructor #public net.minecraft.client.renderer.block.model.ModelBlock (Lnet/minecraft/util/ResourceLocation;Ljava/util/List;Ljava/util/Map;ZZLnet/minecraft/client/renderer/block/model/ItemCameraTransforms;)V # RenderLivingEntity -#public net.minecraft.client.renderer.entity.RendererLivingEntity func_177094_a(Lnet/minecraft/client/renderer/entity/layers/LayerRenderer;)Z # addLayer +#public net.minecraft.client.renderer.entity.RenderLivingBase func_177094_a(Lnet/minecraft/client/renderer/entity/layers/LayerRenderer;)Z # addLayer # S00PacketServerInfo #public net.minecraft.network.status.server.S00PacketServerInfo field_149297_a # GSON diff --git a/src/test/java/net/minecraftforge/debug/DynBucketTest.java b/src/test/java/net/minecraftforge/debug/DynBucketTest.java index 74f8645d6c..52345558c5 100644 --- a/src/test/java/net/minecraftforge/debug/DynBucketTest.java +++ b/src/test/java/net/minecraftforge/debug/DynBucketTest.java @@ -4,8 +4,8 @@ import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelBakery; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; @@ -14,10 +14,10 @@ import net.minecraft.item.ItemStack; 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.BlockPos; -import net.minecraft.util.ChatComponentText; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentString; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -212,7 +212,7 @@ public class DynBucketTest IFluidHandler tank = (IFluidHandler) te; side = side.getOpposite(); - ItemStack stack = playerIn.getHeldItem(); + ItemStack stack = playerIn.inventory.getCurrentItem(); if (stack == null) { sendText(playerIn, tank, side); @@ -245,7 +245,7 @@ public class DynBucketTest { text = "empty"; } - player.addChatMessage(new ChatComponentText(text)); + player.addChatMessage(new TextComponentString(text)); } } } @@ -318,11 +318,11 @@ public class DynBucketTest public Packet getDescriptionPacket() { NBTTagCompound tag = new NBTTagCompound(); writeToNBT(tag); - return new S35PacketUpdateTileEntity(this.getPos(), this.getBlockMetadata(), tag); + return new SPacketUpdateTileEntity(this.getPos(), this.getBlockMetadata(), tag); } @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) { super.onDataPacket(net, pkt); readFromNBT(pkt.getNbtCompound()); } diff --git a/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java b/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java index 6fe7468fb7..9c34e9fca7 100644 --- a/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java +++ b/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java @@ -7,11 +7,11 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockWall; 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.client.renderer.block.statemap.IStateMapper; import net.minecraft.client.renderer.block.statemap.StateMap; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; @@ -102,8 +102,8 @@ public class ForgeBlockStatesLoaderDebug { } @Override - protected BlockState createBlockState() { - return new BlockState(this, VARIANT); + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, VARIANT); } @Override diff --git a/src/test/java/net/minecraftforge/debug/ItemLayerModelDebug.java b/src/test/java/net/minecraftforge/debug/ItemLayerModelDebug.java index da52b7f666..296ba40668 100644 --- a/src/test/java/net/minecraftforge/debug/ItemLayerModelDebug.java +++ b/src/test/java/net/minecraftforge/debug/ItemLayerModelDebug.java @@ -1,6 +1,6 @@ package net.minecraftforge.debug; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraftforge.client.model.ModelLoader; diff --git a/src/test/java/net/minecraftforge/debug/ItemTileDebug.java b/src/test/java/net/minecraftforge/debug/ItemTileDebug.java index 6a21bba966..2330b0195f 100644 --- a/src/test/java/net/minecraftforge/debug/ItemTileDebug.java +++ b/src/test/java/net/minecraftforge/debug/ItemTileDebug.java @@ -4,7 +4,7 @@ import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; diff --git a/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java b/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java index f6559bc2fa..3bf068eb59 100644 --- a/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java +++ b/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java @@ -14,12 +14,12 @@ import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.BlockRenderLayer; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.model.IFlexibleBakedModel; import net.minecraftforge.client.model.ISmartBlockModel; @@ -133,9 +133,9 @@ public class LayerBreakingTest } @Override - public boolean canRenderInLayer(EnumWorldBlockLayer layer) + public boolean canRenderInLayer(BlockRenderLayer layer) { - return layer == EnumWorldBlockLayer.SOLID || layer == EnumWorldBlockLayer.TRANSLUCENT; + return layer == BlockRenderLayer.SOLID || layer == BlockRenderLayer.TRANSLUCENT; } }; @@ -196,7 +196,7 @@ public class LayerBreakingTest solid = new TestBakedModel(models.getModelForState(Blocks.cobblestone.getDefaultState()).getParticleTexture(), false); } - if (net.minecraftforge.client.MinecraftForgeClient.getRenderLayer() == EnumWorldBlockLayer.SOLID) + if (net.minecraftforge.client.MinecraftForgeClient.getRenderLayer() == BlockRenderLayer.SOLID) { return solid; } diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index 81eb2cfc22..8ae2a8b81b 100644 --- a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -12,7 +12,7 @@ import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; @@ -20,7 +20,7 @@ import net.minecraft.entity.SharedMonsterAttributes; 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.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.world.IBlockAccess; diff --git a/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java b/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java index fc61e2a51a..524b546f04 100644 --- a/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java @@ -9,20 +9,22 @@ 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.client.Minecraft; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.statemap.StateMapperBase; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; 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.BlockPos; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.util.EnumFacing; import net.minecraft.util.Vec3; import net.minecraft.world.IBlockAccess; @@ -158,7 +160,7 @@ public class ModelBakeEventDebug if(te instanceof CustomTileEntity) { CustomTileEntity cte = (CustomTileEntity) te; - Vec3 vec = revRotate(new Vec3(hitX - .5, hitY - .5, hitZ - .5), side).addVector(.5, .5, .5); + Vec3d vec = revRotate(new Vec3d(hitX - .5, hitY - .5, hitZ - .5), side).addVector(.5, .5, .5); IUnlistedProperty property = properties[side.ordinal()]; Integer value = cte.getState().getValue(property); if(value == null) value = 0; @@ -182,7 +184,7 @@ public class ModelBakeEventDebug } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[0], properties); } @@ -247,10 +249,10 @@ public class ModelBakeEventDebug private BakedQuad createSidedBakedQuad(float x1, float x2, float z1, float z2, float y, TextureAtlasSprite texture, EnumFacing side) { - Vec3 v1 = rotate(new Vec3(x1 - .5, y - .5, z1 - .5), side).addVector(.5, .5, .5); - Vec3 v2 = rotate(new Vec3(x1 - .5, y - .5, z2 - .5), side).addVector(.5, .5, .5); - Vec3 v3 = rotate(new Vec3(x2 - .5, y - .5, z2 - .5), side).addVector(.5, .5, .5); - Vec3 v4 = rotate(new Vec3(x2 - .5, y - .5, z1 - .5), side).addVector(.5, .5, .5); + Vec3d v1 = rotate(new Vec3d(x1 - .5, y - .5, z1 - .5), side).addVector(.5, .5, .5); + Vec3d v2 = rotate(new Vec3d(x1 - .5, y - .5, z2 - .5), side).addVector(.5, .5, .5); + Vec3d v3 = rotate(new Vec3d(x2 - .5, y - .5, z2 - .5), side).addVector(.5, .5, .5); + Vec3d v4 = rotate(new Vec3d(x2 - .5, y - .5, z1 - .5), side).addVector(.5, .5, .5); return new BakedQuad(Ints.concat( vertexToInts((float)v1.xCoord, (float)v1.yCoord, (float)v1.zCoord, -1, texture, 0, 0), vertexToInts((float)v2.xCoord, (float)v2.yCoord, (float)v2.zCoord, -1, texture, 0, 16), @@ -317,30 +319,30 @@ public class ModelBakeEventDebug } } - private static Vec3 rotate(Vec3 vec, EnumFacing side) + private static Vec3d rotate(Vec3d vec, EnumFacing side) { switch(side) { - case DOWN: return new Vec3( vec.xCoord, -vec.yCoord, -vec.zCoord); - case UP: return new Vec3( vec.xCoord, vec.yCoord, vec.zCoord); - case NORTH: return new Vec3( vec.xCoord, vec.zCoord, -vec.yCoord); - case SOUTH: return new Vec3( vec.xCoord, -vec.zCoord, vec.yCoord); - case WEST: return new Vec3(-vec.yCoord, vec.xCoord, vec.zCoord); - case EAST: return new Vec3( vec.yCoord, -vec.xCoord, vec.zCoord); + case DOWN: return new Vec3d( vec.xCoord, -vec.yCoord, -vec.zCoord); + case UP: return new Vec3d( vec.xCoord, vec.yCoord, vec.zCoord); + case NORTH: return new Vec3d( vec.xCoord, vec.zCoord, -vec.yCoord); + case SOUTH: return new Vec3d( vec.xCoord, -vec.zCoord, vec.yCoord); + case WEST: return new Vec3d(-vec.yCoord, vec.xCoord, vec.zCoord); + case EAST: return new Vec3d( vec.yCoord, -vec.xCoord, vec.zCoord); } return null; } - private static Vec3 revRotate(Vec3 vec, EnumFacing side) + private static Vec3d revRotate(Vec3d vec, EnumFacing side) { switch(side) { - case DOWN: return new Vec3( vec.xCoord, -vec.yCoord, -vec.zCoord); - case UP: return new Vec3( vec.xCoord, vec.yCoord, vec.zCoord); - case NORTH: return new Vec3( vec.xCoord, -vec.zCoord, vec.yCoord); - case SOUTH: return new Vec3( vec.xCoord, vec.zCoord, -vec.yCoord); - case WEST: return new Vec3( vec.yCoord, -vec.xCoord, vec.zCoord); - case EAST: return new Vec3(-vec.yCoord, vec.xCoord, vec.zCoord); + case DOWN: return new Vec3d( vec.xCoord, -vec.yCoord, -vec.zCoord); + case UP: return new Vec3d( vec.xCoord, vec.yCoord, vec.zCoord); + case NORTH: return new Vec3d( vec.xCoord, -vec.zCoord, vec.yCoord); + case SOUTH: return new Vec3d( vec.xCoord, vec.zCoord, -vec.yCoord); + case WEST: return new Vec3d( vec.yCoord, -vec.xCoord, vec.zCoord); + case EAST: return new Vec3d(-vec.yCoord, vec.xCoord, vec.zCoord); } return null; } diff --git a/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java b/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java index 9a48af70fc..b697f76d91 100644 --- a/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java @@ -4,8 +4,8 @@ import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.statemap.StateMapperBase; -import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelBakery; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; diff --git a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java index 38c6124bc2..a1042a8244 100644 --- a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java @@ -17,21 +17,21 @@ 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.client.Minecraft; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; 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.ChatComponentText; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.TextComponentString; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; -import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -86,26 +86,26 @@ public class ModelLoaderRegistryDebug B3DLoader.instance.addDomain(MODID.toLowerCase()); Item item = Item.getItemFromBlock(CustomModelBlock.instance); ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + CustomModelBlock.name, "inventory")); - + OBJLoader.instance.addDomain(MODID.toLowerCase()); Item item2 = Item.getItemFromBlock(OBJTesseractBlock.instance); ModelLoader.setCustomModelResourceLocation(item2, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJTesseractBlock.name, "inventory")); - + Item item3 = Item.getItemFromBlock(OBJVertexColoring1.instance); ModelLoader.setCustomModelResourceLocation(item3, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJVertexColoring1.name, "inventory")); - + Item item4 = Item.getItemFromBlock(OBJDirectionEye.instance); ModelLoader.setCustomModelResourceLocation(item4, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJDirectionEye.name, "inventory")); - + Item item5 = Item.getItemFromBlock(OBJVertexColoring2.instance); ModelLoader.setCustomModelResourceLocation(item5, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJVertexColoring2.name, "inventory")); - + Item item6 = Item.getItemFromBlock(OBJDirectionBlock.instance); ModelLoader.setCustomModelResourceLocation(item6, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJDirectionBlock.name, "inventory")); - + Item item7 = Item.getItemFromBlock(OBJCustomDataBlock.instance); ModelLoader.setCustomModelResourceLocation(item7, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJCustomDataBlock.name, "inventory")); - + Item item8 = Item.getItemFromBlock(OBJDynamicEye.instance); ModelLoader.setCustomModelResourceLocation(item8, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJDynamicEye.name, "inventory")); } @@ -127,10 +127,10 @@ public class ModelLoaderRegistryDebug } @Override - public boolean isOpaqueCube() { return false; } + public boolean isOpaqueCube(IBlockState state) { return false; } @Override - public boolean isFullCube() { return false; } + public boolean isFullCube(IBlockState state) { return false; } @Override public boolean isVisuallyOpaque() { return false; } @@ -140,19 +140,19 @@ public class ModelLoaderRegistryDebug { return this.getDefaultState().withProperty(FACING, getFacingFromEntity(world, pos, placer)); } - + @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(FACING, EnumFacing.getFront(meta)); } - + @Override public int getMetaFromState(IBlockState state) { return ((EnumFacing) state.getValue(FACING)).getIndex(); } - + @Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { @@ -174,13 +174,13 @@ public class ModelLoaderRegistryDebug } return false; } - + @Override - public BlockState createBlockState() + public BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{B3DLoader.B3DFrameProperty.instance}); } - + public static EnumFacing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLivingBase entityIn) { if (MathHelper.abs((float)entityIn.posX - (float)clickedBlock.getX()) < 2.0F && MathHelper.abs((float)entityIn.posZ - (float)clickedBlock.getZ()) < 2.0F) @@ -217,29 +217,29 @@ public class ModelLoaderRegistryDebug public static final OBJTesseractBlock instance = new OBJTesseractBlock(); public static final String name = "OBJTesseractBlock"; private ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{OBJModel.OBJProperty.instance}); - + private OBJTesseractBlock() { super(Material.iron); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); } - + @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new OBJTesseractTileEntity(); } - - @Override - public boolean isOpaqueCube() { return false; } @Override - public boolean isFullCube() { return false; } + public boolean isOpaqueCube(IBlockState state) { return false; } + + @Override + public boolean isFullCube(IBlockState state) { return false; } @Override public boolean isVisuallyOpaque() { return false; } - + @Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { @@ -247,7 +247,7 @@ public class ModelLoaderRegistryDebug OBJModel.OBJState retState = new OBJModel.OBJState(tileEntity == null ? Lists.newArrayList(OBJModel.Group.ALL) : tileEntity.visible, true); return ((IExtendedBlockState) this.state.getBaseState()).withProperty(OBJModel.OBJProperty.instance, retState); } - + @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { @@ -262,7 +262,7 @@ public class ModelLoaderRegistryDebug { model = ModelLoaderRegistry.getMissingModel(); } - + if (player.isSneaking()) { tileEntity.decrement(); @@ -275,7 +275,7 @@ public class ModelLoaderRegistryDebug tileEntity.increment(); } } - + if (world.isRemote) { OBJBakedModel objBaked = (OBJBakedModel) Minecraft.getMinecraft().getBlockRendererDispatcher().getModelFromBlockState(state, world, pos); @@ -284,25 +284,25 @@ public class ModelLoaderRegistryDebug world.markBlockRangeForRenderUpdate(pos, pos); return false; } - + @Override public boolean hasTileEntity(IBlockState state) { return true; } } - + public static class OBJTesseractTileEntity extends TileEntity { private int counter = 1; private int max = 2; public List visible = new ArrayList(); - + public OBJTesseractTileEntity() { this.visible.add(OBJModel.Group.ALL); } - + public void increment() { if (this.visible.contains(OBJModel.Group.ALL)) this.visible.remove(OBJModel.Group.ALL); @@ -313,10 +313,10 @@ public class ModelLoaderRegistryDebug } this.counter++; this.visible.add(Integer.toString(this.counter)); - ChatComponentText text = new ChatComponentText("" + this.counter); + TextComponentString text = new TextComponentString("" + this.counter); if (this.worldObj.isRemote) Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(text); } - + public void decrement() { if (this.visible.contains(OBJModel.Group.ALL)) this.visible.remove(OBJModel.Group.ALL); @@ -327,10 +327,10 @@ public class ModelLoaderRegistryDebug } this.visible.remove(Integer.toString(this.counter)); this.counter--; - ChatComponentText text = new ChatComponentText("" + this.counter); + TextComponentString text = new TextComponentString("" + this.counter); if (this.worldObj.isRemote) Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(text); } - + public void reset() { this.counter = 1; @@ -338,25 +338,25 @@ public class ModelLoaderRegistryDebug this.visible.clear(); this.visible.add(Integer.toString(this.counter)); } - + public int getMax() { return this.max; } - + public void setMax(int max) { this.max = max; } - + public void setToMax() { this.counter = this.max; } } - + /** - * This block demonstrates how to utilize the vertex coloring feature + * This block demonstrates how to utilize the vertex coloring feature * of the OBJ loader. See 'vertex_coloring.obj' and 'vertex_coloring.mtl' in * 'test/resources/assets/forgedebugmodelloaderregistry/models/block/', to properly * utilize this feature an obj file must have 1 'usemtl' key before every vertex as shown, @@ -369,28 +369,28 @@ public class ModelLoaderRegistryDebug { public static final OBJVertexColoring1 instance = new OBJVertexColoring1(); public static final String name = "OBJVertexColoring1"; - + private OBJVertexColoring1() { super(Material.iron); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(name); } - - @Override - public boolean isOpaqueCube() { return false; } @Override - public boolean isFullCube() { return false; } + public boolean isOpaqueCube(IBlockState state) { return false; } + + @Override + public boolean isFullCube(IBlockState state) { return false; } @Override public boolean isVisuallyOpaque() { return false; } } - + /** * This block demonstrates how to use IProperties and IUnlistedProperties together * in the same ExtendedBlockState. Similar to pistons, this block will face the player - * when placed. Unlike pistons, however; this block's model is an eyeball, because + * when placed. Unlike pistons, however; this block's model is an eyeball, because * the OBJ loader can load spheres. * @author shadekiller666 * @@ -401,7 +401,7 @@ public class ModelLoaderRegistryDebug public static final OBJDirectionEye instance = new OBJDirectionEye(); public static final String name = "OBJDirectionEye"; private ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[] {FACING}, new IUnlistedProperty[]{OBJModel.OBJProperty.instance}); - + private OBJDirectionEye() { super(Material.iron); @@ -409,47 +409,47 @@ public class ModelLoaderRegistryDebug setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(name); } - + @Override public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().withProperty(FACING, getFacingFromEntity(world, pos, placer)); } - + @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(FACING, EnumFacing.getFront(meta)); } - + @Override public int getMetaFromState(IBlockState state) { return ((EnumFacing) state.getValue(FACING)).getIndex(); } - + @Override @SideOnly(Side.CLIENT) public IBlockState getStateForEntityRender(IBlockState state) { return this.getDefaultState().withProperty(FACING, EnumFacing.NORTH); } - + @Override - public BlockState createBlockState() + public BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[] {FACING}, new IUnlistedProperty[] {OBJModel.OBJProperty.instance}); } - - @Override - public boolean isOpaqueCube() { return false; } @Override - public boolean isFullCube() { return false; } + public boolean isOpaqueCube(IBlockState state) { return false; } + + @Override + public boolean isFullCube(IBlockState state) { return false; } @Override public boolean isVisuallyOpaque() { return false; } - + @Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { @@ -458,7 +458,7 @@ public class ModelLoaderRegistryDebug OBJModel.OBJState retState = new OBJModel.OBJState(Arrays.asList(new String[]{OBJModel.Group.ALL}), true, transform); return ((IExtendedBlockState) state).withProperty(OBJModel.OBJProperty.instance, retState); } - + public static EnumFacing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLivingBase entityIn) { if (MathHelper.abs((float)entityIn.posX - (float)clickedBlock.getX()) < 2.0F && MathHelper.abs((float)entityIn.posZ - (float)clickedBlock.getZ()) < 2.0F) @@ -479,9 +479,9 @@ public class ModelLoaderRegistryDebug return entityIn.getHorizontalFacing(); } } - + /** - * This block uses the same model as CustomModelBlock3 does, but + * This block uses the same model as CustomModelBlock3 does, but * this class allows the player to cycle the colors of each vertex to black * and then back to the original color when right clicking on the block. * @author shadekiller666 @@ -489,22 +489,22 @@ public class ModelLoaderRegistryDebug */ public static class OBJVertexColoring2 extends Block implements ITileEntityProvider { - public static final OBJVertexColoring2 instance = new OBJVertexColoring2(); + public static final OBJVertexColoring2 instance = new OBJVertexColoring2(); public static final String name = "OBJVertexColoring2"; - + private OBJVertexColoring2() { super(Material.iron); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(name); } - + @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new OBJVertexColoring2TileEntity(); } - + @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { @@ -515,7 +515,7 @@ public class ModelLoaderRegistryDebug return false; } } - + public static class OBJVertexColoring2TileEntity extends TileEntity { private int index = 0; @@ -523,9 +523,9 @@ public class ModelLoaderRegistryDebug private List colorList = new ArrayList(); private boolean hasFilledList = false; private boolean shouldIncrement = true; - + public OBJVertexColoring2TileEntity() {} - + public void cycleColors() { if (this.worldObj.isRemote) @@ -577,7 +577,7 @@ public class ModelLoaderRegistryDebug } } } - + /** * This block is a debug block that faces the player when placed, like a piston. * @author shadekiller666 @@ -589,7 +589,7 @@ public class ModelLoaderRegistryDebug public static final OBJDirectionBlock instance = new OBJDirectionBlock(); public static final String name = "OBJDirectionBlock"; public ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{OBJModel.OBJProperty.instance}); - + private OBJDirectionBlock() { super(Material.iron); @@ -597,34 +597,34 @@ public class ModelLoaderRegistryDebug setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); } - - @Override - public boolean isOpaqueCube() { return false; } @Override - public boolean isFullCube() { return false; } + public boolean isOpaqueCube(IBlockState state) { return false; } + + @Override + public boolean isFullCube(IBlockState state) { return false; } @Override public boolean isVisuallyOpaque() { return false; } - + @Override public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().withProperty(FACING, getFacingFromEntity(world, pos, placer)); } - + @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(FACING, EnumFacing.getFront(meta)); } - + @Override public int getMetaFromState(IBlockState state) { return ((EnumFacing) state.getValue(FACING)).getIndex(); } - + @Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { @@ -634,13 +634,13 @@ public class ModelLoaderRegistryDebug OBJModel.OBJState newState = new OBJModel.OBJState(Lists.newArrayList(OBJModel.Group.ALL), true, transform); return ((IExtendedBlockState) state).withProperty(OBJModel.OBJProperty.instance, newState); } - + @Override - public BlockState createBlockState() + public BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{OBJModel.OBJProperty.instance}); } - + public static EnumFacing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLivingBase entityIn) { if (MathHelper.abs((float)entityIn.posX - (float)clickedBlock.getX()) < 2.0F && MathHelper.abs((float)entityIn.posZ - (float)clickedBlock.getZ()) < 2.0F) @@ -661,7 +661,7 @@ public class ModelLoaderRegistryDebug return entityIn.getHorizontalFacing().getOpposite(); } } - + /** * This block is a testing block that will be used to test the use * of "custom" data defined in a forge blockstate json. WIP, ignore for now. @@ -676,7 +676,7 @@ public class ModelLoaderRegistryDebug public static final PropertyBool EAST = PropertyBool.create("east"); public static final OBJCustomDataBlock instance = new OBJCustomDataBlock(); public static final String name = "OBJCustomDataBlock"; - + private OBJCustomDataBlock() { super(Material.iron); @@ -684,44 +684,44 @@ public class ModelLoaderRegistryDebug setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); } - + @Override - public boolean isOpaqueCube() + public boolean isOpaqueCube(IBlockState state) { return false; } - + @Override - public boolean isFullCube() + public boolean isFullCube(IBlockState state) { return false; } - + @Override public int getMetaFromState(IBlockState state) { return 0; } - + public boolean canConnectTo(IBlockAccess world, BlockPos pos) { Block block = world.getBlockState(pos).getBlock(); return block instanceof OBJCustomDataBlock; } - + @Override public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) { return state.withProperty(NORTH, this.canConnectTo(world, pos.north())).withProperty(SOUTH, this.canConnectTo(world, pos.south())).withProperty(WEST, this.canConnectTo(world, pos.west())).withProperty(EAST, this.canConnectTo(world, pos.east())); } - + @Override - public BlockState createBlockState() + public BlockStateContainer createBlockState() { - return new BlockState(this, new IProperty[]{NORTH, SOUTH, WEST, EAST}); + return new BlockStateContainer(this, new IProperty[]{NORTH, SOUTH, WEST, EAST}); } } - + /** * This block uses the same model as CustomModelBlock4, but instead of facing the * player when placed, this one ALWAYS faces the player. I know, creepy right? @@ -739,31 +739,31 @@ public class ModelLoaderRegistryDebug setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); } - + @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new OBJDynamicEyeTileEntity(); } - + @Override - public boolean isOpaqueCube() + public boolean isOpaqueCube(IBlockState state) { return false; } - + @Override - public boolean isFullCube() + public boolean isFullCube(IBlockState state) { return false; } - + @Override public boolean hasTileEntity(IBlockState state) { return true; } - + @Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { @@ -777,23 +777,23 @@ public class ModelLoaderRegistryDebug } return state; } - + @Override - public BlockState createBlockState() + public BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] {OBJModel.OBJProperty.instance}); } } - + public static class OBJDynamicEyeTileEntity extends TileEntity implements ITickable { public OBJModel.OBJState state; - + public OBJDynamicEyeTileEntity() { this.state = new OBJModel.OBJState(Lists.newArrayList(OBJModel.Group.ALL), true); } - + @Override public void update() { diff --git a/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java b/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java index 061f884bc7..4aa3c0401a 100644 --- a/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java +++ b/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java @@ -2,10 +2,10 @@ package net.minecraftforge.debug; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.BlockRenderLayer; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; @@ -42,9 +42,9 @@ public class MultiLayerModelDebug public boolean isFullCube() { return false; } @Override - public boolean canRenderInLayer(EnumWorldBlockLayer layer) + public boolean canRenderInLayer(BlockRenderLayer layer) { - return layer == EnumWorldBlockLayer.SOLID || layer == EnumWorldBlockLayer.TRANSLUCENT; + return layer == BlockRenderLayer.SOLID || layer == BlockRenderLayer.TRANSLUCENT; } }, blockName); } diff --git a/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java b/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java index 5a60a02607..460567bea5 100644 --- a/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java +++ b/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java @@ -69,13 +69,13 @@ public class PotionRegistryDebug { int height = width; /* Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - worldrenderer.startDrawingQuads(); - worldrenderer.setColorOpaque_I(potion.getLiquidColor()); - worldrenderer.addVertexWithUV((double) x, (double) (y + height), 0.0D, sprite.getMinU(), sprite.getMaxV()); - worldrenderer.addVertexWithUV((double)(x + width), (double)(y + height), 0.0D, sprite.getMaxU(), sprite.getMaxV()); - worldrenderer.addVertexWithUV((double)(x + width), (double)y, 0.0D, sprite.getMaxU(), sprite.getMinV()); - worldrenderer.addVertexWithUV((double)x, (double)y, 0.0D, sprite.getMinU(), sprite.getMinV()); + VertexBuffer VertexBuffer = tessellator.getVertexBuffer(); + VertexBuffer.startDrawingQuads(); + VertexBuffer.setColorOpaque_I(potion.getLiquidColor()); + VertexBuffer.addVertexWithUV((double) x, (double) (y + height), 0.0D, sprite.getMinU(), sprite.getMaxV()); + VertexBuffer.addVertexWithUV((double)(x + width), (double)(y + height), 0.0D, sprite.getMaxU(), sprite.getMaxV()); + VertexBuffer.addVertexWithUV((double)(x + width), (double)y, 0.0D, sprite.getMaxU(), sprite.getMinV()); + VertexBuffer.addVertexWithUV((double)x, (double)y, 0.0D, sprite.getMinU(), sprite.getMinV()); tessellator.draw();*/ } } diff --git a/src/test/java/net/minecraftforge/test/ClientCommandTest.java b/src/test/java/net/minecraftforge/test/ClientCommandTest.java index 79478f2981..3d8157e3f6 100644 --- a/src/test/java/net/minecraftforge/test/ClientCommandTest.java +++ b/src/test/java/net/minecraftforge/test/ClientCommandTest.java @@ -6,8 +6,9 @@ import java.util.List; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentString; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; @@ -53,15 +54,15 @@ public class ClientCommandTest { } @Override - public void processCommand(ICommandSender sender, String[] args) throws CommandException + public void func_184881_a( MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (args.length > 0) { - sender.addChatMessage(new ChatComponentText("Input: " + Arrays.toString(args))); + sender.addChatMessage(new TextComponentString("Input: " + Arrays.toString(args))); } else { - sender.addChatMessage(new ChatComponentText("No arguments.")); + sender.addChatMessage(new TextComponentString("No arguments.")); } } } diff --git a/src/test/java/net/minecraftforge/test/TestCapabilityMod.java b/src/test/java/net/minecraftforge/test/TestCapabilityMod.java index 5f8285ee63..2e8ba82cec 100644 --- a/src/test/java/net/minecraftforge/test/TestCapabilityMod.java +++ b/src/test/java/net/minecraftforge/test/TestCapabilityMod.java @@ -4,8 +4,8 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.nbt.NBTBase; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextFormatting; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; @@ -45,8 +45,8 @@ public class TestCapabilityMod public void onInteract(PlayerInteractEvent event) { if (event.action != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) return; - if (event.entityPlayer.getHeldItem() == null) return; - if (event.entityPlayer.getHeldItem().getItem() != Items.stick) return; + if (event.entityPlayer.inventory.getCurrentItem() == null) return; + if (event.entityPlayer.inventory.getCurrentItem().getItem() != Items.stick) return; // This is just a example of how to interact with the TE, note the strong type binding that getCapability has TileEntity te = event.world.getTileEntity(event.pos); @@ -58,7 +58,7 @@ public class TestCapabilityMod } if (event.world.getBlockState(event.pos).getBlock() == Blocks.dirt) { - event.entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "" + EnumChatFormatting.ITALIC + "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST")); + event.entityPlayer.addChatMessage(new TextComponentString(TextFormatting.RED + "" + TextFormatting.ITALIC + "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST")); event.setCanceled(true); } } diff --git a/src/test/java/net/minecraftforge/test/WRNormalMod.java b/src/test/java/net/minecraftforge/test/WRNormalMod.java index 1944461c22..bf1992f982 100644 --- a/src/test/java/net/minecraftforge/test/WRNormalMod.java +++ b/src/test/java/net/minecraftforge/test/WRNormalMod.java @@ -3,7 +3,7 @@ package net.minecraftforge.test; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.entity.RendererLivingEntity; +import net.minecraft.client.renderer.entity.RenderLivingBase; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.util.ResourceLocation; @@ -66,7 +66,7 @@ public class WRNormalMod } } - public static class RenderScaleTest extends RendererLivingEntity + public static class RenderScaleTest extends RenderLivingBase { private static final ResourceLocation TEXTURE = new ResourceLocation("textures/blocks/stone.png"); From c1744f00e013edebe4f4eee210c54326e8e17fcb Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 1 Mar 2016 17:59:58 +0300 Subject: [PATCH 008/243] Updated various block model patches. --- .../block/model/FaceBakery.java.patch | 93 +++++++++++++ .../block/model/IBakedModel.java.patch | 12 ++ .../model/ItemCameraTransforms.java.patch | 35 ++++- .../block/model/ModelBakery.java.patch | 107 ++++++++++++++ .../block/model/ModelManager.java.patch | 5 +- .../block/model/ModelRotation.java.patch | 8 +- .../renderer/block/model/Variant.java.patch | 20 +++ .../block/statemap/StateMap.java.patch | 11 ++ .../block/model/FaceBakery.java.patch.rej | 70 ---------- .../model/ModelBlockDefinition.java.patch.rej | 19 --- .../block/statemap/StateMap.java.patch.rej | 10 -- .../model/IBakedModel.java.patch.rej | 8 -- .../model/ModelBakery.java.patch.rej | 131 ------------------ src/main/resources/forge.exc | 10 +- 14 files changed, 286 insertions(+), 253 deletions(-) create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch rename rejects/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch.rej => patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch (77%) rename rejects/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch.rej => patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch (81%) create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch new file mode 100644 index 0000000000..1b04f78100 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -0,0 +1,93 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java +@@ -48,14 +48,20 @@ + + public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) + { ++ return makeBakedQuad(posFrom, posTo, face, sprite, facing, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); ++ } ++ ++ public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) ++ { + BlockFaceUV blockfaceuv = face.blockFaceUV; + + if (uvLocked) + { +- blockfaceuv = this.func_188010_a(face.blockFaceUV, facing, modelRotationIn); ++ // TODO fix uvlock for custom rotations ++ //blockfaceuv = this.func_188010_a(face.blockFaceUV, facing, modelRotationIn); + } + +- int[] aint = this.func_188012_a(blockfaceuv, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, shade); ++ int[] aint = this.makeQuadVertexData(blockfaceuv, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, shade); + EnumFacing enumfacing = getFacingFromVertexData(aint); + + if (partRotation == null) +@@ -63,6 +69,7 @@ + this.func_178408_a(aint, enumfacing); + } + ++ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing); + return new BakedQuad(aint, face.tintIndex, enumfacing, sprite); + } + +@@ -73,11 +80,16 @@ + + private int[] func_188012_a(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, ModelRotation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) + { ++ return makeQuadVertexData(p_188012_1_, p_188012_2_, p_188012_3_, p_188012_4_, (net.minecraftforge.client.model.ITransformation)p_188012_5_, p_188012_6_, p_188012_7_); ++ } ++ ++ private int[] makeQuadVertexData(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, net.minecraftforge.client.model.ITransformation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) ++ { + int[] aint = new int[28]; + + for (int i = 0; i < 4; ++i) + { +- this.func_188015_a(aint, i, p_188012_3_, p_188012_1_, p_188012_4_, p_188012_2_, p_188012_5_, p_188012_6_, p_188012_7_); ++ this.fillVertexData(aint, i, p_188012_3_, p_188012_1_, p_188012_4_, p_188012_2_, p_188012_5_, p_188012_6_, p_188012_7_); + } + + return aint; +@@ -123,12 +135,17 @@ + + private void func_188015_a(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, ModelRotation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_) + { +- EnumFacing enumfacing = p_188015_7_.rotateFace(p_188015_3_); ++ fillVertexData(p_188015_1_, p_188015_2_, p_188015_3_, p_188015_4_, p_188015_5_, p_188015_6_, (net.minecraftforge.client.model.ITransformation)p_188015_7_, p_188015_8_, p_188015_9_); ++ } ++ ++ private void fillVertexData(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, net.minecraftforge.client.model.ITransformation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_) ++ { ++ EnumFacing enumfacing = p_188015_7_.rotate(p_188015_3_); + int i = p_188015_9_ ? this.getFaceShadeColor(enumfacing) : -1; + EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.getFacing(p_188015_3_).func_179025_a(p_188015_2_); + Vector3f vector3f = new Vector3f(p_188015_5_[enumfacedirection$vertexinformation.field_179184_a], p_188015_5_[enumfacedirection$vertexinformation.field_179182_b], p_188015_5_[enumfacedirection$vertexinformation.field_179183_c]); + this.func_178407_a(vector3f, p_188015_8_); +- int j = this.func_188011_a(vector3f, p_188015_3_, p_188015_2_, p_188015_7_); ++ int j = this.rotateVertex(vector3f, p_188015_3_, p_188015_2_, p_188015_7_); + this.storeVertexData(p_188015_1_, j, p_188015_2_, vector3f, i, p_188015_6_, p_188015_4_); + } + +@@ -189,14 +206,19 @@ + + public int func_188011_a(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, ModelRotation p_188011_4_) + { ++ return rotateVertex(p_188011_1_, p_188011_2_, p_188011_3_, (net.minecraftforge.client.model.ITransformation)p_188011_4_); ++ } ++ ++ public int rotateVertex(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, net.minecraftforge.client.model.ITransformation p_188011_4_) ++ { + if (p_188011_4_ == ModelRotation.X0_Y0) + { + return p_188011_3_; + } + else + { +- this.rotateScale(p_188011_1_, new Vector3f(0.5F, 0.5F, 0.5F), p_188011_4_.getMatrix4d(), new Vector3f(1.0F, 1.0F, 1.0F)); +- return p_188011_4_.rotateVertex(p_188011_2_, p_188011_3_); ++ net.minecraftforge.client.ForgeHooksClient.transform(p_188011_1_, p_188011_4_.getMatrix()); ++ return p_188011_4_.rotate(p_188011_2_, p_188011_3_); + } + } + diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch new file mode 100644 index 0000000000..552a4b1c6a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java +@@ -20,7 +20,9 @@ + + TextureAtlasSprite getParticleTexture(); + ++ @Deprecated + ItemCameraTransforms getItemCameraTransforms(); + ++ @Deprecated + ItemOverrideList func_188617_f(); + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch index fd1bef036c..44ff0e848a 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java -@@ -12,7 +12,11 @@ +@@ -12,10 +12,13 @@ import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.util.vector.Quaternion; @@ -8,11 +8,38 @@ + * @deprecated use {@link net.minecraftforge.client.model.IPerspectiveAwareModel} instead + */ @SideOnly(Side.CLIENT) -+@Deprecated public class ItemCameraTransforms { - public static final ItemCameraTransforms DEFAULT = new ItemCameraTransforms(); -@@ -169,7 +173,7 @@ +- public static final ItemCameraTransforms DEFAULT = new ItemCameraTransforms(); ++ public static final ItemCameraTransforms DEFAULT = new ItemCameraTransforms(); + public static float field_181690_b = 0.0F; + public static float field_181691_c = 0.0F; + public static float field_181692_d = 0.0F; +@@ -39,6 +42,7 @@ + this(ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT); + } + ++ @Deprecated + public ItemCameraTransforms(ItemCameraTransforms p_i46443_1_) + { + this.field_188036_k = p_i46443_1_.field_188036_k; +@@ -51,6 +55,7 @@ + this.fixed = p_i46443_1_.fixed; + } + ++ @Deprecated + public ItemCameraTransforms(ItemTransformVec3f p_i46569_1_, ItemTransformVec3f p_i46569_2_, ItemTransformVec3f p_i46569_3_, ItemTransformVec3f p_i46569_4_, ItemTransformVec3f p_i46569_5_, ItemTransformVec3f p_i46569_6_, ItemTransformVec3f p_i46569_7_, ItemTransformVec3f p_i46569_8_) + { + this.field_188036_k = p_i46569_1_; +@@ -103,6 +108,7 @@ + return new Quaternion(f3 * f6 * f8 + f4 * f5 * f7, f4 * f5 * f8 - f3 * f6 * f7, f3 * f5 * f8 + f4 * f6 * f7, f4 * f6 * f8 - f3 * f5 * f7); + } + ++ @Deprecated + public ItemTransformVec3f getTransform(ItemCameraTransforms.TransformType p_181688_1_) + { + switch (p_181688_1_) +@@ -169,7 +175,7 @@ } @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch new file mode 100644 index 0000000000..430b1227d0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch @@ -0,0 +1,107 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java +@@ -132,7 +132,7 @@ + { + if (!modelblockdefinition.func_188002_b()) + { +- LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation); ++ LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, var12); + } + } + } +@@ -370,6 +370,7 @@ + + private void registerVariantNames() + { ++ this.variantNames.clear(); //FML clear this to prevent double ups. + this.variantNames.put(Item.getItemFromBlock(Blocks.stone), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.dirt), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.planks), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); +@@ -413,6 +414,10 @@ + this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence), Lists.newArrayList(new String[] {"oak_fence"})); + this.variantNames.put(Items.oak_door, Lists.newArrayList(new String[] {"oak_door"})); + this.variantNames.put(Items.boat, Lists.newArrayList(new String[] {"oak_boat"})); ++ for (Entry, Set> e : customVariantNames.entrySet()) ++ { ++ this.variantNames.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator())); ++ } + } + + private List getVariantNames(Item p_177596_1_) +@@ -429,7 +434,7 @@ + + private ResourceLocation getItemLocation(String p_177583_1_) + { +- ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_); ++ ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_.replaceAll("#.*", "")); + return new ResourceLocation(resourcelocation.getResourceDomain(), "item/" + resourcelocation.getResourcePath()); + } + +@@ -536,7 +541,7 @@ + for (Entry entry : this.itemLocations.entrySet()) + { + ResourceLocation resourcelocation = (ResourceLocation)entry.getValue(); +- ModelResourceLocation modelresourcelocation = new ModelResourceLocation((String)entry.getKey(), "inventory"); ++ ModelResourceLocation modelresourcelocation = net.minecraftforge.client.model.ModelLoader.getInventoryVariant(entry.getKey()); + ModelBlock modelblock = (ModelBlock)this.models.get(resourcelocation); + + if (modelblock != null && modelblock.isResolved()) +@@ -623,6 +628,11 @@ + + private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked) + { ++ return bakeModel(modelBlockIn, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); ++ } ++ ++ protected IBakedModel bakeModel(ModelBlock modelBlockIn, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) ++ { + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle"))); + SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(modelBlockIn, modelBlockIn.func_187967_g())).setTexture(textureatlassprite); + +@@ -639,13 +649,13 @@ + BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); + TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture))); + +- if (blockpartface.cullFace == null) ++ if (blockpartface.cullFace == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix())) + { + simplebakedmodel$builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); + } + else + { +- simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); ++ simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); + } + } + } +@@ -656,6 +666,11 @@ + + private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) + { ++ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation)p_177589_5_, p_177589_6_); ++ } ++ ++ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) ++ { + return this.faceBakery.makeBakedQuad(p_177589_1_.positionFrom, p_177589_1_.positionTo, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.partRotation, p_177589_6_, p_177589_1_.shade); + } + +@@ -878,4 +893,18 @@ + MODEL_GENERATED.name = "generation marker"; + MODEL_ENTITY.name = "block entity marker"; + } ++ ++ private static Map, Set> customVariantNames = Maps.newHashMap(); ++ ++ public static void registerItemVariants(Item item, ResourceLocation... names) ++ { ++ if (!customVariantNames.containsKey(item.delegate)) ++ { ++ customVariantNames.put(item.delegate, Sets.newHashSet()); ++ } ++ for(ResourceLocation name : names) ++ { ++ customVariantNames.get(item.delegate).add(name.toString()); ++ } ++ } + } diff --git a/rejects/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch.rej b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch similarity index 77% rename from rejects/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch index 734c561bd5..6ce4d19a58 100644 --- a/rejects/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch @@ -1,4 +1,6 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java +@@ -24,9 +24,10 @@ public void onResourceManagerReload(IResourceManager resourceManager) { @@ -10,4 +12,3 @@ this.modelProvider.reloadModels(); } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch.rej b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch similarity index 81% rename from rejects/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch index 9d9e7cc812..cef4d35bb4 100644 --- a/rejects/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch @@ -1,4 +1,6 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java +@@ -10,7 +10,7 @@ import org.lwjgl.util.vector.Vector3f; @SideOnly(Side.CLIENT) @@ -7,8 +9,7 @@ { X0_Y0(0, 0), X0_Y90(0, 90), -++++ END PATCH -++++ REJECTED PATCH 2 +@@ -116,4 +116,9 @@ mapRotations.put(Integer.valueOf(modelrotation.combinedXY), modelrotation); } } @@ -18,4 +19,3 @@ + public EnumFacing rotate(EnumFacing facing) { return rotateFace(facing); } + public int rotate(EnumFacing facing, int vertexIndex) { return rotateVertex(facing, vertexIndex); } } -++++ END PATCH diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch new file mode 100644 index 0000000000..51f084a945 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/Variant.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/Variant.java +@@ -32,11 +32,17 @@ + return this.field_188050_a; + } + ++ @Deprecated + public ModelRotation func_188048_b() + { + return this.field_188051_b; + } + ++ public net.minecraftforge.client.model.IModelState getState() ++ { ++ return this.field_188051_b; ++ } ++ + public boolean func_188049_c() + { + return this.field_188052_c; diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch new file mode 100644 index 0000000000..3d5288e138 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java +@@ -38,7 +38,7 @@ + } + else + { +- s = this.func_187490_a(this.name, map); ++ s = String.format("%s:%s", Block.blockRegistry.getNameForObject(state.getBlock()).getResourceDomain(), this.func_187490_a(this.name, map)); + } + + if (this.suffix != null) diff --git a/rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej deleted file mode 100644 index dcf329e613..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej +++ /dev/null @@ -1,70 +0,0 @@ -++++ REJECTED PATCH 1 - - public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) - { -+ return makeBakedQuad(posFrom, posTo, face, sprite, facing, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); -+ } -+ -+ public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) -+ { - int[] aint = this.makeQuadVertexData(face, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, uvLocked, shade); - EnumFacing enumfacing = getFacingFromVertexData(aint); - -++++ END PATCH -++++ REJECTED PATCH 2 - this.func_178408_a(aint, enumfacing); - } - -+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing); - return new BakedQuad(aint, face.tintIndex, enumfacing); - } - - private int[] makeQuadVertexData(BlockPartFace partFace, TextureAtlasSprite sprite, EnumFacing facing, float[] p_178405_4_, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) - { -+ return makeQuadVertexData(partFace, sprite, facing, p_178405_4_, modelRotationIn, partRotation, uvLocked, shade); -+ } -+ -+ private int[] makeQuadVertexData(BlockPartFace partFace, TextureAtlasSprite sprite, EnumFacing facing, float[] p_178405_4_, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) -+ { - int[] aint = new int[28]; - - for (int i = 0; i < 4; ++i) -++++ END PATCH -++++ REJECTED PATCH 3 - - private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) - { -- EnumFacing enumfacing = modelRotationIn.rotateFace(facing); -+ fillVertexData(faceData, vertexIndex, facing, partFace, p_178402_5_, sprite, modelRotationIn, partRotation, uvLocked, shade); -+ } -+ -+ private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) -+ { -+ EnumFacing enumfacing = modelRotationIn.rotate(facing); - int i = shade ? this.getFaceShadeColor(enumfacing) : -1; - EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.getFacing(facing).func_179025_a(vertexIndex); - Vector3f vector3f = new Vector3f(p_178402_5_[enumfacedirection$vertexinformation.field_179184_a], p_178402_5_[enumfacedirection$vertexinformation.field_179182_b], p_178402_5_[enumfacedirection$vertexinformation.field_179183_c]); -++++ END PATCH -++++ REJECTED PATCH 4 - - public int rotateVertex(Vector3f position, EnumFacing facing, int vertexIndex, ModelRotation modelRotationIn, boolean uvLocked) - { -+ return rotateVertex(position, facing, vertexIndex, modelRotationIn, uvLocked); -+ } -+ -+ public int rotateVertex(Vector3f position, EnumFacing facing, int vertexIndex, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) -+ { - if (modelRotationIn == ModelRotation.X0_Y0) - { - return vertexIndex; - } - else - { -- this.rotateScale(position, new Vector3f(0.5F, 0.5F, 0.5F), modelRotationIn.getMatrix4d(), new Vector3f(1.0F, 1.0F, 1.0F)); -- return modelRotationIn.rotateVertex(facing, vertexIndex); -+ net.minecraftforge.client.ForgeHooksClient.transform(position, modelRotationIn.getMatrix()); -+ return modelRotationIn.rotate(facing, vertexIndex); - } - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch.rej deleted file mode 100644 index 6c3d4d0cad..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch.rej +++ /dev/null @@ -1,19 +0,0 @@ -++++ REJECTED PATCH 2 - return this.modelLocation; - } - -+ @Deprecated - public ModelRotation getRotation() - { - return this.modelRotation; - } - -+ public net.minecraftforge.client.model.IModelState getState() -+ { -+ return this.modelRotation; -+ } -+ - public boolean isUvLocked() - { - return this.uvLock; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej deleted file mode 100644 index 5c3dd1f9c9..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - } - else - { -- s = ((IProperty)this.name).getName((Comparable)map.remove(this.name)); -+ s = String.format("%s:%s", ((ResourceLocation)Block.blockRegistry.getNameForObject(state.getBlock())).getResourceDomain(), ((IProperty)this.name).getName((Comparable)map.remove(this.name))); - } - - if (this.suffix != null) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch.rej deleted file mode 100644 index 8b56b35e33..0000000000 --- a/rejects/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch.rej +++ /dev/null @@ -1,8 +0,0 @@ -++++ REJECTED PATCH 1 - - TextureAtlasSprite getParticleTexture(); - -+ @Deprecated - ItemCameraTransforms getItemCameraTransforms(); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej deleted file mode 100644 index 31a5207b0c..0000000000 --- a/rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej +++ /dev/null @@ -1,131 +0,0 @@ -++++ REJECTED PATCH 1 - } - catch (Exception var6) - { -- LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation); -+ LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, var6); - } - } - catch (Exception exception) -++++ END PATCH -++++ REJECTED PATCH 2 - - protected void registerVariantNames() - { -+ this.variantNames.clear(); //FML clear this to prevent double ups. - this.variantNames.put(Item.getItemFromBlock(Blocks.stone), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); - this.variantNames.put(Item.getItemFromBlock(Blocks.dirt), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); - this.variantNames.put(Item.getItemFromBlock(Blocks.planks), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); -++++ END PATCH -++++ REJECTED PATCH 3 - this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence_gate), Lists.newArrayList(new String[] {"oak_fence_gate"})); - this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence), Lists.newArrayList(new String[] {"oak_fence"})); - this.variantNames.put(Items.oak_door, Lists.newArrayList(new String[] {"oak_door"})); -+ for (Entry, Set> e : customVariantNames.entrySet()) -+ { -+ this.variantNames.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator())); -+ } - } - - protected List getVariantNames(Item p_177596_1_) -++++ END PATCH -++++ REJECTED PATCH 4 - - protected ResourceLocation getItemLocation(String p_177583_1_) - { -- ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_); -+ ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_.replaceAll("#.*", "")); - return new ResourceLocation(resourcelocation.getResourceDomain(), "item/" + resourcelocation.getResourcePath()); - } - -++++ END PATCH -++++ REJECTED PATCH 5 - for (Entry entry : this.itemLocations.entrySet()) - { - ResourceLocation resourcelocation = (ResourceLocation)entry.getValue(); -- ModelResourceLocation modelresourcelocation1 = new ModelResourceLocation((String)entry.getKey(), "inventory"); -+ ModelResourceLocation modelresourcelocation1 = net.minecraftforge.client.model.ModelLoader.getInventoryVariant(entry.getKey()); - ModelBlock modelblock1 = (ModelBlock)this.models.get(resourcelocation); - - if (modelblock1 != null && modelblock1.isResolved()) -++++ END PATCH -++++ REJECTED PATCH 6 - - private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked) - { -+ return bakeModel(modelBlockIn, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); -+ } -+ -+ protected IBakedModel bakeModel(ModelBlock modelBlockIn, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) -+ { - TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle"))); - SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite); - -++++ END PATCH -++++ REJECTED PATCH 7 - BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); - TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture))); - -- if (blockpartface.cullFace == null) -+ if (blockpartface.cullFace == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix())) - { - simplebakedmodel$builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); - } - else - { -- simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); -+ simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); - } - } - } -++++ END PATCH -++++ REJECTED PATCH 8 - - private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) - { -+ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation)p_177589_5_, p_177589_6_); -+ } -+ -+ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) -+ { - return this.faceBakery.makeBakedQuad(p_177589_1_.positionFrom, p_177589_1_.positionTo, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.partRotation, p_177589_6_, p_177589_1_.shade); - } - -++++ END PATCH -++++ REJECTED PATCH 9 - MODEL_CLOCK.name = "class generation marker"; - MODEL_ENTITY.name = "block entity marker"; - } -+ -+ /*********************************************************** -+ * FML Start -+ ***********************************************************/ -+ private static Map, Set> customVariantNames = Maps.newHashMap(); -+ /** -+ * @deprecated use registerItemVariants -+ */ -+ @Deprecated -+ public static void addVariantName(Item item, String... names) -+ { -+ if (customVariantNames.containsKey(item.delegate)) -+ customVariantNames.get(item.delegate).addAll(Lists.newArrayList(names)); -+ else -+ customVariantNames.put(item.delegate, Sets.newHashSet(names)); -+ } -+ -+ public static void registerItemVariants(Item item, T... names) -+ { -+ if (!customVariantNames.containsKey(item.delegate)) -+ { -+ customVariantNames.put(item.delegate, Sets.newHashSet()); -+ } -+ for(ResourceLocation name : names) -+ { -+ customVariantNames.get(item.delegate).add(name.toString()); -+ } -+ } -+ /*********************************************************** -+ * FML End -+ ***********************************************************/ - } -++++ END PATCH diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index f1a87873ae..3a3c51171b 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -29,12 +29,12 @@ net/minecraft/server/management/ItemInWorldManager.removeBlock(Lnet/minecraft/ut net/minecraft/client/gui/GuiScreen.drawHoveringText(Ljava/util/List;IILnet/minecraft/client/gui/FontRenderer;)V=|p_146283_1_,p_146283_2_,p_146283_3_,font net/minecraft/block/state/BlockState.(Lnet/minecraft/block/Block;[Lnet/minecraft/block/properties/IProperty;Lcom/google/common/collect/ImmutableMap;)V=|p_i45663_1_,p_i45663_2_,unlistedProperties net/minecraft/client/renderer/entity/RenderItem.applyVanillaTransform(Lnet/minecraft/client/renderer/block/model/ItemTransformVec3f;)V=|p_175034_1_ -net/minecraft/client/resources/model/ModelBakery.bakeModel(Lnet/minecraft/client/renderer/block/model/ModelBlock;Lnet/minecraftforge/client/model/ITransformation;Z)Lnet/minecraft/client/resources/model/IBakedModel;=|p_177578_1_,p_177578_2_,p_177578_3_ -net/minecraft/client/resources/model/ModelBakery.makeBakedQuad(Lnet/minecraft/client/renderer/block/model/BlockPart;Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;Lnet/minecraftforge/client/model/ITransformation;Z)Lnet/minecraft/client/renderer/block/model/BakedQuad;=|p_177589_1_,p_177589_2_,p_177589_3_,p_177589_4_,p_177589_5_,p_177589_6_ +net/minecraft/client/renderer/block/model/ModelBakery.bakeModel(Lnet/minecraft/client/renderer/block/model/ModelBlock;Lnet/minecraftforge/client/model/ITransformation;Z)Lnet/minecraft/client/renderer/block/model/IBakedModel;=|p_177578_1_,p_177578_2_,p_177578_3_ +net/minecraft/client/renderer/block/model/ModelBakery.makeBakedQuad(Lnet/minecraft/client/renderer/block/model/BlockPart;Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;Lnet/minecraftforge/client/model/ITransformation;Z)Lnet/minecraft/client/renderer/block/model/BakedQuad;=|p_177589_1_,p_177589_2_,p_177589_3_,p_177589_4_,p_177589_5_,p_177589_6_ net/minecraft/client/renderer/block/model/FaceBakery.makeBakedQuad(Lorg/lwjgl/util/vector/Vector3f;Lorg/lwjgl/util/vector/Vector3f;Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;Lnet/minecraftforge/client/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;ZZ)Lnet/minecraft/client/renderer/block/model/BakedQuad;=|p_178414_1_,p_178414_2_,p_178414_3_,p_178414_4_,p_178414_5_,p_178414_6_,p_178414_7_,p_178414_8_,p_178414_9_ -net/minecraft/client/renderer/block/model/FaceBakery.makeQuadVertexData(Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;[FLnet/minecraftforge/client/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;ZZ)[I=|p_178405_1_,p_178405_2_,p_178405_3_,p_178405_4_,p_178405_5_,p_178405_6_,p_178405_7_,p_178405_8_ -net/minecraft/client/renderer/block/model/FaceBakery.fillVertexData([IILnet/minecraft/util/EnumFacing;Lnet/minecraft/client/renderer/block/model/BlockPartFace;[FLnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraftforge/client/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;ZZ)V=|p_178402_1_,p_178402_2_,p_178402_3_,p_178402_4_,p_178402_5_,p_178402_6_,p_178402_7_,p_178402_8_,p_178402_9_,p_178402_10_ -net/minecraft/client/renderer/block/model/FaceBakery.rotateVertex(Lorg/lwjgl/util/vector/Vector3f;Lnet/minecraft/util/EnumFacing;ILnet/minecraftforge/client/model/ITransformation;Z)I=|p_178415_1_,p_178415_2_,p_178415_3_,p_178415_4_,p_178415_5_ +net/minecraft/client/renderer/block/model/FaceBakery.makeQuadVertexData(Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;[FLnet/minecraftforge/client/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;Z)[I=|p_188012_1_,p_188012_2_,p_188012_3_,p_188012_4_,p_188012_5_,p_188012_6_,p_188012_7_ +net/minecraft/client/renderer/block/model/FaceBakery.fillVertexData([IILnet/minecraft/util/EnumFacing;Lnet/minecraft/client/renderer/block/model/BlockFaceUV;[FLnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraftforge/client/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;Z)V=|p_188015_1_,p_188015_2_,p_188015_3_,p_188015_4_,p_188015_5_,p_188015_6_,p_188015_7_,p_188015_8_,p_188015_9_ +net/minecraft/client/renderer/block/model/FaceBakery.rotateVertex(Lorg/lwjgl/util/vector/Vector3f;Lnet/minecraft/util/EnumFacing;ILnet/minecraftforge/client/model/ITransformation)I=|p_188011_1_,p_188011_2_,p_188011_3_,p_188011_4_ net/minecraft/item/ItemBlock.setTileEntityNBT(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/EntityPlayer;)Z=|p_179224_0_,p_179224_1_,p_179224_2_,player From c9a01a439dacd92a11d25f6ada3792d4f6452c2f Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 1 Mar 2016 19:22:21 +0300 Subject: [PATCH 009/243] A bunch of rendering rejects updated. --- .../net/minecraft/block/Block.java.patch | 2 +- .../BlockRendererDispatcher.java.patch | 31 ++++++++ .../InventoryEffectRenderer.java.patch | 12 ++- .../client/renderer/ItemRenderer.java.patch | 36 ++++++++- .../client/renderer/VertexBuffer.java.patch | 21 ++--- .../WorldVertexBufferUploader.java.patch | 57 ++++++++++++++ .../renderer/chunk/RenderChunk.java.patch | 15 +++- .../renderer/texture/TextureMap.java.patch | 77 +++++++++++++++++-- .../TileEntityRendererDispatcher.java.patch | 19 ++++- .../BlockModelRenderer.java.patch.rej | 23 ------ .../BlockRendererDispatcher.java.patch.rej | 50 ------------ .../InventoryEffectRenderer.java.patch.rej | 9 --- .../renderer/ItemRenderer.java.patch.rej | 39 ---------- .../WorldVertexBufferUploader.java.patch.rej | 66 ---------------- .../renderer/chunk/RenderChunk.java.patch.rej | 12 --- .../texture/TextureMap.java.patch.rej | 70 ----------------- ...ileEntityRendererDispatcher.java.patch.rej | 16 ---- .../client/ForgeHooksClient.java | 21 +++++ 18 files changed, 262 insertions(+), 314 deletions(-) create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch rename rejects/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch.rej => patches.mcp/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch (82%) create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch index 921d8e7bdc..9234bf198f 100644 --- a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch @@ -1267,7 +1267,7 @@ + * Queries if this block should render in a given layer. + * ISmartBlockModel can use MinecraftForgeClient.getRenderLayer to alter their model based on layer + */ -+ public boolean canRenderInLayer(EnumWorldBlockLayer layer) ++ public boolean canRenderInLayer(BlockRenderLayer layer) + { + return getBlockLayer() == layer; + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch new file mode 100644 index 0000000000..b5feb11544 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java +@@ -29,7 +29,7 @@ + public BlockRendererDispatcher(BlockModelShapes p_i46577_1_, BlockColors p_i46577_2_) + { + this.blockModelShapes = p_i46577_1_; +- this.blockModelRenderer = new BlockModelRenderer(p_i46577_2_); ++ this.blockModelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(p_i46577_2_); + this.fluidRenderer = new BlockFluidRenderer(p_i46577_2_); + } + +@@ -44,7 +44,7 @@ + { + state = state.func_185899_b(blockAccess, pos); + IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(state); +- IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(state, ibakedmodel, texture, pos)).makeBakedModel(); ++ IBakedModel ibakedmodel1 = net.minecraftforge.client.ForgeHooksClient.getDamageModel(ibakedmodel, texture, state, blockAccess, pos); + this.blockModelRenderer.renderModel(blockAccess, ibakedmodel1, state, pos, Tessellator.getInstance().getWorldRenderer(), true); + } + } +@@ -76,7 +76,9 @@ + switch (enumblockrendertype) + { + case MODEL: +- return this.blockModelRenderer.renderModel(blockAccess, this.func_184389_a(state), state, pos, worldRendererIn, true); ++ IBakedModel model = this.func_184389_a(state); ++ state = state.getBlock().getExtendedState(state, blockAccess, pos); ++ return this.blockModelRenderer.renderModel(blockAccess, model, state, pos, worldRendererIn, true); + case ENTITYBLOCK_ANIMATED: + return false; + case LIQUID: diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch index db8cbd4b78..2ac9eee595 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch @@ -7,14 +7,22 @@ - if (!this.mc.thePlayer.getActivePotionEffects().isEmpty()) + boolean hasVisibleEffect = false; + for(PotionEffect potioneffect : this.mc.thePlayer.getActivePotionEffects()) { -+ Potion potion = Potion.potionTypes[potioneffect.getPotionID()]; ++ Potion potion = potioneffect.func_188419_a(); + if(potion.shouldRender(potioneffect)) { hasVisibleEffect = true; break; } + } + if (!this.mc.thePlayer.getActivePotionEffects().isEmpty() && hasVisibleEffect) { this.guiLeft = 160 + (this.width - this.xSize - 200) / 2; this.hasActivePotionEffects = true; -@@ -81,6 +86,8 @@ +@@ -71,6 +76,7 @@ + for (PotionEffect potioneffect : Ordering.natural().sortedCopy(collection)) + { + Potion potion = potioneffect.func_188419_a(); ++ if(!potion.shouldRender(potioneffect)) continue; + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(inventoryBackground); + this.drawTexturedModalRect(i, j, 0, 166, 140, 32); +@@ -81,6 +87,8 @@ this.drawTexturedModalRect(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18); } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index 208eda40c1..e5bce5664f 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -1,5 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java +@@ -360,7 +360,7 @@ + this.func_187456_a(p_187457_7_, p_187457_5_, enumhandside); + } + } +- else if (p_187457_6_.getItem() == Items.filled_map) ++ else if (p_187457_6_.getItem() instanceof net.minecraft.item.ItemMap) + { + if (flag && this.field_187468_e == null) + { @@ -444,6 +444,7 @@ if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) { @@ -8,7 +17,21 @@ EntityPlayer entityplayer = this.mc.thePlayer; for (int i = 0; i < 8; ++i) -@@ -470,11 +471,13 @@ +@@ -457,11 +458,13 @@ + if (iblockstate1.getBlock().isVisuallyOpaque()) + { + iblockstate = iblockstate1; ++ overlayPos = blockpos; + } + } + + if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, partialTicks, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, overlayPos)) + this.func_178108_a(partialTicks, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); + } + } +@@ -470,11 +473,13 @@ { if (this.mc.thePlayer.isInsideOfMaterial(Material.water)) { @@ -22,3 +45,14 @@ this.renderFireInFirstPerson(partialTicks); } } +@@ -596,8 +601,8 @@ + else + { + float f = entityplayersp.func_184825_o(1.0F); +- this.field_187469_f += MathHelper.clamp_float((Objects.equal(this.field_187467_d, itemstack) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); +- this.field_187471_h += MathHelper.clamp_float((float)(Objects.equal(this.field_187468_e, itemstack1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); ++ this.field_187469_f += MathHelper.clamp_float((net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187467_d, itemstack) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); ++ this.field_187471_h += MathHelper.clamp_float((float)(net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187468_e, itemstack1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); + } + + if (this.field_187469_f < 0.1F) diff --git a/rejects/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch.rej b/patches.mcp/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch similarity index 82% rename from rejects/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch index 4c835fe91b..4e7a3a8c47 100644 --- a/rejects/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch @@ -1,4 +1,6 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/client/renderer/VertexBuffer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/VertexBuffer.java +@@ -510,15 +510,15 @@ break; case USHORT: case SHORT: @@ -20,22 +22,13 @@ } this.nextVertexFormatIndex(); -++++ END PATCH -++++ REJECTED PATCH 2 +@@ -609,4 +609,9 @@ + return this.stateVertexFormat; } } - -+ public void checkAndGrow() -+ { -+ this.growBuffer(vertexFormat.getNextOffset()/* / 4 * 4 */); -+ } + + public boolean isColorDisabled() + { -+ return noColor; ++ return noColor; + } -+ - @SideOnly(Side.CLIENT) - public class State - { -++++ END PATCH + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch new file mode 100644 index 0000000000..8d2a98861d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch @@ -0,0 +1,57 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java +@@ -28,26 +28,8 @@ + int l = vertexformatelement.getIndex(); + bytebuffer.position(vertexformat.func_181720_d(j)); + +- switch (vertexformatelement$enumusage) +- { +- case POSITION: +- GlStateManager.func_187427_b(vertexformatelement.getElementCount(), k, i, bytebuffer); +- GlStateManager.func_187410_q(32884); +- break; +- case UV: +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l); +- GlStateManager.func_187404_a(vertexformatelement.getElementCount(), k, i, bytebuffer); +- GlStateManager.func_187410_q(32888); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); +- break; +- case COLOR: +- GlStateManager.func_187400_c(vertexformatelement.getElementCount(), k, i, bytebuffer); +- GlStateManager.func_187410_q(32886); +- break; +- case NORMAL: +- GlStateManager.func_187446_a(k, i, bytebuffer); +- GlStateManager.func_187410_q(32885); +- } ++ // moved to VertexFormatElement.preDraw ++ vertexformatelement.getUsage().preDraw(vertexformat, j, i, bytebuffer); + } + + GlStateManager.func_187439_f(p_181679_1_.getDrawMode(), 0, p_181679_1_.getVertexCount()); +@@ -59,23 +41,8 @@ + VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.getUsage(); + int k1 = vertexformatelement1.getIndex(); + +- switch (vertexformatelement$enumusage1) +- { +- case POSITION: +- GlStateManager.func_187429_p(32884); +- break; +- case UV: +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k1); +- GlStateManager.func_187429_p(32888); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); +- break; +- case COLOR: +- GlStateManager.func_187429_p(32886); +- GlStateManager.resetColor(); +- break; +- case NORMAL: +- GlStateManager.func_187429_p(32885); +- } ++ // moved to VertexFormatElement.postDraw ++ vertexformatelement1.getUsage().postDraw(vertexformat, i1, i, bytebuffer); + } + } + diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch index 33082d5943..5d8e6284be 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch @@ -20,7 +20,18 @@ { TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos)); TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileentity); -@@ -191,6 +193,7 @@ +@@ -176,7 +178,9 @@ + } + } + +- BlockRenderLayer blockrenderlayer1 = block.getBlockLayer(); ++ for(BlockRenderLayer blockrenderlayer1 : BlockRenderLayer.values()) { ++ if(!block.canRenderInLayer(blockrenderlayer1)) continue; ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(blockrenderlayer1); + int j = blockrenderlayer1.ordinal(); + + if (block.getDefaultState().func_185901_i() != EnumBlockRenderType.INVISIBLE) +@@ -191,6 +195,7 @@ aboolean[j] |= blockrendererdispatcher.renderBlock(iblockstate, blockpos$mutableblockpos, iblockaccess, vertexbuffer); } @@ -28,7 +39,7 @@ } for (BlockRenderLayer blockrenderlayer : BlockRenderLayer.values()) -@@ -413,6 +416,26 @@ +@@ -413,6 +418,26 @@ return this.needsUpdate && this.field_188284_q; } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index e0a4f35e60..25c12062ea 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -40,11 +40,62 @@ } private void initMissingImage() -@@ -139,9 +152,13 @@ +@@ -88,12 +101,26 @@ + int j = Integer.MAX_VALUE; + int k = 1 << this.mipmapLevels; + ++ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this); ++ net.minecraftforge.fml.common.FMLLog.info("Max texture size: %d", i); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.mapRegisteredSprites.size()); ++ ++ if(!skipFirst) + for (Entry entry : this.mapRegisteredSprites.entrySet()) + { + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); + ResourceLocation resourcelocation = this.func_184396_a(textureatlassprite); ++ bar.step(resourcelocation.getResourcePath()); + IResource iresource = null; + ++ if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) ++ { ++ if (textureatlassprite.load(resourceManager, resourcelocation)) ++ { ++ continue; ++ } ++ } ++ else + try + { + PngSizeInfo pngsizeinfo = PngSizeInfo.func_188532_a(resourceManager.getResource(resourcelocation)); +@@ -103,12 +130,14 @@ + } + catch (RuntimeException runtimeexception) + { +- logger.error((String)("Unable to parse metadata from " + resourcelocation), (Throwable)runtimeexception); ++ //logger.error((String)("Unable to parse metadata from " + resourcelocation), (Throwable)runtimeexception); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation, runtimeexception.getMessage()); + continue; + } + catch (IOException ioexception) + { +- logger.error((String)("Using missing texture, unable to load " + resourcelocation), (Throwable)ioexception); ++ //logger.error((String)("Using missing texture, unable to load " + resourcelocation), (Throwable)ioexception); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation); + continue; + } + finally +@@ -128,6 +157,7 @@ + stitcher.addSprite(textureatlassprite); + } + ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); + int l = Math.min(j, k); + int i1 = MathHelper.calculateLogBaseTwo(l); + +@@ -139,9 +169,12 @@ this.missingImage.generateMipmaps(this.mipmapLevels); stitcher.addSprite(this.missingImage); -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); + skipFirst = false; + bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 3); @@ -54,9 +105,21 @@ stitcher.doStitch(); } catch (StitcherException stitcherexception) -@@ -253,6 +270,13 @@ - crashreportcategory.addCrashSection("Mipmap levels", Integer.valueOf(this.mipmapLevels)); - throw new ReportedException(crashreport); +@@ -150,9 +183,11 @@ + } + + logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); ++ bar.step("Allocating GL texture"); + TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); + Map map = Maps.newHashMap(this.mapRegisteredSprites); + ++ bar.step("Uploading GL texture"); + for (TextureAtlasSprite textureatlassprite1 : stitcher.getStichSlots()) + { + if (textureatlassprite1 == this.missingImage || this.func_184397_a(resourceManager, textureatlassprite1)) +@@ -185,6 +220,13 @@ + { + textureatlassprite2.copyFrom(this.missingImage); } + + net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); @@ -67,8 +130,8 @@ + net.minecraftforge.fml.common.ProgressManager.pop(bar); } - private ResourceLocation func_184396_a(TextureAtlasSprite p_184396_1_) -@@ -317,4 +341,37 @@ + private boolean func_184397_a(IResourceManager p_184397_1_, final TextureAtlasSprite p_184397_2_) +@@ -317,4 +359,37 @@ { return this.missingImage; } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch index 0f22cecab2..d84e76f4e9 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch @@ -1,6 +1,21 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java +++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java -@@ -129,6 +129,11 @@ +@@ -106,11 +106,14 @@ + { + if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared()) + { ++ if(!tileentityIn.hasFastRenderer()) ++ { + int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0); + int j = i % 65536; + int k = i / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); ++ } + BlockPos blockpos = tileentityIn.getPos(); + this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage); + } +@@ -129,6 +132,11 @@ { try { @@ -12,7 +27,7 @@ tileentityspecialrenderer.renderTileEntityAt(tileEntityIn, x, y, z, partialTicks, destroyStage); } catch (Throwable throwable) -@@ -155,4 +160,49 @@ +@@ -155,4 +163,49 @@ { return this.fontRenderer; } diff --git a/rejects/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch.rej deleted file mode 100644 index 21f015f76a..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch.rej +++ /dev/null @@ -1,23 +0,0 @@ -++++ REJECTED PATCH 1 - @SideOnly(Side.CLIENT) - public static enum EnumNeighborInfo - { -- DOWN(new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.5F, false, new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0]), -- UP(new EnumFacing[]{EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH}, 1.0F, false, new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0]), -+ // -- Forge Patch to Fix Top/Bottom Lighting Interpolation -- -+ // Forge PR - https://github.com/MinecraftForge/MinecraftForge/pull/1892 -+ // Mojang Bug - https://bugs.mojang.com/browse/MC-80148 -+ DOWN( new EnumFacing[]{ EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH }, 0.5F, true, -+ new Orientation[]{ Orientation.FLIP_WEST, Orientation.SOUTH, Orientation.FLIP_WEST, Orientation.FLIP_SOUTH, Orientation.WEST, Orientation.FLIP_SOUTH, Orientation.WEST, Orientation.SOUTH }, -+ new Orientation[]{ Orientation.FLIP_WEST, Orientation.NORTH, Orientation.FLIP_WEST, Orientation.FLIP_NORTH, Orientation.WEST, Orientation.FLIP_NORTH, Orientation.WEST, Orientation.NORTH }, -+ new Orientation[]{ Orientation.FLIP_EAST, Orientation.NORTH, Orientation.FLIP_EAST, Orientation.FLIP_NORTH, Orientation.EAST, Orientation.FLIP_NORTH, Orientation.EAST, Orientation.NORTH }, -+ new Orientation[]{ Orientation.FLIP_EAST, Orientation.SOUTH, Orientation.FLIP_EAST, Orientation.FLIP_SOUTH, Orientation.EAST, Orientation.FLIP_SOUTH, Orientation.EAST, Orientation.SOUTH } ), -+ UP( new EnumFacing[]{ EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH }, 1.0F, true, -+ new Orientation[]{ Orientation.EAST, Orientation.SOUTH, Orientation.EAST, Orientation.FLIP_SOUTH, Orientation.FLIP_EAST, Orientation.FLIP_SOUTH, Orientation.FLIP_EAST, Orientation.SOUTH }, -+ new Orientation[]{ Orientation.EAST, Orientation.NORTH, Orientation.EAST, Orientation.FLIP_NORTH, Orientation.FLIP_EAST, Orientation.FLIP_NORTH, Orientation.FLIP_EAST, Orientation.NORTH }, -+ new Orientation[]{ Orientation.WEST, Orientation.NORTH, Orientation.WEST, Orientation.FLIP_NORTH, Orientation.FLIP_WEST, Orientation.FLIP_NORTH, Orientation.FLIP_WEST, Orientation.NORTH }, -+ new Orientation[]{ Orientation.WEST, Orientation.SOUTH, Orientation.WEST, Orientation.FLIP_SOUTH, Orientation.FLIP_WEST, Orientation.FLIP_SOUTH, Orientation.FLIP_WEST, Orientation.SOUTH } ), - NORTH(new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.WEST}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST}), - SOUTH(new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.DOWN, EnumFacing.UP}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST}), - WEST(new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.6F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.SOUTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.SOUTH}), -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch.rej deleted file mode 100644 index 5c6e047afc..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch.rej +++ /dev/null @@ -1,50 +0,0 @@ -++++ REJECTED PATCH 1 - { - private BlockModelShapes blockModelShapes; - private final GameSettings gameSettings; -- private final BlockModelRenderer blockModelRenderer = new BlockModelRenderer(); -+ private final BlockModelRenderer blockModelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(); - private final ChestRenderer chestRenderer = new ChestRenderer(); - private final BlockFluidRenderer fluidRenderer = new BlockFluidRenderer(); - -++++ END PATCH -++++ REJECTED PATCH 2 - { - state = block.getActualState(state, blockAccess, pos); - IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(state); -+ -+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) -+ { -+ IBlockState extendedState = block.getExtendedState(state, blockAccess, pos); -+ for ( net.minecraft.util.EnumWorldBlockLayer layer : net.minecraft.util.EnumWorldBlockLayer.values() ) -+ { -+ if ( block.canRenderInLayer( layer ) ) -+ { -+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(layer); -+ -+ IBakedModel targetLayer = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); -+ IBakedModel damageModel = (new SimpleBakedModel.Builder(targetLayer, texture)).makeBakedModel(); -+ this.blockModelRenderer.renderModel(blockAccess, damageModel, state, pos, Tessellator.getInstance().getWorldRenderer()); -+ } -+ } -+ return; -+ } -+ - IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, texture)).makeBakedModel(); - this.blockModelRenderer.renderModel(blockAccess, ibakedmodel1, state, pos, Tessellator.getInstance().getWorldRenderer()); - } -++++ END PATCH -++++ REJECTED PATCH 3 - ibakedmodel = ((WeightedBakedModel)ibakedmodel).getAlternativeModel(MathHelper.getPositionRandom(pos)); - } - -+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) -+ { -+ IBlockState extendedState = block.getExtendedState(state, worldIn, pos); -+ ibakedmodel = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); -+ } -+ - return ibakedmodel; - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch.rej deleted file mode 100644 index c919cc702e..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 2 - for (PotionEffect potioneffect : this.mc.thePlayer.getActivePotionEffects()) - { - Potion potion = Potion.potionTypes[potioneffect.getPotionID()]; -+ if(!potion.shouldRender(potioneffect)) continue; - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(inventoryBackground); - this.drawTexturedModalRect(i, j, 0, 166, 140, 32); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej deleted file mode 100644 index d321fc02f6..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej +++ /dev/null @@ -1,39 +0,0 @@ -++++ REJECTED PATCH 1 - - if (this.itemToRender != null) - { -- if (this.itemToRender.getItem() == Items.filled_map) -+ if (this.itemToRender.getItem() instanceof net.minecraft.item.ItemMap) - { - this.renderItemMap(abstractclientplayer, f2, f, f1); - } -++++ END PATCH -++++ REJECTED PATCH 3 - if (iblockstate1.getBlock().isVisuallyOpaque()) - { - iblockstate = iblockstate1; -+ overlayPos = blockpos; - } - } - - if (iblockstate.getBlock().getRenderType() != -1) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, partialTicks, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, overlayPos)) - this.func_178108_a(partialTicks, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); - } - } -++++ END PATCH -++++ REJECTED PATCH 5 - { - if (!this.itemToRender.getIsItemStackEqual(itemstack)) - { -+ if (!this.itemToRender.getItem().shouldCauseReequipAnimation(this.itemToRender, itemstack, equippedItemSlot != entityplayer.inventory.currentItem)) -+ { -+ this.itemToRender = itemstack; -+ this.equippedItemSlot = entityplayer.inventory.currentItem; -+ return; -+ } - flag = true; - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej deleted file mode 100644 index 1aadf25404..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej +++ /dev/null @@ -1,66 +0,0 @@ -++++ REJECTED PATCH 1 - - for (int j = 0; j < list.size(); ++j) - { -+ // moved to VertexFormatElement.preDraw - VertexFormatElement vertexformatelement = (VertexFormatElement)list.get(j); -- VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.getUsage(); -- int k = vertexformatelement.getType().getGlConstant(); -- int l = vertexformatelement.getIndex(); -- bytebuffer.position(vertexformat.func_181720_d(j)); -- -- switch (vertexformatelement$enumusage) -- { -- case POSITION: -- GL11.glVertexPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); -- GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); -- break; -- case UV: -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l); -- GL11.glTexCoordPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); -- GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); -- break; -- case COLOR: -- GL11.glColorPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); -- GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); -- break; -- case NORMAL: -- GL11.glNormalPointer(k, i, bytebuffer); -- GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); -- } -+ vertexformatelement.getUsage().preDraw(vertexformat, j, i, bytebuffer); - } - - GL11.glDrawArrays(p_181679_1_.getDrawMode(), 0, p_181679_1_.getVertexCount()); -++++ END PATCH -++++ REJECTED PATCH 2 - for (int j1 = list.size(); i1 < j1; ++i1) - { - VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1); -- VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.getUsage(); -- int k1 = vertexformatelement1.getIndex(); -- -- switch (vertexformatelement$enumusage1) -- { -- case POSITION: -- GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); -- break; -- case UV: -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k1); -- GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); -- break; -- case COLOR: -- GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); -- GlStateManager.resetColor(); -- break; -- case NORMAL: -- GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); -- } -+ // moved to VertexFormatElement.postDraw -+ vertexformatelement1.getUsage().postDraw(vertexformat, i1, i, bytebuffer); - } - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej deleted file mode 100644 index 18d3267450..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej +++ /dev/null @@ -1,12 +0,0 @@ -++++ REJECTED PATCH 3 - } - } - -- EnumWorldBlockLayer enumworldblocklayer1 = block.getBlockLayer(); -+ for(EnumWorldBlockLayer enumworldblocklayer1 : EnumWorldBlockLayer.values()) { -+ if(!block.canRenderInLayer(enumworldblocklayer1)) continue; -+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1); - int j = enumworldblocklayer1.ordinal(); - - if (block.getRenderType() != -1) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej index 25b88228c7..b48a3f0884 100644 --- a/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej +++ b/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej @@ -1,60 +1,3 @@ -++++ REJECTED PATCH 4 - int j = Integer.MAX_VALUE; - int k = 1 << this.mipmapLevels; - -+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this); -+ net.minecraftforge.fml.common.FMLLog.info("Max texture size: %d", i); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.mapRegisteredSprites.size()); -+ -+ if(!skipFirst) - for (Entry entry : this.mapRegisteredSprites.entrySet()) - { - TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); - ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.getIconName()); - ResourceLocation resourcelocation1 = this.completeResourceLocation(resourcelocation, 0); -+ bar.step(resourcelocation1.getResourcePath()); - -+ if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) -+ { -+ if (!textureatlassprite.load(resourceManager, resourcelocation)) -+ { -+ j = Math.min(j, Math.min(textureatlassprite.getIconWidth(), textureatlassprite.getIconHeight())); -+ stitcher.addSprite(textureatlassprite); -+ } -+ continue; -+ } -+ - try - { - IResource iresource = resourceManager.getResource(resourcelocation1); -++++ END PATCH -++++ REJECTED PATCH 5 - } - catch (RuntimeException runtimeexception) - { -- logger.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception); -+ //logger.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation1, runtimeexception.getMessage()); - continue; - } - catch (IOException ioexception1) - { -- logger.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1); -+ //logger.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation1); - continue; - } - -++++ END PATCH -++++ REJECTED PATCH 6 - stitcher.addSprite(textureatlassprite); - } - -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); - int j1 = Math.min(j, k); - int k1 = MathHelper.calculateLogBaseTwo(j1); - -++++ END PATCH ++++ REJECTED PATCH 7 this.mipmapLevels = k1; } @@ -68,16 +11,3 @@ { textureatlassprite1.generateMipmaps(this.mipmapLevels); ++++ END PATCH -++++ REJECTED PATCH 9 - } - - logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); -+ bar.step("Allocating GL texture"); - TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); - Map map = Maps.newHashMap(this.mapRegisteredSprites); - -+ bar.step("Uploading GL texture"); - for (TextureAtlasSprite textureatlassprite2 : stitcher.getStichSlots()) - { - String s = textureatlassprite2.getIconName(); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch.rej deleted file mode 100644 index 4cd0abd615..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch.rej +++ /dev/null @@ -1,16 +0,0 @@ -++++ REJECTED PATCH 1 - { - if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared()) - { -+ if(!tileentityIn.hasFastRenderer()) -+ { - int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0); - int j = i % 65536; - int k = i / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -+ } - BlockPos blockpos = tileentityIn.getPos(); - this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage); - } -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 9c32496f81..a806b6ff79 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -26,6 +26,7 @@ import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; @@ -34,6 +35,8 @@ import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelManager; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.model.ModelRotation; +import net.minecraft.client.renderer.block.model.SimpleBakedModel; +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.renderer.tileentity.TileEntityRendererDispatcher; @@ -83,6 +86,7 @@ import net.minecraftforge.fml.common.FMLLog; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.BufferUtils; +import com.google.common.base.Objects; import com.google.common.base.Optional; import com.google.common.collect.Maps; @@ -594,4 +598,21 @@ public class ForgeHooksClient } } } + + public static IBakedModel getDamageModel(IBakedModel ibakedmodel, TextureAtlasSprite texture, IBlockState state, IBlockAccess world, BlockPos pos) + { + // TODO custom damage models + // state = state.block.getExtendedState(state, world, pos); + return (new SimpleBakedModel.Builder(state, ibakedmodel, texture, pos)).makeBakedModel(); + } + + public static boolean shouldCauseReequipAnimation(ItemStack from, ItemStack to) + { + if(!Objects.equal(from, to) || from == null) + { + return false; + } + // FIXME: 3rd argument? + return from.getItem().shouldCauseReequipAnimation(from, to); + } } From 153fb6b30dcc8fc43c7bc5c8e2ad1345a71aa90a Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 1 Mar 2016 20:13:37 +0300 Subject: [PATCH 010/243] RendererLivingEntity, RenderEntityItem, RenderItem, RenderManager, LayerArmorBase; Item.getModel + ISmartItemModel are now inside ItemOverrideList; fix class rename in TESR patch. --- .../client/renderer/RenderItem.java.patch | 97 +++++++++++++++++++ .../block/model/IBakedModel.java.patch | 4 +- .../block/model/ItemOverrideList.java.patch | 40 ++++++++ .../entity/RenderEntityItem.java.patch | 48 ++++++++- .../entity/RenderLivingBase.java.patch | 52 +++++----- .../renderer/entity/RenderManager.java.patch | 12 +++ .../entity/layers/LayerArmorBase.java.patch | 92 +++++++++++++++++- .../TileEntitySpecialRenderer.java.patch | 2 +- .../entity/RenderEntityItem.java.patch.rej | 39 -------- .../renderer/entity/RenderItem.java.patch.rej | 96 ------------------ .../entity/RenderManager.java.patch.rej | 13 --- .../layers/LayerArmorBase.java.patch.rej | 93 ------------------ 12 files changed, 313 insertions(+), 275 deletions(-) create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch rename rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej => patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch (52%) delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch new file mode 100644 index 0000000000..6cb9847a9a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch @@ -0,0 +1,97 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/RenderItem.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/RenderItem.java +@@ -71,7 +71,7 @@ + public RenderItem(TextureManager p_i46552_1_, ModelManager p_i46552_2_, ItemColors p_i46552_3_) + { + this.textureManager = p_i46552_1_; +- this.itemModelMesher = new ItemModelMesher(p_i46552_2_); ++ this.itemModelMesher = new net.minecraftforge.client.ItemModelMesherForge(p_i46552_2_); + this.registerItems(); + this.field_184395_f = p_i46552_3_; + } +@@ -223,7 +223,7 @@ + k = k | -16777216; + } + +- this.renderQuad(renderer, bakedquad, k); ++ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, k); + } + } + +@@ -245,17 +245,7 @@ + public IBakedModel func_184393_a(ItemStack p_184393_1_, World p_184393_2_, EntityLivingBase p_184393_3_) + { + IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(p_184393_1_); +- Item item = p_184393_1_.getItem(); +- +- if (item != null && item.func_185040_i()) +- { +- ResourceLocation resourcelocation = ibakedmodel.func_188617_f().func_188021_a(p_184393_1_, p_184393_2_, p_184393_3_); +- return resourcelocation == null ? ibakedmodel : this.itemModelMesher.getModelManager().getModel(new ModelResourceLocation(resourcelocation, "inventory")); +- } +- else +- { +- return ibakedmodel; +- } ++ return ibakedmodel.func_188617_f().handleItemState(ibakedmodel, p_184393_1_, p_184393_2_, p_184393_3_); + } + + public void func_184392_a(ItemStack p_184392_1_, EntityLivingBase p_184392_2_, ItemCameraTransforms.TransformType p_184392_3_, boolean p_184392_4_) +@@ -279,14 +269,9 @@ + GlStateManager.enableBlend(); + GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.pushMatrix(); +- ItemCameraTransforms itemcameratransforms = p_184394_2_.getItemCameraTransforms(); +- ItemCameraTransforms.func_188034_a(itemcameratransforms.getTransform(p_184394_3_), p_184394_4_); ++ // TODO: check if negative scale is a thing ++ p_184394_2_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_184394_2_, p_184394_3_); + +- if (this.func_183005_a(itemcameratransforms.getTransform(p_184394_3_))) +- { +- GlStateManager.func_187407_a(GlStateManager.CullFace.FRONT); +- } +- + this.renderItem(p_184394_1_, p_184394_2_); + GlStateManager.func_187407_a(GlStateManager.CullFace.BACK); + GlStateManager.popMatrix(); +@@ -319,7 +304,7 @@ + GlStateManager.func_187401_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.setupGuiTransform(p_184390_2_, p_184390_3_, p_184390_4_.isGui3d()); +- p_184390_4_.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GUI); ++ p_184390_4_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_184390_4_, ItemCameraTransforms.TransformType.GUI); + this.renderItem(p_184390_1_, p_184390_4_); + GlStateManager.disableAlpha(); + GlStateManager.disableRescaleNormal(); +@@ -426,10 +411,11 @@ + GlStateManager.enableDepth(); + } + +- if (stack.isItemDamaged()) ++ if (stack.getItem().showDurabilityBar(stack)) + { +- int j = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage()); +- int i = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); ++ double health = stack.getItem().getDurabilityForDisplay(stack); ++ int j = (int)Math.round(13.0D - health * 13.0D); ++ int i = (int)Math.round(255.0D - health * 255.0D); + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + GlStateManager.disableTexture2D(); +@@ -440,7 +426,7 @@ + this.func_181565_a(vertexbuffer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255); + this.func_181565_a(vertexbuffer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255); + this.func_181565_a(vertexbuffer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255); +- GlStateManager.enableBlend(); ++ //GlStateManager.enableBlend(); // Forge: Disable Blend because it screws with a lot of things down the line. + GlStateManager.enableAlpha(); + GlStateManager.enableTexture2D(); + GlStateManager.enableLighting(); +@@ -1053,6 +1039,7 @@ + this.registerBlock(Blocks.field_185779_df, TileEntityStructure.Mode.LOAD.func_185110_a(), "structure_block"); + this.registerBlock(Blocks.field_185779_df, TileEntityStructure.Mode.CORNER.func_185110_a(), "structure_block"); + this.registerBlock(Blocks.field_185779_df, TileEntityStructure.Mode.DATA.func_185110_a(), "structure_block"); ++ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.itemModelMesher); + } + + public void onResourceManagerReload(IResourceManager resourceManager) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch index 552a4b1c6a..b346a58914 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch @@ -1,12 +1,10 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java -@@ -20,7 +20,9 @@ +@@ -20,6 +20,7 @@ TextureAtlasSprite getParticleTexture(); + @Deprecated ItemCameraTransforms getItemCameraTransforms(); -+ @Deprecated ItemOverrideList func_188617_f(); - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch new file mode 100644 index 0000000000..ae8b72c435 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch @@ -0,0 +1,40 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java +@@ -1,7 +1,10 @@ + package net.minecraft.client.renderer.block.model; + + import com.google.common.collect.Lists; ++ + import java.util.List; ++ ++import net.minecraft.client.Minecraft; + import net.minecraft.entity.EntityLivingBase; + import net.minecraft.item.ItemStack; + import net.minecraft.util.ResourceLocation; +@@ -27,6 +30,7 @@ + } + } + ++ @Deprecated + public ResourceLocation func_188021_a(ItemStack p_188021_1_, World p_188021_2_, EntityLivingBase p_188021_3_) + { + if (!this.field_188023_b.isEmpty()) +@@ -42,4 +46,18 @@ + + return null; + } ++ ++ public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) ++ { ++ net.minecraft.item.Item item = stack.getItem(); ++ if (item != null && item.func_185040_i()) ++ { ++ ResourceLocation location = func_188021_a(stack, world, entity); ++ if (location != null) ++ { ++ return Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getModel(new ModelResourceLocation(location, "inventory")); ++ } ++ } ++ return originalModel; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch index a7d80ed880..c045d35453 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch @@ -9,7 +9,53 @@ float f2 = p_177077_9_.getItemCameraTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y; GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_); -@@ -192,4 +192,25 @@ +@@ -114,16 +114,13 @@ + GlStateManager.pushMatrix(); + IBakedModel ibakedmodel = this.itemRenderer.func_184393_a(itemstack, entity.worldObj, (EntityLivingBase)null); + int j = this.func_177077_a(entity, x, y, z, partialTicks, ibakedmodel); +- float f = ibakedmodel.getItemCameraTransforms().ground.scale.x; +- float f1 = ibakedmodel.getItemCameraTransforms().ground.scale.y; +- float f2 = ibakedmodel.getItemCameraTransforms().ground.scale.z; + boolean flag1 = ibakedmodel.isGui3d(); + + if (!flag1) + { +- float f3 = -0.0F * (float)(j - 1) * 0.5F * f; +- float f4 = -0.0F * (float)(j - 1) * 0.5F * f1; +- float f5 = -0.09375F * (float)(j - 1) * 0.5F * f2; ++ float f3 = -0.0F * (float)(j - 1) * 0.5F; ++ float f4 = -0.0F * (float)(j - 1) * 0.5F; ++ float f5 = -0.09375F * (float)(j - 1) * 0.5F; + GlStateManager.translate(f3, f4, f5); + } + +@@ -144,10 +141,10 @@ + float f7 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f9 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f6 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; +- GlStateManager.translate(f7, f9, f6); ++ GlStateManager.translate(shouldSpreadItems() ? f7 : 0, shouldSpreadItems() ? f9 : 0, f6); + } + +- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); ++ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND); + this.itemRenderer.renderItem(itemstack, ibakedmodel); + GlStateManager.popMatrix(); + } +@@ -162,10 +159,10 @@ + GlStateManager.translate(f8, f10, 0.0F); + } + +- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); ++ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND); + this.itemRenderer.renderItem(itemstack, ibakedmodel); + GlStateManager.popMatrix(); +- GlStateManager.translate(0.0F * f, 0.0F * f1, 0.09375F * f2); ++ GlStateManager.translate(0.0F, 0.0F, 0.09375F); + } + } + +@@ -192,4 +189,25 @@ { return TextureMap.locationBlocksTexture; } diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch similarity index 52% rename from rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch index 48ad3c48d3..d85da68b73 100644 --- a/rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch @@ -1,53 +1,51 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java +@@ -32,6 +32,9 @@ protected List> layerRenderers = Lists.>newArrayList(); - protected boolean renderOutlines = false; + protected boolean field_188323_j = false; + public static float NAME_TAG_RANGE = 64.0f; + public static float NAME_TAG_RANGE_SNEAK = 32.0f; + - public RendererLivingEntity(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) + public RenderLivingBase(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) { super(renderManagerIn); -++++ END PATCH -++++ REJECTED PATCH 2 +@@ -77,10 +80,12 @@ public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(entity, this, x, y, z))) return; ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(entity, this, x, y, z))) return; GlStateManager.pushMatrix(); GlStateManager.disableCull(); this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks); -- this.mainModel.isRiding = entity.isRiding(); -+ boolean shouldSit = entity.isRiding() && (entity.ridingEntity != null && entity.ridingEntity.shouldRiderSit()); +- this.mainModel.isRiding = entity.func_184218_aH(); ++ boolean shouldSit = entity.func_184218_aH() && (entity.func_184187_bx() != null && entity.func_184187_bx().shouldRiderSit()); + this.mainModel.isRiding = shouldSit; this.mainModel.isChild = entity.isChild(); try -++++ END PATCH -++++ REJECTED PATCH 3 +@@ -89,7 +94,7 @@ float f1 = this.interpolateRotation(entity.prevRotationYawHead, entity.rotationYawHead, partialTicks); float f2 = f1 - f; -- if (entity.isRiding() && entity.ridingEntity instanceof EntityLivingBase) -+ if (shouldSit && entity.ridingEntity instanceof EntityLivingBase) +- if (entity.func_184218_aH() && entity.func_184187_bx() instanceof EntityLivingBase) ++ if (shouldSit && entity.func_184187_bx() instanceof EntityLivingBase) { - EntityLivingBase entitylivingbase = (EntityLivingBase)entity.ridingEntity; + EntityLivingBase entitylivingbase = (EntityLivingBase)entity.func_184187_bx(); f = this.interpolateRotation(entitylivingbase.prevRenderYawOffset, entitylivingbase.renderYawOffset, partialTicks); -++++ END PATCH -++++ REJECTED PATCH 4 - { - super.doRender(entity, x, y, z, entityYaw, partialTicks); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(entity, this, x, y, z)); +@@ -197,6 +202,7 @@ + GlStateManager.enableCull(); + GlStateManager.popMatrix(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(entity, this, x, y, z)); } - protected boolean setScoreTeamColor(T entityLivingBaseIn) -++++ END PATCH -++++ REJECTED PATCH 5 + public float func_188322_c(T p_188322_1_, float p_188322_2_) +@@ -452,10 +458,11 @@ public void renderName(T entity, double x, double y, double z) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(entity, this, x, y, z))) return; ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(entity, this, x, y, z))) return; if (this.canRenderName(entity)) { double d0 = entity.getDistanceSqToEntity(this.renderManager.livingPlayer); @@ -56,13 +54,11 @@ if (d0 < (double)(f * f)) { -++++ END PATCH -++++ REJECTED PATCH 6 - } +@@ -464,6 +471,7 @@ + this.func_188296_a(entity, x, y, z, s, d0); } } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(entity, this, x, y, z)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(entity, this, x, y, z)); } protected boolean canRenderName(T entity) -++++ END PATCH diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch index a0f8a7aeaf..474c115e4f 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -13,3 +13,15 @@ public void setRenderPosition(double renderPosXIn, double renderPosYIn, double renderPosZIn) { +@@ -253,9 +258,9 @@ + IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn)); + Block block = iblockstate.getBlock(); + +- if (block == Blocks.bed) ++ if (block.isBed(worldIn, new BlockPos(livingPlayerIn), (EntityLivingBase)livingPlayerIn)) + { +- int i = ((EnumFacing)iblockstate.getValue(BlockBed.field_185512_D)).getHorizontalIndex(); ++ int i = block.getBedDirection(worldIn, new BlockPos(livingPlayerIn)).getHorizontalIndex(); + this.playerViewY = (float)(i * 90 + 180); + this.playerViewX = 0.0F; + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch index 9f01b1daa7..a03dab6fa4 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch @@ -1,6 +1,46 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java -@@ -140,11 +140,13 @@ +@@ -59,29 +59,27 @@ + T t = this.func_188360_a(p_188361_9_); + t.setModelAttributes(this.renderer.getMainModel()); + t.setLivingAnimations(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_4_); ++ t = getArmorModelHook(p_188361_1_, itemstack, p_188361_9_, t); + this.func_188359_a(t, p_188361_9_); + boolean flag = this.func_188363_b(p_188361_9_); +- this.renderer.bindTexture(this.getArmorResource(itemarmor, flag)); ++ this.renderer.bindTexture(this.getArmorResource(p_188361_1_, itemstack, p_188361_9_, null)); + +- switch (itemarmor.getArmorMaterial()) +- { +- case LEATHER: + int i = itemarmor.getColor(itemstack); ++ { ++ if (i != -1) // Allow this for anything, not only cloth ++ { + float f = (float)(i >> 16 & 255) / 255.0F; + float f1 = (float)(i >> 8 & 255) / 255.0F; + float f2 = (float)(i & 255) / 255.0F; + GlStateManager.color(this.colorR * f, this.colorG * f1, this.colorB * f2, this.alpha); + t.render(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); +- this.renderer.bindTexture(this.getArmorResource(itemarmor, flag, "overlay")); +- case CHAIN: +- case IRON: +- case GOLD: +- case DIAMOND: ++ this.renderer.bindTexture(this.getArmorResource(p_188361_1_, itemstack, p_188361_9_, "overlay")); ++ } ++ { // Non-colored + GlStateManager.color(this.colorR, this.colorG, this.colorB, this.alpha); + t.render(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); +- default: +- +- if (!this.field_177193_i && itemstack.isItemEnchanted()) ++ } // Default ++ if (!this.field_177193_i && itemstack.hasEffect()) + { + func_188364_a(this.renderer, p_188361_1_, t, p_188361_2_, p_188361_3_, p_188361_4_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); + } +@@ -140,11 +138,13 @@ GlStateManager.disableBlend(); } @@ -14,3 +54,53 @@ private ResourceLocation getArmorResource(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) { String s = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.getArmorMaterial().getName(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); +@@ -162,4 +162,49 @@ + protected abstract void initArmor(); + + protected abstract void func_188359_a(T p_188359_1_, EntityEquipmentSlot p_188359_2_); ++ ++ /*=================================== FORGE START =========================================*/ ++ ++ /** ++ * Hook to allow item-sensitive armor model. for LayerBipedArmor. ++ */ ++ protected T getArmorModelHook(EntityLivingBase entity, ItemStack itemStack, EntityEquipmentSlot slot, T model) ++ { ++ return model; ++ } ++ ++ /** ++ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. ++ * ++ * @param entity Entity wearing the armor ++ * @param stack ItemStack for the armor ++ * @param slot Slot ID that the item is in ++ * @param type Subtype, can be null or "overlay" ++ * @return ResourceLocation pointing at the armor's texture ++ */ ++ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, EntityEquipmentSlot slot, String type) ++ { ++ ItemArmor item = (ItemArmor)stack.getItem(); ++ String texture = item.getArmorMaterial().getName(); ++ String domain = "minecraft"; ++ int idx = texture.indexOf(':'); ++ if (idx != -1) ++ { ++ domain = texture.substring(0, idx); ++ texture = texture.substring(idx + 1); ++ } ++ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (func_188363_b(slot) ? 2 : 1), type == null ? "" : String.format("_%s", type)); ++ ++ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); ++ ResourceLocation resourcelocation = (ResourceLocation)ARMOR_TEXTURE_RES_MAP.get(s1); ++ ++ if (resourcelocation == null) ++ { ++ resourcelocation = new ResourceLocation(s1); ++ ARMOR_TEXTURE_RES_MAP.put(s1, resourcelocation); ++ } ++ ++ return resourcelocation; ++ } ++ /*=================================== FORGE END ===========================================*/ + } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch index 2dcbbec257..adf45bb4c5 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch @@ -5,5 +5,5 @@ return false; } + -+ public void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, net.minecraft.client.renderer.WorldRenderer worldRenderer) {} ++ public void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, net.minecraft.client.renderer.VertexBuffer buffer) {} } diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej deleted file mode 100644 index 576671980d..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej +++ /dev/null @@ -1,39 +0,0 @@ -++++ REJECTED PATCH 2 - - for (int j = 0; j < i; ++j) - { -- if (ibakedmodel.isGui3d()) - { - GlStateManager.pushMatrix(); - -++++ END PATCH -++++ REJECTED PATCH 3 - float f = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f1 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f2 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; -- GlStateManager.translate(f, f1, f2); -+ GlStateManager.translate(shouldSpreadItems() ? f : 0.0F, shouldSpreadItems() ? f1 : 0.0F, f2); - } - -+ if (ibakedmodel.isGui3d()) - GlStateManager.scale(0.5F, 0.5F, 0.5F); -- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); -+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND); - this.itemRenderer.renderItem(itemstack, ibakedmodel); - GlStateManager.popMatrix(); - } -- else -- { -- GlStateManager.pushMatrix(); -- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); -- this.itemRenderer.renderItem(itemstack, ibakedmodel); -- GlStateManager.popMatrix(); -- float f3 = ibakedmodel.getItemCameraTransforms().ground.scale.x; -- float f4 = ibakedmodel.getItemCameraTransforms().ground.scale.y; -- float f5 = ibakedmodel.getItemCameraTransforms().ground.scale.z; -- GlStateManager.translate(0.0F * f3, 0.0F * f4, 0.046875F * f5); -- } - } - - GlStateManager.popMatrix(); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej deleted file mode 100644 index 37febaf27b..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej +++ /dev/null @@ -1,96 +0,0 @@ -++++ REJECTED PATCH 1 - public RenderItem(TextureManager textureManager, ModelManager modelManager) - { - this.textureManager = textureManager; -- this.itemModelMesher = new ItemModelMesher(modelManager); -+ this.itemModelMesher = new net.minecraftforge.client.ItemModelMesherForge(modelManager); - this.registerItems(); - } - -++++ END PATCH -++++ REJECTED PATCH 2 - k = k | -16777216; - } - -- this.renderQuad(renderer, bakedquad, k); -+ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, k); - } - } - -++++ END PATCH -++++ REJECTED PATCH 3 - modelresourcelocation = new ModelResourceLocation("bow_pulling_0", "inventory"); - } - } -+ else -+ { -+ // TODO: maybe switch to the smart player model / normal smart item model? -+ modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount()); -+ } - - if (modelresourcelocation != null) - { -++++ END PATCH -++++ REJECTED PATCH 4 - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.pushMatrix(); -- ItemCameraTransforms itemcameratransforms = model.getItemCameraTransforms(); -- itemcameratransforms.applyTransform(cameraTransformType); -+ // TODO: check if negative scale is a thing -+ model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(model, cameraTransformType); - -- if (this.func_183005_a(itemcameratransforms.getTransform(cameraTransformType))) -- { -- GlStateManager.cullFace(1028); -- } -- - this.renderItem(stack, model); - GlStateManager.cullFace(1029); - GlStateManager.popMatrix(); -++++ END PATCH -++++ REJECTED PATCH 5 - GlStateManager.blendFunc(770, 771); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.setupGuiTransform(x, y, ibakedmodel.isGui3d()); -- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GUI); -+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GUI); - this.renderItem(stack, ibakedmodel); - GlStateManager.disableAlpha(); - GlStateManager.disableRescaleNormal(); -++++ END PATCH -++++ REJECTED PATCH 6 - GlStateManager.enableDepth(); - } - -- if (stack.isItemDamaged()) -+ if (stack.getItem().showDurabilityBar(stack)) - { -- int j = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage()); -- int i = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); -+ double health = stack.getItem().getDurabilityForDisplay(stack); -+ int j = (int)Math.round(13.0D - health * 13.0D); -+ int i = (int)Math.round(255.0D - health * 255.0D); - GlStateManager.disableLighting(); - GlStateManager.disableDepth(); - GlStateManager.disableTexture2D(); -++++ END PATCH -++++ REJECTED PATCH 7 - this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255); - this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255); - this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255); -- GlStateManager.enableBlend(); -+ //GlStateManager.enableBlend(); // Forge: Disable Blend because it screws with a lot of things down the line. - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - GlStateManager.enableLighting(); -++++ END PATCH -++++ REJECTED PATCH 8 - this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block"); - this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block"); - this.registerBlock(Blocks.dragon_egg, "dragon_egg"); -+ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.itemModelMesher); - } - - public void onResourceManagerReload(IResourceManager resourceManager) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch.rej deleted file mode 100644 index 7bcabbdeb4..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch.rej +++ /dev/null @@ -1,13 +0,0 @@ -++++ REJECTED PATCH 2 - IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn)); - Block block = iblockstate.getBlock(); - -- if (block == Blocks.bed) -+ if (block.isBed(worldIn, new BlockPos(livingPlayerIn), (EntityLivingBase)livingPlayerIn)) - { -- int i = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); -+ int i = block.getBedDirection(worldIn, new BlockPos(livingPlayerIn)).getHorizontalIndex(); - this.playerViewY = (float)(i * 90 + 180); - this.playerViewX = 0.0F; - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej deleted file mode 100644 index ed83325a86..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej +++ /dev/null @@ -1,93 +0,0 @@ -++++ REJECTED PATCH 1 - T t = this.func_177175_a(armorSlot); - t.setModelAttributes(this.renderer.getMainModel()); - t.setLivingAnimations(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_4_); -+ t = getArmorModelHook(entitylivingbaseIn, itemstack, armorSlot, t); - this.func_177179_a(t, armorSlot); - boolean flag = this.isSlotForLeggings(armorSlot); -- this.renderer.bindTexture(this.getArmorResource(itemarmor, flag)); -+ this.renderer.bindTexture(this.getArmorResource(entitylivingbaseIn, itemstack, flag ? 2 : 1, null)); - -- switch (itemarmor.getArmorMaterial()) -- { -- case LEATHER: - int i = itemarmor.getColor(itemstack); -+ { -+ if (i != -1) // Allow this for anything, not only cloth. -+ { - float f = (float)(i >> 16 & 255) / 255.0F; - float f1 = (float)(i >> 8 & 255) / 255.0F; - float f2 = (float)(i & 255) / 255.0F; - GlStateManager.color(this.colorR * f, this.colorG * f1, this.colorB * f2, this.alpha); - t.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); -- this.renderer.bindTexture(this.getArmorResource(itemarmor, flag, "overlay")); -- case CHAIN: -- case IRON: -- case GOLD: -- case DIAMOND: -+ this.renderer.bindTexture(this.getArmorResource(entitylivingbaseIn, itemstack, flag ? 2 : 1, "overlay")); -+ } -+ { // Non-colored - GlStateManager.color(this.colorR, this.colorG, this.colorB, this.alpha); - t.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); -- default: -- -- if (!this.field_177193_i && itemstack.isItemEnchanted()) -+ } -+ // Default -+ if (!this.field_177193_i && itemstack.hasEffect()) - { - this.func_177183_a(entitylivingbaseIn, t, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); - } -++++ END PATCH -++++ REJECTED PATCH 3 - protected abstract void initArmor(); - - protected abstract void func_177179_a(T p_177179_1_, int p_177179_2_); -+ -+ /*=================================== FORGE START =========================================*/ -+ -+ /** -+ * Hook to allow item-sensitive armor model. for LayerBipedArmor. -+ */ -+ protected T getArmorModelHook(EntityLivingBase entity, ItemStack itemStack, int slot, T model) -+ { -+ return model; -+ } -+ -+ /** -+ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. -+ * -+ * @param entity Entity wearing the armor -+ * @param stack ItemStack for the armor -+ * @param slot Slot ID that the item is in -+ * @param type Subtype, can be null or "overlay" -+ * @return ResourceLocation pointing at the armor's texture -+ */ -+ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, int slot, String type) -+ { -+ ItemArmor item = (ItemArmor)stack.getItem(); -+ String texture = item.getArmorMaterial().getName(); -+ String domain = "minecraft"; -+ int idx = texture.indexOf(':'); -+ if (idx != -1) -+ { -+ domain = texture.substring(0, idx); -+ texture = texture.substring(idx + 1); -+ } -+ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); -+ -+ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); -+ ResourceLocation resourcelocation = (ResourceLocation)ARMOR_TEXTURE_RES_MAP.get(s1); -+ -+ if (resourcelocation == null) -+ { -+ resourcelocation = new ResourceLocation(s1); -+ ARMOR_TEXTURE_RES_MAP.put(s1, resourcelocation); -+ } -+ -+ return resourcelocation; -+ } -+ /*=================================== FORGE END ===========================================*/ - } -++++ END PATCH From d35c38d261f2387741211e5c18e886f0a032f7fd Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 1 Mar 2016 20:52:19 +0300 Subject: [PATCH 011/243] EntityRenderer, most of RenderGlobal, minor fix to LayerBipedArmor. --- .../client/renderer/EntityRenderer.java.patch | 97 ++++++++++++++++--- .../client/renderer/RenderGlobal.java.patch | 34 +++++-- .../entity/layers/LayerBipedArmor.java.patch | 2 +- .../renderer/EntityRenderer.java.patch.rej | 74 -------------- .../renderer/RenderGlobal.java.patch.rej | 32 ------ .../client/ForgeHooksClient.java | 23 ++--- .../client/event/DrawBlockHighlightEvent.java | 2 - .../client/event/EntityViewRenderEvent.java | 55 +++++++---- 8 files changed, 160 insertions(+), 159 deletions(-) delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index acb32c3587..a2f88c78c4 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -8,16 +8,41 @@ } } +@@ -398,7 +399,7 @@ + + if (d3 < d2 || d2 == 0.0D) + { +- if (entity1.func_184208_bv() == entity.func_184208_bv()) ++ if (entity1.func_184208_bv() == entity.func_184208_bv() && !entity.canRiderInteract()) + { + if (d2 == 0.0D) + { @@ -491,7 +492,7 @@ f = f * 60.0F / 70.0F; } - return f; -+ return net.minecraftforge.client.ForgeHooksClient.getFOVModifier(this, entity, block, partialTicks, f); ++ return net.minecraftforge.client.ForgeHooksClient.getFOVModifier(this, entity, iblockstate, partialTicks, f); } } -@@ -629,17 +630,20 @@ +@@ -555,14 +556,8 @@ + { + BlockPos blockpos = new BlockPos(entity); + IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); +- Block block = iblockstate.getBlock(); ++ net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.mc.theWorld, blockpos, iblockstate, entity); + +- if (block == Blocks.bed) +- { +- int j = ((EnumFacing)iblockstate.getValue(BlockBed.field_185512_D)).getHorizontalIndex(); +- GlStateManager.rotate((float)(j * 90), 0.0F, 1.0F, 0.0F); +- } +- + GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, -1.0F, 0.0F); + GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, -1.0F, 0.0F, 0.0F); + } +@@ -629,17 +624,20 @@ if (!this.mc.gameSettings.debugCamEnable) { @@ -36,8 +61,8 @@ - { - GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); - } -+ Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); -+ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, block, partialTicks, yaw, pitch, roll); ++ IBlockState state = ActiveRenderInfo.func_186703_a(this.mc.theWorld, entity, partialTicks); ++ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, state, partialTicks, yaw, pitch, roll); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + GlStateManager.rotate(event.roll, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(event.pitch, 1.0F, 0.0F, 0.0F); @@ -45,7 +70,15 @@ } GlStateManager.translate(0.0F, -f, 0.0F); -@@ -1092,7 +1096,7 @@ +@@ -757,6 +755,7 @@ + + boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); + ++ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(mc.renderGlobal, partialTicks, xOffset)) + if (this.mc.gameSettings.thirdPersonView == 0 && !flag && !this.mc.gameSettings.hideGUI && !this.mc.playerController.isSpectator()) + { + this.enableLightmap(); +@@ -1092,7 +1091,7 @@ try { @@ -54,7 +87,7 @@ } catch (Throwable throwable) { -@@ -1187,7 +1191,7 @@ +@@ -1187,7 +1186,7 @@ if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR) { @@ -63,7 +96,7 @@ } else { -@@ -1312,7 +1316,9 @@ +@@ -1312,7 +1311,9 @@ GlStateManager.pushMatrix(); RenderHelper.enableStandardItemLighting(); this.mc.mcProfiler.endStartSection("entities"); @@ -73,7 +106,31 @@ RenderHelper.disableStandardItemLighting(); this.disableLightmap(); } -@@ -1378,8 +1384,12 @@ +@@ -1325,6 +1326,7 @@ + EntityPlayer entityplayer = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, partialTicks)) + renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); + GlStateManager.enableAlpha(); + } +@@ -1366,6 +1368,15 @@ + GlStateManager.shadeModel(7425); + this.mc.mcProfiler.endStartSection("translucent"); + renderglobal.renderBlockLayer(BlockRenderLayer.TRANSLUCENT, (double)partialTicks, pass, entity); ++ if (!this.debugView) //Only render if render pass 0 happens as well. ++ { ++ RenderHelper.enableStandardItemLighting(); ++ this.mc.mcProfiler.endStartSection("entities"); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); ++ renderglobal.renderEntities(entity, icamera, partialTicks); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); ++ RenderHelper.disableStandardItemLighting(); ++ } + GlStateManager.shadeModel(7424); + GlStateManager.depthMask(true); + GlStateManager.enableCull(); +@@ -1378,6 +1389,9 @@ this.renderCloudsCheck(renderglobal, partialTicks, pass); } @@ -82,11 +139,8 @@ + this.mc.mcProfiler.endStartSection("hand"); -+ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(renderglobal, partialTicks, pass)) if (this.renderHand) - { - GlStateManager.clear(256); -@@ -1490,6 +1500,13 @@ +@@ -1490,6 +1504,13 @@ protected void renderRainSnow(float partialTicks) { @@ -100,11 +154,11 @@ float f = this.mc.theWorld.getRainStrength(partialTicks); if (f > 0.0F) -@@ -1820,6 +1837,13 @@ +@@ -1820,6 +1841,13 @@ this.fogColorBlue = f7; } -+ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, block, partialTicks, this.fogColorRed, this.fogColorGreen, this.fogColorBlue); ++ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, iblockstate, partialTicks, this.fogColorRed, this.fogColorGreen, this.fogColorBlue); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + + this.fogColorRed = event.red; @@ -114,11 +168,22 @@ GlStateManager.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); } -@@ -1915,6 +1939,7 @@ +@@ -1830,7 +1858,9 @@ + GlStateManager.func_187432_a(0.0F, -1.0F, 0.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + IBlockState iblockstate = ActiveRenderInfo.func_186703_a(this.mc.theWorld, entity, partialTicks); +- ++ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, iblockstate, partialTicks, 0.1F); ++ if (hook >= 0) GlStateManager.setFogDensity(hook); ++ else + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(MobEffects.blindness)) + { + float f1 = 5.0F; +@@ -1915,6 +1945,7 @@ GlStateManager.setFogStart(f * 0.05F); GlStateManager.setFogEnd(Math.min(f, 192.0F) * 0.5F); } -+ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, block, partialTicks, p_78468_1_, f); ++ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, iblockstate, partialTicks, p_78468_1_, f); } GlStateManager.enableColorMaterial(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch index 887b5b0cb1..5798363700 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -40,7 +40,15 @@ ++this.countEntitiesRendered; if (entity1.isInRangeToRender3d(d0, d1, d2)) -@@ -672,6 +681,7 @@ +@@ -599,6 +608,7 @@ + { + for (Entity entity2 : classinheritancemultimap) + { ++ if(!entity2.shouldRenderInPass(pass)) continue; + boolean flag = this.renderManager.shouldRender(entity2, camera, d0, d1, d2) || entity2.func_184215_y(this.mc.thePlayer); + + if (flag) +@@ -672,6 +682,7 @@ this.theWorld.theProfiler.endStartSection("blockentities"); RenderHelper.enableStandardItemLighting(); @@ -48,7 +56,7 @@ for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 : this.renderInfos) { List list3 = renderglobal$containerlocalrenderinformation1.renderChunk.getCompiledChunk().getTileEntities(); -@@ -680,6 +690,7 @@ +@@ -680,6 +691,7 @@ { for (TileEntity tileentity2 : list3) { @@ -56,7 +64,7 @@ TileEntityRendererDispatcher.instance.renderTileEntity(tileentity2, partialTicks, -1); } } -@@ -689,9 +700,11 @@ +@@ -689,9 +701,11 @@ { for (TileEntity tileentity : this.setTileEntities) { @@ -68,7 +76,7 @@ this.preRenderDamagedBlocks(); -@@ -718,7 +731,7 @@ +@@ -718,7 +732,7 @@ Block block = this.theWorld.getBlockState(blockpos).getBlock(); @@ -77,7 +85,21 @@ { TileEntityRendererDispatcher.instance.renderTileEntity(tileentity1, partialTicks, destroyblockprogress.getPartialBlockDamage()); } -@@ -1427,6 +1440,12 @@ +@@ -1210,6 +1224,13 @@ + + public void renderSky(float partialTicks, int pass) + { ++ net.minecraftforge.client.IRenderHandler renderer = this.theWorld.provider.getSkyRenderer(); ++ if (renderer != null) ++ { ++ renderer.render(partialTicks, theWorld, mc); ++ return; ++ } ++ + if (this.mc.theWorld.provider.func_186058_p().func_186068_a() == 1) + { + this.renderSkyEnd(); +@@ -1427,6 +1448,12 @@ public void renderClouds(float partialTicks, int pass) { @@ -90,7 +112,7 @@ if (this.mc.theWorld.provider.isSurfaceWorld()) { if (this.mc.gameSettings.func_181147_e() == 2) -@@ -1854,8 +1873,11 @@ +@@ -1854,8 +1881,11 @@ double d4 = (double)blockpos.getY() - d1; double d5 = (double)blockpos.getZ() - d2; Block block = this.theWorld.getBlockState(blockpos).getBlock(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch index 9990cb44ad..854dd052ad 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch @@ -6,7 +6,7 @@ } + + @Override -+ protected ModelBiped getArmorModelHook(net.minecraft.entity.EntityLivingBase entity, net.minecraft.item.ItemStack itemStack, int slot, ModelBiped model) ++ protected ModelBiped getArmorModelHook(net.minecraft.entity.EntityLivingBase entity, net.minecraft.item.ItemStack itemStack, EntityEquipmentSlot slot, ModelBiped model) + { + return net.minecraftforge.client.ForgeHooksClient.getArmorModel(entity, itemStack, slot, model); + } diff --git a/rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej deleted file mode 100644 index c1b1b328c2..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej +++ /dev/null @@ -1,74 +0,0 @@ -++++ REJECTED PATCH 2 - - if (d3 < d2 || d2 == 0.0D) - { -- if (entity1 == entity.ridingEntity) -+ if (entity1 == entity.ridingEntity && !entity.canRiderInteract()) - { - if (d2 == 0.0D) - { -++++ END PATCH -++++ REJECTED PATCH 4 - { - BlockPos blockpos = new BlockPos(entity); - IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); -- Block block = iblockstate.getBlock(); -+ net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.mc.theWorld, blockpos, iblockstate, entity); - -- if (block == Blocks.bed) -- { -- int j = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); -- GlStateManager.rotate((float)(j * 90), 0.0F, 1.0F, 0.0F); -- } -- - GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, -1.0F, 0.0F); - GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, -1.0F, 0.0F, 0.0F); - } -++++ END PATCH -++++ REJECTED PATCH 9 - EntityPlayer entityplayer = (EntityPlayer)entity; - GlStateManager.disableAlpha(); - this.mc.mcProfiler.endStartSection("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.getHeldItem(), partialTicks)) - renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); - GlStateManager.enableAlpha(); - } -++++ END PATCH -++++ REJECTED PATCH 10 - EntityPlayer entityplayer1 = (EntityPlayer)entity; - GlStateManager.disableAlpha(); - this.mc.mcProfiler.endStartSection("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer1, mc.objectMouseOver, 0, entityplayer1.getHeldItem(), partialTicks)) - renderglobal.drawSelectionBox(entityplayer1, this.mc.objectMouseOver, 0, partialTicks); - GlStateManager.enableAlpha(); - } -++++ END PATCH -++++ REJECTED PATCH 11 - GlStateManager.shadeModel(7425); - this.mc.mcProfiler.endStartSection("translucent"); - renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double)partialTicks, pass, entity); -+ if (!this.debugView) //Only render if render pass 0 happens as well. -+ { -+ RenderHelper.enableStandardItemLighting(); -+ this.mc.mcProfiler.endStartSection("entities"); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); -+ renderglobal.renderEntities(entity, icamera, partialTicks); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); -+ RenderHelper.disableStandardItemLighting(); -+ } - GlStateManager.shadeModel(7424); - GlStateManager.depthMask(true); - GlStateManager.enableCull(); -++++ END PATCH -++++ REJECTED PATCH 15 - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); - -+ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, block, partialTicks, 0.1F); -+ if (hook >= 0) -+ GlStateManager.setFogDensity(hook); -+ else - if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.blindness)) - { - float f1 = 5.0F; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej index 182cfa6055..3a8a04466b 100644 --- a/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej +++ b/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej @@ -1,35 +1,3 @@ -++++ REJECTED PATCH 4 - for (int j = 0; j < list.size(); ++j) - { - Entity entity3 = (Entity)list.get(j); -+ if (!entity3.shouldRenderInPass(pass)) continue; - boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); - boolean flag1 = entity3.isInRangeToRender3d(d0, d1, d2) && (entity3.ignoreFrustumCheck || camera.isBoundingBoxInFrustum(entity3.getEntityBoundingBox()) || entity3.riddenByEntity == this.mc.thePlayer) && entity3 instanceof EntityPlayer; - -++++ END PATCH -++++ REJECTED PATCH 5 - } - - entity2 = (Entity)iterator.next(); -+ if (!entity2.shouldRenderInPass(pass)) continue; - flag2 = this.renderManager.shouldRender(entity2, camera, d0, d1, d2) || entity2.riddenByEntity == this.mc.thePlayer; - - if (!flag2) -++++ END PATCH -++++ REJECTED PATCH 10 - - public void renderSky(float partialTicks, int pass) - { -+ net.minecraftforge.client.IRenderHandler renderer = this.theWorld.provider.getSkyRenderer(); -+ if (renderer != null) -+ { -+ renderer.render(partialTicks, theWorld, mc); -+ return; -+ } - if (this.mc.theWorld.provider.getDimensionId() == 1) - { - this.renderSkyEnd(); -++++ END PATCH ++++ REJECTED PATCH 13 if (recordName != null) { diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index a806b6ff79..7d258b2685 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -49,6 +49,7 @@ import net.minecraft.client.settings.GameSettings; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -100,7 +101,7 @@ public class ForgeHooksClient return FMLClientHandler.instance().getClient().renderEngine; } - public static String getArmorTexture(Entity entity, ItemStack armor, String _default, int slot, String type) + public static String getArmorTexture(Entity entity, ItemStack armor, String _default, EntityEquipmentSlot slot, String type) { String result = armor.getItem().getArmorTexture(armor, entity, slot, type); return result != null ? result : _default; @@ -119,9 +120,9 @@ public class ForgeHooksClient } } - public static boolean onDrawBlockHighlight(RenderGlobal context, EntityPlayer player, RayTraceResult target, int subID, ItemStack currentItem, float partialTicks) + public static boolean onDrawBlockHighlight(RenderGlobal context, EntityPlayer player, RayTraceResult target, int subID, float partialTicks) { - return MinecraftForge.EVENT_BUS.post(new DrawBlockHighlightEvent(context, player, target, subID, currentItem, partialTicks)); + return MinecraftForge.EVENT_BUS.post(new DrawBlockHighlightEvent(context, player, target, subID, partialTicks)); } public static void dispatchRenderLast(RenderGlobal context, float partialTicks) @@ -164,9 +165,9 @@ public class ForgeHooksClient renderLayer.set(layer); } - public static ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int slotID, ModelBiped _default) + public static ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot slot, ModelBiped _default) { - ModelBiped model = itemStack.getItem().getArmorModel(entityLiving, itemStack, slotID, _default); + ModelBiped model = itemStack.getItem().getArmorModel(entityLiving, itemStack, slot, _default); return model == null ? _default : model; } @@ -203,8 +204,8 @@ public class ForgeHooksClient return fovUpdateEvent.newfov; } - public static float getFOVModifier(EntityRenderer renderer, Entity entity, Block block, double renderPartialTicks, float fov) { - EntityViewRenderEvent.FOVModifier event = new EntityViewRenderEvent.FOVModifier(renderer, entity, block, renderPartialTicks, fov); + public static float getFOVModifier(EntityRenderer renderer, Entity entity, IBlockState state, double renderPartialTicks, float fov) { + EntityViewRenderEvent.FOVModifier event = new EntityViewRenderEvent.FOVModifier(renderer, entity, state, renderPartialTicks, fov); MinecraftForge.EVENT_BUS.post(event); return event.getFOV(); } @@ -318,16 +319,16 @@ public class ForgeHooksClient MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Post(screen, mouseX, mouseY, partialTicks)); } - public static float getFogDensity(EntityRenderer renderer, Entity entity, Block block, float partial, float density) + public static float getFogDensity(EntityRenderer renderer, Entity entity, IBlockState state, float partial, float density) { - EntityViewRenderEvent.FogDensity event = new EntityViewRenderEvent.FogDensity(renderer, entity, block, partial, density); + EntityViewRenderEvent.FogDensity event = new EntityViewRenderEvent.FogDensity(renderer, entity, state, partial, density); if (MinecraftForge.EVENT_BUS.post(event)) return event.density; return -1; } - public static void onFogRender(EntityRenderer renderer, Entity entity, Block block, float partial, int mode, float distance) + public static void onFogRender(EntityRenderer renderer, Entity entity, IBlockState state, float partial, int mode, float distance) { - MinecraftForge.EVENT_BUS.post(new EntityViewRenderEvent.RenderFogEvent(renderer, entity, block, partial, mode, distance)); + MinecraftForge.EVENT_BUS.post(new EntityViewRenderEvent.RenderFogEvent(renderer, entity, state, partial, mode, distance)); } /* diff --git a/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java b/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java index ea53c22562..b962071ebd 100644 --- a/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java +++ b/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java @@ -14,7 +14,6 @@ public class DrawBlockHighlightEvent extends Event public final EntityPlayer player; public final RayTraceResult target; public final int subID; - public final ItemStack currentItem; public final float partialTicks; public DrawBlockHighlightEvent(RenderGlobal context, EntityPlayer player, RayTraceResult target, int subID, ItemStack currentItem, float partialTicks) @@ -23,7 +22,6 @@ public class DrawBlockHighlightEvent extends Event this.player = player; this.target = target; this.subID = subID; - this.currentItem = currentItem; this.partialTicks= partialTicks; } diff --git a/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java b/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java index 1f23314ac5..90e73e3fc2 100644 --- a/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java +++ b/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java @@ -1,6 +1,7 @@ package net.minecraftforge.client.event; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.entity.Entity; import net.minecraftforge.fml.common.eventhandler.Cancelable; @@ -12,20 +13,40 @@ import net.minecraftforge.fml.common.eventhandler.Event; */ public abstract class EntityViewRenderEvent extends Event { - public final EntityRenderer renderer; - public final Entity entity; - public final Block block; - public final double renderPartialTicks; + private final EntityRenderer renderer; + private final Entity entity; + private final IBlockState state; + private final double renderPartialTicks; - public EntityViewRenderEvent(EntityRenderer renderer, Entity entity, Block block, double renderPartialTicks) + public EntityViewRenderEvent(EntityRenderer renderer, Entity entity, IBlockState state, double renderPartialTicks) { this.renderer = renderer; this.entity = entity; - this.block = block; + this.state = state; this.renderPartialTicks = renderPartialTicks; } - /** + public EntityRenderer getRenderer() + { + return renderer; + } + + public Entity getEntity() + { + return entity; + } + + public IBlockState getState() + { + return state; + } + + public double getRenderPartialTicks() + { + return renderPartialTicks; + } + + /** * Event that allows any feature to customize the fog density the player sees. * NOTE: In order to make this event have an effect, you must cancel the event */ @@ -34,9 +55,9 @@ public abstract class EntityViewRenderEvent extends Event { public float density; - public FogDensity(EntityRenderer renderer, Entity entity, Block block, double renderPartialTicks, float density) + public FogDensity(EntityRenderer renderer, Entity entity, IBlockState state, double renderPartialTicks, float density) { - super(renderer, entity, block, renderPartialTicks); + super(renderer, entity, state, renderPartialTicks); this.density = density; } } @@ -50,9 +71,9 @@ public abstract class EntityViewRenderEvent extends Event public final int fogMode; public final float farPlaneDistance; - public RenderFogEvent(EntityRenderer renderer, Entity entity, Block block, double renderPartialTicks, int fogMode, float farPlaneDistance) + public RenderFogEvent(EntityRenderer renderer, Entity entity, IBlockState state, double renderPartialTicks, int fogMode, float farPlaneDistance) { - super(renderer, entity, block, renderPartialTicks); + super(renderer, entity, state, renderPartialTicks); this.fogMode = fogMode; this.farPlaneDistance = farPlaneDistance; } @@ -68,9 +89,9 @@ public abstract class EntityViewRenderEvent extends Event public float green; public float blue; - public FogColors(EntityRenderer renderer, Entity entity, Block block, double renderPartialTicks, float red, float green, float blue) + public FogColors(EntityRenderer renderer, Entity entity, IBlockState state, double renderPartialTicks, float red, float green, float blue) { - super(renderer, entity, block, renderPartialTicks); + super(renderer, entity, state, renderPartialTicks); this.red = red; this.green = green; this.blue = blue; @@ -86,9 +107,9 @@ public abstract class EntityViewRenderEvent extends Event public float pitch; public float roll; - public CameraSetup(EntityRenderer renderer, Entity entity, Block block, double renderPartialTicks, float yaw, float pitch, float roll) + public CameraSetup(EntityRenderer renderer, Entity entity, IBlockState state, double renderPartialTicks, float yaw, float pitch, float roll) { - super(renderer, entity, block, renderPartialTicks); + super(renderer, entity, state, renderPartialTicks); this.yaw = yaw; this.pitch = pitch; this.roll = roll; @@ -103,8 +124,8 @@ public abstract class EntityViewRenderEvent extends Event { private float fov; - public FOVModifier(EntityRenderer renderer, Entity entity, Block block, double renderPartialTicks, float fov) { - super(renderer, entity, block, renderPartialTicks); + public FOVModifier(EntityRenderer renderer, Entity entity, IBlockState state, double renderPartialTicks, float fov) { + super(renderer, entity, state, renderPartialTicks); this.setFOV(fov); } From d5c4b1825c9725374db519e950d9f8ca086430c0 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 1 Mar 2016 20:52:36 +0300 Subject: [PATCH 012/243] tabs -> spaces. --- .../BlockRendererDispatcher.java.patch | 4 ++-- .../client/renderer/ItemRenderer.java.patch | 2 +- .../client/renderer/RenderGlobal.java.patch | 4 ++-- .../client/renderer/RenderItem.java.patch | 2 +- .../client/renderer/VertexBuffer.java.patch | 2 +- .../block/model/FaceBakery.java.patch | 12 +++++------ .../model/ItemCameraTransforms.java.patch | 7 +------ .../block/model/ItemOverrideList.java.patch | 20 +++++++++---------- .../block/model/ModelBakery.java.patch | 6 +++--- .../renderer/chunk/RenderChunk.java.patch | 4 ++-- .../entity/RenderLivingBase.java.patch | 4 ++-- .../renderer/entity/RenderManager.java.patch | 7 ++++--- .../renderer/texture/TextureMap.java.patch | 12 +++++------ .../TileEntityRendererDispatcher.java.patch | 6 +++--- 14 files changed, 44 insertions(+), 48 deletions(-) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch index b5feb11544..527de782ee 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch @@ -23,8 +23,8 @@ { case MODEL: - return this.blockModelRenderer.renderModel(blockAccess, this.func_184389_a(state), state, pos, worldRendererIn, true); -+ IBakedModel model = this.func_184389_a(state); -+ state = state.getBlock().getExtendedState(state, blockAccess, pos); ++ IBakedModel model = this.func_184389_a(state); ++ state = state.getBlock().getExtendedState(state, blockAccess, pos); + return this.blockModelRenderer.renderModel(blockAccess, model, state, pos, worldRendererIn, true); case ENTITYBLOCK_ANIMATED: return false; diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index e5bce5664f..0b1fdfb9bb 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -27,7 +27,7 @@ if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE) { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, partialTicks, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, overlayPos)) ++ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, partialTicks, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, overlayPos)) this.func_178108_a(partialTicks, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); } } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch index 5798363700..ed75c81f4d 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -44,7 +44,7 @@ { for (Entity entity2 : classinheritancemultimap) { -+ if(!entity2.shouldRenderInPass(pass)) continue; ++ if(!entity2.shouldRenderInPass(pass)) continue; boolean flag = this.renderManager.shouldRender(entity2, camera, d0, d1, d2) || entity2.func_184215_y(this.mc.thePlayer); if (flag) @@ -89,7 +89,7 @@ public void renderSky(float partialTicks, int pass) { -+ net.minecraftforge.client.IRenderHandler renderer = this.theWorld.provider.getSkyRenderer(); ++ net.minecraftforge.client.IRenderHandler renderer = this.theWorld.provider.getSkyRenderer(); + if (renderer != null) + { + renderer.render(partialTicks, theWorld, mc); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch index 6cb9847a9a..08d107de7e 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch @@ -72,7 +72,7 @@ { - int j = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage()); - int i = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); -+ double health = stack.getItem().getDurabilityForDisplay(stack); ++ double health = stack.getItem().getDurabilityForDisplay(stack); + int j = (int)Math.round(13.0D - health * 13.0D); + int i = (int)Math.round(255.0D - health * 255.0D); GlStateManager.disableLighting(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch index 4e7a3a8c47..e8a03041f3 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch @@ -29,6 +29,6 @@ + + public boolean isColorDisabled() + { -+ return noColor; ++ return noColor; + } } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch index 1b04f78100..ade098febf 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -4,7 +4,7 @@ public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) { -+ return makeBakedQuad(posFrom, posTo, face, sprite, facing, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); ++ return makeBakedQuad(posFrom, posTo, face, sprite, facing, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); + } + + public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) @@ -14,7 +14,7 @@ if (uvLocked) { - blockfaceuv = this.func_188010_a(face.blockFaceUV, facing, modelRotationIn); -+ // TODO fix uvlock for custom rotations ++ // TODO fix uvlock for custom rotations + //blockfaceuv = this.func_188010_a(face.blockFaceUV, facing, modelRotationIn); } @@ -35,7 +35,7 @@ private int[] func_188012_a(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, ModelRotation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) { -+ return makeQuadVertexData(p_188012_1_, p_188012_2_, p_188012_3_, p_188012_4_, (net.minecraftforge.client.model.ITransformation)p_188012_5_, p_188012_6_, p_188012_7_); ++ return makeQuadVertexData(p_188012_1_, p_188012_2_, p_188012_3_, p_188012_4_, (net.minecraftforge.client.model.ITransformation)p_188012_5_, p_188012_6_, p_188012_7_); + } + + private int[] makeQuadVertexData(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, net.minecraftforge.client.model.ITransformation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) @@ -54,7 +54,7 @@ private void func_188015_a(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, ModelRotation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_) { - EnumFacing enumfacing = p_188015_7_.rotateFace(p_188015_3_); -+ fillVertexData(p_188015_1_, p_188015_2_, p_188015_3_, p_188015_4_, p_188015_5_, p_188015_6_, (net.minecraftforge.client.model.ITransformation)p_188015_7_, p_188015_8_, p_188015_9_); ++ fillVertexData(p_188015_1_, p_188015_2_, p_188015_3_, p_188015_4_, p_188015_5_, p_188015_6_, (net.minecraftforge.client.model.ITransformation)p_188015_7_, p_188015_8_, p_188015_9_); + } + + private void fillVertexData(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, net.minecraftforge.client.model.ITransformation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_) @@ -73,7 +73,7 @@ public int func_188011_a(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, ModelRotation p_188011_4_) { -+ return rotateVertex(p_188011_1_, p_188011_2_, p_188011_3_, (net.minecraftforge.client.model.ITransformation)p_188011_4_); ++ return rotateVertex(p_188011_1_, p_188011_2_, p_188011_3_, (net.minecraftforge.client.model.ITransformation)p_188011_4_); + } + + public int rotateVertex(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, net.minecraftforge.client.model.ITransformation p_188011_4_) @@ -86,7 +86,7 @@ { - this.rotateScale(p_188011_1_, new Vector3f(0.5F, 0.5F, 0.5F), p_188011_4_.getMatrix4d(), new Vector3f(1.0F, 1.0F, 1.0F)); - return p_188011_4_.rotateVertex(p_188011_2_, p_188011_3_); -+ net.minecraftforge.client.ForgeHooksClient.transform(p_188011_1_, p_188011_4_.getMatrix()); ++ net.minecraftforge.client.ForgeHooksClient.transform(p_188011_1_, p_188011_4_.getMatrix()); + return p_188011_4_.rotate(p_188011_2_, p_188011_3_); } } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch index 44ff0e848a..26b790331f 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java -@@ -12,10 +12,13 @@ +@@ -12,6 +12,9 @@ import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.util.vector.Quaternion; @@ -10,11 +10,6 @@ @SideOnly(Side.CLIENT) public class ItemCameraTransforms { -- public static final ItemCameraTransforms DEFAULT = new ItemCameraTransforms(); -+ public static final ItemCameraTransforms DEFAULT = new ItemCameraTransforms(); - public static float field_181690_b = 0.0F; - public static float field_181691_c = 0.0F; - public static float field_181692_d = 0.0F; @@ -39,6 +42,7 @@ this(ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT); } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch index ae8b72c435..5f9bcf1aa1 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch @@ -26,15 +26,15 @@ + + public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) + { -+ net.minecraft.item.Item item = stack.getItem(); -+ if (item != null && item.func_185040_i()) -+ { -+ ResourceLocation location = func_188021_a(stack, world, entity); -+ if (location != null) -+ { -+ return Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getModel(new ModelResourceLocation(location, "inventory")); -+ } -+ } -+ return originalModel; ++ net.minecraft.item.Item item = stack.getItem(); ++ if (item != null && item.func_185040_i()) ++ { ++ ResourceLocation location = func_188021_a(stack, world, entity); ++ if (location != null) ++ { ++ return Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getModel(new ModelResourceLocation(location, "inventory")); ++ } ++ } ++ return originalModel; + } } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch index 430b1227d0..fe0de3565b 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch @@ -13,7 +13,7 @@ private void registerVariantNames() { -+ this.variantNames.clear(); //FML clear this to prevent double ups. ++ this.variantNames.clear(); //FML clear this to prevent double ups. this.variantNames.put(Item.getItemFromBlock(Blocks.stone), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); this.variantNames.put(Item.getItemFromBlock(Blocks.dirt), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); this.variantNames.put(Item.getItemFromBlock(Blocks.planks), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); @@ -50,7 +50,7 @@ private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked) { -+ return bakeModel(modelBlockIn, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); ++ return bakeModel(modelBlockIn, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); + } + + protected IBakedModel bakeModel(ModelBlock modelBlockIn, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) @@ -78,7 +78,7 @@ private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) { -+ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation)p_177589_5_, p_177589_6_); ++ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation)p_177589_5_, p_177589_6_); + } + + protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch index 5d8e6284be..3db0e8b9a1 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch @@ -26,8 +26,8 @@ - BlockRenderLayer blockrenderlayer1 = block.getBlockLayer(); + for(BlockRenderLayer blockrenderlayer1 : BlockRenderLayer.values()) { -+ if(!block.canRenderInLayer(blockrenderlayer1)) continue; -+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(blockrenderlayer1); ++ if(!block.canRenderInLayer(blockrenderlayer1)) continue; ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(blockrenderlayer1); int j = blockrenderlayer1.ordinal(); if (block.getDefaultState().func_185901_i() != EnumBlockRenderType.INVISIBLE) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch index d85da68b73..a044bc481b 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch @@ -14,7 +14,7 @@ public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(entity, this, x, y, z))) return; ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(entity, this, x, y, z))) return; GlStateManager.pushMatrix(); GlStateManager.disableCull(); this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks); @@ -45,7 +45,7 @@ public void renderName(T entity, double x, double y, double z) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(entity, this, x, y, z))) return; ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(entity, this, x, y, z))) return; if (this.canRenderName(entity)) { double d0 = entity.getDistanceSqToEntity(this.renderManager.livingPlayer); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch index 474c115e4f..2df7ff6229 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -1,18 +1,19 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -@@ -204,7 +204,12 @@ +@@ -204,8 +204,13 @@ this.playerRenderer = new RenderPlayer(this); this.skinMap.put("default", this.playerRenderer); this.skinMap.put("slim", new RenderPlayer(this, true)); + net.minecraftforge.fml.client.registry.RenderingRegistry.loadEntityRenderers(this, this.entityRenderMap); } -+ + + public Map getSkinMap() { + return (Map) java.util.Collections.unmodifiableMap(skinMap); + } - ++ public void setRenderPosition(double renderPosXIn, double renderPosYIn, double renderPosZIn) { + this.renderPosX = renderPosXIn; @@ -253,9 +258,9 @@ IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn)); Block block = iblockstate.getBlock(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 25c12062ea..07b2b98bff 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -58,10 +58,10 @@ + if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) + { -+ if (textureatlassprite.load(resourceManager, resourcelocation)) -+ { -+ continue; -+ } ++ if (textureatlassprite.load(resourceManager, resourcelocation)) ++ { ++ continue; ++ } + } + else try @@ -73,14 +73,14 @@ { - logger.error((String)("Unable to parse metadata from " + resourcelocation), (Throwable)runtimeexception); + //logger.error((String)("Unable to parse metadata from " + resourcelocation), (Throwable)runtimeexception); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation, runtimeexception.getMessage()); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation, runtimeexception.getMessage()); continue; } catch (IOException ioexception) { - logger.error((String)("Using missing texture, unable to load " + resourcelocation), (Throwable)ioexception); + //logger.error((String)("Using missing texture, unable to load " + resourcelocation), (Throwable)ioexception); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation); continue; } finally diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch index d84e76f4e9..d6b642afd9 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch @@ -4,14 +4,14 @@ { if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared()) { -+ if(!tileentityIn.hasFastRenderer()) -+ { ++ if(!tileentityIn.hasFastRenderer()) ++ { int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0); int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -+ } ++ } BlockPos blockpos = tileentityIn.getPos(); this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage); } From d9b69fda659ac0b2bba9ff1335f6f6a5b68a5479 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 1 Mar 2016 21:08:51 +0300 Subject: [PATCH 013/243] FontRenderer --- .../client/gui/FontRenderer.java.patch | 22 +++++++++++-- .../client/gui/FontRenderer.java.patch.rej | 33 ------------------- .../fml/client/SplashProgress.java | 8 +++-- 3 files changed, 26 insertions(+), 37 deletions(-) delete mode 100644 rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch index 7c4ef0a8e5..2d53a7f250 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch @@ -17,6 +17,24 @@ } private void readFontTexture() +@@ -106,7 +107,7 @@ + + try + { +- iresource = Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture); ++ iresource = getResource(this.locationFontTexture); + bufferedimage = TextureUtil.readBufferedImage(iresource.getInputStream()); + } + catch (IOException ioexception) +@@ -171,7 +172,7 @@ + + try + { +- iresource = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin")); ++ iresource = getResource(new ResourceLocation("font/glyph_sizes.bin")); + iresource.getInputStream().read(this.glyphWidth); + } + catch (IOException ioexception) @@ -202,7 +203,7 @@ int i = ch % 16 * 8; int j = ch / 16 * 8; @@ -116,9 +134,9 @@ + renderEngine.bindTexture(location); + } + -+ protected InputStream getResourceInputStream(ResourceLocation location) throws IOException ++ protected IResource getResource(ResourceLocation location) throws IOException + { -+ return Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream(); ++ return Minecraft.getMinecraft().getResourceManager().getResource(location); + } + public int getColorCode(char character) diff --git a/rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej deleted file mode 100644 index fea7625697..0000000000 --- a/rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej +++ /dev/null @@ -1,33 +0,0 @@ -++++ REJECTED PATCH 3 - - try - { -- bufferedimage = TextureUtil.readBufferedImage(Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture).getInputStream()); -+ bufferedimage = TextureUtil.readBufferedImage(getResourceInputStream(this.locationFontTexture)); - } - catch (IOException ioexception) - { -++++ END PATCH -++++ REJECTED PATCH 4 - - try - { -- inputstream = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin")).getInputStream(); -+ inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin")); - inputstream.read(this.glyphWidth); - } - catch (IOException ioexception) -++++ END PATCH -++++ REJECTED PATCH 13 - int j = this.glyphWidth[character] >>> 4; - int k = this.glyphWidth[character] & 15; - -- if (k > 7) -- { -- k = 15; -- j = 0; -- } - - ++k; - return (k - j) / 2 + 1; -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/fml/client/SplashProgress.java b/src/main/java/net/minecraftforge/fml/client/SplashProgress.java index 9ed49fefda..4f670a923e 100644 --- a/src/main/java/net/minecraftforge/fml/client/SplashProgress.java +++ b/src/main/java/net/minecraftforge/fml/client/SplashProgress.java @@ -75,9 +75,12 @@ import javax.imageio.stream.ImageInputStream; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.resources.DefaultResourcePack; import net.minecraft.client.resources.FileResourcePack; import net.minecraft.client.resources.FolderResourcePack; +import net.minecraft.client.resources.IResource; import net.minecraft.client.resources.IResourcePack; +import net.minecraft.client.resources.SimpleResource; import net.minecraft.crash.CrashReport; import net.minecraft.launchwrapper.Launch; import net.minecraft.util.ResourceLocation; @@ -806,9 +809,10 @@ public class SplashProgress } @Override - protected InputStream getResourceInputStream(ResourceLocation location) throws IOException + protected IResource getResource(ResourceLocation location) throws IOException { - return Minecraft.getMinecraft().mcDefaultResourcePack.getInputStream(location); + DefaultResourcePack pack = Minecraft.getMinecraft().mcDefaultResourcePack; + return new SimpleResource(pack.getPackName(), location, pack.getInputStream(location), null, null); } } From 728319cbb5b3f2691d135a109d10f56f4f601abb Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 1 Mar 2016 23:19:38 +0300 Subject: [PATCH 014/243] Fixed most errors in the model stuff, except for ModelLoader and b3d and obj getQuads/handleBlockState methods. --- .../renderer/block/model/BakedQuad.java.patch | 38 ++- .../client/model/BlockStateLoader.java | 18 +- .../client/model/ForgeBlockStateV1.java | 32 +- .../client/model/IColoredBakedQuad.java | 6 +- .../client/model/IFlexibleBakedModel.java | 78 ----- .../minecraftforge/client/model/IModel.java | 3 +- .../client/model/IPerspectiveAwareModel.java | 29 +- .../client/model/ISmartBlockModel.java | 94 ------ .../client/model/ISmartItemModel.java | 9 - .../client/model/ItemLayerModel.java | 58 ++-- .../client/model/ModelDynBucket.java | 139 ++++++--- .../client/model/ModelFluid.java | 40 +-- .../client/model/ModelLoaderRegistry.java | 4 +- .../client/model/MultiLayerModel.java | 110 +++---- .../client/model/MultiModel.java | 108 +++---- .../client/model/TRSRTransformation.java | 2 +- .../model/animation/AnimationModelBase.java | 8 +- .../client/model/animation/AnimationTESR.java | 31 +- .../client/model/animation/Clips.java | 2 +- .../client/model/animation/FastTESR.java | 2 +- .../model/animation/ModelBlockAnimation.java | 2 +- .../client/model/b3d/B3DLoader.java | 286 ++---------------- .../client/model/obj/OBJModel.java | 29 +- .../client/model/pipeline/BlockInfo.java | 39 ++- .../pipeline/ForgeBlockModelRenderer.java | 52 ++-- .../client/model/pipeline/LightUtil.java | 31 +- .../model/pipeline/UnpackedBakedQuad.java | 19 +- ...onsumer.java => VertexBufferConsumer.java} | 2 +- .../model/pipeline/VertexLighterFlat.java | 24 +- .../model/pipeline/VertexLighterSmoothAo.java | 8 +- src/main/resources/forge.exc | 1 + 31 files changed, 462 insertions(+), 842 deletions(-) delete mode 100644 src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java delete mode 100644 src/main/java/net/minecraftforge/client/model/ISmartBlockModel.java delete mode 100644 src/main/java/net/minecraftforge/client/model/ISmartItemModel.java rename src/main/java/net/minecraftforge/client/model/pipeline/{WorldRendererConsumer.java => VertexBufferConsumer.java} (96%) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch index 2c9e531fee..8d8d18d4e0 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch @@ -1,13 +1,47 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java -@@ -6,8 +6,9 @@ +@@ -6,15 +6,25 @@ import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class BakedQuad +public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer { -+ @Override public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) { net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); } protected final int[] vertexData; protected final int tintIndex; protected final EnumFacing face; + protected final TextureAtlasSprite field_187509_d; + ++ /** ++ * @deprecated Use constructor with the format argument. ++ */ ++ @Deprecated + public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_) + { ++ this(p_i46574_1_, p_i46574_2_, p_i46574_3_, p_i46574_4_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.ITEM); ++ } ++ ++ public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_, net.minecraft.client.renderer.vertex.VertexFormat format) ++ { ++ this.format = format; + this.vertexData = p_i46574_1_; + this.tintIndex = p_i46574_2_; + this.face = p_i46574_3_; +@@ -45,4 +55,17 @@ + { + return this.face; + } ++ ++ private final net.minecraft.client.renderer.vertex.VertexFormat format; ++ ++ @Override ++ public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) ++ { ++ net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); ++ } ++ ++ public net.minecraft.client.renderer.vertex.VertexFormat getFormat() ++ { ++ return format; ++ } + } diff --git a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java index 2a5a1322a4..dc177896e3 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java +++ b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java @@ -6,10 +6,13 @@ import java.io.InputStreamReader; import java.io.Reader; import java.util.Collection; import java.util.List; +import java.util.Map; import java.util.Map.Entry; 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.ResourceLocation; import net.minecraftforge.fml.common.FMLLog; @@ -20,6 +23,7 @@ import org.apache.commons.lang3.tuple.Pair; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -55,11 +59,11 @@ public class BlockStateLoader { case 1: // Version 1 ForgeBlockStateV1 v1 = GSON.fromJson(reader, ForgeBlockStateV1.class); - List variants = Lists.newArrayList(); + Map variants = Maps.newHashMap(); for (Entry> entry : v1.variants.asMap().entrySet()) { // Convert Version1 variants into vanilla variants for the ModelBlockDefinition. - List mcVars = Lists.newArrayList(); + List mcVars = Lists.newArrayList(); for (ForgeBlockStateV1.Variant var : entry.getValue()) { boolean uvLock = var.getUvLock().or(false); @@ -68,14 +72,14 @@ public class BlockStateLoader int weight = var.getWeight().or(1); if (var.getModel() != null && var.getSubmodels().size() == 0 && var.getTextures().size() == 0 && var.getCustomData().size() == 0 && var.getState().orNull() instanceof ModelRotation) - mcVars.add(new ModelBlockDefinition.Variant(var.getModel(), (ModelRotation)var.getState().get(), uvLock, weight)); + mcVars.add(new Variant(var.getModel(), (ModelRotation)var.getState().get(), uvLock, weight)); else mcVars.add(new ForgeVariant(var.getModel(), var.getState().or(TRSRTransformation.identity()), uvLock, smooth, gui3d, weight, var.getTextures(), var.getOnlyPartsVariant(), var.getCustomData())); } - variants.add(new ModelBlockDefinition.Variants(entry.getKey(), mcVars)); + variants.put(entry.getKey(), new VariantList(mcVars)); } - return new ModelBlockDefinition(variants); + return new ModelBlockDefinition(variants, null); default: //Unknown version.. try loading it as normal. return vanillaGSON.fromJson(reader, ModelBlockDefinition.class); @@ -128,7 +132,7 @@ public class BlockStateLoader public ImmutableMap getCustomData() { return customData; } } - private static class ForgeVariant extends ModelBlockDefinition.Variant implements ISmartVariant + private static class ForgeVariant extends Variant implements ISmartVariant { private final ImmutableMap textures; private final ImmutableMap parts; @@ -211,7 +215,7 @@ public class BlockStateLoader models.put(entry.getKey(), Pair.of(runModelHooks(model, part.smooth, part.gui3d, part.getTextures(), part.getCustomData()), partState)); } - return new MultiModel(getModelLocation(), hasBase ? base : null, baseTr, models.build()); + return new MultiModel(func_188046_a(), hasBase ? base : null, baseTr, models.build()); } @Override diff --git a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java index fd915c7564..39fa4c2ddd 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java @@ -481,7 +481,7 @@ public class ForgeBlockStateV1 extends Marker { ret.state = Optional.of(TRSRTransformation.identity()); } - else if (transform.equals("forge:default-block")) + /*else if (transform.equals("forge:default-block")) { TRSRTransformation thirdperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( new Vector3f(0, 1.5f / 16, -2.75f / 16), @@ -517,7 +517,7 @@ public class ForgeBlockStateV1 extends Marker new Vector3f(1.7f, 1.7f, 1.7f), null)); ret.state = Optional.of(new SimpleModelState(ImmutableMap.of(TransformType.THIRD_PERSON, thirdperson, TransformType.FIRST_PERSON, firstperson))); - } + }*/ // FIXME else { throw new JsonParseException("transform: unknown default string: " + transform); @@ -543,13 +543,37 @@ public class ForgeBlockStateV1 extends Marker { TRSRTransformation t = context.deserialize(transform.get("thirdperson"), TRSRTransformation.class); transform.remove("thirdperson"); - transforms.put(TransformType.THIRD_PERSON, TRSRTransformation.blockCenterToCorner(t)); + transforms.put(TransformType.THIRD_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); + } + if(transform.has("thirdperson_righthand")) + { + TRSRTransformation t = context.deserialize(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 = context.deserialize(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 = context.deserialize(transform.get("firstperson"), TRSRTransformation.class); transform.remove("firstperson"); - transforms.put(TransformType.FIRST_PERSON, TRSRTransformation.blockCenterToCorner(t)); + transforms.put(TransformType.FIRST_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); + } + if(transform.has("firstperson_righthand")) + { + TRSRTransformation t = context.deserialize(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 = context.deserialize(transform.get("firstperson_lefthand"), TRSRTransformation.class); + transform.remove("firstperson_lefthand"); + transforms.put(TransformType.FIRST_PERSON_LEFT_HAND, TRSRTransformation.blockCenterToCorner(t)); } if(transform.has("head")) { diff --git a/src/main/java/net/minecraftforge/client/model/IColoredBakedQuad.java b/src/main/java/net/minecraftforge/client/model/IColoredBakedQuad.java index 95fce88a7a..e8acab1cb7 100644 --- a/src/main/java/net/minecraftforge/client/model/IColoredBakedQuad.java +++ b/src/main/java/net/minecraftforge/client/model/IColoredBakedQuad.java @@ -1,14 +1,16 @@ package net.minecraftforge.client.model; 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; public interface IColoredBakedQuad { public static class ColoredBakedQuad extends BakedQuad implements IColoredBakedQuad { - public ColoredBakedQuad(int[] data, int tintIndex, EnumFacing side) + public ColoredBakedQuad(int[] data, int tintIndex, EnumFacing side, TextureAtlasSprite sprite, VertexFormat format) { - super(data, tintIndex, side); + super(data, tintIndex, side, sprite, format); } } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java b/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java deleted file mode 100644 index 3ea4c32645..0000000000 --- a/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java +++ /dev/null @@ -1,78 +0,0 @@ -package net.minecraftforge.client.model; - -import java.util.List; - -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.util.EnumFacing; - -/* - * Version of IBakedModel with less restriction on camera transformations and with explicit format of the baked array. - */ -@SuppressWarnings("deprecation") -public interface IFlexibleBakedModel extends IBakedModel -{ - /* - * Specifies the format which BakedQuads' getVertexData will have. - */ - VertexFormat getFormat(); - - /* - * Default implementation of IFlexibleBakedModel that should be useful in most cases - */ - public static class Wrapper implements IFlexibleBakedModel - { - private final IBakedModel parent; - VertexFormat format; - - public Wrapper(IBakedModel parent, VertexFormat format) - { - this.parent = parent; - this.format = format; - } - - public List getFaceQuads(EnumFacing side) - { - return parent.getFaceQuads(side); - } - - public List getGeneralQuads() - { - return parent.getGeneralQuads(); - } - - public boolean isAmbientOcclusion() - { - return parent.isAmbientOcclusion(); - } - - public boolean isGui3d() - { - return parent.isGui3d(); - } - - public boolean isBuiltInRenderer() - { - return parent.isBuiltInRenderer(); - } - - public TextureAtlasSprite getParticleTexture() - { - return parent.getParticleTexture(); - } - - @Deprecated - public ItemCameraTransforms getItemCameraTransforms() - { - return parent.getItemCameraTransforms(); - } - - public VertexFormat getFormat() - { - return new VertexFormat(format); - } - } -} diff --git a/src/main/java/net/minecraftforge/client/model/IModel.java b/src/main/java/net/minecraftforge/client/model/IModel.java index 6a9e1c47fd..884b2f27ef 100644 --- a/src/main/java/net/minecraftforge/client/model/IModel.java +++ b/src/main/java/net/minecraftforge/client/model/IModel.java @@ -2,6 +2,7 @@ package net.minecraftforge.client.model; import java.util.Collection; +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; @@ -36,7 +37,7 @@ public interface IModel * format argument (some attributes can be replaced with padding), * if there's no such info in this model. */ - IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter); + IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter); /* * Default state this model will be baked with. diff --git a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java index 16fd01d013..8db0df2509 100644 --- a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java +++ b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java @@ -4,11 +4,13 @@ import java.util.List; import javax.vecmath.Matrix4f; +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.client.renderer.vertex.VertexFormat; import net.minecraft.util.EnumFacing; import org.apache.commons.lang3.tuple.Pair; @@ -20,26 +22,26 @@ import com.google.common.collect.ImmutableMap; * Model that changes based on the rendering perspective * (first-person, GUI, e.t.c - see TransformType) */ -public interface IPerspectiveAwareModel extends IFlexibleBakedModel +public interface IPerspectiveAwareModel extends IBakedModel { /* * Returns the pair of the model for the given perspective, and the matrix * that should be applied to the GL state before rendering it (matrix may be null). */ - Pair handlePerspective(TransformType cameraTransformType); + Pair handlePerspective(TransformType cameraTransformType); public static class MapWrapper implements IPerspectiveAwareModel { - private final IFlexibleBakedModel parent; + private final IBakedModel parent; private final ImmutableMap transforms; - public MapWrapper(IFlexibleBakedModel parent, ImmutableMap transforms) + public MapWrapper(IBakedModel parent, ImmutableMap transforms) { this.parent = parent; this.transforms = transforms; } - public MapWrapper(IFlexibleBakedModel parent, IModelState state) + public MapWrapper(IBakedModel parent, IModelState state) { this(parent, getTransforms(state)); } @@ -58,6 +60,7 @@ public interface IPerspectiveAwareModel extends IFlexibleBakedModel return builder.build(); } + @SuppressWarnings("deprecation") public static ImmutableMap getTransforms(ItemCameraTransforms transforms) { ImmutableMap.Builder builder = ImmutableMap.builder(); @@ -68,7 +71,7 @@ public interface IPerspectiveAwareModel extends IFlexibleBakedModel return builder.build(); } - public static Pair handlePerspective(IFlexibleBakedModel model, ImmutableMap transforms, TransformType cameraTransformType) + public static Pair handlePerspective(IBakedModel model, ImmutableMap transforms, TransformType cameraTransformType) { TRSRTransformation tr = transforms.get(cameraTransformType); Matrix4f mat = null; @@ -76,7 +79,7 @@ public interface IPerspectiveAwareModel extends IFlexibleBakedModel return Pair.of(model, mat); } - public static Pair handlePerspective(IFlexibleBakedModel model, IModelState state, TransformType cameraTransformType) + public static Pair handlePerspective(IBakedModel model, IModelState state, TransformType cameraTransformType) { TRSRTransformation tr = state.apply(Optional.of(cameraTransformType)).or(TRSRTransformation.identity()); if(tr != TRSRTransformation.identity()) @@ -88,15 +91,15 @@ public interface IPerspectiveAwareModel extends IFlexibleBakedModel public boolean isAmbientOcclusion() { return parent.isAmbientOcclusion(); } public boolean isGui3d() { return parent.isGui3d(); } - public boolean isBuiltInRenderer() { return parent.isBuiltInRenderer(); } + public boolean func_188618_c() { return parent.func_188618_c(); } public TextureAtlasSprite getParticleTexture() { return parent.getParticleTexture(); } + @SuppressWarnings("deprecation") public ItemCameraTransforms getItemCameraTransforms() { return parent.getItemCameraTransforms(); } - public List getFaceQuads(EnumFacing side) { return parent.getFaceQuads(side); } - public List getGeneralQuads() { return parent.getGeneralQuads(); } - public VertexFormat getFormat() { return parent.getFormat(); } + public List func_188616_a(IBlockState state, EnumFacing side, long rand) { return parent.func_188616_a(state, side, rand); } + public ItemOverrideList func_188617_f() { return parent.func_188617_f(); } @Override - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { return handlePerspective(this, transforms, cameraTransformType); } diff --git a/src/main/java/net/minecraftforge/client/model/ISmartBlockModel.java b/src/main/java/net/minecraftforge/client/model/ISmartBlockModel.java deleted file mode 100644 index 797456109d..0000000000 --- a/src/main/java/net/minecraftforge/client/model/ISmartBlockModel.java +++ /dev/null @@ -1,94 +0,0 @@ -package net.minecraftforge.client.model; - -import java.util.List; - -import javax.vecmath.Matrix4f; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.util.EnumFacing; - -import org.apache.commons.lang3.tuple.Pair; - -public interface ISmartBlockModel extends IBakedModel -{ - IBakedModel handleBlockState(IBlockState state); - - public static abstract class Wrapper implements ISmartBlockModel, IFlexibleBakedModel - { - protected final IFlexibleBakedModel parent; - - public Wrapper(IFlexibleBakedModel parent) - { - this.parent = parent; - } - - public List getFaceQuads(EnumFacing side) - { - return parent.getFaceQuads(side); - } - - public List getGeneralQuads() - { - return parent.getGeneralQuads(); - } - - public boolean isAmbientOcclusion() - { - return parent.isAmbientOcclusion(); - } - - public boolean isGui3d() - { - return parent.isGui3d(); - } - - public boolean isBuiltInRenderer() - { - return parent.isBuiltInRenderer(); - } - - public TextureAtlasSprite getParticleTexture() - { - return parent.getParticleTexture(); - } - - public ItemCameraTransforms getItemCameraTransforms() - { - return parent.getItemCameraTransforms(); - } - - public VertexFormat getFormat() - { - return parent.getFormat(); - } - } - - public static abstract class PerspectiveWrapper extends Wrapper implements IPerspectiveAwareModel - { - protected final IPerspectiveAwareModel parent; - - public PerspectiveWrapper(IPerspectiveAwareModel parent) - { - super(parent); - this.parent = parent; - } - - public Pair handlePerspective(TransformType type) - { - Pair pair = parent.handlePerspective(type); - return Pair.of(new ISmartBlockModel.Wrapper(pair.getLeft()) - { - public IBakedModel handleBlockState(IBlockState state) - { - return PerspectiveWrapper.this.handleBlockState(state); - } - }, pair.getRight()); - } - } -} diff --git a/src/main/java/net/minecraftforge/client/model/ISmartItemModel.java b/src/main/java/net/minecraftforge/client/model/ISmartItemModel.java deleted file mode 100644 index 46703fc83c..0000000000 --- a/src/main/java/net/minecraftforge/client/model/ISmartItemModel.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.minecraftforge.client.model; - -import net.minecraft.item.ItemStack; -import net.minecraft.client.renderer.block.model.IBakedModel; - -public interface ISmartItemModel extends IBakedModel -{ - IBakedModel handleItemState(ItemStack stack); -} diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index 873bceae93..208522a766 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -10,9 +10,12 @@ import javax.vecmath.Vector4f; import org.apache.commons.lang3.tuple.Pair; +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.block.model.ModelBlock; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; @@ -85,7 +88,7 @@ public class ItemLayerModel implements IRetexturableModel return new ItemLayerModel(builder.build()); } - public IFlexibleBakedModel bake(IModelState state, final VertexFormat format, Function bakedTextureGetter) + public IBakedModel bake(IModelState state, final VertexFormat format, Function bakedTextureGetter) { ImmutableList.Builder builder = ImmutableList.builder(); Optional transform = state.apply(Optional.absent()); @@ -96,47 +99,21 @@ public class ItemLayerModel implements IRetexturableModel } TextureAtlasSprite particle = bakedTextureGetter.apply(textures.isEmpty() ? new ResourceLocation("missingno") : textures.get(0)); ImmutableMap map = IPerspectiveAwareModel.MapWrapper.getTransforms(state); - return new BakedItemModel(builder.build(), particle, format, map, null); + return new BakedItemModel(builder.build(), particle, map, null); } - @Deprecated // remove 1.9 - public static class BakedModel implements IFlexibleBakedModel + private static class BakedItemModel implements IPerspectiveAwareModel { private final ImmutableList quads; private final TextureAtlasSprite particle; - private final VertexFormat format; - - public BakedModel(ImmutableList quads, TextureAtlasSprite particle, VertexFormat format) - { - this.quads = quads; - this.particle = particle; - this.format = format; - } - - public boolean isAmbientOcclusion() { return true; } - public boolean isGui3d() { return false; } - public boolean isBuiltInRenderer() { return false; } - public TextureAtlasSprite getParticleTexture() { return particle; } - public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; } - public List getFaceQuads(EnumFacing side) { return ImmutableList.of(); } - public List getGeneralQuads() { return quads; } - public VertexFormat getFormat() { return format; } - } - - private static class BakedItemModel implements IFlexibleBakedModel, IPerspectiveAwareModel - { - private final ImmutableList quads; - private final TextureAtlasSprite particle; - private final VertexFormat format; private final ImmutableMap transforms; - private final IFlexibleBakedModel otherModel; + private final IBakedModel otherModel; private final boolean isCulled; - public BakedItemModel(ImmutableList quads, TextureAtlasSprite particle, VertexFormat format, ImmutableMap transforms, IFlexibleBakedModel otherModel) + public BakedItemModel(ImmutableList quads, TextureAtlasSprite particle, ImmutableMap transforms, IBakedModel otherModel) { this.quads = quads; this.particle = particle; - this.format = format; this.transforms = transforms; if(otherModel != null) { @@ -153,23 +130,26 @@ public class ItemLayerModel implements IRetexturableModel builder.add(quad); } } - this.otherModel = new BakedItemModel(builder.build(), particle, format, transforms, this); + this.otherModel = new BakedItemModel(builder.build(), particle, transforms, this); isCulled = false; } } public boolean isAmbientOcclusion() { return true; } public boolean isGui3d() { return false; } - public boolean isBuiltInRenderer() { return false; } + public boolean func_188618_c() { return false; } public TextureAtlasSprite getParticleTexture() { return particle; } public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; } - public List getFaceQuads(EnumFacing side) { return ImmutableList.of(); } - public List getGeneralQuads() { return quads; } - public VertexFormat getFormat() { return format; } - - public Pair handlePerspective(TransformType type) + public ItemOverrideList func_188617_f() { return ItemOverrideList.field_188022_a; } + public List func_188616_a(IBlockState state, EnumFacing side, long rand) { - Pair pair = IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, type); + if(side == null) return quads; + return ImmutableList.of(); + } + + public Pair handlePerspective(TransformType type) + { + Pair pair = IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, type); if(type == TransformType.GUI && !isCulled && pair.getRight() == null) { return Pair.of(otherModel, null); diff --git a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java index 93fa9aaf59..8b36e5e09c 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java +++ b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java @@ -1,31 +1,43 @@ package net.minecraftforge.client.model; +import java.io.IOException; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import javax.vecmath.Matrix4f; +import javax.vecmath.Quat4f; + +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.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidContainerItem; + +import org.apache.commons.lang3.tuple.Pair; + import com.google.common.base.Function; import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.*; -import org.apache.commons.lang3.tuple.Pair; - -import javax.vecmath.Matrix4f; -import javax.vecmath.Quat4f; -import java.io.IOException; -import java.util.Collection; -import java.util.Map; public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableModel { @@ -81,7 +93,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, } @Override - public IFlexibleBakedModel bake(IModelState state, VertexFormat format, + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { @@ -104,8 +116,8 @@ public class ModelDynBucket implements IModel, IModelCustomData, if (baseLocation != null) { // build base (insidest) - IFlexibleBakedModel model = (new ItemLayerModel(ImmutableList.of(baseLocation))).bake(state, format, bakedTextureGetter); - builder.addAll(model.getGeneralQuads()); + IBakedModel model = (new ItemLayerModel(ImmutableList.of(baseLocation))).bake(state, format, bakedTextureGetter); + builder.addAll(model.func_188616_a(null, null, 0)); } if (liquidLocation != null && fluidSprite != null) { @@ -123,7 +135,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, } - return new BakedDynBucket(this, builder.build(), fluidSprite, format, Maps.immutableEnumMap(transformMap), Maps.newHashMap()); + return new BakedDynBucket(this, builder.build(), fluidSprite, format, Maps.immutableEnumMap(transformMap), Maps.newHashMap()); } @Override @@ -211,26 +223,16 @@ public class ModelDynBucket implements IModel, IModelCustomData, } } - // the dynamic bucket is based on the empty bucket - protected static class BakedDynBucket extends ItemLayerModel.BakedModel implements ISmartItemModel, IPerspectiveAwareModel + protected static final class BakedDynBucketOverrideHandler extends ItemOverrideList { - - private final ModelDynBucket parent; - private final Map cache; // contains all the baked models since they'll never change - private final ImmutableMap transforms; - - public BakedDynBucket(ModelDynBucket parent, - ImmutableList quads, TextureAtlasSprite particle, VertexFormat format, ImmutableMap transforms, - Map cache) + public static final BakedDynBucketOverrideHandler INSTANCE = new BakedDynBucketOverrideHandler(); + private BakedDynBucketOverrideHandler() { - super(quads, particle, format); - this.parent = parent; - this.transforms = transforms; - this.cache = cache; + super(ImmutableList.of()); } @Override - public IBakedModel handleItemState(ItemStack stack) + public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) { FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(stack); if (fluidStack == null) @@ -245,16 +247,17 @@ public class ModelDynBucket implements IModel, IModelCustomData, if (fluidStack == null) { // empty bucket - return this; + return originalModel; } + BakedDynBucket model = (BakedDynBucket)originalModel; Fluid fluid = fluidStack.getFluid(); String name = fluid.getName(); - if (!cache.containsKey(name)) + if (!model.cache.containsKey(name)) { - IModel model = parent.process(ImmutableMap.of("fluid", name)); + IModel parent = model.parent.process(ImmutableMap.of("fluid", name)); Function textureGetter; textureGetter = new Function() { @@ -264,18 +267,62 @@ public class ModelDynBucket implements IModel, IModelCustomData, } }; - IFlexibleBakedModel bakedModel = model.bake(new SimpleModelState(transforms), this.getFormat(), textureGetter); - cache.put(name, bakedModel); + IBakedModel bakedModel = parent.bake(new SimpleModelState(model.transforms), model.format, textureGetter); + model.cache.put(name, bakedModel); return bakedModel; } - return cache.get(name); + return model.cache.get(name); + } + } + + // the dynamic bucket is based on the empty bucket + protected static class BakedDynBucket implements IPerspectiveAwareModel + { + + private final ModelDynBucket parent; + // FIXME: guava cache? + private final Map cache; // contains all the baked models since they'll never change + private final ImmutableMap transforms; + private final ImmutableList quads; + private final TextureAtlasSprite particle; + private final VertexFormat format; + + public BakedDynBucket(ModelDynBucket parent, + ImmutableList quads, TextureAtlasSprite particle, VertexFormat format, ImmutableMap transforms, + Map cache) + { + this.quads = quads; + this.particle = particle; + this.format = format; + this.parent = parent; + this.transforms = transforms; + this.cache = cache; } @Override - public Pair handlePerspective(TransformType cameraTransformType) + public ItemOverrideList func_188617_f() + { + return BakedDynBucketOverrideHandler.INSTANCE; + } + + @Override + public Pair handlePerspective(TransformType cameraTransformType) { return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, cameraTransformType); } + + @Override + public List func_188616_a(IBlockState state, EnumFacing side, long rand) + { + if(side == null) return quads; + return ImmutableList.of(); + } + + public boolean isAmbientOcclusion() { return true; } + public boolean isGui3d() { return false; } + public boolean func_188618_c() { return false; } + public TextureAtlasSprite getParticleTexture() { return particle; } + public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; } } } diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index e6235e30dc..2bb21944d6 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -12,14 +12,15 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; 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.VertexFormat; import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ModelRotation; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.MathHelper; import net.minecraftforge.client.model.pipeline.LightUtil; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; import net.minecraftforge.common.property.IExtendedBlockState; @@ -42,7 +43,6 @@ import com.google.common.collect.Maps; import com.google.gson.JsonElement; import com.google.gson.JsonParser; -@SuppressWarnings("deprecation") public class ModelFluid implements IModelCustomData { public static final ModelFluid waterModel = new ModelFluid(FluidRegistry.WATER); @@ -64,7 +64,7 @@ public class ModelFluid implements IModelCustomData return ImmutableSet.of(fluid.getStill(), fluid.getFlowing()); } - public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { ImmutableMap map = IPerspectiveAwareModel.MapWrapper.getTransforms(state); return new BakedFluid(state.apply(Optional.absent()), map, format, fluid.getColor(), bakedTextureGetter.apply(fluid.getStill()), bakedTextureGetter.apply(fluid.getFlowing()), fluid.isGaseous(), Optional.absent()); @@ -95,7 +95,7 @@ public class ModelFluid implements IModelCustomData } } - public static class BakedFluid implements IFlexibleBakedModel, ISmartBlockModel, IPerspectiveAwareModel + public static class BakedFluid implements IPerspectiveAwareModel { private static final int x[] = { 0, 0, 1, 1 }; private static final int z[] = { 0, 1, 1, 0 }; @@ -341,7 +341,7 @@ public class ModelFluid implements IModelCustomData return false; } - public boolean isBuiltInRenderer() + public boolean func_188618_c() { return false; } @@ -356,23 +356,9 @@ public class ModelFluid implements IModelCustomData return ItemCameraTransforms.DEFAULT; } - public List getFaceQuads(EnumFacing side) - { - return faceQuads.get(side); - } - - public List getGeneralQuads() - { - return ImmutableList.of(); - } - - public VertexFormat getFormat() - { - return format; - } - - public IBakedModel handleBlockState(IBlockState state) + public List func_188616_a(IBlockState state, EnumFacing side, long rand) { + BakedFluid model = this; if(state instanceof IExtendedBlockState) { IExtendedBlockState exState = (IExtendedBlockState)state; @@ -386,13 +372,19 @@ public class ModelFluid implements IModelCustomData } key <<= 1; key |= 1; - return modelCache.getUnchecked(key); + model = modelCache.getUnchecked(key); } - return this; + if(side == null) return ImmutableList.of(); + return model.faceQuads.get(side); + } + + public ItemOverrideList func_188617_f() + { + return ItemOverrideList.field_188022_a; } @Override - public Pair handlePerspective(TransformType type) + public Pair handlePerspective(TransformType type) { return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, type); } diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index ae6a230f48..1342d7ed32 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -7,10 +7,8 @@ import java.util.Map; import java.util.Set; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.IReloadableResourceManager; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.IResourceManagerReloadListener; import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.resources.IReloadableResourceManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader.VanillaLoader; import net.minecraftforge.client.model.b3d.B3DLoader; diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index c04dd6e07d..ea725a3de3 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -7,17 +7,17 @@ import java.util.List; import javax.vecmath.Matrix4f; 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.block.model.ModelResourceLocation; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.util.EnumFacing; import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.fml.common.FMLLog; @@ -55,9 +55,9 @@ public class MultiLayerModel implements IModelCustomData return ImmutableList.of(); } - private static ImmutableMap, IFlexibleBakedModel> buildModels(ImmutableMap, ModelResourceLocation> models, IModelState state, VertexFormat format, Function bakedTextureGetter) + private static ImmutableMap, IBakedModel> buildModels(ImmutableMap, ModelResourceLocation> models, IModelState state, VertexFormat format, Function bakedTextureGetter) { - ImmutableMap.Builder, IFlexibleBakedModel> builder = ImmutableMap.builder(); + ImmutableMap.Builder, IBakedModel> builder = ImmutableMap.builder(); for(Optional key : models.keySet()) { IModel model; @@ -76,13 +76,12 @@ public class MultiLayerModel implements IModelCustomData } @Override - public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { IModel missing = ModelLoaderRegistry.getMissingModel(); return new MultiLayerBakedModel( buildModels(models, state, format, bakedTextureGetter), missing.bake(missing.getDefaultState(), format, bakedTextureGetter), - format, IPerspectiveAwareModel.MapWrapper.getTransforms(state) ); } @@ -127,38 +126,17 @@ public class MultiLayerModel implements IModelCustomData return new ModelResourceLocation("builtin/missing", "missing"); } - public static class MultiLayerBakedModel implements IFlexibleBakedModel, ISmartBlockModel, IPerspectiveAwareModel + public static class MultiLayerBakedModel implements IPerspectiveAwareModel { - private final ImmutableMap, IFlexibleBakedModel> models; - private final VertexFormat format; + private final ImmutableMap, IBakedModel> models; private final ImmutableMap cameraTransforms;; - private final IFlexibleBakedModel base; - private final IFlexibleBakedModel missing; + private final IBakedModel base; + private final IBakedModel missing; private final ImmutableMap, ImmutableList> quads; - private static final Function defaultTextureGetter = new Function() - { - public TextureAtlasSprite apply(ResourceLocation location) - { - return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString()); - } - }; - - @Deprecated // remove 1.9 - public MultiLayerBakedModel(ImmutableMap, ModelResourceLocation> models, VertexFormat format, ImmutableMap cameraTransforms) - { - this( - buildModels(models, TRSRTransformation.identity(), format, defaultTextureGetter), - ModelLoaderRegistry.getMissingModel().bake(ModelLoaderRegistry.getMissingModel().getDefaultState(), format, defaultTextureGetter), - format, - cameraTransforms - ); - } - - public MultiLayerBakedModel(ImmutableMap, IFlexibleBakedModel> models, IFlexibleBakedModel missing, VertexFormat format, ImmutableMap cameraTransforms) + public MultiLayerBakedModel(ImmutableMap, IBakedModel> models, IBakedModel missing, ImmutableMap cameraTransforms) { this.models = models; - this.format = format; this.cameraTransforms = cameraTransforms; this.missing = missing; if(models.containsKey(Optional.absent())) @@ -178,33 +156,34 @@ public class MultiLayerModel implements IModelCustomData quads = quadBuilder.build(); } - private static ImmutableList buildQuads(ImmutableMap, IFlexibleBakedModel> models, Optional side) + private static ImmutableList buildQuads(ImmutableMap, IBakedModel> models, Optional side) { ImmutableList.Builder builder = ImmutableList.builder(); for(IBakedModel model : models.values()) { - if(side.isPresent()) - { - builder.addAll(model.getFaceQuads(side.get())); - } - else - { - builder.addAll(model.getGeneralQuads()); - } + builder.addAll(model.func_188616_a(null, side.orNull(), 0)); } return builder.build(); } @Override - public List getFaceQuads(EnumFacing side) + public List func_188616_a(IBlockState state, EnumFacing side, long rand) { - return quads.get(Optional.of(side)); - } - - @Override - public List getGeneralQuads() - { - return quads.get(Optional.absent()); + IBakedModel model; + BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer(); + if(layer == null) + { + return quads.get(Optional.fromNullable(side)); + } + else if(!models.containsKey(layer)) + { + model = missing; + } + else + { + model = models.get(Optional.of(layer)); + } + return model.func_188616_a(state, side, rand); } @Override @@ -220,9 +199,9 @@ public class MultiLayerModel implements IModelCustomData } @Override - public boolean isBuiltInRenderer() + public boolean func_188618_c() { - return base.isBuiltInRenderer(); + return base.func_188618_c(); } @Override @@ -238,27 +217,16 @@ public class MultiLayerModel implements IModelCustomData } @Override - public IBakedModel handleBlockState(IBlockState state) - { - Optional layer = Optional.of(MinecraftForgeClient.getRenderLayer()); - if(!models.containsKey(layer)) - { - return missing; - } - return models.get(layer); - } - - @Override - public VertexFormat getFormat() - { - return format; - } - - @Override - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, cameraTransforms, cameraTransformType); } + + @Override + public ItemOverrideList func_188617_f() + { + return ItemOverrideList.field_188022_a; + } } public static enum Loader implements ICustomModelLoader diff --git a/src/main/java/net/minecraftforge/client/model/MultiModel.java b/src/main/java/net/minecraftforge/client/model/MultiModel.java index f90a747df7..6280f598c7 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiModel.java @@ -1,7 +1,6 @@ package net.minecraftforge.client.model; import java.util.Collection; -import java.util.EnumMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -10,9 +9,12 @@ import java.util.Set; import javax.vecmath.Matrix4f; +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.client.renderer.vertex.VertexFormat; import net.minecraft.util.EnumFacing; @@ -23,30 +25,30 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.Level; import com.google.common.base.Function; +import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; import com.google.common.collect.Sets; -@SuppressWarnings("deprecation") +// TODO: Switch to vanilla class, or to something similar +@Deprecated public class MultiModel implements IModel { - public static class Baked implements IFlexibleBakedModel, IPerspectiveAwareModel + public static class Baked implements IPerspectiveAwareModel { - protected final IFlexibleBakedModel base; - protected final ImmutableMap parts; + protected final IBakedModel base; + protected final ImmutableMap parts; - protected final IFlexibleBakedModel internalBase; - protected ImmutableList general; - protected ImmutableMap> faces; + protected final IBakedModel internalBase; + protected ImmutableMap, ImmutableList> quads; protected final ImmutableMap> transforms; - public Baked(IFlexibleBakedModel base, ImmutableMap parts) + public Baked(IBakedModel base, ImmutableMap parts) { this(null, false, base, parts); } - public Baked(ResourceLocation location, boolean perspective, IFlexibleBakedModel base, ImmutableMap parts) + public Baked(ResourceLocation location, boolean perspective, IBakedModel base, ImmutableMap parts) { this.base = base; this.parts = parts; @@ -55,7 +57,7 @@ public class MultiModel implements IModel internalBase = base; else { - Iterator iter = parts.values().iterator(); + Iterator iter = parts.values().iterator(); if (iter.hasNext()) internalBase = iter.next(); else @@ -69,8 +71,8 @@ public class MultiModel implements IModel ImmutableMap.Builder> builder = ImmutableMap.builder(); for(TransformType type : TransformType.values()) { - Pair p = perBase.handlePerspective(type); - IFlexibleBakedModel newBase = p.getLeft(); + Pair p = perBase.handlePerspective(type); + IBakedModel newBase = p.getLeft(); builder.put(type, Pair.of(new Baked(location, false, newBase, parts), new TRSRTransformation(p.getRight()))); } transforms = builder.build(); @@ -94,9 +96,9 @@ public class MultiModel implements IModel } @Override - public boolean isBuiltInRenderer() + public boolean func_188618_c() { - return internalBase.isBuiltInRenderer(); + return internalBase.func_188618_c(); } @Override @@ -112,66 +114,64 @@ public class MultiModel implements IModel } @Override - public List getFaceQuads(EnumFacing side) + public List func_188616_a(IBlockState state, EnumFacing side, long rand) { - if(faces == null) + if(quads == null) { - // Create map of each face's quads. - EnumMap> faces = Maps.newEnumMap(EnumFacing.class); + ImmutableMap.Builder, ImmutableList> builder = ImmutableMap.builder(); for (EnumFacing face : EnumFacing.values()) { - ImmutableList.Builder faceQuads = ImmutableList.builder(); + ImmutableList.Builder quads = ImmutableList.builder(); if (base != null) - faceQuads.addAll(base.getFaceQuads(face)); - for (IFlexibleBakedModel bakedPart : parts.values()) - faceQuads.addAll(bakedPart.getFaceQuads(face)); - faces.put(face, faceQuads.build()); + { + quads.addAll(base.func_188616_a(null, face, 0)); + } + for (IBakedModel bakedPart : parts.values()) + { + quads.addAll(bakedPart.func_188616_a(null, face, 0)); + } + builder.put(Optional.of(face), quads.build()); } - this.faces = Maps.immutableEnumMap(faces); - } - return faces.get(side); - } - - @Override - public List getGeneralQuads() - { - if(general == null) - { - // Create list of general quads. - ImmutableList.Builder genQuads = ImmutableList.builder(); + ImmutableList.Builder quads = ImmutableList.builder(); if (base != null) - genQuads.addAll(base.getGeneralQuads()); - for (IFlexibleBakedModel bakedPart : parts.values()) - genQuads.addAll(bakedPart.getGeneralQuads()); - general = genQuads.build(); + { + quads.addAll(base.func_188616_a(null, null, 0)); + } + for (IBakedModel bakedPart : parts.values()) + { + quads.addAll(bakedPart.func_188616_a(null, null, 0)); + } + builder.put(Optional.absent(), quads.build()); + this.quads = builder.build(); } - return general; + return quads.get(Optional.fromNullable(side)); } - @Override - public VertexFormat getFormat() - { - return internalBase.getFormat(); - } - - public IFlexibleBakedModel getBaseModel() + public IBakedModel getBaseModel() { return base; } - public Map getParts() + public Map getParts() { return parts; } @Override - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { if(transforms.isEmpty()) return Pair.of(this, null); Pair p = transforms.get(cameraTransformType); return Pair.of(p.getLeft(), p.getRight().getMatrix()); } + + @Override + public ItemOverrideList func_188617_f() + { + // TODO Auto-generated method stub + return null; + } } protected final ResourceLocation location; @@ -231,14 +231,14 @@ public class MultiModel implements IModel } @Override - public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { - IFlexibleBakedModel bakedBase = null; + IBakedModel bakedBase = null; if (base != null) bakedBase = base.bake(state, format, bakedTextureGetter); - ImmutableMap.Builder mapBuilder = ImmutableMap.builder(); + ImmutableMap.Builder mapBuilder = ImmutableMap.builder(); for (Entry> entry : parts.entrySet()) { diff --git a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java index 05492f7bee..2cd3bef15f 100644 --- a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java +++ b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java @@ -11,7 +11,7 @@ import javax.vecmath.Vector4f; import net.minecraft.client.renderer.block.model.ItemTransformVec3f; import net.minecraft.client.renderer.block.model.ModelRotation; import net.minecraft.util.EnumFacing; -import net.minecraft.util.Vec3i; +import net.minecraft.util.math.Vec3i; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Triple; diff --git a/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java b/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java index dbdc076294..766242af82 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java +++ b/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java @@ -58,16 +58,16 @@ public class AnimationModelBase extends M GlStateManager.pushMatrix(); GlStateManager.rotate(180, 0, 0, 1); Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer VertexBuffer = tessellator.getVertexBuffer(); + VertexBuffer VertexBuffer = tessellator.getWorldRenderer(); VertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); VertexBuffer.setTranslation(-0.5, -1.5, -0.5); lighter.setParent(new VertexBufferConsumer(VertexBuffer)); lighter.setWorld(entity.worldObj); - lighter.setBlock(Blocks.air); + lighter.setState(Blocks.air.getDefaultState()); lighter.setBlockPos(pos); boolean empty = true; - List quads = bakedModel.getGeneralQuads(); + List quads = bakedModel.func_188616_a(null, null, 0); if(!quads.isEmpty()) { lighter.updateBlockInfo(); @@ -79,7 +79,7 @@ public class AnimationModelBase extends M } for(EnumFacing side : EnumFacing.values()) { - quads = bakedModel.getFaceQuads(side); + quads = bakedModel.func_188616_a(null, side, 0); if(!quads.isEmpty()) { if(empty) lighter.updateBlockInfo(); diff --git a/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java b/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java index 62224462cd..ac6ec94d6f 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java +++ b/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java @@ -1,7 +1,5 @@ package net.minecraftforge.client.model.animation; -import java.util.concurrent.TimeUnit; - import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; @@ -12,16 +10,11 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.model.IModelState; -import net.minecraftforge.client.model.ISmartBlockModel; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.Properties; import org.apache.commons.lang3.tuple.Pair; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; - /** * Generic TileEntitySpecialRenderer that works with the Forge model system and animations. */ @@ -29,24 +22,6 @@ public class AnimationTESR extends Fa { protected static BlockRendererDispatcher blockRenderer; - protected static final LoadingCache, IBakedModel> modelCache = CacheBuilder.newBuilder().maximumSize(10).expireAfterWrite(100, TimeUnit.MILLISECONDS).build(new CacheLoader, IBakedModel>() - { - public IBakedModel load(Pair key) throws Exception - { - IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(key.getLeft().getClean()); - if(model instanceof ISmartBlockModel) - { - model = ((ISmartBlockModel)model).handleBlockState(key.getLeft().withProperty(Properties.AnimationProperty, key.getRight())); - } - return model; - } - }); - - protected static IBakedModel getModel(IExtendedBlockState state, IModelState modelState) - { - return modelCache.getUnchecked(Pair.of(state, modelState)); - } - public void renderTileEntityFast(T te, double x, double y, double z, float partialTick, int breakStage, VertexBuffer renderer) { if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); @@ -66,11 +41,13 @@ public class AnimationTESR extends Fa Pair> pair = te.asm().apply(time); handleEvents(te, time, pair.getRight()); - IBakedModel model = getModel(exState, pair.getLeft()); + // TODO: caching? + IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(exState.getClean()); + exState = exState.withProperty(Properties.AnimationProperty, pair.getLeft()); renderer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ()); - blockRenderer.getBlockModelRenderer().renderModel(world, model, state, pos, renderer, false); + blockRenderer.getBlockModelRenderer().renderModel(world, model, exState, pos, renderer, false); } } } diff --git a/src/main/java/net/minecraftforge/client/model/animation/Clips.java b/src/main/java/net/minecraftforge/client/model/animation/Clips.java index 1fbb8711f3..6e760694ea 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/Clips.java +++ b/src/main/java/net/minecraftforge/client/model/animation/Clips.java @@ -4,7 +4,7 @@ import java.io.IOException; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.IStringSerializable; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.IModel; import net.minecraftforge.client.model.IModelPart; diff --git a/src/main/java/net/minecraftforge/client/model/animation/FastTESR.java b/src/main/java/net/minecraftforge/client/model/animation/FastTESR.java index 3b8bcdd452..80a238eb4b 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/FastTESR.java +++ b/src/main/java/net/minecraftforge/client/model/animation/FastTESR.java @@ -18,7 +18,7 @@ public abstract class FastTESR extends TileEntitySpecialRe public final void renderTileEntityAt(T te, double x, double y, double z, float partialTicks, int destroyStage) { Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer VertexBuffer = tessellator.getVertexBuffer(); + VertexBuffer VertexBuffer = tessellator.getWorldRenderer(); this.bindTexture(TextureMap.locationBlocksTexture); RenderHelper.disableStandardItemLighting(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); diff --git a/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java b/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java index a7480b20d7..2e5598975c 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java +++ b/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java @@ -13,7 +13,7 @@ import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; import net.minecraft.client.renderer.block.model.BlockPart; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.MathHelper; import net.minecraftforge.client.model.IModelState; import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.client.model.animation.ModelBlockAnimation.Parameter.Interpolation; diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 3dfbcc041b..eb60e170fe 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -16,6 +16,7 @@ import javax.vecmath.Vector3f; 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.texture.TextureAtlasSprite; @@ -24,7 +25,7 @@ import net.minecraft.client.resources.IResource; import net.minecraft.client.resources.IResourceManager; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.*; import net.minecraftforge.client.model.animation.IClip; @@ -127,65 +128,11 @@ public class B3DLoader implements ICustomModelLoader } B3DModel model = cache.get(file); if(model == null) return ModelLoaderRegistry.getMissingModel(); - if(modelLocation instanceof B3DMeshLocation) - { - String mesh = ((B3DMeshLocation)modelLocation).getMesh(); - if(!model.getMeshes().containsKey(mesh)) - { - FMLLog.severe("No mesh named %s in model %s, skipping", mesh, modelLocation); - return ModelLoaderRegistry.getMissingModel(); - } - return new ModelWrapper(modelLocation, model, ImmutableSet.of(mesh), 1); - } if(!(model.getRoot().getKind() instanceof Mesh)) { - return new ModelWrapper(modelLocation, model, ImmutableSet.of(), 1); - } - return new ModelWrapper(modelLocation, model, ImmutableSet.of(((Node)model.getRoot()).getName()), 1); - } - - /** - * @deprecated Use json or IModelCustomData.process - */ - @Deprecated - public static class B3DMeshLocation extends ResourceLocation - { - public final String mesh; - - public B3DMeshLocation(String domain, String path, String mesh) - { - super(domain, path); - this.mesh = mesh; - } - - public String getMesh() - { - return mesh; - } - - @Override - public int hashCode() - { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((mesh == null) ? 0 : mesh.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) - { - if (this == obj) return true; - if (!super.equals(obj)) return false; - if (getClass() != obj.getClass()) return false; - B3DMeshLocation other = (B3DMeshLocation) obj; - if (mesh == null) - { - if (other.mesh != null) return false; - } - else if (!mesh.equals(other.mesh)) return false; - return true; + return new ModelWrapper(modelLocation, model, ImmutableSet.of(), true, true, 1); } + return new ModelWrapper(modelLocation, model, ImmutableSet.of(((Node)model.getRoot()).getName()), true, true, 1); } public static class B3DState implements IModelState @@ -454,166 +401,6 @@ public class B3DLoader implements ICustomModelLoader } } - /** - * @deprecated Use ModelWrapper, this will be removed in 1.9 - */ - @Deprecated - public static class Wrapper extends PartWrapper implements IRetexturableModel, IModelCustomData - { - private final ResourceLocation location; - private final ImmutableSet meshes; - private final ImmutableMap textures; - - public Wrapper(ResourceLocation location, List textures, B3DModel.Node mesh) - { - this(location, ImmutableSet.of(), buildTextures(textures), mesh); - } - - public Wrapper(ResourceLocation location, ImmutableMap textures, B3DModel.Node mesh) - { - this(location, ImmutableSet.of(), textures, mesh); - } - - public Wrapper(ResourceLocation location, ImmutableSet meshes, List textures, B3DModel.Node mesh) - { - this(location, meshes, buildTextures(textures), mesh); - } - - public Wrapper(ResourceLocation location, ImmutableSet meshes, ImmutableMap textures, B3DModel.Node mesh) - { - super(mesh); - this.location = location; - this.meshes = meshes; - this.textures = textures; - } - - private static ImmutableMap buildTextures(List textures) - { - ImmutableMap.Builder builder = ImmutableMap.builder(); - - for(Texture t : textures) - { - String path = t.getPath(); - String location = getLocation(path); - if(!location.startsWith("#")) location = "#" + location; - builder.put(path, new ResourceLocation(location)); - } - return builder.build(); - } - - private static String getLocation(String path) - { - if(path.endsWith(".png")) path = path.substring(0, path.length() - ".png".length()); - return path; - } - - public Collection getDependencies() - { - // no dependencies for in-file models - // FIXME maybe add child meshes - return Collections.emptyList(); - } - - public Collection getTextures() - { - return Collections2.filter(textures.values(), new Predicate() - { - public boolean apply(ResourceLocation loc) - { - return !loc.getResourcePath().startsWith("#"); - } - }); - } - - public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) - { - ImmutableMap.Builder builder = ImmutableMap.builder(); - TextureAtlasSprite missing = bakedTextureGetter.apply(new ResourceLocation("missingno")); - for(Map.Entry e : textures.entrySet()) - { - if(e.getValue().getResourcePath().startsWith("#")) - { - FMLLog.severe("unresolved texture '%s' for b3d model '%s'", e.getValue().getResourcePath(), location); - builder.put(e.getKey(), missing); - } - else - { - builder.put(e.getKey(), bakedTextureGetter.apply(e.getValue())); - } - } - builder.put("missingno", missing); - return new BakedWrapper(getNode(), state, format, meshes, builder.build()); - } - - public ResourceLocation getLocation() - { - return location; - } - - public ImmutableMap getTextureMap() - { - return textures; - } - - @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + ((location == null) ? 0 : location.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) - { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - Wrapper other = (Wrapper) obj; - if (location == null) - { - if (other.location != null) return false; - } - else if (!location.equals(other.location)) return false; - return true; - } - - @Override - public IModel retexture(ImmutableMap textures) - { - ImmutableMap.Builder builder = ImmutableMap.builder(); - for(Map.Entry e : this.textures.entrySet()) - { - String path = e.getKey(); - String loc = getLocation(path); - if(textures.containsKey(loc)) - { - String newLoc = textures.get(loc); - if(newLoc == null) newLoc = getLocation(path); - builder.put(e.getKey(), new ResourceLocation(newLoc)); - } - else - { - builder.put(e); - } - } - return new Wrapper(location, builder.build(), getNode()); - } - - @Override - public IModel process(ImmutableMap customData) - { - return this; - } - - @Override - public IModelState getDefaultState() - { - return new B3DState(getNode().getAnimation(), 1); - } - } - public static class ModelWrapper implements IRetexturableModel, IModelCustomData, IModelSimpleProperties, IAnimatedModel { private final ResourceLocation modelLocation; @@ -624,23 +411,11 @@ public class B3DLoader implements ICustomModelLoader private final boolean gui3d; private final int defaultKey; - @Deprecated // remove in 1.9 - public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet meshes, int defaultKey) - { - this(modelLocation, model, meshes, true, true, defaultKey); - } - public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet meshes, boolean smooth, boolean gui3d, int defaultKey) { this(modelLocation, model, meshes, smooth, gui3d, defaultKey, buildTextures(model.getTextures())); } - @Deprecated // remove in 1.9 - public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet meshes, int defaultKey, ImmutableMap textures) - { - this(modelLocation, model, meshes, true, true, defaultKey, textures); - } - public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet meshes, boolean smooth, boolean gui3d, int defaultKey, ImmutableMap textures) { this.modelLocation = modelLocation; @@ -691,7 +466,7 @@ public class B3DLoader implements ICustomModelLoader } @Override - public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { ImmutableMap.Builder builder = ImmutableMap.builder(); TextureAtlasSprite missing = bakedTextureGetter.apply(new ResourceLocation("missingno")); @@ -730,7 +505,7 @@ public class B3DLoader implements ICustomModelLoader builder.put(e); } } - return new ModelWrapper(modelLocation, model, meshes, defaultKey, builder.build()); + return new ModelWrapper(modelLocation, model, meshes, smooth, gui3d, defaultKey, builder.build()); } @Override @@ -741,7 +516,7 @@ public class B3DLoader implements ICustomModelLoader JsonElement e = new JsonParser().parse(data.get("mesh")); if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isString()) { - return new ModelWrapper(modelLocation, model, ImmutableSet.of(e.getAsString()), defaultKey, textures); + return new ModelWrapper(modelLocation, model, ImmutableSet.of(e.getAsString()), smooth, gui3d, defaultKey, textures); } else if (e.isJsonArray()) { @@ -758,7 +533,7 @@ public class B3DLoader implements ICustomModelLoader return this; } } - return new ModelWrapper(modelLocation, model, builder.build(), defaultKey, textures); + return new ModelWrapper(modelLocation, model, builder.build(), smooth, gui3d, defaultKey, textures); } else { @@ -771,7 +546,7 @@ public class B3DLoader implements ICustomModelLoader JsonElement e = new JsonParser().parse(data.get("key")); if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isNumber()) { - return new ModelWrapper(modelLocation, model, meshes, e.getAsNumber().intValue(), textures); + return new ModelWrapper(modelLocation, model, meshes, smooth, gui3d, e.getAsNumber().intValue(), textures); } else { @@ -817,7 +592,7 @@ public class B3DLoader implements ICustomModelLoader } } - private static class BakedWrapper implements IFlexibleBakedModel, ISmartBlockModel, ISmartItemModel, IPerspectiveAwareModel + private static class BakedWrapper implements IPerspectiveAwareModel { private final Node node; private final IModelState state; @@ -830,12 +605,6 @@ public class B3DLoader implements ICustomModelLoader private ImmutableList quads; - @Deprecated // remove in 1.9 - public BakedWrapper(Node node, IModelState state, VertexFormat format, ImmutableSet meshes, ImmutableMap textures) - { - this(node, state, true, true, format, meshes, textures); - } - public BakedWrapper(final Node node, final IModelState state, final boolean smooth, final boolean gui3d, final VertexFormat format, final ImmutableSet meshes, final ImmutableMap textures) { this(node, state, smooth, gui3d, format, meshes, textures, CacheBuilder.newBuilder() @@ -857,12 +626,6 @@ public class B3DLoader implements ICustomModelLoader })); } - @Deprecated // remove in 1.9 - public BakedWrapper(Node node, IModelState state, VertexFormat format, ImmutableSet meshes, ImmutableMap textures, LoadingCache cache) - { - this(node, state, true, true, format, meshes, textures, cache); - } - public BakedWrapper(Node node, IModelState state, boolean smooth, boolean gui3d, VertexFormat format, ImmutableSet meshes, ImmutableMap textures, LoadingCache cache) { this.node = node; @@ -875,11 +638,8 @@ public class B3DLoader implements ICustomModelLoader this.cache = cache; } - public List getFaceQuads(EnumFacing side) - { - return Collections.emptyList(); - } - + // FIXME merge with handleBlockState + @Override public List getGeneralQuads() { if(quads == null) @@ -887,7 +647,7 @@ public class B3DLoader implements ICustomModelLoader ImmutableList.Builder builder = ImmutableList.builder(); for(Node child : node.getNodes().values()) { - builder.addAll(new BakedWrapper(child, state, format, meshes, textures).getGeneralQuads()); + builder.addAll(new BakedWrapper(child, state, smooth, gui3d, format, meshes, textures).getGeneralQuads()); } if(node.getKind() instanceof Mesh && meshes.contains(node.getName())) { @@ -996,7 +756,7 @@ public class B3DLoader implements ICustomModelLoader return gui3d; } - public boolean isBuiltInRenderer() + public boolean func_188618_c() { return false; } @@ -1012,6 +772,7 @@ public class B3DLoader implements ICustomModelLoader return ItemCameraTransforms.DEFAULT; } + // FIXME merge with getQuads @Override public BakedWrapper handleBlockState(IBlockState state) { @@ -1040,7 +801,7 @@ public class B3DLoader implements ICustomModelLoader return cache.getUnchecked(s.getFrame()); } B3DState newState = new B3DState(newAnimation, s.getFrame(), s.getNextFrame(), s.getProgress(), parent); - return new BakedWrapper(node, newState, format, meshes, textures); + return new BakedWrapper(node, newState, smooth, gui3d, format, meshes, textures); } } else if(exState.getUnlistedNames().contains(Properties.AnimationProperty)) @@ -1055,25 +816,14 @@ public class B3DLoader implements ICustomModelLoader IModelState newState = exState.getValue(Properties.AnimationProperty); if(newState != null) { - return new BakedWrapper(node, new ModelStateComposition(parent, newState), format, meshes, textures); + return new BakedWrapper(node, new ModelStateComposition(parent, newState), smooth, gui3d, format, meshes, textures); } } } return this; } - public VertexFormat getFormat() - { - return format; - } - - public BakedWrapper handleItemState(ItemStack stack) - { - // TODO specify how to get B3DState from ItemStack - return this; - } - - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, state, cameraTransformType); } diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index 1c6cb7a585..07ab890824 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -53,7 +53,6 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -@SuppressWarnings("deprecation") public class OBJModel implements IRetexturableModel, IModelCustomData { //private Gson GSON = new GsonBuilder().create(); @@ -95,7 +94,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData< } @Override - public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { ImmutableMap.Builder builder = ImmutableMap.builder(); builder.put(ModelLoader.White.loc.toString(), ModelLoader.White.instance); @@ -1300,7 +1299,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData< } } - public class OBJBakedModel implements IFlexibleBakedModel, ISmartBlockModel, ISmartItemModel, IPerspectiveAwareModel + public class OBJBakedModel implements IPerspectiveAwareModel { private final OBJModel model; private IModelState state; @@ -1323,12 +1322,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData< this.quads = null; } - @Override - public List getFaceQuads(EnumFacing side) - { - return Collections.emptyList(); - } - + // FIXME: merge with getQuads @Override public List getGeneralQuads() { @@ -1479,7 +1473,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData< } @Override - public boolean isBuiltInRenderer() + public boolean func_188618_c() { return false; } @@ -1496,18 +1490,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData< return ItemCameraTransforms.DEFAULT; } - @Override - public VertexFormat getFormat() - { - return format; - } - - @Override - public IBakedModel handleItemState(ItemStack stack) - { - return this; - } - + // FIXME: merge with getQuads @Override public OBJBakedModel handleBlockState(IBlockState state) { @@ -1591,7 +1574,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData< } @Override - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, state, cameraTransformType); } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java b/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java index abc813a1e8..0198580e9e 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java @@ -1,16 +1,18 @@ package net.minecraftforge.client.model.pipeline; -import net.minecraft.block.Block; import net.minecraft.block.Block.EnumOffsetType; -import net.minecraft.util.math.BlockPos; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockAccess; public class BlockInfo { + private final BlockColors colors; private IBlockAccess world; - private Block block; + private IBlockState state; private BlockPos blockPos; private final boolean[][][] translucent = new boolean[3][3][3]; @@ -25,11 +27,16 @@ public class BlockInfo private int cachedTint = -1; private int cachedMultiplier = -1; + public BlockInfo(BlockColors colors) + { + this.colors = colors; + } + public int getColorMultiplier(int tint) { if(cachedTint == tint) return cachedMultiplier; cachedTint = tint; - cachedMultiplier = block.colorMultiplier(world, blockPos, tint); + cachedMultiplier = colors.func_186724_a(state, world, blockPos, tint); return cachedMultiplier; } @@ -41,12 +48,12 @@ public class BlockInfo public void updateShift(boolean ignoreY) { long rand = 0; - if(block.getOffsetType() != EnumOffsetType.NONE) + if(state.getBlock().getOffsetType() != EnumOffsetType.NONE) { rand = MathHelper.getCoordinateRandom(blockPos.getX(), ignoreY ? 0 : blockPos.getY(), blockPos.getZ()); shx = ((float)((rand >> 16) & 0xF) / 0xF - .5f) * .5f; shz = ((float)((rand >> 24) & 0xF) / 0xF - .5f) * .5f; - if(block.getOffsetType() == EnumOffsetType.XYZ) + if(state.getBlock().getOffsetType() == EnumOffsetType.XYZ) { shy = ((float)((rand >> 20) & 0xF) / 0xF - 1) * .2f; } @@ -60,9 +67,9 @@ public class BlockInfo cachedMultiplier = -1; } - public void setBlock(Block block) + public void setState(IBlockState state) { - this.block = block; + this.state = state; cachedTint = -1; cachedMultiplier = -1; } @@ -94,16 +101,16 @@ public class BlockInfo for(int z = 0; z <= 2; z++) { BlockPos pos = blockPos.add(x - 1, y - 1, z - 1); - Block block = world.getBlockState(pos).getBlock(); - translucent[x][y][z] = block.isTranslucent(); + IBlockState state = world.getBlockState(pos); + translucent[x][y][z] = state.func_185895_e(); //translucent[x][y][z] = world.getBlockState(pos).getBlock().getLightOpacity(world, pos) == 0; - int brightness = this.block.getMixedBrightnessForBlock(world, pos); + int brightness = state.func_185889_a(world, pos); s[x][y][z] = (brightness >> 0x14) & 0xF; b[x][y][z] = (brightness >> 0x04) & 0xF; - ao[x][y][z] = block.getAmbientOcclusionLightValue(); + ao[x][y][z] = state.func_185892_j(); if(x == 1 && y == 1 && z == 1) { - full = block.isFullCube(); + full = state.func_185917_h(); } } } @@ -150,9 +157,9 @@ public class BlockInfo return world; } - public Block getBlock() + public IBlockState getState() { - return block; + return state; } public BlockPos getBlockPos() diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java b/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java index e6efd48a45..cb4635dcfc 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java @@ -2,13 +2,14 @@ package net.minecraftforge.client.model.pipeline; import java.util.List; -import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.BlockModelRenderer; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.util.math.BlockPos; +import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.ForgeModContainer; @@ -19,7 +20,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer @Override protected VertexLighterFlat initialValue() { - return new VertexLighterFlat(); + return new VertexLighterFlat(colors); } }; @@ -28,7 +29,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer @Override protected VertexLighterSmoothAo initialValue() { - return new VertexLighterSmoothAo(); + return new VertexLighterSmoothAo(colors); } }; @@ -37,55 +38,64 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer private final ThreadLocal lastRendererFlat = new ThreadLocal(); private final ThreadLocal lastRendererSmooth = new ThreadLocal(); + private final BlockColors colors; + + public ForgeBlockModelRenderer(BlockColors colors) + { + // TODO Auto-generated constructor stub + super(colors); + this.colors = colors; + } + @Override - public boolean renderModelStandard(IBlockAccess world, IBakedModel model, Block block, BlockPos pos, VertexBuffer wr, boolean checkSides) + public boolean func_187497_c(IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, VertexBuffer buffer, boolean checkSides, long rand) { if(ForgeModContainer.forgeLightPipelineEnabled) { - if(wr != lastRendererFlat.get()) + if(buffer != lastRendererFlat.get()) { - lastRendererFlat.set(wr); - VertexBufferConsumer newCons = new VertexBufferConsumer(wr); + lastRendererFlat.set(buffer); + VertexBufferConsumer newCons = new VertexBufferConsumer(buffer); wrFlat.set(newCons); lighterFlat.get().setParent(newCons); } wrFlat.get().setOffset(pos); - return render(lighterFlat.get(), world, model, block, pos, wr, checkSides); + return render(lighterFlat.get(), world, model, state, pos, buffer, checkSides, rand); } else { - return super.renderModelStandard(world, model, block, pos, wr, checkSides); + return super.func_187497_c(world, model, state, pos, buffer, checkSides, rand); } } @Override - public boolean renderModelAmbientOcclusion(IBlockAccess world, IBakedModel model, Block block, BlockPos pos, VertexBuffer wr, boolean checkSides) + public boolean func_187498_b(IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, VertexBuffer buffer, boolean checkSides, long rand) { if(ForgeModContainer.forgeLightPipelineEnabled) { - if(wr != lastRendererSmooth.get()) + if(buffer != lastRendererSmooth.get()) { - lastRendererSmooth.set(wr); - VertexBufferConsumer newCons = new VertexBufferConsumer(wr); + lastRendererSmooth.set(buffer); + VertexBufferConsumer newCons = new VertexBufferConsumer(buffer); wrSmooth.set(newCons); lighterSmooth.get().setParent(newCons); } wrSmooth.get().setOffset(pos); - return render(lighterSmooth.get(), world, model, block, pos, wr, checkSides); + return render(lighterSmooth.get(), world, model, state, pos, buffer, checkSides, rand); } else { - return super.renderModelAmbientOcclusion(world, model, block, pos, wr, checkSides); + return super.func_187498_b(world, model, state, pos, buffer, checkSides, rand); } } - public static boolean render(VertexLighterFlat lighter, IBlockAccess world, IBakedModel model, Block block, BlockPos pos, VertexBuffer wr, boolean checkSides) + public static boolean render(VertexLighterFlat lighter, IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, VertexBuffer wr, boolean checkSides, long rand) { lighter.setWorld(world); - lighter.setBlock(block); + lighter.setState(state); lighter.setBlockPos(pos); boolean empty = true; - List quads = model.getGeneralQuads(); + List quads = model.func_188616_a(state, null, rand); if(!quads.isEmpty()) { lighter.updateBlockInfo(); @@ -97,10 +107,10 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer } for(EnumFacing side : EnumFacing.values()) { - quads = model.getFaceQuads(side); + quads = model.func_188616_a(state, side, rand); if(!quads.isEmpty()) { - if(!checkSides || block.shouldSideBeRendered(world, pos.offset(side), side)) + if(!checkSides || state.func_185894_c(world, pos.offset(side), side)) { if(empty) lighter.updateBlockInfo(); empty = false; diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java index cd5cfa5dab..b30431b493 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java @@ -3,7 +3,6 @@ package net.minecraftforge.client.model.pipeline; 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.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage; @@ -11,6 +10,8 @@ import net.minecraft.util.EnumFacing; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.model.IColoredBakedQuad; +import org.apache.commons.lang3.tuple.Pair; + import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; @@ -71,18 +72,16 @@ public class LightUtil } } - private static final LoadingCache formatMaps = CacheBuilder.newBuilder() + private static final LoadingCache, int[]> formatMaps = CacheBuilder.newBuilder() .maximumSize(10) - .build(new CacheLoader() + .build(new CacheLoader, int[]>() { - public int[] load(VertexFormat format) + public int[] load(Pair pair) { - return mapFormats(format, DefaultVertexFormats.ITEM); + return mapFormats(pair.getLeft(), pair.getRight()); } }); - private static final int itemCount = DefaultVertexFormats.ITEM.getElementCount(); - public static void putBakedQuad(IVertexConsumer consumer, BakedQuad quad) { consumer.setQuadOrientation(quad.getFace()); @@ -96,16 +95,18 @@ public class LightUtil } //int[] eMap = mapFormats(consumer.getVertexFormat(), DefaultVertexFormats.ITEM); float[] data = new float[4]; - VertexFormat format = consumer.getVertexFormat(); - int count = format.getElementCount(); - int[] eMap = formatMaps.getUnchecked(format); + VertexFormat formatFrom = consumer.getVertexFormat(); + VertexFormat formatTo = quad.getFormat(); + int countFrom = formatFrom.getElementCount(); + int countTo = formatTo.getElementCount(); + int[] eMap = formatMaps.getUnchecked(Pair.of(formatFrom, formatTo)); for(int v = 0; v < 4; v++) { - for(int e = 0; e < count; e++) + for(int e = 0; e < countFrom; e++) { - if(eMap[e] != itemCount) + if(eMap[e] != countTo) { - unpack(quad.getVertexData(), data, DefaultVertexFormats.ITEM, v, eMap[e]); + unpack(quad.getVertexData(), data, quad.getFormat(), v, eMap[e]); consumer.put(e, data); } else @@ -240,7 +241,7 @@ public class LightUtil if(tessellator == null) { Tessellator tes = Tessellator.getInstance(); - VertexBuffer wr = tes.getVertexBuffer(); + VertexBuffer wr = tes.getWorldRenderer(); tessellator = new VertexBufferConsumer(wr); } return tessellator; @@ -260,7 +261,7 @@ public class LightUtil public static void renderQuadColorSlow(VertexBuffer wr, BakedQuad quad, int auxColor) { ItemConsumer cons; - if(wr == Tessellator.getInstance().getVertexBuffer()) + if(wr == Tessellator.getInstance().getWorldRenderer()) { cons = getItemConsumer(); } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java b/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java index 430207d08b..8e04342919 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java @@ -1,6 +1,7 @@ package net.minecraftforge.client.model.pipeline; 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.IColoredBakedQuad; @@ -13,9 +14,9 @@ public class UnpackedBakedQuad extends BakedQuad protected final VertexFormat format; protected boolean packed = false; - public UnpackedBakedQuad(float[][][] unpackedData, int tint, EnumFacing orientation, VertexFormat format) + public UnpackedBakedQuad(float[][][] unpackedData, int tint, EnumFacing orientation, TextureAtlasSprite texture, VertexFormat format) { - super(new int[format.getNextOffset() /* / 4 * 4 */], tint, orientation); + super(new int[format.getNextOffset() /* / 4 * 4 */], tint, orientation, texture, format); this.unpackedData = unpackedData; this.format = format; } @@ -69,9 +70,9 @@ public class UnpackedBakedQuad extends BakedQuad public static class Colored extends UnpackedBakedQuad implements IColoredBakedQuad { - public Colored(float[][][] unpackedData, int tint, EnumFacing orientation, VertexFormat format) + public Colored(float[][][] unpackedData, int tint, EnumFacing orientation, TextureAtlasSprite texture, VertexFormat format) { - super(unpackedData, tint, orientation, format); + super(unpackedData, tint, orientation, texture, format); } } @@ -81,6 +82,7 @@ public class UnpackedBakedQuad extends BakedQuad private final float[][][] unpackedData; private int tint = -1; private EnumFacing orientation; + private TextureAtlasSprite texture; private boolean isColored = false; private int vertices = 0; @@ -108,6 +110,11 @@ public class UnpackedBakedQuad extends BakedQuad this.orientation = orientation; } + public void setTexture(TextureAtlasSprite texture) + { + this.texture = texture; + } + public void setQuadColored() { this.isColored = true; @@ -146,9 +153,9 @@ public class UnpackedBakedQuad extends BakedQuad } if(isColored) { - return new Colored(unpackedData, tint, orientation, format); + return new Colored(unpackedData, tint, orientation, texture, format); } - return new UnpackedBakedQuad(unpackedData, tint, orientation, format); + return new UnpackedBakedQuad(unpackedData, tint, orientation, texture, format); } } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/WorldRendererConsumer.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java similarity index 96% rename from src/main/java/net/minecraftforge/client/model/pipeline/WorldRendererConsumer.java rename to src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java index a1b9537110..7a783b4d97 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/WorldRendererConsumer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java @@ -7,7 +7,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; /** - * Assumes VertexFormatElement is present in the WorlRenderer's vertex format. + * Assumes VertexFormatElement is present in the VertexBuffer's vertex format. */ public class VertexBufferConsumer implements IVertexConsumer { diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java index 2e6bec66b1..32cb394e58 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java @@ -2,19 +2,20 @@ package net.minecraftforge.client.model.pipeline; import javax.vecmath.Vector3f; -import com.google.common.base.Objects; - -import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; +import com.google.common.base.Objects; + public class VertexLighterFlat extends QuadGatheringTransformer { - protected final BlockInfo blockInfo = new BlockInfo(); + protected final BlockInfo blockInfo; private int tint = -1; protected int posIndex = -1; @@ -22,6 +23,11 @@ public class VertexLighterFlat extends QuadGatheringTransformer protected int colorIndex = -1; protected int lightmapIndex = -1; + public VertexLighterFlat(BlockColors colors) + { + this.blockInfo = new BlockInfo(colors); + } + @Override public void setParent(IVertexConsumer parent) { @@ -197,7 +203,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer float e2 = 0.95f; BlockPos pos = blockInfo.getBlockPos(); - boolean full = blockInfo.getBlock().isFullCube(); + boolean full = blockInfo.getState().func_185917_h(); if((full || y < -e1) && normal[1] < -e2) pos = pos.down(); if((full || y > e1) && normal[1] > e2) pos = pos.up(); @@ -206,7 +212,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer if((full || x < -e1) && normal[0] < -e2) pos = pos.west(); if((full || x > e1) && normal[0] > e2) pos = pos.east(); - int brightness = blockInfo.getBlock().getMixedBrightnessForBlock(blockInfo.getWorld(), pos); + int brightness = blockInfo.getState().func_185889_a(blockInfo.getWorld(), pos); lightmap[0] = ((float)((brightness >> 0x04) & 0xF) * 0x20) / 0xFFFF; lightmap[1] = ((float)((brightness >> 0x14) & 0xF) * 0x20) / 0xFFFF; @@ -235,9 +241,9 @@ public class VertexLighterFlat extends QuadGatheringTransformer blockInfo.setWorld(world); } - public void setBlock(Block block) + public void setState(IBlockState state) { - blockInfo.setBlock(block); + blockInfo.setState(state); } public void setBlockPos(BlockPos blockPos) diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterSmoothAo.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterSmoothAo.java index bc1d80ebbd..160f689b3d 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterSmoothAo.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterSmoothAo.java @@ -1,10 +1,16 @@ package net.minecraftforge.client.model.pipeline; -import net.minecraft.util.MathHelper; +import net.minecraft.client.renderer.color.BlockColors; +import net.minecraft.util.math.MathHelper; public class VertexLighterSmoothAo extends VertexLighterFlat { + public VertexLighterSmoothAo(BlockColors colors) + { + super(colors); + } + @Override protected void updateLightmap(float[] normal, float[] lightmap, float x, float y, float z) { diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 3a3c51171b..70ab22e1b3 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -45,3 +45,4 @@ net/minecraft/stats/StatList.mergeStatBases([Lnet/minecraft/stats/StatBase;Lnet/ net/minecraft/item/ItemStack.(Lnet/minecraft/item/Item;IILnet/minecraft/nbt/NBTTagCompound;)V=|p_i1881_1_,p_i1881_2_,p_i1881_3_,capNBT net/minecraft/block/BlockRedstoneWire.canConnectTo(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/EnumFacing;Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;)Z=p_176343_0_,p_176343_1_,world,pos +net/minecraft/client/renderer/block/model/BakedQuad.([IILnet/minecraft/util/EnumFacing;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/client/renderer/vertex/VertexFormat)V=|p_i46574_1_,p_i46574_2_,p_i46574_3_,p_i46574_4_,format From ad788880e576880e5598e115916cb2020de66d91 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 1 Mar 2016 20:42:36 -0800 Subject: [PATCH 015/243] Some entity patches. --- .../net/minecraft/block/Block.java.patch | 40 ++- .../multiplayer/PlayerControllerMP.java.patch | 16 +- .../minecraft/entity/EntityList.java.patch | 18 -- .../entity/EntityLivingBase.java.patch | 53 ++++ .../entity/EntityTrackerEntry.java.patch | 33 ++- .../entity/ai/EntityAIAttackMelee.java.patch | 15 +- .../entity/boss/EntityDragon.java.patch | 18 ++ .../entity/boss/EntityWither.java.patch | 11 + .../entity/item/EntityItem.java.patch | 6 +- .../EntityMinecartCommandBlock.java.patch | 10 + .../item/EntityMinecartContainer.java.patch | 2 +- .../item/EntityMinecartEmpty.java.patch | 11 + .../item/EntityMinecartFurnace.java.patch | 11 + .../item/EntityMinecartHopper.java.patch | 2 +- .../entity/monster/EntityEnderman.java.patch | 13 +- .../entity/monster/EntityZombie.java.patch | 51 +++- .../entity/passive/EntityMooshroom.java.patch | 25 +- .../entity/passive/EntityOcelot.java.patch | 11 + .../entity/passive/EntitySheep.java.patch | 16 +- .../entity/passive/EntityVillager.java.patch | 18 +- .../entity/player/EntityPlayer.java.patch | 216 +++++++++++++---- .../entity/player/EntityPlayerMP.java.patch | 51 +++- .../entity/player/InventoryPlayer.java.patch | 22 +- .../network/NetHandlerPlayServer.java.patch | 8 + .../minecraft/world/WorldProvider.java.patch | 2 +- .../net/minecraft/world/WorldType.java.patch | 4 +- .../EntityMinecartCommandBlock.java.patch.rej | 9 - .../entity/EntityTrackerEntry.java.patch.rej | 32 --- .../entity/boss/EntityDragon.java.patch.rej | 13 - .../entity/boss/EntityWither.java.patch.rej | 10 - .../boss/IBossDisplayData.java.patch.rej | 9 - .../item/EntityMinecartEmpty.java.patch.rej | 9 - .../item/EntityMinecartFurnace.java.patch.rej | 9 - .../monster/EntityEnderman.java.patch.rej | 19 -- .../monster/EntityZombie.java.patch.rej | 42 ---- .../passive/EntityMooshroom.java.patch.rej | 19 -- .../passive/EntityOcelot.java.patch.rej | 10 - .../entity/passive/EntitySheep.java.patch.rej | 15 -- .../passive/EntityVillager.java.patch.rej | 9 - .../entity/player/EntityPlayer.java.patch.rej | 228 ------------------ .../player/EntityPlayerMP.java.patch.rej | 55 ----- .../player/InventoryPlayer.java.patch.rej | 16 -- .../event/ForgeEventFactory.java | 43 ++-- .../minecraftforge/event/ServerChatEvent.java | 19 +- .../LivingEntityUseItemEvent.java} | 43 ++-- .../minecart/MinecartInteractEvent.java | 16 +- .../entity/player/EntityInteractEvent.java | 14 +- .../event/entity/player/FillBucketEvent.java | 26 +- .../entity/player/PlayerDestroyItemEvent.java | 11 +- .../event/entity/player/PlayerEvent.java | 12 +- .../minecraftforge/fluids/BlockFluidBase.java | 6 - .../common/network/internal/FMLMessage.java | 16 +- .../network/internal/FMLNetworkHandler.java | 2 +- .../fml/common/registry/EntityRegistry.java | 36 --- .../FMLControlledNamespacedRegistry.java | 2 +- .../fml/common/registry/VillagerRegistry.java | 5 +- .../server/command/ForgeCommand.java | 10 +- 57 files changed, 697 insertions(+), 751 deletions(-) rename rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej => patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch (84%) create mode 100644 patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch delete mode 100644 rejects/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch.rej rename src/main/java/net/minecraftforge/event/entity/{player/PlayerUseItemEvent.java => living/LivingEntityUseItemEvent.java} (65%) diff --git a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch index 9234bf198f..e744bb3cac 100644 --- a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch @@ -188,7 +188,7 @@ } protected ItemStack createStackedBlock(IBlockState state) -@@ -844,6 +864,1160 @@ +@@ -844,6 +864,1180 @@ return "Block{" + blockRegistry.getNameForObject(this) + "}"; } @@ -567,12 +567,13 @@ + * players to sleep in it, though the block has to specifically + * perform the sleeping functionality in it's activated event. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @param player The player or camera entity, null in some cases. + * @return True to treat this as a bed + */ -+ public boolean isBed(IBlockAccess world, BlockPos pos, Entity player) ++ public boolean isBed(IBlockState state, IBlockAccess world, BlockPos pos, Entity player) + { + return this == net.minecraft.init.Blocks.bed; + } @@ -581,12 +582,13 @@ + * Returns the position that the player is moved to upon + * waking up, or respawning at the bed. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @param player The player or camera entity, null in some cases. + * @return The spawn position + */ -+ public BlockPos getBedSpawnPosition(IBlockAccess world, BlockPos pos, EntityPlayer player) ++ public BlockPos getBedSpawnPosition(IBlockState state, IBlockAccess world, BlockPos pos, EntityPlayer player) + { + if (world instanceof World) + return BlockBed.getSafeExitLocation((World)world, pos, 0); @@ -616,13 +618,14 @@ + * Returns the direction of the block. Same values that + * are returned by BlockDirectional + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @return Bed direction + */ -+ public EnumFacing getBedDirection(IBlockAccess world, BlockPos pos) ++ public EnumFacing getBedDirection(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ return (EnumFacing)getActualState(world.getBlockState(pos), world, pos).getValue(BlockDirectional.FACING); ++ return (EnumFacing)getActualState(state, world, pos).getValue(BlockHorizontal.field_185512_D); + } + + /** @@ -990,15 +993,30 @@ + /** + * Determines if this block is can be destroyed by the specified entities normal behavior. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @return True to allow the ender dragon to destroy this block + */ -+ public boolean canEntityDestroy(IBlockAccess world, BlockPos pos, Entity entity) ++ public boolean canEntityDestroy(IBlockState state, IBlockAccess world, BlockPos pos, Entity entity) + { + if (entity instanceof net.minecraft.entity.boss.EntityDragon) + { -+ return this != net.minecraft.init.Blocks.barrier && this != net.minecraft.init.Blocks.obsidian && this != net.minecraft.init.Blocks.end_stone && this != net.minecraft.init.Blocks.bedrock && this != net.minecraft.init.Blocks.command_block; ++ return this != net.minecraft.init.Blocks.barrier && ++ this != net.minecraft.init.Blocks.obsidian && ++ this != net.minecraft.init.Blocks.end_stone && ++ this != net.minecraft.init.Blocks.bedrock && ++ this != net.minecraft.init.Blocks.end_portal && ++ this != net.minecraft.init.Blocks.end_portal_frame && ++ this != net.minecraft.init.Blocks.command_block && ++ this != net.minecraft.init.Blocks.field_185776_dc && ++ this != net.minecraft.init.Blocks.field_185777_dd && ++ this != net.minecraft.init.Blocks.iron_bars && ++ this != net.minecraft.init.Blocks.field_185775_db; ++ } ++ else if (entity instanceof net.minecraft.entity.boss.EntityWither) ++ { ++ return net.minecraft.entity.boss.EntityWither.func_181033_a(this); + } + + return true; @@ -1031,7 +1049,7 @@ + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { + IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ for (IProperty prop : state.getProperties().keySet()) + { + if (prop.getName().equals("facing") || prop.getName().equals("rotation")) + { @@ -1052,10 +1070,11 @@ + public EnumFacing[] getValidRotations(World world, BlockPos pos) + { + IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ for (IProperty prop : state.getProperties().keySet()) + { + if (prop.getName().equals("facing") && prop.getValueClass() == EnumFacing.class) + { ++ @SuppressWarnings("unchecked") + java.util.Collection values = ((java.util.Collection)prop.getAllowedValues()); + return values.toArray(new EnumFacing[values.size()]); + } @@ -1082,10 +1101,11 @@ + * @param color The color to change to + * @return If the recoloring was successful + */ ++ @SuppressWarnings({ "unchecked", "rawtypes" }) + public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, net.minecraft.item.EnumDyeColor color) + { + IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ for (IProperty prop : state.getProperties().keySet()) + { + if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class) + { diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index 258c41f477..07a51f59fa 100644 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -1,6 +1,12 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java -@@ -167,6 +167,12 @@ +@@ -162,11 +162,18 @@ + + if (itemstack1.stackSize == 0) + { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.mc.thePlayer, itemstack1, EnumHand.MAIN_HAND); + this.mc.thePlayer.func_184611_a(EnumHand.MAIN_HAND, (ItemStack)null); + } } } @@ -13,3 +19,11 @@ return flag; } } +@@ -456,6 +463,7 @@ + if (itemstack.stackSize == 0) + { + p_187101_1_.func_184611_a(p_187101_4_, (ItemStack)null); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187101_1_, itemstack, p_187101_4_); + } + } + diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch index 4fe4eddce7..a795edd304 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch @@ -38,21 +38,3 @@ } else { -@@ -362,6 +374,17 @@ - this.secondaryColor = p_i47076_3_; - this.field_151512_d = StatList.getStatKillEntity(this); - this.field_151513_e = StatList.getStatEntityKilledBy(this); -+ this.name = EntityList.getStringFromID(id); - } -+ -+ public EntityEggInfo(String name, int primaryColor, int secondaryColor) -+ { -+ this.spawnedID = -1; -+ this.name = name; -+ this.primaryColor = primaryColor; -+ this.secondaryColor = secondaryColor; -+ this.field_151512_d = (new StatBase("stat.killEntity." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKill", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).registerStat(); -+ this.field_151513_e = (new StatBase("stat.entityKilledBy." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKilledBy", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).registerStat(); -+ } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 535927f319..d267a16705 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -152,3 +152,56 @@ public abstract EnumHandSide func_184591_cq(); public boolean func_184587_cr() +@@ -2371,6 +2432,14 @@ + + if (itemstack == this.field_184627_bm) + { ++ field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn); ++ if (field_184628_bn <= 0) ++ { ++ this.onItemUseFinish(); ++ } ++ else ++ { // Forge Keep unindented to lower patch ++ field_184627_bm.getItem().onUsingTick(field_184627_bm, this, field_184628_bn); //Forge Added + if (this.func_184605_cv() <= 25 && this.func_184605_cv() % 4 == 0) + { + this.func_184584_a(this.field_184627_bm, 5); +@@ -2380,6 +2449,7 @@ + { + this.onItemUseFinish(); + } ++ } + } + else + { +@@ -2394,8 +2464,10 @@ + + if (itemstack != null && !this.func_184587_cr()) + { ++ int duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, itemstack, itemstack.getMaxItemUseDuration()); ++ if (duration <= 0) return; + this.field_184627_bm = itemstack; +- this.field_184628_bn = itemstack.getMaxItemUseDuration(); ++ this.field_184628_bn = duration; + + if (!this.worldObj.isRemote) + { +@@ -2478,6 +2550,8 @@ + this.func_184584_a(this.field_184627_bm, 16); + ItemStack itemstack = this.field_184627_bm.onItemUseFinish(this.worldObj, this); + ++ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, field_184627_bm, func_184605_cv(), itemstack); ++ + if (itemstack != null && itemstack.stackSize == 0) + { + itemstack = null; +@@ -2508,6 +2582,8 @@ + if (this.field_184627_bm != null) + { + this.field_184627_bm.onPlayerStoppedUsing(this.worldObj, this, this.func_184605_cv()); ++ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_184627_bm, this.func_184605_cv())) ++ this.field_184627_bm.onPlayerStoppedUsing(this.worldObj, this, this.func_184605_cv()); + } + + this.func_184602_cy(); diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch index 8375c44cf6..42d43da738 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch @@ -1,6 +1,37 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java +++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java -@@ -477,6 +477,9 @@ +@@ -398,6 +398,14 @@ + this.lastTrackedEntityMotionY = this.trackedEntity.motionY; + this.motionZ = this.trackedEntity.motionZ; + ++ int posX = MathHelper.floor_double(this.trackedEntity.posX * 32.0D); ++ int posY = MathHelper.floor_double(this.trackedEntity.posY * 32.0D); ++ int posZ = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D); ++ if (posX != this.encodedPosX || posY != this.encodedPosY || posZ != this.encodedPosZ) ++ { ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.trackedEntity, playerMP, this.encodedPosX, this.encodedPosY, this.encodedPosZ); ++ } ++ + if (flag && !(packet instanceof SPacketSpawnMob)) + { + playerMP.playerNetServerHandler.sendPacket(new SPacketEntityVelocity(this.trackedEntity.getEntityId(), this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ)); +@@ -438,6 +446,7 @@ + + this.trackedEntity.func_184178_b(playerMP); + playerMP.func_184848_d(this.trackedEntity); ++ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(trackedEntity, playerMP); + } + } + else if (this.trackingPlayers.contains(playerMP)) +@@ -445,6 +454,7 @@ + this.trackingPlayers.remove(playerMP); + this.trackedEntity.func_184203_c(playerMP); + playerMP.removeEntity(this.trackedEntity); ++ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(trackedEntity, playerMP); + } + } + } +@@ -477,6 +487,9 @@ logger.warn("Fetching addPacket for removed entity"); } diff --git a/rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej b/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch similarity index 84% rename from rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch index 2d0c7a658e..df4bcbc3d2 100644 --- a/rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch @@ -1,14 +1,15 @@ -++++ REJECTED PATCH 1 - private double targetX; +--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java ++++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java +@@ -21,6 +21,8 @@ private double targetY; private double targetZ; + protected final int field_188493_g = 20; + private int failedPathFindingPenalty = 0; + private boolean canPenalize = false; - public EntityAIAttackOnCollide(EntityCreature creature, Class targetClass, double speedIn, boolean useLongMemory) + public EntityAIAttackMelee(EntityCreature creature, double speedIn, boolean useLongMemory) { -++++ END PATCH -++++ REJECTED PATCH 2 +@@ -45,6 +47,19 @@ } else { @@ -28,8 +29,7 @@ this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); return this.entityPathEntity != null; } -++++ END PATCH -++++ REJECTED PATCH 3 +@@ -89,6 +104,23 @@ this.targetZ = entitylivingbase.posZ; this.delayCounter = 4 + this.attacker.getRNG().nextInt(7); @@ -53,4 +53,3 @@ if (d0 > 1024.0D) { this.delayCounter += 10; -++++ END PATCH diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch new file mode 100644 index 0000000000..f8d066e7e6 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/entity/boss/EntityDragon.java ++++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java +@@ -474,13 +474,13 @@ + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + +- if (iblockstate.func_185904_a() != Material.air && iblockstate.func_185904_a() != Material.fire) ++ if (!block.isAir(iblockstate, this.worldObj, blockpos) && iblockstate.func_185904_a() != Material.fire) + { + if (!this.worldObj.getGameRules().getBoolean("mobGriefing")) + { + flag = true; + } +- else if (block != Blocks.barrier && block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && block != Blocks.end_portal && block != Blocks.end_portal_frame) ++ else if (block.canEntityDestroy(iblockstate, this.worldObj, blockpos, this)) + { + if (block != Blocks.command_block && block != Blocks.field_185776_dc && block != Blocks.field_185777_dd && block != Blocks.iron_bars && block != Blocks.field_185775_db) + { diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch new file mode 100644 index 0000000000..8936ecdcb2 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/boss/EntityWither.java ++++ ../src-work/minecraft/net/minecraft/entity/boss/EntityWither.java +@@ -365,7 +365,7 @@ + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + +- if (iblockstate.func_185904_a() != Material.air && func_181033_a(block)) ++ if (!block.isAir(iblockstate, this.worldObj, blockpos)) + { + flag = this.worldObj.destroyBlock(blockpos, true) || flag; + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch index e78393fac3..5562fd6469 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch @@ -24,7 +24,7 @@ public void onUpdate() { -+ ItemStack stack = this.getDataWatcher().getWatchableObjectItemStack(10); ++ ItemStack stack = this.func_184212_Q().func_187225_a(field_184533_c).orNull(); + if (stack != null && stack.getItem() != null && stack.getItem().onEntityItemUpdate(this)) return; if (this.getEntityItem() == null) { @@ -34,7 +34,7 @@ this.handleWaterMovement(); - if (!this.worldObj.isRemote && this.age >= 6000) -+ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); ++ ItemStack item = this.func_184212_Q().func_187225_a(field_184533_c).orNull(); + + if (!this.worldObj.isRemote && this.age >= lifespan) { @@ -63,7 +63,7 @@ - { - this.setDead(); - } -+ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); ++ ItemStack item = this.func_184212_Q().func_187225_a(field_184533_c).orNull(); + if (item == null || item.stackSize <= 0) this.setDead(); + if (tagCompund.hasKey("Lifespan")) lifespan = tagCompund.getInteger("Lifespan"); } diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch new file mode 100644 index 0000000000..028fa17b8d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java +@@ -122,6 +122,7 @@ + + public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; + this.commandBlockLogic.tryOpenEditCommandBlock(p_184230_1_); + return false; + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch index 5b38ca3984..0663f08f19 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch @@ -4,7 +4,7 @@ public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; if (!this.worldObj.isRemote) { p_184230_1_.displayGUIChest(this); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch new file mode 100644 index 0000000000..4239cd058b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java +@@ -19,6 +19,8 @@ + + public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; ++ + if (p_184230_1_.isSneaking()) + { + return false; diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch new file mode 100644 index 0000000000..e80c6fb498 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java +@@ -136,6 +136,8 @@ + + public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; ++ + if (p_184230_2_ != null && p_184230_2_.getItem() == Items.coal && this.fuel + 3600 <= 32000) + { + if (!p_184230_1_.capabilities.isCreativeMode) diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch index 12c782abdb..3fbedf27bb 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch @@ -4,7 +4,7 @@ public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; if (!this.worldObj.isRemote) { p_184230_1_.displayGUIChest(this); diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch index acbdcde24b..dcd8ee527d 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch @@ -1,6 +1,17 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java -@@ -342,6 +342,18 @@ +@@ -259,7 +259,9 @@ + + private boolean teleportTo(double x, double y, double z) + { +- boolean flag = this.func_184595_k(x, y, z); ++ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, x, y, z, 0); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; ++ boolean flag = this.func_184595_k(event.targetX, event.targetY, event.targetZ); + + if (flag) + { +@@ -342,6 +344,18 @@ } } diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch index f62c7284ab..47b77b2621 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch @@ -1,6 +1,53 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java -@@ -279,7 +279,7 @@ +@@ -101,7 +101,7 @@ + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); + this.getEntityAttribute(SharedMonsterAttributes.field_188791_g).setBaseValue(2.0D); +- this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * 0.10000000149011612D); ++ this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance); + } + + protected void entityInit() +@@ -259,12 +259,24 @@ + entitylivingbase = (EntityLivingBase)source.getEntity(); + } + +- if (entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue() && this.worldObj.getGameRules().getBoolean("doMobSpawning")) ++ int i = MathHelper.floor_double(this.posX); ++ int j = MathHelper.floor_double(this.posY); ++ int k = MathHelper.floor_double(this.posZ); ++ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(reinforcementChance).getAttributeValue()); ++ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true; ++ ++ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || ++ entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue() && this.worldObj.getGameRules().getBoolean("doMobSpawning")) + { +- int i = MathHelper.floor_double(this.posX); +- int j = MathHelper.floor_double(this.posY); +- int k = MathHelper.floor_double(this.posZ); +- EntityZombie entityzombie = new EntityZombie(this.worldObj); ++ EntityZombie entityzombie; ++ if (summonAid.customSummonedAid != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) ++ { ++ entityzombie = summonAid.customSummonedAid; ++ } ++ else ++ { ++ entityzombie = new EntityZombie(this.worldObj); ++ } + + for (int l = 0; l < 50; ++l) + { +@@ -272,14 +284,14 @@ + int j1 = j + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1); + int k1 = k + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1); + +- if (this.worldObj.getBlockState(new BlockPos(i1, j1 - 1, k1)).func_185896_q() && this.worldObj.getLightFromNeighbors(new BlockPos(i1, j1, k1)) < 10) ++ if (this.worldObj.getBlockState(new BlockPos(i1, j1 - 1, k1)).isSideSolid(this.worldObj, new BlockPos(i1, j1 - 1, k1), net.minecraft.util.EnumFacing.UP) && this.worldObj.getLightFromNeighbors(new BlockPos(i1, j1, k1)) < 10) + { + entityzombie.setPosition((double)i1, (double)j1, (double)k1); + if (!this.worldObj.isAnyPlayerWithinRangeAt((double)i1, (double)j1, (double)k1, 7.0D) && this.worldObj.checkNoEntityCollision(entityzombie.getEntityBoundingBox(), entityzombie) && this.worldObj.func_184144_a(entityzombie, entityzombie.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.getEntityBoundingBox())) { this.worldObj.spawnEntityInWorld(entityzombie); @@ -9,7 +56,7 @@ entityzombie.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null); this.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); entityzombie.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); -@@ -483,7 +483,7 @@ +@@ -483,7 +495,7 @@ if (livingdata == null) { diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch index 10eafe85ac..47493b5699 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch @@ -9,13 +9,30 @@ { public EntityMooshroom(World worldIn) { -@@ -78,6 +78,35 @@ +@@ -22,6 +22,7 @@ + this.spawnableBlock = Blocks.mycelium; + } + ++ @SuppressWarnings("unused") + public boolean func_184645_a(EntityPlayer p_184645_1_, EnumHand p_184645_2_, ItemStack p_184645_3_) + { + if (p_184645_3_ != null && p_184645_3_.getItem() == Items.bowl && this.getGrowingAge() >= 0 && !p_184645_1_.capabilities.isCreativeMode) +@@ -37,7 +38,7 @@ + + return true; + } +- else if (p_184645_3_ != null && p_184645_3_.getItem() == Items.shears && this.getGrowingAge() >= 0) ++ else if (false && p_184645_3_ != null && p_184645_3_.getItem() == Items.shears && this.getGrowingAge() >= 0) //Forge Disable, Moved to onSheared + { + this.setDead(); + this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); +@@ -78,6 +79,35 @@ return new EntityMooshroom(this.worldObj); } -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos){ return getGrowingAge() >= 0; } ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.math.BlockPos pos){ return getGrowingAge() >= 0; } + @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos, int fortune) ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.math.BlockPos pos, int fortune) + { + this.setDead(); + this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); @@ -38,7 +55,7 @@ + ret.add(new ItemStack(Blocks.red_mushroom)); + } + -+ this.playSound("mob.sheep.shear", 1.0F, 1.0F); ++ this.func_184185_a(SoundEvents.field_187784_dt, 1.0F, 1.0F); + return ret; + } + diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch new file mode 100644 index 0000000000..0a74cfc615 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java +@@ -285,7 +285,7 @@ + IBlockState iblockstate = this.worldObj.getBlockState(blockpos.down()); + Block block = iblockstate.getBlock(); + +- if (block == Blocks.grass || iblockstate.func_185904_a() == Material.leaves) ++ if (block == Blocks.grass || block.isLeaves(iblockstate, this.worldObj, blockpos.down())) + { + return true; + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch index 762f03bcda..d8b60f9592 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch @@ -9,7 +9,19 @@ { private static final DataParameter field_184774_bv = EntityDataManager.func_187226_a(EntitySheep.class, DataSerializers.field_187191_a); private final InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() -@@ -356,4 +356,19 @@ +@@ -171,9 +171,10 @@ + } + } + ++ @SuppressWarnings("unused") + public boolean func_184645_a(EntityPlayer p_184645_1_, EnumHand p_184645_2_, ItemStack p_184645_3_) + { +- if (p_184645_3_ != null && p_184645_3_.getItem() == Items.shears && !this.getSheared() && !this.isChild()) ++ if (false && p_184645_3_ != null && p_184645_3_.getItem() == Items.shears && !this.getSheared() && !this.isChild()) //Forge: Moved to onSheared + { + if (!this.worldObj.isRemote) + { +@@ -356,4 +357,19 @@ DYE_TO_RGB.put(EnumDyeColor.RED, new float[] {0.6F, 0.2F, 0.2F}); DYE_TO_RGB.put(EnumDyeColor.BLACK, new float[] {0.1F, 0.1F, 0.1F}); } @@ -25,7 +37,7 @@ + for (int j = 0; j < i; ++j) + ret.add(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, this.getFleeceColor().getMetadata())); + -+ this.playSound("mob.sheep.shear", 1.0F, 1.0F); ++ this.func_184185_a(SoundEvents.field_187763_eJ, 1.0F, 1.0F); + return ret; + } } diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch index 53207949d7..d2209ab8a2 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -1,15 +1,23 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java -@@ -221,7 +221,7 @@ +@@ -90,6 +90,7 @@ + private boolean isLookingForHome; + private boolean areAdditionalTasksSet; + private InventoryBasic villagerInventory; ++ @Deprecated //Use VillagerRegistry + private static final EntityVillager.ITradeList[][][][] DEFAULT_TRADE_LIST_MAP = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.wheat, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.potato, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.carrot, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.bread, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.pumpkin_pie, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.apple, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.cookie, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.cake, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.fish, new EntityVillager.PriceInfo(6, 6), Items.cooked_fish, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.fishing_rod, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.shears, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool)), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.arrow, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.bow, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new EntityVillager.PriceInfo(10, 10), Items.flint, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.paper, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.book, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.compass, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.written_book, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.clock, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.name_tag, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.rotten_flesh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.gold_ingot, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.redstone, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.ender_pearl, new EntityVillager.PriceInfo(4, 7)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.experience_bottle, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_helmet, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.iron_chestplate, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_chestplate, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.chainmail_boots, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_leggings, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.chainmail_helmet, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_chestplate, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_axe, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_sword, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_sword, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_axe, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_shovel, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_pickaxe, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.porkchop, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.chicken, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.cooked_porkchop, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.cooked_chicken, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.leather, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.leather_leggings, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.leather_chestplate, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.saddle, new EntityVillager.PriceInfo(8, 10))}}}}; + + public EntityVillager(World worldIn) +@@ -221,7 +222,7 @@ { boolean flag = p_184645_3_ != null && p_184645_3_.getItem() == Items.spawn_egg; - if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild()) -+ if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking()) ++ if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !p_184645_1_.isSneaking()) { if (!this.worldObj.isRemote && (this.buyingList == null || !this.buyingList.isEmpty())) { -@@ -533,6 +533,7 @@ +@@ -533,6 +534,7 @@ private void populateBuyingList() { @@ -17,7 +25,7 @@ EntityVillager.ITradeList[][][] aentityvillager$itradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()]; if (this.careerId != 0 && this.careerLevel != 0) -@@ -647,6 +648,7 @@ +@@ -647,6 +649,7 @@ } } @@ -25,7 +33,7 @@ if (s1 != null) { TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("entity.Villager." + s1, new Object[0]); -@@ -708,7 +710,7 @@ +@@ -708,7 +711,7 @@ public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) { livingdata = super.onInitialSpawn(difficulty, livingdata); diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index 1c16e0ee1f..2a1e1236c2 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -1,6 +1,18 @@ --- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java +++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java -@@ -174,6 +174,7 @@ +@@ -93,6 +93,11 @@ + @SuppressWarnings("incomplete-switch") + public abstract class EntityPlayer extends EntityLivingBase + { ++ public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; ++ private java.util.HashMap spawnChunkMap = new java.util.HashMap(); ++ private java.util.HashMap spawnForcedMap = new java.util.HashMap(); ++ public float eyeHeight = this.getDefaultEyeHeight(); ++ + private static final DataParameter field_184829_a = EntityDataManager.func_187226_a(EntityPlayer.class, DataSerializers.field_187193_c); + private static final DataParameter field_184830_b = EntityDataManager.func_187226_a(EntityPlayer.class, DataSerializers.field_187192_b); + protected static final DataParameter field_184827_bp = EntityDataManager.func_187226_a(EntityPlayer.class, DataSerializers.field_187191_a); +@@ -174,6 +179,7 @@ public void onUpdate() { @@ -8,15 +20,7 @@ this.noClip = this.isSpectator(); if (this.isSpectator()) -@@ -205,6 +206,7 @@ - { - this.wakeUpPlayer(false, true, true); - } -+ } - } - } - else if (this.sleepTimer > 0) -@@ -219,7 +221,7 @@ +@@ -219,7 +225,7 @@ super.onUpdate(); @@ -25,7 +29,7 @@ { this.closeScreen(); this.openContainer = this.inventoryContainer; -@@ -360,6 +362,7 @@ +@@ -360,6 +366,7 @@ this.setSize(f, f1); } } @@ -33,7 +37,21 @@ } public int getMaxInPortalTime() -@@ -576,11 +579,15 @@ +@@ -442,11 +449,11 @@ + this.cameraYaw = 0.0F; + this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); + +- if (this.func_184187_bx() instanceof EntityPig) ++ if (this.func_184187_bx() instanceof EntityLivingBase && ((EntityLivingBase)this.func_94060_bK()).shouldRiderFaceForward(this)) + { + this.rotationPitch = f1; + this.rotationYaw = f; +- this.renderYawOffset = ((EntityPig)this.func_184187_bx()).renderYawOffset; ++ this.renderYawOffset = ((EntityLivingBase)this.func_184187_bx()).renderYawOffset; + } + } + } +@@ -576,11 +583,15 @@ public void onDeath(DamageSource cause) { @@ -49,7 +67,7 @@ if (this.getName().equals("Notch")) { this.dropItem(new ItemStack(Items.apple, 1), true, false); -@@ -591,6 +598,9 @@ +@@ -591,6 +602,9 @@ this.inventory.dropAllItems(); } @@ -59,7 +77,7 @@ if (cause != null) { this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * 0.017453292F) * 0.1F); -@@ -678,12 +688,25 @@ +@@ -678,12 +692,25 @@ public EntityItem dropOneItem(boolean dropAll) { @@ -87,7 +105,7 @@ } public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem) -@@ -746,15 +769,24 @@ +@@ -746,15 +773,24 @@ protected ItemStack func_184816_a(EntityItem p_184816_1_) { @@ -113,7 +131,23 @@ if (f > 1.0F) { int i = EnchantmentHelper.func_185293_e(this); -@@ -845,6 +877,16 @@ +@@ -804,12 +840,13 @@ + f /= 5.0F; + } + +- return f; ++ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos); ++ return (f < 0 ? 0 : f); + } + + public boolean func_184823_b(IBlockState p_184823_1_) + { +- return this.inventory.func_184432_b(p_184823_1_); ++ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_184823_1_, this.inventory.func_184432_b(p_184823_1_)); + } + + public void readEntityFromNBT(NBTTagCompound tagCompund) +@@ -845,6 +882,16 @@ this.spawnForced = tagCompund.getBoolean("SpawnForced"); } @@ -130,7 +164,7 @@ this.foodStats.readNBT(tagCompund); this.capabilities.readCapabilitiesFromNBT(tagCompund); -@@ -877,6 +919,23 @@ +@@ -877,6 +924,23 @@ tagCompound.setBoolean("SpawnForced", this.spawnForced); } @@ -154,7 +188,7 @@ this.foodStats.writeNBT(tagCompound); this.capabilities.writeCapabilitiesToNBT(tagCompound); tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT()); -@@ -884,6 +943,7 @@ +@@ -884,6 +948,7 @@ public boolean attackEntityFrom(DamageSource source, float amount) { @@ -162,7 +196,36 @@ if (this.isEntityInvulnerable(source)) { return false; -@@ -1123,6 +1183,7 @@ +@@ -966,6 +1031,7 @@ + if (this.field_184627_bm.stackSize <= 0) + { + EnumHand enumhand = this.func_184600_cs(); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, this.field_184627_bm, enumhand); + + if (enumhand == EnumHand.MAIN_HAND) + { +@@ -1001,8 +1067,12 @@ + { + if (!this.isEntityInvulnerable(damageSrc)) + { ++ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); ++ if (damageAmount <= 0) return; + damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); + damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); ++ damageAmount = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, inventory.armorInventory, damageSrc, damageAmount); ++ if (damageAmount <= 0) return; + float f = damageAmount; + damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); + this.setAbsorptionAmount(this.getAbsorptionAmount() - (f - damageAmount)); +@@ -1067,6 +1137,7 @@ + } + else + { ++ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, p_184822_1_, p_184822_2_, p_184822_3_)) return EnumActionResult.PASS; + ItemStack itemstack = p_184822_2_ != null ? p_184822_2_.copy() : null; + + if (!p_184822_1_.func_184230_a(this, p_184822_2_, p_184822_3_)) +@@ -1123,6 +1194,7 @@ public void attackTargetEntityWithCurrentItem(Entity targetEntity) { @@ -170,7 +233,7 @@ if (targetEntity.canAttackWithItem()) { if (!targetEntity.hitByEntity(this)) -@@ -1410,6 +1471,8 @@ +@@ -1410,6 +1482,8 @@ public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation) { @@ -179,7 +242,21 @@ if (!this.worldObj.isRemote) { if (this.isPlayerSleeping() || !this.isEntityAlive()) -@@ -1514,13 +1577,14 @@ +@@ -1449,9 +1523,10 @@ + + this.setSize(0.2F, 0.2F); + +- if (this.worldObj.isBlockLoaded(bedLocation)) +- { +- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(bedLocation).getValue(BlockHorizontal.field_185512_D); ++ IBlockState state = null; ++ if (this.worldObj.isBlockLoaded(bedLocation)) state = this.worldObj.getBlockState(bedLocation); ++ if (state != null && state.getBlock().isBed(state, this.worldObj, bedLocation, this)) { ++ EnumFacing enumfacing = state.getBlock().getBedDirection(state, this.worldObj, bedLocation); + float f = 0.5F; + float f1 = 0.5F; + +@@ -1514,13 +1589,14 @@ public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn) { @@ -188,16 +265,16 @@ IBlockState iblockstate = this.worldObj.getBlockState(this.playerLocation); - if (this.playerLocation != null && iblockstate.getBlock() == Blocks.bed) -+ if (this.playerLocation != null && iblockstate.getBlock().isBed(worldObj, playerLocation, this)) ++ if (this.playerLocation != null && iblockstate.getBlock().isBed(iblockstate, worldObj, playerLocation, this)) { - this.worldObj.setBlockState(this.playerLocation, iblockstate.withProperty(BlockBed.OCCUPIED, Boolean.valueOf(false)), 4); - BlockPos blockpos = BlockBed.getSafeExitLocation(this.worldObj, this.playerLocation, 0); + iblockstate.getBlock().setBedOccupied(worldObj, playerLocation, this, false); -+ BlockPos blockpos = iblockstate.getBlock().getBedSpawnPosition(worldObj, playerLocation, this); ++ BlockPos blockpos = iblockstate.getBlock().getBedSpawnPosition(iblockstate, worldObj, playerLocation, this); if (blockpos == null) { -@@ -1529,6 +1593,10 @@ +@@ -1529,6 +1605,10 @@ this.setPosition((double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.1F), (double)((float)blockpos.getZ() + 0.5F)); } @@ -208,7 +285,7 @@ this.sleeping = false; -@@ -1547,14 +1615,14 @@ +@@ -1547,14 +1627,15 @@ private boolean isInBed() { @@ -218,14 +295,37 @@ public static BlockPos getBedSpawnLocation(World worldIn, BlockPos bedLocation, boolean forceSpawn) { - Block block = worldIn.getBlockState(bedLocation).getBlock(); +- Block block = worldIn.getBlockState(bedLocation).getBlock(); ++ IBlockState state = worldIn.getBlockState(bedLocation); ++ Block block = state.getBlock(); - if (block != Blocks.bed) -+ if (!block.isBed(worldIn, bedLocation, null)) ++ if (!block.isBed(state, worldIn, bedLocation, null)) { if (!forceSpawn) { -@@ -1618,16 +1686,24 @@ +@@ -1569,16 +1650,17 @@ + } + else + { +- return BlockBed.getSafeExitLocation(worldIn, bedLocation, 0); ++ return block.getBedSpawnPosition(state, worldIn, bedLocation, null); + } + } + + @SideOnly(Side.CLIENT) + public float getBedOrientationInDegrees() + { +- if (this.playerLocation != null) ++ IBlockState state = this.playerLocation == null ? null : this.worldObj.getBlockState(playerLocation); ++ if (state != null && state.getBlock().isBed(state, worldObj, playerLocation, this)) + { +- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockHorizontal.field_185512_D); ++ EnumFacing enumfacing = state.getBlock().getBedDirection(state, worldObj, playerLocation); + + switch (enumfacing) + { +@@ -1618,16 +1700,24 @@ public BlockPos getBedLocation() { @@ -252,7 +352,7 @@ if (pos != null) { this.spawnChunk = pos; -@@ -1822,6 +1898,10 @@ +@@ -1822,6 +1912,10 @@ super.fall(distance, damageMultiplier); } @@ -263,18 +363,38 @@ } protected void resetHeight() -@@ -2009,6 +2089,10 @@ - this.field_181016_an = oldPlayer.field_181016_an; - this.field_181017_ao = oldPlayer.field_181017_ao; - this.field_181018_ap = oldPlayer.field_181018_ap; -+ //Copy and re-init ExtendedProperties when switching dimensions. -+ this.extendedProperties = oldPlayer.extendedProperties; -+ for (net.minecraftforge.common.IExtendedEntityProperties p : this.extendedProperties.values()) -+ p.init(this, this.worldObj); - } - else if (this.worldObj.getGameRules().getBoolean("keepInventory") || oldPlayer.isSpectator()) - { -@@ -2129,7 +2213,7 @@ +@@ -2022,6 +2116,18 @@ + this.xpSeed = oldPlayer.xpSeed; + this.theInventoryEnderChest = oldPlayer.theInventoryEnderChest; + this.func_184212_Q().func_187227_b(field_184827_bp, oldPlayer.func_184212_Q().func_187225_a(field_184827_bp)); ++ ++ this.spawnChunkMap = oldPlayer.spawnChunkMap; ++ this.spawnForcedMap = oldPlayer.spawnForcedMap; ++ ++ //Copy over a section of the Entity Data from the old player. ++ //Allows mods to specify data that persists after players respawn. ++ NBTTagCompound old = oldPlayer.getEntityData(); ++ if (old.hasKey(PERSISTED_NBT_TAG)) ++ { ++ getEntityData().setTag(PERSISTED_NBT_TAG, old.getCompoundTag(PERSISTED_NBT_TAG)); ++ } ++ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, oldPlayer, !respawnFromEnd); + } + + protected boolean canTriggerWalking() +@@ -2120,7 +2226,10 @@ + + public ITextComponent getDisplayName() + { +- ITextComponent itextcomponent = new TextComponentString(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName())); ++ ITextComponent itextcomponent = new TextComponentString(""); ++ if (!prefixes.isEmpty()) for (ITextComponent prefix : prefixes) itextcomponent.appendSibling(prefix); ++ itextcomponent.appendSibling(new TextComponentString(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName()))); ++ if (!suffixes.isEmpty()) for (ITextComponent suffix : suffixes) itextcomponent.appendSibling(suffix); + itextcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); + itextcomponent.getChatStyle().setChatHoverEvent(this.getHoverEvent()); + itextcomponent.getChatStyle().setInsertion(this.getName()); +@@ -2129,7 +2238,7 @@ public float getEyeHeight() { @@ -283,7 +403,7 @@ if (this.isPlayerSleeping()) { -@@ -2340,6 +2424,136 @@ +@@ -2340,6 +2449,136 @@ return (float)this.getEntityAttribute(SharedMonsterAttributes.field_188792_h).getAttributeValue(); } @@ -397,23 +517,23 @@ + this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.getName()); + } + -+ private final java.util.Collection prefixes = new java.util.LinkedList(); -+ private final java.util.Collection suffixes = new java.util.LinkedList(); ++ private final java.util.Collection prefixes = new java.util.LinkedList(); ++ private final java.util.Collection suffixes = new java.util.LinkedList(); + + /** + * Add a prefix to the player's username in chat + * @param prefix The prefix + */ -+ public void addPrefix(net.minecraft.util.IChatComponent prefix) { prefixes.add(prefix); } ++ public void addPrefix(ITextComponent prefix) { prefixes.add(prefix); } + + /** + * Add a suffix to the player's username in chat + * @param suffix The suffix + */ -+ public void addSuffix(net.minecraft.util.IChatComponent suffix) { suffixes.add(suffix); } ++ public void addSuffix(ITextComponent suffix) { suffixes.add(suffix); } + -+ public java.util.Collection getPrefixes() { return this.prefixes; } -+ public java.util.Collection getSuffixes() { return this.suffixes; } ++ public java.util.Collection getPrefixes() { return this.prefixes; } ++ public java.util.Collection getSuffixes() { return this.suffixes; } + + /* ======================================== FORGE END =====================================*/ + diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch index e5c9a28a24..4e12cfdae6 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -1,6 +1,24 @@ --- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java +++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -@@ -250,7 +250,7 @@ +@@ -134,14 +134,15 @@ + public int ping; + public boolean playerConqueredTheEnd; + ++ @SuppressWarnings("unused") + public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, PlayerInteractionManager interactionManager) + { + super(worldIn, profile); + interactionManager.thisPlayerMP = this; + this.theItemInWorldManager = interactionManager; +- BlockPos blockpos = worldIn.getSpawnPoint(); ++ BlockPos blockpos = worldIn.provider.getRandomizedSpawnPoint(); + +- if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) ++ if (false && !worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) + { + int i = Math.max(0, server.func_184108_a(worldIn)); + int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ())); +@@ -250,7 +251,7 @@ this.openContainer.detectAndSendChanges(); @@ -9,7 +27,15 @@ { this.closeScreen(); this.openContainer = this.inventoryContainer; -@@ -459,7 +459,20 @@ +@@ -433,6 +434,7 @@ + + public void onDeath(DamageSource cause) + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; + boolean flag = this.worldObj.getGameRules().getBoolean("showDeathMessages"); + this.playerNetServerHandler.sendPacket(new SPacketCombatEvent(this.getCombatTracker(), SPacketCombatEvent.Event.ENTITY_DIED, flag)); + +@@ -459,7 +461,20 @@ if (!this.worldObj.getGameRules().getBoolean("keepInventory") && !this.isSpectator()) { @@ -24,13 +50,30 @@ + { + for (net.minecraft.entity.item.EntityItem item : capturedDrops) + { -+ joinEntityItemWithWorld(item); ++ this.worldObj.spawnEntityInWorld(item); + } + } } for (ScoreObjective scoreobjective : this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreCriteria.deathCount)) -@@ -921,6 +934,7 @@ +@@ -540,6 +555,7 @@ + + public Entity func_184204_a(int p_184204_1_) + { ++ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return; + this.field_184851_cj = true; + + if (this.dimension == 1 && p_184204_1_ == 1) +@@ -697,7 +713,7 @@ + BlockPos blockpos = new BlockPos(i, j, k); + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + +- if (iblockstate.func_185904_a() == Material.air) ++ if (iblockstate.getBlock().isAir(iblockstate, this.worldObj, blockpos)) + { + BlockPos blockpos1 = blockpos.down(); + IBlockState iblockstate1 = this.worldObj.getBlockState(blockpos1); +@@ -921,6 +937,7 @@ { if (stat != null) { diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch index 26b44efcd6..8f0f421e9e 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch @@ -1,7 +1,23 @@ --- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java +++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java -@@ -304,6 +304,14 @@ - return i; +@@ -270,13 +270,8 @@ + + if (itemstack == null) + { +- itemstack = new ItemStack(item, 0, itemStackIn.getMetadata()); +- +- if (itemStackIn.hasTagCompound()) +- { +- itemstack.setTagCompound((NBTTagCompound)itemStackIn.getTagCompound().copy()); +- } +- ++ itemstack = itemStackIn.copy(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up. ++ itemstack.stackSize = 0; + this.setInventorySlotContents(j, itemstack); + } + +@@ -344,6 +339,14 @@ + } } } + @@ -14,4 +30,4 @@ + } } - private int storeItemStack(ItemStack itemStackIn) + public boolean addItemStackToInventory(final ItemStack itemStackIn) diff --git a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch index e61c493305..ce968f5647 100644 --- a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -12,3 +12,11 @@ { return; } +@@ -689,6 +692,7 @@ + if (itemstack != null && itemstack.stackSize == 0) + { + this.playerEntity.func_184611_a(enumhand, (ItemStack)null); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.playerEntity, itemstack, enumhand); + itemstack = null; + } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch index 3995f98c23..4102bfe0e1 100644 --- a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -138,7 +138,7 @@ + BlockPos ret = this.worldObj.getSpawnPoint(); + + boolean isAdventure = worldObj.getWorldInfo().getGameType() == WorldSettings.GameType.ADVENTURE; -+ int spawnFuzz = terrainType.getSpawnFuzz(); ++ int spawnFuzz = this.worldObj instanceof WorldServer ? terrainType.getSpawnFuzz((WorldServer)this.worldObj, this.worldObj.getMinecraftServer()) : 1; + int border = MathHelper.floor_double(worldObj.getWorldBorder().getClosestDistance(ret.getX(), ret.getZ())); + if (border < spawnFuzz) spawnFuzz = border; + if (spawnFuzz < 1) spawnFuzz = 1; diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch index 39573c29f7..9828f8d9f3 100644 --- a/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch @@ -93,9 +93,9 @@ + * Useful for void world types. + * @return Fuzz for entity initial spawn in blocks. + */ -+ public int getSpawnFuzz() ++ public int getSpawnFuzz(WorldServer world, net.minecraft.server.MinecraftServer server) + { -+ return Math.max(5, net.minecraft.server.MinecraftServer.getServer().getSpawnProtectionSize() - 6); ++ return Math.max(0, server.func_184108_a(world)); + } + + /** diff --git a/rejects/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch.rej deleted file mode 100644 index 75ed679fe7..0000000000 --- a/rejects/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - - public boolean interactFirst(EntityPlayer playerIn) - { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; - this.commandBlockLogic.tryOpenEditCommandBlock(playerIn); - return false; - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch.rej deleted file mode 100644 index cdbb07dee0..0000000000 --- a/rejects/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch.rej +++ /dev/null @@ -1,32 +0,0 @@ -++++ REJECTED PATCH 1 - this.lastTrackedEntityMotionY = this.trackedEntity.motionY; - this.motionZ = this.trackedEntity.motionZ; - -+ int posX = MathHelper.floor_double(this.trackedEntity.posX * 32.0D); -+ int posY = MathHelper.floor_double(this.trackedEntity.posY * 32.0D); -+ int posZ = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D); -+ if (posX != this.encodedPosX || posY != this.encodedPosY || posZ != this.encodedPosZ) -+ { -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.trackedEntity, playerMP, this.encodedPosX, this.encodedPosY, this.encodedPosZ); -+ } -+ - if (this.sendVelocityUpdates && !(packet instanceof S0FPacketSpawnMob)) - { - playerMP.playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(this.trackedEntity.getEntityId(), this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ)); -++++ END PATCH -++++ REJECTED PATCH 2 - playerMP.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.trackedEntity.getEntityId(), potioneffect)); - } - } -+ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(trackedEntity, playerMP); - } - } - else if (this.trackingPlayers.contains(playerMP)) - { - this.trackingPlayers.remove(playerMP); - playerMP.removeEntity(this.trackedEntity); -+ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(trackedEntity, playerMP); - } - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch.rej b/rejects/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch.rej deleted file mode 100644 index baa14587a8..0000000000 --- a/rejects/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch.rej +++ /dev/null @@ -1,13 +0,0 @@ -++++ REJECTED PATCH 1 - BlockPos blockpos = new BlockPos(k1, l1, i2); - Block block = this.worldObj.getBlockState(blockpos).getBlock(); - -- if (block.getMaterial() != Material.air) -+ if (!block.isAir(worldObj, new BlockPos(k1, l1, i2))) - { -- if (block != Blocks.barrier && block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && block != Blocks.command_block && this.worldObj.getGameRules().getBoolean("mobGriefing")) -+ if (block.canEntityDestroy(worldObj, new BlockPos(k1, l1, i2), this) && this.worldObj.getGameRules().getBoolean("mobGriefing")) - { - flag1 = this.worldObj.setBlockToAir(blockpos) || flag1; - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej b/rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej deleted file mode 100644 index a357507d6a..0000000000 --- a/rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - BlockPos blockpos = new BlockPos(i3, k, l); - Block block = this.worldObj.getBlockState(blockpos).getBlock(); - -- if (block.getMaterial() != Material.air && func_181033_a(block)) -+ if (!block.isAir(worldObj,blockpos) && func_181033_a(block) && block.canEntityDestroy(worldObj, blockpos, this)) - { - flag = this.worldObj.destroyBlock(blockpos, true) || flag; - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch.rej b/rejects/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch.rej deleted file mode 100644 index b7bedf878c..0000000000 --- a/rejects/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public interface IBossDisplayData - { - float getMaxHealth(); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch.rej b/rejects/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch.rej deleted file mode 100644 index c29f3c2b53..0000000000 --- a/rejects/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - - public boolean interactFirst(EntityPlayer playerIn) - { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; - if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn) - { - return true; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch.rej b/rejects/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch.rej deleted file mode 100644 index 9128588fdc..0000000000 --- a/rejects/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - - public boolean interactFirst(EntityPlayer playerIn) - { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; - ItemStack itemstack = playerIn.inventory.getCurrentItem(); - - if (itemstack != null && itemstack.getItem() == Items.coal) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej b/rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej deleted file mode 100644 index 2110205143..0000000000 --- a/rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej +++ /dev/null @@ -1,19 +0,0 @@ -++++ REJECTED PATCH 1 - - protected boolean teleportTo(double x, double y, double z) - { -+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, x, y, z, 0); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; - double d0 = this.posX; - double d1 = this.posY; - double d2 = this.posZ; -- this.posX = x; -- this.posY = y; -- this.posZ = z; -+ this.posX = event.targetX; -+ this.posY = event.targetY; -+ this.posZ = event.targetZ; - boolean flag = false; - BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ); - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej b/rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej deleted file mode 100644 index 2d62aecaf8..0000000000 --- a/rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej +++ /dev/null @@ -1,42 +0,0 @@ -++++ REJECTED PATCH 1 - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); -- this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * 0.10000000149011612D); -+ this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance); - } - - protected void entityInit() -++++ END PATCH -++++ REJECTED PATCH 2 - entitylivingbase = (EntityLivingBase)source.getEntity(); - } - -- if (entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) -+ int i = MathHelper.floor_double(this.posX); -+ int j = MathHelper.floor_double(this.posY); -+ int k = MathHelper.floor_double(this.posZ); -+ -+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(reinforcementChance).getAttributeValue()); -+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true; -+ -+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || -+ entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) - { -- int i = MathHelper.floor_double(this.posX); -- int j = MathHelper.floor_double(this.posY); -- int k = MathHelper.floor_double(this.posZ); -- EntityZombie entityzombie = new EntityZombie(this.worldObj); -+ EntityZombie entityzombie; -+ if (summonAid.customSummonedAid != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) -+ { -+ entityzombie = summonAid.customSummonedAid; -+ } -+ else -+ { -+ entityzombie = new EntityZombie(this.worldObj); -+ } - - for (int l = 0; l < 50; ++l) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch.rej b/rejects/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch.rej deleted file mode 100644 index c6f68c40ed..0000000000 --- a/rejects/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch.rej +++ /dev/null @@ -1,19 +0,0 @@ -++++ REJECTED PATCH 2 - this.spawnableBlock = Blocks.mycelium; - } - -+ @SuppressWarnings("unused") - public boolean interact(EntityPlayer player) - { - ItemStack itemstack = player.inventory.getCurrentItem(); -++++ END PATCH -++++ REJECTED PATCH 3 - } - } - -- if (itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) -+ if (false && itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) //Forge Disable, Moved to onSheared - { - this.setDead(); - this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch.rej b/rejects/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch.rej deleted file mode 100644 index c6cc508db6..0000000000 --- a/rejects/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - - Block block = this.worldObj.getBlockState(blockpos.down()).getBlock(); - -- if (block == Blocks.grass || block.getMaterial() == Material.leaves) -+ if (block == Blocks.grass || block.isLeaves(worldObj, blockpos.down())) - { - return true; - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch.rej b/rejects/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch.rej deleted file mode 100644 index cc41f21686..0000000000 --- a/rejects/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch.rej +++ /dev/null @@ -1,15 +0,0 @@ -++++ REJECTED PATCH 2 - } - } - -+ @SuppressWarnings("unused") - public boolean interact(EntityPlayer player) - { - ItemStack itemstack = player.inventory.getCurrentItem(); - -- if (itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) -+ if (false && itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) //Forge: Moved to onSheared - { - if (!this.worldObj.isRemote) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej b/rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej deleted file mode 100644 index a9b8dc6a75..0000000000 --- a/rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - private boolean isLookingForHome; - private boolean areAdditionalTasksSet; - private InventoryBasic villagerInventory; -+ @Deprecated //Use VillagerRegistry - private static final EntityVillager.ITradeList[][][][] DEFAULT_TRADE_LIST_MAP = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.wheat, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.potato, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.carrot, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.bread, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.pumpkin_pie, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.apple, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.cookie, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.cake, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.fish, new EntityVillager.PriceInfo(6, 6), Items.cooked_fish, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.fishing_rod, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.shears, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 0), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.arrow, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.bow, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new EntityVillager.PriceInfo(10, 10), Items.flint, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.paper, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.book, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.compass, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.written_book, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.clock, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.name_tag, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.rotten_flesh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.gold_ingot, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.redstone, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.ender_eye, new EntityVillager.PriceInfo(7, 11)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.experience_bottle, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_helmet, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.iron_chestplate, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_chestplate, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.chainmail_boots, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_leggings, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.chainmail_helmet, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_chestplate, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_axe, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_sword, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_sword, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_axe, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_shovel, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_pickaxe, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.porkchop, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.chicken, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.cooked_porkchop, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.cooked_chicken, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.leather, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.leather_leggings, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.leather_chestplate, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.saddle, new EntityVillager.PriceInfo(8, 10))}}}}; - - public EntityVillager(World worldIn) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch.rej b/rejects/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch.rej deleted file mode 100644 index ccf686cf35..0000000000 --- a/rejects/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch.rej +++ /dev/null @@ -1,228 +0,0 @@ -++++ REJECTED PATCH 1 - @SuppressWarnings("incomplete-switch") - public abstract class EntityPlayer extends EntityLivingBase - { -+ public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; -+ private java.util.HashMap spawnChunkMap = new java.util.HashMap(); -+ private java.util.HashMap spawnForcedMap = new java.util.HashMap(); -+ public float eyeHeight = this.getDefaultEyeHeight(); -+ - public InventoryPlayer inventory = new InventoryPlayer(this); - private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); - public Container inventoryContainer; -++++ END PATCH -++++ REJECTED PATCH 2 - { - if (this.itemInUse != null) - { -- this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); -+ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, itemInUse, this.itemInUseCount)) -+ this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); - } - - this.clearItemInUse(); -++++ END PATCH -++++ REJECTED PATCH 4 - - if (itemstack == this.itemInUse) - { -+ itemInUseCount = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, itemInUse, itemInUseCount); -+ if (itemInUseCount <= 0) -+ { -+ this.onItemUseFinish(); -+ } -+ else -+ { // Forge Keep unindented to lower patch -+ itemInUse.getItem().onUsingTick(itemInUse, this, itemInUseCount); //Forge Added - if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) - { - this.updateItemUse(itemstack, 5); -++++ END PATCH -++++ REJECTED PATCH 8 - int i = this.itemInUse.stackSize; - ItemStack itemstack = this.itemInUse.onItemUseFinish(this.worldObj, this); - -+ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, itemInUse, itemInUseCount, itemstack); - if (itemstack != this.itemInUse || itemstack != null && itemstack.stackSize != i) - { - this.inventory.mainInventory[this.inventory.currentItem] = itemstack; - -- if (itemstack.stackSize == 0) -+ if (itemstack != null && itemstack.stackSize == 0) - { - this.inventory.mainInventory[this.inventory.currentItem] = null; - } -++++ END PATCH -++++ REJECTED PATCH 9 - this.cameraYaw = 0.0F; - this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); - -- if (this.ridingEntity instanceof EntityPig) -+ if (this.ridingEntity instanceof EntityLivingBase && ((EntityLivingBase)ridingEntity).shouldRiderFaceForward(this)) - { - this.rotationPitch = f1; - this.rotationYaw = f; -- this.renderYawOffset = ((EntityPig)this.ridingEntity).renderYawOffset; -+ this.renderYawOffset = ((EntityLivingBase)this.ridingEntity).renderYawOffset; - } - } - } -++++ END PATCH -++++ REJECTED PATCH 14 - f /= 5.0F; - } - -- return f; -+ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos); -+ return (f < 0 ? 0 : f); - } - - public boolean canHarvestBlock(Block blockToHarvest) - { -- return this.inventory.canHeldItemHarvest(blockToHarvest); -+ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, blockToHarvest, this.inventory.canHeldItemHarvest(blockToHarvest)); - } - - public void readEntityFromNBT(NBTTagCompound tagCompund) -++++ END PATCH -++++ REJECTED PATCH 18 - { - if (!this.isEntityInvulnerable(damageSrc)) - { -+ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); -+ if (damageAmount <= 0) return; - if (!damageSrc.isUnblockable() && this.isBlocking() && damageAmount > 0.0F) - { - damageAmount = (1.0F + damageAmount) * 0.5F; - } - -- damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); -+ damageAmount = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, inventory.armorInventory, damageSrc, damageAmount); -+ if (damageAmount <= 0) return; - damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); - float f = damageAmount; - damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); -++++ END PATCH -++++ REJECTED PATCH 19 - } - else - { -+ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, targetEntity)) return false; - ItemStack itemstack = this.getCurrentEquippedItem(); - ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null; - -++++ END PATCH -++++ REJECTED PATCH 20 - - public void destroyCurrentEquippedItem() - { -+ ItemStack orig = getCurrentEquippedItem(); - this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, orig); - } - - public double getYOffset() -++++ END PATCH -++++ REJECTED PATCH 23 - - this.setSize(0.2F, 0.2F); - -- if (this.worldObj.isBlockLoaded(bedLocation)) -+ if (this.worldObj.isBlockLoaded(bedLocation) && worldObj.getBlockState(bedLocation).getBlock().isBed(worldObj, bedLocation, this)) - { -- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(bedLocation).getValue(BlockDirectional.FACING); -+ EnumFacing enumfacing = this.worldObj.getBlockState(bedLocation).getBlock().getBedDirection(worldObj, bedLocation); - float f = 0.5F; - float f1 = 0.5F; - -++++ END PATCH -++++ REJECTED PATCH 27 - } - else - { -- return BlockBed.getSafeExitLocation(worldIn, bedLocation, 0); -+ return worldIn.getBlockState(bedLocation).getBlock().getBedSpawnPosition(worldIn, bedLocation, null); - } - } - - @SideOnly(Side.CLIENT) - public float getBedOrientationInDegrees() - { -- if (this.playerLocation != null) -+ if (this.playerLocation != null && worldObj.getBlockState(playerLocation).getBlock().isBed(worldObj, playerLocation, this)) - { -- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockDirectional.FACING); -+ EnumFacing enumfacing = this.worldObj.getBlockState(this.playerLocation).getBlock().getBedDirection(worldObj, playerLocation); - - switch (enumfacing) - { -++++ END PATCH -++++ REJECTED PATCH 30 - } - - EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entityLivingIn))); -+ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entityLivingIn)); - - if (entitylist$entityegginfo != null) - { -++++ END PATCH -++++ REJECTED PATCH 31 - { - if (stack != this.itemInUse) - { -+ duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, stack, duration); -+ if (duration <= 0) return; - this.itemInUse = stack; - this.itemInUseCount = duration; - -++++ END PATCH -++++ REJECTED PATCH 33 - this.xpSeed = oldPlayer.xpSeed; - this.theInventoryEnderChest = oldPlayer.theInventoryEnderChest; - this.getDataWatcher().updateObject(10, Byte.valueOf(oldPlayer.getDataWatcher().getWatchableObjectByte(10))); -+ -+ this.spawnChunkMap = oldPlayer.spawnChunkMap; -+ this.spawnForcedMap = oldPlayer.spawnForcedMap; -+ -+ //Copy over a section of the Entity Data from the old player. -+ //Allows mods to specify data that persists after players respawn. -+ NBTTagCompound old = oldPlayer.getEntityData(); -+ if (old.hasKey(PERSISTED_NBT_TAG)) -+ { -+ getEntityData().setTag(PERSISTED_NBT_TAG, old.getCompoundTag(PERSISTED_NBT_TAG)); -+ } -+ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, oldPlayer, !respawnFromEnd); - } - - protected boolean canTriggerWalking() -++++ END PATCH -++++ REJECTED PATCH 34 - - public void setCurrentItemOrArmor(int slotIn, ItemStack stack) - { -- this.inventory.armorInventory[slotIn] = stack; -+ if (slotIn == 0) //Forge: Fix issue in Player where it doen't take into account selected item -+ { -+ this.inventory.mainInventory[this.inventory.currentItem] = stack; -+ } -+ else -+ { -+ this.inventory.armorInventory[slotIn - 1] = stack; -+ } - } - - @SideOnly(Side.CLIENT) -++++ END PATCH -++++ REJECTED PATCH 35 - - public IChatComponent getDisplayName() - { -- IChatComponent ichatcomponent = new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName())); -+ IChatComponent ichatcomponent = new ChatComponentText(""); -+ if (!prefixes.isEmpty()) for (net.minecraft.util.IChatComponent prefix : prefixes) ichatcomponent.appendSibling(prefix); -+ ichatcomponent.appendSibling(new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getDisplayNameString()))); -+ if (!suffixes.isEmpty()) for (net.minecraft.util.IChatComponent suffix : suffixes) ichatcomponent.appendSibling(suffix); - ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); - ichatcomponent.getChatStyle().setChatHoverEvent(this.getHoverEvent()); - ichatcomponent.getChatStyle().setInsertion(this.getName()); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej b/rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej deleted file mode 100644 index eece032322..0000000000 --- a/rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej +++ /dev/null @@ -1,55 +0,0 @@ -++++ REJECTED PATCH 1 - public int ping; - public boolean playerConqueredTheEnd; - -+ @SuppressWarnings("unused") - public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager) - { - super(worldIn, profile); - interactionManager.thisPlayerMP = this; - this.theItemInWorldManager = interactionManager; -- BlockPos blockpos = worldIn.getSpawnPoint(); -+ BlockPos blockpos = worldIn.provider.getRandomizedSpawnPoint(); - -- if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) -+ if (false && !worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) - { - int i = Math.max(5, server.getSpawnProtectionSize() - 6); - int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ())); -++++ END PATCH -++++ REJECTED PATCH 3 - for (Chunk chunk1 : list) - { - this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk1); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(chunk1.getChunkCoordIntPair(), this)); - } - } - } -++++ END PATCH -++++ REJECTED PATCH 4 - - public void onDeath(DamageSource cause) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; - if (this.worldObj.getGameRules().getBoolean("showDeathMessages")) - { - Team team = this.getTeam(); -++++ END PATCH -++++ REJECTED PATCH 6 - if (entitylivingbase != null) - { - EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entitylivingbase))); -+ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entitylivingbase)); - - if (entitylist$entityegginfo != null) - { -++++ END PATCH -++++ REJECTED PATCH 7 - - public void travelToDimension(int dimensionId) - { -+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, dimensionId)) return; - if (this.dimension == 1 && dimensionId == 1) - { - this.triggerAchievement(AchievementList.theEnd2); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch.rej b/rejects/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch.rej deleted file mode 100644 index 9fcc96b0eb..0000000000 --- a/rejects/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch.rej +++ /dev/null @@ -1,16 +0,0 @@ -++++ REJECTED PATCH 1 - { - if (this.mainInventory[j] == null) - { -- this.mainInventory[j] = new ItemStack(item, 0, itemStackIn.getMetadata()); -- -- if (itemStackIn.hasTagCompound()) -- { -- this.mainInventory[j].setTagCompound((NBTTagCompound)itemStackIn.getTagCompound().copy()); -- } -+ this.mainInventory[j] = itemStackIn.copy(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up. -+ this.mainInventory[j].stackSize = 0; - } - - int k = i; -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index 378a5106dc..7bd4d80b96 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -21,7 +21,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.DamageSource; 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.util.text.ITextComponent; import net.minecraft.world.Explosion; import net.minecraft.world.World; import net.minecraft.world.WorldServer; @@ -42,6 +45,7 @@ import net.minecraftforge.event.entity.EntityMountEvent; import net.minecraftforge.event.entity.EntityStruckByLightningEvent; import net.minecraftforge.event.entity.PlaySoundAtEntityEvent; import net.minecraftforge.event.entity.item.ItemExpireEvent; +import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent; import net.minecraftforge.event.entity.living.LivingExperienceDropEvent; import net.minecraftforge.event.entity.living.LivingHealEvent; import net.minecraftforge.event.entity.living.LivingPackSizeEvent; @@ -61,7 +65,6 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; import net.minecraftforge.event.entity.player.PlayerSetSpawnEvent; import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; -import net.minecraftforge.event.entity.player.PlayerUseItemEvent; import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; import net.minecraftforge.event.entity.player.SleepingLocationCheckEvent; import net.minecraftforge.event.entity.player.UseHoeEvent; @@ -102,11 +105,11 @@ public class ForgeEventFactory return event; } - public static boolean doPlayerHarvestCheck(EntityPlayer player, Block block, boolean success) + public static boolean doPlayerHarvestCheck(EntityPlayer player, IBlockState state, boolean success) { - PlayerEvent.HarvestCheck event = new PlayerEvent.HarvestCheck(player, block, success); + PlayerEvent.HarvestCheck event = new PlayerEvent.HarvestCheck(player, state, success); MinecraftForge.EVENT_BUS.post(event); - return event.success; + return event.canHarvest(); } public static float getBreakSpeed(EntityPlayer player, IBlockState state, float original, BlockPos pos) @@ -128,9 +131,9 @@ public class ForgeEventFactory return event; } - public static void onPlayerDestroyItem(EntityPlayer player, ItemStack stack) + public static void onPlayerDestroyItem(EntityPlayer player, ItemStack stack, EnumHand hand) { - MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, stack)); + MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, stack, hand)); } public static Result canEntitySpawn(EntityLiving entity, World world, float x, float y, float z) @@ -212,26 +215,26 @@ public class ForgeEventFactory return MinecraftForge.EVENT_BUS.post(new EntityStruckByLightningEvent(entity, bolt)); } - public static int onItemUseStart(EntityPlayer player, ItemStack item, int duration) + public static int onItemUseStart(EntityLivingBase entity, ItemStack item, int duration) { - PlayerUseItemEvent event = new PlayerUseItemEvent.Start(player, item, duration); + LivingEntityUseItemEvent event = new LivingEntityUseItemEvent.Start(entity, item, duration); return MinecraftForge.EVENT_BUS.post(event) ? -1 : event.duration; } - public static int onItemUseTick(EntityPlayer player, ItemStack item, int duration) + public static int onItemUseTick(EntityLivingBase entity, ItemStack item, int duration) { - PlayerUseItemEvent event = new PlayerUseItemEvent.Tick(player, item, duration); + LivingEntityUseItemEvent event = new LivingEntityUseItemEvent.Tick(entity, item, duration); return MinecraftForge.EVENT_BUS.post(event) ? -1 : event.duration; } - public static boolean onUseItemStop(EntityPlayer player, ItemStack item, int duration) + public static boolean onUseItemStop(EntityLivingBase entity, ItemStack item, int duration) { - return MinecraftForge.EVENT_BUS.post(new PlayerUseItemEvent.Stop(player, item, duration)); + return MinecraftForge.EVENT_BUS.post(new LivingEntityUseItemEvent.Stop(entity, item, duration)); } - public static ItemStack onItemUseFinish(EntityPlayer player, ItemStack item, int duration, ItemStack result) + public static ItemStack onItemUseFinish(EntityLivingBase entity, ItemStack item, int duration, ItemStack result) { - PlayerUseItemEvent.Finish event = new PlayerUseItemEvent.Finish(player, item, duration, result); + LivingEntityUseItemEvent.Finish event = new LivingEntityUseItemEvent.Finish(entity, item, duration, result); MinecraftForge.EVENT_BUS.post(event); return event.result; } @@ -294,7 +297,7 @@ public class ForgeEventFactory return 0; } - public static ItemStack onBucketUse(EntityPlayer player, World world, ItemStack stack, MovingObjectPosition target) + public static ItemStack onBucketUse(EntityPlayer player, World world, ItemStack stack, RayTraceResult target) { FillBucketEvent event = new FillBucketEvent(player, stack, world, target); if (MinecraftForge.EVENT_BUS.post(event)) return stack; @@ -305,10 +308,10 @@ public class ForgeEventFactory return stack; if (--stack.stackSize <= 0) - return event.result; + return event.getFilledBucket(); - if (!player.inventory.addItemStackToInventory(event.result)) - player.dropPlayerItemWithRandomChoice(event.result, false); + if (!player.inventory.addItemStackToInventory(event.getFilledBucket())) + player.dropPlayerItemWithRandomChoice(event.getFilledBucket(), false); return stack; } @@ -367,9 +370,9 @@ public class ForgeEventFactory } } - public static boolean canInteractWith(EntityPlayer player, Entity entity) + public static boolean canInteractWith(EntityPlayer player, Entity entity, ItemStack item, EnumHand hand) { - return !MinecraftForge.EVENT_BUS.post(new EntityInteractEvent(player, entity)); + return !MinecraftForge.EVENT_BUS.post(new EntityInteractEvent(player, entity, item, hand)); } public static boolean canMountEntity(Entity entityMounting, Entity entityBeingMounted, boolean isMounting) diff --git a/src/main/java/net/minecraftforge/event/ServerChatEvent.java b/src/main/java/net/minecraftforge/event/ServerChatEvent.java index 71e615573c..af326955c7 100644 --- a/src/main/java/net/minecraftforge/event/ServerChatEvent.java +++ b/src/main/java/net/minecraftforge/event/ServerChatEvent.java @@ -3,7 +3,6 @@ package net.minecraftforge.event; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.text.ITextComponent; /** @@ -26,11 +25,10 @@ import net.minecraft.util.text.ITextComponent; @Cancelable public class ServerChatEvent extends Event { - public final String message, username; - public final EntityPlayerMP player; - @Deprecated //Use methods below - public ChatComponentTranslation component; - public ServerChatEvent(EntityPlayerMP player, String message, ChatComponentTranslation component) + private final String message, username; + private final EntityPlayerMP player; + private ITextComponent component; + public ServerChatEvent(EntityPlayerMP player, String message, ITextComponent component) { super(); this.message = message; @@ -41,14 +39,15 @@ public class ServerChatEvent extends Event public void setComponent(ITextComponent e) { - if (e instanceof ChatComponentTranslation) - this.component = (ChatComponentTranslation)e; - else - this.component = new ChatComponentTranslation("%s", e); + this.component = e; } public ITextComponent getComponent() { return this.component; } + + public String getMessage() { return this.message; } + public String getUsername() { return this.username; } + public EntityPlayerMP getPlayer() { return this.player; } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerUseItemEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingEntityUseItemEvent.java similarity index 65% rename from src/main/java/net/minecraftforge/event/entity/player/PlayerUseItemEvent.java rename to src/main/java/net/minecraftforge/event/entity/living/LivingEntityUseItemEvent.java index 2387de5d7f..735ade5d2e 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerUseItemEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingEntityUseItemEvent.java @@ -1,17 +1,18 @@ -package net.minecraftforge.event.entity.player; +package net.minecraftforge.event.entity.living; import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -public abstract class PlayerUseItemEvent extends PlayerEvent +public abstract class LivingEntityUseItemEvent extends LivingEvent { public final ItemStack item; public int duration; - private PlayerUseItemEvent(EntityPlayer player, ItemStack item, int duration) + private LivingEntityUseItemEvent(EntityLivingBase entity, ItemStack item, int duration) { - super(player); + super(entity); this.item = item; this.duration = duration; } @@ -28,11 +29,11 @@ public abstract class PlayerUseItemEvent extends PlayerEvent * */ @Cancelable - public static class Start extends PlayerUseItemEvent + public static class Start extends LivingEntityUseItemEvent { - public Start(EntityPlayer player, ItemStack item, int duration) + public Start(EntityLivingBase entity, ItemStack item, int duration) { - super(player, item, duration); + super(entity, item, duration); } } @@ -43,32 +44,32 @@ public abstract class PlayerUseItemEvent extends PlayerEvent * */ @Cancelable - public static class Tick extends PlayerUseItemEvent + public static class Tick extends LivingEntityUseItemEvent { - public Tick(EntityPlayer player, ItemStack item, int duration) + public Tick(EntityLivingBase entity, ItemStack item, int duration) { - super(player, item, duration); + super(entity, item, duration); } } /** - * Fired when a player stops using an item without the use duration timing out. + * Fired when a player stops using an item without the use duration timing out. * Example: * Stop eating 1/2 way through * Stop defending with sword * Stop drawing bow. This case would fire the arrow - * + * * Duration on this event is how long the item had left in it's count down before 'finishing' * - * Canceling this event will prevent the Item from being notified that it has stopped being used, + * Canceling this event will prevent the Item from being notified that it has stopped being used, * The only vanilla item this would effect are bows, and it would cause them NOT to fire there arrow. */ @Cancelable - public static class Stop extends PlayerUseItemEvent + public static class Stop extends LivingEntityUseItemEvent { - public Stop(EntityPlayer player, ItemStack item, int duration) + public Stop(EntityLivingBase entity, ItemStack item, int duration) { - super(player, item, duration); + super(entity, item, duration); } } @@ -76,18 +77,18 @@ public abstract class PlayerUseItemEvent extends PlayerEvent * Fired after an item has fully finished being used. * The item has been notified that it was used, and the item/result stacks reflect after that state. * This means that when this is fired for a Potion, the potion effect has already been applied. - * + * * If you wish to cancel those effects, you should cancel one of the above events. - * + * * The result item stack is the stack that is placed in the player's inventory in replacement of the stack that is currently being used. * */ - public static class Finish extends PlayerUseItemEvent + public static class Finish extends LivingEntityUseItemEvent { public ItemStack result; - public Finish(EntityPlayer player, ItemStack item, int duration, ItemStack result) + public Finish(EntityLivingBase entity, ItemStack item, int duration, ItemStack result) { - super(player, item, duration); + super(entity, item, duration); this.result = result; } } diff --git a/src/main/java/net/minecraftforge/event/entity/minecart/MinecartInteractEvent.java b/src/main/java/net/minecraftforge/event/entity/minecart/MinecartInteractEvent.java index ea56b9964a..819cb7823b 100644 --- a/src/main/java/net/minecraftforge/event/entity/minecart/MinecartInteractEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/minecart/MinecartInteractEvent.java @@ -3,11 +3,13 @@ package net.minecraftforge.event.entity.minecart; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.item.EntityMinecart; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumHand; /** * MinecartInteractEvent is fired when a player interacts with a minecart.
* This event is fired whenever a player interacts with a minecart in - * EntityMinecartContainer#interactFirst(EntityPlayer), + * EntityMinecartContainer#interactFirst(EntityPlayer), * EntityMinecartEmpty#interactFirst(EntityPlayer) * EntityMinecartFurnace#interactFirst(EntityPlayer) * EntityMinecartHopper#interactFirst(EntityPlayer).
@@ -24,11 +26,19 @@ import net.minecraft.entity.player.EntityPlayer; @Cancelable public class MinecartInteractEvent extends MinecartEvent { - public final EntityPlayer player; + private final EntityPlayer player; + private final ItemStack item; + private final EnumHand hand; - public MinecartInteractEvent(EntityMinecart minecart, EntityPlayer player) + public MinecartInteractEvent(EntityMinecart minecart, EntityPlayer player, ItemStack item, EnumHand hand) { super(minecart); this.player = player; + this.item = item; + this.hand = hand; } + + public EntityPlayer getPlayer() { return player; } + public ItemStack getItem() { return item; } + public EnumHand getHand() { return hand; } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/EntityInteractEvent.java b/src/main/java/net/minecraftforge/event/entity/player/EntityInteractEvent.java index 0a4bcf42d9..ce817b0034 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/EntityInteractEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/EntityInteractEvent.java @@ -4,6 +4,8 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event.HasResult; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumHand; /** * EntityInteractEvent is fired when a player interacts with an Entity.
@@ -22,10 +24,18 @@ import net.minecraft.entity.player.EntityPlayer; @Cancelable public class EntityInteractEvent extends PlayerEvent { - public final Entity target; - public EntityInteractEvent(EntityPlayer player, Entity target) + private final Entity target; + private final ItemStack item; + private final EnumHand hand; + public EntityInteractEvent(EntityPlayer player, Entity target, ItemStack item, EnumHand hand) { super(player); this.target = target; + this.item = item; + this.hand = hand; } + + public Entity getTarget() { return this.target; } + public ItemStack getItem() { return this.item; } + public EnumHand getHand() { return this.hand; } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java b/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java index 5e1f71ab5c..faf549d85b 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java @@ -4,7 +4,7 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; 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; @Cancelable @@ -12,26 +12,32 @@ import net.minecraft.world.World; public class FillBucketEvent extends PlayerEvent { /** - * This event is fired when a player attempts to use a Empty bucket, it + * This event is fired when a player attempts to use a Empty bucket, it * can be canceled to completely prevent any further processing. - * - * If you set the result to 'ALLOW', it means that you have processed - * the event and wants the basic functionality of adding the new + * + * If you set the result to 'ALLOW', it means that you have processed + * the event and wants the basic functionality of adding the new * ItemStack to your inventory and reducing the stack size to process. * setResult(ALLOW) is the same as the old setHandeled(); */ - public final ItemStack current; - public final World world; - public final MovingObjectPosition target; + private final ItemStack current; + private final World world; + private final RayTraceResult target; - public ItemStack result; + private ItemStack result; - public FillBucketEvent(EntityPlayer player, ItemStack current, World world, MovingObjectPosition target) + public FillBucketEvent(EntityPlayer player, ItemStack current, World world, RayTraceResult target) { super(player); this.current = current; this.world = world; this.target = target; } + + public ItemStack getEmptyBucket() { return this.current; } + public World getWorld(){ return this.world; } + public RayTraceResult getTarget() { return this.target; } + public ItemStack getFilledBucket() { return this.result; } + public void setFilledBucket(ItemStack bucket) { this.result = bucket; } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java index e8d7a20c12..65fe0a1663 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java @@ -3,6 +3,7 @@ package net.minecraftforge.event.entity.player; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumHand; /** * PlayerDestroyItemEvent is fired when a player destroys an item.
@@ -15,6 +16,7 @@ import net.minecraft.item.ItemStack; * and ItemInWorldManager#activateBlockOrUseItem(EntityPlayer, World, ItemStack, int, int, int, int, float, float, float).
*
* {@link #original} contains the original ItemStack before the item was destroyed.
+ * (@link #hand) contains the hand that the current item was held in.
*
* This event is not {@link Cancelable}.
*
@@ -24,11 +26,16 @@ import net.minecraft.item.ItemStack; **/ public class PlayerDestroyItemEvent extends PlayerEvent { - public final ItemStack original; - public PlayerDestroyItemEvent(EntityPlayer player, ItemStack original) + private final ItemStack original; + private final EnumHand hand; + public PlayerDestroyItemEvent(EntityPlayer player, ItemStack original, EnumHand hand) { super(player); this.original = original; + this.hand = hand; } + public ItemStack getOriginal() { return this.original; } + public EnumHand getHand() { return this.hand; } + } diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java index 6b8ee48e7b..f460b1d165 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java @@ -43,15 +43,19 @@ public class PlayerEvent extends LivingEvent **/ public static class HarvestCheck extends PlayerEvent { - public final Block block; - public boolean success; + private final IBlockState state; + private boolean success; - public HarvestCheck(EntityPlayer player, Block block, boolean success) + public HarvestCheck(EntityPlayer player, IBlockState state, boolean success) { super(player); - this.block = block; + this.state = state; this.success = success; } + + public IBlockState getTargetBlock() { return this.state; } + public boolean canHarvest() { return this.success; } + public void setCanHarvest(boolean success){ this.success = success; } } /** diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java b/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java index 9080d6dae2..75bd31edf6 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java @@ -321,12 +321,6 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return true; } - @Override - public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockState state) - { - return null; - } - @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java index bc1178dd67..a19c46187c 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java @@ -14,7 +14,7 @@ import net.minecraft.entity.DataWatcher; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.network.PacketBuffer; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.MathHelper; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.common.network.ByteBufUtils; @@ -110,12 +110,12 @@ public abstract class FMLMessage { } public static class EntityAdjustMessage extends EntityMessage { - int serverX; - int serverY; - int serverZ; + long serverX; + long serverY; + long serverZ; public EntityAdjustMessage() {} - public EntityAdjustMessage(Entity entity, int serverX, int serverY, int serverZ) + public EntityAdjustMessage(Entity entity, long serverX, long serverY, long serverZ) { super(entity); this.serverX = serverX; @@ -127,9 +127,9 @@ public abstract class FMLMessage { void toBytes(ByteBuf buf) { super.toBytes(buf); - buf.writeInt(serverX); - buf.writeInt(serverY); - buf.writeInt(serverZ); + buf.writeLong(serverX); + buf.writeLong(serverY); + buf.writeLong(serverZ); } @Override diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java index 6afdf342b7..2bbafe3642 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java @@ -109,7 +109,7 @@ public class FMLNetworkHandler } - public static void makeEntitySpawnAdjustment(Entity entity, EntityPlayerMP player, int serverX, int serverY, int serverZ) + public static void makeEntitySpawnAdjustment(Entity entity, EntityPlayerMP player, long serverX, long serverY, long serverZ) { EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER); embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.PLAYER); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java index 939ef706fa..7a6506ca03 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java @@ -118,8 +118,6 @@ public class EntityRegistry private ListMultimap entityRegistrations = ArrayListMultimap.create(); private Map entityNames = Maps.newHashMap(); private BiMap, EntityRegistration> entityClassRegistrations = HashBiMap.create(); - private Map entityEggs = Maps.newHashMap(); - private Map entityEggsUn = Collections.unmodifiableMap(entityEggs); public static EntityRegistry instance() { @@ -200,40 +198,6 @@ public class EntityRegistry entityRegistrations.put(mc, er); } - /** - * Registers a spawn egg for the specified entity class. - * The class must already be registered in the EntityList.classToStringMapping. - * This can be done either by using the global ID system, or preferably the registerModEntity functions above. - * Once registered mob eggs can be created by using minecraft:spawn_egg with NBT entry 'entity_name' with - * value of the name this class is registered in the classToStringMapping with. - * - * @param entityClass The entity class - * @param primary Primary egg color - * @param secondary Secondary egg color - * - * @throws IllegalArgumentException if entityClass is not registered in classToStringMapping. - * - */ - public static void registerEgg(Class entityClass, int primary, int secondary) - { - if (!EntityList.classToStringMapping.containsKey(entityClass)) - throw new IllegalArgumentException("Entity not registered in classToString map: " + entityClass); - - String name = (String)EntityList.classToStringMapping.get(entityClass); - EntityRegistry.instance().entityEggs.put(name, new EntityList.EntityEggInfo(name, primary, secondary)); - FMLLog.fine("Registering entity egg '%s' for %s", name, entityClass); - } - - /** - * Returns a Unmodifiable view of the registered entity eggs list. - * - * @return An Unmodifiable view of the registered entity eggs list. - */ - public static Map getEggs() - { - return instance().entityEggsUn; - } - /** * Registers in the minecraft Entity ID list. This is generally not a good idea and shouldn't be used. * Simply use {@link #registerModEntity(Class, String, int, Object, int, int, boolean, int, int)} instead. diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index d2385f314f..22b66734c8 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -21,8 +21,8 @@ import org.apache.commons.lang3.Validate; import org.apache.logging.log4j.Level; import net.minecraft.util.ObjectIntIdentityMap; -import net.minecraft.util.RegistryNamespacedDefaultedByKey; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.RegistryNamespacedDefaultedByKey; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.functions.GenericIterableFactory; import net.minecraftforge.fml.common.registry.RegistryDelegate.Delegate; diff --git a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java index 7eef45e0be..577edc2652 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java @@ -431,11 +431,10 @@ public class VillagerRegistry }, { new ListItemForEmeralds(Items.redstone, new PriceInfo(-4, -1)), - new ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), - new PriceInfo(-2, -1)) + new ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new PriceInfo(-2, -1)) }, { - new ListItemForEmeralds(Items.ender_eye, new PriceInfo(7, 11)), + new ListItemForEmeralds(Items.ender_pearl, new PriceInfo(4, 7)), new ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new PriceInfo(-3, -1)) }, { diff --git a/src/main/java/net/minecraftforge/server/command/ForgeCommand.java b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java index 39556c8597..bd2b2eb3c2 100644 --- a/src/main/java/net/minecraftforge/server/command/ForgeCommand.java +++ b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java @@ -10,7 +10,7 @@ import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.server.ForgeTimeTracker; @@ -113,7 +113,7 @@ public class ForgeCommand extends CommandBase { { ForgeTimeTracker.tileEntityTrackingDuration = duration; ForgeTimeTracker.tileEntityTracking = true; - sender.addChatMessage(new ChatComponentTranslation("commands.forge.tracking.te.enabled", duration)); + sender.addChatMessage(new TextComponentTranslation("commands.forge.tracking.te.enabled", duration)); } private void doTPSLog(ICommandSender sender, String[] args) @@ -136,17 +136,17 @@ public class ForgeCommand extends CommandBase { { double worldTickTime = ForgeCommand.mean(this.getServer().worldTickTimes.get(dimId)) * 1.0E-6D; double worldTPS = Math.min(1000.0/worldTickTime, 20); - sender.addChatMessage(new ChatComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dimId), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS))); + sender.addChatMessage(new TextComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dimId), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS))); } double meanTickTime = ForgeCommand.mean(this.getServer().tickTimeArray) * 1.0E-6D; double meanTPS = Math.min(1000.0/meanTickTime, 20); - sender.addChatMessage(new ChatComponentTranslation("commands.forge.tps.summary","Overall", timeFormatter.format(meanTickTime), timeFormatter.format(meanTPS))); + sender.addChatMessage(new TextComponentTranslation("commands.forge.tps.summary","Overall", timeFormatter.format(meanTickTime), timeFormatter.format(meanTPS))); } else { double worldTickTime = ForgeCommand.mean(this.getServer().worldTickTimes.get(dim)) * 1.0E-6D; double worldTPS = Math.min(1000.0/worldTickTime, 20); - sender.addChatMessage(new ChatComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dim), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS))); + sender.addChatMessage(new TextComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dim), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS))); } } From 8fe432230da486f510a7c79af95440a8492fbc3e Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Tue, 1 Mar 2016 23:04:07 -0800 Subject: [PATCH 016/243] Fix broken patches for EntityMinecart --- .../entity/item/EntityMinecart.java.patch | 272 +++++++++++++++++- 1 file changed, 271 insertions(+), 1 deletion(-) diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch index 4a0a53dd36..1e93f3997c 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -152,7 +152,15 @@ { double d17 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); -@@ -574,8 +605,14 @@ +@@ -526,6 +557,7 @@ + this.setPosition(this.posX, this.posY, this.posZ); + double d22 = this.motionX; + double d23 = this.motionZ; ++ this.moveMinecartOnRail(p_180460_1_); + + if (this.func_184207_aI()) + { +@@ -574,8 +606,14 @@ this.motionZ = d5 * (double)(i - p_180460_1_.getZ()); } @@ -168,3 +176,265 @@ double d15 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); if (d15 > 0.01D) +@@ -795,13 +833,19 @@ + + public void applyEntityCollision(Entity entityIn) + { ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, entityIn)); ++ if (getCollisionHandler() != null) ++ { ++ getCollisionHandler().onEntityCollision(this, entityIn); ++ return; ++ } + if (!this.worldObj.isRemote) + { + if (!entityIn.noClip && !this.noClip) + { + if (!this.func_184196_w(entityIn)) + { +- if (entityIn instanceof EntityLivingBase && this.func_184264_v() == EntityMinecart.Type.RIDEABLE && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && !this.func_184207_aI() && !entityIn.func_184218_aH()) ++ if (entityIn instanceof EntityLivingBase && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && !this.func_184207_aI() && !entityIn.func_184218_aH()) + { + entityIn.func_184220_m(this); + } +@@ -847,7 +891,7 @@ + double d7 = entityIn.motionX + this.motionX; + double d8 = entityIn.motionZ + this.motionZ; + +- if (((EntityMinecart)entityIn).func_184264_v() == EntityMinecart.Type.FURNACE && this.func_184264_v() != EntityMinecart.Type.FURNACE) ++ if (((EntityMinecart)entityIn).isPoweredCart() && !isPoweredCart()) + { + this.motionX *= 0.20000000298023224D; + this.motionZ *= 0.20000000298023224D; +@@ -855,7 +899,7 @@ + entityIn.motionX *= 0.949999988079071D; + entityIn.motionZ *= 0.949999988079071D; + } +- else if (((EntityMinecart)entityIn).func_184264_v() != EntityMinecart.Type.FURNACE && this.func_184264_v() == EntityMinecart.Type.FURNACE) ++ else if (!((EntityMinecart)entityIn).isPoweredCart() && isPoweredCart()) + { + entityIn.motionX *= 0.20000000298023224D; + entityIn.motionZ *= 0.20000000298023224D; +@@ -981,7 +1025,222 @@ + { + this.func_184212_Q().func_187227_b(field_184270_f, Boolean.valueOf(p_94096_1_)); + } ++ ++ /* =================================== FORGE START ===========================================*/ ++ private BlockPos getCurrentRailPosition() ++ { ++ int x = MathHelper.floor_double(this.posX); ++ int y = MathHelper.floor_double(this.posY); ++ int z = MathHelper.floor_double(this.posZ); + ++ if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(x, y - 1, z))) y--; ++ return new BlockPos(x, y, z); ++ } ++ ++ protected double getMaxSpeed() ++ { ++ if (!canUseRail()) return getMaximumSpeed(); ++ BlockPos pos = this.getCurrentRailPosition(); ++ IBlockState state = this.worldObj.getBlockState(pos); ++ if (!BlockRailBase.isRailBlock(state)) return getMaximumSpeed(); ++ ++ float railMaxSpeed = ((BlockRailBase)state.getBlock()).getRailMaxSpeed(worldObj, this, pos); ++ return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); ++ } ++ ++ /** ++ * Moved to allow overrides. ++ * This code handles minecart movement and speed capping when on a rail. ++ */ ++ public void moveMinecartOnRail(BlockPos pos) ++ { ++ double mX = this.motionX; ++ double mZ = this.motionZ; ++ ++ if (this.riddenByEntity != null) ++ { ++ mX *= 0.75D; ++ mZ *= 0.75D; ++ } ++ ++ double max = this.getMaxSpeed(); ++ mX = MathHelper.clamp_double(mX, -max, max); ++ mZ = MathHelper.clamp_double(mZ, -max, max); ++ this.moveEntity(mX, 0.0D, mZ); ++ } ++ ++ /** ++ * Gets the current global Minecart Collision handler if none ++ * is registered, returns null ++ * @return The collision handler or null ++ */ ++ public static net.minecraftforge.common.IMinecartCollisionHandler getCollisionHandler() ++ { ++ return collisionHandler; ++ } ++ ++ /** ++ * Sets the global Minecart Collision handler, overwrites any ++ * that is currently set. ++ * @param handler The new handler ++ */ ++ public static void setCollisionHandler(net.minecraftforge.common.IMinecartCollisionHandler handler) ++ { ++ collisionHandler = handler; ++ } ++ ++ /** ++ * This function returns an ItemStack that represents this cart. ++ * This should be an ItemStack that can be used by the player to place the cart, ++ * but is not necessary the item the cart drops when destroyed. ++ * @return An ItemStack that can be used to place the cart. ++ */ ++ public ItemStack getCartItem() ++ { ++ if (this instanceof EntityMinecartFurnace) ++ { ++ return new ItemStack(Items.furnace_minecart); ++ } ++ else if (this instanceof EntityMinecartChest) ++ { ++ return new ItemStack(Items.chest_minecart); ++ } ++ else if (this instanceof EntityMinecartTNT) ++ { ++ return new ItemStack(Items.tnt_minecart); ++ } ++ else if (this instanceof EntityMinecartHopper) ++ { ++ return new ItemStack(Items.hopper_minecart); ++ } ++ else if (this instanceof EntityMinecartCommandBlock) ++ { ++ return new ItemStack(Items.command_block_minecart); ++ } ++ return new ItemStack(Items.minecart); ++ } ++ ++ /** ++ * Returns true if this cart can currently use rails. ++ * This function is mainly used to gracefully detach a minecart from a rail. ++ * @return True if the minecart can use rails. ++ */ ++ public boolean canUseRail() ++ { ++ return canUseRail; ++ } ++ ++ /** ++ * Set whether the minecart can use rails. ++ * This function is mainly used to gracefully detach a minecart from a rail. ++ * @param use Whether the minecart can currently use rails. ++ */ ++ public void setCanUseRail(boolean use) ++ { ++ canUseRail = use; ++ } ++ ++ /** ++ * Return false if this cart should not call onMinecartPass() and should ignore Powered Rails. ++ * @return True if this cart should call onMinecartPass(). ++ */ ++ public boolean shouldDoRailFunctions() ++ { ++ return true; ++ } ++ ++ /** ++ * Returns true if this cart is self propelled. ++ * @return True if powered. ++ */ ++ public boolean isPoweredCart() ++ { ++ return getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE; ++ } ++ ++ /** ++ * Returns true if this cart can be ridden by an Entity. ++ * @return True if this cart can be ridden. ++ */ ++ public boolean canBeRidden() ++ { ++ return this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE; ++ } ++ ++ /** ++ * Getters/setters for physics variables ++ */ ++ ++ /** ++ * Returns the carts max speed when traveling on rails. Carts going faster ++ * than 1.1 cause issues with chunk loading. Carts cant traverse slopes or ++ * corners at greater than 0.5 - 0.6. This value is compared with the rails ++ * max speed and the carts current speed cap to determine the carts current ++ * max speed. A normal rail's max speed is 0.4. ++ * ++ * @return Carts max speed. ++ */ ++ public float getMaxCartSpeedOnRail() ++ { ++ return 1.2f; ++ } ++ ++ /** ++ * Returns the current speed cap for the cart when traveling on rails. This ++ * functions differs from getMaxCartSpeedOnRail() in that it controls ++ * current movement and cannot be overridden. The value however can never be ++ * higher than getMaxCartSpeedOnRail(). ++ * ++ * @return ++ */ ++ public final float getCurrentCartSpeedCapOnRail() ++ { ++ return currentSpeedRail; ++ } ++ ++ public final void setCurrentCartSpeedCapOnRail(float value) ++ { ++ value = Math.min(value, getMaxCartSpeedOnRail()); ++ currentSpeedRail = value; ++ } ++ ++ public float getMaxSpeedAirLateral() ++ { ++ return maxSpeedAirLateral; ++ } ++ ++ public void setMaxSpeedAirLateral(float value) ++ { ++ maxSpeedAirLateral = value; ++ } ++ ++ public float getMaxSpeedAirVertical() ++ { ++ return maxSpeedAirVertical; ++ } ++ ++ public void setMaxSpeedAirVertical(float value) ++ { ++ maxSpeedAirVertical = value; ++ } ++ ++ public double getDragAir() ++ { ++ return dragAir; ++ } ++ ++ public void setDragAir(double value) ++ { ++ dragAir = value; ++ } ++ ++ public double getSlopeAdjustment() ++ { ++ return 0.0078125D; ++ } ++ ++ /* =================================== FORGE END ===========================================*/ ++ + public static enum Type + { + RIDEABLE(0, "MinecartRideable"), From 8863aab9e52683552d0bb1fedd3a641089ecb7cc Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 1 Mar 2016 23:38:31 -0800 Subject: [PATCH 017/243] Items done, <1000 errors whoot! --- .../multiplayer/PlayerControllerMP.java.patch | 8 +- .../net/minecraft/item/Item.java.patch | 705 ++++++++++++++++- .../net/minecraft/item/ItemArmor.java.patch | 11 +- .../net/minecraft/item/ItemBlock.java.patch | 22 +- .../net/minecraft/item/ItemBow.java.patch | 31 + .../net/minecraft/item/ItemBucket.java.patch | 11 + .../minecraft/item/ItemEmptyMap.java.patch | 11 + .../item/ItemFlintAndSteel.java.patch | 11 + .../net/minecraft/item/ItemHoe.java.patch | 17 + .../net/minecraft/item/ItemLilyPad.java.patch | 14 +- .../net/minecraft/item/ItemMap.java.patch | 9 +- .../item/ItemMonsterPlacer.java.patch | 39 +- .../minecraft/item/ItemSeedFood.java.patch | 12 +- .../net/minecraft/item/ItemSeeds.java.patch | 12 +- .../net/minecraft/item/ItemShears.java.patch | 27 +- .../net/minecraft/item/ItemSkull.java.patch | 22 + .../net/minecraft/item/ItemStack.java.patch | 92 ++- .../network/NetHandlerPlayServer.java.patch | 48 +- .../world/storage/MapData.java.patch | 9 + .../net/minecraft/item/Item.java.patch.rej | 735 ------------------ .../minecraft/item/ItemArmor.java.patch.rej | 31 - .../minecraft/item/ItemBlock.java.patch.rej | 19 - .../net/minecraft/item/ItemBow.java.patch.rej | 22 - .../minecraft/item/ItemBucket.java.patch.rej | 11 - .../net/minecraft/item/ItemDye.java.patch.rej | 10 - .../item/ItemEmptyMap.java.patch.rej | 10 - .../item/ItemFlintAndSteel.java.patch.rej | 10 - .../net/minecraft/item/ItemHoe.java.patch.rej | 16 - .../item/ItemMonsterPlacer.java.patch.rej | 88 --- .../item/ItemSeedFood.java.patch.rej | 10 - .../minecraft/item/ItemSeeds.java.patch.rej | 10 - .../minecraft/item/ItemShears.java.patch.rej | 16 - .../minecraft/item/ItemSkull.java.patch.rej | 32 - .../minecraft/item/ItemStack.java.patch.rej | 101 --- .../NetHandlerPlayServer.java.patch.rej | 129 --- .../server/S00PacketServerInfo.java.patch.rej | 10 - .../net/minecraftforge/common/ForgeHooks.java | 24 +- .../event/ForgeEventFactory.java | 31 +- .../event/entity/player/ArrowLooseEvent.java | 18 +- .../event/entity/player/ArrowNockEvent.java | 40 +- 40 files changed, 1136 insertions(+), 1348 deletions(-) create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch rename rejects/minecraft/net/minecraft/item/ItemLilyPad.java.patch.rej => patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch (57%) rename rejects/minecraft/net/minecraft/item/ItemMap.java.patch.rej => patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch (50%) create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch delete mode 100644 rejects/minecraft/net/minecraft/item/Item.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemArmor.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemBucket.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemDye.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemEmptyMap.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemHoe.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemSeedFood.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemSeeds.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemShears.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemSkull.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index 07a51f59fa..84c1d4b583 100644 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -19,8 +19,12 @@ return flag; } } -@@ -456,6 +463,7 @@ - if (itemstack.stackSize == 0) +@@ -453,9 +460,10 @@ + { + p_187101_1_.func_184611_a(p_187101_4_, itemstack); + +- if (itemstack.stackSize == 0) ++ if (itemstack.stackSize <= 0) { p_187101_1_.func_184611_a(p_187101_4_, (ItemStack)null); + net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187101_1_, itemstack, p_187101_4_); diff --git a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch index 39507cbe8b..342392b077 100644 --- a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch @@ -1,5 +1,16 @@ --- ../src-base/minecraft/net/minecraft/item/Item.java +++ ../src-work/minecraft/net/minecraft/item/Item.java +@@ -58,8 +58,8 @@ + + public class Item + { +- public static final RegistryNamespaced itemRegistry = new RegistryNamespaced(); +- private static final Map BLOCK_TO_ITEM = Maps.newHashMap(); ++ public static final RegistryNamespaced itemRegistry = net.minecraftforge.fml.common.registry.GameData.getItemRegistry();; ++ private static final Map BLOCK_TO_ITEM = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap(); + private static final IItemPropertyGetter field_185046_b = new IItemPropertyGetter() + { + @SideOnly(Side.CLIENT) @@ -104,6 +104,9 @@ private Item containerItem; private String unlocalizedName; @@ -35,7 +46,661 @@ } protected RayTraceResult getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids) -@@ -935,6 +940,10 @@ +@@ -385,6 +390,10 @@ + float f6 = f3 * f4; + float f7 = f2 * f4; + double d3 = 5.0D; ++ if (playerIn instanceof net.minecraft.entity.player.EntityPlayerMP) ++ { ++ d3 = ((net.minecraft.entity.player.EntityPlayerMP)playerIn).theItemInWorldManager.getBlockReachDistance(); ++ } + Vec3d vec3d1 = vec3d.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); + return worldIn.rayTraceBlocks(vec3d, vec3d1, useLiquids, !useLiquids, false); + } +@@ -422,11 +431,642 @@ + return false; + } + ++ @Deprecated // Use ItemStack sensitive version below. + public Multimap getItemAttributeModifiers(EntityEquipmentSlot p_111205_1_) + { + return HashMultimap.create(); + } + ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * ItemStack sensitive version of getItemAttributeModifiers ++ */ ++ public Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) ++ { ++ return this.getItemAttributeModifiers(slot); ++ } ++ ++ /** ++ * Called when a player drops the item into the world, ++ * returning false from this will prevent the item from ++ * being removed from the players inventory and spawning ++ * in the world ++ * ++ * @param player The player that dropped the item ++ * @param item The item stack, before the item is removed. ++ */ ++ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) ++ { ++ return true; ++ } ++ ++ /** ++ * Allow the item one last chance to modify its name used for the ++ * tool highlight useful for adding something extra that can't be removed ++ * by a user in the displayed name, such as a mode of operation. ++ * ++ * @param item the ItemStack for the item. ++ * @param the name that will be displayed unless it is changed in this method. ++ */ ++ public String getHighlightTip( ItemStack item, String displayName ) ++ { ++ return displayName; ++ } ++ ++ /** ++ * This is called when the item is used, before the block is activated. ++ * @param stack The Item Stack ++ * @param player The Player that used the item ++ * @param world The Current World ++ * @param pos Target position ++ * @param side The side of the target hit ++ * @return Return true to prevent any further processing. ++ */ ++ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) ++ { ++ return false; ++ } ++ ++ /** ++ * Metadata-sensitive version of getStrVsBlock ++ * @param itemstack The Item Stack ++ * @param state The block state ++ * @return The damage strength ++ */ ++ public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state) ++ { ++ return getStrVsBlock(itemstack, state.getBlock()); ++ } ++ ++ protected boolean canRepair = true; ++ /** ++ * Called by CraftingManager to determine if an item is reparable. ++ * @return True if reparable ++ */ ++ public boolean isRepairable() ++ { ++ return canRepair && isDamageable(); ++ } ++ ++ /** ++ * Call to disable repair recipes. ++ * @return The current Item instance ++ */ ++ public Item setNoRepair() ++ { ++ canRepair = false; ++ return this; ++ } ++ ++ /** ++ * Called before a block is broken. Return true to prevent default block harvesting. ++ * ++ * Note: In SMP, this is called on both client and server sides! ++ * ++ * @param itemstack The current ItemStack ++ * @param pos Block's position in world ++ * @param player The Player that is wielding the item ++ * @return True to prevent harvesting, false to continue as normal ++ */ ++ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) ++ { ++ return false; ++ } ++ ++ /** ++ * Called each tick while using an item. ++ * @param stack The Item being used ++ * @param player The Player using the item ++ * @param count The amount of time in tick the item has been used for continuously ++ */ ++ public void onUsingTick(ItemStack stack, EntityPlayer player, int count) ++ { ++ } ++ ++ /** ++ * Called when the player Left Clicks (attacks) an entity. ++ * Processed before damage is done, if return value is true further processing is canceled ++ * and the entity is not attacked. ++ * ++ * @param stack The Item being used ++ * @param player The player that is attacking ++ * @param entity The entity being attacked ++ * @return True to cancel the rest of the interaction. ++ */ ++ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) ++ { ++ return false; ++ } ++ ++ /** ++ * Player, Render pass, and item usage sensitive version of getIconIndex. ++ * ++ * @param stack The item stack to get the icon for. ++ * @param player The player holding the item ++ * @param useRemaining The ticks remaining for the active item. ++ * @return Null to use default model, or a custom ModelResourceLocation for the stage of use. ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.renderer.block.model.ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) ++ { ++ return null; ++ } ++ ++ /** ++ * ItemStack sensitive version of getContainerItem. ++ * Returns a full ItemStack instance of the result. ++ * ++ * @param itemStack The current ItemStack ++ * @return The resulting ItemStack ++ */ ++ public ItemStack getContainerItem(ItemStack itemStack) ++ { ++ if (!hasContainerItem(itemStack)) ++ { ++ return null; ++ } ++ return new ItemStack(getContainerItem()); ++ } ++ ++ /** ++ * ItemStack sensitive version of hasContainerItem ++ * @param stack The current item stack ++ * @return True if this item has a 'container' ++ */ ++ public boolean hasContainerItem(ItemStack stack) ++ { ++ return hasContainerItem(); ++ } ++ ++ /** ++ * Retrieves the normal 'lifespan' of this item when it is dropped on the ground as a EntityItem. ++ * This is in ticks, standard result is 6000, or 5 mins. ++ * ++ * @param itemStack The current ItemStack ++ * @param world The world the entity is in ++ * @return The normal lifespan in ticks. ++ */ ++ public int getEntityLifespan(ItemStack itemStack, World world) ++ { ++ return 6000; ++ } ++ ++ /** ++ * Determines if this Item has a special entity for when they are in the world. ++ * Is called when a EntityItem is spawned in the world, if true and Item#createCustomEntity ++ * returns non null, the EntityItem will be destroyed and the new Entity will be added to the world. ++ * ++ * @param stack The current item stack ++ * @return True of the item has a custom entity, If true, Item#createCustomEntity will be called ++ */ ++ public boolean hasCustomEntity(ItemStack stack) ++ { ++ return false; ++ } ++ ++ /** ++ * This function should return a new entity to replace the dropped item. ++ * Returning null here will not kill the EntityItem and will leave it to function normally. ++ * Called when the item it placed in a world. ++ * ++ * @param world The world object ++ * @param location The EntityItem object, useful for getting the position of the entity ++ * @param itemstack The current item stack ++ * @return A new Entity object to spawn or null ++ */ ++ public Entity createEntity(World world, Entity location, ItemStack itemstack) ++ { ++ return null; ++ } ++ ++ /** ++ * Called by the default implemetation of EntityItem's onUpdate method, allowing for cleaner ++ * control over the update of the item without having to write a subclass. ++ * ++ * @param entityItem The entity Item ++ * @return Return true to skip any further update code. ++ */ ++ public boolean onEntityItemUpdate(net.minecraft.entity.item.EntityItem entityItem) ++ { ++ return false; ++ } ++ ++ /** ++ * Gets a list of tabs that items belonging to this class can display on, ++ * combined properly with getSubItems allows for a single item to span ++ * many sub-items across many tabs. ++ * ++ * @return A list of all tabs that this item could possibly be one. ++ */ ++ public CreativeTabs[] getCreativeTabs() ++ { ++ return new CreativeTabs[]{ getCreativeTab() }; ++ } ++ ++ /** ++ * Determines the base experience for a player when they remove this item from a furnace slot. ++ * This number must be between 0 and 1 for it to be valid. ++ * This number will be multiplied by the stack size to get the total experience. ++ * ++ * @param item The item stack the player is picking up. ++ * @return The amount to award for each item. ++ */ ++ public float getSmeltingExperience(ItemStack item) ++ { ++ return -1; //-1 will default to the old lookups. ++ } ++ ++ /** ++ * Generates the base Random item for a specific instance of the chest gen, ++ * Enchanted books use this to pick a random enchantment. ++ * ++ * @param chest The chest category to generate for ++ * @param rnd World RNG ++ * @param original Original result registered with the chest gen hooks. ++ * @return New values to use as the random item, typically this will be original ++ */ ++ public net.minecraft.util.WeightedRandomChestContent getChestGenBase(net.minecraftforge.common.ChestGenHooks chest, Random rnd, net.minecraft.util.WeightedRandomChestContent original) ++ { ++ if (this instanceof ItemEnchantedBook) ++ { ++ return ((ItemEnchantedBook)this).getRandom(rnd, ++ original.minStackSize, ++ original.maxStackSize, original.itemWeight); ++ } ++ return original; ++ } ++ ++ /** ++ * ++ * Should this item, when held, allow sneak-clicks to pass through to the underlying block? ++ * ++ * @param world The world ++ * @param pos Block position in world ++ * @param player The Player that is wielding the item ++ * @return ++ */ ++ public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player) ++ { ++ return false; ++ } ++ ++ /** ++ * Called to tick armor in the armor slot. Override to do something ++ */ ++ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack){} ++ ++ /** ++ * Determines if the specific ItemStack can be placed in the specified armor slot. ++ * ++ * @param stack The ItemStack ++ * @param armorType Armor slot ID: 0: Helmet, 1: Chest, 2: Legs, 3: Boots ++ * @param entity The entity trying to equip the armor ++ * @return True if the given ItemStack can be inserted in the slot ++ */ ++ public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) ++ { ++ if (this instanceof ItemArmor) ++ { ++ return ((ItemArmor)this).armorType == armorType; ++ } ++ ++ if (armorType == 0) ++ { ++ return this == Item.getItemFromBlock(Blocks.pumpkin) || this == Items.skull; ++ } ++ ++ return false; ++ } ++ ++ /** ++ * Allow or forbid the specific book/item combination as an anvil enchant ++ * ++ * @param stack The item ++ * @param book The book ++ * @return if the enchantment is allowed ++ */ ++ public boolean isBookEnchantable(ItemStack stack, ItemStack book) ++ { ++ return true; ++ } ++ ++ /** ++ * Called by RenderBiped and RenderPlayer to determine the armor texture that ++ * should be use for the currently equipped item. ++ * This will only be called on instances of ItemArmor. ++ * ++ * Returning null from this function will use the default value. ++ * ++ * @param stack ItemStack for the equipped armor ++ * @param entity The entity wearing the armor ++ * @param slot The slot the armor is in ++ * @param type The subtype, can be null or "overlay" ++ * @return Path of texture to bind, or null to use default ++ */ ++ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) ++ { ++ return null; ++ } ++ ++ /** ++ * Returns the font renderer used to render tooltips and overlays for this item. ++ * Returning null will use the standard font renderer. ++ * ++ * @param stack The current item stack ++ * @return A instance of FontRenderer or null to use default ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack) ++ { ++ return null; ++ } ++ ++ /** ++ * Override this method to have an item handle its own armor rendering. ++ * ++ * @param entityLiving The entity wearing the armor ++ * @param itemStack The itemStack to render the model of ++ * @param armorSlot 0=head, 1=torso, 2=legs, 3=feet ++ * @param _default Original armor model. Will have attributes set. ++ * @return A ModelBiped to render instead of the default ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot, net.minecraft.client.model.ModelBiped _default) ++ { ++ return null; ++ } ++ ++ /** ++ * Called when a entity tries to play the 'swing' animation. ++ * ++ * @param entityLiving The entity swinging the item. ++ * @param stack The Item stack ++ * @return True to cancel any further processing by EntityLiving ++ */ ++ public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) ++ { ++ return false; ++ } ++ ++ /** ++ * Called when the client starts rendering the HUD, for whatever item the player currently has as a helmet. ++ * This is where pumpkins would render there overlay. ++ * ++ * @param stack The ItemStack that is equipped ++ * @param player Reference to the current client entity ++ * @param resolution Resolution information about the current viewport and configured GUI Scale ++ * @param partialTicks Partial ticks for the renderer, useful for interpolation ++ */ ++ @SideOnly(Side.CLIENT) ++ public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, net.minecraft.client.gui.ScaledResolution resolution, float partialTicks){} ++ ++ /** ++ * Return the itemDamage represented by this ItemStack. Defaults to the itemDamage field on ItemStack, but can be overridden here for other sources such as NBT. ++ * ++ * @param stack The itemstack that is damaged ++ * @return the damage value ++ */ ++ public int getDamage(ItemStack stack) ++ { ++ return stack.itemDamage; ++ } ++ ++ /** ++ * This used to be 'display damage' but its really just 'aux' data in the ItemStack, usually shares the same variable as damage. ++ * @param stack ++ * @return ++ */ ++ public int getMetadata(ItemStack stack) ++ { ++ return stack.itemDamage; ++ } ++ ++ /** ++ * Determines if the durability bar should be rendered for this item. ++ * Defaults to vanilla stack.isDamaged behavior. ++ * But modders can use this for any data they wish. ++ * ++ * @param stack The current Item Stack ++ * @return True if it should render the 'durability' bar. ++ */ ++ public boolean showDurabilityBar(ItemStack stack) ++ { ++ return stack.isItemDamaged(); ++ } ++ ++ /** ++ * Queries the percentage of the 'Durability' bar that should be drawn. ++ * ++ * @param stack The current ItemStack ++ * @return 1.0 for 100% 0 for 0% ++ */ ++ public double getDurabilityForDisplay(ItemStack stack) ++ { ++ return (double)stack.getItemDamage() / (double)stack.getMaxDamage(); ++ } ++ ++ /** ++ * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item, ++ * but can be overridden here for other sources such as NBT. ++ * ++ * @param stack The itemstack that is damaged ++ * @return the damage value ++ */ ++ public int getMaxDamage(ItemStack stack) ++ { ++ return getMaxDamage(); ++ } ++ ++ /** ++ * Return if this itemstack is damaged. Note only called if {@link #isDamageable()} is true. ++ * @param stack the stack ++ * @return if the stack is damaged ++ */ ++ public boolean isDamaged(ItemStack stack) ++ { ++ return stack.itemDamage > 0; ++ } ++ ++ /** ++ * Set the damage for this itemstack. Note, this method is responsible for zero checking. ++ * @param stack the stack ++ * @param damage the new damage value ++ */ ++ public void setDamage(ItemStack stack, int damage) ++ { ++ stack.itemDamage = damage; ++ ++ if (stack.itemDamage < 0) ++ { ++ stack.itemDamage = 0; ++ } ++ } ++ ++ /** ++ * ItemStack sensitive version of {@link #canHarvestBlock(Block)} ++ * @param state The block trying to harvest ++ * @param stack The itemstack used to harvest the block ++ * @return true if can harvest the block ++ */ ++ public boolean canHarvestBlock(IBlockState state, ItemStack stack) ++ { ++ return canHarvestBlock(state); ++ } ++ ++ /** ++ * Gets the maximum number of items that this stack should be able to hold. ++ * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit() ++ * ++ * @param stack The ItemStack ++ * @return THe maximum number this item can be stacked to ++ */ ++ public int getItemStackLimit(ItemStack stack) ++ { ++ return this.getItemStackLimit(); ++ } ++ ++ private java.util.Map toolClasses = new java.util.HashMap(); ++ /** ++ * Sets or removes the harvest level for the specified tool class. ++ * ++ * @param toolClass Class ++ * @param level Harvest level: ++ * Wood: 0 ++ * Stone: 1 ++ * Iron: 2 ++ * Diamond: 3 ++ * Gold: 0 ++ */ ++ public void setHarvestLevel(String toolClass, int level) ++ { ++ if (level < 0) ++ toolClasses.remove(toolClass); ++ else ++ toolClasses.put(toolClass, level); ++ } ++ ++ public java.util.Set getToolClasses(ItemStack stack) ++ { ++ return toolClasses.keySet(); ++ } ++ ++ /** ++ * Queries the harvest level of this item stack for the specifred tool class, ++ * Returns -1 if this tool is not of the specified type ++ * ++ * @param stack This item stack instance ++ * @param toolClass Tool Class ++ * @return Harvest level, or -1 if not the specified tool type. ++ */ ++ public int getHarvestLevel(ItemStack stack, String toolClass) ++ { ++ Integer ret = toolClasses.get(toolClass); ++ return ret == null ? -1 : ret; ++ } ++ ++ /** ++ * ItemStack sensitive version of getItemEnchantability ++ * ++ * @param stack The ItemStack ++ * @return the item echantability value ++ */ ++ public int getItemEnchantability(ItemStack stack) ++ { ++ return getItemEnchantability(); ++ } ++ ++ /** ++ * Whether this Item can be used as a payment to activate the vanilla beacon. ++ * @param stack the ItemStack ++ * @return true if this Item can be used ++ */ ++ public boolean isBeaconPayment(ItemStack stack) ++ { ++ return this == Items.emerald || this == Items.diamond || this == Items.gold_ingot || this == Items.iron_ingot; ++ } ++ ++ /** ++ * Determine if the player switching between these two item stacks ++ * @param oldStack The old stack that was equipped ++ * @param newStack The new stack ++ * @param slotChanged If the current equipped slot was changed, ++ * Vanilla does not play the animation if you switch between two ++ * slots that hold the exact same item. ++ * @return True to play the item change animation ++ */ ++ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) ++ { ++ return !ItemStack.areItemStacksEqual(oldStack, newStack); ++ } ++ ++ private ResourceLocation registryName = null; ++ /** ++ * Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item. ++ * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. ++ * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. ++ * ++ * The supplied name will be prefixed with the currently active mod's modId. ++ * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. ++ * ++ * If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown. ++ * ++ * Returns 'this' to allow for chaining. ++ * ++ * @param name Unique registry name ++ * @return This instance ++ */ ++ public final Item setRegistryName(String name) ++ { ++ if (getRegistryName() != null) ++ throw new IllegalStateException("Attempted to set registry name on block with exisiting registry name! New: " + name + " Old: " + getRegistryName()); ++ int index = name.lastIndexOf(':'); ++ String oldPrefix = index == -1 ? "" : name.substring(0, index); ++ name = index == -1 ? name : name.substring(index + 1); ++ net.minecraftforge.fml.common.ModContainer mc = net.minecraftforge.fml.common.Loader.instance().activeModContainer(); ++ String prefix = mc == null ? "minecraft" : mc.getModId(); ++ if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) ++ { ++ net.minecraftforge.fml.common.FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name); ++ prefix = oldPrefix; ++ } ++ this.registryName = new ResourceLocation(prefix, name); ++ return this; ++ } ++ public final Item setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); } ++ public final Item setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); } ++ ++ /** ++ * A unique identifier for this block, if this block is registered in the game registry it will return that name. ++ * Otherwise it will return the name set in setRegistryName(). ++ * If neither are valid null is returned. ++ * ++ * @return Unique identifier or null. ++ */ ++ public final String getRegistryName() ++ { ++ if (delegate.getResourceName() != null) return delegate.getResourceName().toString(); ++ return registryName != null ? registryName.toString() : null; ++ } ++ ++ /** ++ * Called from ItemStack.setItem, will hold extra data for the life of this ItemStack. ++ * Can be retrieved from stack.getCapabilities() ++ * The NBT can be null if this is not called from readNBT or if the item the stack is ++ * changing FROM is different then this item, or the previous item had no capabilities. ++ * ++ * This is called BEFORE the stacks item is set so you can use stack.getItem() to see the OLD item. ++ * Remember that getItem CAN return null. ++ * ++ * @param stack The ItemStack ++ * @param nbt NBT of this item serialized, or null. ++ * @return A holder instance associated with this ItemStack where you can hold capabilities for the life of this item. ++ */ ++ public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) ++ { ++ return null; ++ } ++ /* ======================================== FORGE END =====================================*/ ++ + public static void registerItems() + { + registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() +@@ -935,6 +1575,10 @@ private final float damageVsEntity; private final int enchantability; @@ -46,3 +711,41 @@ private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) { this.harvestLevel = harvestLevel; +@@ -969,9 +1613,36 @@ + return this.enchantability; + } + ++ @Deprecated // Use getRepairItemStack below + public Item getRepairItem() + { +- return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == DIAMOND ? Items.diamond : null)))); ++ switch (this) ++ { ++ case WOOD: return Item.getItemFromBlock(Blocks.planks); ++ case STONE: return Item.getItemFromBlock(Blocks.cobblestone); ++ case GOLD: return Items.gold_ingot; ++ case IRON: return Items.iron_ingot; ++ case DIAMOND: return Items.diamond; ++ default: return customCraftingMaterial; ++ } + } ++ ++ public ToolMaterial setRepairItem(ItemStack stack) ++ { ++ if (this.repairMaterial != null || customCraftingMaterial != null) throw new RuntimeException("Can not change already set repair material"); ++ if (this == WOOD || this == STONE || this == GOLD || this == IRON || this == DIAMOND) throw new RuntimeException("Can not change vanilla tool repair materials"); ++ this.repairMaterial = stack; ++ this.customCraftingMaterial = stack.getItem(); ++ return this; ++ } ++ ++ public ItemStack getRepairItemStack() ++ { ++ if (repairMaterial != null) return repairMaterial; ++ Item ret = this.getRepairItem(); ++ if (ret == null) return null; ++ repairMaterial = new ItemStack(ret, 1, net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE); ++ return repairMaterial; ++ } + } + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch index b8191a6915..25d1f23e59 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch @@ -1,6 +1,15 @@ --- ../src-base/minecraft/net/minecraft/item/ItemArmor.java +++ ../src-work/minecraft/net/minecraft/item/ItemArmor.java -@@ -267,7 +267,15 @@ +@@ -235,6 +235,8 @@ + private final int[] damageReductionAmountArray; + private final int enchantability; + private final SoundEvent field_185020_j; ++ //Added by forge for custom Armor materials. ++ public Item customCraftingMaterial = null; + + private ArmorMaterial(String p_i46796_3_, int p_i46796_4_, int[] p_i46796_5_, int p_i46796_6_, SoundEvent p_i46796_7_) + { +@@ -267,7 +269,15 @@ public Item getRepairItem() { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch index 20c49cd78f..06dca56105 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch @@ -1,6 +1,24 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBlock.java +++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java -@@ -121,7 +121,7 @@ +@@ -50,16 +50,8 @@ + int i = this.getMetadata(stack.getMetadata()); + IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, hitX, hitY, hitZ, p_180614_9_, i, playerIn); + +- if (worldIn.setBlockState(pos, iblockstate1, 11)) ++ if (placeBlockAt(stack, playerIn, worldIn, pos, hitX, hitY, hitZ, p_180614_9_, iblockstate1)) + { +- iblockstate1 = worldIn.getBlockState(pos); +- +- if (iblockstate1.getBlock() == this.block) +- { +- setTileEntityNBT(worldIn, playerIn, pos, stack); +- this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); +- } +- + SoundType soundtype = this.block.func_185467_w(); + worldIn.func_184133_a(playerIn, pos, soundtype.func_185841_e(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F); + --stack.stackSize; +@@ -121,7 +113,7 @@ { Block block = worldIn.getBlockState(pos).getBlock(); @@ -9,7 +27,7 @@ { side = EnumFacing.UP; } -@@ -159,4 +159,26 @@ +@@ -159,4 +151,26 @@ { return this.block; } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch new file mode 100644 index 0000000000..01c1117e7f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBow.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBow.java +@@ -90,6 +90,10 @@ + boolean flag = entityplayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185312_x, stack) > 0; + ItemStack itemstack = this.func_185060_a(entityplayer); + ++ int i = this.getMaxItemUseDuration(stack) - timeLeft; ++ i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(stack, worldIn, (EntityPlayer)playerIn, i, itemstack != null || flag); ++ if (i < 0) return; ++ + if (itemstack != null || flag) + { + if (itemstack == null) +@@ -97,7 +101,6 @@ + itemstack = new ItemStack(Items.arrow); + } + +- int i = this.getMaxItemUseDuration(stack) - timeLeft; + float f = func_185059_b(i); + + if ((double)f >= 0.1D) +@@ -189,6 +192,9 @@ + { + boolean flag = this.func_185060_a(playerIn) != null; + ++ ActionResult ret = net.minecraftforge.event.ForgeEventFactory.onArrowNock(itemStackIn, worldIn, playerIn, p_77659_4_, flag); ++ if (ret != null) return ret; ++ + if (!playerIn.capabilities.isCreativeMode && !flag) + { + return !flag ? new ActionResult(EnumActionResult.FAIL, itemStackIn) : new ActionResult(EnumActionResult.PASS, itemStackIn); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch new file mode 100644 index 0000000000..d2254fe35e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBucket.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBucket.java +@@ -36,6 +36,8 @@ + { + boolean flag = this.isFull == Blocks.air; + RayTraceResult raytraceresult = this.getMovingObjectPositionFromPlayer(worldIn, playerIn, flag); ++ ActionResult ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(playerIn, worldIn, itemStackIn, raytraceresult); ++ if (ret != null) return ret; + + if (raytraceresult == null) + { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch new file mode 100644 index 0000000000..03387eb421 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemEmptyMap.java ++++ ../src-work/minecraft/net/minecraft/item/ItemEmptyMap.java +@@ -25,7 +25,7 @@ + worldIn.setItemData(s, mapdata); + mapdata.scale = 0; + mapdata.calculateMapCenter(playerIn.posX, playerIn.posZ, mapdata.scale); +- mapdata.dimension = (byte)worldIn.provider.func_186058_p().func_186068_a(); ++ mapdata.dimension = worldIn.provider.func_186058_p().func_186068_a(); + mapdata.field_186210_e = true; + mapdata.markDirty(); + --itemStackIn.stackSize; diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch new file mode 100644 index 0000000000..69f342f8bf --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemFlintAndSteel.java ++++ ../src-work/minecraft/net/minecraft/item/ItemFlintAndSteel.java +@@ -31,7 +31,7 @@ + } + else + { +- if (worldIn.getBlockState(pos).func_185904_a() == Material.air) ++ if (worldIn.isAirBlock(pos)) + { + worldIn.func_184133_a(playerIn, pos, SoundEvents.field_187649_bu, SoundCategory.BLOCKS, 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); + worldIn.setBlockState(pos, Blocks.fire.getDefaultState(), 11); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch new file mode 100644 index 0000000000..f721d1fc7c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemHoe.java ++++ ../src-work/minecraft/net/minecraft/item/ItemHoe.java +@@ -45,10 +45,13 @@ + } + else + { ++ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, playerIn, worldIn, pos); ++ if (hook != 0) return hook > 0 ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; ++ + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + +- if (hitX != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).func_185904_a() == Material.air) ++ if (hitX != EnumFacing.DOWN && worldIn.isAirBlock(pos.up())) + { + if (block == Blocks.grass || block == Blocks.field_185774_da) + { diff --git a/rejects/minecraft/net/minecraft/item/ItemLilyPad.java.patch.rej b/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch similarity index 57% rename from rejects/minecraft/net/minecraft/item/ItemLilyPad.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch index 33da610fd2..5c669d0a79 100644 --- a/rejects/minecraft/net/minecraft/item/ItemLilyPad.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch @@ -1,16 +1,18 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/item/ItemLilyPad.java ++++ ../src-work/minecraft/net/minecraft/item/ItemLilyPad.java +@@ -47,6 +47,15 @@ - if (iblockstate.getBlock().getMaterial() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) + if (iblockstate.func_185904_a() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) { + // special case for handling block placement with water lilies + net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(worldIn, blockpos1); - worldIn.setBlockState(blockpos1, Blocks.waterlily.getDefaultState()); ++ worldIn.setBlockState(blockpos1, Blocks.waterlily.getDefaultState()); + if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(playerIn, blocksnapshot, net.minecraft.util.EnumFacing.UP).isCanceled()) + { + blocksnapshot.restore(true, false); -+ return itemStackIn; ++ return new ActionResult(EnumActionResult.FAIL, itemStackIn); + } ++ + worldIn.setBlockState(blockpos1, Blocks.waterlily.getDefaultState(), 11); if (!playerIn.capabilities.isCreativeMode) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemMap.java.patch.rej b/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch similarity index 50% rename from rejects/minecraft/net/minecraft/item/ItemMap.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch index 38ab28060a..763a91d255 100644 --- a/rejects/minecraft/net/minecraft/item/ItemMap.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch @@ -1,10 +1,11 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/item/ItemMap.java ++++ ../src-work/minecraft/net/minecraft/item/ItemMap.java +@@ -57,7 +57,7 @@ mapdata = new MapData(s); mapdata.scale = 3; mapdata.calculateMapCenter((double)worldIn.getWorldInfo().getSpawnX(), (double)worldIn.getWorldInfo().getSpawnZ(), mapdata.scale); -- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); -+ mapdata.dimension = worldIn.provider.getDimensionId(); +- mapdata.dimension = (byte)worldIn.provider.func_186058_p().func_186068_a(); ++ mapdata.dimension = worldIn.provider.func_186058_p().func_186068_a(); mapdata.markDirty(); worldIn.setItemData(s, mapdata); } -++++ END PATCH diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch index dd7b0ff031..d9e451c9f7 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch @@ -1,34 +1,11 @@ --- ../src-base/minecraft/net/minecraft/item/ItemMonsterPlacer.java +++ ../src-work/minecraft/net/minecraft/item/ItemMonsterPlacer.java -@@ -193,8 +193,31 @@ - return new ActionResult(EnumActionResult.PASS, itemStackIn); - } - } -+ -+ for (String name : net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().keySet()) -+ { -+ ItemStack stack = new ItemStack(itemIn); -+ net.minecraft.nbt.NBTTagCompound nbt = new net.minecraft.nbt.NBTTagCompound(); -+ nbt.setString("entity_name", name); -+ stack.setTagCompound(nbt); -+ subItems.add(stack); -+ } - } +@@ -88,7 +88,7 @@ + pos = pos.offset(hitX); + double d0 = 0.0D; -+ public static String getEntityName(ItemStack stack) -+ { -+ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("entity_name", 8)) -+ return stack.getTagCompound().getString("entity_name"); -+ return EntityList.getStringFromID(stack.getMetadata()); -+ } -+ -+ private static EntityList.EntityEggInfo getEggInfo(ItemStack stack) -+ { -+ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("entity_name", 8)) -+ return net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(stack.getTagCompound().getString("entity_name")); -+ return (EntityList.EntityEggInfo)EntityList.entityEggs.get(stack.getMetadata()); -+ } -+ - public static Entity spawnCreature(World worldIn, String entityID, double x, double y, double z) - { - if (entityID != null && EntityList.entityEggs.containsKey(entityID)) +- if (hitX == EnumFacing.UP && iblockstate instanceof BlockFence) ++ if (hitX == EnumFacing.UP && iblockstate.getBlock() instanceof BlockFence) //Forge: Fix Vanilla bug comparing state instead of block + { + d0 = 0.5D; + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch index ade0e57383..1425a3d9cf 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch @@ -9,7 +9,17 @@ { private Block crops; private Block soilId; -@@ -33,4 +33,16 @@ +@@ -22,7 +22,8 @@ + + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand side, EnumFacing hitX, float hitY, float hitZ, float p_180614_9_) + { +- if (hitX == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(hitX), hitX, stack) && worldIn.getBlockState(pos).getBlock() == this.soilId && worldIn.isAirBlock(pos.up())) ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos); ++ if (hitX == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(hitX), hitX, stack) && state.getBlock().canSustainPlant(state, worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) + { + worldIn.setBlockState(pos.up(), this.crops.getDefaultState(), 11); + --stack.stackSize; +@@ -33,4 +34,16 @@ return EnumActionResult.FAIL; } } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch index 1d5d89be8b..b176b6576b 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch @@ -9,7 +9,17 @@ { private Block crops; private Block soilBlockID; -@@ -34,4 +34,16 @@ +@@ -23,7 +23,8 @@ + + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand side, EnumFacing hitX, float hitY, float hitZ, float p_180614_9_) + { +- if (hitX == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(hitX), hitX, stack) && worldIn.getBlockState(pos).getBlock() == this.soilBlockID && worldIn.isAirBlock(pos.up())) ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos); ++ if (hitX == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(hitX), hitX, stack) && state.getBlock().canSustainPlant(state, worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) + { + worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); + --stack.stackSize; +@@ -34,4 +35,16 @@ return EnumActionResult.FAIL; } } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch index 8ec9fd7fae..6bb523f66b 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch @@ -1,13 +1,30 @@ --- ../src-base/minecraft/net/minecraft/item/ItemShears.java +++ ../src-work/minecraft/net/minecraft/item/ItemShears.java -@@ -36,4 +36,71 @@ +@@ -6,6 +6,7 @@ + import net.minecraft.creativetab.CreativeTabs; + import net.minecraft.entity.EntityLivingBase; + import net.minecraft.init.Blocks; ++import net.minecraft.util.EnumHand; + import net.minecraft.util.math.BlockPos; + import net.minecraft.world.World; + +@@ -22,7 +23,7 @@ + { + stack.damageItem(1, playerIn); + Block block = blockIn.getBlock(); +- return blockIn.func_185904_a() != Material.leaves && block != Blocks.web && block != Blocks.tallgrass && block != Blocks.vine && block != Blocks.tripwire && block != Blocks.wool ? super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn) : true; ++ return blockIn.func_185904_a() != Material.leaves && block != Blocks.web && block != Blocks.tallgrass && block != Blocks.vine && block != Blocks.tripwire && block != Blocks.wool && !(blockIn instanceof net.minecraftforge.common.IShearable) ? super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn) : true; + } + + public boolean canHarvestBlock(IBlockState blockIn) +@@ -36,4 +37,71 @@ Block block = block.getBlock(); return block != Blocks.web && block.func_185904_a() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, block)) : 15.0F; } + + + @Override -+ public boolean itemInteractionForEntity(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity) ++ public boolean itemInteractionForEntity(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity, EnumHand hand) + { + if (entity.worldObj.isRemote) + { @@ -20,7 +37,7 @@ + if (target.isShearable(itemstack, entity.worldObj, pos)) + { + java.util.List drops = target.onSheared(itemstack, entity.worldObj, pos, -+ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.enchantment.Enchantment.fortune.effectId, itemstack)); ++ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.init.Enchantments.field_185308_t, itemstack)); + + java.util.Random rand = new java.util.Random(); + for(ItemStack stack : drops) @@ -51,7 +68,7 @@ + if (target.isShearable(itemstack, player.worldObj, pos)) + { + java.util.List drops = target.onSheared(itemstack, player.worldObj, pos, -+ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.enchantment.Enchantment.fortune.effectId, itemstack)); ++ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.init.Enchantments.field_185308_t, itemstack)); + java.util.Random rand = new java.util.Random(); + + for(ItemStack stack : drops) @@ -66,7 +83,7 @@ + } + + itemstack.damageItem(1, player); -+ player.addStat(net.minecraft.stats.StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); ++ player.triggerAchievement(net.minecraft.stats.StatList.func_188055_a(block)); + } + } + return false; diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch new file mode 100644 index 0000000000..d30bce76ea --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSkull.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSkull.java +@@ -42,13 +42,18 @@ + } + else + { ++ if (worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos)) ++ { ++ hitX = EnumFacing.UP; ++ pos = pos.down(); ++ } + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + boolean flag = block.isReplaceable(worldIn, pos); + + if (!flag) + { +- if (!worldIn.getBlockState(pos).func_185904_a().isSolid()) ++ if (!worldIn.getBlockState(pos).func_185904_a().isSolid() && !worldIn.isSideSolid(pos, hitX, true)) + { + return EnumActionResult.FAIL; + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch index b05c2b68a0..f955a53d7f 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch @@ -38,7 +38,48 @@ this.stackSize = amount; this.itemDamage = meta; -@@ -196,7 +202,7 @@ +@@ -114,7 +120,7 @@ + public ItemStack splitStack(int amount) + { + amount = Math.min(amount, this.stackSize); +- ItemStack itemstack = new ItemStack(this.item, amount, this.itemDamage); ++ ItemStack itemstack = new ItemStack(this.item, amount, this.itemDamage, this.capabilities != null ? this.capabilities.serializeNBT() : null); + + if (this.stackTagCompound != null) + { +@@ -127,11 +133,12 @@ + + public Item getItem() + { +- return this.item; ++ return this.delegate != null ? this.delegate.get() : null; + } + + public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand side, EnumFacing hitX, float hitY, float hitZ, float p_179546_8_) + { ++ if (!worldIn.isRemote) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, playerIn, worldIn, pos, hitX, hitY, hitZ, p_179546_8_, side); + EnumActionResult enumactionresult = this.getItem().onItemUse(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ, p_179546_8_); + + if (enumactionresult == EnumActionResult.SUCCESS) +@@ -169,12 +176,16 @@ + nbt.setTag("tag", this.stackTagCompound); + } + ++ if (this.capabilities != null) nbt.setTag("ForgeCaps", this.capabilities.serializeNBT()); ++ + return nbt; + } + + public void readFromNBT(NBTTagCompound nbt) + { +- this.item = Item.getByNameOrId(nbt.getString("id")); ++ this.capNBT = nbt.hasKey("ForgeCaps") ? nbt.getCompoundTag("ForgeCaps") : null; ++ this.setItem(Item.getByNameOrId(nbt.getString("id"))); ++ this.capNBT = null; + this.stackSize = nbt.getByte("Count"); + this.itemDamage = nbt.getShort("Damage"); + +@@ -196,7 +207,7 @@ public int getMaxStackSize() { @@ -47,7 +88,7 @@ } public boolean isStackable() -@@ -206,7 +212,7 @@ +@@ -206,7 +217,7 @@ public boolean isItemStackDamageable() { @@ -56,6 +97,44 @@ } public boolean getHasSubtypes() +@@ -216,32 +227,27 @@ + + public boolean isItemDamaged() + { +- return this.isItemStackDamageable() && this.itemDamage > 0; ++ return this.isItemStackDamageable() && getItem().isDamaged(this); + } + + public int getItemDamage() + { +- return this.itemDamage; ++ return getItem().getDamage(this); + } + + public int getMetadata() + { +- return this.itemDamage; ++ return getItem().getMetadata(this); + } + + public void setItemDamage(int meta) + { +- this.itemDamage = meta; +- +- if (this.itemDamage < 0) +- { +- this.itemDamage = 0; +- } ++ getItem().setDamage(this, meta); + } + + public int getMaxDamage() + { +- return this.item == null ? 0 : this.item.getMaxDamage(); ++ return this.item == null ? 0 : this.item.getMaxDamage(this); + } + + public boolean attemptDamageItem(int amount, Random rand) @@ -273,8 +279,8 @@ } } @@ -93,6 +172,15 @@ return list; } +@@ -869,7 +876,7 @@ + } + else + { +- multimap = this.getItem().getItemAttributeModifiers(p_111283_1_); ++ multimap = this.getItem().getAttributeModifiers(p_111283_1_, this); + } + + return multimap; @@ -901,6 +908,18 @@ public void setItem(Item newItem) diff --git a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch index ce968f5647..2facd3bb90 100644 --- a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -12,7 +12,18 @@ { return; } -@@ -689,6 +692,7 @@ +@@ -670,7 +673,9 @@ + + if (blockpos.getY() < this.serverController.getBuildLimit() - 1 || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit()) + { +- if (this.field_184362_y == null && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < 64.0D && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) ++ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 3; ++ dist *= dist; ++ if (this.field_184362_y == null && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < dist && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) + { + this.playerEntity.theItemInWorldManager.func_187251_a(this.playerEntity, worldserver, itemstack, enumhand, blockpos, enumfacing, p_184337_1_.func_187026_d(), p_184337_1_.func_187025_e(), p_184337_1_.func_187020_f()); + } +@@ -689,6 +694,7 @@ if (itemstack != null && itemstack.stackSize == 0) { this.playerEntity.func_184611_a(enumhand, (ItemStack)null); @@ -20,3 +31,38 @@ itemstack = null; } } +@@ -703,12 +709,14 @@ + + if (itemstack != null) + { ++ //TODO: Hook interact event here... we don't know the type of itneration tho... + this.playerEntity.theItemInWorldManager.func_187250_a(this.playerEntity, worldserver, itemstack, enumhand); + itemstack = this.playerEntity.func_184586_b(enumhand); + + if (itemstack != null && itemstack.stackSize == 0) + { + this.playerEntity.func_184611_a(enumhand, (ItemStack)null); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.playerEntity, itemstack, enumhand); + itemstack = null; + } + } +@@ -888,7 +896,9 @@ + } + else + { +- ITextComponent itextcomponent = new TextComponentTranslation("chat.type.text", new Object[] {this.playerEntity.getDisplayName(), s}); ++ ITextComponent itextcomponent = new TextComponentTranslation("chat.type.text", this.playerEntity.getDisplayName(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s)); ++ itextcomponent = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, itextcomponent); ++ if (itextcomponent == null) return; + this.serverController.func_184103_al().sendChatMsgImpl(itextcomponent, false); + } + +@@ -1057,7 +1067,7 @@ + return; + } + +- this.playerEntity = this.serverController.func_184103_al().recreatePlayerEntity(this.playerEntity, 0, false); ++ this.playerEntity = this.serverController.func_184103_al().recreatePlayerEntity(this.playerEntity, playerEntity.dimension, false); + + if (this.serverController.isHardcore()) + { diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch index c6a72a010d..c454546d02 100644 --- a/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch @@ -1,5 +1,14 @@ --- ../src-base/minecraft/net/minecraft/world/storage/MapData.java +++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java +@@ -21,7 +21,7 @@ + { + public int xCenter; + public int zCenter; +- public byte dimension; ++ public int dimension; + public boolean field_186210_e; + public byte scale; + public byte[] colors = new byte[16384]; @@ -45,7 +45,17 @@ public void readFromNBT(NBTTagCompound nbt) diff --git a/rejects/minecraft/net/minecraft/item/Item.java.patch.rej b/rejects/minecraft/net/minecraft/item/Item.java.patch.rej deleted file mode 100644 index 138fb95f06..0000000000 --- a/rejects/minecraft/net/minecraft/item/Item.java.patch.rej +++ /dev/null @@ -1,735 +0,0 @@ -++++ REJECTED PATCH 1 - - public class Item - { -- public static final RegistryNamespaced itemRegistry = new RegistryNamespaced(); -- private static final Map BLOCK_TO_ITEM = Maps.newHashMap(); -+ public static final RegistryNamespaced itemRegistry = net.minecraftforge.fml.common.registry.GameData.getItemRegistry(); -+ private static final Map BLOCK_TO_ITEM = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap(); - protected static final UUID itemModifierUUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); - private CreativeTabs tabToDisplayOn; - protected static Random itemRand = new Random(); -++++ END PATCH -++++ REJECTED PATCH 6 - float f6 = f3 * f4; - float f7 = f2 * f4; - double d3 = 5.0D; -+ if (playerIn instanceof net.minecraft.entity.player.EntityPlayerMP) -+ { -+ d3 = ((net.minecraft.entity.player.EntityPlayerMP)playerIn).theItemInWorldManager.getBlockReachDistance(); -+ } - Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); - return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); - } -++++ END PATCH -++++ REJECTED PATCH 7 - return false; - } - -+ @Deprecated // Use ItemStack sensitive version below. - public Multimap getItemAttributeModifiers() - { - return HashMultimap.create(); - } - -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * ItemStack sensitive version of getItemAttributeModifiers -+ */ -+ public Multimap getAttributeModifiers(ItemStack stack) -+ { -+ return this.getItemAttributeModifiers(); -+ } -+ -+ /** -+ * Called when a player drops the item into the world, -+ * returning false from this will prevent the item from -+ * being removed from the players inventory and spawning -+ * in the world -+ * -+ * @param player The player that dropped the item -+ * @param item The item stack, before the item is removed. -+ */ -+ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) -+ { -+ return true; -+ } -+ -+ /** -+ * Allow the item one last chance to modify its name used for the -+ * tool highlight useful for adding something extra that can't be removed -+ * by a user in the displayed name, such as a mode of operation. -+ * -+ * @param item the ItemStack for the item. -+ * @param the name that will be displayed unless it is changed in this method. -+ */ -+ public String getHighlightTip( ItemStack item, String displayName ) -+ { -+ return displayName; -+ } -+ -+ /** -+ * This is called when the item is used, before the block is activated. -+ * @param stack The Item Stack -+ * @param player The Player that used the item -+ * @param world The Current World -+ * @param pos Target position -+ * @param side The side of the target hit -+ * @return Return true to prevent any further processing. -+ */ -+ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) -+ { -+ return false; -+ } -+ -+ /** -+ * Metadata-sensitive version of getStrVsBlock -+ * @param itemstack The Item Stack -+ * @param state The block state -+ * @return The damage strength -+ */ -+ public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state) -+ { -+ return getStrVsBlock(itemstack, state.getBlock()); -+ } -+ -+ -+ protected boolean canRepair = true; -+ /** -+ * Called by CraftingManager to determine if an item is reparable. -+ * @return True if reparable -+ */ -+ public boolean isRepairable() -+ { -+ return canRepair && isDamageable(); -+ } -+ -+ /** -+ * Call to disable repair recipes. -+ * @return The current Item instance -+ */ -+ public Item setNoRepair() -+ { -+ canRepair = false; -+ return this; -+ } -+ -+ /** -+ * Called before a block is broken. Return true to prevent default block harvesting. -+ * -+ * Note: In SMP, this is called on both client and server sides! -+ * -+ * @param itemstack The current ItemStack -+ * @param pos Block's position in world -+ * @param player The Player that is wielding the item -+ * @return True to prevent harvesting, false to continue as normal -+ */ -+ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) -+ { -+ return false; -+ } -+ -+ /** -+ * Called each tick while using an item. -+ * @param stack The Item being used -+ * @param player The Player using the item -+ * @param count The amount of time in tick the item has been used for continuously -+ */ -+ public void onUsingTick(ItemStack stack, EntityPlayer player, int count) -+ { -+ } -+ -+ /** -+ * Called when the player Left Clicks (attacks) an entity. -+ * Processed before damage is done, if return value is true further processing is canceled -+ * and the entity is not attacked. -+ * -+ * @param stack The Item being used -+ * @param player The player that is attacking -+ * @param entity The entity being attacked -+ * @return True to cancel the rest of the interaction. -+ */ -+ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) -+ { -+ return false; -+ } -+ -+ /** -+ * Player, Render pass, and item usage sensitive version of getIconIndex. -+ * -+ * @param stack The item stack to get the icon for. -+ * @param player The player holding the item -+ * @param useRemaining The ticks remaining for the active item. -+ * @return Null to use default model, or a custom ModelResourceLocation for the stage of use. -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.resources.model.ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) -+ { -+ return null; -+ } -+ -+ /** -+ * ItemStack sensitive version of getContainerItem. -+ * Returns a full ItemStack instance of the result. -+ * -+ * @param itemStack The current ItemStack -+ * @return The resulting ItemStack -+ */ -+ public ItemStack getContainerItem(ItemStack itemStack) -+ { -+ if (!hasContainerItem(itemStack)) -+ { -+ return null; -+ } -+ return new ItemStack(getContainerItem()); -+ } -+ -+ /** -+ * ItemStack sensitive version of hasContainerItem -+ * @param stack The current item stack -+ * @return True if this item has a 'container' -+ */ -+ public boolean hasContainerItem(ItemStack stack) -+ { -+ return hasContainerItem(); -+ } -+ -+ /** -+ * Retrieves the normal 'lifespan' of this item when it is dropped on the ground as a EntityItem. -+ * This is in ticks, standard result is 6000, or 5 mins. -+ * -+ * @param itemStack The current ItemStack -+ * @param world The world the entity is in -+ * @return The normal lifespan in ticks. -+ */ -+ public int getEntityLifespan(ItemStack itemStack, World world) -+ { -+ return 6000; -+ } -+ -+ /** -+ * Determines if this Item has a special entity for when they are in the world. -+ * Is called when a EntityItem is spawned in the world, if true and Item#createCustomEntity -+ * returns non null, the EntityItem will be destroyed and the new Entity will be added to the world. -+ * -+ * @param stack The current item stack -+ * @return True of the item has a custom entity, If true, Item#createCustomEntity will be called -+ */ -+ public boolean hasCustomEntity(ItemStack stack) -+ { -+ return false; -+ } -+ -+ /** -+ * This function should return a new entity to replace the dropped item. -+ * Returning null here will not kill the EntityItem and will leave it to function normally. -+ * Called when the item it placed in a world. -+ * -+ * @param world The world object -+ * @param location The EntityItem object, useful for getting the position of the entity -+ * @param itemstack The current item stack -+ * @return A new Entity object to spawn or null -+ */ -+ public Entity createEntity(World world, Entity location, ItemStack itemstack) -+ { -+ return null; -+ } -+ -+ /** -+ * Called by the default implemetation of EntityItem's onUpdate method, allowing for cleaner -+ * control over the update of the item without having to write a subclass. -+ * -+ * @param entityItem The entity Item -+ * @return Return true to skip any further update code. -+ */ -+ public boolean onEntityItemUpdate(net.minecraft.entity.item.EntityItem entityItem) -+ { -+ return false; -+ } -+ -+ /** -+ * Gets a list of tabs that items belonging to this class can display on, -+ * combined properly with getSubItems allows for a single item to span -+ * many sub-items across many tabs. -+ * -+ * @return A list of all tabs that this item could possibly be one. -+ */ -+ public CreativeTabs[] getCreativeTabs() -+ { -+ return new CreativeTabs[]{ getCreativeTab() }; -+ } -+ -+ /** -+ * Determines the base experience for a player when they remove this item from a furnace slot. -+ * This number must be between 0 and 1 for it to be valid. -+ * This number will be multiplied by the stack size to get the total experience. -+ * -+ * @param item The item stack the player is picking up. -+ * @return The amount to award for each item. -+ */ -+ public float getSmeltingExperience(ItemStack item) -+ { -+ return -1; //-1 will default to the old lookups. -+ } -+ -+ /** -+ * Return the correct icon for rendering based on the supplied ItemStack and render pass. -+ * -+ * Defers to {@link #getIconFromDamageForRenderPass(int, int)} -+ * @param stack to render for -+ * @param pass the multi-render pass -+ * @return the icon -+ * / -+ public IIcon getIcon(ItemStack stack, int pass) -+ { -+ return func_77618_c(stack.getMetadata(), pass); -+ } -+ */ -+ -+ /** -+ * Generates the base Random item for a specific instance of the chest gen, -+ * Enchanted books use this to pick a random enchantment. -+ * -+ * @param chest The chest category to generate for -+ * @param rnd World RNG -+ * @param original Original result registered with the chest gen hooks. -+ * @return New values to use as the random item, typically this will be original -+ */ -+ public net.minecraft.util.WeightedRandomChestContent getChestGenBase(net.minecraftforge.common.ChestGenHooks chest, Random rnd, net.minecraft.util.WeightedRandomChestContent original) -+ { -+ if (this instanceof ItemEnchantedBook) -+ { -+ return ((ItemEnchantedBook)this).getRandom(rnd, -+ original.minStackSize, -+ original.maxStackSize, original.itemWeight); -+ } -+ return original; -+ } -+ -+ /** -+ * -+ * Should this item, when held, allow sneak-clicks to pass through to the underlying block? -+ * -+ * @param world The world -+ * @param pos Block position in world -+ * @param player The Player that is wielding the item -+ * @return -+ */ -+ public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player) -+ { -+ return false; -+ } -+ -+ /** -+ * Called to tick armor in the armor slot. Override to do something -+ */ -+ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack){} -+ -+ /** -+ * Determines if the specific ItemStack can be placed in the specified armor slot. -+ * -+ * @param stack The ItemStack -+ * @param armorType Armor slot ID: 0: Helmet, 1: Chest, 2: Legs, 3: Boots -+ * @param entity The entity trying to equip the armor -+ * @return True if the given ItemStack can be inserted in the slot -+ */ -+ public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) -+ { -+ if (this instanceof ItemArmor) -+ { -+ return ((ItemArmor)this).armorType == armorType; -+ } -+ -+ if (armorType == 0) -+ { -+ return this == Item.getItemFromBlock(Blocks.pumpkin) || this == Items.skull; -+ } -+ -+ return false; -+ } -+ -+ /** -+ * Allow or forbid the specific book/item combination as an anvil enchant -+ * -+ * @param stack The item -+ * @param book The book -+ * @return if the enchantment is allowed -+ */ -+ public boolean isBookEnchantable(ItemStack stack, ItemStack book) -+ { -+ return true; -+ } -+ -+ /** -+ * Called by RenderBiped and RenderPlayer to determine the armor texture that -+ * should be use for the currently equipped item. -+ * This will only be called on instances of ItemArmor. -+ * -+ * Returning null from this function will use the default value. -+ * -+ * @param stack ItemStack for the equipped armor -+ * @param entity The entity wearing the armor -+ * @param slot The slot the armor is in -+ * @param type The subtype, can be null or "overlay" -+ * @return Path of texture to bind, or null to use default -+ */ -+ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) -+ { -+ return null; -+ } -+ -+ /** -+ * Returns the font renderer used to render tooltips and overlays for this item. -+ * Returning null will use the standard font renderer. -+ * -+ * @param stack The current item stack -+ * @return A instance of FontRenderer or null to use default -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack) -+ { -+ return null; -+ } -+ -+ /** -+ * @deprecated Use 4-argument version. -+ */ -+ // remove 1.9 -+ @SideOnly(Side.CLIENT) -+ @Deprecated -+ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) -+ { -+ return null; -+ } -+ -+ /** -+ * Override this method to have an item handle its own armor rendering. -+ * -+ * @param entityLiving The entity wearing the armor -+ * @param itemStack The itemStack to render the model of -+ * @param armorSlot 0=head, 1=torso, 2=legs, 3=feet -+ * @param _default Original armor model. Will have attributes set. -+ * @return A ModelBiped to render instead of the default -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot, net.minecraft.client.model.ModelBiped _default) -+ { -+ return getArmorModel(entityLiving, itemStack, armorSlot); -+ } -+ -+ /** -+ * Called when a entity tries to play the 'swing' animation. -+ * -+ * @param entityLiving The entity swinging the item. -+ * @param stack The Item stack -+ * @return True to cancel any further processing by EntityLiving -+ */ -+ public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) -+ { -+ return false; -+ } -+ -+ /** -+ * Called when the client starts rendering the HUD, for whatever item the player currently has as a helmet. -+ * This is where pumpkins would render there overlay. -+ * -+ * @param stack The ItemStack that is equipped -+ * @param player Reference to the current client entity -+ * @param resolution Resolution information about the current viewport and configured GUI Scale -+ * @param partialTicks Partial ticks for the renderer, useful for interpolation -+ */ -+ @SideOnly(Side.CLIENT) -+ public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, net.minecraft.client.gui.ScaledResolution resolution, float partialTicks){} -+ -+ /** -+ * Return the itemDamage represented by this ItemStack. Defaults to the itemDamage field on ItemStack, but can be overridden here for other sources such as NBT. -+ * -+ * @param stack The itemstack that is damaged -+ * @return the damage value -+ */ -+ public int getDamage(ItemStack stack) -+ { -+ return stack.itemDamage; -+ } -+ -+ /** -+ * This used to be 'display damage' but its really just 'aux' data in the ItemStack, usually shares the same variable as damage. -+ * @param stack -+ * @return -+ */ -+ public int getMetadata(ItemStack stack) -+ { -+ return stack.itemDamage; -+ } -+ -+ /** -+ * Determines if the durability bar should be rendered for this item. -+ * Defaults to vanilla stack.isDamaged behavior. -+ * But modders can use this for any data they wish. -+ * -+ * @param stack The current Item Stack -+ * @return True if it should render the 'durability' bar. -+ */ -+ public boolean showDurabilityBar(ItemStack stack) -+ { -+ return stack.isItemDamaged(); -+ } -+ -+ /** -+ * Queries the percentage of the 'Durability' bar that should be drawn. -+ * -+ * @param stack The current ItemStack -+ * @return 1.0 for 100% 0 for 0% -+ */ -+ public double getDurabilityForDisplay(ItemStack stack) -+ { -+ return (double)stack.getItemDamage() / (double)stack.getMaxDamage(); -+ } -+ -+ /** -+ * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item, -+ * but can be overridden here for other sources such as NBT. -+ * -+ * @param stack The itemstack that is damaged -+ * @return the damage value -+ */ -+ public int getMaxDamage(ItemStack stack) -+ { -+ return getMaxDamage(); -+ } -+ -+ /** -+ * Return if this itemstack is damaged. Note only called if {@link #isDamageable()} is true. -+ * @param stack the stack -+ * @return if the stack is damaged -+ */ -+ public boolean isDamaged(ItemStack stack) -+ { -+ return stack.itemDamage > 0; -+ } -+ -+ /** -+ * Set the damage for this itemstack. Note, this method is responsible for zero checking. -+ * @param stack the stack -+ * @param damage the new damage value -+ */ -+ public void setDamage(ItemStack stack, int damage) -+ { -+ stack.itemDamage = damage; -+ -+ if (stack.itemDamage < 0) -+ { -+ stack.itemDamage = 0; -+ } -+ } -+ -+ /** -+ * ItemStack sensitive version of {@link #canHarvestBlock(Block)} -+ * @param par1Block The block trying to harvest -+ * @param itemStack The itemstack used to harvest the block -+ * @return true if can harvest the block -+ */ -+ public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) -+ { -+ return canHarvestBlock(par1Block); -+ } -+ -+ /** -+ * Gets the maximum number of items that this stack should be able to hold. -+ * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit() -+ * -+ * @param stack The ItemStack -+ * @return THe maximum number this item can be stacked to -+ */ -+ public int getItemStackLimit(ItemStack stack) -+ { -+ return this.getItemStackLimit(); -+ } -+ -+ private java.util.Map toolClasses = new java.util.HashMap(); -+ /** -+ * Sets or removes the harvest level for the specified tool class. -+ * -+ * @param toolClass Class -+ * @param level Harvest level: -+ * Wood: 0 -+ * Stone: 1 -+ * Iron: 2 -+ * Diamond: 3 -+ * Gold: 0 -+ */ -+ public void setHarvestLevel(String toolClass, int level) -+ { -+ if (level < 0) -+ toolClasses.remove(toolClass); -+ else -+ toolClasses.put(toolClass, level); -+ } -+ -+ public java.util.Set getToolClasses(ItemStack stack) -+ { -+ return toolClasses.keySet(); -+ } -+ -+ /** -+ * Queries the harvest level of this item stack for the specifred tool class, -+ * Returns -1 if this tool is not of the specified type -+ * -+ * @param stack This item stack instance -+ * @param toolClass Tool Class -+ * @return Harvest level, or -1 if not the specified tool type. -+ */ -+ public int getHarvestLevel(ItemStack stack, String toolClass) -+ { -+ Integer ret = toolClasses.get(toolClass); -+ return ret == null ? -1 : ret; -+ } -+ -+ /** -+ * ItemStack sensitive version of getItemEnchantability -+ * -+ * @param stack The ItemStack -+ * @return the item echantability value -+ */ -+ public int getItemEnchantability(ItemStack stack) -+ { -+ return getItemEnchantability(); -+ } -+ -+ /** -+ * Whether this Item can be used as a payment to activate the vanilla beacon. -+ * @param stack the ItemStack -+ * @return true if this Item can be used -+ */ -+ public boolean isBeaconPayment(ItemStack stack) -+ { -+ return this == Items.emerald || this == Items.diamond || this == Items.gold_ingot || this == Items.iron_ingot; -+ } -+ -+ -+ /** -+ * Determine if the player switching between these two item stacks -+ * @param oldStack The old stack that was equipped -+ * @param newStack The new stack -+ * @param slotChanged If the current equipped slot was changed, -+ * Vanilla does not play the animation if you switch between two -+ * slots that hold the exact same item. -+ * @return True to play the item change animation -+ */ -+ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) -+ { -+ return !ItemStack.areItemStacksEqual(oldStack, newStack); -+ } -+ -+ -+ private ResourceLocation registryName = null; -+ /** -+ * Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item. -+ * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. -+ * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. -+ * -+ * The supplied name will be prefixed with the currently active mod's modId. -+ * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. -+ * -+ * If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown. -+ * -+ * Returns 'this' to allow for chaining. -+ * -+ * @param name Unique registry name -+ * @return This instance -+ */ -+ public final Item setRegistryName(String name) -+ { -+ if (getRegistryName() != null) -+ throw new IllegalStateException("Attempted to set registry name on block with exisiting registry name! New: " + name + " Old: " + getRegistryName()); -+ int index = name.lastIndexOf(':'); -+ String oldPrefix = index == -1 ? "" : name.substring(0, index); -+ name = index == -1 ? name : name.substring(index + 1); -+ net.minecraftforge.fml.common.ModContainer mc = net.minecraftforge.fml.common.Loader.instance().activeModContainer(); -+ String prefix = mc == null ? "minecraft" : mc.getModId(); -+ if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) -+ { -+ net.minecraftforge.fml.common.FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name); -+ prefix = oldPrefix; -+ } -+ this.registryName = new ResourceLocation(prefix, name); -+ return this; -+ } -+ public final Item setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); } -+ public final Item setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); } -+ -+ /** -+ * A unique identifier for this block, if this block is registered in the game registry it will return that name. -+ * Otherwise it will return the name set in setRegistryName(). -+ * If neither are valid null is returned. -+ * -+ * @return Unique identifier or null. -+ */ -+ public final String getRegistryName() -+ { -+ if (delegate.getResourceName() != null) return delegate.getResourceName().toString(); -+ return registryName != null ? registryName.toString() : null; -+ } -+ -+ /** -+ * Called from ItemStack.setItem, will hold extra data for the life of this ItemStack. -+ * Can be retrieved from stack.getCapabilities() -+ * The NBT can be null if this is not called from readNBT or if the item the stack is -+ * changing FROM is different then this item, or the previous item had no capabilities. -+ * -+ * This is called BEFORE the stacks item is set so you can use stack.getItem() to see the OLD item. -+ * Remember that getItem CAN return null. -+ * -+ * @param stack The ItemStack -+ * @param nbt NBT of this item serialized, or null. -+ * @return A holder instance associated with this ItemStack where you can hold capabilities for the life of this item. -+ */ -+ public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) -+ { -+ return null; -+ } -+ /* ======================================== FORGE END =====================================*/ -+ - public static void registerItems() - { - registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() -++++ END PATCH -++++ REJECTED PATCH 9 - return this.enchantability; - } - -+ @Deprecated // Use getRepairItemStack below - public Item getRepairItem() - { -- return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null)))); -+ switch (this) -+ { -+ case WOOD: return Item.getItemFromBlock(Blocks.planks); -+ case STONE: return Item.getItemFromBlock(Blocks.cobblestone); -+ case GOLD: return Items.gold_ingot; -+ case IRON: return Items.iron_ingot; -+ case EMERALD: return Items.diamond; -+ default: return customCraftingMaterial; -+ } - } -+ -+ public ToolMaterial setRepairItem(ItemStack stack) -+ { -+ if (this.repairMaterial != null || customCraftingMaterial != null) throw new RuntimeException("Can not change already set repair material"); -+ if (this == WOOD || this == STONE || this == GOLD || this == IRON || this == EMERALD) throw new RuntimeException("Can not change vanilla tool repair materials"); -+ this.repairMaterial = stack; -+ this.customCraftingMaterial = stack.getItem(); -+ return this; -+ } -+ -+ public ItemStack getRepairItemStack() -+ { -+ if (repairMaterial != null) return repairMaterial; -+ Item ret = this.getRepairItem(); -+ if (ret == null) return null; -+ repairMaterial = new ItemStack(ret, 1, net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE); -+ return repairMaterial; -+ } - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemArmor.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemArmor.java.patch.rej deleted file mode 100644 index 673c164bcd..0000000000 --- a/rejects/minecraft/net/minecraft/item/ItemArmor.java.patch.rej +++ /dev/null @@ -1,31 +0,0 @@ -++++ REJECTED PATCH 1 - if (list.size() > 0) - { - EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0); -- int l = entitylivingbase instanceof EntityPlayer ? 1 : 0; -+ int l = 0;// Forge: We fix the indexes. Mojang Stop hard coding this! - int i1 = EntityLiving.getArmorPosition(stack); - ItemStack itemstack = stack.copy(); - itemstack.stackSize = 1; -++++ END PATCH -++++ REJECTED PATCH 2 - - if (itemstack == null) - { -- playerIn.setCurrentItemOrArmor(i, itemStackIn.copy()); -+ playerIn.setCurrentItemOrArmor(i + 1, itemStackIn.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. - itemStackIn.stackSize = 0; - } - -++++ END PATCH -++++ REJECTED PATCH 3 - private final int[] damageReductionAmountArray; - private final int enchantability; - -+ //Added by forge for custom Armor materials. -+ public Item customCraftingMaterial = null; -+ - private ArmorMaterial(String name, int maxDamage, int[] reductionAmounts, int enchantability) - { - this.name = name; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej deleted file mode 100644 index 76da5c69d8..0000000000 --- a/rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej +++ /dev/null @@ -1,19 +0,0 @@ -++++ REJECTED PATCH 1 - int i = this.getMetadata(stack.getMetadata()); - IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn); - -- if (worldIn.setBlockState(pos, iblockstate1, 3)) -+ if (placeBlockAt(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ, iblockstate1)) - { -- iblockstate1 = worldIn.getBlockState(pos); -- -- if (iblockstate1.getBlock() == this.block) -- { -- setTileEntityNBT(worldIn, playerIn, pos, stack); -- this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); -- } -- - worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F); - --stack.stackSize; - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej deleted file mode 100644 index 14823bc8a5..0000000000 --- a/rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej +++ /dev/null @@ -1,22 +0,0 @@ -++++ REJECTED PATCH 1 - if (flag || playerIn.inventory.hasItem(Items.arrow)) - { - int i = this.getMaxItemUseDuration(stack) - timeLeft; -+ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, stack, i); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; -+ i = event.charge; - float f = (float)i / 20.0F; - f = (f * f + f * 2.0F) / 3.0F; - -++++ END PATCH -++++ REJECTED PATCH 2 - - public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) - { -+ net.minecraftforge.event.entity.player.ArrowNockEvent event = new net.minecraftforge.event.entity.player.ArrowNockEvent(playerIn, itemStackIn); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return event.result; -+ - if (playerIn.capabilities.isCreativeMode || playerIn.inventory.hasItem(Items.arrow)) - { - playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemBucket.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemBucket.java.patch.rej deleted file mode 100644 index 57675df4f0..0000000000 --- a/rejects/minecraft/net/minecraft/item/ItemBucket.java.patch.rej +++ /dev/null @@ -1,11 +0,0 @@ -++++ REJECTED PATCH 1 - } - else - { -+ ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(playerIn, worldIn, itemStackIn, movingobjectposition); -+ if (ret != null) return ret; -+ - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - BlockPos blockpos = movingobjectposition.getBlockPos(); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemDye.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemDye.java.patch.rej deleted file mode 100644 index 9932bf9705..0000000000 --- a/rejects/minecraft/net/minecraft/item/ItemDye.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 3 - - Block block = worldIn.getBlockState(pos).getBlock(); - -- if (block.getMaterial() != Material.air) -+ if (block.isAir(worldIn, pos)) - { - block.setBlockBoundsBasedOnState(worldIn, pos); - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemEmptyMap.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemEmptyMap.java.patch.rej deleted file mode 100644 index 350f0c56c8..0000000000 --- a/rejects/minecraft/net/minecraft/item/ItemEmptyMap.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - worldIn.setItemData(s, mapdata); - mapdata.scale = 0; - mapdata.calculateMapCenter(playerIn.posX, playerIn.posZ, mapdata.scale); -- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); -+ mapdata.dimension = worldIn.provider.getDimensionId(); - mapdata.markDirty(); - --itemStackIn.stackSize; - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch.rej deleted file mode 100644 index dbdf005803..0000000000 --- a/rejects/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - } - else - { -- if (worldIn.getBlockState(pos).getBlock().getMaterial() == Material.air) -+ if (worldIn.isAirBlock(pos)) - { - worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - worldIn.setBlockState(pos, Blocks.fire.getDefaultState()); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemHoe.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemHoe.java.patch.rej deleted file mode 100644 index dc31908b5b..0000000000 --- a/rejects/minecraft/net/minecraft/item/ItemHoe.java.patch.rej +++ /dev/null @@ -1,16 +0,0 @@ -++++ REJECTED PATCH 1 - } - else - { -+ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, playerIn, worldIn, pos); -+ if (hook != 0) return hook > 0; -+ - IBlockState iblockstate = worldIn.getBlockState(pos); - Block block = iblockstate.getBlock(); - -- if (side != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).getBlock().getMaterial() == Material.air) -+ if (side != EnumFacing.DOWN && worldIn.isAirBlock(pos.up())) - { - if (block == Blocks.grass) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej deleted file mode 100644 index cf591e4eb8..0000000000 --- a/rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej +++ /dev/null @@ -1,88 +0,0 @@ -++++ REJECTED PATCH 1 - public String getItemStackDisplayName(ItemStack stack) - { - String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); -- String s1 = EntityList.getStringFromID(stack.getMetadata()); -+ String s1 = ItemMonsterPlacer.getEntityName(stack); - - if (s1 != null) - { -++++ END PATCH -++++ REJECTED PATCH 2 - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int renderPass) - { -- EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(stack.getMetadata())); -+ EntityList.EntityEggInfo entitylist$entityegginfo = ItemMonsterPlacer.getEggInfo(stack); - return entitylist$entityegginfo != null ? (renderPass == 0 ? entitylist$entityegginfo.primaryColor : entitylist$entityegginfo.secondaryColor) : 16777215; - } - -++++ END PATCH -++++ REJECTED PATCH 3 - if (tileentity instanceof TileEntityMobSpawner) - { - MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic(); -- mobspawnerbaselogic.setEntityName(EntityList.getStringFromID(stack.getMetadata())); -+ mobspawnerbaselogic.setEntityName(ItemMonsterPlacer.getEntityName(stack)); - tileentity.markDirty(); - worldIn.markBlockForUpdate(pos); - -++++ END PATCH -++++ REJECTED PATCH 4 - pos = pos.offset(side); - double d0 = 0.0D; - -- if (side == EnumFacing.UP && iblockstate instanceof BlockFence) -+ if (side == EnumFacing.UP && iblockstate.getBlock() instanceof BlockFence) //Forge: Fix Vanilla bug comparing state instead of block - { - d0 = 0.5D; - } - -- Entity entity = spawnCreature(worldIn, stack.getMetadata(), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); -+ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(stack), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); - - if (entity != null) - { -++++ END PATCH -++++ REJECTED PATCH 5 - - if (worldIn.getBlockState(blockpos).getBlock() instanceof BlockLiquid) - { -- Entity entity = spawnCreature(worldIn, itemStackIn.getMetadata(), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); -+ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(itemStackIn), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); - - if (entity != null) - { -++++ END PATCH -++++ REJECTED PATCH 6 - } - } - -+ @Deprecated // Use string version below. - public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z) - { - if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID))) - { - return null; - } -+ return spawnCreature(worldIn, EntityList.getStringFromID(entityID), x, y, z); -+ } -+ -+ public static Entity spawnCreature(World worldIn, String name, double x, double y, double z) -+ { -+ if (!EntityList.stringToClassMapping.containsKey(name)) -+ { -+ return null; -+ } - else - { - Entity entity = null; - - for (int i = 0; i < 1; ++i) - { -- entity = EntityList.createEntityByID(entityID, worldIn); -+ entity = EntityList.createEntityByName(name, worldIn); - - if (entity instanceof EntityLivingBase) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemSeedFood.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemSeedFood.java.patch.rej deleted file mode 100644 index 7002a40326..0000000000 --- a/rejects/minecraft/net/minecraft/item/ItemSeedFood.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 2 - { - return false; - } -- else if (worldIn.getBlockState(pos).getBlock() == this.soilId && worldIn.isAirBlock(pos.up())) -+ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) - { - worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); - --stack.stackSize; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemSeeds.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemSeeds.java.patch.rej deleted file mode 100644 index 3476adb20e..0000000000 --- a/rejects/minecraft/net/minecraft/item/ItemSeeds.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 2 - { - return false; - } -- else if (worldIn.getBlockState(pos).getBlock() == this.soilBlockID && worldIn.isAirBlock(pos.up())) -+ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) - { - worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); - --stack.stackSize; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemShears.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemShears.java.patch.rej deleted file mode 100644 index 6a6935ec60..0000000000 --- a/rejects/minecraft/net/minecraft/item/ItemShears.java.patch.rej +++ /dev/null @@ -1,16 +0,0 @@ -++++ REJECTED PATCH 1 - - public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) - { -- if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool) -+ if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool && !(blockIn instanceof net.minecraftforge.common.IShearable)) - { - return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn); - } - else - { -- stack.damageItem(1, playerIn); - return true; - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemSkull.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemSkull.java.patch.rej deleted file mode 100644 index c1aa019c08..0000000000 --- a/rejects/minecraft/net/minecraft/item/ItemSkull.java.patch.rej +++ /dev/null @@ -1,32 +0,0 @@ -++++ REJECTED PATCH 1 - - public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) - { -+ if (worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && side != EnumFacing.DOWN) -+ { -+ side = EnumFacing.UP; -+ pos = pos.down(); -+ } - if (side == EnumFacing.DOWN) - { - return false; -++++ END PATCH -++++ REJECTED PATCH 2 - - if (!flag) - { -- if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid()) -+ if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid() && !worldIn.isSideSolid(pos, side, true)) - { - return false; - } -++++ END PATCH -++++ REJECTED PATCH 3 - { - if (!worldIn.isRemote) - { -+ if (!Blocks.skull.canPlaceBlockOnSide(worldIn, pos, side)) return false; - worldIn.setBlockState(pos, Blocks.skull.getDefaultState().withProperty(BlockSkull.FACING, side), 3); - int i = 0; - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej deleted file mode 100644 index 3a104b0874..0000000000 --- a/rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej +++ /dev/null @@ -1,101 +0,0 @@ -++++ REJECTED PATCH 4 - - public ItemStack splitStack(int amount) - { -- ItemStack itemstack = new ItemStack(this.item, amount, this.itemDamage); -+ ItemStack itemstack = new ItemStack(this.item, amount, this.itemDamage, this.capabilities != null ? this.capabilities.serializeNBT() : null); - - if (this.stackTagCompound != null) - { -++++ END PATCH -++++ REJECTED PATCH 5 - - public Item getItem() - { -- return this.item; -+ return this.delegate != null ? this.delegate.get() : null; - } - - public boolean onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) - { -+ if (!worldIn.isRemote) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); - boolean flag = this.getItem().onItemUse(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); - - if (flag) -++++ END PATCH -++++ REJECTED PATCH 6 - nbt.setTag("tag", this.stackTagCompound); - } - -+ if (this.capabilities != null) nbt.setTag("ForgeCaps", this.capabilities.serializeNBT()); -+ - return nbt; - } - - public void readFromNBT(NBTTagCompound nbt) - { -+ this.capNBT = nbt.hasKey("ForgeCaps") ? nbt.getCompoundTag("ForgeCaps") : null; - if (nbt.hasKey("id", 8)) - { -- this.item = Item.getByNameOrId(nbt.getString("id")); -+ this.setItem(Item.getByNameOrId(nbt.getString("id"))); - } - else - { -- this.item = Item.getItemById(nbt.getShort("id")); -+ this.setItem(Item.getItemById(nbt.getShort("id"))); - } -+ this.capNBT = null; - - this.stackSize = nbt.getByte("Count"); - this.itemDamage = nbt.getShort("Damage"); -++++ END PATCH -++++ REJECTED PATCH 9 - - public boolean isItemDamaged() - { -- return this.isItemStackDamageable() && this.itemDamage > 0; -+ return this.isItemStackDamageable() && getItem().isDamaged(this); - } - - public int getItemDamage() - { -- return this.itemDamage; -+ return getItem().getDamage(this); - } - - public int getMetadata() - { -- return this.itemDamage; -+ return getItem().getMetadata(this); - } - - public void setItemDamage(int meta) - { -- this.itemDamage = meta; -- -- if (this.itemDamage < 0) -- { -- this.itemDamage = 0; -- } -+ getItem().setDamage(this, meta); - } - - public int getMaxDamage() - { -- return this.item.getMaxDamage(); -+ return this.item.getMaxDamage(this); - } - - public boolean attemptDamageItem(int amount, Random rand) -++++ END PATCH -++++ REJECTED PATCH 14 - } - else - { -- multimap = this.getItem().getItemAttributeModifiers(); -+ multimap = this.getItem().getAttributeModifiers(this); - } - - return multimap; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch.rej b/rejects/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch.rej deleted file mode 100644 index 6d8531c1bb..0000000000 --- a/rejects/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch.rej +++ /dev/null @@ -1,129 +0,0 @@ -++++ REJECTED PATCH 1 - this.playerEntity.ridingEntity.updateRiderPosition(); - } - -+ if (!this.hasMoved) return; //Fixes teleportation kick while riding entities -+ - this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); - - if (this.playerEntity.ridingEntity != null) -++++ END PATCH -++++ REJECTED PATCH 2 - this.playerEntity.jump(); - } - -+ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving -+ - this.playerEntity.moveEntity(d11, d12, d13); - this.playerEntity.onGround = packetIn.isOnGround(); - d11 = d8 - this.playerEntity.posX; -++++ END PATCH -++++ REJECTED PATCH 3 - logger.warn(this.playerEntity.getName() + " moved wrongly!"); - } - -+ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving -+ - this.playerEntity.setPositionAndRotation(d8, d9, d10, f1, f2); - this.playerEntity.addMovementStat(this.playerEntity.posX - d0, this.playerEntity.posY - d1, this.playerEntity.posZ - d2); - -++++ END PATCH -++++ REJECTED PATCH 4 - { - boolean flag2 = worldserver.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.getEntityBoundingBox().contract((double)f3, (double)f3, (double)f3)).isEmpty(); - -- if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping()) -+ if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping() && !this.playerEntity.noClip) - { - this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, f1, f2); - return; -++++ END PATCH -++++ REJECTED PATCH 5 - this.floatingTickCount = 0; - } - -+ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving -+ - this.playerEntity.onGround = packetIn.isOnGround(); - this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); - this.playerEntity.handleFalling(this.playerEntity.posY - d7, packetIn.isOnGround()); -++++ END PATCH -++++ REJECTED PATCH 7 - WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); - ItemStack itemstack = this.playerEntity.inventory.getCurrentItem(); - boolean flag = false; -+ boolean placeResult = true; - BlockPos blockpos = packetIn.getPosition(); - EnumFacing enumfacing = EnumFacing.getFront(packetIn.getPlacedBlockDirection()); - this.playerEntity.markPlayerActive(); -++++ END PATCH -++++ REJECTED PATCH 8 - return; - } - -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(playerEntity, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, worldserver, new BlockPos(0, 0, 0), null, new net.minecraft.util.Vec3(packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ())); -+ if (event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { - this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack); -+ } - } - else if (blockpos.getY() < this.serverController.getBuildLimit() - 1 || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit()) - { -- if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < 64.0D && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) -+ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 3; -+ dist *= dist; -+ if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < dist && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) - { -- this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); -+ // record block place result so we can update client itemstack size if place event was cancelled. -+ placeResult = this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); - } - - flag = true; -++++ END PATCH -++++ REJECTED PATCH 9 - this.playerEntity.isChangingQuantityOnly = true; - this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = ItemStack.copyItemStack(this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem]); - Slot slot = this.playerEntity.openContainer.getSlotFromInventory(this.playerEntity.inventory, this.playerEntity.inventory.currentItem); -+ int windowId = this.playerEntity.openContainer.windowId; -+ if (slot == null) // Forge: Fix 'slotless' inventories not selecting a valid slot to update -+ { -+ slot = this.playerEntity.inventoryContainer.getSlotFromInventory(this.playerEntity.inventory, this.playerEntity.inventory.currentItem); -+ windowId = this.playerEntity.inventoryContainer.windowId; -+ } - this.playerEntity.openContainer.detectAndSendChanges(); - this.playerEntity.isChangingQuantityOnly = false; - -- if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack())) -+ if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack()) || !placeResult) // force client itemstack update if place event was cancelled - { -- this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); -+ this.sendPacket(new S2FPacketSetSlot(windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); - } - } - } -++++ END PATCH -++++ REJECTED PATCH 10 - } - else - { -- IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.text", new Object[] {this.playerEntity.getDisplayName(), s}); -- this.serverController.getConfigurationManager().sendChatMsgImpl(ichatcomponent, false); -+ ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", this.playerEntity.getDisplayName(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s)); -+ IChatComponent chat = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, chatcomponenttranslation1); -+ if (chat == null) return; -+ this.serverController.getConfigurationManager().sendChatMsgImpl(chat, false); - } - - this.chatSpamThresholdCount += 20; -++++ END PATCH -++++ REJECTED PATCH 11 - return; - } - -- this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, 0, false); -+ this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, playerEntity.dimension, false); - } - - break; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej b/rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej deleted file mode 100644 index faf51ffc77..0000000000 --- a/rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - - public void writePacketData(PacketBuffer buf) throws IOException - { -- buf.writeString(GSON.toJson((Object)this.response)); -+ buf.writeString(this.response.getJson()); - } - - public void processPacket(INetHandlerStatusClient handler) -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 28f7a00192..2b7c2fcfde 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -52,9 +52,15 @@ import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityNote; import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.WeightedRandom; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.event.ClickEvent; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraft.world.WorldSettings; @@ -540,14 +546,14 @@ public class ForgeHooks } @SuppressWarnings("deprecation") - public static ChatComponentTranslation onServerChatEvent(NetHandlerPlayServer net, String raw, ChatComponentTranslation comp) + public static ITextComponent onServerChatEvent(NetHandlerPlayServer net, String raw, ITextComponent comp) { ServerChatEvent event = new ServerChatEvent(net.playerEntity, raw, comp); if (MinecraftForge.EVENT_BUS.post(event)) { return null; } - return event.component; + return event.getComponent(); } @@ -614,7 +620,7 @@ public class ForgeHooks ClickEvent click = new ClickEvent(ClickEvent.Action.OPEN_URL, url); link.getChatStyle().setChatClickEvent(click); link.getChatStyle().setUnderlined(true); - link.getChatStyle().setColor(EnumChatFormatting.BLUE); + link.getChatStyle().setColor(TextFormatting.BLUE); if (ichat == null) ichat = link; else @@ -691,7 +697,7 @@ public class ForgeHooks return event.isCanceled() ? -1 : event.getExpToDrop(); } - public static boolean onPlaceItemIntoWorld(ItemStack itemstack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + public static EnumActionResult onPlaceItemIntoWorld(ItemStack itemstack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { // handle all placement events here int meta = itemstack.getItemDamage(); @@ -707,10 +713,10 @@ public class ForgeHooks world.captureBlockSnapshots = true; } - boolean flag = itemstack.getItem().onItemUse(itemstack, player, world, pos, side, hitX, hitY, hitZ); + EnumActionResult ret = itemstack.getItem().onItemUse(itemstack, player, world, pos, hand, side, hitX, hitY, hitZ); world.captureBlockSnapshots = false; - if (flag) + if (ret == EnumActionResult.SUCCESS) { // save new item data int newMeta = itemstack.getItemDamage(); @@ -743,7 +749,7 @@ public class ForgeHooks if (placeEvent != null && (placeEvent.isCanceled())) { - flag = false; // cancel placement + ret = EnumActionResult.FAIL; // cancel placement // revert back all captured blocks for (net.minecraftforge.common.util.BlockSnapshot blocksnapshot : blockSnapshots) { @@ -774,12 +780,12 @@ public class ForgeHooks world.markAndNotifyBlock(snap.pos, null, oldBlock, newBlock, updateFlag); } - player.addStat(StatList.objectUseStats[Item.getIdFromItem(itemstack.getItem())], 1); + player.triggerAchievement(StatList.func_188060_a(itemstack.getItem())); } } world.capturedBlockSnapshots.clear(); - return flag; + return ret; } public static boolean onAnvilChange(ContainerRepair container, ItemStack left, ItemStack right, IInventory outputSlot, String name, int baseCost) diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index 7bd4d80b96..b1c7ecfa07 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -16,10 +16,13 @@ import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer.EnumStatus; import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ActionResult; import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; @@ -52,6 +55,8 @@ import net.minecraftforge.event.entity.living.LivingPackSizeEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent.AllowDespawn; import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent; +import net.minecraftforge.event.entity.player.ArrowLooseEvent; +import net.minecraftforge.event.entity.player.ArrowNockEvent; import net.minecraftforge.event.entity.player.BonemealEvent; import net.minecraftforge.event.entity.player.EntityInteractEvent; import net.minecraftforge.event.entity.player.EntityItemPickupEvent; @@ -297,23 +302,23 @@ public class ForgeEventFactory return 0; } - public static ItemStack onBucketUse(EntityPlayer player, World world, ItemStack stack, RayTraceResult target) + public static ActionResult onBucketUse(EntityPlayer player, World world, ItemStack stack, RayTraceResult target) { FillBucketEvent event = new FillBucketEvent(player, stack, world, target); - if (MinecraftForge.EVENT_BUS.post(event)) return stack; + if (MinecraftForge.EVENT_BUS.post(event)) return new ActionResult(EnumActionResult.FAIL, stack); if (event.getResult() == Result.ALLOW) { if (player.capabilities.isCreativeMode) - return stack; + return new ActionResult(EnumActionResult.SUCCESS, stack); if (--stack.stackSize <= 0) - return event.getFilledBucket(); + return new ActionResult(EnumActionResult.SUCCESS, event.getFilledBucket()); if (!player.inventory.addItemStackToInventory(event.getFilledBucket())) player.dropPlayerItemWithRandomChoice(event.getFilledBucket(), false); - return stack; + return new ActionResult(EnumActionResult.SUCCESS, stack); } return null; } @@ -521,4 +526,20 @@ public class ForgeEventFactory return canContinueSleep == Result.ALLOW; } + public static ActionResult onArrowNock(ItemStack item, World world, EntityPlayer player, EnumHand hand, boolean hasAmmo) + { + ArrowNockEvent event = new ArrowNockEvent(player, item, hand, world, hasAmmo); + if (MinecraftForge.EVENT_BUS.post(event)) + return new ActionResult(EnumActionResult.FAIL, item); + return event.getAction(); + } + + public static int onArrowLoose(ItemStack stack, World world, EntityPlayer player, int charge, boolean hasAmmo) + { + ArrowLooseEvent event = new ArrowLooseEvent(player, stack, world, charge, hasAmmo); + if (MinecraftForge.EVENT_BUS.post(event)) + return -1; + return event.getCharge(); + } + } diff --git a/src/main/java/net/minecraftforge/event/entity/player/ArrowLooseEvent.java b/src/main/java/net/minecraftforge/event/entity/player/ArrowLooseEvent.java index 9d3e4e9b25..1e8a01cd94 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/ArrowLooseEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/ArrowLooseEvent.java @@ -3,6 +3,7 @@ package net.minecraftforge.event.entity.player; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.world.World; /** * ArrowLooseEvent is fired when a player stops using a bow.
@@ -22,13 +23,22 @@ import net.minecraft.item.ItemStack; @Cancelable public class ArrowLooseEvent extends PlayerEvent { - public final ItemStack bow; - public int charge; - - public ArrowLooseEvent(EntityPlayer player, ItemStack bow, int charge) + private final ItemStack bow; + private final World world; + private final boolean hasAmmo; + private int charge; + + public ArrowLooseEvent(EntityPlayer player, ItemStack bow, World world, int charge, boolean hasAmmo) { super(player); this.bow = bow; + this.world = world; this.charge = charge; + this.hasAmmo = hasAmmo; } + + public ItemStack getBow() { return this.bow; } + public boolean hasAmmo() { return this.hasAmmo; } + public int getCharge() { return this.charge; } + public void setCharge(int charge) { this.charge = charge; } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/ArrowNockEvent.java b/src/main/java/net/minecraftforge/event/entity/player/ArrowNockEvent.java index 1ff04fa732..4e73c4fc83 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/ArrowNockEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/ArrowNockEvent.java @@ -1,31 +1,45 @@ package net.minecraftforge.event.entity.player; -import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumHand; +import net.minecraft.world.World; /** * ArrowNockEvent is fired when a player begins using a bow.
* This event is fired whenever a player begins using a bow in * ItemBow#onItemRightClick(ItemStack, World, EntityPlayer).
*
- * {@link #result} contains the resulting ItemStack due to the use of the bow.
- *
- * This event is {@link Cancelable}.
- * If this event is canceled, the player does not begin using the bow.
- *
- * This event does not have a result. {@link HasResult}
- *
* This event is fired on the {@link MinecraftForge#EVENT_BUS}. **/ -@Cancelable public class ArrowNockEvent extends PlayerEvent { - public ItemStack result; - - public ArrowNockEvent(EntityPlayer player, ItemStack result) + private final ItemStack bow; + private final EnumHand hand; + private final World world; + private final boolean hasAmmo; + private ActionResult action; + + public ArrowNockEvent(EntityPlayer player, ItemStack item, EnumHand hand, World world, boolean hasAmmo) { super(player); - this.result = result; + this.bow = item; + this.hand = hand; + this.world = world; + this.hasAmmo = hasAmmo; + } + + public ItemStack getBow() { return this.bow; } + public EnumHand getHand() { return this.hand; } + public boolean hasAmmo() { return this.hasAmmo; } + public ActionResult getAction() + { + return this.action; + } + + public void setAction(ActionResult action) + { + this.action = action; } } From 7fadb5aeb89da07578471c66e44e72aa99d336c6 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 2 Mar 2016 01:44:41 -0800 Subject: [PATCH 018/243] Small renames before bed. --- .../entity/item/EntityMinecart.java.patch.rej | 289 ------------------ .../net/minecraftforge/common/ForgeHooks.java | 2 + .../common/IMinecartCollisionHandler.java | 2 +- .../common/util/EnumHelper.java | 14 +- .../fml/client/config/GuiConfigEntries.java | 20 +- .../fml/client/config/GuiEditArray.java | 10 +- .../client/config/GuiEditArrayEntries.java | 4 +- .../fml/client/config/GuiSelectString.java | 11 +- .../server/console/ConsoleFormatter.java | 48 +-- .../server/console/TerminalHandler.java | 4 +- 10 files changed, 59 insertions(+), 345 deletions(-) delete mode 100644 rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej diff --git a/rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej b/rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej deleted file mode 100644 index bab388b0db..0000000000 --- a/rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej +++ /dev/null @@ -1,289 +0,0 @@ -++++ REJECTED PATCH 10 - this.posX = d19 + d1 * d18; - this.posZ = d20 + d2 * d18; - this.setPosition(this.posX, this.posY, this.posZ); -- double d22 = this.motionX; -- double d23 = this.motionZ; -+ this.moveMinecartOnRail(p_180460_1_); - -- if (this.riddenByEntity != null) -- { -- d22 *= 0.75D; -- d23 *= 0.75D; -- } -- -- double d13 = this.getMaximumSpeed(); -- d22 = MathHelper.clamp_double(d22, -d13, d13); -- d23 = MathHelper.clamp_double(d23, -d13, d13); -- this.moveEntity(d22, 0.0D, d23); -- - if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - p_180460_1_.getX() == aint[0][0] && MathHelper.floor_double(this.posZ) - p_180460_1_.getZ() == aint[0][2]) - { - this.setPosition(this.posX, this.posY + (double)aint[0][1], this.posZ); -++++ END PATCH -++++ REJECTED PATCH 12 - - public void applyEntityCollision(Entity entityIn) - { -+ -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, entityIn)); -+ if (getCollisionHandler() != null) -+ { -+ getCollisionHandler().onEntityCollision(this, entityIn); -+ return; -+ } - if (!this.worldObj.isRemote) - { - if (!entityIn.noClip && !this.noClip) - { - if (entityIn != this.riddenByEntity) - { -- if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) -+ if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) - { - entityIn.mountEntity(this); - } -++++ END PATCH -++++ REJECTED PATCH 13 - double d7 = entityIn.motionX + this.motionX; - double d8 = entityIn.motionZ + this.motionZ; - -- if (((EntityMinecart)entityIn).getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE) -+ if (((EntityMinecart)entityIn).isPoweredCart() && !isPoweredCart()) - { - this.motionX *= 0.20000000298023224D; - this.motionZ *= 0.20000000298023224D; -++++ END PATCH -++++ REJECTED PATCH 14 - entityIn.motionX *= 0.949999988079071D; - entityIn.motionZ *= 0.949999988079071D; - } -- else if (((EntityMinecart)entityIn).getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE) -+ else if (((EntityMinecart)entityIn).isPoweredCart() && isPoweredCart()) - { - entityIn.motionX *= 0.20000000298023224D; - entityIn.motionZ *= 0.20000000298023224D; -++++ END PATCH -++++ REJECTED PATCH 15 - } - } - -+ /* =================================== FORGE START ===========================================*/ -+ private BlockPos getCurrentRailPosition() -+ { -+ int x = MathHelper.floor_double(this.posX); -+ int y = MathHelper.floor_double(this.posY); -+ int z = MathHelper.floor_double(this.posZ); -+ -+ if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(x, y - 1, z))) y--; -+ return new BlockPos(x, y, z); -+ } -+ -+ protected double getMaxSpeed() -+ { -+ if (!canUseRail()) return getMaximumSpeed(); -+ BlockPos pos = this.getCurrentRailPosition(); -+ IBlockState state = this.worldObj.getBlockState(pos); -+ if (!BlockRailBase.isRailBlock(state)) return getMaximumSpeed(); -+ -+ float railMaxSpeed = ((BlockRailBase)state.getBlock()).getRailMaxSpeed(worldObj, this, pos); -+ return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); -+ } -+ -+ /** -+ * Moved to allow overrides. -+ * This code handles minecart movement and speed capping when on a rail. -+ */ -+ public void moveMinecartOnRail(BlockPos pos) -+ { -+ double mX = this.motionX; -+ double mZ = this.motionZ; -+ -+ if (this.riddenByEntity != null) -+ { -+ mX *= 0.75D; -+ mZ *= 0.75D; -+ } -+ -+ double max = this.getMaxSpeed(); -+ mX = MathHelper.clamp_double(mX, -max, max); -+ mZ = MathHelper.clamp_double(mZ, -max, max); -+ this.moveEntity(mX, 0.0D, mZ); -+ } -+ -+ /** -+ * Gets the current global Minecart Collision handler if none -+ * is registered, returns null -+ * @return The collision handler or null -+ */ -+ public static net.minecraftforge.common.IMinecartCollisionHandler getCollisionHandler() -+ { -+ return collisionHandler; -+ } -+ -+ /** -+ * Sets the global Minecart Collision handler, overwrites any -+ * that is currently set. -+ * @param handler The new handler -+ */ -+ public static void setCollisionHandler(net.minecraftforge.common.IMinecartCollisionHandler handler) -+ { -+ collisionHandler = handler; -+ } -+ -+ /** -+ * This function returns an ItemStack that represents this cart. -+ * This should be an ItemStack that can be used by the player to place the cart, -+ * but is not necessary the item the cart drops when destroyed. -+ * @return An ItemStack that can be used to place the cart. -+ */ -+ public ItemStack getCartItem() -+ { -+ if (this instanceof EntityMinecartFurnace) -+ { -+ return new ItemStack(Items.furnace_minecart); -+ } -+ else if (this instanceof EntityMinecartChest) -+ { -+ return new ItemStack(Items.chest_minecart); -+ } -+ else if (this instanceof EntityMinecartTNT) -+ { -+ return new ItemStack(Items.tnt_minecart); -+ } -+ else if (this instanceof EntityMinecartHopper) -+ { -+ return new ItemStack(Items.hopper_minecart); -+ } -+ else if (this instanceof EntityMinecartCommandBlock) -+ { -+ return new ItemStack(Items.command_block_minecart); -+ } -+ return new ItemStack(Items.minecart); -+ } -+ -+ /** -+ * Returns true if this cart can currently use rails. -+ * This function is mainly used to gracefully detach a minecart from a rail. -+ * @return True if the minecart can use rails. -+ */ -+ public boolean canUseRail() -+ { -+ return canUseRail; -+ } -+ -+ /** -+ * Set whether the minecart can use rails. -+ * This function is mainly used to gracefully detach a minecart from a rail. -+ * @param use Whether the minecart can currently use rails. -+ */ -+ public void setCanUseRail(boolean use) -+ { -+ canUseRail = use; -+ } -+ -+ /** -+ * Return false if this cart should not call onMinecartPass() and should ignore Powered Rails. -+ * @return True if this cart should call onMinecartPass(). -+ */ -+ public boolean shouldDoRailFunctions() -+ { -+ return true; -+ } -+ -+ /** -+ * Returns true if this cart is self propelled. -+ * @return True if powered. -+ */ -+ public boolean isPoweredCart() -+ { -+ return getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE; -+ } -+ -+ /** -+ * Returns true if this cart can be ridden by an Entity. -+ * @return True if this cart can be ridden. -+ */ -+ public boolean canBeRidden() -+ { -+ return this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE; -+ } -+ -+ /** -+ * Getters/setters for physics variables -+ */ -+ -+ /** -+ * Returns the carts max speed when traveling on rails. Carts going faster -+ * than 1.1 cause issues with chunk loading. Carts cant traverse slopes or -+ * corners at greater than 0.5 - 0.6. This value is compared with the rails -+ * max speed and the carts current speed cap to determine the carts current -+ * max speed. A normal rail's max speed is 0.4. -+ * -+ * @return Carts max speed. -+ */ -+ public float getMaxCartSpeedOnRail() -+ { -+ return 1.2f; -+ } -+ -+ /** -+ * Returns the current speed cap for the cart when traveling on rails. This -+ * functions differs from getMaxCartSpeedOnRail() in that it controls -+ * current movement and cannot be overridden. The value however can never be -+ * higher than getMaxCartSpeedOnRail(). -+ * -+ * @return -+ */ -+ public final float getCurrentCartSpeedCapOnRail() -+ { -+ return currentSpeedRail; -+ } -+ -+ public final void setCurrentCartSpeedCapOnRail(float value) -+ { -+ value = Math.min(value, getMaxCartSpeedOnRail()); -+ currentSpeedRail = value; -+ } -+ -+ public float getMaxSpeedAirLateral() -+ { -+ return maxSpeedAirLateral; -+ } -+ -+ public void setMaxSpeedAirLateral(float value) -+ { -+ maxSpeedAirLateral = value; -+ } -+ -+ public float getMaxSpeedAirVertical() -+ { -+ return maxSpeedAirVertical; -+ } -+ -+ public void setMaxSpeedAirVertical(float value) -+ { -+ maxSpeedAirVertical = value; -+ } -+ -+ public double getDragAir() -+ { -+ return dragAir; -+ } -+ -+ public void setDragAir(double value) -+ { -+ dragAir = value; -+ } -+ -+ public double getSlopeAdjustment() -+ { -+ return 0.0078125D; -+ } -+ -+ /* =================================== FORGE END ===========================================*/ -+ - public static enum EnumMinecartType - { - RIDEABLE(0, "MinecartRideable"), -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 2b7c2fcfde..f8816cf3e7 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -56,7 +56,9 @@ import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.WeightedRandom; +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.util.text.TextComponentString; import net.minecraft.util.text.TextFormatting; diff --git a/src/main/java/net/minecraftforge/common/IMinecartCollisionHandler.java b/src/main/java/net/minecraftforge/common/IMinecartCollisionHandler.java index 2346273d02..b0251dcfe7 100644 --- a/src/main/java/net/minecraftforge/common/IMinecartCollisionHandler.java +++ b/src/main/java/net/minecraftforge/common/IMinecartCollisionHandler.java @@ -1,6 +1,6 @@ package net.minecraftforge.common; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityMinecart; diff --git a/src/main/java/net/minecraftforge/common/util/EnumHelper.java b/src/main/java/net/minecraftforge/common/util/EnumHelper.java index 066d0a8ceb..8fee636af3 100644 --- a/src/main/java/net/minecraftforge/common/util/EnumHelper.java +++ b/src/main/java/net/minecraftforge/common/util/EnumHelper.java @@ -15,8 +15,8 @@ import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.MovingObjectPosition.MovingObjectType; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.gen.structure.StructureStrongholdPieces.Stronghold.Door; import net.minecraftforge.classloading.FMLForgePlugin; @@ -42,11 +42,11 @@ public class EnumHelper {Door.class}, {EnumEnchantmentType.class}, {Sensitivity.class}, - {MovingObjectType.class}, + {RayTraceResult.Type.class}, {EnumSkyBlock.class, int.class}, {EnumStatus.class}, {ToolMaterial.class, int.class, int.class, float.class, float.class, int.class}, - {EnumRarity.class, EnumChatFormatting.class, String.class} + {EnumRarity.class, TextFormatting.class, String.class} }; public static EnumAction addAction(String name) @@ -82,9 +82,9 @@ public class EnumHelper { return addEnum(Sensitivity.class, name); } - public static MovingObjectType addMovingObjectType(String name) + public static RayTraceResult.Type addMovingObjectType(String name) { - return addEnum(MovingObjectType.class, name); + return addEnum(RayTraceResult.Type.class, name); } public static EnumSkyBlock addSkyBlock(String name, int lightValue) { @@ -98,7 +98,7 @@ public class EnumHelper { return addEnum(ToolMaterial.class, name, harvestLevel, maxUses, efficiency, damage, enchantability); } - public static EnumRarity addRarity(String name, EnumChatFormatting color, String displayName) + public static EnumRarity addRarity(String name, TextFormatting color, String displayName) { return addEnum(EnumRarity.class, name, color, displayName); } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java b/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java index b7b5b220cc..dd9355323a 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java @@ -25,7 +25,7 @@ import net.minecraft.client.gui.GuiListExtended; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.resources.I18n; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; @@ -1499,25 +1499,25 @@ public class GuiConfigEntries extends GuiListExtended if (!comment.equals(configElement.getLanguageKey() + ".tooltip")) toolTip = new ArrayList(this.mc.fontRendererObj.listFormattedStringToWidth( - EnumChatFormatting.GREEN + name + "\n" + EnumChatFormatting.YELLOW + comment, 300)); + TextFormatting.GREEN + name + "\n" + TextFormatting.YELLOW + comment, 300)); else if (configElement.getComment() != null && !configElement.getComment().trim().isEmpty()) toolTip = new ArrayList(this.mc.fontRendererObj.listFormattedStringToWidth( - EnumChatFormatting.GREEN + name + "\n" + EnumChatFormatting.YELLOW + configElement.getComment(), 300)); + TextFormatting.GREEN + name + "\n" + TextFormatting.YELLOW + configElement.getComment(), 300)); else toolTip = new ArrayList(this.mc.fontRendererObj.listFormattedStringToWidth( - EnumChatFormatting.GREEN + name + "\n" + EnumChatFormatting.RED + "No tooltip defined.", 300)); + TextFormatting.GREEN + name + "\n" + TextFormatting.RED + "No tooltip defined.", 300)); if ((configElement.getType() == ConfigGuiType.INTEGER && (Integer.valueOf(configElement.getMinValue().toString()) != Integer.MIN_VALUE || Integer.valueOf(configElement.getMaxValue().toString()) != Integer.MAX_VALUE)) || (configElement.getType() == ConfigGuiType.DOUBLE && (Double.valueOf(configElement.getMinValue().toString()) != -Double.MAX_VALUE || Double.valueOf(configElement.getMaxValue().toString()) != Double.MAX_VALUE))) toolTip.addAll(this.mc.fontRendererObj.listFormattedStringToWidth( - EnumChatFormatting.AQUA + I18n.format("fml.configgui.tooltip.defaultNumeric", configElement.getMinValue(), configElement.getMaxValue(), configElement.getDefault()), 300)); + TextFormatting.AQUA + I18n.format("fml.configgui.tooltip.defaultNumeric", configElement.getMinValue(), configElement.getMaxValue(), configElement.getDefault()), 300)); else if (configElement.getType() != ConfigGuiType.CONFIG_CATEGORY) - toolTip.addAll(this.mc.fontRendererObj.listFormattedStringToWidth(EnumChatFormatting.AQUA + I18n.format("fml.configgui.tooltip.default", configElement.getDefault()),300)); + toolTip.addAll(this.mc.fontRendererObj.listFormattedStringToWidth(TextFormatting.AQUA + I18n.format("fml.configgui.tooltip.default", configElement.getDefault()),300)); if (configElement.requiresMcRestart() || owningScreen.allRequireMcRestart) - toolTip.add(EnumChatFormatting.RED + "[" + I18n.format("fml.configgui.gameRestartTitle") + "]"); + toolTip.add(TextFormatting.RED + "[" + I18n.format("fml.configgui.gameRestartTitle") + "]"); } @Override @@ -1527,9 +1527,9 @@ public class GuiConfigEntries extends GuiListExtended if (drawLabel) { - String label = (!isValidValue ? EnumChatFormatting.RED.toString() : - (isChanged ? EnumChatFormatting.WHITE.toString() : EnumChatFormatting.GRAY.toString())) - + (isChanged ? EnumChatFormatting.ITALIC.toString() : "") + this.name; + String label = (!isValidValue ? TextFormatting.RED.toString() : + (isChanged ? TextFormatting.WHITE.toString() : TextFormatting.GRAY.toString())) + + (isChanged ? TextFormatting.ITALIC.toString() : "") + this.name; this.mc.fontRendererObj.drawString( label, this.owningScreen.entryList.labelX, diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiEditArray.java b/src/main/java/net/minecraftforge/fml/client/config/GuiEditArray.java index 1202b7e396..13e4cc95b9 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiEditArray.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiEditArray.java @@ -21,7 +21,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import static net.minecraftforge.fml.client.config.GuiUtils.RESET_CHAR; import static net.minecraftforge.fml.client.config.GuiUtils.UNDO_CHAR; @@ -63,17 +63,17 @@ public class GuiEditArray extends GuiScreen String comment; comment = I18n.format(configElement.getLanguageKey() + ".tooltip", - "\n" + EnumChatFormatting.AQUA, configElement.getDefault(), configElement.getMinValue(), configElement.getMaxValue()); + "\n" + TextFormatting.AQUA, configElement.getDefault(), configElement.getMinValue(), configElement.getMaxValue()); if (!comment.equals(configElement.getLanguageKey() + ".tooltip")) toolTip = mc.fontRendererObj.listFormattedStringToWidth( - EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.YELLOW + comment, 300); + TextFormatting.GREEN + propName + "\n" + TextFormatting.YELLOW + comment, 300); else if (configElement.getComment() != null && !configElement.getComment().trim().isEmpty()) toolTip = mc.fontRendererObj.listFormattedStringToWidth( - EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.YELLOW + configElement.getComment(), 300); + TextFormatting.GREEN + propName + "\n" + TextFormatting.YELLOW + configElement.getComment(), 300); else toolTip = mc.fontRendererObj.listFormattedStringToWidth( - EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.RED + "No tooltip defined.", 300); + TextFormatting.GREEN + propName + "\n" + TextFormatting.RED + "No tooltip defined.", 300); if (parentScreen instanceof GuiConfig) { diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiEditArrayEntries.java b/src/main/java/net/minecraftforge/fml/client/config/GuiEditArrayEntries.java index 85088e8fc0..ac86dcbe63 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiEditArrayEntries.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiEditArrayEntries.java @@ -20,7 +20,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiListExtended; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.resources.I18n; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.client.config.GuiConfigEntries.ArrayEntry; import net.minecraftforge.fml.common.FMLLog; @@ -560,7 +560,7 @@ public class GuiEditArrayEntries extends GuiListExtended { if (this.getValue() != null && this.isValidated) owningEntryList.mc.fontRendererObj.drawString( - isValidValue ? EnumChatFormatting.GREEN + VALID : EnumChatFormatting.RED + INVALID, + isValidValue ? TextFormatting.GREEN + VALID : TextFormatting.RED + INVALID, listWidth / 4 - owningEntryList.mc.fontRendererObj.getStringWidth(VALID) - 2, y + slotHeight / 2 - owningEntryList.mc.fontRendererObj.FONT_HEIGHT / 2, 16777215); diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiSelectString.java b/src/main/java/net/minecraftforge/fml/client/config/GuiSelectString.java index e4975fc4aa..df245bdbae 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiSelectString.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiSelectString.java @@ -21,7 +21,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; + import static net.minecraftforge.fml.client.config.GuiUtils.RESET_CHAR; import static net.minecraftforge.fml.client.config.GuiUtils.UNDO_CHAR; @@ -62,17 +63,17 @@ public class GuiSelectString extends GuiScreen String comment; comment = I18n.format(configElement.getLanguageKey() + ".tooltip", - "\n" + EnumChatFormatting.AQUA, configElement.getDefault(), configElement.getMinValue(), configElement.getMaxValue()); + "\n" + TextFormatting.AQUA, configElement.getDefault(), configElement.getMinValue(), configElement.getMaxValue()); if (!comment.equals(configElement.getLanguageKey() + ".tooltip")) toolTip = mc.fontRendererObj.listFormattedStringToWidth( - EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.YELLOW + comment, 300); + TextFormatting.GREEN + propName + "\n" + TextFormatting.YELLOW + comment, 300); else if (configElement.getComment() != null && !configElement.getComment().trim().isEmpty()) toolTip = mc.fontRendererObj.listFormattedStringToWidth( - EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.YELLOW + configElement.getComment(), 300); + TextFormatting.GREEN + propName + "\n" + TextFormatting.YELLOW + configElement.getComment(), 300); else toolTip = mc.fontRendererObj.listFormattedStringToWidth( - EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.RED + "No tooltip defined.", 300); + TextFormatting.GREEN + propName + "\n" + TextFormatting.RED + "No tooltip defined.", 300); if (parentScreen instanceof GuiConfig) { diff --git a/src/main/java/net/minecraftforge/server/console/ConsoleFormatter.java b/src/main/java/net/minecraftforge/server/console/ConsoleFormatter.java index 51719e0870..69796f734c 100644 --- a/src/main/java/net/minecraftforge/server/console/ConsoleFormatter.java +++ b/src/main/java/net/minecraftforge/server/console/ConsoleFormatter.java @@ -8,7 +8,7 @@ import org.fusesource.jansi.Ansi; import com.google.common.base.Function; import com.google.common.collect.ImmutableMap; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; public final class ConsoleFormatter implements Function { @@ -20,31 +20,31 @@ public final class ConsoleFormatter implements Function private static final String RESET = Ansi.ansi().reset().toString(); private static final ImmutableMap REPLACEMENTS = ImmutableMap. builder() - .put(compile(EnumChatFormatting.BLACK), Ansi.ansi().reset().fg(Ansi.Color.BLACK).boldOff().toString()) - .put(compile(EnumChatFormatting.DARK_BLUE), Ansi.ansi().reset().fg(Ansi.Color.BLUE).boldOff().toString()) - .put(compile(EnumChatFormatting.DARK_GREEN), Ansi.ansi().reset().fg(Ansi.Color.GREEN).boldOff().toString()) - .put(compile(EnumChatFormatting.DARK_AQUA), Ansi.ansi().reset().fg(Ansi.Color.CYAN).boldOff().toString()) - .put(compile(EnumChatFormatting.DARK_RED), Ansi.ansi().reset().fg(Ansi.Color.RED).boldOff().toString()) - .put(compile(EnumChatFormatting.DARK_PURPLE), Ansi.ansi().reset().fg(Ansi.Color.MAGENTA).boldOff().toString()) - .put(compile(EnumChatFormatting.GOLD), Ansi.ansi().reset().fg(Ansi.Color.YELLOW).boldOff().toString()) - .put(compile(EnumChatFormatting.GRAY), Ansi.ansi().reset().fg(Ansi.Color.WHITE).boldOff().toString()) - .put(compile(EnumChatFormatting.DARK_GRAY), Ansi.ansi().reset().fg(Ansi.Color.BLACK).bold().toString()) - .put(compile(EnumChatFormatting.BLUE), Ansi.ansi().reset().fg(Ansi.Color.BLUE).bold().toString()) - .put(compile(EnumChatFormatting.GREEN), Ansi.ansi().reset().fg(Ansi.Color.GREEN).bold().toString()) - .put(compile(EnumChatFormatting.AQUA), Ansi.ansi().reset().fg(Ansi.Color.CYAN).bold().toString()) - .put(compile(EnumChatFormatting.RED), Ansi.ansi().reset().fg(Ansi.Color.RED).bold().toString()) - .put(compile(EnumChatFormatting.LIGHT_PURPLE), Ansi.ansi().reset().fg(Ansi.Color.MAGENTA).bold().toString()) - .put(compile(EnumChatFormatting.YELLOW), Ansi.ansi().reset().fg(Ansi.Color.YELLOW).bold().toString()) - .put(compile(EnumChatFormatting.WHITE), Ansi.ansi().reset().fg(Ansi.Color.WHITE).bold().toString()) - .put(compile(EnumChatFormatting.OBFUSCATED), Ansi.ansi().a(Ansi.Attribute.BLINK_SLOW).toString()) - .put(compile(EnumChatFormatting.BOLD), Ansi.ansi().a(Ansi.Attribute.UNDERLINE_DOUBLE).toString()) - .put(compile(EnumChatFormatting.STRIKETHROUGH), Ansi.ansi().a(Ansi.Attribute.STRIKETHROUGH_ON).toString()) - .put(compile(EnumChatFormatting.UNDERLINE), Ansi.ansi().a(Ansi.Attribute.UNDERLINE).toString()) - .put(compile(EnumChatFormatting.ITALIC), Ansi.ansi().a(Ansi.Attribute.ITALIC).toString()) - .put(compile(EnumChatFormatting.RESET), RESET) + .put(compile(TextFormatting.BLACK), Ansi.ansi().reset().fg(Ansi.Color.BLACK).boldOff().toString()) + .put(compile(TextFormatting.DARK_BLUE), Ansi.ansi().reset().fg(Ansi.Color.BLUE).boldOff().toString()) + .put(compile(TextFormatting.DARK_GREEN), Ansi.ansi().reset().fg(Ansi.Color.GREEN).boldOff().toString()) + .put(compile(TextFormatting.DARK_AQUA), Ansi.ansi().reset().fg(Ansi.Color.CYAN).boldOff().toString()) + .put(compile(TextFormatting.DARK_RED), Ansi.ansi().reset().fg(Ansi.Color.RED).boldOff().toString()) + .put(compile(TextFormatting.DARK_PURPLE), Ansi.ansi().reset().fg(Ansi.Color.MAGENTA).boldOff().toString()) + .put(compile(TextFormatting.GOLD), Ansi.ansi().reset().fg(Ansi.Color.YELLOW).boldOff().toString()) + .put(compile(TextFormatting.GRAY), Ansi.ansi().reset().fg(Ansi.Color.WHITE).boldOff().toString()) + .put(compile(TextFormatting.DARK_GRAY), Ansi.ansi().reset().fg(Ansi.Color.BLACK).bold().toString()) + .put(compile(TextFormatting.BLUE), Ansi.ansi().reset().fg(Ansi.Color.BLUE).bold().toString()) + .put(compile(TextFormatting.GREEN), Ansi.ansi().reset().fg(Ansi.Color.GREEN).bold().toString()) + .put(compile(TextFormatting.AQUA), Ansi.ansi().reset().fg(Ansi.Color.CYAN).bold().toString()) + .put(compile(TextFormatting.RED), Ansi.ansi().reset().fg(Ansi.Color.RED).bold().toString()) + .put(compile(TextFormatting.LIGHT_PURPLE), Ansi.ansi().reset().fg(Ansi.Color.MAGENTA).bold().toString()) + .put(compile(TextFormatting.YELLOW), Ansi.ansi().reset().fg(Ansi.Color.YELLOW).bold().toString()) + .put(compile(TextFormatting.WHITE), Ansi.ansi().reset().fg(Ansi.Color.WHITE).bold().toString()) + .put(compile(TextFormatting.OBFUSCATED), Ansi.ansi().a(Ansi.Attribute.BLINK_SLOW).toString()) + .put(compile(TextFormatting.BOLD), Ansi.ansi().a(Ansi.Attribute.UNDERLINE_DOUBLE).toString()) + .put(compile(TextFormatting.STRIKETHROUGH), Ansi.ansi().a(Ansi.Attribute.STRIKETHROUGH_ON).toString()) + .put(compile(TextFormatting.UNDERLINE), Ansi.ansi().a(Ansi.Attribute.UNDERLINE).toString()) + .put(compile(TextFormatting.ITALIC), Ansi.ansi().a(Ansi.Attribute.ITALIC).toString()) + .put(compile(TextFormatting.RESET), RESET) .build(); - private static Pattern compile(EnumChatFormatting formatting) + private static Pattern compile(TextFormatting formatting) { return Pattern.compile(formatting.toString(), Pattern.LITERAL | Pattern.CASE_INSENSITIVE); } diff --git a/src/main/java/net/minecraftforge/server/console/TerminalHandler.java b/src/main/java/net/minecraftforge/server/console/TerminalHandler.java index 142b32bc73..6bf0a2e7ca 100644 --- a/src/main/java/net/minecraftforge/server/console/TerminalHandler.java +++ b/src/main/java/net/minecraftforge/server/console/TerminalHandler.java @@ -9,7 +9,7 @@ import com.google.common.base.Function; import jline.console.ConsoleReader; import net.minecraft.server.dedicated.DedicatedServer; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; public final class TerminalHandler { @@ -60,7 +60,7 @@ public final class TerminalHandler @Override public String apply(String text) { - return EnumChatFormatting.getTextWithoutFormattingCodes(text); + return TextFormatting.getTextWithoutFormattingCodes(text); } }); From 3fd09af1d3e4cc0c8e7a66c52cec0831a64f348b Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 2 Mar 2016 15:06:36 +0300 Subject: [PATCH 019/243] GuiCreateWorld, GuiSlot, GuiUtilRenderComponents, GuiContainerCreative --- .../client/gui/GuiCreateWorld.java.patch | 13 +++++-- .../minecraft/client/gui/GuiSlot.java.patch | 32 +++++++++++++---- .../gui/GuiUtilRenderComponents.java.patch | 10 ++++++ .../inventory/GuiContainerCreative.java.patch | 36 +++++++++++++------ .../client/gui/GuiCreateWorld.java.patch.rej | 10 ------ .../client/gui/GuiSlot.java.patch.rej | 19 ---------- .../GuiUtilRenderComponents.java.patch.rej | 9 ----- .../GuiContainerCreative.java.patch.rej | 25 ------------- 8 files changed, 71 insertions(+), 83 deletions(-) create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch delete mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch index 714e647b52..420742007d 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch @@ -1,6 +1,15 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -@@ -311,14 +311,7 @@ +@@ -205,6 +205,8 @@ + } + } + ++ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress(); ++ + WorldSettings worldsettings = new WorldSettings(i, WorldSettings.GameType.getByName(this.gameMode), this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]); + worldsettings.setWorldName(this.chunkProviderSettingsJson); + +@@ -311,14 +313,7 @@ } else if (button.id == 8) { @@ -16,7 +25,7 @@ } } } -@@ -370,7 +363,7 @@ +@@ -370,7 +365,7 @@ this.btnBonusItems.visible = this.field_146344_y; this.btnMapType.visible = this.field_146344_y; this.btnAllowCommands.visible = this.field_146344_y; diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch index 326e92388e..852133385e 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -1,21 +1,39 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java -@@ -458,4 +458,18 @@ +@@ -181,15 +181,8 @@ + GlStateManager.disableFog(); + Tessellator tessellator = Tessellator.getInstance(); + VertexBuffer vertexbuffer = tessellator.getWorldRenderer(); +- this.mc.getTextureManager().bindTexture(Gui.optionsBackground); +- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +- float f = 32.0F; +- vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); +- vertexbuffer.pos((double)this.left, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); +- vertexbuffer.pos((double)this.right, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); +- vertexbuffer.pos((double)this.right, (double)this.top, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); +- vertexbuffer.pos((double)this.left, (double)this.top, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); +- tessellator.draw(); ++ // Forge: background rendering moved into separate method. ++ this.drawContainerBackground(tessellator); + int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; + int l = this.top + 4 - (int)this.amountScrolled; + +@@ -458,4 +451,18 @@ { return this.slotHeight; } + + protected void drawContainerBackground(Tessellator tessellator) + { -+ WorldRenderer worldrenderer = tessellator.getWorldRenderer(); ++ VertexBuffer buffer = tessellator.getWorldRenderer(); + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + float f = 32.0F; -+ worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); -+ worldrenderer.pos((double)this.left, (double)this.bottom, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -+ worldrenderer.pos((double)this.right, (double)this.bottom, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -+ worldrenderer.pos((double)this.right, (double)this.top, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -+ worldrenderer.pos((double)this.left, (double)this.top, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); ++ buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); ++ buffer.pos((double)this.left, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); ++ buffer.pos((double)this.right, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); ++ buffer.pos((double)this.right, (double)this.top, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); ++ buffer.pos((double)this.left, (double)this.top, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); + tessellator.draw(); + } } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch new file mode 100644 index 0000000000..94e88d2d37 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java +@@ -73,6 +73,7 @@ + s3 = s4; + } + ++ s3 = FontRenderer.getFormatFromString(s2) + s3; //Forge: Fix chat formatting not surviving line wrapping. + TextComponentString textcomponentstring2 = new TextComponentString(s3); + textcomponentstring2.setChatStyle(itextcomponent1.getChatStyle().createShallowCopy()); + list1.add(j + 1, textcomponentstring2); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch index b752bda1d5..58c34c352f 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -47,7 +47,21 @@ for (Item item : Item.itemRegistry) { if (item != null && item.getCreativeTab() != null) -@@ -332,7 +349,6 @@ +@@ -324,7 +341,13 @@ + item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList); + } + } ++ updateFilteredItems(guicontainercreative$containercreative); ++ } + ++ //split from above for custom search tabs ++ private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$containercreative) ++ { ++ if (CreativeTabs.creativeTabArray[selectedTabIndex] == CreativeTabs.tabAllSearch) // FORGE: Only add enchanted books to the regular search + for (Enchantment enchantment : Enchantment.field_185264_b) + { + if (enchantment != null && enchantment.type != null) +@@ -332,7 +355,6 @@ Items.enchanted_book.getAll(enchantment, guicontainercreative$containercreative.itemList); } } @@ -55,7 +69,7 @@ Iterator iterator = guicontainercreative$containercreative.itemList.iterator(); String s1 = this.searchField.getText().toLowerCase(); -@@ -364,7 +380,7 @@ +@@ -364,7 +386,7 @@ { CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; @@ -64,7 +78,7 @@ { GlStateManager.disableBlend(); this.fontRendererObj.drawString(I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752); -@@ -399,7 +415,7 @@ +@@ -399,7 +421,7 @@ for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray) { @@ -73,7 +87,7 @@ { this.setCurrentCreativeTab(creativetabs); return; -@@ -412,11 +428,13 @@ +@@ -412,11 +434,13 @@ private boolean needsScrollBars() { @@ -87,7 +101,7 @@ int i = selectedTabIndex; selectedTabIndex = p_147050_1_.getTabIndex(); GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; -@@ -487,12 +505,14 @@ +@@ -487,12 +511,14 @@ if (this.searchField != null) { @@ -103,7 +117,7 @@ this.updateCreativeSearch(); } else -@@ -562,20 +582,43 @@ +@@ -562,20 +588,43 @@ } super.drawScreen(mouseX, mouseY, partialTicks); @@ -148,7 +162,7 @@ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableLighting(); } -@@ -637,16 +680,35 @@ +@@ -637,16 +686,35 @@ RenderHelper.enableGUIStandardItemLighting(); CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; @@ -185,7 +199,7 @@ this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName())); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); this.searchField.drawTextBox(); -@@ -661,6 +723,14 @@ +@@ -661,6 +729,14 @@ this.drawTexturedModalRect(i, j + (int)((float)(k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); } @@ -200,7 +214,7 @@ this.func_147051_a(creativetabs); if (creativetabs == CreativeTabs.tabInventory) -@@ -671,6 +741,14 @@ +@@ -671,6 +747,14 @@ protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) { @@ -215,7 +229,7 @@ int i = p_147049_1_.getTabColumn(); int j = 28 * i; int k = 0; -@@ -767,6 +845,8 @@ +@@ -767,6 +851,8 @@ } GlStateManager.disableLighting(); @@ -224,7 +238,7 @@ this.drawTexturedModalRect(l, i1, j, k, 28, j1); this.zLevel = 100.0F; this.itemRender.zLevel = 100.0F; -@@ -793,6 +873,15 @@ +@@ -793,6 +879,15 @@ { this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); } diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej deleted file mode 100644 index e60b28cb52..0000000000 --- a/rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - } - } - -+ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress(); -+ - WorldSettings.GameType worldsettings$gametype = WorldSettings.GameType.getByName(this.gameMode); - WorldSettings worldsettings = new WorldSettings(i, worldsettings$gametype, this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]); - worldsettings.setWorldName(this.chunkProviderSettingsJson); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej deleted file mode 100644 index f6c39b84e0..0000000000 --- a/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej +++ /dev/null @@ -1,19 +0,0 @@ -++++ REJECTED PATCH 1 - GlStateManager.disableFog(); - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); -- this.mc.getTextureManager().bindTexture(Gui.optionsBackground); -- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -- float f = 32.0F; -- worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); -- worldrenderer.pos((double)this.left, (double)this.bottom, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -- worldrenderer.pos((double)this.right, (double)this.bottom, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -- worldrenderer.pos((double)this.right, (double)this.top, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -- worldrenderer.pos((double)this.left, (double)this.top, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -- tessellator.draw(); -+ // Forge: background rendering moved into separate method. -+ this.drawContainerBackground(tessellator); - int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; - int l = this.top + 4 - (int)this.amountScrolled; - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch.rej deleted file mode 100644 index 230f833b20..0000000000 --- a/rejects/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - s3 = s4; - } - -+ s3 = FontRenderer.getFormatFromString(s2) + s3; //Forge: Fix chat formatting not surviving line wrapping. - ChatComponentText chatcomponenttext2 = new ChatComponentText(s3); - chatcomponenttext2.setChatStyle(ichatcomponent1.getChatStyle().createShallowCopy()); - list1.add(j + 1, chatcomponenttext2); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej deleted file mode 100644 index 64f2a9b28f..0000000000 --- a/rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej +++ /dev/null @@ -1,25 +0,0 @@ -++++ REJECTED PATCH 2 - return; - } - -- if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2)) -+ if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2) && ItemStack.areItemStackTagsEqual(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770 - { - if (clickedButton == 0) - { -++++ END PATCH -++++ REJECTED PATCH 6 - item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList); - } - } -+ updateFilteredItems(guicontainercreative$containercreative); -+ } - -+ //split from above for custom search tabs -+ private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$containercreative) -+ { -+ if (CreativeTabs.creativeTabArray[selectedTabIndex] == CreativeTabs.tabAllSearch) // FORGE: Only add enchanted books to the regular search - for (Enchantment enchantment : Enchantment.enchantmentsBookList) - { - if (enchantment != null && enchantment.type != null) -++++ END PATCH From 24b66ff9f3e188b1b135c3090ed552749dbc34ff Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 2 Mar 2016 15:32:22 +0300 Subject: [PATCH 020/243] GuiOverlayDebug, ItemModelMesher, RenderManager, Stitcher fixed + minor fixes in forge gui classes. --- .../client/gui/GuiOverlayDebug.java.patch | 8 +-- .../renderer/ItemModelMesher.java.patch | 21 ++++---- .../renderer/entity/RenderManager.java.patch | 4 +- .../renderer/texture/Stitcher.java.patch | 11 ++-- .../minecraftforge/fml/client/GuiModList.java | 16 +++--- .../fml/client/GuiScrollingList.java | 52 +++++++++---------- .../fml/client/config/GuiConfig.java | 2 +- .../fml/client/config/GuiUtils.java | 10 ++-- 8 files changed, 61 insertions(+), 63 deletions(-) diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch index 92f2f908c6..179cfc5683 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch @@ -1,12 +1,12 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java -@@ -108,6 +108,9 @@ - { - BlockPos blockpos = new BlockPos(this.mc.getRenderViewEntity().posX, this.mc.getRenderViewEntity().getEntityBoundingBox().minY, this.mc.getRenderViewEntity().posZ); +@@ -190,6 +190,9 @@ + long l = j - k; + List list = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.getCpu()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GlStateManager.func_187416_u(7936)}), GlStateManager.func_187416_u(7937), GlStateManager.func_187416_u(7938)}); + list.add(""); + list.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false)); + if (this.isReducedDebug()) { - return Lists.newArrayList(new String[] {"Minecraft 1.9 (" + this.mc.getVersion() + "/" + ClientBrandRetriever.getClientModName() + ")", this.mc.debug, this.mc.renderGlobal.getDebugInfoRenders(), this.mc.renderGlobal.getDebugInfoEntities(), "P: " + this.mc.effectRenderer.getStatistics() + ". T: " + this.mc.theWorld.getDebugLoadedEntities(), this.mc.theWorld.getProviderName(), "", String.format("Chunk-relative: %d %d %d", new Object[]{Integer.valueOf(blockpos.getX() & 15), Integer.valueOf(blockpos.getY() & 15), Integer.valueOf(blockpos.getZ() & 15)})}); + return list; diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch index deb8b59874..2870d8d283 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch @@ -1,14 +1,13 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/ItemModelMesher.java +++ ../src-work/minecraft/net/minecraft/client/renderer/ItemModelMesher.java -@@ -50,6 +50,11 @@ - } - } +@@ -32,7 +32,9 @@ -+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartItemModel) -+ { -+ ibakedmodel = ((net.minecraftforge.client.model.ISmartItemModel)ibakedmodel).handleItemState(stack); -+ } -+ - if (ibakedmodel == null) - { - ibakedmodel = this.modelManager.getMissingModel(); + public TextureAtlasSprite getParticleIcon(Item item, int meta) + { +- return this.getItemModel(new ItemStack(item, 1, meta)).getParticleTexture(); ++ ItemStack stack = new ItemStack(item, 1, meta); ++ IBakedModel model = this.getItemModel(stack); ++ return model.func_188617_f().handleItemState(model, stack, null, null).getParticleTexture(); + } + + public IBakedModel getItemModel(ItemStack stack) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch index 2df7ff6229..208c386cd8 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -19,10 +19,10 @@ Block block = iblockstate.getBlock(); - if (block == Blocks.bed) -+ if (block.isBed(worldIn, new BlockPos(livingPlayerIn), (EntityLivingBase)livingPlayerIn)) ++ if (block.isBed(iblockstate, worldIn, new BlockPos(livingPlayerIn), (EntityLivingBase)livingPlayerIn)) { - int i = ((EnumFacing)iblockstate.getValue(BlockBed.field_185512_D)).getHorizontalIndex(); -+ int i = block.getBedDirection(worldIn, new BlockPos(livingPlayerIn)).getHorizontalIndex(); ++ int i = block.getBedDirection(iblockstate, worldIn, new BlockPos(livingPlayerIn)).getHorizontalIndex(); this.playerViewY = (float)(i * 90 + 180); this.playerViewX = 0.0F; } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch index 93f14a3cb3..7b10c36b2a 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java -@@ -56,12 +56,17 @@ +@@ -56,18 +56,24 @@ { Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]); Arrays.sort((Object[])astitcher$holder); @@ -18,14 +18,13 @@ throw new StitcherException(stitcher$holder, s); } } -@@ -182,6 +187,7 @@ - this.stitchSlots.add(stitcher$slot); - return true; - } + + this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth); + this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight); + net.minecraftforge.fml.common.ProgressManager.pop(bar); } - @SideOnly(Side.CLIENT) + public List getStichSlots() @@ -238,7 +244,7 @@ public String toString() diff --git a/src/main/java/net/minecraftforge/fml/client/GuiModList.java b/src/main/java/net/minecraftforge/fml/client/GuiModList.java index c30b9365f7..ddc45a8fb7 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiModList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiModList.java @@ -40,8 +40,8 @@ import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.IResourcePack; -import net.minecraft.util.TextComponentString; import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StringUtils; import net.minecraftforge.common.ForgeHooks; @@ -53,7 +53,7 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.common.ModContainer.Disableable; import net.minecraftforge.fml.common.versioning.ComparableVersion; -import static net.minecraft.util.EnumChatFormatting.*; +import static net.minecraft.util.text.TextFormatting.*; import org.apache.logging.log4j.Level; @@ -524,13 +524,13 @@ public class GuiModList extends GuiScreen { GlStateManager.enableBlend(); GuiModList.this.mc.renderEngine.bindTexture(logoPath); - VertexBuffer wr = tess.getVertexBuffer(); + VertexBuffer wr = tess.getWorldRenderer(); int offset = (this.left + this.listWidth/2) - (logoDims.width / 2); wr.begin(7, DefaultVertexFormats.POSITION_TEX); - wr.pos(offset, top + logoDims.height, zLevel).tex(0, 1).endVertex(); - wr.pos(offset + logoDims.width, top + logoDims.height, zLevel).tex(1, 1).endVertex(); - wr.pos(offset + logoDims.width, top, zLevel).tex(1, 0).endVertex(); - wr.pos(offset, top, zLevel).tex(0, 0).endVertex(); + wr.pos(offset, top + logoDims.height, zLevel).func_187315_a(0, 1).endVertex(); + wr.pos(offset + logoDims.width, top + logoDims.height, zLevel).func_187315_a(1, 1).endVertex(); + wr.pos(offset + logoDims.width, top, zLevel).func_187315_a(1, 0).endVertex(); + wr.pos(offset, top, zLevel).func_187315_a(0, 0).endVertex(); tess.draw(); GlStateManager.disableBlend(); top += logoDims.height + 10; @@ -570,7 +570,7 @@ public class GuiModList extends GuiScreen for (ITextComponent part : (Iterable)line) { if (!(part instanceof TextComponentString)) continue; - k += GuiModList.this.fontRendererObj.getStringWidth(((TextComponentString)part).getTextComponentString_TextValue()); + k += GuiModList.this.fontRendererObj.getStringWidth(((TextComponentString)part).getChatComponentText_TextValue()); if (k >= x) { GuiModList.this.handleComponentClick(part); diff --git a/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java b/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java index 825e85d019..4c82db1815 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java @@ -263,7 +263,7 @@ public abstract class GuiScrollingList this.applyScrollLimits(); Tessellator tess = Tessellator.getInstance(); - VertexBuffer worldr = tess.getVertexBuffer(); + VertexBuffer worldr = tess.getWorldRenderer(); ScaledResolution res = new ScaledResolution(client); double scaleW = client.displayWidth / res.getScaledWidth_double(); @@ -284,10 +284,10 @@ public abstract class GuiScrollingList GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); float scale = 32.0F; worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - worldr.pos(this.left, this.bottom, 0.0D).tex(this.left / scale, (this.bottom + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - worldr.pos(this.right, this.bottom, 0.0D).tex(this.right / scale, (this.bottom + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - worldr.pos(this.right, this.top, 0.0D).tex(this.right / scale, (this.top + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - worldr.pos(this.left, this.top, 0.0D).tex(this.left / scale, (this.top + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); + worldr.pos(this.left, this.bottom, 0.0D).func_187315_a(this.left / scale, (this.bottom + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); + worldr.pos(this.right, this.bottom, 0.0D).func_187315_a(this.right / scale, (this.bottom + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); + worldr.pos(this.right, this.top, 0.0D).func_187315_a(this.right / scale, (this.top + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); + worldr.pos(this.left, this.top, 0.0D).func_187315_a(this.left / scale, (this.top + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); tess.draw(); } @@ -311,14 +311,14 @@ public abstract class GuiScrollingList GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableTexture2D(); worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - worldr.pos(min, slotTop + slotBuffer + 2, 0).tex(0, 1).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(max, slotTop + slotBuffer + 2, 0).tex(1, 1).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(max, slotTop - 2, 0).tex(1, 0).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(min, slotTop - 2, 0).tex(0, 0).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(min + 1, slotTop + slotBuffer + 1, 0).tex(0, 1).color(0x00, 0x00, 0x00, 0xFF).endVertex(); - worldr.pos(max - 1, slotTop + slotBuffer + 1, 0).tex(1, 1).color(0x00, 0x00, 0x00, 0xFF).endVertex(); - worldr.pos(max - 1, slotTop - 1, 0).tex(1, 0).color(0x00, 0x00, 0x00, 0xFF).endVertex(); - worldr.pos(min + 1, slotTop - 1, 0).tex(0, 0).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.pos(min, slotTop + slotBuffer + 2, 0).func_187315_a(0, 1).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.pos(max, slotTop + slotBuffer + 2, 0).func_187315_a(1, 1).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.pos(max, slotTop - 2, 0).func_187315_a(1, 0).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.pos(min, slotTop - 2, 0).func_187315_a(0, 0).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.pos(min + 1, slotTop + slotBuffer + 1, 0).func_187315_a(0, 1).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.pos(max - 1, slotTop + slotBuffer + 1, 0).func_187315_a(1, 1).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.pos(max - 1, slotTop - 1, 0).func_187315_a(1, 0).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.pos(min + 1, slotTop - 1, 0).func_187315_a(0, 0).color(0x00, 0x00, 0x00, 0xFF).endVertex(); tess.draw(); GlStateManager.enableTexture2D(); } @@ -347,22 +347,22 @@ public abstract class GuiScrollingList GlStateManager.disableTexture2D(); worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - worldr.pos(scrollBarLeft, this.bottom, 0.0D).tex(0.0D, 1.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); - worldr.pos(scrollBarRight, this.bottom, 0.0D).tex(1.0D, 1.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); - worldr.pos(scrollBarRight, this.top, 0.0D).tex(1.0D, 0.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); - worldr.pos(scrollBarLeft, this.top, 0.0D).tex(0.0D, 0.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.pos(scrollBarLeft, this.bottom, 0.0D).func_187315_a(0.0D, 1.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.pos(scrollBarRight, this.bottom, 0.0D).func_187315_a(1.0D, 1.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.pos(scrollBarRight, this.top, 0.0D).func_187315_a(1.0D, 0.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.pos(scrollBarLeft, this.top, 0.0D).func_187315_a(0.0D, 0.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); tess.draw(); worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - worldr.pos(scrollBarLeft, barTop + height, 0.0D).tex(0.0D, 1.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(scrollBarRight, barTop + height, 0.0D).tex(1.0D, 1.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(scrollBarRight, barTop, 0.0D).tex(1.0D, 0.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(scrollBarLeft, barTop, 0.0D).tex(0.0D, 0.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.pos(scrollBarLeft, barTop + height, 0.0D).func_187315_a(0.0D, 1.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.pos(scrollBarRight, barTop + height, 0.0D).func_187315_a(1.0D, 1.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.pos(scrollBarRight, barTop, 0.0D).func_187315_a(1.0D, 0.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.pos(scrollBarLeft, barTop, 0.0D).func_187315_a(0.0D, 0.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); tess.draw(); worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - worldr.pos(scrollBarLeft, barTop + height - 1, 0.0D).tex(0.0D, 1.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); - worldr.pos(scrollBarRight - 1, barTop + height - 1, 0.0D).tex(1.0D, 1.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); - worldr.pos(scrollBarRight - 1, barTop, 0.0D).tex(1.0D, 0.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); - worldr.pos(scrollBarLeft, barTop, 0.0D).tex(0.0D, 0.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); + worldr.pos(scrollBarLeft, barTop + height - 1, 0.0D).func_187315_a(0.0D, 1.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); + worldr.pos(scrollBarRight - 1, barTop + height - 1, 0.0D).func_187315_a(1.0D, 1.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); + worldr.pos(scrollBarRight - 1, barTop, 0.0D).func_187315_a(1.0D, 0.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); + worldr.pos(scrollBarLeft, barTop, 0.0D).func_187315_a(0.0D, 0.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); tess.draw(); } @@ -390,7 +390,7 @@ public abstract class GuiScrollingList GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer VertexBuffer = tessellator.getVertexBuffer(); + VertexBuffer VertexBuffer = tessellator.getWorldRenderer(); VertexBuffer.begin(7, DefaultVertexFormats.POSITION_COLOR); VertexBuffer.pos(right, top, 0.0D).color(r1, g1, b1, a1).endVertex(); VertexBuffer.pos(left, top, 0.0D).color(r1, g1, b1, a1).endVertex(); diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java b/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java index c24ebd8403..b8ff0e06e1 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java @@ -23,7 +23,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; -import net.minecraft.util.TextComponentString; +import net.minecraft.util.text.TextComponentString; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.config.GuiConfigEntries.IConfigEntry; import net.minecraftforge.fml.client.event.ConfigChangedEvent; diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java b/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java index d8fde51914..6502112441 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java @@ -184,12 +184,12 @@ public class GuiUtils float uScale = 1f / 0x100; float vScale = 1f / 0x100; Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer wr = tessellator.getVertexBuffer(); + VertexBuffer wr = tessellator.getWorldRenderer(); wr.begin(7, DefaultVertexFormats.POSITION_TEX); - wr.pos(x , y + height, zLevel).tex( u * uScale, ((v + height) * vScale)).endVertex(); - wr.pos(x + width, y + height, zLevel).tex((u + width) * uScale, ((v + height) * vScale)).endVertex(); - wr.pos(x + width, y , zLevel).tex((u + width) * uScale, ( v * vScale)).endVertex(); - wr.pos(x , y , zLevel).tex( u * uScale, ( v * vScale)).endVertex(); + wr.pos(x , y + height, zLevel).func_187315_a( u * uScale, ((v + height) * vScale)).endVertex(); + wr.pos(x + width, y + height, zLevel).func_187315_a((u + width) * uScale, ((v + height) * vScale)).endVertex(); + wr.pos(x + width, y , zLevel).func_187315_a((u + width) * uScale, ( v * vScale)).endVertex(); + wr.pos(x , y , zLevel).func_187315_a( u * uScale, ( v * vScale)).endVertex(); tessellator.draw(); } From d44d82e19dc0e5f7a800ebab61ed3fed4e9d8975 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 2 Mar 2016 15:36:32 +0300 Subject: [PATCH 021/243] removed Item.getModel, functionality is now achieveable via ItemOverrides. --- .../net/minecraft/item/Item.java.patch | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch index 342392b077..6a756fdcb1 100644 --- a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch @@ -57,7 +57,7 @@ Vec3d vec3d1 = vec3d.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); return worldIn.rayTraceBlocks(vec3d, vec3d1, useLiquids, !useLiquids, false); } -@@ -422,11 +431,642 @@ +@@ -422,11 +431,628 @@ return false; } @@ -189,20 +189,6 @@ + } + + /** -+ * Player, Render pass, and item usage sensitive version of getIconIndex. -+ * -+ * @param stack The item stack to get the icon for. -+ * @param player The player holding the item -+ * @param useRemaining The ticks remaining for the active item. -+ * @return Null to use default model, or a custom ModelResourceLocation for the stage of use. -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.renderer.block.model.ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) -+ { -+ return null; -+ } -+ -+ /** + * ItemStack sensitive version of getContainerItem. + * Returns a full ItemStack instance of the result. + * @@ -700,7 +686,7 @@ public static void registerItems() { registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() -@@ -935,6 +1575,10 @@ +@@ -935,6 +1561,10 @@ private final float damageVsEntity; private final int enchantability; @@ -711,7 +697,7 @@ private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) { this.harvestLevel = harvestLevel; -@@ -969,9 +1613,36 @@ +@@ -969,9 +1599,36 @@ return this.enchantability; } From cff4bf21aee593afaa749bff5ffde20e4fcb06b1 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 2 Mar 2016 20:00:32 +0300 Subject: [PATCH 022/243] Updated raw types in ExtendedBlockState, fixed some ATs, updated some things that needed updating in model classes. --- .../state/BlockStateContainer.java.patch | 2 +- .../block/model/ModelBakery.java.patch | 6 +-- .../client/model/BlockStateLoader.java | 6 --- .../client/model/ForgeBlockStateV1.java | 3 +- .../client/model/IModelCustomData.java | 3 +- .../client/model/IRetexturableModel.java | 3 +- .../client/model/ItemLayerModel.java | 3 +- .../client/model/ModelDynBucket.java | 4 +- .../client/model/ModelFluid.java | 2 +- .../client/model/MultiLayerModel.java | 2 +- .../common/property/ExtendedBlockState.java | 19 +++---- src/main/resources/forge_at.cfg | 52 +++++++++---------- 12 files changed, 46 insertions(+), 59 deletions(-) diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch index 0bb60ecf51..3342a4b24e 100644 --- a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch @@ -12,7 +12,7 @@ + return new StateImplementation(block, properties); + } + -+ protected BlockStateContainer(Block blockIn, IProperty[] properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) ++ protected BlockStateContainer(Block blockIn, IProperty[] properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) + { this.block = blockIn; Map < String, IProperty> map = Maps. < String, IProperty> newHashMap(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch index fe0de3565b..ebdfd263f2 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch @@ -11,7 +11,7 @@ } @@ -370,6 +370,7 @@ - private void registerVariantNames() + protected void registerVariantNames() { + this.variantNames.clear(); //FML clear this to prevent double ups. this.variantNames.put(Item.getItemFromBlock(Blocks.stone), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); @@ -27,10 +27,10 @@ + } } - private List getVariantNames(Item p_177596_1_) + protected List getVariantNames(Item p_177596_1_) @@ -429,7 +434,7 @@ - private ResourceLocation getItemLocation(String p_177583_1_) + protected ResourceLocation getItemLocation(String p_177583_1_) { - ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_); + ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_.replaceAll("#.*", "")); diff --git a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java index dc177896e3..8a0081f6d7 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java +++ b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java @@ -108,12 +108,6 @@ public class BlockStateLoader private final ResourceLocation model; private final ImmutableMap customData; - @Deprecated // remove in 1.9 - public SubModel(IModelState state, boolean uvLock, ImmutableMap textures, ResourceLocation model, ImmutableMap customData) - { - this(state, uvLock, true, true, textures, model, customData); - } - public SubModel(IModelState state, boolean uvLock, boolean smooth, boolean gui3d, ImmutableMap textures, ResourceLocation model, ImmutableMap customData) { this.state = state; diff --git a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java index 39fa4c2ddd..95d871d17e 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java @@ -37,7 +37,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; -@SuppressWarnings("deprecation") public class ForgeBlockStateV1 extends Marker { ForgeBlockStateV1.Variant defaults; @@ -372,7 +371,7 @@ public class ForgeBlockStateV1 extends Marker protected SubModel asGenericSubModel() { - return new SubModel(state.or(TRSRTransformation.identity()), uvLock.or(false), getTextures(), model, getCustomData()); + return new SubModel(state.or(TRSRTransformation.identity()), smooth.or(true), gui3d.or(true), uvLock.or(false), getTextures(), model, getCustomData()); } /** diff --git a/src/main/java/net/minecraftforge/client/model/IModelCustomData.java b/src/main/java/net/minecraftforge/client/model/IModelCustomData.java index 810e768f05..ec5471645a 100644 --- a/src/main/java/net/minecraftforge/client/model/IModelCustomData.java +++ b/src/main/java/net/minecraftforge/client/model/IModelCustomData.java @@ -9,6 +9,5 @@ public interface IModelCustomData> extends IModel * If unknown data is encountered it should be skipped. * @return a new model, with data applied. */ - // 1.9: change IModel to M - IModel process(ImmutableMap customData); + M process(ImmutableMap customData); } diff --git a/src/main/java/net/minecraftforge/client/model/IRetexturableModel.java b/src/main/java/net/minecraftforge/client/model/IRetexturableModel.java index b6b14ccd5e..98016dcc64 100644 --- a/src/main/java/net/minecraftforge/client/model/IRetexturableModel.java +++ b/src/main/java/net/minecraftforge/client/model/IRetexturableModel.java @@ -21,6 +21,5 @@ public interface IRetexturableModel> extends IMo * @param textures New * @return Model with textures applied. */ - // 1.9: change IModel to M - IModel retexture(ImmutableMap textures); + M retexture(ImmutableMap textures); } diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index 208522a766..f129e83a58 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -31,7 +31,6 @@ import com.google.common.collect.ImmutableMap; public class ItemLayerModel implements IRetexturableModel { - public static final ItemLayerModel instance = new ItemLayerModel(ImmutableList.of()); private final ImmutableList textures; @@ -71,7 +70,7 @@ public class ItemLayerModel implements IRetexturableModel return TRSRTransformation.identity(); } - public IModel retexture(ImmutableMap textures) + public ItemLayerModel retexture(ImmutableMap textures) { ImmutableList.Builder builder = ImmutableList.builder(); for(int i = 0; i < textures.size() + this.textures.size(); i++) diff --git a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java index 8b36e5e09c..932ebfc531 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java +++ b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java @@ -152,7 +152,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, * If the fluid can't be found, water is used */ @Override - public IModel process(ImmutableMap customData) + public ModelDynBucket process(ImmutableMap customData) { String fluidName = customData.get("fluid"); Fluid fluid = FluidRegistry.getFluid(fluidName); @@ -183,7 +183,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, * If no liquid is given a hardcoded variant for the bucket is used. */ @Override - public IModel retexture(ImmutableMap textures) + public ModelDynBucket retexture(ImmutableMap textures) { ResourceLocation base = baseLocation; diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index 2bb21944d6..d08f4af9eb 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -391,7 +391,7 @@ public class ModelFluid implements IModelCustomData } @Override - public IModel process(ImmutableMap customData) + public ModelFluid process(ImmutableMap customData) { if(!customData.containsKey("fluid")) return this; diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index ea725a3de3..27423c7a94 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -93,7 +93,7 @@ public class MultiLayerModel implements IModelCustomData } @Override - public IModel process(ImmutableMap customData) + public MultiLayerModel process(ImmutableMap customData) { ImmutableMap.Builder, ModelResourceLocation> builder = ImmutableMap.builder(); for(String key : customData.keySet()) diff --git a/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java b/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java index 5a5978428f..a18af6cc87 100644 --- a/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java +++ b/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java @@ -22,7 +22,7 @@ public class ExtendedBlockState extends BlockStateContainer { private final ImmutableSet> unlistedProperties; - public ExtendedBlockState(Block blockIn, @SuppressWarnings("rawtypes") IProperty[] properties, IUnlistedProperty[] unlistedProperties) + public ExtendedBlockState(Block blockIn, IProperty[] properties, IUnlistedProperty[] unlistedProperties) { super(blockIn, properties, buildUnlistedMap(unlistedProperties)); ImmutableSet.Builder> builder = ImmutableSet.>builder(); @@ -49,7 +49,7 @@ public class ExtendedBlockState extends BlockStateContainer } @Override - protected StateImplementation createState(Block block, @SuppressWarnings("rawtypes") ImmutableMap properties, ImmutableMap, Optional> unlistedProperties) + protected StateImplementation createState(Block block, ImmutableMap, Comparable> properties, ImmutableMap, Optional> unlistedProperties) { if (unlistedProperties == null || unlistedProperties.isEmpty()) return super.createState(block, properties, unlistedProperties); return new ExtendedStateImplementation(block, properties, unlistedProperties, null); @@ -58,10 +58,9 @@ public class ExtendedBlockState extends BlockStateContainer protected static class ExtendedStateImplementation extends StateImplementation implements IExtendedBlockState { private final ImmutableMap, Optional> unlistedProperties; - @SuppressWarnings("rawtypes") - private Map, BlockState.StateImplementation> normalMap; + private Map, Comparable>, BlockStateContainer.StateImplementation> normalMap; - protected ExtendedStateImplementation(Block block, @SuppressWarnings("rawtypes") ImmutableMap properties, ImmutableMap, Optional> unlistedProperties, @SuppressWarnings("rawtypes") ImmutableTable table) + protected ExtendedStateImplementation(Block block, ImmutableMap, Comparable> properties, ImmutableMap, Optional> unlistedProperties, ImmutableTable, Comparable, IBlockState> table) { super(block, properties); this.unlistedProperties = unlistedProperties; @@ -85,15 +84,13 @@ public class ExtendedBlockState extends BlockStateContainer { return this; } - @SuppressWarnings("rawtypes") - Map map = Maps.newHashMap(getProperties()); + Map, Comparable> map = Maps.newHashMap(getProperties()); map.put(property, value); if(Iterables.all(unlistedProperties.values(), Predicates.>equalTo(Optional.absent()))) { // no dynamic properties present, looking up in the normal table return (IExtendedBlockState) normalMap.get(map); } - @SuppressWarnings("rawtypes") - ImmutableTable table = propertyValueTable; + ImmutableTable, Comparable, IBlockState> table = propertyValueTable; table = ((StateImplementation)table.get(property, value)).getPropertyValueTable(); return new ExtendedStateImplementation(getBlock(), ImmutableMap.copyOf(map), unlistedProperties, table).setMap(this.normalMap); } @@ -138,13 +135,13 @@ public class ExtendedBlockState extends BlockStateContainer } @Override - public void buildPropertyValueTable(@SuppressWarnings("rawtypes") Map, BlockState.StateImplementation> map) + public void buildPropertyValueTable(Map, Comparable>, BlockStateContainer.StateImplementation> map) { this.normalMap = map; super.buildPropertyValueTable(map); } - private ExtendedStateImplementation setMap(@SuppressWarnings("rawtypes") Map, BlockState.StateImplementation> map) + private ExtendedStateImplementation setMap(Map, Comparable>, BlockStateContainer.StateImplementation> map) { this.normalMap = map; return this; diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index 229cde6951..5737f44f75 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -109,35 +109,35 @@ public net.minecraft.world.gen.ChunkProviderServer field_73251_h # worldObj protected net.minecraft.client.renderer.entity.RenderEntityItem func_177078_a(Lnet/minecraft/item/ItemStack;)I # getMiniItemCount public net.minecraft.item.crafting.RecipesBanners$RecipeAddPattern public net.minecraft.item.crafting.RecipesBanners$RecipeDuplicatePattern -#public net.minecraft.block.state.BlockState$StateImplementation -#protected net.minecraft.block.state.BlockState$StateImplementation (Lnet/minecraft/block/Block;Lcom/google/common/collect/ImmutableMap;)V -#protected net.minecraft.block.state.BlockState$StateImplementation field_177238_c # propertyValueTable +public net.minecraft.block.state.BlockStateContainer$StateImplementation +protected net.minecraft.block.state.BlockStateContainer$StateImplementation (Lnet/minecraft/block/Block;Lcom/google/common/collect/ImmutableMap;)V +protected net.minecraft.block.state.BlockStateContainer$StateImplementation field_177238_c # propertyValueTable public net.minecraft.client.renderer.block.model.ModelBlock field_178318_c # textures public net.minecraft.client.renderer.block.model.ModelBlock field_178315_d # parent public net.minecraft.client.renderer.block.model.ModelBlock field_178322_i # ambientOcclusion -#protected net.minecraft.client.resources.model.ModelBakery field_177602_b # LOCATIONS_BUILTIN_TEXTURES -#protected net.minecraft.client.resources.model.ModelBakery field_177598_f # resourceManager -#protected net.minecraft.client.resources.model.ModelBakery field_177599_g # sprites -#protected net.minecraft.client.resources.model.ModelBakery field_177609_j # textureMap -#protected net.minecraft.client.resources.model.ModelBakery field_177610_k # blockModelShapes -#protected net.minecraft.client.resources.model.ModelBakery field_177605_n # bakedRegistry -#protected net.minecraft.client.resources.model.ModelBakery field_177606_o # MODEL_GENERATED -#protected net.minecraft.client.resources.model.ModelBakery field_177618_p # MODEL_COMPASS -#protected net.minecraft.client.resources.model.ModelBakery field_177617_q # MODEL_CLOCK -#protected net.minecraft.client.resources.model.ModelBakery field_177616_r # MODEL_ENTITY -#protected net.minecraft.client.resources.model.ModelBakery func_177591_a(Ljava/util/Collection;)V # loadVariants -#protected net.minecraft.client.resources.model.ModelBakery func_177569_a(Lnet/minecraft/client/renderer/block/model/ModelBlockDefinition;Lnet/minecraft/client/resources/model/ModelResourceLocation;)V # registerVariant -#protected net.minecraft.client.resources.model.ModelBakery func_177586_a(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/block/model/ModelBlockDefinition; # getModelBlockDefinition -#protected net.minecraft.client.resources.model.ModelBakery func_177594_c(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/block/model/ModelBlock; # loadModel -#protected net.minecraft.client.resources.model.ModelBakery func_177592_e()V # registerVariantNames -#protected net.minecraft.client.resources.model.ModelBakery func_177596_a(Lnet/minecraft/item/Item;)Ljava/util/List; # getVariantNames -#protected net.minecraft.client.resources.model.ModelBakery func_177583_a(Ljava/lang/String;)Lnet/minecraft/util/ResourceLocation; # getItemLocation -#protected net.minecraft.client.resources.model.ModelBakery func_177585_a(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Ljava/util/Set; # getTextureLocations -#protected net.minecraft.client.resources.model.ModelBakery func_177581_b(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Z # hasItemModel -#protected net.minecraft.client.resources.model.ModelBakery func_177587_c(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Z # isCustomRenderer -#protected net.minecraft.client.resources.model.ModelBakery func_177582_d(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Lnet/minecraft/client/renderer/block/model/ModelBlock; # makeItemModel -#protected net.minecraft.client.resources.model.ModelBakery func_177580_d(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/util/ResourceLocation; # getModelLocation -#public net.minecraft.client.resources.model.WeightedBakedModel field_177565_b # models +protected net.minecraft.client.renderer.block.model.ModelBakery field_177602_b # LOCATIONS_BUILTIN_TEXTURES +protected net.minecraft.client.renderer.block.model.ModelBakery field_177598_f # resourceManager +protected net.minecraft.client.renderer.block.model.ModelBakery field_177599_g # sprites +protected net.minecraft.client.renderer.block.model.ModelBakery field_177609_j # textureMap +protected net.minecraft.client.renderer.block.model.ModelBakery field_177610_k # blockModelShapes +protected net.minecraft.client.renderer.block.model.ModelBakery field_177605_n # bakedRegistry +protected net.minecraft.client.renderer.block.model.ModelBakery field_177606_o # MODEL_GENERATED +#protected net.minecraft.client.renderer.block.model.ModelBakery field_177618_p # MODEL_COMPASS +#protected net.minecraft.client.renderer.block.model.ModelBakery field_177617_q # MODEL_CLOCK +protected net.minecraft.client.renderer.block.model.ModelBakery field_177616_r # MODEL_ENTITY +#protected net.minecraft.client.renderer.block.model.ModelBakery func_177591_a(Ljava/util/Collection;)V # loadVariants +protected net.minecraft.client.renderer.block.model.ModelBakery func_177569_a(Lnet/minecraft/client/renderer/block/model/ModelBlockDefinition;Lnet/minecraft/client/renderer/block/model/ModelResourceLocation;)V # registerVariant +protected net.minecraft.client.renderer.block.model.ModelBakery func_177586_a(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/block/model/ModelBlockDefinition; # getModelBlockDefinition +protected net.minecraft.client.renderer.block.model.ModelBakery func_177594_c(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/block/model/ModelBlock; # loadModel +protected net.minecraft.client.renderer.block.model.ModelBakery func_177592_e()V # registerVariantNames +protected net.minecraft.client.renderer.block.model.ModelBakery func_177596_a(Lnet/minecraft/item/Item;)Ljava/util/List; # getVariantNames +protected net.minecraft.client.renderer.block.model.ModelBakery func_177583_a(Ljava/lang/String;)Lnet/minecraft/util/ResourceLocation; # getItemLocation +protected net.minecraft.client.renderer.block.model.ModelBakery func_177585_a(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Ljava/util/Set; # getTextureLocations +protected net.minecraft.client.renderer.block.model.ModelBakery func_177581_b(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Z # hasItemModel +protected net.minecraft.client.renderer.block.model.ModelBakery func_177587_c(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Z # isCustomRenderer +protected net.minecraft.client.renderer.block.model.ModelBakery func_177582_d(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Lnet/minecraft/client/renderer/block/model/ModelBlock; # makeItemModel +protected net.minecraft.client.renderer.block.model.ModelBakery func_177580_d(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/util/ResourceLocation; # getModelLocation +#public net.minecraft.client.renderer.block.model.WeightedBakedModel field_177565_b # models # EnumFacing public net.minecraft.util.EnumFacing field_82609_l # VALUES public net.minecraft.util.EnumFacing field_176754_o # HORIZONTALS From becb0a9e0eda233be86a58648a80f9efbf55a4a7 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 2 Mar 2016 20:28:51 +0300 Subject: [PATCH 023/243] Chunk --- .../minecraft/world/chunk/Chunk.java.patch | 127 ++++++++++++++++-- .../world/chunk/Chunk.java.patch.rej | 98 -------------- 2 files changed, 116 insertions(+), 109 deletions(-) delete mode 100644 rejects/minecraft/net/minecraft/world/chunk/Chunk.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch index c9ec58283a..dec892407e 100644 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -1,10 +1,34 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java +++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java +@@ -175,7 +175,7 @@ + { + IBlockState iblockstate = this.func_186032_a(j, l - 1, k); + +- if (iblockstate.func_185891_c() != 0) ++ if (iblockstate.getLightOpacity(this.worldObj, new BlockPos(j, l - 1, k)) != 0) + { + this.heightMap[k << 4 | j] = l; + +@@ -448,12 +448,12 @@ + + public int getBlockLightOpacity(BlockPos pos) + { +- return this.getBlockState(pos).func_185891_c(); ++ return this.getBlockState(pos).getLightOpacity(this.worldObj, pos); + } + + private int getBlockLightOpacity(int x, int y, int z) + { +- return this.func_186032_a(x, y, z).func_185891_c(); ++ return this.func_186032_a(x, y, z).getLightOpacity(this.worldObj, new BlockPos(x, y, z)); + } + + public IBlockState getBlockState(BlockPos pos) @@ -534,6 +534,7 @@ { Block block = state.getBlock(); Block block1 = iblockstate.getBlock(); -+ int k1 = block1.getLightOpacity(this.worldObj, pos); // Relocate old light value lookup here, so that it is called before TE is removed. ++ int k1 = iblockstate.getLightOpacity(this.worldObj, pos); // Relocate old light value lookup here, so that it is called before TE is removed. ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4]; boolean flag = false; @@ -30,7 +54,17 @@ this.worldObj.removeTileEntity(pos); } } -@@ -595,28 +601,18 @@ +@@ -574,8 +580,7 @@ + } + else + { +- int j1 = state.func_185891_c(); +- int k1 = iblockstate.func_185891_c(); ++ int j1 = state.getLightOpacity(this.worldObj, pos); + + if (j1 > 0) + { +@@ -595,28 +600,18 @@ } } @@ -61,7 +95,7 @@ this.worldObj.setTileEntity(pos, tileentity1); } -@@ -719,6 +715,7 @@ +@@ -719,6 +714,7 @@ k = this.entityLists.length - 1; } @@ -69,7 +103,28 @@ entityIn.addedToChunk = true; entityIn.chunkCoordX = this.xPosition; entityIn.chunkCoordY = k; -@@ -774,14 +771,9 @@ +@@ -758,13 +754,19 @@ + { + IBlockState iblockstate = this.getBlockState(pos); + Block block = iblockstate.getBlock(); +- return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, iblockstate.getBlock().getMetaFromState(iblockstate)); ++ return !block.hasTileEntity(iblockstate) ? null : block.createTileEntity(this.worldObj, iblockstate); + } + + public TileEntity getTileEntity(BlockPos pos, Chunk.EnumCreateEntityType p_177424_2_) + { + TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(pos); + ++ if (tileentity != null && tileentity.isInvalid()) ++ { ++ chunkTileEntityMap.remove(pos); ++ tileentity = null; ++ } ++ + if (tileentity == null) + { + if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) +@@ -774,14 +776,9 @@ } else if (p_177424_2_ == Chunk.EnumCreateEntityType.QUEUED) { @@ -85,7 +140,16 @@ return tileentity; } -@@ -810,6 +802,7 @@ +@@ -801,7 +798,7 @@ + tileEntityIn.setWorldObj(this.worldObj); + tileEntityIn.setPos(pos); + +- if (this.getBlockState(pos).getBlock() instanceof ITileEntityProvider) ++ if (this.getBlockState(pos).getBlock().hasTileEntity(this.getBlockState(pos))) + { + if (this.chunkTileEntityMap.containsKey(pos)) + { +@@ -810,6 +807,7 @@ tileEntityIn.validate(); this.chunkTileEntityMap.put(pos, tileEntityIn); @@ -93,7 +157,7 @@ } } -@@ -838,8 +831,9 @@ +@@ -838,8 +836,9 @@ entity.onChunkLoad(); } @@ -104,7 +168,7 @@ } public void onChunkUnload() -@@ -855,6 +849,7 @@ +@@ -855,6 +854,7 @@ { this.worldObj.unloadEntities(this.entityLists[i]); } @@ -112,7 +176,7 @@ } public void setChunkModified() -@@ -864,8 +859,8 @@ +@@ -864,8 +864,8 @@ public void getEntitiesWithinAABBForEntity(Entity entityIn, AxisAlignedBB aabb, List listToFill, Predicate p_177414_4_) { @@ -123,7 +187,7 @@ i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); -@@ -904,8 +899,8 @@ +@@ -904,8 +904,8 @@ public void getEntitiesOfTypeWithinAAAB(Class entityClass, AxisAlignedBB aabb, List listToFill, Predicate p_177430_4_) { @@ -134,7 +198,30 @@ i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); -@@ -1162,10 +1157,16 @@ +@@ -1050,7 +1050,7 @@ + { + BlockPos blockpos = (BlockPos)this.tileEntityPosQueue.poll(); + +- if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.getBlockState(blockpos).getBlock().hasTileEntity()) ++ if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.getBlockState(blockpos).getBlock().hasTileEntity(this.getBlockState(blockpos))) + { + TileEntity tileentity = this.createNewTileEntity(blockpos); + this.worldObj.setTileEntity(blockpos, tileentity); +@@ -1114,6 +1114,13 @@ + @SideOnly(Side.CLIENT) + public void func_186033_a(PacketBuffer p_186033_1_, int p_186033_2_, boolean p_186033_3_) + { ++ for(TileEntity tileEntity : chunkTileEntityMap.values()) ++ { ++ tileEntity.updateContainingBlockInfo(); ++ tileEntity.getBlockMetadata(); ++ tileEntity.getBlockType(); ++ } ++ + boolean flag = !this.worldObj.provider.getHasNoSky(); + + for (int i = 0; i < this.storageArrays.length; ++i) +@@ -1162,10 +1169,16 @@ this.isTerrainPopulated = true; this.generateHeightMap(); @@ -151,7 +238,25 @@ } public BiomeGenBase getBiome(BlockPos pos, BiomeProvider chunkManager) -@@ -1481,4 +1482,20 @@ +@@ -1239,7 +1252,7 @@ + { + BlockPos blockpos2 = blockpos1.offset(enumfacing); + +- if (this.worldObj.getBlockState(blockpos2).func_185906_d() > 0) ++ if (this.worldObj.getBlockState(blockpos2).getLightValue(this.worldObj, blockpos2) > 0) + { + this.worldObj.checkLight(blockpos2); + } +@@ -1370,7 +1383,7 @@ + { + blockpos$mutableblockpos.set(blockpos$mutableblockpos.getX(), l, blockpos$mutableblockpos.getZ()); + +- if (this.getBlockState(blockpos$mutableblockpos).func_185906_d() > 0) ++ if (this.getBlockState(blockpos$mutableblockpos).getLightValue(this.worldObj, blockpos$mutableblockpos) > 0) + { + this.worldObj.checkLight(blockpos$mutableblockpos); + } +@@ -1481,4 +1494,20 @@ QUEUED, CHECK; } diff --git a/rejects/minecraft/net/minecraft/world/chunk/Chunk.java.patch.rej b/rejects/minecraft/net/minecraft/world/chunk/Chunk.java.patch.rej deleted file mode 100644 index f731b5fc2f..0000000000 --- a/rejects/minecraft/net/minecraft/world/chunk/Chunk.java.patch.rej +++ /dev/null @@ -1,98 +0,0 @@ -++++ REJECTED PATCH 1 - { - Block block = this.getBlock0(j, l - 1, k); - -- if (block.getLightOpacity() != 0) -+ if (getBlockLightOpacity(j, l - 1, k) != 0) - { - this.heightMap[k << 4 | j] = l; - -++++ END PATCH -++++ REJECTED PATCH 2 - - public int getBlockLightOpacity(BlockPos pos) - { -- return this.getBlock(pos).getLightOpacity(); -+ return this.getBlock(pos).getLightOpacity(worldObj, pos); - } - - private int getBlockLightOpacity(int x, int y, int z) - { -- return this.getBlock0(x, y, z).getLightOpacity(); -+ return getBlockLightOpacity(new BlockPos((xPosition << 4) + x, y, (zPosition << 4) + z)); - } - - private Block getBlock0(int x, int y, int z) -++++ END PATCH -++++ REJECTED PATCH 5 - } - else - { -- int j1 = block.getLightOpacity(); -- int k1 = block1.getLightOpacity(); -+ int j1 = block.getLightOpacity(this.worldObj, pos); - - if (j1 > 0) - { -++++ END PATCH -++++ REJECTED PATCH 8 - private TileEntity createNewTileEntity(BlockPos pos) - { - Block block = this.getBlock(pos); -- return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, this.getBlockMetadata(pos)); -+ IBlockState state = block.getStateFromMeta(this.getBlockMetadata(pos)); -+ return !block.hasTileEntity(state) ? null : block.createTileEntity(this.worldObj, state); - } - - public TileEntity getTileEntity(BlockPos pos, Chunk.EnumCreateEntityType p_177424_2_) - { - TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(pos); - -+ if (tileentity != null && tileentity.isInvalid()) -+ { -+ chunkTileEntityMap.remove(pos); -+ tileentity = null; -+ } -+ - if (tileentity == null) - { - if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) -++++ END PATCH -++++ REJECTED PATCH 10 - tileEntityIn.setWorldObj(this.worldObj); - tileEntityIn.setPos(pos); - -- if (this.getBlock(pos) instanceof ITileEntityProvider) -+ if (this.getBlock(pos).hasTileEntity(getBlock(pos).getStateFromMeta(this.getBlockMetadata(pos)))) - { - if (this.chunkTileEntityMap.containsKey(pos)) - { -++++ END PATCH -++++ REJECTED PATCH 16 - while (!this.tileEntityPosQueue.isEmpty()) - { - BlockPos blockpos = (BlockPos)this.tileEntityPosQueue.poll(); -+ Block block = this.getBlock(blockpos); -+ IBlockState state = block.getStateFromMeta(this.getBlockMetadata(blockpos)); - -- if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.getBlock(blockpos).hasTileEntity()) -+ if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && block.hasTileEntity(state)) - { - TileEntity tileentity = this.createNewTileEntity(blockpos); - this.worldObj.setTileEntity(blockpos, tileentity); -++++ END PATCH -++++ REJECTED PATCH 17 - @SideOnly(Side.CLIENT) - public void fillChunk(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_) - { -+ for(TileEntity tileEntity : chunkTileEntityMap.values()) -+ { -+ tileEntity.updateContainingBlockInfo(); -+ tileEntity.getBlockMetadata(); -+ tileEntity.getBlockType(); -+ } -+ - int i = 0; - boolean flag = !this.worldObj.provider.getHasNoSky(); - -++++ END PATCH From b15667a7e6e5ee32d0713314ae8417aaefd0a5fb Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 2 Mar 2016 08:59:31 -0500 Subject: [PATCH 024/243] DedicatedServer IntegratedServer --- .../dedicated/DedicatedServer.java.patch | 20 ++++++- .../integrated/IntegratedServer.java.patch | 60 ++++++++++++++++++- .../dedicated/DedicatedServer.java.patch.rej | 18 ------ .../IntegratedServer.java.patch.rej | 58 ------------------ 4 files changed, 76 insertions(+), 80 deletions(-) delete mode 100644 rejects/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index f2415104a2..d945032b47 100644 --- a/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -25,7 +25,23 @@ logger.info("Loading properties"); this.settings = new PropertyManager(new File("server.properties")); this.eula = new ServerEula(new File("eula.txt")); -@@ -282,7 +286,7 @@ +@@ -205,6 +209,7 @@ + } + else + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStarted(); + this.func_184105_a(new DedicatedPlayerList(this)); + long j = System.nanoTime(); + +@@ -254,6 +259,7 @@ + TileEntitySkull.func_184293_a(this.getPlayerProfileCache()); + TileEntitySkull.func_184294_a(this.getMinecraftSessionService()); + PlayerProfileCache.func_187320_a(this.isServerInOnlineMode()); ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; + logger.info("Preparing level \"" + this.getFolderName() + "\""); + this.loadAllWorlds(this.getFolderName(), this.getFolderName(), k, worldtype, s2); + long i1 = System.nanoTime() - j; +@@ -282,7 +288,7 @@ thread1.start(); } @@ -34,7 +50,7 @@ } } } -@@ -580,6 +584,9 @@ +@@ -580,6 +586,9 @@ return this.settings.getIntProperty("network-compression-threshold", super.getNetworkCompressionTreshold()); } diff --git a/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch index 51bc84dfe0..e83ac8ccbd 100644 --- a/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -9,7 +9,63 @@ ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(p_71247_1_, true); this.setResourcePackFromWorld(this.getFolderName(), isavehandler); WorldInfo worldinfo = isavehandler.loadWorldInfo(); -@@ -138,9 +136,10 @@ +@@ -83,44 +81,23 @@ + worldinfo.setWorldName(p_71247_2_); + } + +- for (int i = 0; i < this.worldServers.length; ++i) ++ WorldServer overWorld = (isDemo() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init() : ++ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init()); ++ overWorld.initialize(this.theWorldSettings); ++ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) + { +- int j = 0; +- +- if (i == 1) ++ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.theProfiler)).init()); ++ world.addWorldAccess(new WorldManager(this, world)); ++ if (!this.isSinglePlayer()) + { +- j = -1; ++ world.getWorldInfo().setGameType(getGameType()); + } +- +- if (i == 2) +- { +- j = 1; +- } +- +- if (i == 0) +- { +- if (this.isDemo()) +- { +- this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- } +- else +- { +- this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- } +- +- this.worldServers[i].initialize(this.theWorldSettings); +- } +- else +- { +- this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); +- } +- +- this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); + } + +- this.func_184103_al().setPlayerManager(this.worldServers); ++ this.func_184103_al().setPlayerManager(new WorldServer[]{ overWorld }); + +- if (this.worldServers[0].getWorldInfo().getDifficulty() == null) ++ if (overWorld.getWorldInfo().getDifficulty() == null) + { + this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); + } +@@ -138,9 +115,10 @@ this.setAllowFlight(true); logger.info("Generating keypair"); this.setKeyPair(CryptManager.generateKeyPair()); @@ -21,7 +77,7 @@ } public void tick() -@@ -213,6 +212,7 @@ +@@ -213,6 +191,7 @@ public EnumDifficulty getDifficulty() { diff --git a/rejects/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch.rej deleted file mode 100644 index 5a4f31b4c5..0000000000 --- a/rejects/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch.rej +++ /dev/null @@ -1,18 +0,0 @@ -++++ REJECTED PATCH 4 - } - else - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStarted(); - this.setConfigManager(new DedicatedPlayerList(this)); - long j = System.nanoTime(); - -++++ END PATCH -++++ REJECTED PATCH 5 - this.setBuildLimit((this.getBuildLimit() + 8) / 16 * 16); - this.setBuildLimit(MathHelper.clamp_int(this.getBuildLimit(), 64, 256)); - this.settings.setProperty("max-build-height", Integer.valueOf(this.getBuildLimit())); -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; - logger.info("Preparing level \"" + this.getFolderName() + "\""); - this.loadAllWorlds(this.getFolderName(), this.getFolderName(), k, worldtype, s2); - long i1 = System.nanoTime() - j; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej deleted file mode 100644 index 621619af0a..0000000000 --- a/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej +++ /dev/null @@ -1,58 +0,0 @@ -++++ REJECTED PATCH 2 - worldinfo.setWorldName(p_71247_2_); - } - -- for (int i = 0; i < this.worldServers.length; ++i) -- { -- int j = 0; -+ WorldServer overWorld = (isDemo() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init() : -+ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init()); -+ overWorld.initialize(this.theWorldSettings); - -- if (i == 1) -+ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) -+ { -+ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.theProfiler)).init()); -+ world.addWorldAccess(new WorldManager(this, world)); -+ if (!this.isSinglePlayer()) - { -- j = -1; -+ world.getWorldInfo().setGameType(getGameType()); - } -- -- if (i == 2) -- { -- j = 1; -- } -- -- if (i == 0) -- { -- if (this.isDemo()) -- { -- this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); -- } -- else -- { -- this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); -- } -- -- this.worldServers[i].initialize(this.theWorldSettings); -- } -- else -- { -- this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); -- } -- -- this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); - } - -- this.getConfigurationManager().setPlayerManager(this.worldServers); -+ this.getConfigurationManager().setPlayerManager(new WorldServer[]{ overWorld }); - -- if (this.worldServers[0].getWorldInfo().getDifficulty() == null) -+ if (overWorld.getWorldInfo().getDifficulty() == null) - { - this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); - } -++++ END PATCH From 706e894cbb5fff4ebd28f2389ecc0a7ceaebf9f0 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Thu, 3 Mar 2016 18:07:18 +1100 Subject: [PATCH 025/243] Updated the biome dictionary Squashed commits: [4064de6] Updated the biome dictionary --- .../common/BiomeDictionary.java | 114 +++++++----------- 1 file changed, 42 insertions(+), 72 deletions(-) diff --git a/src/main/java/net/minecraftforge/common/BiomeDictionary.java b/src/main/java/net/minecraftforge/common/BiomeDictionary.java index df4cf2e6a5..704137a531 100644 --- a/src/main/java/net/minecraftforge/common/BiomeDictionary.java +++ b/src/main/java/net/minecraftforge/common/BiomeDictionary.java @@ -4,10 +4,11 @@ import java.util.*; import net.minecraftforge.fml.common.FMLLog; import net.minecraft.init.Blocks; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.biome.*; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.event.terraingen.DeferredBiomeDecorator; -import static net.minecraft.world.biome.BiomeGenBase.*; +import static net.minecraft.init.Biomes.*; import static net.minecraftforge.common.BiomeDictionary.Type.*; public class BiomeDictionary @@ -53,15 +54,7 @@ public class BiomeDictionary SANDY, SNOWY, WASTELAND, - BEACH, - - /*Deprecated tags, kept for compatibility*/ - @Deprecated - /**Replaced by SANDY**/ - DESERT(SANDY), - @Deprecated - /**Replaced by SNOWY**/ - FROZEN(SNOWY); + BEACH; private List subTags; @@ -106,7 +99,7 @@ public class BiomeDictionary { typeInfoList = Arrays.copyOf(typeInfoList, ret.ordinal()+1); } - for(BiomeInfo bInfo:biomeList) + for(BiomeInfo bInfo:biomeInfoMap.values()) { if(bInfo != null) { @@ -119,8 +112,7 @@ public class BiomeDictionary } } - private static final int BIOME_LIST_SIZE = BiomeGenBase.getBiomeGenArray().length; - private static BiomeInfo[] biomeList = new BiomeInfo[BIOME_LIST_SIZE]; + private static HashMap biomeInfoMap = new HashMap(); @SuppressWarnings("unchecked") private static ArrayList[] typeInfoList = new ArrayList[Type.values().length]; @@ -154,7 +146,7 @@ public class BiomeDictionary { types = listSubTags(types); - if(BiomeGenBase.getBiomeGenArray()[biome.biomeID] != null) + if(BiomeGenBase.field_185377_q.getNameForObject(biome) != null) { for(Type type : types) { @@ -166,15 +158,16 @@ public class BiomeDictionary typeInfoList[type.ordinal()].add(biome); } - if(biomeList[biome.biomeID] == null) + if(!isBiomeRegistered(biome)) { - biomeList[biome.biomeID] = new BiomeInfo(types); + ResourceLocation location = BiomeGenBase.field_185377_q.getNameForObject(biome); + biomeInfoMap.put(location, new BiomeInfo(types)); } else { for(Type type : types) { - biomeList[biome.biomeID].typeList.add(type); + getBiomeInfo(biome).typeList.add(type); } } @@ -208,14 +201,8 @@ public class BiomeDictionary */ public static Type[] getTypesForBiome(BiomeGenBase biome) { - checkRegistration(biome); - - if(biomeList[biome.biomeID] != null) - { - return (Type[])biomeList[biome.biomeID].typeList.toArray(new Type[0]); - } - - return new Type[0]; + checkRegistration(biome); + return (Type[])getBiomeInfo(biome).typeList.toArray(new Type[0]); } /** @@ -227,21 +214,15 @@ public class BiomeDictionary */ public static boolean areBiomesEquivalent(BiomeGenBase biomeA, BiomeGenBase biomeB) { - int a = biomeA.biomeID; - int b = biomeB.biomeID; - checkRegistration(biomeA); checkRegistration(biomeB); - if(biomeList[a] != null && biomeList[b] != null) + for(Type type : getTypesForBiome(biomeA)) { - for(Type type : biomeList[a].typeList) - { - if(containsType(biomeList[b], type)) - { - return true; - } - } + if(containsType(getBiomeInfo(biomeB), type)) + { + return true; + } } return false; @@ -257,13 +238,7 @@ public class BiomeDictionary public static boolean isBiomeOfType(BiomeGenBase biome, Type type) { checkRegistration(biome); - - if(biomeList[biome.biomeID] != null) - { - return containsType(biomeList[biome.biomeID], type); - } - - return false; + return containsType(getBiomeInfo(biome), type); } /** @@ -273,12 +248,7 @@ public class BiomeDictionary */ public static boolean isBiomeRegistered(BiomeGenBase biome) { - return biomeList[biome.biomeID] != null; - } - - public static boolean isBiomeRegistered(int biomeID) - { - return biomeList[biomeID] != null; + return biomeInfoMap.containsKey(BiomeGenBase.field_185377_q.getNameForObject(biome)); } public static void registerAllBiomes() @@ -294,15 +264,10 @@ public class BiomeDictionary */ public static void registerAllBiomesAndGenerateEvents() { - for(int i = 0; i < BiomeGenBase.getBiomeGenArray().length; i++) - { - BiomeGenBase biome = BiomeGenBase.getBiomeGenArray()[i]; - - if(biome == null) - { - continue; - } - + for (ResourceLocation biomeResource : BiomeGenBase.field_185377_q.getKeys()) + { + BiomeGenBase biome = BiomeGenBase.field_185377_q.getObject(biomeResource); + if (biome.theBiomeDecorator instanceof DeferredBiomeDecorator) { DeferredBiomeDecorator decorator = (DeferredBiomeDecorator) biome.theBiomeDecorator; @@ -324,7 +289,7 @@ public class BiomeDictionary { if (biome.theBiomeDecorator.treesPerChunk >= 3) { - if (biome.isHighHumidity() && biome.temperature >= 0.9F) + if (biome.isHighHumidity() && biome.func_185353_n() >= 0.9F) { BiomeDictionary.registerBiomeType(biome, JUNGLE); } @@ -332,36 +297,36 @@ public class BiomeDictionary { BiomeDictionary.registerBiomeType(biome, FOREST); - if (biome.temperature <= 0.2f) + if (biome.func_185353_n() <= 0.2f) { BiomeDictionary.registerBiomeType(biome, CONIFEROUS); } } } - else if(biome.maxHeight <= 0.3F && biome.maxHeight >= 0.0F) + else if(biome.func_185360_m() <= 0.3F && biome.func_185360_m() >= 0.0F) { - if(!biome.isHighHumidity() || biome.minHeight >= 0.0F) + if(!biome.isHighHumidity() || biome.func_185355_j() >= 0.0F) { BiomeDictionary.registerBiomeType(biome, PLAINS); } } - if (biome.rainfall > 0.85f) + if (biome.getFloatRainfall() > 0.85f) { BiomeDictionary.registerBiomeType(biome, WET); } - if (biome.rainfall < 0.15f) + if (biome.getFloatRainfall() < 0.15f) { BiomeDictionary.registerBiomeType(biome, DRY); } - if (biome.temperature > 0.85f) + if (biome.func_185353_n() > 0.85f) { BiomeDictionary.registerBiomeType(biome, HOT); } - if (biome.temperature < 0.15f) + if (biome.func_185353_n() < 0.15f) { BiomeDictionary.registerBiomeType(biome, COLD); } @@ -375,14 +340,14 @@ public class BiomeDictionary BiomeDictionary.registerBiomeType(biome, DENSE); } - if (biome.isHighHumidity() && biome.minHeight < 0.0F && (biome.maxHeight <= 0.3F && biome.maxHeight >= 0.0F)) + if (biome.isHighHumidity() && biome.func_185355_j() < 0.0F && (biome.func_185360_m() <= 0.3F && biome.func_185360_m() >= 0.0F)) { BiomeDictionary.registerBiomeType(biome, SWAMP); } - if (biome.minHeight <= -0.5F) + if (biome.func_185355_j() <= -0.5F) { - if (biome.maxHeight == 0.0F) + if (biome.func_185360_m() == 0.0F) { BiomeDictionary.registerBiomeType(biome, RIVER); } @@ -392,12 +357,12 @@ public class BiomeDictionary } } - if (biome.maxHeight >= 0.4F && biome.maxHeight < 1.5F) + if (biome.func_185360_m() >= 0.4F && biome.func_185360_m() < 1.5F) { BiomeDictionary.registerBiomeType(biome, HILLS); } - if (biome.maxHeight >= 1.5F) + if (biome.func_185360_m() >= 1.5F) { BiomeDictionary.registerBiomeType(biome, MOUNTAIN); } @@ -407,7 +372,7 @@ public class BiomeDictionary BiomeDictionary.registerBiomeType(biome, SNOWY); } - if (biome.topBlock != Blocks.sand && biome.temperature >= 1.0f && biome.rainfall < 0.2f) + if (biome.topBlock != Blocks.sand && biome.func_185353_n() >= 1.0f && biome.getFloatRainfall() < 0.2f) { BiomeDictionary.registerBiomeType(biome, SAVANNA); } @@ -427,6 +392,11 @@ public class BiomeDictionary } //Internal implementation + private static BiomeInfo getBiomeInfo(BiomeGenBase biome) + { + return biomeInfoMap.get(BiomeGenBase.field_185377_q.getNameForObject(biome)); + } + private static void checkRegistration(BiomeGenBase biome) { if(!isBiomeRegistered(biome)) From b6bcf7bf4bcdf225b44f813166d0d300b6577e9e Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 2 Mar 2016 23:23:40 -0800 Subject: [PATCH 026/243] Enchantments, some world, Biomes, bucks, world/gen/features. --- .../net/minecraft/block/Block.java.patch | 29 ++--- .../enchantment/Enchantment.java.patch | 27 +++++ .../enchantment/EnchantmentHelper.java.patch | 19 ++++ .../net/minecraft/world/ChunkCache.java.patch | 17 ++- .../net/minecraft/world/Explosion.java.patch | 28 ++++- .../world/WorldEntitySpawner.java.patch | 37 +++--- .../minecraft/world/WorldProvider.java.patch | 47 +++++++- .../net/minecraft/world/WorldType.java.patch | 27 +++-- .../world/biome/BiomeDecorator.java.patch | 105 ++++++++++++----- .../world/biome/BiomeGenBase.java.patch | 84 ++++++++++++++ .../world/biome/BiomeGenForest.java.patch | 2 +- .../world/biome/BiomeGenHills.java.patch | 2 +- .../world/biome/BiomeProvider.java.patch | 38 +++++++ .../chunk/storage/AnvilChunkLoader.java.patch | 43 ++++++- .../chunk/storage/AnvilSaveHandler.java.patch | 11 +- .../feature/WorldGenBigMushroom.java.patch | 34 ++++++ .../gen/feature/WorldGenBigTree.java.patch | 12 ++ .../gen/feature/WorldGenBirchTree.java.patch | 64 +++++++++++ .../world/gen/feature/WorldGenBush.java.patch | 11 ++ .../gen/feature/WorldGenCanopyTree.java.patch | 37 +++++- .../gen/feature/WorldGenDeadBush.java.patch | 19 ++++ .../gen/feature/WorldGenDungeons.java.patch | 8 +- .../gen/feature/WorldGenGlowStone1.java.patch | 11 ++ .../gen/feature/WorldGenGlowStone2.java.patch | 11 ++ .../gen/feature/WorldGenHellLava.java.patch | 11 ++ .../gen/feature/WorldGenHugeTrees.java.patch | 29 ++++- .../gen/feature/WorldGenIceSpike.java.patch | 29 +++++ .../gen/feature/WorldGenLiquids.java.patch | 11 ++ .../feature/WorldGenMegaPineTree.java.patch | 60 ++++++++++ .../gen/feature/WorldGenMinable.java.patch | 5 +- .../feature/WorldGenSavannaTree.java.patch | 40 ++++++- .../gen/feature/WorldGenShrub.java.patch | 37 ++++++ .../gen/feature/WorldGenSwamp.java.patch | 83 +++++++++++++- .../gen/feature/WorldGenTaiga1.java.patch | 26 ++++- .../gen/feature/WorldGenTaiga2.java.patch | 66 +++++++++++ .../gen/feature/WorldGenTallGrass.java.patch | 19 ++++ .../gen/feature/WorldGenTrees.java.patch | 98 +++++++++++++++- .../WorldGeneratorBonusChest.java.patch | 55 +++++++++ .../world/storage/MapData.java.patch | 2 +- .../world/storage/SaveFormatOld.java.patch | 27 +++++ .../world/storage/SaveHandler.java.patch | 35 ++++-- .../enchantment/Enchantment.java.patch.rej | 57 ---------- .../EnchantmentHelper.java.patch.rej | 23 ---- .../minecraft/world/ChunkCache.java.patch.rej | 10 -- .../minecraft/world/Explosion.java.patch.rej | 18 --- .../world/WorldProvider.java.patch.rej | 47 -------- .../biome/BiomeColorHelper.java.patch.rej | 10 -- .../world/biome/BiomeDecorator.java.patch.rej | 54 --------- .../world/biome/BiomeGenBase.java.patch.rej | 107 ------------------ .../biome/WorldChunkManager.java.patch.rej | 47 -------- .../storage/AnvilChunkLoader.java.patch.rej | 41 ------- .../WorldGenBigMushroom.java.patch.rej | 34 ------ .../feature/WorldGenBigTree.java.patch.rej | 13 --- .../feature/WorldGenCanopyTree.java.patch.rej | 34 ------ .../feature/WorldGenDeadBush.java.patch.rej | 16 --- .../feature/WorldGenDungeons.java.patch.rej | 15 --- .../gen/feature/WorldGenForest.java.patch.rej | 52 --------- .../feature/WorldGenHugeTrees.java.patch.rej | 26 ----- .../WorldGenMegaPineTree.java.patch.rej | 63 ----------- .../WorldGenSavannaTree.java.patch.rej | 39 ------- .../gen/feature/WorldGenShrub.java.patch.rej | 31 ----- .../gen/feature/WorldGenSwamp.java.patch.rej | 80 ------------- .../gen/feature/WorldGenTaiga1.java.patch.rej | 24 ---- .../gen/feature/WorldGenTaiga2.java.patch.rej | 52 --------- .../WorldGeneratorBonusChest.java.patch.rej | 16 --- .../world/storage/MapData.java.patch.rej | 10 -- .../world/storage/SaveHandler.java.patch.rej | 57 ---------- .../fml/common/FMLCommonHandler.java | 8 +- 68 files changed, 1237 insertions(+), 1103 deletions(-) rename rejects/minecraft/net/minecraft/world/SpawnerAnimals.java.patch.rej => patches.mcp/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch (74%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch rename rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej => patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch (56%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch delete mode 100644 rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/ChunkCache.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/storage/MapData.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch index e744bb3cac..65aa8f3e3a 100644 --- a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch @@ -188,7 +188,7 @@ } protected ItemStack createStackedBlock(IBlockState state) -@@ -844,6 +864,1180 @@ +@@ -844,6 +864,1175 @@ return "Block{" + blockRegistry.getNameForObject(this) + "}"; } @@ -543,23 +543,15 @@ + * Determines if a specified mob type can spawn on this block, returning false will + * prevent any mob from spawning on the block. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @param type The Mob Category Type + * @return True to allow a mob of the specified category to spawn, false to prevent it. + */ -+ public boolean canCreatureSpawn(IBlockAccess world, BlockPos pos, net.minecraft.entity.EntityLiving.SpawnPlacementType type) ++ public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, net.minecraft.entity.EntityLiving.SpawnPlacementType type) + { -+ IBlockState state = world.getBlockState(pos); -+ if (this instanceof BlockSlab) -+ { -+ return (isFullBlock() || state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP); -+ } -+ else if (this instanceof BlockStairs) -+ { -+ return state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP; -+ } -+ return isSideSolid(world, pos, EnumFacing.UP); ++ return isSideSolid(state, world, pos, EnumFacing.UP); + } + + /** @@ -677,13 +669,14 @@ + /** + * Used during tree growth to determine if newly generated leaves can replace this block. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @return true if this block can be replaced by growing leaves. + */ -+ public boolean canBeReplacedByLeaves(IBlockAccess world, BlockPos pos) ++ public boolean canBeReplacedByLeaves(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ return !isFullBlock(); ++ return !state.func_185913_b(); + } + + /** @@ -700,15 +693,16 @@ + /** + * Determines if the current block is replaceable by Ore veins during world generation. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @param target The generic target block the gen is looking for, Standards define stone + * for overworld generation, and neatherack for the nether. + * @return True to allow this block to be replaced by a ore + */ -+ public boolean isReplaceableOreGen(World world, BlockPos pos, com.google.common.base.Predicate target) ++ public boolean isReplaceableOreGen(IBlockState state, IBlockAccess world, BlockPos pos, com.google.common.base.Predicate target) + { -+ return target.apply(world.getBlockState(pos)); ++ return target.apply(state); + } + + /** @@ -941,11 +935,12 @@ + * + * Note: This happens DURING the generation, the generation may not be complete when this is called. + * ++ * @param state The current state + * @param world Current world + * @param pos Block position in world + * @param source Source plant's position in world + */ -+ public void onPlantGrow(World world, BlockPos pos, BlockPos source) ++ public void onPlantGrow(IBlockState state, World world, BlockPos pos, BlockPos source) + { + if (this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.farmland) + { diff --git a/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch index 950a1f5b80..d6bac48898 100644 --- a/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -9,3 +9,30 @@ } public void onEntityDamaged(EntityLivingBase user, Entity target, int level) +@@ -134,6 +134,26 @@ + return false; + } + ++ /** ++ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)} ++ * applies for all possible enchantments. ++ * @param stack ++ * @return ++ */ ++ public boolean canApplyAtEnchantingTable(ItemStack stack) ++ { ++ return this.type.canEnchantItem(stack.getItem()); ++ } ++ ++ /** ++ * Is this enchantment allowed to be enchanted on books via Enchantment Table ++ * @return false to disable the vanilla feature ++ */ ++ public boolean isAllowedOnBooks() ++ { ++ return true; ++ } ++ + public static void func_185257_f() + { + EntityEquipmentSlot[] aentityequipmentslot = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET}; diff --git a/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index 1cdc06c02d..cf49768b5b 100644 --- a/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -18,3 +18,22 @@ if (i <= 0) { +@@ -380,7 +380,8 @@ + + while (iterator.hasNext()) + { +- if (!p_185282_1_.enchantmentobj.canApplyTogether(((EnchantmentData)iterator.next()).enchantmentobj)) ++ Enchantment e2 = iterator.next().enchantmentobj; ++ if (!p_185282_1_.enchantmentobj.canApplyTogether(e2) || !e2.canApplyTogether(p_185282_1_.enchantmentobj)) //Forge BugFix: Let Both enchantments veto being together + { + iterator.remove(); + } +@@ -395,7 +396,7 @@ + + for (Enchantment enchantment : Enchantment.field_185264_b) + { +- if ((!enchantment.func_185261_e() || p_185291_2_) && (enchantment.type.canEnchantItem(item) || flag)) ++ if ((!enchantment.func_185261_e() || p_185291_2_) && (enchantment.canApplyAtEnchantingTable(p_185291_1_) || (flag || enchantment.isAllowedOnBooks()))) + { + for (int i = enchantment.getMaxLevel(); i > enchantment.getMinLevel() - 1; --i) + { diff --git a/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch index 3f5cc6f748..014ea8af2b 100644 --- a/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch @@ -18,7 +18,17 @@ return this.chunkArray[i][j].getLightFor(p_175629_1_, pos); } } -@@ -160,6 +164,7 @@ +@@ -150,7 +154,8 @@ + + public boolean isAirBlock(BlockPos pos) + { +- return this.getBlockState(pos).func_185904_a() == Material.air; ++ IBlockState state = this.getBlockState(pos); ++ return state.getBlock().isAir(state, this, pos); + } + + @SideOnly(Side.CLIENT) +@@ -160,6 +165,7 @@ { int i = (pos.getX() >> 4) - this.chunkX; int j = (pos.getZ() >> 4) - this.chunkZ; @@ -26,7 +36,7 @@ return this.chunkArray[i][j].getLightFor(p_175628_1_, pos); } else -@@ -178,4 +183,16 @@ +@@ -178,4 +184,17 @@ { return this.worldObj.getWorldType(); } @@ -40,6 +50,7 @@ + if (x < 0 || x >= chunkArray.length || z < 0 || z >= chunkArray[x].length) return _default; + if (chunkArray[x][z] == null) return _default; + -+ return getBlockState(pos).getBlock().isSideSolid(this, pos, side); ++ IBlockState state = getBlockState(pos); ++ return state.getBlock().isSideSolid(state, this, pos, side); + } } diff --git a/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch b/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch index 3a8d6d929d..75563e98a0 100644 --- a/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch @@ -1,14 +1,22 @@ --- ../src-base/minecraft/net/minecraft/world/Explosion.java +++ ../src-work/minecraft/net/minecraft/world/Explosion.java -@@ -67,6 +67,7 @@ +@@ -40,6 +40,7 @@ + private final float explosionSize; + private final List affectedBlockPositions; + private final Map playerKnockbackMap; ++ private final Vec3d position; + + @SideOnly(Side.CLIENT) + public Explosion(World worldIn, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) +@@ -67,6 +68,7 @@ this.explosionZ = p_i45754_7_; this.isFlaming = p_i45754_10_; this.isSmoking = p_i45754_11_; -+ this.position = new Vec3(explosionX, explosionY, explosionZ); ++ this.position = new Vec3d(explosionX, explosionY, explosionZ); } public void doExplosionA() -@@ -101,7 +102,7 @@ +@@ -101,7 +103,7 @@ if (iblockstate.func_185904_a() != Material.air) { @@ -17,7 +25,15 @@ f -= (f2 + 0.3F) * 0.3F; } -@@ -227,8 +228,7 @@ +@@ -128,6 +130,7 @@ + int j2 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D); + int j1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); ++ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3); + Vec3d vec3d = new Vec3d(this.explosionX, this.explosionY, this.explosionZ); + + for (int k2 = 0; k2 < list.size(); ++k2) +@@ -227,8 +230,7 @@ block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos), 1.0F / this.explosionSize, 0); } @@ -27,10 +43,10 @@ } } } -@@ -264,4 +264,6 @@ +@@ -264,4 +266,6 @@ { return this.affectedBlockPositions; } + -+ public Vec3 getPosition(){ return this.position; } ++ public Vec3d getPosition(){ return this.position; } } diff --git a/rejects/minecraft/net/minecraft/world/SpawnerAnimals.java.patch.rej b/patches.mcp/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch similarity index 74% rename from rejects/minecraft/net/minecraft/world/SpawnerAnimals.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch index 7c4fb96bd5..4e7af74168 100644 --- a/rejects/minecraft/net/minecraft/world/SpawnerAnimals.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch @@ -1,24 +1,26 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/world/WorldEntitySpawner.java ++++ ../src-work/minecraft/net/minecraft/world/WorldEntitySpawner.java +@@ -77,15 +77,17 @@ { if ((!enumcreaturetype.getPeacefulCreature() || spawnPeacefulMobs) && (enumcreaturetype.getPeacefulCreature() || spawnHostileMobs) && (!enumcreaturetype.getAnimal() || p_77192_4_)) { -- int j4 = worldServerIn.countEntities(enumcreaturetype.getCreatureClass()); -+ int j4 = worldServerIn.countEntities(enumcreaturetype, true); - int k4 = enumcreaturetype.getMaxNumberOfCreature() * i / MOB_COUNT_DIV; +- int k4 = worldServerIn.countEntities(enumcreaturetype.getCreatureClass()); ++ int k4 = worldServerIn.countEntities(enumcreaturetype, true); + int l4 = enumcreaturetype.getMaxNumberOfCreature() * i / MOB_COUNT_DIV; - if (j4 <= k4) + if (k4 <= l4) { + java.util.ArrayList shuffled = com.google.common.collect.Lists.newArrayList(this.eligibleChunksForSpawning); + java.util.Collections.shuffle(shuffled); - label374: -- + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + label415: + - for (ChunkCoordIntPair chunkcoordintpair1 : this.eligibleChunksForSpawning) + for (ChunkCoordIntPair chunkcoordintpair1 : shuffled) { BlockPos blockpos = getRandomChunkPosition(worldServerIn, chunkcoordintpair1.chunkXPos, chunkcoordintpair1.chunkZPos); int k1 = blockpos.getX(); -++++ END PATCH -++++ REJECTED PATCH 2 +@@ -144,8 +146,10 @@ entityliving.setLocationAndAngles((double)f, (double)i3, (double)f1, worldServerIn.rand.nextFloat() * 360.0F, 0.0F); @@ -30,24 +32,23 @@ ientitylivingdata = entityliving.onInitialSpawn(worldServerIn.getDifficultyForLocation(new BlockPos(entityliving)), ientitylivingdata); if (entityliving.isNotColliding()) -++++ END PATCH -++++ REJECTED PATCH 3 - worldServerIn.spawnEntityInWorld(entityliving); +@@ -158,7 +162,7 @@ + entityliving.setDead(); } - if (j2 >= entityliving.getMaxSpawnedInChunk()) + if (i2 >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(entityliving)) { - continue label374; + continue label415; } -++++ END PATCH -++++ REJECTED PATCH 4 +@@ -211,8 +215,9 @@ + else { BlockPos blockpos = pos.down(); ++ IBlockState state = worldIn.getBlockState(blockpos); -- if (!World.doesBlockHaveSolidTopSurface(worldIn, blockpos)) -+ if (!worldIn.getBlockState(blockpos).getBlock().canCreatureSpawn(worldIn, blockpos, spawnPlacementTypeIn)) +- if (!worldIn.getBlockState(blockpos).func_185896_q()) ++ if (!state.getBlock().canCreatureSpawn(state, worldIn, blockpos, spawnPlacementTypeIn)) { return false; } -++++ END PATCH diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch index 4102bfe0e1..730ed8d0e4 100644 --- a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -1,6 +1,44 @@ --- ../src-base/minecraft/net/minecraft/world/WorldProvider.java +++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java -@@ -172,13 +172,13 @@ +@@ -52,26 +52,12 @@ + + protected void registerWorldChunkManager() + { +- WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType(); +- +- if (worldtype == WorldType.FLAT) +- { +- FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions()); +- this.worldChunkMgr = new BiomeProviderSingle(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), Biomes.field_180279_ad)); +- } +- else if (worldtype == WorldType.DEBUG_WORLD) +- { +- this.worldChunkMgr = new BiomeProviderSingle(Biomes.plains); +- } +- else +- { +- this.worldChunkMgr = new BiomeProvider(this.worldObj.getWorldInfo()); +- } ++ this.worldChunkMgr = terrainType.getBiomeProvider(worldObj); + } + + public IChunkGenerator func_186060_c() + { +- return (IChunkGenerator)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderOverworld(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderOverworld(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings)))); ++ return terrainType.getChunkGenerator(worldObj, generatorSettings); + } + + public boolean canCoordinateBeSpawn(int x, int z) +@@ -156,7 +142,7 @@ + @SideOnly(Side.CLIENT) + public float getCloudHeight() + { +- return 128.0F; ++ return this.terrainType.getCloudHeight(); + } + + @SideOnly(Side.CLIENT) +@@ -172,13 +158,13 @@ public int getAverageGroundLevel() { @@ -16,7 +54,7 @@ } @SideOnly(Side.CLIENT) -@@ -212,6 +212,321 @@ +@@ -212,6 +198,322 @@ return new WorldBorder(); } @@ -24,6 +62,7 @@ + private net.minecraftforge.client.IRenderHandler skyRenderer = null; + private net.minecraftforge.client.IRenderHandler cloudRenderer = null; + private net.minecraftforge.client.IRenderHandler weatherRenderer = null; ++ private int dimensionId; + + /** + * Sets the providers current dimension ID, used in default getSaveFolder() @@ -212,13 +251,13 @@ + } + + @SideOnly(Side.CLIENT) -+ public Vec3 getSkyColor(net.minecraft.entity.Entity cameraEntity, float partialTicks) ++ public Vec3d getSkyColor(net.minecraft.entity.Entity cameraEntity, float partialTicks) + { + return worldObj.getSkyColorBody(cameraEntity, partialTicks); + } + + @SideOnly(Side.CLIENT) -+ public Vec3 drawClouds(float partialTicks) ++ public Vec3d drawClouds(float partialTicks) + { + return worldObj.drawCloudsBody(partialTicks); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch index 9828f8d9f3..a727426d40 100644 --- a/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch @@ -1,6 +1,16 @@ --- ../src-base/minecraft/net/minecraft/world/WorldType.java +++ ../src-work/minecraft/net/minecraft/world/WorldType.java -@@ -27,6 +27,7 @@ +@@ -1,5 +1,9 @@ + package net.minecraft.world; + ++import net.minecraft.world.chunk.IChunkGenerator; ++import net.minecraft.world.gen.ChunkProviderDebug; ++import net.minecraft.world.gen.ChunkProviderFlat; ++import net.minecraft.world.gen.ChunkProviderOverworld; + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +@@ -27,6 +31,7 @@ private WorldType(int id, String name, int version) { @@ -8,33 +18,34 @@ this.worldType = name; this.generatorVersion = version; this.canBeCreated = true; -@@ -113,4 +114,144 @@ +@@ -113,4 +118,145 @@ this.hasNotificationData = true; return this; } + -+ public net.minecraft.world.biome.WorldChunkManager getChunkManager(World world) ++ public net.minecraft.world.biome.BiomeProvider getBiomeProvider(World world) + { + if (this == FLAT) + { + net.minecraft.world.gen.FlatGeneratorInfo flatgeneratorinfo = net.minecraft.world.gen.FlatGeneratorInfo.createFlatGeneratorFromString(world.getWorldInfo().getGeneratorOptions()); -+ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), net.minecraft.world.biome.BiomeGenBase.field_180279_ad), 0.5F); ++ return new net.minecraft.world.biome.BiomeProviderSingle(net.minecraft.world.biome.BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), net.minecraft.init.Biomes.field_180279_ad)); + } + else if (this == DEBUG_WORLD) + { -+ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.plains, 0.0F); ++ return new net.minecraft.world.biome.BiomeProviderSingle(net.minecraft.init.Biomes.plains); + } + else + { -+ return new net.minecraft.world.biome.WorldChunkManager(world); ++ return new net.minecraft.world.biome.BiomeProvider(world.getWorldInfo()); + } + } + -+ public net.minecraft.world.chunk.IChunkProvider getChunkGenerator(World world, String generatorOptions) ++ public net.minecraft.world.chunk.IChunkGenerator getChunkGenerator(World world, String generatorOptions) + { + if (this == FLAT) return new net.minecraft.world.gen.ChunkProviderFlat(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); + if (this == DEBUG_WORLD) return new net.minecraft.world.gen.ChunkProviderDebug(world); -+ return new net.minecraft.world.gen.ChunkProviderGenerate(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); ++ if (this == CUSTOMIZED) return new net.minecraft.world.gen.ChunkProviderOverworld(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); ++ return new net.minecraft.world.gen.ChunkProviderOverworld(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); + } + + public int getMinimumSpawnHeight(World world) diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch index 95281792f3..9a93d4f6d9 100644 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch @@ -1,118 +1,167 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeDecorator.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeDecorator.java -@@ -100,6 +100,7 @@ +@@ -91,8 +91,10 @@ + + protected void genDecorations(BiomeGenBase biomeGenBaseIn, World p_150513_2_, Random p_150513_3_) + { ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(p_150513_2_, p_150513_3_, field_180294_c)); + this.generateOres(p_150513_2_, p_150513_3_); + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND)) + for (int i = 0; i < this.sandPerChunk2; ++i) + { + int j = p_150513_3_.nextInt(16) + 8; +@@ -100,6 +102,7 @@ this.sandGen.generate(p_150513_2_, p_150513_3_, p_150513_2_.getTopSolidOrLiquidBlock(this.field_180294_c.add(j, 0, k))); } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CLAY)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CLAY)) for (int i1 = 0; i1 < this.clayPerChunk; ++i1) { int l1 = p_150513_3_.nextInt(16) + 8; -@@ -107,6 +108,7 @@ +@@ -107,6 +110,7 @@ this.clayGen.generate(p_150513_2_, p_150513_3_, p_150513_2_.getTopSolidOrLiquidBlock(this.field_180294_c.add(l1, 0, i6))); } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND_PASS2)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND_PASS2)) for (int j1 = 0; j1 < this.sandPerChunk; ++j1) { int i2 = p_150513_3_.nextInt(16) + 8; -@@ -121,6 +123,7 @@ +@@ -121,6 +125,7 @@ ++k1; } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE)) for (int j2 = 0; j2 < k1; ++j2) { int k6 = p_150513_3_.nextInt(16) + 8; -@@ -135,6 +138,7 @@ +@@ -135,6 +140,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.BIG_SHROOM)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.BIG_SHROOM)) for (int k2 = 0; k2 < this.bigMushroomsPerChunk; ++k2) { int l6 = p_150513_3_.nextInt(16) + 8; -@@ -142,6 +146,7 @@ +@@ -142,6 +148,7 @@ this.bigMushroomGen.generate(p_150513_2_, p_150513_3_, p_150513_2_.getHeight(this.field_180294_c.add(l6, 0, k10))); } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS)) for (int l2 = 0; l2 < this.flowersPerChunk; ++l2) { int i7 = p_150513_3_.nextInt(16) + 8; -@@ -163,6 +168,7 @@ +@@ -163,6 +170,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) for (int i3 = 0; i3 < this.grassPerChunk; ++i3) { int j7 = p_150513_3_.nextInt(16) + 8; -@@ -176,6 +182,7 @@ +@@ -176,6 +184,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.DEAD_BUSH)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.DEAD_BUSH)) for (int j3 = 0; j3 < this.deadBushPerChunk; ++j3) { int k7 = p_150513_3_.nextInt(16) + 8; -@@ -189,6 +196,7 @@ +@@ -189,6 +198,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LILYPAD)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LILYPAD)) for (int k3 = 0; k3 < this.waterlilyPerChunk; ++k3) { int l7 = p_150513_3_.nextInt(16) + 8; -@@ -215,6 +223,8 @@ +@@ -215,6 +225,8 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM)) + { for (int l3 = 0; l3 < this.mushroomsPerChunk; ++l3) { if (p_150513_3_.nextInt(4) == 0) -@@ -265,7 +275,9 @@ +@@ -265,7 +277,9 @@ this.mushroomRedGen.generate(p_150513_2_, p_150513_3_, this.field_180294_c.add(j4, l15, l8)); } } - + } // End of Mushroom generation -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.REED)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.REED)) + { for (int k4 = 0; k4 < this.reedsPerChunk; ++k4) { int i9 = p_150513_3_.nextInt(16) + 8; -@@ -305,6 +317,7 @@ +@@ -291,7 +305,8 @@ + this.reedGen.generate(p_150513_2_, p_150513_3_, this.field_180294_c.add(j9, i19, i13)); + } + } +- ++ } // End of Reed generation ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.PUMPKIN)) + if (p_150513_3_.nextInt(32) == 0) + { + int i5 = p_150513_3_.nextInt(16) + 8; +@@ -305,6 +320,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CACTUS)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CACTUS)) for (int j5 = 0; j5 < this.cactiPerChunk; ++j5) { int l9 = p_150513_3_.nextInt(16) + 8; -@@ -320,6 +333,7 @@ +@@ -320,6 +336,7 @@ if (this.generateLakes) { -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_WATER)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_WATER)) for (int k5 = 0; k5 < 50; ++k5) { int i10 = p_150513_3_.nextInt(16) + 8; -@@ -334,6 +348,7 @@ +@@ -334,6 +351,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_LAVA)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_LAVA)) for (int l5 = 0; l5 < 20; ++l5) { int j10 = p_150513_3_.nextInt(16) + 8; -@@ -343,6 +358,7 @@ +@@ -343,21 +361,35 @@ (new WorldGenLiquids(Blocks.flowing_lava)).generate(p_150513_2_, p_150513_3_, blockpos3); } } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post(currentWorld, randomGenerator, field_180294_c)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post(p_150513_2_, p_150513_3_, field_180294_c)); } protected void generateOres(World p_76797_1_, Random p_76797_2_) + { ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(p_76797_1_, p_76797_2_, field_180294_c)); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, dirtGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIRT)) + this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.dirtCount, this.dirtGen, this.chunkProviderSettings.dirtMinHeight, this.chunkProviderSettings.dirtMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, gravelGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRAVEL)) + this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.gravelCount, this.gravelGen, this.chunkProviderSettings.gravelMinHeight, this.chunkProviderSettings.gravelMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, dioriteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIORITE)) + this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.dioriteCount, this.dioriteGen, this.chunkProviderSettings.dioriteMinHeight, this.chunkProviderSettings.dioriteMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, graniteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRANITE)) + this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.graniteCount, this.graniteGen, this.chunkProviderSettings.graniteMinHeight, this.chunkProviderSettings.graniteMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, andesiteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.ANDESITE)) + this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.andesiteCount, this.andesiteGen, this.chunkProviderSettings.andesiteMinHeight, this.chunkProviderSettings.andesiteMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, coalGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.COAL)) + this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.coalCount, this.coalGen, this.chunkProviderSettings.coalMinHeight, this.chunkProviderSettings.coalMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, ironGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.IRON)) + this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.ironCount, this.ironGen, this.chunkProviderSettings.ironMinHeight, this.chunkProviderSettings.ironMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, goldGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GOLD)) + this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.goldCount, this.goldGen, this.chunkProviderSettings.goldMinHeight, this.chunkProviderSettings.goldMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, redstoneGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.REDSTONE)) + this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.redstoneCount, this.redstoneGen, this.chunkProviderSettings.redstoneMinHeight, this.chunkProviderSettings.redstoneMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, diamondGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIAMOND)) + this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.diamondCount, this.diamondGen, this.chunkProviderSettings.diamondMinHeight, this.chunkProviderSettings.diamondMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, lapisGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.LAPIS)) + this.genStandardOre2(p_76797_1_, p_76797_2_, this.chunkProviderSettings.lapisCount, this.lapisGen, this.chunkProviderSettings.lapisCenterHeight, this.chunkProviderSettings.lapisSpread); ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(p_76797_1_, p_76797_2_, field_180294_c)); + } + + protected void genStandardOre1(World blockCount, Random generator, int minHeight, WorldGenerator maxHeight, int p_76795_5_, int p_76795_6_) diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch index 59181c502c..f39cc259f6 100644 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch @@ -32,3 +32,87 @@ } public Class getBiomeClass() +@@ -386,6 +387,83 @@ + return this.enableSnow; + } + ++ /* ========================================= FORGE START ======================================*/ ++ protected List flowers = new java.util.ArrayList(); ++ ++ public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) ++ { ++ return new net.minecraftforge.event.terraingen.DeferredBiomeDecorator(original); ++ } ++ ++ public int getWaterColorMultiplier() ++ { ++ net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor(this, waterColorMultiplier); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ return event.newColor; ++ } ++ ++ public int getModdedBiomeGrassColor(int original) ++ { ++ net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor(this, original); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ return event.newColor; ++ } ++ ++ public int getModdedBiomeFoliageColor(int original) ++ { ++ net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor(this, original); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ return event.newColor; ++ } ++ ++ /** ++ * Weighted random holder class used to hold possible flowers ++ * that can spawn in this biome when bonemeal is used on grass. ++ */ ++ public static class FlowerEntry extends WeightedRandom.Item ++ { ++ public final net.minecraft.block.state.IBlockState state; ++ public FlowerEntry(net.minecraft.block.state.IBlockState state, int weight) ++ { ++ super(weight); ++ this.state = state; ++ } ++ } ++ ++ /** ++ * Adds the default flowers, as of 1.7, it is 2 yellow, and 1 red. I chose 10 to allow some wiggle room in the numbers. ++ */ ++ public void addDefaultFlowers() ++ { ++ addFlower(Blocks.yellow_flower.getDefaultState().withProperty(Blocks.yellow_flower.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 20); ++ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); ++ } ++ ++ /** Register a new plant to be planted when bonemeal is used on grass. ++ * @param state The block to place. ++ * @param weight The weight of the plant, where red flowers are ++ * 10 and yellow flowers are 20. ++ */ ++ public void addFlower(IBlockState state, int weight) ++ { ++ this.flowers.add(new FlowerEntry(state, weight)); ++ } ++ ++ public void plantFlower(World world, Random rand, BlockPos pos) ++ { ++ FlowerEntry flower = (FlowerEntry)WeightedRandom.getRandomItem(rand, flowers); ++ if (flower == null || flower.state == null || ++ (flower.state.getBlock() instanceof net.minecraft.block.BlockBush && ++ !((net.minecraft.block.BlockBush)flower.state.getBlock()).canBlockStay(world, pos, flower.state))) ++ { ++ return; ++ } ++ ++ world.setBlockState(pos, flower.state, 3); ++ } ++ ++ /* ========================================= FORGE END ======================================*/ ++ + public static void func_185358_q() + { + func_185354_a(0, "ocean", new BiomeGenOcean((new BiomeGenBase.BiomeProperties("Ocean")).func_185398_c(-1.0F).func_185400_d(0.1F))); diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch index 5b14837f4e..7785a8e11f 100644 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch @@ -7,7 +7,7 @@ + @Override + public void addDefaultFlowers() + { -+ if (field_150632_aF != 1) ++ if (field_150632_aF != BiomeGenForest.Type.FLOWER) + { + super.addDefaultFlowers(); + return; diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch index c349e0c2e9..6c6c9d0d45 100644 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch @@ -51,7 +51,7 @@ + { + BlockPos blockpos = pos.add(rand.nextInt(16), rand.nextInt(28) + 4, rand.nextInt(16)); + -+ if (worldIn.getBlockState(blockpos).getBlock().isReplaceableOreGen(worldIn, blockpos, net.minecraft.block.state.pattern.BlockHelper.forBlock(Blocks.stone))) ++ if (worldIn.getBlockState(blockpos).getBlock().isReplaceableOreGen(worldIn, blockpos, net.minecraft.block.state.pattern.BlockMatcher.forBlock(Blocks.stone))) + { + worldIn.setBlockState(blockpos, Blocks.emerald_ore.getDefaultState(), 2); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch new file mode 100644 index 0000000000..a1f44da1d6 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch @@ -0,0 +1,38 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeProvider.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeProvider.java +@@ -15,6 +15,7 @@ + + public class BiomeProvider + { ++ public static List allowedBiomes = Lists.newArrayList(Biomes.forest, Biomes.plains, Biomes.taiga, Biomes.taigaHills, Biomes.forestHills, Biomes.jungle, Biomes.jungleHills); + private GenLayer genBiomes; + private GenLayer biomeIndexLayer; + private final BiomeCache biomeCache; +@@ -23,13 +24,14 @@ + protected BiomeProvider() + { + this.biomeCache = new BiomeCache(this); +- this.biomesToSpawnIn = Lists.newArrayList(new BiomeGenBase[] {Biomes.forest, Biomes.plains, Biomes.taiga, Biomes.taigaHills, Biomes.forestHills, Biomes.jungle, Biomes.jungleHills}); ++ this.biomesToSpawnIn = Lists.newArrayList(allowedBiomes); + } + + private BiomeProvider(long seed, WorldType p_i45744_3_, String p_i45744_4_) + { + this(); + GenLayer[] agenlayer = GenLayer.initializeAllBiomeGenerators(seed, p_i45744_3_, p_i45744_4_); ++ agenlayer = getModdedBiomeGenerators(p_i45744_3_, seed, agenlayer); + this.genBiomes = agenlayer[0]; + this.biomeIndexLayer = agenlayer[1]; + } +@@ -196,4 +198,11 @@ + { + this.biomeCache.cleanupCache(); + } ++ ++ public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original) ++ { ++ net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens event = new net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens(worldType, seed, original); ++ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); ++ return event.newBiomeGens; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch index 0b1799fd46..46e4f5f777 100644 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch @@ -65,7 +65,7 @@ logger.error("Chunk file at " + x + "," + z + " is in the wrong location; relocating. (Expected " + x + ", " + z + ", got " + chunk.xPosition + ", " + chunk.zPosition + ")"); nbttagcompound.setInteger("xPos", x); nbttagcompound.setInteger("zPos", z); -+ ++ + // Have to move tile entities since we don't load them at this stage + NBTTagList _tileEntities = nbttagcompound.getTagList("TileEntities", 10); + @@ -100,7 +100,44 @@ this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound); } catch (Exception exception) -@@ -347,6 +406,12 @@ +@@ -265,8 +324,17 @@ + + if (entity.writeToNBTOptional(nbttagcompound2)) + { ++ try ++ { + chunkIn.setHasEntities(true); + nbttaglist1.appendTag(nbttagcompound2); ++ } ++ catch (Exception e) ++ { ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, ++ "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author", ++ entity.getClass().getName()); ++ } + } + } + } +@@ -276,9 +344,18 @@ + + for (TileEntity tileentity : chunkIn.getTileEntityMap().values()) + { ++ try ++ { + NBTTagCompound nbttagcompound3 = new NBTTagCompound(); + tileentity.writeToNBT(nbttagcompound3); + nbttaglist2.appendTag(nbttagcompound3); ++ } ++ catch (Exception e) ++ { ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, ++ "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author", ++ tileentity.getClass().getName()); ++ } + } + + p_75820_3_.setTag("TileEntities", nbttaglist2); +@@ -347,6 +424,12 @@ chunk.setBiomeArray(p_75823_2_.getByteArray("Biomes")); } @@ -113,7 +150,7 @@ NBTTagList nbttaglist1 = p_75823_2_.getTagList("Entities", 10); if (nbttaglist1 != null) -@@ -399,8 +464,6 @@ +@@ -399,8 +482,6 @@ } } } diff --git a/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch similarity index 56% rename from rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch index 4836be7fc7..401ade530a 100644 --- a/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch @@ -1,4 +1,6 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java +@@ -21,18 +21,12 @@ { File file1 = this.getWorldDirectory(); @@ -8,15 +10,14 @@ - File file3 = new File(file1, "DIM-1"); + File file3 = new File(file1, provider.getSaveFolder()); file3.mkdirs(); - return new AnvilChunkLoader(file3); + return new AnvilChunkLoader(file3, this.field_186341_a); } - else if (provider instanceof WorldProviderEnd) - { - File file2 = new File(file1, "DIM1"); - file2.mkdirs(); -- return new AnvilChunkLoader(file2); +- return new AnvilChunkLoader(file2, this.field_186341_a); - } else { - return new AnvilChunkLoader(file1); -++++ END PATCH + return new AnvilChunkLoader(file1, this.field_186341_a); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch new file mode 100644 index 0000000000..72784ad60b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch @@ -0,0 +1,34 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java +@@ -56,9 +56,9 @@ + { + if (j >= 0 && j < 256) + { +- Material material = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).func_185904_a(); ++ IBlockState state = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)); + +- if (material != Material.air && material != Material.leaves) ++ if (!state.getBlock().isAir(state, worldIn, blockpos$mutableblockpos) && !state.getBlock().isLeaves(state, worldIn, blockpos$mutableblockpos)) + { + flag = false; + } +@@ -193,8 +193,9 @@ + if (position.getY() >= position.getY() + i - 1 || blockhugemushroom$enumtype != BlockHugeMushroom.EnumType.ALL_INSIDE) + { + BlockPos blockpos = new BlockPos(l1, l2, i2); ++ IBlockState state = worldIn.getBlockState(blockpos); + +- if (!worldIn.getBlockState(blockpos).func_185913_b()) ++ if (state.getBlock().canBeReplacedByLeaves(state, worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, block.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, blockhugemushroom$enumtype)); + } +@@ -207,7 +208,7 @@ + { + IBlockState iblockstate = worldIn.getBlockState(position.up(i3)); + +- if (!iblockstate.func_185913_b()) ++ if (iblockstate.getBlock().canBeReplacedByLeaves(iblockstate, worldIn, position.up(i3))) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(i3), block.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, BlockHugeMushroom.EnumType.STEM)); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch index 9f7ba74535..81386001d6 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch @@ -1,5 +1,17 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java +@@ -99,9 +99,9 @@ + if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_181631_2_ * p_181631_2_)) + { + BlockPos blockpos = p_181631_1_.add(j, 0, k); +- Material material = this.world.getBlockState(blockpos).func_185904_a(); ++ IBlockState state = this.world.getBlockState(blockpos); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(state, world, blockpos) || state.getBlock().isLeaves(state, world, blockpos)) + { + this.setBlockAndNotifyAdequately(this.world, blockpos, p_181631_3_); + } @@ -254,7 +254,7 @@ { BlockPos blockpos1 = posOne.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch new file mode 100644 index 0000000000..f92c104f12 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch @@ -0,0 +1,64 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java +@@ -8,6 +8,7 @@ + import net.minecraft.block.material.Material; + import net.minecraft.block.state.IBlockState; + import net.minecraft.init.Blocks; ++import net.minecraft.util.EnumFacing; + import net.minecraft.util.math.BlockPos; + import net.minecraft.world.World; + +@@ -56,9 +57,9 @@ + { + for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) + { +- if (j >= 0 && j < 256) ++ if (j >= 0 && j < worldIn.getHeight()) + { +- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock())) ++ if (!this.isReplaceable(worldIn, blockpos$mutableblockpos.set(l, j, i1))) + { + flag = false; + } +@@ -77,11 +78,13 @@ + } + else + { +- Block block = worldIn.getBlockState(position.down()).getBlock(); ++ BlockPos down = position.down(); ++ IBlockState state = worldIn.getBlockState(down); ++ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, down, EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); + +- if ((block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland) && position.getY() < 256 - i - 1) ++ if (isSoil && position.getY() < worldIn.getHeight() - i - 1) + { +- this.func_175921_a(worldIn, position.down()); ++ state.getBlock().onPlantGrow(state, worldIn, down, position); + + for (int i2 = position.getY() - 3 + i; i2 <= position.getY() + i; ++i2) + { +@@ -99,9 +102,9 @@ + if (Math.abs(j1) != l2 || Math.abs(l1) != l2 || rand.nextInt(2) != 0 && k2 != 0) + { + BlockPos blockpos = new BlockPos(i3, i2, k1); +- Material material = worldIn.getBlockState(blockpos).func_185904_a(); ++ IBlockState state2 = worldIn.getBlockState(blockpos); + +- if (material == Material.air || material == Material.leaves) ++ if (state2.getBlock().isAir(state2, worldIn, blockpos) || state2.getBlock().isAir(state2, worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181630_b); + } +@@ -112,9 +115,10 @@ + + for (int j2 = 0; j2 < i; ++j2) + { +- Material material1 = worldIn.getBlockState(position.up(j2)).func_185904_a(); ++ BlockPos upN = position.up(j2); ++ IBlockState state2 = worldIn.getBlockState(upN); + +- if (material1 == Material.air || material1 == Material.leaves) ++ if (state2.getBlock().isAir(state2, worldIn, upN) || state2.getBlock().isLeaves(state2, worldIn, upN)) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(j2), field_181629_a); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java.patch new file mode 100644 index 0000000000..2949665850 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java +@@ -20,7 +20,7 @@ + { + BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8)); + +- if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky() || blockpos.getY() < 255) && this.field_175908_a.canBlockStay(worldIn, blockpos, this.field_175908_a.getDefaultState())) ++ if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky() || blockpos.getY() < worldIn.getHeight() - 1) && this.field_175908_a.canBlockStay(worldIn, blockpos, this.field_175908_a.getDefaultState())) + { + worldIn.setBlockState(blockpos, this.field_175908_a.getDefaultState(), 2); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch index be05389737..41b7963de6 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch @@ -5,11 +5,11 @@ { BlockPos blockpos = position.down(); - Block block = worldIn.getBlockState(blockpos).getBlock(); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); ++ IBlockState state = worldIn.getBlockState(blockpos); + boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - if (block != Blocks.grass && block != Blocks.dirt) -+ if (!(isSoil && position.getY() < 256 - i - 1)) ++ if (!(isSoil && position.getY() < worldIn.getHeight() - i - 1)) { return false; } @@ -28,6 +28,18 @@ EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand); int i1 = i - rand.nextInt(4); int j1 = 2 - rand.nextInt(3); +@@ -67,9 +68,9 @@ + + int k2 = k + j2; + BlockPos blockpos1 = new BlockPos(k1, k2, l1); +- Material material = worldIn.getBlockState(blockpos1).func_185904_a(); ++ state = worldIn.getBlockState(blockpos1); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(state, worldIn, blockpos1) || state.getBlock().isLeaves(state, worldIn, blockpos1)) + { + this.func_181639_b(worldIn, blockpos1); + this.func_181639_b(worldIn, blockpos1.east()); @@ -187,7 +188,7 @@ { for (int k1 = -i1; k1 <= i1; ++k1) @@ -37,3 +49,24 @@ { return false; } +@@ -209,11 +210,18 @@ + private void func_150526_a(World worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) + { + BlockPos blockpos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); +- Material material = worldIn.getBlockState(blockpos).func_185904_a(); ++ IBlockState state = worldIn.getBlockState(blockpos); + +- if (material == Material.air) ++ if (state.getBlock().isAir(state, worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181641_b); + } + } ++ ++ //Just a helper macro ++ private void onPlantGrow(World world, BlockPos pos, BlockPos source) ++ { ++ IBlockState state = world.getBlockState(pos); ++ state.getBlock().onPlantGrow(state, world, pos, source); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch new file mode 100644 index 0000000000..da651f127e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java +@@ -11,12 +11,12 @@ + { + public boolean generate(World worldIn, Random rand, BlockPos position) + { +- IBlockState iblockstate; +- +- while (((iblockstate = worldIn.getBlockState(position)).func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) && position.getY() > 0) ++ do + { ++ IBlockState state = worldIn.getBlockState(position); ++ if (!state.getBlock().isAir(state, worldIn, position) && !state.getBlock().isLeaves(state, worldIn, position)) break; + position = position.down(); +- } ++ } while (position.getY() > 0); + + for (int i = 0; i < 4; ++i) + { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch index 32a26829cf..1986b2cd5c 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch @@ -1,16 +1,10 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java -@@ -154,6 +154,12 @@ +@@ -154,6 +154,6 @@ private String pickMobSpawner(Random p_76543_1_) { - return SPAWNERTYPES[p_76543_1_.nextInt(SPAWNERTYPES.length)]; + return net.minecraftforge.common.DungeonHooks.getRandomDungeonMob(p_76543_1_); } -+ -+ static -+ { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, CHESTCONTENT, 8, 8); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); -+ } } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java.patch new file mode 100644 index 0000000000..3108f459fe --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java +@@ -27,7 +27,7 @@ + { + BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), -rand.nextInt(12), rand.nextInt(8) - rand.nextInt(8)); + +- if (worldIn.getBlockState(blockpos).func_185904_a() == Material.air) ++ if (worldIn.isAirBlock(blockpos)) + { + int j = 0; + diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java.patch new file mode 100644 index 0000000000..649c43e9bc --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java +@@ -27,7 +27,7 @@ + { + BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), -rand.nextInt(12), rand.nextInt(8) - rand.nextInt(8)); + +- if (worldIn.getBlockState(blockpos).func_185904_a() == Material.air) ++ if (worldIn.isAirBlock(blockpos)) + { + int j = 0; + diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java.patch new file mode 100644 index 0000000000..2b60c9804c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java +@@ -24,7 +24,7 @@ + { + return false; + } +- else if (worldIn.getBlockState(position).func_185904_a() != Material.air && worldIn.getBlockState(position).getBlock() != Blocks.netherrack) ++ else if (!worldIn.isAirBlock(position) && worldIn.getBlockState(position).getBlock() != Blocks.netherrack) + { + return false; + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch index bfa8df76e4..4a87bd3802 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch @@ -31,7 +31,31 @@ return true; } else -@@ -145,4 +146,10 @@ +@@ -113,9 +114,9 @@ + if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) + { + BlockPos blockpos = p_175925_2_.add(j, 0, k); +- Material material = worldIn.getBlockState(blockpos).func_185904_a(); ++ IBlockState state = worldIn.getBlockState(blockpos); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); + } +@@ -135,9 +136,9 @@ + if (j * j + k * k <= i) + { + BlockPos blockpos = p_175928_2_.add(j, 0, k); +- Material material = worldIn.getBlockState(blockpos).func_185904_a(); ++ IBlockState state = worldIn.getBlockState(blockpos); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); + } +@@ -145,4 +146,11 @@ } } } @@ -39,6 +63,7 @@ + //Just a helper macro + private void onPlantGrow(World world, BlockPos pos, BlockPos source) + { -+ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); ++ IBlockState state = world.getBlockState(pos); ++ state.getBlock().onPlantGrow(state, world, pos, source); + } } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java.patch new file mode 100644 index 0000000000..e3a4429626 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java +@@ -51,7 +51,7 @@ + IBlockState iblockstate = worldIn.getBlockState(position.add(i1, k, j1)); + Block block = iblockstate.getBlock(); + +- if (iblockstate.func_185904_a() == Material.air || block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice) ++ if (iblockstate.getBlock().isAir(iblockstate, worldIn, position.add(i1, k, j1)) || block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice) + { + this.setBlockAndNotifyAdequately(worldIn, position.add(i1, k, j1), Blocks.packed_ice.getDefaultState()); + } +@@ -61,7 +61,7 @@ + iblockstate = worldIn.getBlockState(position.add(i1, -k, j1)); + block = iblockstate.getBlock(); + +- if (iblockstate.func_185904_a() == Material.air || block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice) ++ if (iblockstate.getBlock().isAir(iblockstate, worldIn, position.add(i1, -k, j1)) || block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice) + { + this.setBlockAndNotifyAdequately(worldIn, position.add(i1, -k, j1), Blocks.packed_ice.getDefaultState()); + } +@@ -99,7 +99,7 @@ + IBlockState iblockstate1 = worldIn.getBlockState(blockpos); + Block block1 = iblockstate1.getBlock(); + +- if (iblockstate1.func_185904_a() != Material.air && block1 != Blocks.dirt && block1 != Blocks.snow && block1 != Blocks.ice && block1 != Blocks.packed_ice) ++ if (!iblockstate1.getBlock().isAir(iblockstate1, worldIn, blockpos) && block1 != Blocks.dirt && block1 != Blocks.snow && block1 != Blocks.ice && block1 != Blocks.packed_ice) + { + break; + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java.patch new file mode 100644 index 0000000000..36c45d5d3e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java +@@ -26,7 +26,7 @@ + { + return false; + } +- else if (worldIn.getBlockState(position).func_185904_a() != Material.air && worldIn.getBlockState(position).getBlock() != Blocks.stone) ++ else if (!worldIn.isAirBlock(position) && worldIn.getBlockState(position).getBlock() != Blocks.stone) + { + return false; + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch new file mode 100644 index 0000000000..da814bc5cd --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch @@ -0,0 +1,60 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java +@@ -41,32 +41,25 @@ + + for (int j = 0; j < i; ++j) + { +- IBlockState iblockstate = worldIn.getBlockState(position.up(j)); +- +- if (iblockstate.func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) ++ if (isAirLeaves(worldIn, position.up(j))) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(j), this.woodMetadata); + } + + if (j < i - 1) + { +- iblockstate = worldIn.getBlockState(position.add(1, j, 0)); +- +- if (iblockstate.func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) ++ if (isAirLeaves(worldIn, position.add(1, j, 0))) + { + this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 0), this.woodMetadata); + } + +- iblockstate = worldIn.getBlockState(position.add(1, j, 1)); +- +- if (iblockstate.func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) ++ if (isAirLeaves(worldIn, position.add(1, j, 1))) + { + this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 1), this.woodMetadata); + } + +- iblockstate = worldIn.getBlockState(position.add(0, j, 1)); + +- if (iblockstate.func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) ++ if (isAirLeaves(worldIn, position.add(0, j, 1))) + { + this.setBlockAndNotifyAdequately(worldIn, position.add(0, j, 1), this.woodMetadata); + } +@@ -133,7 +126,7 @@ + IBlockState iblockstate = worldIn.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + +- if (block == Blocks.grass || block == Blocks.dirt) ++ if (block.canSustainPlant(iblockstate, worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181635_g); + break; +@@ -145,4 +138,11 @@ + } + } + } ++ ++ //Helper macro ++ private boolean isAirLeaves(World world, BlockPos pos) ++ { ++ IBlockState state = world.getBlockState(pos); ++ return state.getBlock().isAir(state, world, pos) || state.getBlock().isLeaves(state, world, pos); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch index e3f30fb496..bc5a4713c8 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch @@ -1,11 +1,12 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java -@@ -73,7 +73,7 @@ +@@ -73,7 +73,8 @@ { BlockPos blockpos = new BlockPos(l1, i2, j2); - if (this.predicate.apply(worldIn.getBlockState(blockpos))) -+ if (worldIn.getBlockState(blockpos).getBlock().isReplaceableOreGen(worldIn, blockpos, this.predicate)) ++ IBlockState state = worldIn.getBlockState(blockpos); ++ if (state.getBlock().isReplaceableOreGen(state, worldIn, blockpos, this.predicate)) { worldIn.setBlockState(blockpos, this.oreBlock, 2); } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch index a40dcd852f..50dad44e18 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch @@ -19,10 +19,46 @@ + boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - if ((block == Blocks.grass || block == Blocks.dirt) && position.getY() < 256 - i - 1) -+ if (isSoil && position.getY() < 256 - i - 1) ++ if (isSoil && position.getY() < worldIn.getHeight() - i - 1) { - this.func_175921_a(worldIn, position.down()); -+ state.getBlock().onPlantGrow(worldIn, down, position); ++ state.getBlock().onPlantGrow(state, worldIn, down, position); EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand); int k2 = i - rand.nextInt(4) - 1; int l2 = 3 - rand.nextInt(3); +@@ -95,9 +97,9 @@ + } + + BlockPos blockpos = new BlockPos(i3, i2, j1); +- Material material = worldIn.getBlockState(blockpos).func_185904_a(); ++ state = worldIn.getBlockState(blockpos); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos)) + { + this.func_181642_b(worldIn, blockpos); + k1 = i2; +@@ -149,9 +151,9 @@ + i3 += enumfacing1.getFrontOffsetX(); + j1 += enumfacing1.getFrontOffsetZ(); + BlockPos blockpos1 = new BlockPos(i3, j2, j1); +- Material material1 = worldIn.getBlockState(blockpos1).func_185904_a(); ++ state = worldIn.getBlockState(blockpos1); + +- if (material1 == Material.air || material1 == Material.leaves) ++ if (state.getBlock().isAir(state, worldIn, blockpos1) || state.getBlock().isLeaves(state, worldIn, blockpos1)) + { + this.func_181642_b(worldIn, blockpos1); + k1 = j2; +@@ -209,9 +211,9 @@ + + private void func_175924_b(World worldIn, BlockPos p_175924_2_) + { +- Material material = worldIn.getBlockState(p_175924_2_).func_185904_a(); ++ IBlockState state = worldIn.getBlockState(p_175924_2_); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(state, worldIn, p_175924_2_) || state.getBlock().isLeaves(state, worldIn, p_175924_2_)) + { + this.setBlockAndNotifyAdequately(worldIn, p_175924_2_, field_181644_b); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch new file mode 100644 index 0000000000..b5fb605796 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java +@@ -22,16 +22,16 @@ + + public boolean generate(World worldIn, Random rand, BlockPos position) + { +- IBlockState iblockstate; +- +- while (((iblockstate = worldIn.getBlockState(position)).func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) && position.getY() > 0) ++ do + { ++ IBlockState state = worldIn.getBlockState(position); ++ if (!state.getBlock().isLeaves(state, worldIn, position) && !state.getBlock().isLeaves(state, worldIn, position)) break; + position = position.down(); +- } ++ } while (position.getY() > 0); + +- Block block = worldIn.getBlockState(position).getBlock(); ++ IBlockState state = worldIn.getBlockState(position); + +- if (block == Blocks.dirt || block == Blocks.grass) ++ if (state.getBlock().canSustainPlant(state, worldIn, position, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) + { + position = position.up(); + this.setBlockAndNotifyAdequately(worldIn, position, this.woodMetadata); +@@ -52,9 +52,9 @@ + if (Math.abs(i1) != k || Math.abs(k1) != k || rand.nextInt(2) != 0) + { + BlockPos blockpos = new BlockPos(l, i, j1); +- Material material = worldIn.getBlockState(blockpos).func_185904_a(); ++ state = worldIn.getBlockState(blockpos); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().canBeReplacedByLeaves(state, worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch index d8362186c5..1adcecd9c6 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch @@ -1,5 +1,14 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java +@@ -61,7 +61,7 @@ + IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)); + Block block = iblockstate.getBlock(); + +- if (iblockstate.func_185904_a() != Material.air && iblockstate.func_185904_a() != Material.leaves) ++ if (!iblockstate.getBlock().isAir(iblockstate, worldIn, blockpos$mutableblockpos.set(l, j, i1)) && !iblockstate.getBlock().isLeaves(iblockstate, worldIn, blockpos$mutableblockpos.set(l, j, i1))) + { + if (block != Blocks.water && block != Blocks.flowing_water) + { @@ -87,11 +87,13 @@ } else @@ -10,10 +19,80 @@ + boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - if ((block1 == Blocks.grass || block1 == Blocks.dirt) && position.getY() < 256 - i - 1) -+ if (isSoil && position.getY() < 256 - i - 1) ++ if (isSoil && position.getY() < worldIn.getHeight() - i - 1) { - this.func_175921_a(worldIn, position.down()); -+ state.getBlock().onPlantGrow(worldIn, position.down(),position); ++ state.getBlock().onPlantGrow(state, worldIn, position.down(),position); for (int k1 = position.getY() - 3 + i; k1 <= position.getY() + i; ++k1) { +@@ -109,8 +111,9 @@ + if (Math.abs(k3) != l2 || Math.abs(j1) != l2 || rand.nextInt(2) != 0 && j2 != 0) + { + BlockPos blockpos = new BlockPos(j3, k1, i4); ++ state = worldIn.getBlockState(blockpos); + +- if (!worldIn.getBlockState(blockpos).func_185913_b()) ++ if (state.getBlock().canBeReplacedByLeaves(state, worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181649_b); + } +@@ -121,10 +124,11 @@ + + for (int l1 = 0; l1 < i; ++l1) + { +- IBlockState iblockstate1 = worldIn.getBlockState(position.up(l1)); ++ BlockPos upN = position.up(l1); ++ IBlockState iblockstate1 = worldIn.getBlockState(upN); + Block block2 = iblockstate1.getBlock(); + +- if (iblockstate1.func_185904_a() == Material.air || iblockstate1.func_185904_a() == Material.leaves || block2 == Blocks.flowing_water || block2 == Blocks.water) ++ if (block2.isAir(iblockstate1, worldIn, upN) || block2.isLeaves(iblockstate1, worldIn, upN) || block2 == Blocks.flowing_water || block2 == Blocks.water) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(l1), field_181648_a); + } +@@ -149,22 +153,22 @@ + BlockPos blockpos1 = blockpos$mutableblockpos1.north(); + BlockPos blockpos2 = blockpos$mutableblockpos1.south(); + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).func_185904_a() == Material.air) ++ if (rand.nextInt(4) == 0 && isAir(worldIn, blockpos3)) + { + this.func_181647_a(worldIn, blockpos3, BlockVine.EAST); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).func_185904_a() == Material.air) ++ if (rand.nextInt(4) == 0 && isAir(worldIn, blockpos4)) + { + this.func_181647_a(worldIn, blockpos4, BlockVine.WEST); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).func_185904_a() == Material.air) ++ if (rand.nextInt(4) == 0 && isAir(worldIn, blockpos1)) + { + this.func_181647_a(worldIn, blockpos1, BlockVine.SOUTH); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).func_185904_a() == Material.air) ++ if (rand.nextInt(4) == 0 && isAir(worldIn, blockpos2)) + { + this.func_181647_a(worldIn, blockpos2, BlockVine.NORTH); + } +@@ -193,10 +197,16 @@ + this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); + int i = 4; + +- for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).func_185904_a() == Material.air && i > 0; --i) ++ for (p_181647_2_ = p_181647_2_.down(); isAir(p_181647_1_, p_181647_2_) && i > 0; --i) + { + this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); + p_181647_2_ = p_181647_2_.down(); + } + } ++ ++ private boolean isAir(World world, BlockPos pos) ++ { ++ IBlockState state = world.getBlockState(pos); ++ return state.getBlock().isAir(state, world, pos); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch index fa469e6c4b..fba5e3c2c8 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch @@ -22,7 +22,31 @@ + if (isSoil && position.getY() < 256 - i - 1) { - this.func_175921_a(worldIn, position.down()); -+ state.getBlock().onPlantGrow(worldIn, down, position); ++ state.getBlock().onPlantGrow(state, worldIn, down, position); int k2 = 0; for (int l2 = position.getY() + i; l2 >= position.getY() + j; --l2) +@@ -92,8 +94,9 @@ + if (Math.abs(k3) != k2 || Math.abs(j2) != k2 || k2 <= 0) + { + BlockPos blockpos = new BlockPos(j3, l2, i2); ++ state = worldIn.getBlockState(blockpos); + +- if (!worldIn.getBlockState(blockpos).func_185913_b()) ++ if (state.getBlock().canBeReplacedByLeaves(state, worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181637_b); + } +@@ -113,9 +116,10 @@ + + for (int i3 = 0; i3 < i - 1; ++i3) + { +- Material material = worldIn.getBlockState(position.up(i3)).func_185904_a(); ++ BlockPos upN = position.up(i3); ++ state = worldIn.getBlockState(upN); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN)) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(i3), field_181636_a); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch new file mode 100644 index 0000000000..e4b0a43f86 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch @@ -0,0 +1,66 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java +@@ -30,7 +30,7 @@ + int l = 2 + rand.nextInt(2); + boolean flag = true; + +- if (position.getY() >= 1 && position.getY() + i + 1 <= 256) ++ if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) + { + for (int i1 = position.getY(); i1 <= position.getY() + 1 + i && flag; ++i1) + { +@@ -51,11 +51,11 @@ + { + for (int l1 = position.getZ() - j1; l1 <= position.getZ() + j1 && flag; ++l1) + { +- if (i1 >= 0 && i1 < 256) ++ if (i1 >= 0 && i1 < worldIn.getHeight()) + { +- Material material = worldIn.getBlockState(blockpos$mutableblockpos.set(k1, i1, l1)).func_185904_a(); ++ IBlockState state = worldIn.getBlockState(blockpos$mutableblockpos.set(k1, i1, l1)); + +- if (material != Material.air && material != Material.leaves) ++ if (!state.getBlock().isAir(state, worldIn, blockpos$mutableblockpos.set(k1, i1, l1)) && !state.getBlock().isLeaves(state, worldIn, blockpos$mutableblockpos.set(k1, i1, l1))) + { + flag = false; + } +@@ -74,11 +74,12 @@ + } + else + { +- Block block = worldIn.getBlockState(position.down()).getBlock(); ++ BlockPos down = position.down(); ++ IBlockState state = worldIn.getBlockState(down); + +- if ((block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland) && position.getY() < 256 - i - 1) ++ if (state.getBlock().canSustainPlant(state, worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling) && position.getY() < worldIn.getHeight() - i - 1) + { +- this.func_175921_a(worldIn, position.down()); ++ state.getBlock().onPlantGrow(state, worldIn, down, position); + int i3 = rand.nextInt(2); + int j3 = 1; + int k3 = 0; +@@ -98,8 +99,9 @@ + if (Math.abs(j2) != i3 || Math.abs(l2) != i3 || i3 <= 0) + { + BlockPos blockpos = new BlockPos(i2, j4, k2); ++ state = worldIn.getBlockState(blockpos); + +- if (!worldIn.getBlockState(blockpos).func_185913_b()) ++ if (state.getBlock().canBeReplacedByLeaves(state, worldIn, blockpos)) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181646_b); + } +@@ -128,9 +130,10 @@ + + for (int k4 = 0; k4 < i - i4; ++k4) + { +- Material material1 = worldIn.getBlockState(position.up(k4)).func_185904_a(); ++ BlockPos upN = position.up(k4); ++ state = worldIn.getBlockState(upN); + +- if (material1 == Material.air || material1 == Material.leaves) ++ if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN)) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(k4), field_181645_a); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch new file mode 100644 index 0000000000..0dafce7542 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java +@@ -19,12 +19,12 @@ + + public boolean generate(World worldIn, Random rand, BlockPos position) + { +- IBlockState iblockstate; +- +- while (((iblockstate = worldIn.getBlockState(position)).func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) && position.getY() > 0) ++ do + { ++ IBlockState state = worldIn.getBlockState(position); ++ if (!state.getBlock().isAir(state, worldIn, position) && !state.getBlock().isLeaves(state, worldIn, position)) break; + position = position.down(); +- } ++ } while (position.getY() > 0); + + for (int i = 0; i < 128; ++i) + { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch index bddc8b598a..4b2a82109e 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch @@ -1,11 +1,105 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java -@@ -68,7 +68,7 @@ +@@ -44,7 +44,7 @@ + int i = rand.nextInt(3) + this.minTreeHeight; + boolean flag = true; + +- if (position.getY() >= 1 && position.getY() + i + 1 <= 256) ++ if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) + { + for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) + { +@@ -66,9 +66,9 @@ + { + for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) { - if (j >= 0 && j < 256) +- if (j >= 0 && j < 256) ++ if (j >= 0 && j < worldIn.getHeight()) { - if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock())) + if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.set(l, j, i1))) { flag = false; } +@@ -87,9 +87,9 @@ + } + else + { +- Block block = worldIn.getBlockState(position.down()).getBlock(); ++ IBlockState state = worldIn.getBlockState(position.down()); + +- if ((block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland) && position.getY() < 256 - i - 1) ++ if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling) && position.getY() < worldIn.getHeight() - i - 1) + { + this.func_175921_a(worldIn, position.down()); + int k2 = 3; +@@ -111,9 +111,9 @@ + if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || rand.nextInt(2) != 0 && i4 != 0) + { + BlockPos blockpos = new BlockPos(k1, i3, i2); +- Material material = worldIn.getBlockState(blockpos).func_185904_a(); ++ state = worldIn.getBlockState(blockpos); + +- if (material == Material.air || material == Material.leaves || material == Material.vine) ++ if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.func_185904_a() == Material.vine) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves); + } +@@ -124,9 +124,10 @@ + + for (int j3 = 0; j3 < i; ++j3) + { +- Material material1 = worldIn.getBlockState(position.up(j3)).func_185904_a(); ++ BlockPos upN = position.up(j3); ++ state = worldIn.getBlockState(upN); + +- if (material1 == Material.air || material1 == Material.leaves || material1 == Material.vine) ++ if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.func_185904_a() == Material.vine) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood); + +@@ -169,29 +170,30 @@ + { + blockpos$mutableblockpos1.set(l4, k3, i5); + +- if (worldIn.getBlockState(blockpos$mutableblockpos1).func_185904_a() == Material.leaves) ++ state = worldIn.getBlockState(blockpos$mutableblockpos1); ++ if (state.getBlock().isLeaves(state, worldIn, blockpos$mutableblockpos1)) + { + BlockPos blockpos2 = blockpos$mutableblockpos1.west(); + BlockPos blockpos3 = blockpos$mutableblockpos1.east(); + BlockPos blockpos4 = blockpos$mutableblockpos1.north(); + BlockPos blockpos1 = blockpos$mutableblockpos1.south(); + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).func_185904_a() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.isAirBlock(blockpos2)) + { + this.func_181650_b(worldIn, blockpos2, BlockVine.EAST); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).func_185904_a() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.isAirBlock(blockpos3)) + { + this.func_181650_b(worldIn, blockpos3, BlockVine.WEST); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).func_185904_a() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.isAirBlock(blockpos4)) + { + this.func_181650_b(worldIn, blockpos4, BlockVine.SOUTH); + } + +- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).func_185904_a() == Material.air) ++ if (rand.nextInt(4) == 0 && worldIn.isAirBlock(blockpos1)) + { + this.func_181650_b(worldIn, blockpos1, BlockVine.NORTH); + } +@@ -245,7 +247,7 @@ + this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); + int i = 4; + +- for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).func_185904_a() == Material.air && i > 0; --i) ++ for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.isAirBlock(p_181650_2_) && i > 0; --i) + { + this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); + p_181650_2_ = p_181650_2_.down(); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch new file mode 100644 index 0000000000..9ff41f8ecf --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch @@ -0,0 +1,55 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java +@@ -14,12 +14,12 @@ + { + public boolean generate(World worldIn, Random rand, BlockPos position) + { +- IBlockState iblockstate; +- +- while (((iblockstate = worldIn.getBlockState(position)).func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) && position.getY() > 1) ++ do + { ++ IBlockState state = worldIn.getBlockState(position); ++ if (!state.getBlock().isAir(state, worldIn, position) && !state.getBlock().isLeaves(state, worldIn, position)) break; + position = position.down(); +- } ++ } while (position.getY() > 0); + + if (position.getY() < 1) + { +@@ -33,7 +33,7 @@ + { + BlockPos blockpos = position.add(rand.nextInt(4) - rand.nextInt(4), rand.nextInt(3) - rand.nextInt(3), rand.nextInt(4) - rand.nextInt(4)); + +- if (worldIn.isAirBlock(blockpos) && worldIn.getBlockState(blockpos.down()).func_185896_q()) ++ if (worldIn.isAirBlock(blockpos) && worldIn.getBlockState(blockpos.down()).isSideSolid(worldIn, blockpos.down(), net.minecraft.util.EnumFacing.UP)) + { + worldIn.setBlockState(blockpos, Blocks.chest.getDefaultState(), 2); + TileEntity tileentity = worldIn.getTileEntity(blockpos); +@@ -48,22 +48,22 @@ + BlockPos blockpos3 = blockpos.north(); + BlockPos blockpos4 = blockpos.south(); + +- if (worldIn.isAirBlock(blockpos2) && worldIn.getBlockState(blockpos2.down()).func_185896_q()) ++ if (worldIn.isAirBlock(blockpos2) && worldIn.getBlockState(blockpos2.down()).isSideSolid(worldIn, blockpos2.down(), net.minecraft.util.EnumFacing.UP)) + { + worldIn.setBlockState(blockpos2, Blocks.torch.getDefaultState(), 2); + } + +- if (worldIn.isAirBlock(blockpos1) && worldIn.getBlockState(blockpos1.down()).func_185896_q()) ++ if (worldIn.isAirBlock(blockpos1) && worldIn.getBlockState(blockpos1.down()).isSideSolid(worldIn, blockpos1.down(), net.minecraft.util.EnumFacing.UP)) + { + worldIn.setBlockState(blockpos1, Blocks.torch.getDefaultState(), 2); + } + +- if (worldIn.isAirBlock(blockpos3) && worldIn.getBlockState(blockpos3.down()).func_185896_q()) ++ if (worldIn.isAirBlock(blockpos3) && worldIn.getBlockState(blockpos3.down()).isSideSolid(worldIn, blockpos3.down(), net.minecraft.util.EnumFacing.UP)) + { + worldIn.setBlockState(blockpos3, Blocks.torch.getDefaultState(), 2); + } + +- if (worldIn.isAirBlock(blockpos4) && worldIn.getBlockState(blockpos4.down()).func_185896_q()) ++ if (worldIn.isAirBlock(blockpos4) && worldIn.getBlockState(blockpos4.down()).isSideSolid(worldIn, blockpos4.down(), net.minecraft.util.EnumFacing.UP)) + { + worldIn.setBlockState(blockpos4, Blocks.torch.getDefaultState(), 2); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch index c454546d02..cf7f4d15e1 100644 --- a/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch @@ -5,7 +5,7 @@ public int xCenter; public int zCenter; - public byte dimension; -+ public int dimension; ++ public int dimension; //FML byte -> int public boolean field_186210_e; public byte scale; public byte[] colors = new byte[16384]; diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch new file mode 100644 index 0000000000..c1fec8d2c6 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/world/storage/SaveFormatOld.java ++++ ../src-work/minecraft/net/minecraft/world/storage/SaveFormatOld.java +@@ -106,6 +106,24 @@ + } + } + ++ //Forge: Special version of the above that runs during actual world loading and not metadata gathering. ++ public static WorldInfo loadAndFix(File file, DataFixer fixer, SaveHandler save) ++ { ++ try ++ { ++ NBTTagCompound nbt = CompressedStreamTools.readCompressed(new FileInputStream(file)); ++ WorldInfo info = new WorldInfo(fixer.func_188257_a(FixTypes.LEVEL, nbt.getCompoundTag("Data"))); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(save, info, nbt); ++ return info; ++ } ++ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) { throw e; } ++ catch (Exception exception) ++ { ++ logger.error((String)("Exception reading " + file), (Throwable)exception); ++ return null; ++ } ++ } ++ + @SideOnly(Side.CLIENT) + public void renameWorld(String dirName, String newName) + { diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch index 9e57e2d0be..aba3075c0a 100644 --- a/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch @@ -1,6 +1,26 @@ --- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java +++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java -@@ -135,6 +135,8 @@ +@@ -117,7 +117,7 @@ + + if (file1.exists()) + { +- WorldInfo worldinfo = SaveFormatOld.func_186353_a(file1, this.field_186341_a); ++ WorldInfo worldinfo = SaveFormatOld.loadAndFix(file1, this.field_186341_a, this); + + if (worldinfo != null) + { +@@ -125,8 +125,9 @@ + } + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); + file1 = new File(this.worldDirectory, "level.dat_old"); +- return file1.exists() ? SaveFormatOld.func_186353_a(file1, this.field_186341_a) : null; ++ return file1.exists() ? SaveFormatOld.loadAndFix(file1, this.field_186341_a, this) : null; + } + + public void saveWorldInfoWithPlayer(WorldInfo worldInformation, NBTTagCompound tagCompound) +@@ -135,6 +136,8 @@ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setTag("Data", nbttagcompound); @@ -9,15 +29,14 @@ try { File file1 = new File(this.worldDirectory, "level.dat_new"); -@@ -199,6 +201,8 @@ - { - NBTTagCompound nbttagcompound = null; +@@ -188,6 +191,7 @@ + } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound1); -+ - try + file1.renameTo(file2); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(player, this.playersDirectory, player.getUniqueID().toString()); + } + catch (Exception var5) { - File file1 = new File(this.playersDirectory, player.getUniqueID().toString() + ".dat"); @@ -218,6 +222,7 @@ player.readFromNBT(this.field_186341_a.func_188257_a(FixTypes.PLAYER, nbttagcompound)); } diff --git a/rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej b/rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej deleted file mode 100644 index f9ef1270f7..0000000000 --- a/rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej +++ /dev/null @@ -1,57 +0,0 @@ -++++ REJECTED PATCH 1 - - if (enchantmentsList[enchID] != null) - { -- throw new IllegalArgumentException("Duplicate enchantment id!"); -+ throw new IllegalArgumentException("Duplicate enchantment id! " + this.getClass() + " and " + enchantmentsList[enchID].getClass() + " Enchantment ID:" + enchID); - } - else - { -++++ END PATCH -++++ REJECTED PATCH 3 - { - } - -+ /** -+ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)} -+ * applies for all possible enchantments. -+ * @param stack -+ * @return -+ */ -+ public boolean canApplyAtEnchantingTable(ItemStack stack) -+ { -+ return this.type.canEnchantItem(stack.getItem()); -+ } -+ -+ private static final java.lang.reflect.Field bookSetter = Enchantment.class.getDeclaredFields()[1]; -+ /** -+ * Add to the list of enchantments applicable by the anvil from a book -+ * -+ * @param enchantment -+ */ -+ public static void addToBookList(Enchantment enchantment) -+ { -+ try -+ { -+ net.minecraftforge.common.util.EnumHelper.setFailsafeFieldValue(bookSetter, null, -+ com.google.common.collect.ObjectArrays.concat(enchantmentsBookList, enchantment)); -+ } -+ catch (Exception e) -+ { -+ throw new RuntimeException(e); //Rethrow see what happens -+ } -+ } -+ -+ /** -+ * Is this enchantment allowed to be enchanted on books via Enchantment Table -+ * @return false to disable the vanilla feature -+ */ -+ public boolean isAllowedOnBooks() -+ { -+ return true; -+ } -+ - static - { - List list = Lists.newArrayList(); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej b/rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej deleted file mode 100644 index 69f7aae3ef..0000000000 --- a/rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej +++ /dev/null @@ -1,23 +0,0 @@ -++++ REJECTED PATCH 3 - - for (EnchantmentData enchantmentdata1 : list) - { -- if (!enchantmentdata1.enchantmentobj.canApplyTogether(Enchantment.getEnchantmentById(integer.intValue()))) -+ Enchantment e1 = enchantmentdata1.enchantmentobj; -+ Enchantment e2 = Enchantment.getEnchantmentById(integer.intValue()); -+ if (!e1.canApplyTogether(e2) || !e2.canApplyTogether(e1)) //Forge BugFix: Let Both enchantments veto being together - { - flag = false; - break; -++++ END PATCH -++++ REJECTED PATCH 4 - - for (Enchantment enchantment : Enchantment.enchantmentsBookList) - { -- if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) -+ if (enchantment == null) continue; -+ if (enchantment.canApplyAtEnchantingTable(p_77505_1_) || (flag && enchantment.isAllowedOnBooks())) - { - for (int i = enchantment.getMinLevel(); i <= enchantment.getMaxLevel(); ++i) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/ChunkCache.java.patch.rej b/rejects/minecraft/net/minecraft/world/ChunkCache.java.patch.rej deleted file mode 100644 index d67a85598d..0000000000 --- a/rejects/minecraft/net/minecraft/world/ChunkCache.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 3 - - public boolean isAirBlock(BlockPos pos) - { -- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; -+ return this.getBlockState(pos).getBlock().isAir(this, pos); - } - - @SideOnly(Side.CLIENT) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej b/rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej deleted file mode 100644 index a75ecd5c2c..0000000000 --- a/rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej +++ /dev/null @@ -1,18 +0,0 @@ -++++ REJECTED PATCH 1 - private final float explosionSize; - private final List affectedBlockPositions; - private final Map playerKnockbackMap; -+ private final Vec3 position; - - @SideOnly(Side.CLIENT) - public Explosion(World worldIn, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) -++++ END PATCH -++++ REJECTED PATCH 4 - int j2 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D); - int j1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D); - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); -+ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3); - Vec3 vec3 = new Vec3(this.explosionX, this.explosionY, this.explosionZ); - - for (int k2 = 0; k2 < list.size(); ++k2) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej b/rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej deleted file mode 100644 index de0d6369db..0000000000 --- a/rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej +++ /dev/null @@ -1,47 +0,0 @@ -++++ REJECTED PATCH 1 - - protected void registerWorldChunkManager() - { -- WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType(); -- -- if (worldtype == WorldType.FLAT) -- { -- FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions()); -- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), BiomeGenBase.field_180279_ad), 0.5F); -- } -- else if (worldtype == WorldType.DEBUG_WORLD) -- { -- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.0F); -- } -- else -- { -- this.worldChunkMgr = new WorldChunkManager(this.worldObj); -- } -+ this.worldChunkMgr = terrainType.getChunkManager(worldObj); - } - - public IChunkProvider createChunkGenerator() - { -- return (IChunkProvider)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings)))); -+ return terrainType.getChunkGenerator(worldObj, generatorSettings); - } - - public boolean canCoordinateBeSpawn(int x, int z) -++++ END PATCH -++++ REJECTED PATCH 2 - - public static WorldProvider getProviderForDimension(int dimension) - { -- return (WorldProvider)(dimension == -1 ? new WorldProviderHell() : (dimension == 0 ? new WorldProviderSurface() : (dimension == 1 ? new WorldProviderEnd() : null))); -+ return net.minecraftforge.common.DimensionManager.createProviderFor(dimension); - } - - @SideOnly(Side.CLIENT) - public float getCloudHeight() - { -- return 128.0F; -+ return this.terrainType.getCloudHeight(); - } - - @SideOnly(Side.CLIENT) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch.rej b/rejects/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch.rej deleted file mode 100644 index 5bc356b51f..0000000000 --- a/rejects/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - { - public int getColorAtPos(BiomeGenBase p_180283_1_, BlockPos blockPosition) - { -- return p_180283_1_.waterColorMultiplier; -+ return p_180283_1_.getWaterColorMultiplier(); - } - }; - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch.rej b/rejects/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch.rej deleted file mode 100644 index af1943cfc9..0000000000 --- a/rejects/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch.rej +++ /dev/null @@ -1,54 +0,0 @@ -++++ REJECTED PATCH 1 - - protected void genDecorations(BiomeGenBase biomeGenBaseIn) - { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(currentWorld, randomGenerator, field_180294_c)); - this.generateOres(); - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND)) - for (int i = 0; i < this.sandPerChunk2; ++i) - { - int j = this.randomGenerator.nextInt(16) + 8; -++++ END PATCH -++++ REJECTED PATCH 12 - this.reedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j9, i19, i13)); - } - } -- -+ } // End of Reed generation -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.PUMPKIN)) - if (this.randomGenerator.nextInt(32) == 0) - { - int i5 = this.randomGenerator.nextInt(16) + 8; -++++ END PATCH -++++ REJECTED PATCH 17 - - protected void generateOres() - { -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(currentWorld, randomGenerator, field_180294_c)); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, dirtGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIRT)) - this.genStandardOre1(this.chunkProviderSettings.dirtCount, this.dirtGen, this.chunkProviderSettings.dirtMinHeight, this.chunkProviderSettings.dirtMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, gravelGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRAVEL)) - this.genStandardOre1(this.chunkProviderSettings.gravelCount, this.gravelGen, this.chunkProviderSettings.gravelMinHeight, this.chunkProviderSettings.gravelMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, dioriteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIORITE)) - this.genStandardOre1(this.chunkProviderSettings.dioriteCount, this.dioriteGen, this.chunkProviderSettings.dioriteMinHeight, this.chunkProviderSettings.dioriteMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, graniteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRANITE)) - this.genStandardOre1(this.chunkProviderSettings.graniteCount, this.graniteGen, this.chunkProviderSettings.graniteMinHeight, this.chunkProviderSettings.graniteMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, andesiteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.ANDESITE)) - this.genStandardOre1(this.chunkProviderSettings.andesiteCount, this.andesiteGen, this.chunkProviderSettings.andesiteMinHeight, this.chunkProviderSettings.andesiteMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, coalGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.COAL)) - this.genStandardOre1(this.chunkProviderSettings.coalCount, this.coalGen, this.chunkProviderSettings.coalMinHeight, this.chunkProviderSettings.coalMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, ironGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.IRON)) - this.genStandardOre1(this.chunkProviderSettings.ironCount, this.ironGen, this.chunkProviderSettings.ironMinHeight, this.chunkProviderSettings.ironMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, goldGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GOLD)) - this.genStandardOre1(this.chunkProviderSettings.goldCount, this.goldGen, this.chunkProviderSettings.goldMinHeight, this.chunkProviderSettings.goldMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, redstoneGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.REDSTONE)) - this.genStandardOre1(this.chunkProviderSettings.redstoneCount, this.redstoneGen, this.chunkProviderSettings.redstoneMinHeight, this.chunkProviderSettings.redstoneMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, diamondGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIAMOND)) - this.genStandardOre1(this.chunkProviderSettings.diamondCount, this.diamondGen, this.chunkProviderSettings.diamondMinHeight, this.chunkProviderSettings.diamondMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, lapisGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.LAPIS)) - this.genStandardOre2(this.chunkProviderSettings.lapisCount, this.lapisGen, this.chunkProviderSettings.lapisCenterHeight, this.chunkProviderSettings.lapisSpread); -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(currentWorld, randomGenerator, field_180294_c)); - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch.rej b/rejects/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch.rej deleted file mode 100644 index 583ee45c17..0000000000 --- a/rejects/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch.rej +++ /dev/null @@ -1,107 +0,0 @@ -++++ REJECTED PATCH 1 - - public BiomeGenBase(int id) - { -+ this(id, true); -+ } -+ public BiomeGenBase(int id, boolean register) -+ { - this.minHeight = height_Default.rootHeight; - this.maxHeight = height_Default.variation; - this.temperature = 0.5F; -++++ END PATCH -++++ REJECTED PATCH 2 - this.worldGeneratorBigTree = new WorldGenBigTree(false); - this.worldGeneratorSwamp = new WorldGenSwamp(); - this.biomeID = id; -+ if (register) - biomeList[id] = this; - this.theBiomeDecorator = this.createBiomeDecorator(); - this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); -++++ END PATCH -++++ REJECTED PATCH 6 - } - } - -+ /* ========================================= FORGE START ======================================*/ -+ protected List flowers = new java.util.ArrayList(); -+ -+ public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) -+ { -+ return new net.minecraftforge.event.terraingen.DeferredBiomeDecorator(original); -+ } -+ -+ public int getWaterColorMultiplier() -+ { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor(this, waterColorMultiplier); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; -+ } -+ -+ public int getModdedBiomeGrassColor(int original) -+ { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor(this, original); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; -+ } -+ -+ public int getModdedBiomeFoliageColor(int original) -+ { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor(this, original); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; -+ } -+ -+ /** -+ * Weighted random holder class used to hold possible flowers -+ * that can spawn in this biome when bonemeal is used on grass. -+ */ -+ public static class FlowerEntry extends WeightedRandom.Item -+ { -+ public final net.minecraft.block.state.IBlockState state; -+ public FlowerEntry(net.minecraft.block.state.IBlockState state, int weight) -+ { -+ super(weight); -+ this.state = state; -+ } -+ } -+ -+ /** -+ * Adds the default flowers, as of 1.7, it is 2 yellow, and 1 red. I chose 10 to allow some wiggle room in the numbers. -+ */ -+ public void addDefaultFlowers() -+ { -+ addFlower(Blocks.yellow_flower.getDefaultState().withProperty(Blocks.yellow_flower.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 20); -+ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); -+ } -+ -+ /** Register a new plant to be planted when bonemeal is used on grass. -+ * @param state The block to place. -+ * @param weight The weight of the plant, where red flowers are -+ * 10 and yellow flowers are 20. -+ */ -+ public void addFlower(IBlockState state, int weight) -+ { -+ this.flowers.add(new FlowerEntry(state, weight)); -+ } -+ -+ public void plantFlower(World world, Random rand, BlockPos pos) -+ { -+ FlowerEntry flower = (FlowerEntry)WeightedRandom.getRandomItem(rand, flowers); -+ if (flower == null || flower.state == null || -+ (flower.state.getBlock() instanceof net.minecraft.block.BlockBush && -+ !((net.minecraft.block.BlockBush)flower.state.getBlock()).canBlockStay(world, pos, flower.state))) -+ { -+ return; -+ } -+ -+ world.setBlockState(pos, flower.state, 3); -+ } -+ -+ -+ /* ========================================= FORGE END ======================================*/ -+ - static - { - plains.createMutation(); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch.rej b/rejects/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch.rej deleted file mode 100644 index dfdca41dbb..0000000000 --- a/rejects/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch.rej +++ /dev/null @@ -1,47 +0,0 @@ -++++ REJECTED PATCH 1 - - public class WorldChunkManager - { -+ public static List allowedBiomes = Lists.newArrayList(BiomeGenBase.forest, BiomeGenBase.plains, BiomeGenBase.taiga, BiomeGenBase.taigaHills, BiomeGenBase.forestHills, BiomeGenBase.jungle, BiomeGenBase.jungleHills); - private GenLayer genBiomes; - private GenLayer biomeIndexLayer; - private BiomeCache biomeCache; -++++ END PATCH -++++ REJECTED PATCH 2 - this.biomeCache = new BiomeCache(this); - this.field_180301_f = ""; - this.biomesToSpawnIn = Lists.newArrayList(); -- this.biomesToSpawnIn.add(BiomeGenBase.forest); -- this.biomesToSpawnIn.add(BiomeGenBase.plains); -- this.biomesToSpawnIn.add(BiomeGenBase.taiga); -- this.biomesToSpawnIn.add(BiomeGenBase.taigaHills); -- this.biomesToSpawnIn.add(BiomeGenBase.forestHills); -- this.biomesToSpawnIn.add(BiomeGenBase.jungle); -- this.biomesToSpawnIn.add(BiomeGenBase.jungleHills); -+ this.biomesToSpawnIn.addAll(allowedBiomes); - } - - public WorldChunkManager(long seed, WorldType p_i45744_3_, String p_i45744_4_) -++++ END PATCH -++++ REJECTED PATCH 3 - this(); - this.field_180301_f = p_i45744_4_; - GenLayer[] agenlayer = GenLayer.initializeAllBiomeGenerators(seed, p_i45744_3_, p_i45744_4_); -+ agenlayer = getModdedBiomeGenerators(p_i45744_3_, seed, agenlayer); - this.genBiomes = agenlayer[0]; - this.biomeIndexLayer = agenlayer[1]; - } -++++ END PATCH -++++ REJECTED PATCH 4 - { - this.biomeCache.cleanupCache(); - } -+ -+ public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original) -+ { -+ net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens event = new net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens(worldType, seed, original); -+ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ return event.newBiomeGens; -+ } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch.rej b/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch.rej deleted file mode 100644 index 57276f7df4..0000000000 --- a/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch.rej +++ /dev/null @@ -1,41 +0,0 @@ -++++ REJECTED PATCH 5 - { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - -+ try -+ { - if (entity.writeToNBTOptional(nbttagcompound1)) - { - chunkIn.setHasEntities(true); - nbttaglist1.appendTag(nbttagcompound1); - } -+ } -+ catch (Exception e) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, -+ "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author", -+ entity.getClass().getName()); -+ } - } - } - -++++ END PATCH -++++ REJECTED PATCH 6 - for (TileEntity tileentity : chunkIn.getTileEntityMap().values()) - { - NBTTagCompound nbttagcompound2 = new NBTTagCompound(); -+ try -+ { - tileentity.writeToNBT(nbttagcompound2); - nbttaglist2.appendTag(nbttagcompound2); -+ } -+ catch (Exception e) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, -+ "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author", -+ tileentity.getClass().getName()); -+ } - } - - p_75820_3_.setTag("TileEntities", nbttaglist2); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej deleted file mode 100644 index 9bb5153656..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej +++ /dev/null @@ -1,34 +0,0 @@ -++++ REJECTED PATCH 1 - { - Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock(); - -- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) -+ if (!block.isAir(worldIn, blockpos$mutableblockpos) && !block.isLeaves(worldIn, blockpos$mutableblockpos)) - { - flag = false; - } -++++ END PATCH -++++ REJECTED PATCH 2 - { - BlockPos blockpos = new BlockPos(l1, l2, i2); - -- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.mushroomType.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, blockhugemushroom$enumtype)); - } -++++ END PATCH -++++ REJECTED PATCH 3 - - for (int i3 = 0; i3 < i; ++i3) - { -- Block block2 = worldIn.getBlockState(position.up(i3)).getBlock(); -+ BlockPos upN = position.up(i3); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(upN); - -- if (!block2.isFullBlock()) -+ if (state.getBlock().canBeReplacedByLeaves(worldIn, upN)) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(i3), this.mushroomType.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, BlockHugeMushroom.EnumType.STEM)); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej deleted file mode 100644 index 2dc3f7fbe6..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej +++ /dev/null @@ -1,13 +0,0 @@ -++++ REJECTED PATCH 1 - if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_181631_2_ * p_181631_2_)) - { - BlockPos blockpos = p_181631_1_.add(j, 0, k); -- Material material = this.world.getBlockState(blockpos).getBlock().getMaterial(); -+ net.minecraft.block.state.IBlockState state = this.world.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(this.world, blockpos) || state.getBlock().isLeaves(this.world, blockpos)) - { - this.setBlockAndNotifyAdequately(this.world, blockpos, p_181631_3_); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej deleted file mode 100644 index f2c7e0fb92..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej +++ /dev/null @@ -1,34 +0,0 @@ -++++ REJECTED PATCH 3 - - int k2 = k + j2; - BlockPos blockpos1 = new BlockPos(k1, k2, l1); -- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); -+ state = worldIn.getBlockState(blockpos1); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(worldIn, blockpos1) || state.getBlock().isLeaves(worldIn, blockpos1)) - { - this.func_181639_b(worldIn, blockpos1); - this.func_181639_b(worldIn, blockpos1.east()); -++++ END PATCH -++++ REJECTED PATCH 5 - private void func_150526_a(World worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) - { - BlockPos blockpos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); -- Block block = worldIn.getBlockState(blockpos).getBlock(); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); - -- if (block.getMaterial() == Material.air) -+ if (state.getBlock().isAir(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181641_b); - } - } -+ -+ //Just a helper macro -+ private void onPlantGrow(World world, BlockPos pos, BlockPos source) -+ { -+ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); -+ } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch.rej deleted file mode 100644 index 114439852b..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch.rej +++ /dev/null @@ -1,16 +0,0 @@ -++++ REJECTED PATCH 1 - { - Block block; - -- while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0) -+ do - { -+ block = worldIn.getBlockState(position).getBlock(); -+ if (!block.isLeaves(worldIn, position) && !block.isLeaves(worldIn, position)) break; - position = position.down(); -- } -+ } while (position.getY() > 0); - - for (int i = 0; i < 4; ++i) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch.rej deleted file mode 100644 index e3b9ce02bd..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch.rej +++ /dev/null @@ -1,15 +0,0 @@ -++++ REJECTED PATCH 1 - if (j3 == 1) - { - worldIn.setBlockState(blockpos2, Blocks.chest.correctFacing(worldIn, blockpos2, Blocks.chest.getDefaultState()), 2); -- List list = WeightedRandomChestContent.func_177629_a(CHESTCONTENT, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(rand)}); - TileEntity tileentity1 = worldIn.getTileEntity(blockpos2); - - if (tileentity1 instanceof TileEntityChest) - { -- WeightedRandomChestContent.generateChestContents(rand, list, (TileEntityChest)tileentity1, 8); -+ WeightedRandomChestContent.generateChestContents(rand, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, rand), (TileEntityChest)tileentity1, 8); - } - - break; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej deleted file mode 100644 index 2f590ff3aa..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej +++ /dev/null @@ -1,52 +0,0 @@ -++++ REJECTED PATCH 1 - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock())) -+ if (!this.isReplaceable(worldIn, blockpos$mutableblockpos.set(l, j, i1))) - { - flag = false; - } -++++ END PATCH -++++ REJECTED PATCH 2 - } - else - { -- Block block1 = worldIn.getBlockState(position.down()).getBlock(); -+ 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)); - -- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 256 - i - 1) -+ if (isSoil && position.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, position.down()); -+ block1.onPlantGrow(worldIn, down, position); - - for (int i2 = position.getY() - 3 + i; i2 <= position.getY() + i; ++i2) - { -++++ END PATCH -++++ REJECTED PATCH 3 - BlockPos blockpos = new BlockPos(i3, i2, k1); - Block block = worldIn.getBlockState(blockpos).getBlock(); - -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181630_b); - } -++++ END PATCH -++++ REJECTED PATCH 4 - - for (int j2 = 0; j2 < i; ++j2) - { -- Block block2 = worldIn.getBlockState(position.up(j2)).getBlock(); -- -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) -+ BlockPos upN = position.up(j2); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(j2), field_181629_a); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej deleted file mode 100644 index 140ae96593..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej +++ /dev/null @@ -1,26 +0,0 @@ -++++ REJECTED PATCH 3 - if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) - { - BlockPos blockpos = p_175925_2_.add(j, 0, k); -- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(worldIn, blockpos) || state.getBlock().isLeaves(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); - } -++++ END PATCH -++++ REJECTED PATCH 4 - if (j * j + k * k <= i) - { - BlockPos blockpos = p_175928_2_.add(j, 0, k); -- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); -+ Block block = worldIn.getBlockState(blockpos).getBlock(); - -- if (material == Material.air || material == Material.leaves) -+ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej deleted file mode 100644 index 1009b02d7e..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej +++ /dev/null @@ -1,63 +0,0 @@ -++++ REJECTED PATCH 1 - { - Block block = worldIn.getBlockState(position.up(j)).getBlock(); - -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (isAirLeaves(worldIn,position.up(j))) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(j), this.woodMetadata); - } - - if (j < i - 1) - { -- block = worldIn.getBlockState(position.add(1, j, 0)).getBlock(); -- -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (isAirLeaves(worldIn,position.add(1, j, 0))) - { - this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 0), this.woodMetadata); - } - -- block = worldIn.getBlockState(position.add(1, j, 1)).getBlock(); -- -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (isAirLeaves(worldIn,position.add(1, j, 1))) - { - this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 1), this.woodMetadata); - } - -- block = worldIn.getBlockState(position.add(0, j, 1)).getBlock(); -- -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (isAirLeaves(worldIn,position.add(0, j, 1))) - { - this.setBlockAndNotifyAdequately(worldIn, position.add(0, j, 1), this.woodMetadata); - } -++++ END PATCH -++++ REJECTED PATCH 2 - BlockPos blockpos = p_175934_2_.up(i); - Block block = worldIn.getBlockState(blockpos).getBlock(); - -- if (block == Blocks.grass || block == Blocks.dirt) -+ if (block.canSustainPlant(worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181635_g); - break; - } - -- if (block.getMaterial() != Material.air && i < 0) -+ if (!block.isAir(worldIn, blockpos) && i < 0) - { - break; - } - } - } -+ -+ //Helper macro -+ private boolean isAirLeaves(World world, BlockPos pos) -+ { -+ net.minecraft.block.Block block = world.getBlockState(pos).getBlock(); -+ return block.isAir(world, pos) || block.isLeaves(world, pos); -+ } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej deleted file mode 100644 index 3072ebfaf2..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej +++ /dev/null @@ -1,39 +0,0 @@ -++++ REJECTED PATCH 3 - } - - BlockPos blockpos = new BlockPos(i3, i2, j1); -- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); -+ block = worldIn.getBlockState(blockpos).getBlock(); - -- if (material == Material.air || material == Material.leaves) -+ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) - { - this.func_181642_b(worldIn, blockpos); - k1 = i2; -++++ END PATCH -++++ REJECTED PATCH 4 - i3 += enumfacing1.getFrontOffsetX(); - j1 += enumfacing1.getFrontOffsetZ(); - BlockPos blockpos1 = new BlockPos(i3, j2, j1); -- Material material1 = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); -+ block = worldIn.getBlockState(blockpos1).getBlock(); - -- if (material1 == Material.air || material1 == Material.leaves) -+ if (block.isAir(worldIn, blockpos2) || block.isLeaves(worldIn, blockpos2)) - { - this.func_181642_b(worldIn, blockpos1); - k1 = j2; -++++ END PATCH -++++ REJECTED PATCH 5 - - private void func_175924_b(World worldIn, BlockPos p_175924_2_) - { -- Material material = worldIn.getBlockState(p_175924_2_).getBlock().getMaterial(); -+ Block block = worldIn.getBlockState(p_175924_2_).getBlock(); - -- if (material == Material.air || material == Material.leaves) -+ if (block.isAir(worldIn, p_175924_2_) || block.isLeaves(worldIn, p_175924_2_)) - { - this.setBlockAndNotifyAdequately(worldIn, p_175924_2_, field_181644_b); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej deleted file mode 100644 index 3123677dfc..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej +++ /dev/null @@ -1,31 +0,0 @@ -++++ REJECTED PATCH 1 - { - Block block; - -- while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0) -+ do - { -+ block = worldIn.getBlockState(position).getBlock(); -+ if (!block.isAir(worldIn, position) && !block.isLeaves(worldIn, position)) break; - position = position.down(); -- } -+ } while (position.getY() > 0); - - Block block1 = worldIn.getBlockState(position).getBlock(); - -- if (block1 == Blocks.dirt || block1 == Blocks.grass) -+ if (block1.canSustainPlant(worldIn, position, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) - { - position = position.up(); - this.setBlockAndNotifyAdequately(worldIn, position, this.woodMetadata); -++++ END PATCH -++++ REJECTED PATCH 2 - { - BlockPos blockpos = new BlockPos(l, i, j1); - -- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej deleted file mode 100644 index da11cee0f2..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej +++ /dev/null @@ -1,80 +0,0 @@ -++++ REJECTED PATCH 1 - { - Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock(); - -- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) -+ if (!block.isAir(worldIn, blockpos$mutableblockpos.set(l, j, i1)) && !block.isLeaves(worldIn, blockpos$mutableblockpos.set(l, j, i1))) - { - if (block != Blocks.water && block != Blocks.flowing_water) - { -++++ END PATCH -++++ REJECTED PATCH 3 - { - BlockPos blockpos = new BlockPos(k3, l1, j1); - -- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181649_b); - } -++++ END PATCH -++++ REJECTED PATCH 4 - - for (int i2 = 0; i2 < i; ++i2) - { -- Block block2 = worldIn.getBlockState(position.up(i2)).getBlock(); -+ BlockPos upN = position.up(i2); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); - -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2 == Blocks.flowing_water || block2 == Blocks.water) -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2 == Blocks.flowing_water || block2 == Blocks.water) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(i2), field_181648_a); - } -++++ END PATCH -++++ REJECTED PATCH 5 - { - blockpos$mutableblockpos1.set(i4, j2, j4); - -- if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.leaves) -+ if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().isLeaves(worldIn, blockpos$mutableblockpos1)) - { - BlockPos blockpos3 = blockpos$mutableblockpos1.west(); - BlockPos blockpos4 = blockpos$mutableblockpos1.east(); - BlockPos blockpos1 = blockpos$mutableblockpos1.north(); - BlockPos blockpos2 = blockpos$mutableblockpos1.south(); - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn,blockpos3)) - { - this.func_181647_a(worldIn, blockpos3, BlockVine.EAST); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn,blockpos4)) - { - this.func_181647_a(worldIn, blockpos4, BlockVine.WEST); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn,blockpos1)) - { - this.func_181647_a(worldIn, blockpos1, BlockVine.SOUTH); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn,blockpos2)) - { - this.func_181647_a(worldIn, blockpos2, BlockVine.NORTH); - } -++++ END PATCH -++++ REJECTED PATCH 6 - this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); - int i = 4; - -- for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).getBlock().getMaterial() == Material.air && i > 0; --i) -+ for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).getBlock().isAir(p_181647_1_,p_181647_2_) && i > 0; --i) - { - this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); - p_181647_2_ = p_181647_2_.down(); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej deleted file mode 100644 index 69dac58c70..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej +++ /dev/null @@ -1,24 +0,0 @@ -++++ REJECTED PATCH 3 - { - BlockPos blockpos = new BlockPos(j3, l2, i2); - -- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181637_b); - } -++++ END PATCH -++++ REJECTED PATCH 4 - - for (int i3 = 0; i3 < i - 1; ++i3) - { -- Block block1 = worldIn.getBlockState(position.up(i3)).getBlock(); -+ BlockPos upN = position.up(i3); -+ Block block1 = worldIn.getBlockState(upN).getBlock(); - -- if (block1.getMaterial() == Material.air || block1.getMaterial() == Material.leaves) -+ if (block1.isAir(worldIn, upN) || block1.isLeaves(worldIn, upN)) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(i3), field_181636_a); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej deleted file mode 100644 index c239c82d24..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej +++ /dev/null @@ -1,52 +0,0 @@ -++++ REJECTED PATCH 1 - { - Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(k1, i1, l1)).getBlock(); - -- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) -+ if (!block.isAir(worldIn, blockpos$mutableblockpos) && !block.isLeaves(worldIn, blockpos$mutableblockpos)) - { - flag = false; - } -++++ END PATCH -++++ REJECTED PATCH 2 - } - else - { -- Block block1 = worldIn.getBlockState(position.down()).getBlock(); -+ 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); - -- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 256 - i - 1) -+ if (isSoil && position.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, position.down()); -+ block1.onPlantGrow(worldIn, down, position); - int i3 = rand.nextInt(2); - int j3 = 1; - int k3 = 0; -++++ END PATCH -++++ REJECTED PATCH 3 - { - BlockPos blockpos = new BlockPos(i2, j4, k2); - -- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181646_b); - } -++++ END PATCH -++++ REJECTED PATCH 4 - - for (int k4 = 0; k4 < i - i4; ++k4) - { -- Block block2 = worldIn.getBlockState(position.up(k4)).getBlock(); -+ BlockPos upN = position.up(k4); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); - -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(k4), field_181645_a); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch.rej deleted file mode 100644 index c80d1d0f2d..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch.rej +++ /dev/null @@ -1,16 +0,0 @@ -++++ REJECTED PATCH 1 - { - Block block; - -- while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 1) -+ do - { -+ block = worldIn.getBlockState(position).getBlock(); -+ if (!block.isAir(worldIn, position) && !block.isLeaves(worldIn, position)) break; - position = position.down(); -- } -+ } while (position.getY() > 0); - - if (position.getY() < 1) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/storage/MapData.java.patch.rej b/rejects/minecraft/net/minecraft/world/storage/MapData.java.patch.rej deleted file mode 100644 index be29e9811a..0000000000 --- a/rejects/minecraft/net/minecraft/world/storage/MapData.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - { - public int xCenter; - public int zCenter; -- public byte dimension; -+ public int dimension; //FML byte -> int - public byte scale; - public byte[] colors = new byte[16384]; - public List playersArrayList = Lists.newArrayList(); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej b/rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej deleted file mode 100644 index 5df712317c..0000000000 --- a/rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej +++ /dev/null @@ -1,57 +0,0 @@ -++++ REJECTED PATCH 1 - { - File file1 = new File(this.worldDirectory, "level.dat"); - -+ WorldInfo worldInfo = null; -+ - if (file1.exists()) - { - try - { - NBTTagCompound nbttagcompound2 = CompressedStreamTools.readCompressed(new FileInputStream(file1)); - NBTTagCompound nbttagcompound3 = nbttagcompound2.getCompoundTag("Data"); -- return new WorldInfo(nbttagcompound3); -+ worldInfo = new WorldInfo(nbttagcompound3); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound2); -+ return worldInfo; - } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) -+ { -+ throw e; -+ } - catch (Exception exception1) - { - exception1.printStackTrace(); - } - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); - file1 = new File(this.worldDirectory, "level.dat_old"); - - if (file1.exists()) -++++ END PATCH -++++ REJECTED PATCH 2 - { - NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); - NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); -- return new WorldInfo(nbttagcompound1); -+ worldInfo = new WorldInfo(nbttagcompound1); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); -+ return worldInfo; -+ } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) -+ { -+ throw e; - } - catch (Exception exception) - { -++++ END PATCH -++++ REJECTED PATCH 5 - } - - file1.renameTo(file2); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(player, this.playersDirectory, player.getUniqueID().toString()); - } - catch (Exception var5) - { -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java b/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java index 29183959f2..e7aadf6a84 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java @@ -40,10 +40,10 @@ import net.minecraft.network.EnumConnectionState; import net.minecraft.network.INetHandler; import net.minecraft.network.NetworkManager; import net.minecraft.network.handshake.client.C00Handshake; -import net.minecraft.network.login.server.S00PacketDisconnect; +import net.minecraft.network.login.server.SPacketDisconnect; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.TextComponentString; import net.minecraft.util.IThreadListener; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraft.world.storage.SaveHandler; import net.minecraft.world.storage.WorldInfo; @@ -611,7 +611,7 @@ public class FMLCommonHandler { TextComponentString text = new TextComponentString("Server is still starting! Please wait before reconnecting."); FMLLog.info("Disconnecting Player: " + text.getUnformattedText()); - manager.sendPacket(new S00PacketDisconnect(text)); + manager.sendPacket(new SPacketDisconnect(text)); manager.closeChannel(text); return false; } @@ -621,7 +621,7 @@ public class FMLCommonHandler manager.setConnectionState(EnumConnectionState.LOGIN); TextComponentString text = new TextComponentString("This server requires FML/Forge to be installed. Contact your server admin for more details."); FMLLog.info("Disconnecting Player: " + text.getUnformattedText()); - manager.sendPacket(new S00PacketDisconnect(text)); + manager.sendPacket(new SPacketDisconnect(text)); manager.closeChannel(text); return false; } From c87feabd6ef75ee93babe44e92e947c5e3f4e3cf Mon Sep 17 00:00:00 2001 From: Adubbz Date: Thu, 3 Mar 2016 18:33:26 +1100 Subject: [PATCH 027/243] Updated BiomeManager to 1.9 --- .../minecraftforge/common/BiomeManager.java | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/main/java/net/minecraftforge/common/BiomeManager.java b/src/main/java/net/minecraftforge/common/BiomeManager.java index 474bf18946..8eb1315335 100644 --- a/src/main/java/net/minecraftforge/common/BiomeManager.java +++ b/src/main/java/net/minecraftforge/common/BiomeManager.java @@ -7,9 +7,10 @@ import java.util.List; import com.google.common.collect.ImmutableList; +import net.minecraft.init.Biomes; import net.minecraft.util.WeightedRandom; import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.biome.WorldChunkManager; +import net.minecraft.world.biome.BiomeProvider; import net.minecraft.world.gen.structure.MapGenVillage; import net.minecraftforge.common.util.EnumHelper; @@ -24,9 +25,9 @@ public class BiomeManager static { - oceanBiomes.add(BiomeGenBase.ocean); - oceanBiomes.add(BiomeGenBase.deepOcean); - oceanBiomes.add(BiomeGenBase.frozenOcean); + oceanBiomes.add(Biomes.ocean); + oceanBiomes.add(Biomes.deepOcean); + oceanBiomes.add(Biomes.frozenOcean); } private static TrackedList[] setupBiomes() @@ -35,26 +36,26 @@ public class BiomeManager TrackedList[] currentBiomes = new TrackedList[BiomeType.values().length]; List list = new ArrayList(); - list.add(new BiomeEntry(BiomeGenBase.forest, 10)); - list.add(new BiomeEntry(BiomeGenBase.roofedForest, 10)); - list.add(new BiomeEntry(BiomeGenBase.extremeHills, 10)); - list.add(new BiomeEntry(BiomeGenBase.plains, 10)); - list.add(new BiomeEntry(BiomeGenBase.birchForest, 10)); - list.add(new BiomeEntry(BiomeGenBase.swampland, 10)); + list.add(new BiomeEntry(Biomes.forest, 10)); + list.add(new BiomeEntry(Biomes.roofedForest, 10)); + list.add(new BiomeEntry(Biomes.extremeHills, 10)); + list.add(new BiomeEntry(Biomes.plains, 10)); + list.add(new BiomeEntry(Biomes.birchForest, 10)); + list.add(new BiomeEntry(Biomes.swampland, 10)); currentBiomes[BiomeType.WARM.ordinal()] = new TrackedList(list); list.clear(); - list.add(new BiomeEntry(BiomeGenBase.forest, 10)); - list.add(new BiomeEntry(BiomeGenBase.extremeHills, 10)); - list.add(new BiomeEntry(BiomeGenBase.taiga, 10)); - list.add(new BiomeEntry(BiomeGenBase.plains, 10)); + list.add(new BiomeEntry(Biomes.forest, 10)); + list.add(new BiomeEntry(Biomes.extremeHills, 10)); + list.add(new BiomeEntry(Biomes.taiga, 10)); + list.add(new BiomeEntry(Biomes.plains, 10)); currentBiomes[BiomeType.COOL.ordinal()] = new TrackedList(list); list.clear(); - list.add(new BiomeEntry(BiomeGenBase.icePlains, 30)); - list.add(new BiomeEntry(BiomeGenBase.coldTaiga, 10)); + list.add(new BiomeEntry(Biomes.icePlains, 30)); + list.add(new BiomeEntry(Biomes.coldTaiga, 10)); currentBiomes[BiomeType.ICY.ordinal()] = new TrackedList(list); list.clear(); @@ -102,17 +103,17 @@ public class BiomeManager public static void addSpawnBiome(BiomeGenBase biome) { - if (!WorldChunkManager.allowedBiomes.contains(biome)) + if (!BiomeProvider.allowedBiomes.contains(biome)) { - WorldChunkManager.allowedBiomes.add(biome); + BiomeProvider.allowedBiomes.add(biome); } } public static void removeSpawnBiome(BiomeGenBase biome) { - if (WorldChunkManager.allowedBiomes.contains(biome)) + if (BiomeProvider.allowedBiomes.contains(biome)) { - WorldChunkManager.allowedBiomes.remove(biome); + BiomeProvider.allowedBiomes.remove(biome); } } From f821759c21ecb281dcb39b3eb979cf9e9ed0fb82 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 2 Mar 2016 23:37:05 -0800 Subject: [PATCH 028/243] Delete reject files i missed --- .../feature/WorldGenTallGrass.java.patch.rej | 16 ---- .../gen/feature/WorldGenTrees.java.patch.rej | 88 ------------------- 2 files changed, 104 deletions(-) delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch.rej deleted file mode 100644 index 8e41645a26..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch.rej +++ /dev/null @@ -1,16 +0,0 @@ -++++ REJECTED PATCH 1 - { - Block block; - -- while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0) -+ do - { -+ block = worldIn.getBlockState(position).getBlock(); -+ if (!block.isAir(worldIn, position) && !block.isLeaves(worldIn, position)) break; - position = position.down(); -- } -+ } while (position.getY() > 0); - - for (int i = 0; i < 128; ++i) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej deleted file mode 100644 index 4476c426aa..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej +++ /dev/null @@ -1,88 +0,0 @@ -++++ REJECTED PATCH 2 - } - else - { -- Block block1 = worldIn.getBlockState(position.down()).getBlock(); -+ 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); - -- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 256 - i - 1) -+ if (isSoil && position.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, position.down()); -+ block1.onPlantGrow(worldIn, down, position); - int k2 = 3; - int l2 = 0; - -++++ END PATCH -++++ REJECTED PATCH 3 - BlockPos blockpos = new BlockPos(k1, i3, i2); - Block block = worldIn.getBlockState(blockpos).getBlock(); - -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine) -+ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos) || block.getMaterial() == Material.vine) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves); - } -++++ END PATCH -++++ REJECTED PATCH 4 - - for (int j3 = 0; j3 < i; ++j3) - { -- Block block2 = worldIn.getBlockState(position.up(j3)).getBlock(); -+ BlockPos upN = position.up(j3); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); - -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2.getMaterial() == Material.vine) -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2.getMaterial() == Material.vine) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood); - -++++ END PATCH -++++ REJECTED PATCH 5 - { - blockpos$mutableblockpos1.set(l4, k3, i5); - -- if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.leaves) -+ if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().isLeaves(worldIn,blockpos$mutableblockpos1)) - { - BlockPos blockpos2 = blockpos$mutableblockpos1.west(); - BlockPos blockpos3 = blockpos$mutableblockpos1.east(); - BlockPos blockpos4 = blockpos$mutableblockpos1.north(); - BlockPos blockpos1 = blockpos$mutableblockpos1.south(); - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn,blockpos2)) - { - this.func_181650_b(worldIn, blockpos2, BlockVine.EAST); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn,blockpos3)) - { - this.func_181650_b(worldIn, blockpos3, BlockVine.WEST); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn,blockpos4)) - { - this.func_181650_b(worldIn, blockpos4, BlockVine.SOUTH); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn,blockpos1)) - { - this.func_181650_b(worldIn, blockpos1, BlockVine.NORTH); - } -++++ END PATCH -++++ REJECTED PATCH 6 - this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); - int i = 4; - -- for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).getBlock().getMaterial() == Material.air && i > 0; --i) -+ for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).getBlock().isAir(p_181650_1_,p_181650_2_) && i > 0; --i) - { - this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); - p_181650_2_ = p_181650_2_.down(); -++++ END PATCH From 8a506022d7a6af396adaf4d2d5063c48ed6a2f6f Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 3 Mar 2016 02:57:38 -0800 Subject: [PATCH 029/243] More work on misc things. --- .../net/minecraft/block/Block.java.patch | 29 +- .../net/minecraft/client/Minecraft.java.patch | 369 +++++++++++++++++- .../multiplayer/GuiConnecting.java.patch | 11 +- .../client/particle/EffectRenderer.java.patch | 18 +- .../net/minecraft/entity/Entity.java.patch | 21 +- .../dedicated/DedicatedServer.java.patch | 2 +- .../minecraft/client/Minecraft.java.patch.rej | 316 +-------------- .../common/ForgeChunkManager.java | 8 +- .../net/minecraftforge/common/ForgeHooks.java | 157 ++++---- .../fml/client/SplashProgress.java | 5 +- .../common/network/PacketLoggingHandler.java | 8 +- src/main/resources/forge_at.cfg | 1 + 12 files changed, 497 insertions(+), 448 deletions(-) rename rejects/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch.rej => patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch (64%) diff --git a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch index 65aa8f3e3a..fe404d8742 100644 --- a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch @@ -188,7 +188,15 @@ } protected ItemStack createStackedBlock(IBlockState state) -@@ -844,6 +864,1175 @@ +@@ -747,6 +767,7 @@ + entityIn.motionY = 0.0D; + } + ++ @Deprecated // Forge: Use more sensitive version below: getPickBlock + public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) + { + return new ItemStack(Item.getItemFromBlock(this), 1, this.damageDropped(p_185473_3_)); +@@ -844,6 +865,1162 @@ return "Block{" + blockRegistry.getNameForObject(this) + "}"; } @@ -788,22 +796,9 @@ + * @param target The full target the player is looking at + * @return A ItemStack to add to the player's inventory, Null if nothing should be added. + */ -+ 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 getPickBlock(target, world, pos); -+ } -+ @Deprecated -+ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos) -+ { -+ Item item = getItem(world, pos); -+ -+ if (item == null) -+ { -+ return null; -+ } -+ -+ Block block = item instanceof ItemBlock && !isFlowerPot() ? Block.getBlockFromItem(item) : this; -+ return new ItemStack(item, 1, block.getDamageValue(world, pos)); ++ return func_185473_a(world, pos, state); + } + + /** @@ -846,7 +841,7 @@ + * @return True to prevent vanilla digging particles form spawning. + */ + @SideOnly(Side.CLIENT) -+ public boolean addHitEffects(World worldObj, MovingObjectPosition target, net.minecraft.client.particle.EffectRenderer effectRenderer) ++ public boolean addHitEffects(World worldObj, RayTraceResult target, net.minecraft.client.particle.EffectRenderer effectRenderer) + { + return false; + } diff --git a/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch b/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch index caba83d8c0..4bfb84b468 100644 --- a/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch @@ -8,6 +8,19 @@ this.isDemo = gameConfig.gameInfo.isDemo; this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1; this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1; +@@ -432,10 +431,10 @@ + this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_); + this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language); + this.mcResourceManager.registerReloadListener(this.mcLanguageManager); +- this.refreshResources(); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.defaultResourcePacks, this.mcResourceManager); + this.renderEngine = new TextureManager(this.mcResourceManager); + this.mcResourceManager.registerReloadListener(this.renderEngine); +- this.drawSplashScreen(this.renderEngine); ++ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.renderEngine); + this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); + this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves"), this.field_184131_U); + this.mcSoundHandler = new SoundHandler(this.mcResourceManager, this.gameSettings); @@ -469,6 +468,8 @@ } }); @@ -17,7 +30,62 @@ this.checkGLError("Pre startup"); GlStateManager.enableTexture2D(); GlStateManager.shadeModel(7425); -@@ -692,21 +693,23 @@ +@@ -482,19 +483,23 @@ + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + this.checkGLError("Startup"); +- this.textureMapBlocks = new TextureMap("textures"); ++ bar.step("Loading Texture Map"); ++ this.textureMapBlocks = new TextureMap("textures", true); + this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels); + this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks); + this.renderEngine.bindTexture(TextureMap.locationBlocksTexture); + this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0); ++ bar.step("Loading Model Manager"); + this.modelManager = new ModelManager(this.textureMapBlocks); + this.mcResourceManager.registerReloadListener(this.modelManager); + this.field_184127_aH = BlockColors.func_186723_a(); + this.field_184128_aI = ItemColors.func_186729_a(this.field_184127_aH); ++ bar.step("Loading Item Renderer"); + this.renderItem = new RenderItem(this.renderEngine, this.modelManager, this.field_184128_aI); + this.renderManager = new RenderManager(this.renderEngine, this.renderItem); + this.itemRenderer = new ItemRenderer(this); + this.mcResourceManager.registerReloadListener(this.renderItem); ++ bar.step("Loading Entity Renderer"); + this.entityRenderer = new EntityRenderer(this, this.mcResourceManager); + this.mcResourceManager.registerReloadListener(this.entityRenderer); + this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.field_184127_aH); +@@ -504,23 +509,26 @@ + this.guiAchievement = new GuiAchievement(this); + GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight); + this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading(); + this.checkGLError("Post startup"); +- this.ingameGUI = new GuiIngame(this); ++ this.ingameGUI = new net.minecraftforge.client.GuiIngameForge(this); + + if (this.serverName != null) + { +- this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort)); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.serverName, this.serverPort); + } + else + { + this.displayGuiScreen(new GuiMainMenu()); + } + +- this.renderEngine.deleteTexture(this.mojangLogo); ++ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(renderEngine, mojangLogo); + this.mojangLogo = null; + this.loadingScreen = new LoadingScreenRenderer(this); + this.field_184132_p = new DebugRenderer(this); + ++ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete(); + if (this.gameSettings.fullScreen && !this.fullscreen) + { + this.toggleFullscreen(); +@@ -692,21 +700,23 @@ File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); Bootstrap.printToSYSOUT(crashReportIn.getCompleteReport()); @@ -44,7 +112,7 @@ } public boolean isUnicode() -@@ -899,11 +902,6 @@ +@@ -899,11 +909,6 @@ public void displayGuiScreen(GuiScreen guiScreenIn) { @@ -56,7 +124,25 @@ if (guiScreenIn == null && this.theWorld == null) { guiScreenIn = new GuiMainMenu(); -@@ -1051,9 +1049,11 @@ +@@ -913,6 +918,17 @@ + guiScreenIn = new GuiGameOver((ITextComponent)null); + } + ++ GuiScreen old = this.currentScreen; ++ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(guiScreenIn); ++ ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; ++ ++ guiScreenIn = event.gui; ++ if (old != null && guiScreenIn != old) ++ { ++ old.onGuiClosed(); ++ } ++ + if (guiScreenIn instanceof GuiMainMenu || guiScreenIn instanceof GuiMultiplayer) + { + this.gameSettings.showDebugInfo = false; +@@ -1051,9 +1067,11 @@ if (!this.skipRenderWorld) { @@ -68,7 +154,28 @@ } this.mcProfiler.endSection(); -@@ -1623,6 +1623,8 @@ +@@ -1393,9 +1411,9 @@ + { + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + +- if (this.theWorld.getBlockState(blockpos).func_185904_a() != Material.air && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit)) ++ if (!this.theWorld.isAirBlock(blockpos) && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit)) + { +- this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit); ++ this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver); + this.thePlayer.func_184609_a(EnumHand.MAIN_HAND); + } + } +@@ -1429,7 +1447,7 @@ + case BLOCK: + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + +- if (this.theWorld.getBlockState(blockpos).func_185904_a() != Material.air) ++ if (!this.theWorld.isAirBlock(blockpos)) + { + this.playerController.clickBlock(blockpos, this.objectMouseOver.sideHit); + break; +@@ -1623,6 +1641,8 @@ --this.rightClickDelayTimer; } @@ -77,7 +184,7 @@ this.mcProfiler.startSection("gui"); if (!this.isGamePaused) -@@ -1734,6 +1736,7 @@ +@@ -1734,6 +1754,7 @@ this.joinPlayerCounter = 0; this.theWorld.joinEntityInSurroundings(this.thePlayer); } @@ -85,7 +192,15 @@ } this.mcProfiler.endStartSection("gameRenderer"); -@@ -1926,6 +1929,7 @@ +@@ -1821,6 +1842,7 @@ + this.myNetworkManager.processReceivedPackets(); + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick(); + this.mcProfiler.endSection(); + this.systemTime = getSystemTime(); + } +@@ -1926,6 +1948,7 @@ this.gameSettings.showLagometer = this.gameSettings.showDebugInfo && GuiScreen.isAltKeyDown(); } } @@ -93,7 +208,24 @@ } } -@@ -2273,6 +2277,12 @@ +@@ -2166,6 +2189,8 @@ + { + while (Mouse.next()) + { ++ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; ++ + int i = Mouse.getEventButton(); + KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); + +@@ -2231,6 +2256,7 @@ + + public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn) + { ++ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(folderName, worldName, worldSettingsIn); + this.loadWorld((WorldClient)null); + System.gc(); + ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); +@@ -2273,6 +2299,12 @@ while (!this.theIntegratedServer.serverIsInRunLoop()) { @@ -106,7 +238,24 @@ String s = this.theIntegratedServer.getUserMessage(); if (s != null) -@@ -2310,6 +2320,8 @@ +@@ -2298,8 +2330,14 @@ + SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); + NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); + networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); +- networkmanager.sendPacket(new C00Handshake(107, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); +- networkmanager.sendPacket(new CPacketLoginStart(this.getSession().getProfile())); ++ networkmanager.sendPacket(new C00Handshake(107, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true)); ++ com.mojang.authlib.GameProfile gameProfile = this.getSession().getProfile(); ++ if (!this.getSession().hasCachedProperties()) ++ { ++ gameProfile = sessionService.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. ++ this.getSession().setProperties(gameProfile.getProperties()); ++ } ++ networkmanager.sendPacket(new CPacketLoginStart(gameProfile)); + this.myNetworkManager = networkmanager; + } + +@@ -2310,6 +2348,8 @@ public void loadWorld(WorldClient worldClientIn, String loadingMessage) { @@ -115,7 +264,26 @@ if (worldClientIn == null) { NetHandlerPlayClient nethandlerplayclient = this.getNetHandler(); -@@ -2345,6 +2357,7 @@ +@@ -2322,6 +2362,18 @@ + if (this.theIntegratedServer != null && this.theIntegratedServer.isAnvilFileSet()) + { + this.theIntegratedServer.initiateShutdown(); ++ if (loadingScreen != null) ++ { ++ this.loadingScreen.displayLoadingString(I18n.format("forge.client.shutdown.internal")); ++ } ++ while (!theIntegratedServer.isServerStopped()) ++ { ++ try ++ { ++ Thread.sleep(10); ++ } ++ catch (InterruptedException ie) {} ++ } + } + + this.theIntegratedServer = null; +@@ -2345,6 +2397,7 @@ this.ingameGUI.func_181029_i(); this.setServerData((ServerData)null); this.integratedServerIsRunning = false; @@ -123,3 +291,186 @@ } this.mcSoundHandler.stopSounds(); +@@ -2461,159 +2514,8 @@ + { + if (this.objectMouseOver != null && this.objectMouseOver.typeOfHit != RayTraceResult.Type.MISS) + { +- boolean flag = this.thePlayer.capabilities.isCreativeMode; +- TileEntity tileentity = null; +- ItemStack itemstack; +- +- if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) +- { +- BlockPos blockpos = this.objectMouseOver.getBlockPos(); +- IBlockState iblockstate = this.theWorld.getBlockState(blockpos); +- Block block = iblockstate.getBlock(); +- +- if (iblockstate.func_185904_a() == Material.air) +- { +- return; +- } +- +- itemstack = block.func_185473_a(this.theWorld, blockpos, iblockstate); +- +- if (itemstack == null) +- { +- return; +- } +- +- if (flag && GuiScreen.isCtrlKeyDown() && block.hasTileEntity()) +- { +- tileentity = this.theWorld.getTileEntity(blockpos); +- } +- } +- else +- { +- if (this.objectMouseOver.typeOfHit != RayTraceResult.Type.ENTITY || this.objectMouseOver.entityHit == null || !flag) +- { +- return; +- } +- +- if (this.objectMouseOver.entityHit instanceof EntityPainting) +- { +- itemstack = new ItemStack(Items.painting); +- } +- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) +- { +- itemstack = new ItemStack(Items.lead); +- } +- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) +- { +- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; +- ItemStack itemstack1 = entityitemframe.getDisplayedItem(); +- +- if (itemstack1 == null) +- { +- itemstack = new ItemStack(Items.item_frame); +- } +- else +- { +- itemstack = ItemStack.copyItemStack(itemstack1); +- } +- } +- else if (this.objectMouseOver.entityHit instanceof EntityMinecart) +- { +- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; +- Item item; +- +- switch (entityminecart.func_184264_v()) +- { +- case FURNACE: +- item = Items.furnace_minecart; +- break; +- case CHEST: +- item = Items.chest_minecart; +- break; +- case TNT: +- item = Items.tnt_minecart; +- break; +- case HOPPER: +- item = Items.hopper_minecart; +- break; +- case COMMAND_BLOCK: +- item = Items.command_block_minecart; +- break; +- default: +- item = Items.minecart; +- } +- +- itemstack = new ItemStack(item); +- } +- else if (this.objectMouseOver.entityHit instanceof EntityBoat) +- { +- itemstack = new ItemStack(((EntityBoat)this.objectMouseOver.entityHit).func_184455_j()); +- } +- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) +- { +- itemstack = new ItemStack(Items.armor_stand); +- } +- else if (this.objectMouseOver.entityHit instanceof EntityEnderCrystal) +- { +- itemstack = new ItemStack(Items.field_185158_cP); +- } +- else +- { +- String s = EntityList.getEntityString(this.objectMouseOver.entityHit); +- +- if (!EntityList.entityEggs.containsKey(s)) +- { +- return; +- } +- +- itemstack = new ItemStack(Items.spawn_egg); +- ItemMonsterPlacer.func_185078_a(itemstack, s); +- } +- } +- +- if (itemstack.getItem() == null) +- { +- String s1 = ""; +- +- if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) +- { +- s1 = ((ResourceLocation)Block.blockRegistry.getNameForObject(this.theWorld.getBlockState(this.objectMouseOver.getBlockPos()).getBlock())).toString(); +- } +- else if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.ENTITY) +- { +- s1 = EntityList.getEntityString(this.objectMouseOver.entityHit); +- } +- +- logger.warn("Picking on: [{}] {} gave null item", new Object[] {this.objectMouseOver.typeOfHit, s1}); +- } +- else +- { +- InventoryPlayer inventoryplayer = this.thePlayer.inventory; +- +- if (tileentity != null) +- { +- this.func_184119_a(itemstack, tileentity); +- } +- +- int i = inventoryplayer.func_184429_b(itemstack); +- +- if (flag) +- { +- inventoryplayer.func_184434_a(itemstack); +- this.playerController.sendSlotPacket(this.thePlayer.func_184586_b(EnumHand.MAIN_HAND), 36 + inventoryplayer.currentItem); +- } +- else if (i != -1) +- { +- if (InventoryPlayer.func_184435_e(i)) +- { +- inventoryplayer.currentItem = i; +- } +- else +- { +- this.playerController.func_187100_a(i); +- } +- } +- } ++ net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld); ++ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions + } + } + +@@ -2909,18 +2811,8 @@ + + public static int getGLMaximumTextureSize() + { +- for (int i = 16384; i > 0; i >>= 1) +- { +- GlStateManager.func_187419_a(32868, 0, 6408, i, i, 0, 6408, 5121, (IntBuffer)null); +- int j = GlStateManager.func_187411_c(32868, 0, 4096); +- +- if (j != 0) +- { +- return i; +- } +- } +- +- return -1; ++ //Forge we redirect this to our code which caches the value before any splash screen stuff is done. ++ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize(); + } + + public boolean isSnooperEnabled() diff --git a/rejects/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch.rej b/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch similarity index 64% rename from rejects/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch index 8d8ef37b2e..8a4f63a24c 100644 --- a/rejects/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch @@ -1,10 +1,11 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java ++++ ../src-work/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java +@@ -67,7 +67,7 @@ inetaddress = InetAddress.getByName(ip); GuiConnecting.this.networkManager = NetworkManager.func_181124_a(inetaddress, port, GuiConnecting.this.mc.gameSettings.func_181148_f()); GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen)); -- GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN)); -+ GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN, true)); - GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile())); +- GuiConnecting.this.networkManager.sendPacket(new C00Handshake(107, ip, port, EnumConnectionState.LOGIN)); ++ GuiConnecting.this.networkManager.sendPacket(new C00Handshake(107, ip, port, EnumConnectionState.LOGIN, true)); + GuiConnecting.this.networkManager.sendPacket(new CPacketLoginStart(GuiConnecting.this.mc.getSession().getProfile())); } catch (UnknownHostException unknownhostexception) -++++ END PATCH diff --git a/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch index 6aca35860d..522791b865 100644 --- a/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch @@ -1,14 +1,24 @@ --- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java +++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java -@@ -460,4 +460,13 @@ +@@ -3,6 +3,9 @@ + import com.google.common.collect.Lists; + import com.google.common.collect.Maps; + import com.google.common.collect.Queues; ++ ++import akka.actor.FSM.State; ++ + import java.util.ArrayDeque; + import java.util.Iterator; + import java.util.List; +@@ -460,4 +463,13 @@ return "" + i; } + -+ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.MovingObjectPosition target) ++ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.math.RayTraceResult target) + { -+ Block block = worldObj.getBlockState(pos).getBlock(); -+ if (block != null && !block.addHitEffects(worldObj, target, this)) ++ IBlockState state = worldObj.getBlockState(pos); ++ if (state != null && !state.getBlock().addHitEffects(state, worldObj, target, this)) + { + addBlockHitEffects(pos, target.sideHit); + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch b/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch index cfdd777961..3b2451cc9d 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch @@ -70,7 +70,7 @@ { if (!this.worldObj.isRemote && !this.isDead) { -+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, dimensionId)) return; ++ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return null; this.worldObj.theProfiler.startSection("changeDimension"); MinecraftServer minecraftserver = this.func_184102_h(); int i = this.dimension; @@ -83,7 +83,7 @@ } public boolean verifyExplosion(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn, float p_174816_5_) -@@ -2662,6 +2695,211 @@ +@@ -2662,6 +2695,210 @@ EnchantmentHelper.applyArthropodEnchantments(entityLivingBaseIn, entityIn); } @@ -117,7 +117,7 @@ + * @param target The full target the player is looking at + * @return A ItemStack to add to the player's inventory, Null if nothing should be added. + */ -+ public ItemStack getPickedResult(MovingObjectPosition target) ++ public ItemStack getPickedResult(RayTraceResult target) + { + if (this instanceof net.minecraft.entity.item.EntityPainting) + { @@ -145,24 +145,23 @@ + } + else if (this instanceof net.minecraft.entity.item.EntityBoat) + { -+ return new ItemStack(net.minecraft.init.Items.boat); ++ return new ItemStack(((EntityBoat)this).func_184455_j()); + } + else if (this instanceof net.minecraft.entity.item.EntityArmorStand) + { + return new ItemStack(net.minecraft.init.Items.armor_stand); + } ++ else if (this instanceof net.minecraft.entity.item.EntityEnderCrystal) ++ { ++ return new ItemStack(net.minecraft.init.Items.field_185158_cP); ++ } + else + { -+ int id = EntityList.getEntityID(this); -+ if (id > 0 && EntityList.entityEggs.containsKey(id)) -+ { -+ return new ItemStack(net.minecraft.init.Items.spawn_egg, 1, id); -+ } + String name = EntityList.getEntityString(this); -+ if (name != null && net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().containsKey(name)) ++ if (EntityList.entityEggs.containsKey(name)) + { + ItemStack stack = new ItemStack(net.minecraft.init.Items.spawn_egg); -+ stack.setTagInfo("entity_name", new net.minecraft.nbt.NBTTagString(name)); ++ net.minecraft.item.ItemMonsterPlacer.func_185078_a(stack, name); + return stack; + } + } diff --git a/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index d945032b47..4e1062e8af 100644 --- a/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -55,7 +55,7 @@ } + //Forge: Enable formated text for colors in console. -+ @Override public void addChatMessage(net.minecraft.util.IChatComponent message) { logger.info(message.getFormattedText()); } ++ @Override public void addChatMessage(net.minecraft.util.text.ITextComponent message) { logger.info(message.getFormattedText()); } + protected boolean convertFiles() throws IOException { diff --git a/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej b/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej index 398b89ce8f..af5d4ff9b9 100644 --- a/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej +++ b/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej @@ -1,100 +1,3 @@ -++++ REJECTED PATCH 2 - this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_); - this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language); - this.mcResourceManager.registerReloadListener(this.mcLanguageManager); -- this.refreshResources(); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.defaultResourcePacks, this.mcResourceManager); - this.renderEngine = new TextureManager(this.mcResourceManager); - this.mcResourceManager.registerReloadListener(this.renderEngine); -- this.drawSplashScreen(this.renderEngine); -+ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.renderEngine); - this.initStream(); - this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); - this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves")); -++++ END PATCH -++++ REJECTED PATCH 4 - GlStateManager.loadIdentity(); - GlStateManager.matrixMode(5888); - this.checkGLError("Startup"); -- this.textureMapBlocks = new TextureMap("textures"); -+ bar.step("Loading Texture Map"); -+ this.textureMapBlocks = new TextureMap("textures",true); - this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels); - this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks); - this.renderEngine.bindTexture(TextureMap.locationBlocksTexture); - this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0); -+ bar.step("Loading Model Manager"); - this.modelManager = new ModelManager(this.textureMapBlocks); - this.mcResourceManager.registerReloadListener(this.modelManager); -+ bar.step("Loading Item Renderer"); - this.renderItem = new RenderItem(this.renderEngine, this.modelManager); - this.renderManager = new RenderManager(this.renderEngine, this.renderItem); - this.itemRenderer = new ItemRenderer(this); - this.mcResourceManager.registerReloadListener(this.renderItem); -+ bar.step("Loading Entity Renderer"); - this.entityRenderer = new EntityRenderer(this, this.mcResourceManager); - this.mcResourceManager.registerReloadListener(this.entityRenderer); - this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.gameSettings); -++++ END PATCH -++++ REJECTED PATCH 5 - this.guiAchievement = new GuiAchievement(this); - GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight); - this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading(); - this.checkGLError("Post startup"); -- this.ingameGUI = new GuiIngame(this); -+ this.ingameGUI = new net.minecraftforge.client.GuiIngameForge(this); - - if (this.serverName != null) - { -- this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort)); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.serverName, this.serverPort); - } - else - { - this.displayGuiScreen(new GuiMainMenu()); - } - -- this.renderEngine.deleteTexture(this.mojangLogo); -+ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(renderEngine, mojangLogo); - this.mojangLogo = null; - this.loadingScreen = new LoadingScreenRenderer(this); - -+ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete(); - if (this.gameSettings.fullScreen && !this.fullscreen) - { - this.toggleFullscreen(); -++++ END PATCH -++++ REJECTED PATCH 8 - guiScreenIn = new GuiGameOver(); - } - -+ GuiScreen old = this.currentScreen; -+ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(guiScreenIn); -+ -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; -+ -+ guiScreenIn = event.gui; -+ if (old != null && guiScreenIn != old) -+ { -+ old.onGuiClosed(); -+ } -+ - if (guiScreenIn instanceof GuiMainMenu) - { - this.gameSettings.showDebugInfo = false; -++++ END PATCH -++++ REJECTED PATCH 10 - - if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit)) - { -- this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit); -+ this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver); - this.thePlayer.swingItem(); - } - } -++++ END PATCH ++++ REJECTED PATCH 11 case BLOCK: BlockPos blockpos = this.objectMouseOver.getBlockPos(); @@ -127,221 +30,4 @@ { this.entityRenderer.itemRenderer.resetEquippedProgress2(); } -++++ END PATCH -++++ REJECTED PATCH 14 - - while (Mouse.next()) - { -+ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; -+ - int i = Mouse.getEventButton(); - KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); - -++++ END PATCH -++++ REJECTED PATCH 17 - this.myNetworkManager.processReceivedPackets(); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick(); -+ - this.mcProfiler.endSection(); - this.systemTime = getSystemTime(); - } - - public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn) - { -+ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(folderName, worldName, worldSettingsIn); - this.loadWorld((WorldClient)null); - System.gc(); - ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); -++++ END PATCH -++++ REJECTED PATCH 19 - SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); - NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); - networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); -- networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); -- networkmanager.sendPacket(new C00PacketLoginStart(this.getSession().getProfile())); -+ networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true)); -+ com.mojang.authlib.GameProfile gameProfile = this.getSession().getProfile(); -+ if (!this.getSession().hasCachedProperties()) -+ { -+ gameProfile = sessionService.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. -+ this.getSession().setProperties(gameProfile.getProperties()); -+ } -+ networkmanager.sendPacket(new C00PacketLoginStart(gameProfile)); - this.myNetworkManager = networkmanager; - } - -++++ END PATCH -++++ REJECTED PATCH 21 - { - this.theIntegratedServer.initiateShutdown(); - this.theIntegratedServer.setStaticInstance(); -+ if (loadingScreen != null) -+ { -+ this.loadingScreen.displayLoadingString(I18n.format("forge.client.shutdown.internal")); -+ } -+ while (!theIntegratedServer.isServerStopped()) -+ { -+ try -+ { -+ Thread.sleep(10); -+ } -+ catch (InterruptedException ie) {} -+ } - } - - this.theIntegratedServer = null; -++++ END PATCH -++++ REJECTED PATCH 23 - if (this.objectMouseOver != null) - { - boolean flag = this.thePlayer.capabilities.isCreativeMode; -- int i = 0; -- boolean flag1 = false; -- TileEntity tileentity = null; -- Item item; -- -- if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) -- { -- BlockPos blockpos = this.objectMouseOver.getBlockPos(); -- Block block = this.theWorld.getBlockState(blockpos).getBlock(); -- -- if (block.getMaterial() == Material.air) -- { -- return; -- } -- -- item = block.getItem(this.theWorld, blockpos); -- -- if (item == null) -- { -- return; -- } -- -- if (flag && GuiScreen.isCtrlKeyDown()) -- { -- tileentity = this.theWorld.getTileEntity(blockpos); -- } -- -- Block block1 = item instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem(item) : block; -- i = block1.getDamageValue(this.theWorld, blockpos); -- flag1 = item.getHasSubtypes(); -- } -- else -- { -- if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) -- { -- return; -- } -- -- if (this.objectMouseOver.entityHit instanceof EntityPainting) -- { -- item = Items.painting; -- } -- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) -- { -- item = Items.lead; -- } -- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) -- { -- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; -- ItemStack itemstack = entityitemframe.getDisplayedItem(); -- -- if (itemstack == null) -- { -- item = Items.item_frame; -- } -- else -- { -- item = itemstack.getItem(); -- i = itemstack.getMetadata(); -- flag1 = true; -- } -- } -- else if (this.objectMouseOver.entityHit instanceof EntityMinecart) -- { -- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; -- -- switch (entityminecart.getMinecartType()) -- { -- case FURNACE: -- item = Items.furnace_minecart; -- break; -- case CHEST: -- item = Items.chest_minecart; -- break; -- case TNT: -- item = Items.tnt_minecart; -- break; -- case HOPPER: -- item = Items.hopper_minecart; -- break; -- case COMMAND_BLOCK: -- item = Items.command_block_minecart; -- break; -- default: -- item = Items.minecart; -- } -- } -- else if (this.objectMouseOver.entityHit instanceof EntityBoat) -- { -- item = Items.boat; -- } -- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) -- { -- item = Items.armor_stand; -- } -- else -- { -- item = Items.spawn_egg; -- i = EntityList.getEntityID(this.objectMouseOver.entityHit); -- flag1 = true; -- -- if (!EntityList.entityEggs.containsKey(Integer.valueOf(i))) -- { -- return; -- } -- } -- } -- - InventoryPlayer inventoryplayer = this.thePlayer.inventory; - -- if (tileentity == null) -- { -- inventoryplayer.setCurrentItem(item, i, flag1, flag); -- } -- else -- { -- ItemStack itemstack1 = this.func_181036_a(item, i, tileentity); -- inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1); -- } -- -+ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld)) return; -+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions - if (flag) - { - int j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + inventoryplayer.currentItem; -++++ END PATCH -++++ REJECTED PATCH 24 - - public static int getGLMaximumTextureSize() - { -- for (int i = 16384; i > 0; i >>= 1) -- { -- GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)((ByteBuffer)null)); -- int j = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); -- -- if (j != 0) -- { -- return i; -- } -- } -- -- return -1; -+ //Forge we redirect this to our code which caches the value before any splash screen stuff is done. -+ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize(); - } - - public boolean isSnooperEnabled() -++++ END PATCH +++++ END PATCH \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java index e60af5ed2a..8c52939d62 100644 --- a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java +++ b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java @@ -32,6 +32,8 @@ import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import com.google.common.collect.SetMultimap; import com.google.common.collect.Sets; + +import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; @@ -42,7 +44,7 @@ import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.entity.Entity; import net.minecraft.util.ClassInheritanceMultiMap; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.MathHelper; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.world.World; @@ -551,8 +553,8 @@ public class ForgeChunkManager forcedChunks.remove(world); dormantChunkCache.remove(world); - // integrated server is shutting down - if (!MinecraftServer.getServer().isServerRunning()) + // integrated server is shutting down + if (FMLCommonHandler.instance().getMinecraftServerInstance().isServerRunning()) { playerTickets.clear(); tickets.clear(); diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index f8816cf3e7..a64dc75254 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -22,13 +22,23 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLeashKnot; +import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.entity.item.EntityEnderCrystal; import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.item.EntityMinecart; import net.minecraft.entity.item.EntityMinecartContainer; +import net.minecraft.entity.item.EntityPainting; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.Container; @@ -39,6 +49,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemBucket; +import net.minecraft.item.ItemMonsterPlacer; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; @@ -55,10 +66,12 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.WeightedRandom; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextFormatting; @@ -89,6 +102,7 @@ import net.minecraftforge.event.entity.player.PlayerOpenContainerEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.NoteBlockEvent; import net.minecraftforge.fluids.IFluidBlock; +import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.relauncher.ReflectionHelper; @@ -247,76 +261,70 @@ public class ForgeHooks /** * Called when a player uses 'pick block', calls new Entity and Block hooks. */ - public static boolean onPickBlock(MovingObjectPosition target, EntityPlayer player, World world) + public static boolean onPickBlock(RayTraceResult target, EntityPlayer player, World world) { /* - int i = 0; - boolean flag1 = false; TileEntity tileentity = null; - Item item; + ItemStack itemstack; - if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) { BlockPos blockpos = this.objectMouseOver.getBlockPos(); - Block block = this.theWorld.getBlockState(blockpos).getBlock(); + IBlockState iblockstate = this.theWorld.getBlockState(blockpos); + Block block = iblockstate.getBlock(); - if (block.getMaterial() == Material.air) + if (iblockstate.func_185904_a() == Material.air) { return; } - item = block.getItem(this.theWorld, blockpos); + itemstack = block.func_185473_a(this.theWorld, blockpos, iblockstate); - if (item == null) + if (itemstack == null) { return; } - if (flag && GuiScreen.isCtrlKeyDown()) + if (flag && GuiScreen.isCtrlKeyDown() && block.hasTileEntity()) { tileentity = this.theWorld.getTileEntity(blockpos); } - - Block block1 = item instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem(item) : block; - i = block1.getDamageValue(this.theWorld, blockpos); - flag1 = item.getHasSubtypes(); } else { - if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) + if (this.objectMouseOver.typeOfHit != RayTraceResult.Type.ENTITY || this.objectMouseOver.entityHit == null || !flag) { return; } if (this.objectMouseOver.entityHit instanceof EntityPainting) { - item = Items.painting; + itemstack = new ItemStack(Items.painting); } else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) { - item = Items.lead; + itemstack = new ItemStack(Items.lead); } else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) { EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; - ItemStack itemstack = entityitemframe.getDisplayedItem(); + ItemStack itemstack1 = entityitemframe.getDisplayedItem(); - if (itemstack == null) + if (itemstack1 == null) { - item = Items.item_frame; + itemstack = new ItemStack(Items.item_frame); } else { - item = itemstack.getItem(); - i = itemstack.getMetadata(); - flag1 = true; + itemstack = ItemStack.copyItemStack(itemstack1); } } else if (this.objectMouseOver.entityHit instanceof EntityMinecart) { EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; + Item item; - switch (entityminecart.getMinecartType()) + switch (entityminecart.func_184264_v()) { case FURNACE: item = Items.furnace_minecart; @@ -336,61 +344,56 @@ public class ForgeHooks default: item = Items.minecart; } + + itemstack = new ItemStack(item); } else if (this.objectMouseOver.entityHit instanceof EntityBoat) { - item = Items.boat; + itemstack = new ItemStack(((EntityBoat)this.objectMouseOver.entityHit).func_184455_j()); } else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) { - item = Items.armor_stand; + itemstack = new ItemStack(Items.armor_stand); + } + else if (this.objectMouseOver.entityHit instanceof EntityEnderCrystal) + { + itemstack = new ItemStack(Items.field_185158_cP); } else { - item = Items.spawn_egg; - i = EntityList.getEntityID(this.objectMouseOver.entityHit); - flag1 = true; + String s = EntityList.getEntityString(this.objectMouseOver.entityHit); - if (!EntityList.entityEggs.containsKey(Integer.valueOf(i))) + if (!EntityList.entityEggs.containsKey(s)) { return; } + + itemstack = new ItemStack(Items.spawn_egg); + ItemMonsterPlacer.func_185078_a(itemstack, s); } } - - InventoryPlayer inventoryplayer = this.thePlayer.inventory; - - if (tileentity == null) - { - inventoryplayer.setCurrentItem(item, i, flag1, flag); - } - else - { - ItemStack itemstack1 = this.func_181036_a(item, i, tileentity); - inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1); - } */ ItemStack result = null; boolean isCreative = player.capabilities.isCreativeMode; TileEntity te = null; - if (target.typeOfHit == MovingObjectType.BLOCK) + if (target.typeOfHit == RayTraceResult.Type.BLOCK) { IBlockState state = world.getBlockState(target.getBlockPos()); - if (state.getBlock().isAir(world, target.getBlockPos())) + if (state.getBlock().isAir(state, world, target.getBlockPos())) { return false; } - if (isCreative && GuiScreen.isCtrlKeyDown()) + if (isCreative && GuiScreen.isCtrlKeyDown() && state.getBlock().hasTileEntity(state)) te = world.getTileEntity(target.getBlockPos()); - result = state.getBlock().getPickBlock(target, world, target.getBlockPos(), player); + result = state.getBlock().getPickBlock(state, target, world, target.getBlockPos(), player); } else { - if (target.typeOfHit != MovingObjectType.ENTITY || target.entityHit == null || !isCreative) + if (target.typeOfHit != RayTraceResult.Type.ENTITY || target.entityHit == null || !isCreative) { return false; } @@ -403,44 +406,44 @@ public class ForgeHooks return false; } + if (result.getItem() == null) + { + String s1 = ""; + + if (target.typeOfHit == RayTraceResult.Type.BLOCK) + { + s1 = ((ResourceLocation)Block.blockRegistry.getNameForObject(world.getBlockState(target.getBlockPos()).getBlock())).toString(); + } + else if (target.typeOfHit == RayTraceResult.Type.ENTITY) + { + s1 = EntityList.getEntityString(target.entityHit); + } + + FMLLog.warning("Picking on: [%s] %s gave null item", target.typeOfHit, s1); + return true; + } + if (te != null) { - NBTTagCompound nbt = new NBTTagCompound(); - te.writeToNBT(nbt); - result.setTagInfo("BlockEntityTag", nbt); - - NBTTagCompound display = new NBTTagCompound(); - result.setTagInfo("display", display); - - NBTTagList lore = new NBTTagList(); - display.setTag("Lore", lore); - lore.appendTag(new NBTTagString("(+NBT)")); + Minecraft.getMinecraft().func_184119_a(result, te); } - for (int x = 0; x < 9; x++) + if (isCreative) { - ItemStack stack = player.inventory.getStackInSlot(x); - if (stack != null && stack.isItemEqual(result) && ItemStack.areItemStackTagsEqual(stack, result)) - { - player.inventory.currentItem = x; - return true; - } + player.inventory.func_184434_a(result); + Minecraft.getMinecraft().playerController.sendSlotPacket(player.func_184586_b(EnumHand.MAIN_HAND), 36 + player.inventory.currentItem); + return true; } - - if (!isCreative) + int slot = player.inventory.func_184429_b(result); + if (slot != -1) { - return false; + if (InventoryPlayer.func_184435_e(slot)) + player.inventory.currentItem = slot; + else + Minecraft.getMinecraft().playerController.func_187100_a(slot); + return true; } - - int slot = player.inventory.getFirstEmptyStack(); - if (slot < 0 || slot >= 9) - { - slot = player.inventory.currentItem; - } - - player.inventory.setInventorySlotContents(slot, result); - player.inventory.currentItem = slot; - return true; + return false; } //Optifine Helper Functions u.u, these are here specifically for Optifine diff --git a/src/main/java/net/minecraftforge/fml/client/SplashProgress.java b/src/main/java/net/minecraftforge/fml/client/SplashProgress.java index 4f670a923e..3ba49489fb 100644 --- a/src/main/java/net/minecraftforge/fml/client/SplashProgress.java +++ b/src/main/java/net/minecraftforge/fml/client/SplashProgress.java @@ -74,6 +74,7 @@ import javax.imageio.stream.ImageInputStream; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.resources.DefaultResourcePack; import net.minecraft.client.resources.FileResourcePack; @@ -502,8 +503,8 @@ public class SplashProgress if (max_texture_size != -1) return max_texture_size; for (int i = 0x4000; i > 0; i >>= 1) { - GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); - if (GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH) != 0) + GlStateManager.func_187419_a(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (IntBuffer)null); + if (GlStateManager.func_187411_c(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH) != 0) { max_texture_size = i; return i; diff --git a/src/main/java/net/minecraftforge/fml/common/network/PacketLoggingHandler.java b/src/main/java/net/minecraftforge/fml/common/network/PacketLoggingHandler.java index f94033add8..54b5fecf0f 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/PacketLoggingHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/PacketLoggingHandler.java @@ -14,11 +14,11 @@ import java.util.List; import org.apache.logging.log4j.Level; import net.minecraft.network.EnumPacketDirection; +import net.minecraft.network.NettyVarint21FrameDecoder; +import net.minecraft.network.NettyVarint21FrameEncoder; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.PacketBuffer; -import net.minecraft.util.MessageDeserializer2; -import net.minecraft.util.MessageSerializer2; import net.minecraftforge.fml.common.FMLLog; public class PacketLoggingHandler @@ -60,7 +60,7 @@ public class PacketLoggingHandler } else { - pipeline.replace("splitter", "splitter", new MessageDeserializer2() + pipeline.replace("splitter", "splitter", new NettyVarint21FrameDecoder() { String prefix = (direction == EnumPacketDirection.SERVERBOUND ? "SERVER: C->S" : "CLIENT: S->C"); @Override @@ -77,7 +77,7 @@ public class PacketLoggingHandler } } }); - pipeline.replace("prepender", "prepender", new MessageSerializer2() + pipeline.replace("prepender", "prepender", new NettyVarint21FrameEncoder() { String prefix = (direction == EnumPacketDirection.SERVERBOUND ? "SERVER: S->C" : "CLIENT: C->S"); @Override diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index 5737f44f75..654f7a7499 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -185,6 +185,7 @@ public net.minecraft.client.Minecraft field_71446_o # textureManager public net.minecraft.client.Minecraft field_110450_ap # mcDefaultResourcePack public net.minecraft.client.Minecraft func_71370_a(II)V # resize public net.minecraft.client.Minecraft func_180510_a(Lnet/minecraft/client/renderer/texture/TextureManager;)V # drawSplashScreen +public net.minecraft.client.Minecraft func_184119_a(Lnet/minecraft/item/ItemStack;Lnet/minecraft/tileentity/TileEntity;)Lnet/minecraft/item/ItemStack; # storeTEInStack ## ItemBlock public net.minecraft.item.ItemBlock field_150939_a ## DedicatedServer From 74b2c3dfe68c4759ae726eb00c4175c94430d3e1 Mon Sep 17 00:00:00 2001 From: LexManos Date: Fri, 4 Mar 2016 16:40:34 -0800 Subject: [PATCH 030/243] World Patches work. --- .../net/minecraft/item/Item.java.patch | 7 +- .../minecraft/world/WorldProvider.java.patch | 7 +- .../world/WorldProviderSurface.java.patch | 10 ++ .../minecraft/world/chunk/Chunk.java.patch | 20 ++- .../world/gen/ChunkProviderEnd.java.patch | 68 ++++++++- .../world/gen/ChunkProviderHell.java.patch | 104 +++++++++++++ .../gen/ChunkProviderOverworld.java.patch | 101 ++++++++++++ .../world/gen/ChunkProviderServer.java.patch | 79 +++++++++- .../world/gen/MapGenCaves.java.patch | 58 +++++-- .../world/gen/MapGenRavine.java.patch | 66 ++++++-- .../world/gen/layer/GenLayer.java.patch | 12 +- .../world/gen/layer/GenLayerBiome.java.patch | 80 +++++++++- ...ComponentScatteredFeaturePieces.java.patch | 38 +++-- .../gen/structure/MapGenStronghold.java.patch | 23 +++ .../StructureMineshaftPieces.java.patch | 15 -- .../StructureStrongholdPieces.java.patch | 41 ----- .../StructureVillagePieces.java.patch | 28 ++-- .../world/gen/ChunkProviderEnd.java.patch.rej | 60 -------- .../gen/ChunkProviderGenerate.java.patch.rej | 117 -------------- .../gen/ChunkProviderHell.java.patch.rej | 144 ------------------ .../gen/ChunkProviderServer.java.patch.rej | 85 ----------- .../world/gen/MapGenCaves.java.patch.rej | 37 ----- .../world/gen/MapGenRavine.java.patch.rej | 32 ---- .../world/gen/layer/GenLayer.java.patch.rej | 10 -- .../gen/layer/GenLayerBiome.java.patch.rej | 84 ---------- ...onentScatteredFeaturePieces.java.patch.rej | 55 ------- .../structure/MapGenStronghold.java.patch.rej | 21 --- .../StructureMineshaftPieces.java.patch.rej | 19 --- ...StructureNetherBridgePieces.java.patch.rej | 29 ---- .../StructureStrongholdPieces.java.patch.rej | 37 ----- .../StructureVillagePieces.java.patch.rej | 19 --- .../minecraftforge/common/ChestGenHooks.java | 18 +-- .../event/ForgeEventFactory.java | 21 ++- ...derEvent.java => ChunkGeneratorEvent.java} | 21 +-- .../event/terraingen/InitNoiseGensEvent.java | 110 +++++++++++-- .../event/terraingen/PopulateChunkEvent.java | 17 ++- .../event/terraingen/TerrainGen.java | 9 +- .../fml/common/IWorldGenerator.java | 7 +- .../fml/common/registry/GameRegistry.java | 3 +- src/main/resources/forge.exc | 4 +- src/main/resources/forge_at.cfg | 30 ++++ 41 files changed, 810 insertions(+), 936 deletions(-) create mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldProviderSurface.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch delete mode 100644 rejects/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch.rej rename src/main/java/net/minecraftforge/event/terraingen/{ChunkProviderEvent.java => ChunkGeneratorEvent.java} (68%) diff --git a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch index 6a756fdcb1..4f4b6169d3 100644 --- a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch @@ -57,7 +57,7 @@ Vec3d vec3d1 = vec3d.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); return worldIn.rayTraceBlocks(vec3d, vec3d1, useLiquids, !useLiquids, false); } -@@ -422,11 +431,628 @@ +@@ -422,11 +431,629 @@ return false; } @@ -301,6 +301,7 @@ + * @param original Original result registered with the chest gen hooks. + * @return New values to use as the random item, typically this will be original + */ ++ @Deprecated // LootTables! + public net.minecraft.util.WeightedRandomChestContent getChestGenBase(net.minecraftforge.common.ChestGenHooks chest, Random rnd, net.minecraft.util.WeightedRandomChestContent original) + { + if (this instanceof ItemEnchantedBook) @@ -686,7 +687,7 @@ public static void registerItems() { registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() -@@ -935,6 +1561,10 @@ +@@ -935,6 +1562,10 @@ private final float damageVsEntity; private final int enchantability; @@ -697,7 +698,7 @@ private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) { this.harvestLevel = harvestLevel; -@@ -969,9 +1599,36 @@ +@@ -969,9 +1600,36 @@ return this.enchantability; } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch index 730ed8d0e4..6172c74f1b 100644 --- a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -54,7 +54,7 @@ } @SideOnly(Side.CLIENT) -@@ -212,6 +198,322 @@ +@@ -212,6 +198,327 @@ return new WorldBorder(); } @@ -67,6 +67,7 @@ + /** + * Sets the providers current dimension ID, used in default getSaveFolder() + * Added to allow default providers to be registered for multiple dimensions. ++ * This is to denote the exact dimension ID opposed to the 'type' in WorldType + * + * @param dim Dimension ID + */ @@ -74,6 +75,10 @@ + { + this.dimensionId = dim; + } ++ public int getDimension() ++ { ++ return this.dimensionId; ++ } + + /** + * Returns the sub-folder of the world folder that this WorldProvider saves to. diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldProviderSurface.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldProviderSurface.java.patch new file mode 100644 index 0000000000..d9aeb58c8b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/WorldProviderSurface.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldProviderSurface.java ++++ ../src-work/minecraft/net/minecraft/world/WorldProviderSurface.java +@@ -9,6 +9,6 @@ + + public boolean func_186056_c(int p_186056_1_, int p_186056_2_) + { +- return !this.worldObj.isSpawnChunk(p_186056_1_, p_186056_2_); ++ return !this.worldObj.isSpawnChunk(p_186056_1_, p_186056_2_) || !net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimension()); + } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch index dec892407e..cc85a3ee62 100644 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -198,7 +198,15 @@ i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); -@@ -1050,7 +1050,7 @@ +@@ -994,6 +994,7 @@ + { + this.func_150809_p(); + p_186034_1_.func_185931_b(this.xPosition, this.zPosition); ++ net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(this.xPosition, this.zPosition, this.worldObj, p_186034_1_, this.worldObj.getChunkProvider()); + this.setChunkModified(); + } + } +@@ -1050,7 +1051,7 @@ { BlockPos blockpos = (BlockPos)this.tileEntityPosQueue.poll(); @@ -207,7 +215,7 @@ { TileEntity tileentity = this.createNewTileEntity(blockpos); this.worldObj.setTileEntity(blockpos, tileentity); -@@ -1114,6 +1114,13 @@ +@@ -1114,6 +1115,13 @@ @SideOnly(Side.CLIENT) public void func_186033_a(PacketBuffer p_186033_1_, int p_186033_2_, boolean p_186033_3_) { @@ -221,7 +229,7 @@ boolean flag = !this.worldObj.provider.getHasNoSky(); for (int i = 0; i < this.storageArrays.length; ++i) -@@ -1162,10 +1169,16 @@ +@@ -1162,10 +1170,16 @@ this.isTerrainPopulated = true; this.generateHeightMap(); @@ -238,7 +246,7 @@ } public BiomeGenBase getBiome(BlockPos pos, BiomeProvider chunkManager) -@@ -1239,7 +1252,7 @@ +@@ -1239,7 +1253,7 @@ { BlockPos blockpos2 = blockpos1.offset(enumfacing); @@ -247,7 +255,7 @@ { this.worldObj.checkLight(blockpos2); } -@@ -1370,7 +1383,7 @@ +@@ -1370,7 +1384,7 @@ { blockpos$mutableblockpos.set(blockpos$mutableblockpos.getX(), l, blockpos$mutableblockpos.getZ()); @@ -256,7 +264,7 @@ { this.worldObj.checkLight(blockpos$mutableblockpos); } -@@ -1481,4 +1494,20 @@ +@@ -1481,4 +1495,20 @@ QUEUED, CHECK; } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch index 9f87f08fa4..827e84f8b0 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch @@ -1,12 +1,72 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java -@@ -123,6 +123,9 @@ +@@ -39,6 +39,9 @@ + double[] field_185967_f; + double[] field_185968_g; + private final WorldGenEndIsland field_185975_r = new WorldGenEndIsland(); ++ // temporary variables used during event handling ++ private int chunkX = 0; ++ private int chunkZ = 0; + + public ChunkProviderEnd(World p_i46667_1_, boolean p_i46667_2_, long p_i46667_3_) + { +@@ -51,6 +54,16 @@ + this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10); + this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16); + this.field_185973_o = new NoiseGeneratorSimplex(this.rand); ++ ++ net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextEnd ctx = ++ new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextEnd(field_185969_i, field_185970_j, field_185971_k, noiseGen5, noiseGen6, field_185973_o); ++ ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i46667_1_, this.rand, ctx); ++ this.field_185969_i = ctx.getLPerlin1(); ++ this.field_185970_j = ctx.getLPerlin2(); ++ this.field_185971_k = ctx.getPerlin(); ++ this.noiseGen5 = ctx.getDepth(); ++ this.noiseGen6 = ctx.getScale(); ++ this.field_185973_o = ctx.getIsland(); + } + + public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) +@@ -123,6 +136,7 @@ public void func_185962_a(ChunkPrimer p_185962_1_) { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, p_180519_1_, this.endWorld); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; ++ if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, this.chunkX, this.chunkZ, p_185962_1_, this.worldObj)) return; for (int i = 0; i < 16; ++i) { for (int j = 0; j < 16; ++j) +@@ -174,6 +188,7 @@ + + public Chunk func_185932_a(int p_185932_1_, int p_185932_2_) + { ++ this.chunkX = p_185932_1_; this.chunkZ = p_185932_2_; + this.rand.setSeed((long)p_185932_1_ * 341873128712L + (long)p_185932_2_ * 132897987541L); + ChunkPrimer chunkprimer = new ChunkPrimer(); + this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, p_185932_1_ * 16, p_185932_2_ * 16, 16, 16); +@@ -255,6 +270,10 @@ + + private double[] func_185963_a(double[] p_185963_1_, int p_185963_2_, int p_185963_3_, int p_185963_4_, int p_185963_5_, int p_185963_6_, int p_185963_7_) + { ++ net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField(this, p_185963_1_, p_185963_2_, p_185963_3_, p_185963_4_, p_185963_5_, p_185963_6_, p_185963_7_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; ++ + if (p_185963_1_ == null) + { + p_185963_1_ = new double[p_185963_5_ * p_185963_6_ * p_185963_7_]; +@@ -327,6 +346,7 @@ + public void func_185931_b(int p_185931_1_, int p_185931_2_) + { + BlockFalling.fallInstantly = true; ++ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.worldObj, p_185931_1_, p_185931_2_, false); + BlockPos blockpos = new BlockPos(p_185931_1_ * 16, 0, p_185931_2_ * 16); + + if (this.mapFeaturesEnabled) +@@ -374,6 +394,7 @@ + } + } + ++ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.worldObj, p_185931_1_, p_185931_2_, false); + BlockFalling.fallInstantly = false; + } + diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch new file mode 100644 index 0000000000..b0983b7e30 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch @@ -0,0 +1,104 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderHell.java ++++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderHell.java +@@ -76,6 +76,19 @@ + this.field_185946_g = new NoiseGeneratorOctaves(this.field_185954_p, 10); + this.field_185947_h = new NoiseGeneratorOctaves(this.field_185954_p, 16); + worldIn.setSeaLevel(63); ++ ++ net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextHell ctx = ++ new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextHell(field_185957_u, field_185958_v, field_185959_w, slowsandGravelNoiseGen, netherrackExculsivityNoiseGen, field_185946_g, field_185947_h); ++ ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.field_185954_p, ctx); ++ this.field_185957_u = ctx.getLPerlin1(); ++ this.field_185958_v = ctx.getLPerlin2(); ++ this.field_185959_w = ctx.getPerlin(); ++ this.slowsandGravelNoiseGen = ctx.getPerlin2(); ++ this.netherrackExculsivityNoiseGen = ctx.getPerlin3(); ++ this.field_185946_g = ctx.getScale(); ++ this.field_185947_h = ctx.getDepth(); ++ this.genNetherBridge = (MapGenNetherBridge)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(genNetherBridge, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_BRIDGE); ++ this.field_185939_I = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_185939_I, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_CAVE); + } + + public void func_185936_a(int p_185936_1_, int p_185936_2_, ChunkPrimer p_185936_3_) +@@ -154,6 +167,7 @@ + + public void func_185937_b(int p_185937_1_, int p_185937_2_, ChunkPrimer p_185937_3_) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, p_185937_1_, p_185937_2_, p_185937_3_, this.field_185952_n)) return; + int i = this.field_185952_n.getSeaLevel() + 1; + double d0 = 0.03125D; + this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, p_185937_1_ * 16, p_185937_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); +@@ -276,6 +290,10 @@ + p_185938_1_ = new double[p_185938_5_ * p_185938_6_ * p_185938_7_]; + } + ++ net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField(this, p_185938_1_, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, p_185938_6_, p_185938_7_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; ++ + double d0 = 684.412D; + double d1 = 2053.236D; + this.noiseData4 = this.field_185946_g.generateNoiseOctaves(this.noiseData4, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, 1, p_185938_7_, 1.0D, 0.0D, 1.0D); +@@ -357,20 +375,25 @@ + public void func_185931_b(int p_185931_1_, int p_185931_2_) + { + BlockFalling.fallInstantly = true; ++ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.field_185952_n, p_185931_1_, p_185931_2_, false); + BlockPos blockpos = new BlockPos(p_185931_1_ * 16, 0, p_185931_2_ * 16); + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_185931_1_, p_185931_2_); + this.genNetherBridge.generateStructure(this.field_185952_n, this.field_185954_p, chunkcoordintpair); + ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA)) + for (int i = 0; i < 8; ++i) + { + this.field_177472_y.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(120) + 4, this.field_185954_p.nextInt(16) + 8)); + } + ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.FIRE)) + for (int j = 0; j < this.field_185954_p.nextInt(this.field_185954_p.nextInt(10) + 1) + 1; ++j) + { + this.field_177470_t.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(120) + 4, this.field_185954_p.nextInt(16) + 8)); + } + ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.GLOWSTONE)) ++ { + for (int k = 0; k < this.field_185954_p.nextInt(this.field_185954_p.nextInt(10) + 1); ++k) + { + this.field_177469_u.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(120) + 4, this.field_185954_p.nextInt(16) + 8)); +@@ -380,7 +403,13 @@ + { + this.field_177468_v.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(128), this.field_185954_p.nextInt(16) + 8)); + } ++ }//Forge: End doGLowstone + ++ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.field_185952_n, p_185931_1_, p_185931_2_, false); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(this.field_185952_n, this.field_185954_p, blockpos)); ++ ++ if (net.minecraftforge.event.terraingen.TerrainGen.decorate(this.field_185952_n, this.field_185954_p, blockpos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM)) ++ { + if (this.field_185954_p.nextBoolean()) + { + this.field_177471_z.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(128), this.field_185954_p.nextInt(16) + 8)); +@@ -390,17 +419,22 @@ + { + this.field_177465_A.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(128), this.field_185954_p.nextInt(16) + 8)); + } ++ } + ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(this.field_185952_n, this.field_185954_p, field_177467_w, blockpos, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.QUARTZ)) + for (int i1 = 0; i1 < 16; ++i1) + { + this.field_177467_w.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16), this.field_185954_p.nextInt(108) + 10, this.field_185954_p.nextInt(16))); + } + ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA2)) + for (int j1 = 0; j1 < 16; ++j1) + { + this.field_177473_x.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16), this.field_185954_p.nextInt(108) + 10, this.field_185954_p.nextInt(16))); + } + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post(this.field_185952_n, this.field_185954_p, blockpos)); ++ + BlockFalling.fallInstantly = false; + } + diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java.patch new file mode 100644 index 0000000000..a7478f3216 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java.patch @@ -0,0 +1,101 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java ++++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java +@@ -59,6 +59,15 @@ + + public ChunkProviderOverworld(World p_i46668_1_, long p_i46668_2_, boolean p_i46668_4_, String p_i46668_5_) + { ++ { ++ field_186003_v = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186003_v, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE); ++ field_186004_w = (MapGenStronghold)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186004_w, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD); ++ field_186005_x = (MapGenVillage)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186005_x, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE); ++ field_186006_y = (MapGenMineshaft)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186006_y, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT); ++ field_186007_z = (MapGenScatteredFeature)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186007_z, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE); ++ field_185979_A = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_185979_A, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE); ++ field_185980_B = (StructureOceanMonument)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_185980_B, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.OCEAN_MONUMENT); ++ } + this.field_185995_n = p_i46668_1_; + this.field_185996_o = p_i46668_4_; + this.field_185997_p = p_i46668_1_.getWorldInfo().getTerrainType(); +@@ -88,6 +97,17 @@ + this.field_186001_t = this.field_186000_s.useLavaOceans ? Blocks.lava.getDefaultState() : Blocks.water.getDefaultState(); + p_i46668_1_.setSeaLevel(this.field_186000_s.seaLevel); + } ++ ++ net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextOverworld ctx = ++ new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextOverworld(field_185991_j, field_185992_k, field_185993_l, field_185994_m, field_185983_b, field_185984_c, field_185985_d); ++ ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i46668_1_, this.field_185990_i, ctx); ++ this.field_185991_j = ctx.getLPerlin1(); ++ this.field_185992_k = ctx.getLPerlin2(); ++ this.field_185993_l = ctx.getPerlin(); ++ this.field_185994_m = ctx.getHeight(); ++ this.field_185983_b = ctx.getScale(); ++ this.field_185984_c = ctx.getDepth(); ++ this.field_185985_d = ctx.getForest(); + } + + public void func_185976_a(int p_185976_1_, int p_185976_2_, ChunkPrimer p_185976_3_) +@@ -161,6 +181,7 @@ + + public void func_185977_a(int p_185977_1_, int p_185977_2_, ChunkPrimer p_185977_3_, BiomeGenBase[] p_185977_4_) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, p_185977_1_, p_185977_2_, p_185977_3_, this.field_185995_n)) return; + double d0 = 0.03125D; + this.field_186002_u = this.field_185994_m.func_151599_a(this.field_186002_u, (double)(p_185977_1_ * 16), (double)(p_185977_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); + +@@ -365,6 +386,8 @@ + boolean flag = false; + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_185931_1_, p_185931_2_); + ++ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.field_185995_n, p_185931_1_, p_185931_2_, flag); ++ + if (this.field_185996_o) + { + if (this.field_186000_s.useMineShafts) +@@ -394,6 +417,7 @@ + } + + if (biomegenbase != Biomes.desert && biomegenbase != Biomes.desertHills && this.field_186000_s.useWaterLakes && !flag && this.field_185990_i.nextInt(this.field_186000_s.waterLakeChance) == 0) ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) + { + int i1 = this.field_185990_i.nextInt(16) + 8; + int j1 = this.field_185990_i.nextInt(256); +@@ -402,6 +426,7 @@ + } + + if (!flag && this.field_185990_i.nextInt(this.field_186000_s.lavaLakeChance / 10) == 0 && this.field_186000_s.useLavaLakes) ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA)) + { + int i2 = this.field_185990_i.nextInt(16) + 8; + int l2 = this.field_185990_i.nextInt(this.field_185990_i.nextInt(248) + 8); +@@ -414,6 +439,7 @@ + } + + if (this.field_186000_s.useDungeons) ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON)) + { + for (int j2 = 0; j2 < this.field_186000_s.dungeonChance; ++j2) + { +@@ -425,9 +451,12 @@ + } + + biomegenbase.decorate(this.field_185995_n, this.field_185990_i, new BlockPos(i, 0, j)); ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS)) + WorldEntitySpawner.performWorldGenSpawning(this.field_185995_n, biomegenbase, i + 8, j + 8, 16, 16, this.field_185990_i); + blockpos = blockpos.add(8, 0, 8); + ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE)) ++ { + for (int k2 = 0; k2 < 16; ++k2) + { + for (int j3 = 0; j3 < 16; ++j3) +@@ -446,7 +475,10 @@ + } + } + } ++ }//Forge: End ICE + ++ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.field_185995_n, p_185931_1_, p_185931_2_, flag); ++ + BlockFalling.fallInstantly = false; + } + diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch index 3899f6d81e..fe5a8cf44e 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch @@ -8,7 +8,74 @@ public ChunkProviderServer(WorldServer p_i46838_1_, IChunkLoader p_i46838_2_, IChunkGenerator p_i46838_3_) { -@@ -118,6 +119,7 @@ +@@ -92,14 +93,65 @@ + + public Chunk func_186025_d(int p_186025_1_, int p_186025_2_) + { ++ return loadChunk(p_186025_1_, p_186025_2_, null); ++ } ++ ++ public Chunk loadChunk(int X, int Z, Runnable runnable) ++ { ++ long pos = ChunkCoordIntPair.chunkXZ2Int(X, Z); ++ this.droppedChunksSet.remove(Long.valueOf(pos)); ++ Chunk chunk = this.id2ChunkMap.getValueByKey(pos); ++ net.minecraft.world.chunk.storage.AnvilChunkLoader loader = null; ++ ++ if (this.chunkLoader instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader) ++ { ++ loader = (net.minecraft.world.chunk.storage.AnvilChunkLoader) this.chunkLoader; ++ } ++ ++ // We can only use the queue for already generated chunks ++ if (chunk == null && loader != null && loader.chunkExists(this.worldObj, X, Z)) ++ { ++ if (runnable != null) ++ { ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.queueChunkLoad(this.worldObj, loader, this, X, Z, runnable); ++ return null; ++ } ++ else ++ { ++ chunk = net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(this.worldObj, loader, this, X, Z); ++ } ++ } ++ else if (chunk == null) ++ { ++ chunk = this.originalLoadChunk(X, Z); ++ } ++ ++ // If we didn't load the chunk async and have a callback run it now ++ if (runnable != null) ++ { ++ runnable.run(); ++ } ++ ++ return chunk; ++ } ++ ++ public Chunk originalLoadChunk(int p_186025_1_, int p_186025_2_) ++ { + Chunk chunk = this.func_186028_c(p_186025_1_, p_186025_2_); + + if (chunk == null) + { + long i = ChunkCoordIntPair.chunkXZ2Int(p_186025_1_, p_186025_2_); +- chunk = this.loadChunkFromFile(p_186025_1_, p_186025_2_); ++ if (!loadingChunks.add(i)) ++ { ++ net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in di >mension %d that is already being loaded. This will cause weird chunk breakages.", p_186025_1_, p_186025_2_, worldObj.provider.getDimension()); ++ } ++ chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(i, this.worldObj); + + if (chunk == null) ++ chunk = this.loadChunkFromFile(p_186025_1_, p_186025_2_); ++ ++ if (chunk == null) + { + try + { +@@ -118,6 +170,7 @@ this.id2ChunkMap.add(i, chunk); this.loadedChunks.add(chunk); @@ -16,7 +83,7 @@ chunk.onChunkLoad(); chunk.func_186030_a(this, this.field_186029_c); } -@@ -214,6 +216,11 @@ +@@ -214,6 +267,11 @@ { if (!this.worldObj.disableLevelSaving) { @@ -28,14 +95,14 @@ for (int i = 0; i < 100; ++i) { if (!this.droppedChunksSet.isEmpty()) -@@ -228,6 +235,12 @@ +@@ -228,6 +286,12 @@ this.saveChunkExtraData(chunk); this.id2ChunkMap.remove(olong.longValue()); this.loadedChunks.remove(chunk); + net.minecraftforge.common.ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.chunkXZ2Int(chunk.xPosition, chunk.zPosition), chunk); -+ if(loadedChunks.size() == 0 && net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this.worldObj).size() == 0 && !net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimensionId())){ -+ net.minecraftforge.common.DimensionManager.unloadWorld(this.worldObj.provider.getDimensionId()); -+ return serverChunkGenerator.unloadQueuedChunks(); ++ if(loadedChunks.size() == 0 && net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this.worldObj).size() == 0 && !net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimension())){ ++ net.minecraftforge.common.DimensionManager.unloadWorld(this.worldObj.provider.getDimension()); ++ return false; + } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch index 432cee4847..7d067708c7 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch @@ -1,15 +1,53 @@ --- ../src-base/minecraft/net/minecraft/world/gen/MapGenCaves.java +++ ../src-work/minecraft/net/minecraft/world/gen/MapGenCaves.java -@@ -143,7 +143,7 @@ +@@ -141,9 +141,7 @@ + { + if (l1 >= 0 && l1 < 256) { - IBlockState iblockstate = p_180702_5_.getBlockState(j1, l1, k1); - +- IBlockState iblockstate = p_180702_5_.getBlockState(j1, l1, k1); +- - if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) + if (isOceanBlock(p_180702_5_, j1, l1, k1, p_180702_3_, p_180702_4_)) { flag3 = true; } -@@ -266,4 +266,71 @@ +@@ -181,33 +179,12 @@ + IBlockState iblockstate1 = p_180702_5_.getBlockState(j3, j2, i2); + IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.getBlockState(j3, j2 + 1, i2), field_186127_b); + +- if (iblockstate1.getBlock() == Blocks.grass || iblockstate1.getBlock() == Blocks.mycelium) ++ if (isTopBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_)) + { + flag1 = true; + } + +- if (this.func_175793_a(iblockstate1, iblockstate2)) +- { +- if (j2 - 1 < 10) +- { +- p_180702_5_.setBlockState(j3, j2, i2, field_186126_a); +- } +- else +- { +- p_180702_5_.setBlockState(j3, j2, i2, field_186127_b); +- +- if (iblockstate2.getBlock() == Blocks.sand) +- { +- p_180702_5_.setBlockState(j3, j2 + 1, i2, iblockstate2.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? field_186129_d : field_186128_c); +- } +- +- if (flag1 && p_180702_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) +- { +- blockpos$mutableblockpos.set(j3 + p_180702_3_ * 16, 0, i2 + p_180702_4_ * 16); +- p_180702_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock.getBlock().getDefaultState()); +- } +- } +- } ++ digBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2); + } + } + } +@@ -266,4 +243,71 @@ } } } @@ -23,8 +61,8 @@ + //Exception biomes to make sure we generate like vanilla + private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) + { -+ if (biome == net.minecraft.world.biome.BiomeGenBase.beach) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.desert) return true; ++ if (biome == net.minecraft.init.Biomes.beach) return true; ++ if (biome == net.minecraft.init.Biomes.desert) return true; + return false; + } + @@ -60,17 +98,17 @@ + + if (this.func_175793_a(state, up) || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) + { -+ if (y < 10) ++ if (y - 1 < 10) + { -+ data.setBlockState(x, y, z, Blocks.lava.getDefaultState()); ++ data.setBlockState(x, y, z, field_186126_a); + } + else + { -+ data.setBlockState(x, y, z, Blocks.air.getDefaultState()); ++ data.setBlockState(x, y, z, field_186127_b); + + if (up.getBlock() == Blocks.sand) + { -+ data.setBlockState(x, y + 1, z, up.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState()); ++ data.setBlockState(x, y + 1, z, up.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? field_186129_d : field_186128_c); + } + + if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch index 030975e7fe..ce7bbd4f67 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch @@ -1,15 +1,59 @@ --- ../src-base/minecraft/net/minecraft/world/gen/MapGenRavine.java +++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java -@@ -130,7 +130,7 @@ +@@ -128,9 +128,7 @@ + { + if (l1 >= 0 && l1 < 256) { - IBlockState iblockstate = p_180707_5_.getBlockState(j1, l1, k1); - +- IBlockState iblockstate = p_180707_5_.getBlockState(j1, l1, k1); +- - if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) + if (isOceanBlock(p_180707_5_, j1, l1, k1, p_180707_3_, p_180707_4_)) { flag2 = true; } -@@ -223,4 +223,68 @@ +@@ -146,8 +144,6 @@ + + if (!flag2) + { +- BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); +- + for (int j3 = k2; j3 < k; ++j3) + { + double d10 = ((double)(j3 + p_180707_3_ * 16) + 0.5D - p_180707_6_) / d9; +@@ -165,30 +161,12 @@ + + if ((d10 * d10 + d7 * d7) * (double)this.field_75046_d[j2 - 1] + d8 * d8 / 6.0D < 1.0D) + { +- IBlockState iblockstate1 = p_180707_5_.getBlockState(j3, j2, i2); +- +- if (iblockstate1.getBlock() == Blocks.grass) ++ if (isTopBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_)) + { + flag = true; + } + +- if (iblockstate1.getBlock() == Blocks.stone || iblockstate1.getBlock() == Blocks.dirt || iblockstate1.getBlock() == Blocks.grass) +- { +- if (j2 - 1 < 10) +- { +- p_180707_5_.setBlockState(j3, j2, i2, field_186135_a); +- } +- else +- { +- p_180707_5_.setBlockState(j3, j2, i2, field_186136_b); +- +- if (flag && p_180707_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) +- { +- blockpos$mutableblockpos.set(j3 + p_180707_3_ * 16, 0, i2 + p_180707_4_ * 16); +- p_180707_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock); +- } +- } +- } ++ digBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_, flag); + } + } + } +@@ -223,4 +201,68 @@ } } } @@ -22,10 +66,10 @@ + //Exception biomes to make sure we generate like vanilla + private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) + { -+ if (biome == net.minecraft.world.biome.BiomeGenBase.beach) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.desert) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.mushroomIsland) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.mushroomIslandShore) return true; ++ if (biome == net.minecraft.init.Biomes.beach) return true; ++ if (biome == net.minecraft.init.Biomes.desert) return true; ++ if (biome == net.minecraft.init.Biomes.mushroomIsland) return true; ++ if (biome == net.minecraft.init.Biomes.mushroomIslandShore) return true; + return false; + } + @@ -62,13 +106,13 @@ + + if (state.getBlock() == Blocks.stone || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) + { -+ if (y < 10) ++ if (y - 1 < 10) + { -+ data.setBlockState(x, y, z, Blocks.lava.getDefaultState()); ++ data.setBlockState(x, y, z, field_186135_a); + } + else + { -+ data.setBlockState(x, y, z, Blocks.air.getDefaultState()); ++ data.setBlockState(x, y, z, field_186136_b); + + if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) + { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch index 8bd908b08a..2538914b03 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch @@ -16,7 +16,17 @@ GenLayer genlayerhills = new GenLayerHills(1000L, genlayerbiomeedge, lvt_10_1_); GenLayer genlayer5 = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); genlayer5 = GenLayerZoom.magnify(1000L, genlayer5, j); -@@ -171,4 +171,27 @@ +@@ -158,8 +158,7 @@ + + protected static boolean isBiomeOceanic(int p_151618_0_) + { +- BiomeGenBase biomegenbase = BiomeGenBase.getBiome(p_151618_0_); +- return biomegenbase == Biomes.ocean || biomegenbase == Biomes.deepOcean || biomegenbase == Biomes.frozenOcean; ++ return net.minecraftforge.common.BiomeManager.oceanBiomes.contains(BiomeGenBase.getBiome(p_151618_0_)); + } + + protected int selectRandom(int... p_151619_1_) +@@ -171,4 +170,27 @@ { 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_})))))))))); } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch index 91c084e9cf..adc74b8ea2 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch @@ -1,6 +1,84 @@ --- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java +++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java -@@ -112,4 +112,12 @@ +@@ -7,10 +7,8 @@ + + public class GenLayerBiome extends GenLayer + { +- private BiomeGenBase[] field_151623_c = new BiomeGenBase[] {Biomes.desert, Biomes.desert, Biomes.desert, Biomes.savanna, Biomes.savanna, Biomes.plains}; +- private BiomeGenBase[] field_151621_d = new BiomeGenBase[] {Biomes.forest, Biomes.roofedForest, Biomes.extremeHills, Biomes.plains, Biomes.birchForest, Biomes.swampland}; +- private BiomeGenBase[] field_151622_e = new BiomeGenBase[] {Biomes.forest, Biomes.extremeHills, Biomes.taiga, Biomes.plains}; +- private BiomeGenBase[] field_151620_f = new BiomeGenBase[] {Biomes.icePlains, Biomes.icePlains, Biomes.icePlains, Biomes.coldTaiga}; ++ @SuppressWarnings("unchecked") ++ private java.util.List[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length]; + private final ChunkProviderSettings field_175973_g; + + public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_) +@@ -18,9 +16,30 @@ + super(p_i45560_1_); + this.parent = p_i45560_3_; + ++ for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values()) ++ { ++ com.google.common.collect.ImmutableList biomesToAdd = net.minecraftforge.common.BiomeManager.getBiomes(type); ++ int idx = type.ordinal(); ++ ++ if (biomes[idx] == null) biomes[idx] = new java.util.ArrayList(); ++ if (biomesToAdd != null) biomes[idx].addAll(biomesToAdd); ++ } ++ ++ int desertIdx = net.minecraftforge.common.BiomeManager.BiomeType.DESERT.ordinal(); ++ ++ 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) + { +- this.field_151623_c = new BiomeGenBase[] {Biomes.desert, Biomes.forest, Biomes.extremeHills, Biomes.swampland, Biomes.plains, Biomes.taiga}; ++ biomes[desertIdx].clear(); ++ 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.extremeHills, 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) +@@ -74,7 +93,7 @@ + } + else + { +- aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(this.field_151623_c[this.nextInt(this.field_151623_c.length)]); ++ aint1[k + i * areaWidth] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome); + } + } + else if (k == 2) +@@ -85,7 +104,7 @@ + } + else + { +- aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(this.field_151621_d[this.nextInt(this.field_151621_d.length)]); ++ aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM).biome); + } + } + else if (k == 3) +@@ -96,12 +115,12 @@ + } + else + { +- aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(this.field_151622_e[this.nextInt(this.field_151622_e.length)]); ++ aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL).biome); + } + } + else if (k == 4) + { +- aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(this.field_151620_f[this.nextInt(this.field_151620_f.length)]); ++ aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY).biome); + } + else + { +@@ -112,4 +131,12 @@ return aint1; } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch index 1bcaeb316e..713c9cc049 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch @@ -1,29 +1,35 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java -@@ -57,6 +57,12 @@ - { - } - -+ static -+ { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, itemsToGenerateInTemple, 2, 7); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); -+ } -+ - public DesertPyramid(Random p_i2062_1_, int p_i2062_2_, int p_i2062_3_) - { - super(p_i2062_1_, p_i2062_2_, 64, p_i2062_3_, 21, 15, 21); -@@ -451,6 +457,13 @@ +@@ -451,6 +451,11 @@ private static final List field_175815_j = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.arrow, 0, 2, 7, 30)}); private static ComponentScatteredFeaturePieces.JunglePyramid.Stones junglePyramidsRandomScatteredStones = new ComponentScatteredFeaturePieces.JunglePyramid.Stones(); + static + { + net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_DISPENSER, field_175815_j, 2, 2); -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST, field_175816_i, 2, 7); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); + } + public JunglePyramid() { } +@@ -607,9 +612,10 @@ + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 4, -3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 3, -3, 1, structureBoundingBoxIn); + ++ net.minecraftforge.common.ChestGenHooks dispenser = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_DISPENSER); + if (!this.field_74945_j) + { +- this.field_74945_j = this.func_186166_a(worldIn, structureBoundingBoxIn, randomIn, 3, -2, 1, EnumFacing.NORTH, field_175815_j, 2); ++ this.field_74945_j = this.func_186166_a(worldIn, structureBoundingBoxIn, randomIn, 3, -2, 1, EnumFacing.NORTH, dispenser.getItems(randomIn), dispenser.getCount(randomIn)); + } + + this.setBlockState(worldIn, Blocks.vine.getDefaultState().withProperty(BlockVine.SOUTH, Boolean.valueOf(true)), 3, -2, 2, structureBoundingBoxIn); +@@ -626,7 +632,7 @@ + + if (!this.field_74946_k) + { +- this.field_74946_k = this.func_186166_a(worldIn, structureBoundingBoxIn, randomIn, 9, -2, 3, EnumFacing.WEST, field_175815_j, 2); ++ this.field_74946_k = this.func_186166_a(worldIn, structureBoundingBoxIn, randomIn, 9, -2, 3, EnumFacing.WEST, dispenser.getItems(randomIn), dispenser.getCount(randomIn)); + } + + this.setBlockState(worldIn, Blocks.vine.getDefaultState().withProperty(BlockVine.EAST, Boolean.valueOf(true)), 8, -1, 3, structureBoundingBoxIn); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch new file mode 100644 index 0000000000..81289f9368 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java +@@ -28,11 +28,19 @@ + + for (BiomeGenBase biomegenbase : BiomeGenBase.field_185377_q) + { +- if (biomegenbase != null && biomegenbase.func_185355_j() > 0.0F) ++ if (biomegenbase != null && biomegenbase.func_185355_j() > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) + { + this.field_151546_e.add(biomegenbase); + } + } ++ ++ for (BiomeGenBase biome : net.minecraftforge.common.BiomeManager.strongHoldBiomes) ++ { ++ if (!this.field_151546_e.contains(biome)) ++ { ++ this.field_151546_e.add(biome); ++ } ++ } + } + + public MapGenStronghold(Map p_i2068_1_) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch deleted file mode 100644 index b0dfd7a8c0..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java -@@ -31,6 +31,12 @@ - MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Stairs.class, "MSStairs"); - } - -+ static -+ { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR, CHEST_CONTENT_WEIGHT_LIST, 8, 8); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(net.minecraft.init.Items.enchanted_book, 1, 0), 1, 1, 1)); -+ } -+ - private static StructureComponent func_175892_a(List listIn, Random rand, int x, int y, int z, EnumFacing facing, int type) - { - int i = rand.nextInt(100); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch deleted file mode 100644 index 7ebeaa9a79..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java -@@ -244,6 +244,12 @@ - { - } - -+ static -+ { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, strongholdChestContents, 2, 4); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); -+ } -+ - public ChestCorridor(int p_i45582_1_, Random p_i45582_2_, StructureBoundingBox p_i45582_3_, EnumFacing p_i45582_4_) - { - super(p_i45582_1_); -@@ -599,6 +605,12 @@ - { - private boolean isLargeRoom; - -+ static -+ { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY, strongholdLibraryChestContents, 1, 5); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 5, 2)); -+ } -+ - public Library() - { - } -@@ -1025,6 +1037,12 @@ - { - protected int roomType; - -+ static -+ { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, strongholdRoomCrossingChestContents, 1, 5); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); -+ } -+ - public RoomCrossing() - { - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch index 8dc9017c25..e861158b70 100644 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch @@ -19,19 +19,7 @@ return structurevillagepieces$village; } -@@ -875,6 +880,11 @@ - { - } - -+ static -+ { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, villageBlacksmithChestContents, 3, 8); -+ } -+ - public House2(StructureVillagePieces.Start start, int p_i45563_2_, Random rand, StructureBoundingBox p_i45563_4_, EnumFacing facing) - { - super(start, p_i45563_2_); -@@ -1447,6 +1457,7 @@ +@@ -1447,6 +1452,7 @@ public List structureVillageWeightedPieceList; public List field_74932_i = Lists.newArrayList(); public List field_74930_j = Lists.newArrayList(); @@ -39,7 +27,15 @@ public Start() { -@@ -1520,6 +1531,7 @@ +@@ -1460,6 +1466,7 @@ + this.terrainType = p_i2104_7_; + BiomeGenBase biomegenbase = chunkManagerIn.getBiomeGenerator(new BlockPos(p_i2104_4_, 0, p_i2104_5_), Biomes.field_180279_ad); + this.inDesert = biomegenbase == Biomes.desert || biomegenbase == Biomes.desertHills; ++ this.biome = biomegenbase; + this.func_175846_a(this.inDesert); + } + +@@ -1520,6 +1527,7 @@ protected int field_143015_k = -1; private int villagersSpawned; private boolean isDesertVillage; @@ -47,7 +43,7 @@ public Village() { -@@ -1532,6 +1544,7 @@ +@@ -1532,6 +1540,7 @@ if (start != null) { this.isDesertVillage = start.inDesert; @@ -55,7 +51,7 @@ } } -@@ -1660,6 +1673,9 @@ +@@ -1660,6 +1669,9 @@ protected IBlockState func_175847_a(IBlockState p_175847_1_) { diff --git a/rejects/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch.rej deleted file mode 100644 index 650a6183f6..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch.rej +++ /dev/null @@ -1,60 +0,0 @@ -++++ REJECTED PATCH 1 - double[] noiseData3; - double[] noiseData4; - double[] noiseData5; -+ // temporary variables used during event handling -+ private int chunkX = 0; -+ private int chunkZ = 0; - - public ChunkProviderEnd(World worldIn, long p_i2007_2_) - { -++++ END PATCH -++++ REJECTED PATCH 2 - this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, 8); - this.noiseGen4 = new NoiseGeneratorOctaves(this.endRNG, 10); - this.noiseGen5 = new NoiseGeneratorOctaves(this.endRNG, 16); -+ -+ NoiseGenerator[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5}; -+ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.endRNG, noiseGens); -+ this.noiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.noiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.noiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.noiseGen4 = (NoiseGeneratorOctaves)noiseGens[3]; -+ this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; - } - - public void func_180520_a(int p_180520_1_, int p_180520_2_, ChunkPrimer p_180520_3_) -++++ END PATCH -++++ REJECTED PATCH 4 - - public Chunk provideChunk(int x, int z) - { -+ chunkX = x; chunkZ = z; - this.endRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L); - ChunkPrimer chunkprimer = new ChunkPrimer(); - this.biomesForGeneration = this.endWorld.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); -++++ END PATCH -++++ REJECTED PATCH 5 - - private double[] initializeNoiseField(double[] p_73187_1_, int p_73187_2_, int p_73187_3_, int p_73187_4_, int p_73187_5_, int p_73187_6_, int p_73187_7_) - { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField(this, p_73187_1_, p_73187_2_, p_73187_3_, p_73187_4_, p_73187_5_, p_73187_6_, p_73187_7_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; -+ - if (p_73187_1_ == null) - { - p_73187_1_ = new double[p_73187_5_ * p_73187_6_ * p_73187_7_]; -++++ END PATCH -++++ REJECTED PATCH 6 - public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) - { - BlockFalling.fallInstantly = true; -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, endWorld, endWorld.rand, p_73153_2_, p_73153_3_, false)); - BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); - this.endWorld.getBiomeGenForCoords(blockpos.add(16, 0, 16)).decorate(this.endWorld, this.endWorld.rand, blockpos); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, endWorld, endWorld.rand, p_73153_2_, p_73153_3_, false)); - BlockFalling.fallInstantly = false; - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch.rej deleted file mode 100644 index c97f247612..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch.rej +++ /dev/null @@ -1,117 +0,0 @@ -++++ REJECTED PATCH 1 - - public ChunkProviderGenerate(World worldIn, long p_i45636_2_, boolean p_i45636_4_, String p_i45636_5_) - { -+ { -+ caveGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(caveGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE); -+ strongholdGenerator = (MapGenStronghold)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(strongholdGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD); -+ villageGenerator = (MapGenVillage)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(villageGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE); -+ mineshaftGenerator = (MapGenMineshaft)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(mineshaftGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT); -+ scatteredFeatureGenerator = (MapGenScatteredFeature)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(scatteredFeatureGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE); -+ ravineGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(ravineGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE); -+ oceanMonumentGenerator = (StructureOceanMonument)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(oceanMonumentGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.OCEAN_MONUMENT); -+ } - this.worldObj = worldIn; - this.mapFeaturesEnabled = p_i45636_4_; - this.field_177475_o = worldIn.getWorldInfo().getTerrainType(); -++++ END PATCH -++++ REJECTED PATCH 2 - this.field_177476_s = this.settings.useLavaOceans ? Blocks.lava : Blocks.water; - worldIn.setSeaLevel(this.settings.seaLevel); - } -+ -+ NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, noiseGen5, noiseGen6, mobSpawnerNoise}; -+ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.rand, noiseGens); -+ this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.field_147430_m = (NoiseGeneratorPerlin)noiseGens[3]; -+ this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; -+ this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; -+ this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6]; - } - - public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) -++++ END PATCH -++++ REJECTED PATCH 3 - - public void replaceBlocksForBiome(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) - { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.worldObj); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; -+ - double d0 = 0.03125D; - this.stoneNoise = this.field_147430_m.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); - -++++ END PATCH -++++ REJECTED PATCH 4 - boolean flag = false; - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); -+ - if (this.settings.useMineShafts && this.mapFeaturesEnabled) - { - this.mineshaftGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair); -++++ END PATCH -++++ REJECTED PATCH 5 - this.oceanMonumentGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair); - } - -- if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0) -+ if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0 -+ && net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) - { - int i1 = this.rand.nextInt(16) + 8; - int j1 = this.rand.nextInt(256); -++++ END PATCH -++++ REJECTED PATCH 6 - (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, blockpos.add(i1, j1, k1)); - } - -- if (!flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes) -+ if (!flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes && -+ net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA)) - { - int i2 = this.rand.nextInt(16) + 8; - int l2 = this.rand.nextInt(this.rand.nextInt(248) + 8); -++++ END PATCH -++++ REJECTED PATCH 7 - - if (this.settings.useDungeons) - { -- for (int j2 = 0; j2 < this.settings.dungeonChance; ++j2) -+ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON); -+ for (int j2 = 0; doGen && j2 < this.settings.dungeonChance; ++j2) - { - int i3 = this.rand.nextInt(16) + 8; - int l3 = this.rand.nextInt(256); -++++ END PATCH -++++ REJECTED PATCH 8 - } - - biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(i, 0, j)); -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS)) -+ { - SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, i + 8, j + 8, 16, 16, this.rand); -+ } - blockpos = blockpos.add(8, 0, 8); - -- for (int k2 = 0; k2 < 16; ++k2) -+ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE); -+ for (int k2 = 0; doGen && k2 < 16; ++k2) - { - for (int j3 = 0; j3 < 16; ++j3) - { -++++ END PATCH -++++ REJECTED PATCH 9 - } - } - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); -+ - BlockFalling.fallInstantly = false; - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch.rej deleted file mode 100644 index 5eac183f2a..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch.rej +++ /dev/null @@ -1,144 +0,0 @@ -++++ REJECTED PATCH 1 - private final WorldGenHellLava field_177472_y = new WorldGenHellLava(Blocks.flowing_lava, false); - private final GeneratorBushFeature field_177471_z = new GeneratorBushFeature(Blocks.brown_mushroom); - private final GeneratorBushFeature field_177465_A = new GeneratorBushFeature(Blocks.red_mushroom); -- private final MapGenNetherBridge genNetherBridge = new MapGenNetherBridge(); -- private final MapGenBase netherCaveGenerator = new MapGenCavesHell(); -+ private final MapGenNetherBridge genNetherBridge; -+ private final MapGenBase netherCaveGenerator; - double[] noiseData1; - double[] noiseData2; - double[] noiseData3; -++++ END PATCH -++++ REJECTED PATCH 2 - - public ChunkProviderHell(World worldIn, boolean p_i45637_2_, long p_i45637_3_) - { -+ this.genNetherBridge = (MapGenNetherBridge) net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(new MapGenNetherBridge(), net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_BRIDGE); -+ this.netherCaveGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(new MapGenCavesHell(), net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_CAVE); - this.worldObj = worldIn; - this.field_177466_i = p_i45637_2_; - this.hellRNG = new Random(p_i45637_3_); -- this.netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); -- this.netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); -- this.netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); -- this.slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); -- this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); -- this.netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); -- this.netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); -+ NoiseGeneratorOctaves netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); -+ NoiseGeneratorOctaves netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); -+ NoiseGeneratorOctaves netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); -+ NoiseGeneratorOctaves slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); -+ NoiseGeneratorOctaves netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); -+ NoiseGeneratorOctaves netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); -+ NoiseGeneratorOctaves netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); -+ NoiseGenerator[] noiseGens = new NoiseGenerator[] { -+ netherNoiseGen1, netherNoiseGen2, netherNoiseGen3, slowsandGravelNoiseGen, netherrackExculsivityNoiseGen, netherNoiseGen6, netherNoiseGen7 -+ }; -+ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.hellRNG, noiseGens); -+ this.netherNoiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.netherNoiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.netherNoiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.slowsandGravelNoiseGen = (NoiseGeneratorOctaves)noiseGens[3]; -+ this.netherrackExculsivityNoiseGen = (NoiseGeneratorOctaves)noiseGens[4]; -+ this.netherNoiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; -+ this.netherNoiseGen7 = (NoiseGeneratorOctaves)noiseGens[6]; - worldIn.setSeaLevel(63); - } - -++++ END PATCH -++++ REJECTED PATCH 3 - - public void func_180516_b(int p_180516_1_, int p_180516_2_, ChunkPrimer p_180516_3_) - { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180516_1_, p_180516_2_, p_180516_3_, this.worldObj); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; -+ - int i = this.worldObj.getSeaLevel() + 1; - double d0 = 0.03125D; - this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, p_180516_1_ * 16, p_180516_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); -++++ END PATCH -++++ REJECTED PATCH 4 - - private double[] initializeNoiseField(double[] p_73164_1_, int p_73164_2_, int p_73164_3_, int p_73164_4_, int p_73164_5_, int p_73164_6_, int p_73164_7_) - { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField(this, p_73164_1_, p_73164_2_, p_73164_3_, p_73164_4_, p_73164_5_, p_73164_6_, p_73164_7_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; -+ - if (p_73164_1_ == null) - { - p_73164_1_ = new double[p_73164_5_ * p_73164_6_ * p_73164_7_]; -++++ END PATCH -++++ REJECTED PATCH 5 - public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) - { - BlockFalling.fallInstantly = true; -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false)); - BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); - this.genNetherBridge.generateStructure(this.worldObj, this.hellRNG, chunkcoordintpair); - -- for (int i = 0; i < 8; ++i) -+ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA); -+ for (int i = 0; doGen && i < 8; ++i) - { - this.field_177472_y.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); - } - -- for (int j = 0; j < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++j) -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.FIRE); -+ for (int j = 0; doGen && j < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++j) - { - this.field_177470_t.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); - } - -- for (int k = 0; k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.GLOWSTONE); -+ for (int k = 0; doGen && k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) - { - this.field_177469_u.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); - } - -- for (int l = 0; l < 10; ++l) -+ for (int l = 0; doGen && l < 10; ++l) - { - this.field_177468_v.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); - } - -- if (this.hellRNG.nextBoolean()) -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(worldObj, hellRNG, blockpos)); -+ -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.decorate(worldObj, hellRNG, blockpos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM); -+ if (doGen && this.hellRNG.nextBoolean()) - { - this.field_177471_z.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); - } - -- if (this.hellRNG.nextBoolean()) -+ if (doGen && this.hellRNG.nextBoolean()) - { - this.field_177465_A.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); - } - -- for (int i1 = 0; i1 < 16; ++i1) -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.generateOre(worldObj, hellRNG, field_177467_w, blockpos, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.QUARTZ); -+ for (int i1 = 0; doGen && i1 < 16; ++i1) - { - this.field_177467_w.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); - } - -- for (int j1 = 0; j1 < 16; ++j1) -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA2); -+ for (int j1 = 0; doGen && j1 < 16; ++j1) - { - this.field_177473_x.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); - } - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false)); - BlockFalling.fallInstantly = false; - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch.rej deleted file mode 100644 index e4824e612c..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch.rej +++ /dev/null @@ -1,85 +0,0 @@ -++++ REJECTED PATCH 2 - - public void dropChunk(int x, int z) - { -- if (this.worldObj.provider.canRespawnHere()) -+ if (this.worldObj.provider.canRespawnHere() && net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimensionId())) - { - if (!this.worldObj.isSpawnChunk(x, z)) - { -++++ END PATCH -++++ REJECTED PATCH 3 - - public Chunk loadChunk(int p_73158_1_, int p_73158_2_) - { -+ return loadChunk(p_73158_1_, p_73158_2_, null); -+ } -+ -+ public Chunk loadChunk(int par1, int par2, Runnable runnable) -+ { -+ long k = ChunkCoordIntPair.chunkXZ2Int(par1, par2); -+ this.droppedChunksSet.remove(Long.valueOf(k)); -+ Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(k); -+ net.minecraft.world.chunk.storage.AnvilChunkLoader loader = null; -+ -+ if (this.chunkLoader instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader) -+ { -+ loader = (net.minecraft.world.chunk.storage.AnvilChunkLoader) this.chunkLoader; -+ } -+ -+ // We can only use the queue for already generated chunks -+ if (chunk == null && loader != null && loader.chunkExists(this.worldObj, par1, par2)) -+ { -+ if (runnable != null) -+ { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.queueChunkLoad(this.worldObj, loader, this, par1, par2, runnable); -+ return null; -+ } -+ else -+ { -+ chunk = net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(this.worldObj, loader, this, par1, par2); -+ } -+ } -+ else if (chunk == null) -+ { -+ chunk = this.originalLoadChunk(par1, par2); -+ } -+ -+ // If we didn't load the chunk async and have a callback run it now -+ if (runnable != null) -+ { -+ runnable.run(); -+ } -+ -+ return chunk; -+ } -+ -+ public Chunk originalLoadChunk(int p_73158_1_, int p_73158_2_) -+ { - long i = ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_); - this.droppedChunksSet.remove(Long.valueOf(i)); - Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(i); - - if (chunk == null) - { -+ boolean added = loadingChunks.add(i); -+ if (!added) -+ { -+ net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in di >mension %d that is already being loaded. This will cause weird chunk breakages.", p_73158_1_, p_73158_2_, worldObj.provider.getDimensionId()); -+ } -+ chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(i, this.worldObj); -+ -+ if (chunk == null) - chunk = this.loadChunkFromFile(p_73158_1_, p_73158_2_); - - if (chunk == null) -++++ END PATCH -++++ REJECTED PATCH 5 - if (this.serverChunkGenerator != null) - { - this.serverChunkGenerator.populate(p_73153_1_, p_73153_2_, p_73153_3_); -+ net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(p_73153_2_, p_73153_3_, worldObj, serverChunkGenerator, p_73153_1_); - chunk.setChunkModified(); - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch.rej deleted file mode 100644 index 5fce173028..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch.rej +++ /dev/null @@ -1,37 +0,0 @@ -++++ REJECTED PATCH 2 - IBlockState iblockstate1 = p_180702_5_.getBlockState(j3, j2, i2); - IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.getBlockState(j3, j2 + 1, i2), Blocks.air.getDefaultState()); - -- if (iblockstate1.getBlock() == Blocks.grass || iblockstate1.getBlock() == Blocks.mycelium) -+ if (isTopBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_)) - { - flag1 = true; - } - -- if (this.func_175793_a(iblockstate1, iblockstate2)) -- { -- if (j2 - 1 < 10) -- { -- p_180702_5_.setBlockState(j3, j2, i2, Blocks.lava.getDefaultState()); -- } -- else -- { -- p_180702_5_.setBlockState(j3, j2, i2, Blocks.air.getDefaultState()); -- -- if (iblockstate2.getBlock() == Blocks.sand) -- { -- p_180702_5_.setBlockState(j3, j2 + 1, i2, iblockstate2.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState()); -- } -- -- if (flag1 && p_180702_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) -- { -- blockpos$mutableblockpos.set(j3 + p_180702_3_ * 16, 0, i2 + p_180702_4_ * 16); -- p_180702_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock.getBlock().getDefaultState()); -- } -- } -- } -+ digBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2); - } - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej deleted file mode 100644 index cf2327018b..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej +++ /dev/null @@ -1,32 +0,0 @@ -++++ REJECTED PATCH 2 - { - IBlockState iblockstate1 = p_180707_5_.getBlockState(j3, j2, i2); - -- if (iblockstate1.getBlock() == Blocks.grass) -+ if (isTopBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_)) - { - flag = true; - } - -- if (iblockstate1.getBlock() == Blocks.stone || iblockstate1.getBlock() == Blocks.dirt || iblockstate1.getBlock() == Blocks.grass) -- { -- if (j2 - 1 < 10) -- { -- p_180707_5_.setBlockState(j3, j2, i2, Blocks.flowing_lava.getDefaultState()); -- } -- else -- { -- p_180707_5_.setBlockState(j3, j2, i2, Blocks.air.getDefaultState()); -- -- if (flag && p_180707_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) -- { -- blockpos$mutableblockpos.set(j3 + p_180707_3_ * 16, 0, i2 + p_180707_4_ * 16); -- p_180707_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock); -- } -- } -- } -+ digBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_, flag); - } - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch.rej deleted file mode 100644 index 2a00cca4ab..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 2 - - protected static boolean isBiomeOceanic(int p_151618_0_) - { -- return p_151618_0_ == BiomeGenBase.ocean.biomeID || p_151618_0_ == BiomeGenBase.deepOcean.biomeID || p_151618_0_ == BiomeGenBase.frozenOcean.biomeID; -+ return net.minecraftforge.common.BiomeManager.oceanBiomes.contains(BiomeGenBase.getBiome(p_151618_0_)); - } - - protected int selectRandom(int... p_151619_1_) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch.rej deleted file mode 100644 index e2267751c0..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch.rej +++ /dev/null @@ -1,84 +0,0 @@ -++++ REJECTED PATCH 1 - - public class GenLayerBiome extends GenLayer - { -- private BiomeGenBase[] field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.savanna, BiomeGenBase.savanna, BiomeGenBase.plains}; -- private BiomeGenBase[] field_151621_d = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.roofedForest, BiomeGenBase.extremeHills, BiomeGenBase.plains, BiomeGenBase.birchForest, BiomeGenBase.swampland}; -- private BiomeGenBase[] field_151622_e = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.taiga, BiomeGenBase.plains}; -- private BiomeGenBase[] field_151620_f = new BiomeGenBase[] {BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.coldTaiga}; -+ @SuppressWarnings("unchecked") -+ private java.util.List[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length]; -+ - private final ChunkProviderSettings field_175973_g; - - public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_) -++++ END PATCH -++++ REJECTED PATCH 2 - super(p_i45560_1_); - this.parent = p_i45560_3_; - -+ for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values()) -+ { -+ com.google.common.collect.ImmutableList biomesToAdd = net.minecraftforge.common.BiomeManager.getBiomes(type); -+ int idx = type.ordinal(); -+ -+ if (biomes[idx] == null) biomes[idx] = new java.util.ArrayList(); -+ if (biomesToAdd != null) biomes[idx].addAll(biomesToAdd); -+ } -+ -+ 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)); -+ - if (p_i45560_4_ == WorldType.DEFAULT_1_1) - { -- this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.plains, BiomeGenBase.taiga}; -+ 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)); - this.field_175973_g = null; - } - else if (p_i45560_4_ == WorldType.CUSTOMIZED) -++++ END PATCH -++++ REJECTED PATCH 3 - } - else - { -- aint1[j + i * areaWidth] = this.field_151623_c[this.nextInt(this.field_151623_c.length)].biomeID; -+ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome.biomeID; - } - } - else if (k == 2) -++++ END PATCH -++++ REJECTED PATCH 4 - } - else - { -- aint1[j + i * areaWidth] = this.field_151621_d[this.nextInt(this.field_151621_d.length)].biomeID; -+ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM).biome.biomeID; - } - } - else if (k == 3) -++++ END PATCH -++++ REJECTED PATCH 5 - } - else - { -- aint1[j + i * areaWidth] = this.field_151622_e[this.nextInt(this.field_151622_e.length)].biomeID; -+ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL).biome.biomeID; - } - } - else if (k == 4) - { -- aint1[j + i * areaWidth] = this.field_151620_f[this.nextInt(this.field_151620_f.length)].biomeID; -+ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY).biome.biomeID; - } - else - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch.rej deleted file mode 100644 index 7cec77af05..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch.rej +++ /dev/null @@ -1,55 +0,0 @@ -++++ REJECTED PATCH 2 - { - int l1 = enumfacing.getFrontOffsetX() * 2; - int i2 = enumfacing.getFrontOffsetZ() * 2; -- this.field_74940_h[enumfacing.getHorizontalIndex()] = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 10 + l1, -11, 10 + i2, WeightedRandomChestContent.func_177629_a(itemsToGenerateInTemple, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(5)); -+ this.field_74940_h[enumfacing.getHorizontalIndex()] = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 10 + l1, -11, 10 + i2, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, randomIn)); - } - } - -++++ END PATCH -++++ REJECTED PATCH 4 - this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 4, -3, 1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 3, -3, 1, structureBoundingBoxIn); - -+ net.minecraftforge.common.ChestGenHooks dispenser = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_DISPENSER); -+ net.minecraftforge.common.ChestGenHooks chest = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST); -+ - if (!this.field_74945_j) - { -- this.field_74945_j = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 3, -2, 1, EnumFacing.NORTH.getIndex(), field_175815_j, 2); -+ this.field_74945_j = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 3, -2, 1, EnumFacing.NORTH.getIndex(), dispenser.getItems(randomIn), dispenser.getCount(randomIn)); - } - - this.setBlockState(worldIn, Blocks.vine.getStateFromMeta(15), 3, -2, 2, structureBoundingBoxIn); -++++ END PATCH -++++ REJECTED PATCH 5 - - if (!this.field_74946_k) - { -- this.field_74946_k = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 9, -2, 3, EnumFacing.WEST.getIndex(), field_175815_j, 2); -+ this.field_74946_k = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 9, -2, 3, EnumFacing.WEST.getIndex(), dispenser.getItems(randomIn), dispenser.getCount(randomIn)); - } - - this.setBlockState(worldIn, Blocks.vine.getStateFromMeta(15), 8, -1, 3, structureBoundingBoxIn); -++++ END PATCH -++++ REJECTED PATCH 6 - - if (!this.field_74947_h) - { -- this.field_74947_h = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 8, -3, 3, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(5)); -+ this.field_74947_h = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 8, -3, 3, chest.getItems(randomIn), chest.getCount(randomIn)); - } - - this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 9, -3, 2, structureBoundingBoxIn); -++++ END PATCH -++++ REJECTED PATCH 7 - - if (!this.field_74948_i) - { -- this.field_74948_i = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 9, -3, 10, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(5)); -+ this.field_74948_i = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 9, -3, 10, chest.getItems(randomIn), chest.getCount(randomIn)); - } - - return true; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej deleted file mode 100644 index 5827a1fee6..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej +++ /dev/null @@ -1,21 +0,0 @@ -++++ REJECTED PATCH 1 - - for (BiomeGenBase biomegenbase : BiomeGenBase.getBiomeGenArray()) - { -- if (biomegenbase != null && biomegenbase.minHeight > 0.0F) -+ if (biomegenbase != null && biomegenbase.minHeight > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) - { - this.field_151546_e.add(biomegenbase); - } - } -+ for (BiomeGenBase biome : net.minecraftforge.common.BiomeManager.strongHoldBiomes) -+ { -+ if (!this.field_151546_e.contains(biome)) -+ { -+ this.field_151546_e.add(biome); -+ } -+ } - } - - public MapGenStronghold(Map p_i2068_1_) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch.rej deleted file mode 100644 index 5ced572b87..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch.rej +++ /dev/null @@ -1,19 +0,0 @@ -++++ REJECTED PATCH 2 - this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.05F, 1, 2, k1 - 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); - this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.05F, 1, 2, k1 + 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); - -+ net.minecraftforge.common.ChestGenHooks info = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR); - if (randomIn.nextInt(100) == 0) - { -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 2, 0, k1 - 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.CHEST_CONTENT_WEIGHT_LIST, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 3 + randomIn.nextInt(4)); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 2, 0, k1 - 1, info.getItems(randomIn), info.getCount(randomIn)); - } - - if (randomIn.nextInt(100) == 0) - { -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 0, 0, k1 + 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.CHEST_CONTENT_WEIGHT_LIST, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 3 + randomIn.nextInt(4)); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 0, 0, k1 + 1, info.getItems(randomIn), info.getCount(randomIn)); - } - - if (this.hasSpiders && !this.spawnerPlaced) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej deleted file mode 100644 index 2307718641..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej +++ /dev/null @@ -1,29 +0,0 @@ -++++ REJECTED PATCH 1 - if (this.field_111021_b && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) - { - this.field_111021_b = false; -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, field_111019_a, 2 + randomIn.nextInt(4)); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, randomIn)); - } - - this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); -++++ END PATCH -++++ REJECTED PATCH 2 - if (this.field_111020_b && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(1, 3), this.getYWithOffset(2), this.getZWithOffset(1, 3)))) - { - this.field_111020_b = false; -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 1, 2, 3, field_111019_a, 2 + randomIn.nextInt(4)); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 1, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, randomIn)); - } - - this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); -++++ END PATCH -++++ REJECTED PATCH 3 - abstract static class Piece extends StructureComponent - { - protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 5), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 5), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 15), new WeightedRandomChestContent(Items.golden_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.golden_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.flint_and_steel, 0, 1, 1, 5), new WeightedRandomChestContent(Items.nether_wart, 0, 3, 7, 5), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 8), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 5), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.obsidian), 0, 2, 4, 2)}); -+ static { net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, field_111019_a, 2, 5); } - - public Piece() - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch.rej deleted file mode 100644 index 6f7af3afda..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch.rej +++ /dev/null @@ -1,37 +0,0 @@ -++++ REJECTED PATCH 2 - if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) - { - this.hasMadeChest = true; -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, WeightedRandomChestContent.func_177629_a(strongholdChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(2)); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, randomIn)); - } - - return true; -++++ END PATCH -++++ REJECTED PATCH 4 - this.setBlockState(worldIn, Blocks.torch.getDefaultState(), i1, 8, j1 + 1, structureBoundingBoxIn); - } - -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 3, 5, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn, 1, 5, 2)}), 1 + randomIn.nextInt(4)); -+ net.minecraftforge.common.ChestGenHooks info = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 3, 5, info.getItems(randomIn), info.getCount(randomIn)); - - if (this.isLargeRoom) - { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), 12, 9, 1, structureBoundingBoxIn); -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 12, 8, 1, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn, 1, 5, 2)}), 1 + randomIn.nextInt(4)); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 12, 8, 1, info.getItems(randomIn), info.getCount(randomIn)); - } - - return true; -++++ END PATCH -++++ REJECTED PATCH 6 - this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 1, 3, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 2, 3, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 3, 3, structureBoundingBoxIn); -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 4, 8, WeightedRandomChestContent.func_177629_a(strongholdRoomCrossingChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 1 + randomIn.nextInt(4)); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 4, 8, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, randomIn)); - } - - return true; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch.rej deleted file mode 100644 index bba26e14d0..0000000000 --- a/rejects/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch.rej +++ /dev/null @@ -1,19 +0,0 @@ -++++ REJECTED PATCH 4 - if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(5, 5), this.getYWithOffset(1), this.getZWithOffset(5, 5)))) - { - this.hasMadeChest = true; -- this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 5, 1, 5, villageBlacksmithChestContents, 3 + randomIn.nextInt(6)); -+ this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 5, 1, 5, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, randomIn), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, randomIn)); - } - - for (int i = 6; i <= 8; ++i) -++++ END PATCH -++++ REJECTED PATCH 6 - this.terrainType = p_i2104_7_; - BiomeGenBase biomegenbase = chunkManagerIn.getBiomeGenerator(new BlockPos(p_i2104_4_, 0, p_i2104_5_), BiomeGenBase.field_180279_ad); - this.inDesert = biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills; -+ this.biome = biomegenbase; - this.func_175846_a(this.inDesert); - } - -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/common/ChestGenHooks.java b/src/main/java/net/minecraftforge/common/ChestGenHooks.java index 61c024423d..8d2cc0a753 100644 --- a/src/main/java/net/minecraftforge/common/ChestGenHooks.java +++ b/src/main/java/net/minecraftforge/common/ChestGenHooks.java @@ -24,17 +24,9 @@ import net.minecraftforge.oredict.OreDictionary; public class ChestGenHooks { //Currently implemented categories for chests/dispensers, Dungeon loot is still in DungeonHooks - public static final String MINESHAFT_CORRIDOR = "mineshaftCorridor"; - public static final String PYRAMID_DESERT_CHEST = "pyramidDesertyChest"; - public static final String PYRAMID_JUNGLE_CHEST = "pyramidJungleChest"; - public static final String PYRAMID_JUNGLE_DISPENSER = "pyramidJungleDispenser"; - public static final String STRONGHOLD_CORRIDOR = "strongholdCorridor"; - public static final String STRONGHOLD_LIBRARY = "strongholdLibrary"; - public static final String STRONGHOLD_CROSSING = "strongholdCrossing"; - public static final String VILLAGE_BLACKSMITH = "villageBlacksmith"; + public static final String PYRAMID_JUNGLE_DISPENSER = "pyramidJungleDispenser"; // TODO: Convert to a Loot Table public static final String BONUS_CHEST = "bonusChest"; public static final String DUNGEON_CHEST = "dungeonChest"; - public static final String NETHER_FORTRESS = "netherFortress"; private static final HashMap chestInfo = new HashMap(); private static boolean hasInit = false; @@ -53,15 +45,7 @@ public class ChestGenHooks hasInit = true; // This causes the classes static initializers to run new WorldGenDungeons(); - new DesertPyramid(); new JunglePyramid(); - new StructureMineshaftPieces(); - new StructureOceanMonument(); - new StructureStrongholdPieces.ChestCorridor(); - new StructureStrongholdPieces.Library(); - new StructureStrongholdPieces.RoomCrossing(); - new StructureVillagePieces.House2(); - new StructureNetherBridgePieces.Corridor(); WorldServer.fillChestHook(); } diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index b1c7ecfa07..0c1fcaeb0e 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -33,6 +33,8 @@ import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.WorldSettings; import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.storage.IPlayerFileData; import net.minecraft.world.storage.SaveHandler; import net.minecraftforge.client.event.ClientChatReceivedEvent; @@ -73,6 +75,8 @@ import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; import net.minecraftforge.event.entity.player.SleepingLocationCheckEvent; import net.minecraftforge.event.entity.player.UseHoeEvent; +import net.minecraftforge.event.terraingen.ChunkGeneratorEvent; +import net.minecraftforge.event.terraingen.PopulateChunkEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.BlockEvent.NeighborNotifyEvent; import net.minecraftforge.event.world.BlockEvent.MultiPlaceEvent; @@ -521,7 +525,10 @@ public class ForgeEventFactory Result canContinueSleep = evt.getResult(); if (canContinueSleep == Result.DEFAULT) - return player.worldObj.getBlockState(player.playerLocation).getBlock().isBed(player.worldObj, player.playerLocation, player); + { + IBlockState state = player.worldObj.getBlockState(player.playerLocation); + return state.getBlock().isBed(state, player.worldObj, player.playerLocation, player); + } else return canContinueSleep == Result.ALLOW; } @@ -542,4 +549,16 @@ public class ForgeEventFactory return event.getCharge(); } + public static boolean onReplaceBiomeBlocks(IChunkGenerator gen, int x, int z, ChunkPrimer primer, World world) + { + ChunkGeneratorEvent.ReplaceBiomeBlocks event = new ChunkGeneratorEvent.ReplaceBiomeBlocks(gen, x, z, primer, world); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + return event.getResult() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY; + } + + public static void onChunkPopulate(boolean pre, IChunkGenerator gen, World world, int x, int z, boolean hasVillageGenerated) + { + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(gen, world, world.rand, x, z, hasVillageGenerated)); + } + } diff --git a/src/main/java/net/minecraftforge/event/terraingen/ChunkProviderEvent.java b/src/main/java/net/minecraftforge/event/terraingen/ChunkGeneratorEvent.java similarity index 68% rename from src/main/java/net/minecraftforge/event/terraingen/ChunkProviderEvent.java rename to src/main/java/net/minecraftforge/event/terraingen/ChunkGeneratorEvent.java index d9374346a0..a4e13d4e1a 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/ChunkProviderEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/ChunkGeneratorEvent.java @@ -3,18 +3,19 @@ package net.minecraftforge.event.terraingen; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.world.World; import net.minecraft.world.chunk.ChunkPrimer; -import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.chunk.IChunkGenerator; -public class ChunkProviderEvent extends Event +public class ChunkGeneratorEvent extends Event { + private final IChunkGenerator gen; - public final IChunkProvider chunkProvider; - - public ChunkProviderEvent(IChunkProvider chunkProvider) + public ChunkGeneratorEvent(IChunkGenerator gen) { - this.chunkProvider = chunkProvider; + this.gen = gen; } + public IChunkGenerator getGenerator() { return this.gen; } + /** * This event is fired when a chunks blocks are replaced by a biomes top and * filler blocks. @@ -22,14 +23,14 @@ public class ChunkProviderEvent extends Event * You can set the result to DENY to prevent the default replacement. */ @HasResult - public static class ReplaceBiomeBlocks extends ChunkProviderEvent + public static class ReplaceBiomeBlocks extends ChunkGeneratorEvent { public final int x; public final int z; public final ChunkPrimer primer; public final World world; // CAN BE NULL - public ReplaceBiomeBlocks(IChunkProvider chunkProvider, int x, int z, ChunkPrimer primer, World world) + public ReplaceBiomeBlocks(IChunkGenerator chunkProvider, int x, int z, ChunkPrimer primer, World world) { super(chunkProvider); this.x = x; @@ -46,7 +47,7 @@ public class ChunkProviderEvent extends Event * You can set the result to DENY to substitute your own noise field. */ @HasResult - public static class InitNoiseField extends ChunkProviderEvent + public static class InitNoiseField extends ChunkGeneratorEvent { public double[] noisefield; public final int posX; @@ -56,7 +57,7 @@ public class ChunkProviderEvent extends Event public final int sizeY; public final int sizeZ; - public InitNoiseField(IChunkProvider chunkProvider, double[] noisefield, int posX, int posY, int posZ, int sizeX, int sizeY, int sizeZ) + public InitNoiseField(IChunkGenerator chunkProvider, double[] noisefield, int posX, int posY, int posZ, int sizeX, int sizeY, int sizeZ) { super(chunkProvider); this.noisefield = noisefield; diff --git a/src/main/java/net/minecraftforge/event/terraingen/InitNoiseGensEvent.java b/src/main/java/net/minecraftforge/event/terraingen/InitNoiseGensEvent.java index ae4af86c13..9c31596f84 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/InitNoiseGensEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/InitNoiseGensEvent.java @@ -3,20 +3,110 @@ package net.minecraftforge.event.terraingen; import java.util.Random; import net.minecraft.world.World; -import net.minecraft.world.gen.NoiseGenerator; -import net.minecraftforge.event.world.*; +import net.minecraft.world.gen.NoiseGeneratorOctaves; +import net.minecraft.world.gen.NoiseGeneratorPerlin; +import net.minecraft.world.gen.NoiseGeneratorSimplex; +import net.minecraftforge.event.world.WorldEvent; -public class InitNoiseGensEvent extends WorldEvent +public class InitNoiseGensEvent extends WorldEvent { - public final Random rand; - public final NoiseGenerator[] originalNoiseGens; - public NoiseGenerator[] newNoiseGens; - - public InitNoiseGensEvent(World world, Random rand, NoiseGenerator[] original) + private final Random rand; + private final T original; + private T newValues; + + @SuppressWarnings("unchecked") + public InitNoiseGensEvent(World world, Random rand, T original) { super(world); this.rand = rand; - originalNoiseGens = original; - newNoiseGens = original.clone(); + this.original = original; + this.newValues = (T)original.clone(); + } + public Random getRandom() { return this.rand; } + public T getOriginal() { return this.original; } + public T getNewValues() { return this.newValues; } + + public static class Context + { + private NoiseGeneratorOctaves lperlin1; + private NoiseGeneratorOctaves lperlin2; + private NoiseGeneratorOctaves perlin; + private NoiseGeneratorOctaves scale; + private NoiseGeneratorOctaves depth; + public Context(NoiseGeneratorOctaves lperlin1, NoiseGeneratorOctaves lperlin2, NoiseGeneratorOctaves perlin, + NoiseGeneratorOctaves scale, NoiseGeneratorOctaves depth) + { + this.lperlin1 = lperlin1; + this.lperlin2 = lperlin2; + this.perlin = perlin; + this.scale = scale; + this.depth = depth; + } + public NoiseGeneratorOctaves getLPerlin1() { return lperlin1; } + public NoiseGeneratorOctaves getLPerlin2() { return lperlin2; } + public NoiseGeneratorOctaves getPerlin() { return perlin; } + public NoiseGeneratorOctaves getScale() { return scale; } + public NoiseGeneratorOctaves getDepth() { return depth; } + public void setLPerlin1(NoiseGeneratorOctaves value) { this.lperlin1 = value; } + public void getLPerlin2(NoiseGeneratorOctaves value) { this.lperlin2 = value; } + public void getPerlin (NoiseGeneratorOctaves value) { this.perlin = value; } + public void getScale (NoiseGeneratorOctaves value) { this.scale = value; } + public void getDepth (NoiseGeneratorOctaves value) { this.depth = value; } + + public Context clone(){ return new Context(lperlin1, lperlin2, perlin, scale, depth); } + } + + public static class ContextOverworld extends Context + { + private NoiseGeneratorPerlin height; + private NoiseGeneratorOctaves forest; + + public ContextOverworld(NoiseGeneratorOctaves lperlin1, NoiseGeneratorOctaves lperlin2, NoiseGeneratorOctaves perlin, + NoiseGeneratorPerlin height, NoiseGeneratorOctaves scale, NoiseGeneratorOctaves depth, NoiseGeneratorOctaves forest) + { + super(lperlin1, lperlin2, perlin, scale, depth); + this.height = height; + this.forest = forest; + } + public ContextOverworld clone() { return new ContextOverworld(getLPerlin1(), getLPerlin2(), getPerlin(), height, getScale(), getDepth(), forest); } + public NoiseGeneratorPerlin getHeight() { return height; } + public NoiseGeneratorOctaves getForest() { return forest; } + + public void getHeight (NoiseGeneratorPerlin value) { this.height = value; } + public void getForest (NoiseGeneratorOctaves value) { this.forest = value; } + } + + public static class ContextEnd extends Context + { + private NoiseGeneratorSimplex island; + public ContextEnd(NoiseGeneratorOctaves lperlin1, NoiseGeneratorOctaves lperlin2, NoiseGeneratorOctaves perlin, + NoiseGeneratorOctaves scale, NoiseGeneratorOctaves depth, NoiseGeneratorSimplex island) + { + super(lperlin1, lperlin2, perlin, scale, depth); + this.island = island; + } + public ContextEnd clone() { return new ContextEnd(getLPerlin1(), getLPerlin2(), getPerlin(), getScale(), getDepth(), island); } + public NoiseGeneratorSimplex getIsland() { return island; } + public void getIsland (NoiseGeneratorSimplex value) { this.island = value; } + } + + + public static class ContextHell extends Context + { + private NoiseGeneratorOctaves perlin2; + private NoiseGeneratorOctaves perlin3; + + public ContextHell(NoiseGeneratorOctaves lperlin1, NoiseGeneratorOctaves lperlin2, NoiseGeneratorOctaves perlin, + NoiseGeneratorOctaves perlin2, NoiseGeneratorOctaves perlin3, NoiseGeneratorOctaves scale, NoiseGeneratorOctaves depth) + { + super(lperlin1, lperlin2, perlin, scale, depth); + this.perlin2 = perlin2; + this.perlin3 = perlin3; + } + public ContextHell clone() { return new ContextHell(getLPerlin1(), getLPerlin2(), getPerlin(), perlin2, perlin3, getScale(), getDepth()); } + public NoiseGeneratorOctaves getPerlin2() { return perlin2; } + public NoiseGeneratorOctaves getPerlin3() { return perlin3; } + public void getPerlin2 (NoiseGeneratorOctaves value) { this.perlin2 = value; } + public void getPerlin3 (NoiseGeneratorOctaves value) { this.perlin3 = value; } } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java b/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java index cfc77547f5..78a183639e 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java @@ -5,6 +5,7 @@ import java.util.Random; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.common.eventhandler.Event.HasResult; import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; /** @@ -20,7 +21,7 @@ import net.minecraft.world.chunk.IChunkProvider; *
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}, except {@link Populate}, which fires on the {@link MinecraftForge#TERRAIN_GEN_BUS}.
**/ -public class PopulateChunkEvent extends ChunkProviderEvent +public class PopulateChunkEvent extends ChunkGeneratorEvent { public final World world; public final Random rand; @@ -28,9 +29,9 @@ public class PopulateChunkEvent extends ChunkProviderEvent public final int chunkZ; public final boolean hasVillageGenerated; - public PopulateChunkEvent(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) + public PopulateChunkEvent(IChunkGenerator gen, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) { - super(chunkProvider); + super(gen); this.world = world; this.rand = rand; this.chunkX = chunkX; @@ -53,9 +54,9 @@ public class PopulateChunkEvent extends ChunkProviderEvent **/ public static class Pre extends PopulateChunkEvent { - public Pre(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) + public Pre(IChunkGenerator gen, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) { - super(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated); + super(gen, world, rand, chunkX, chunkZ, hasVillageGenerated); } } @@ -74,7 +75,7 @@ public class PopulateChunkEvent extends ChunkProviderEvent **/ public static class Post extends PopulateChunkEvent { - public Post(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) + public Post(IChunkGenerator chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) { super(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated); } @@ -105,9 +106,9 @@ public class PopulateChunkEvent extends ChunkProviderEvent public final EventType type; - public Populate(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated, EventType type) + public Populate(IChunkGenerator gen, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated, EventType type) { - super(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated); + super(gen, world, rand, chunkX, chunkZ, hasVillageGenerated); this.type = type; } } diff --git a/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java b/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java index 9ca4e97b4d..a61d29537a 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java +++ b/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java @@ -4,6 +4,7 @@ import java.util.Random; import net.minecraftforge.fml.common.eventhandler.Event.*; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.MapGenBase; import net.minecraft.world.gen.NoiseGenerator; @@ -15,11 +16,11 @@ import net.minecraftforge.event.terraingen.PopulateChunkEvent.*; public abstract class TerrainGen { - public static NoiseGenerator[] getModdedNoiseGenerators(World world, Random rand, NoiseGenerator[] original) + public static T getModdedNoiseGenerators(World world, Random rand, T original) { - InitNoiseGensEvent event = new InitNoiseGensEvent(world, rand, original); + InitNoiseGensEvent event = new InitNoiseGensEvent(world, rand, original); MinecraftForge.TERRAIN_GEN_BUS.post(event); - return event.newNoiseGens; + return event.getNewValues(); } public static MapGenBase getModdedMapGen(MapGenBase original, InitMapGenEvent.EventType type) @@ -29,7 +30,7 @@ public abstract class TerrainGen return event.newGen; } - public static boolean populate(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated, Populate.EventType type) + public static boolean populate(IChunkGenerator chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated, Populate.EventType type) { PopulateChunkEvent.Populate event = new PopulateChunkEvent.Populate(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated, type); MinecraftForge.TERRAIN_GEN_BUS.post(event); diff --git a/src/main/java/net/minecraftforge/fml/common/IWorldGenerator.java b/src/main/java/net/minecraftforge/fml/common/IWorldGenerator.java index 20b43f83d9..6210b20a49 100644 --- a/src/main/java/net/minecraftforge/fml/common/IWorldGenerator.java +++ b/src/main/java/net/minecraftforge/fml/common/IWorldGenerator.java @@ -5,7 +5,7 @@ * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * + * * Contributors: * cpw - implementation */ @@ -15,11 +15,12 @@ package net.minecraftforge.fml.common; import java.util.Random; import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; /** - * This is called back during world generation. + * This is called back during world generation. * * @author cpw * @@ -37,5 +38,5 @@ public interface IWorldGenerator * @param chunkProvider : additionalData[2] {@link IChunkProvider} that is requesting the world generation. * */ - 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); } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java index ee5b0fcfb7..dd9d7feea3 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java @@ -39,6 +39,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.IFuelHandler; @@ -94,7 +95,7 @@ public class GameRegistry * @param chunkGenerator The chunk generator * @param chunkProvider The chunk provider */ - public static void generateWorld(int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) + public static void generateWorld(int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { if (sortedGeneratorList == null) { diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 70ab22e1b3..d59cf947d3 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -19,8 +19,8 @@ net/minecraft/world/biome/BiomeGenBase.(IZ)V=|p_i1971_1_,register net/minecraft/world/chunk/storage/AnvilChunkLoader.loadChunk__Async(Lnet/minecraft/world/World;II)[Ljava/lang/Object;=|p_75815_1_,p_75815_2_,p_75815_3_ net/minecraft/world/chunk/storage/AnvilChunkLoader.checkedReadChunkFromNBT__Async(Lnet/minecraft/world/World;IILnet/minecraft/nbt/NBTTagCompound;)[Ljava/lang/Object;=|p_75822_1_,p_75822_2_,p_75822_3_,p_75822_4_ net/minecraft/world/chunk/storage/AnvilChunkLoader.loadEntities(Lnet/minecraft/world/World;Lnet/minecraft/nbt/NBTTagCompound;Lnet/minecraft/world/chunk/Chunk;)V=|p_75823_1_,p_75823_2_,chunk -net/minecraft/world/gen/ChunkProviderServer.loadChunk(II;Ljava/lang/Runnable;)Lnet/minecraft/world/chunk/Chunk;=|p_73158_1,p_73158_2,runnable -net/minecraft/world/gen/ChunkProviderServer.originalLoadChunk(II)Lnet/minecraft/world/chunk/Chunk;=|p_73158_1_,p_73158_2_ +net/minecraft/world/gen/ChunkProviderServer.loadChunk(II;Ljava/lang/Runnable;)Lnet/minecraft/world/chunk/Chunk;=|p_186025_1_,p_186025_2_,runnable +net/minecraft/world/gen/ChunkProviderServer.originalLoadChunk(II)Lnet/minecraft/world/chunk/Chunk;=|p_186025_1_,p_186025_2_ net/minecraft/block/BlockFire.tryCatchFire(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;ILjava/util/Random;ILnet/minecraft/util/EnumFacing;)V=|p_176536_1_,p_176536_2_,p_176536_3_,p_176536_4_,p_176536_5_,face net/minecraft/block/BlockSkull.getDrops(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/BlockPos;Lnet/minecraft/block/state/IBlockState;I)Ljava/util/List;=|p_180663_1_,p_180663_2_,p_180663_3_,fortune diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index 654f7a7499..4f78e56d38 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -234,3 +234,33 @@ protected net.minecraft.client.gui.FontRenderer func_78277_a(CZ)F # renderUnicod # ServerConfigurationManager #public net.minecraft.server.management.ServerConfigurationManager field_72404_b #playerEntityList - private in 1.8.8 #public net.minecraft.server.management.ServerConfigurationManager field_177454_f #uuidToPlayerMap - private in 1.8.8 + +# ChunkProviderEnd +private-f net/minecraft/world/gen/ChunkProviderEnd/field_185969_i #lperlin1 +private-f net/minecraft/world/gen/ChunkProviderEnd/field_185970_j #lperlin2 +private-f net/minecraft/world/gen/ChunkProviderEnd/field_185971_k #perlin +private-f net/minecraft/world/gen/ChunkProviderEnd/field_185973_o #island + +# ChunkProviderOverworld +private-f net/minecraft/world/gen/ChunkProviderOverworld/field_185991_j #lperlin1 +private-f net/minecraft/world/gen/ChunkProviderOverworld/field_185992_k #lperlin2 +private-f net/minecraft/world/gen/ChunkProviderOverworld/field_185993_l #perlin +private-f net/minecraft/world/gen/ChunkProviderOverworld/field_185994_m #surface +private-f net/minecraft/world/gen/ChunkProviderOverworld/field_185979_A #ravineGenerator +private-f net/minecraft/world/gen/ChunkProviderOverworld/field_185980_B #oceanMonumentGenerator +private-f net/minecraft/world/gen/ChunkProviderOverworld/field_186003_v #caveGenerator +private-f net/minecraft/world/gen/ChunkProviderOverworld/field_186004_w #strongholdGenerator +private-f net/minecraft/world/gen/ChunkProviderOverworld/field_186005_x #villageGenerator +private-f net/minecraft/world/gen/ChunkProviderOverworld/field_186006_y #mineshaftGenerator +private-f net/minecraft/world/gen/ChunkProviderOverworld/field_186007_z #scatteredFeatureGenerator + +# ChunkProviderHell +private-f net/minecraft/world/gen/ChunkProviderHell/field_185957_u #lperlin1 +private-f net/minecraft/world/gen/ChunkProviderHell/field_185958_v #lperlin2 +private-f net/minecraft/world/gen/ChunkProviderHell/field_185959_w #perlin +private-f net/minecraft/world/gen/ChunkProviderHell/field_73177_m #perlin2 +private-f net/minecraft/world/gen/ChunkProviderHell/field_73174_n #perlin3 +public-f net/minecraft/world/gen/ChunkProviderHell/field_185946_g #scale +public-f net/minecraft/world/gen/ChunkProviderHell/field_185947_h #depth +private-f net/minecraft/world/gen/ChunkProviderHell/field_185939_I #netherCaveGenerator +private-f net/minecraft/world/gen/ChunkProviderHell/field_73172_c #netherBridgeGenerator \ No newline at end of file From ed8a8b415be90689de95ffb2f9d30e6bb2abbdcf Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sat, 5 Mar 2016 04:43:41 +0300 Subject: [PATCH 031/243] Fix various errors in text mods. --- .../minecraftforge/debug/DynBucketTest.java | 27 ++- .../minecraftforge/debug/ItemTileDebug.java | 5 +- .../debug/LayerBreakingTest.java | 225 ------------------ .../debug/ModelAnimationDebug.java | 36 +-- .../debug/ModelBakeEventDebug.java | 75 ++---- .../debug/ModelLoaderRegistryDebug.java | 25 +- .../debug/MultiLayerModelDebug.java | 5 +- .../minecraftforge/test/FOVModifierTest.java | 2 +- 8 files changed, 79 insertions(+), 321 deletions(-) delete mode 100644 src/test/java/net/minecraftforge/debug/LayerBreakingTest.java diff --git a/src/test/java/net/minecraftforge/debug/DynBucketTest.java b/src/test/java/net/minecraftforge/debug/DynBucketTest.java index 52345558c5..90208cdc88 100644 --- a/src/test/java/net/minecraftforge/debug/DynBucketTest.java +++ b/src/test/java/net/minecraftforge/debug/DynBucketTest.java @@ -19,6 +19,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; @@ -81,6 +82,7 @@ public class DynBucketTest } } + @SuppressWarnings("unused") @EventHandler public void preInit(FMLPreInitializationEvent event) { @@ -113,6 +115,7 @@ public class DynBucketTest //MinecraftForge.EVENT_BUS.register(this); } + @SuppressWarnings("unused") private void registerFluidContainer(Fluid fluid, int meta) { if (fluid == null) @@ -123,6 +126,7 @@ public class DynBucketTest FluidContainerRegistry.registerFluidContainer(fs, stack, new ItemStack(Items.bucket)); } + @SuppressWarnings("unused") private void registerFluidContainer2(Fluid fluid, int meta) { if (fluid == null) @@ -136,16 +140,16 @@ public class DynBucketTest @SubscribeEvent public void onBucketFill(FillBucketEvent event) { - IBlockState state = event.world.getBlockState(event.target.getBlockPos()); + IBlockState state = event.getWorld().getBlockState(event.getTarget().getBlockPos()); if (state.getBlock() instanceof IFluidBlock) { Fluid fluid = ((IFluidBlock) state.getBlock()).getFluid(); FluidStack fs = new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME); - ItemStack filled = FluidContainerRegistry.fillFluidContainer(fs, event.current); + ItemStack filled = FluidContainerRegistry.fillFluidContainer(fs, event.getEmptyBucket()); if (filled != null) { - event.result = filled; + event.setFilledBucket(filled); event.setResult(Result.ALLOW); } } @@ -202,7 +206,7 @@ public class DynBucketTest } @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) { TileEntity te = worldIn.getTileEntity(pos); if (!(te instanceof IFluidHandler)) @@ -212,15 +216,14 @@ public class DynBucketTest IFluidHandler tank = (IFluidHandler) te; side = side.getOpposite(); - ItemStack stack = playerIn.inventory.getCurrentItem(); - if (stack == null) + if (heldItem == null) { sendText(playerIn, tank, side); return false; } // do the thing with the tank and the buckets - if (FluidUtil.interactWithTank(stack, playerIn, tank, side)) + if (FluidUtil.interactWithTank(heldItem, playerIn, tank, side)) { return true; } @@ -230,7 +233,7 @@ public class DynBucketTest } // prevent interaction of the item if it's a fluidcontainer. Prevents placing liquids when interacting with the tank - return FluidContainerRegistry.isFilledContainer(stack) || stack.getItem() instanceof IFluidContainerItem; + return FluidContainerRegistry.isFilledContainer(heldItem) || heldItem.getItem() instanceof IFluidContainerItem; } private void sendText(EntityPlayer player, IFluidHandler tank, EnumFacing side) @@ -259,7 +262,8 @@ public class DynBucketTest { int filled = tank.fill(resource, doFill); if(doFill && filled > 0) { - worldObj.markBlockForUpdate(pos); + IBlockState state = worldObj.getBlockState(pos); + worldObj.func_184138_a(pos, state, state, 8); // TODO check flag } return filled; } @@ -276,7 +280,8 @@ public class DynBucketTest { FluidStack drained = tank.drain(maxDrain, doDrain); if(doDrain && drained != null) { - worldObj.markBlockForUpdate(pos); + IBlockState state = worldObj.getBlockState(pos); + worldObj.func_184138_a(pos, state, state, 8); // TODO check flag } return drained; } @@ -315,7 +320,7 @@ public class DynBucketTest } @Override - public Packet getDescriptionPacket() { + public Packet getDescriptionPacket() { NBTTagCompound tag = new NBTTagCompound(); writeToNBT(tag); return new SPacketUpdateTileEntity(this.getPos(), this.getBlockMetadata(), tag); diff --git a/src/test/java/net/minecraftforge/debug/ItemTileDebug.java b/src/test/java/net/minecraftforge/debug/ItemTileDebug.java index 2330b0195f..0539661ed0 100644 --- a/src/test/java/net/minecraftforge/debug/ItemTileDebug.java +++ b/src/test/java/net/minecraftforge/debug/ItemTileDebug.java @@ -2,6 +2,7 @@ package net.minecraftforge.debug; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -125,10 +126,10 @@ public class ItemTileDebug } @Override - public boolean isOpaqueCube() { return false; } + public boolean isOpaqueCube(IBlockState state) { return false; } @Override - public boolean isFullCube() { return false; } + public boolean isFullCube(IBlockState state) { return false; } @Override public boolean isVisuallyOpaque() { return false; } diff --git a/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java b/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java deleted file mode 100644 index 3bf068eb59..0000000000 --- a/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java +++ /dev/null @@ -1,225 +0,0 @@ - -package net.minecraftforge.debug; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BlockModelShapes; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.BlockRenderLayer; -import net.minecraftforge.client.event.ModelBakeEvent; -import net.minecraftforge.client.model.IFlexibleBakedModel; -import net.minecraftforge.client.model.ISmartBlockModel; -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.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.fml.relauncher.Side; - -import com.google.common.primitives.Ints; - -@SuppressWarnings( "deprecation" ) -@Mod( modid = "LayerBreakingTest", name = "LayerBreakingTest", version = "0.0.0" ) -public class LayerBreakingTest -{ - public static final boolean ENABLE = true; - public static TestBlock testBlock; - - class TestBakedModel implements IFlexibleBakedModel - { - TextureAtlasSprite texture; - List list = new ArrayList(); - - private int[] vertexToInts(float x, float y, float z, int color, TextureAtlasSprite texture, int u, int v) - { - return new int[] { Float.floatToRawIntBits(x), Float.floatToRawIntBits(y), Float.floatToRawIntBits(z), color, Float.floatToRawIntBits(texture.getInterpolatedU(u)), Float.floatToRawIntBits(texture.getInterpolatedV(v)), 0 }; - } - - public TestBakedModel(TextureAtlasSprite sprite, boolean top) - { - texture = sprite; - if (top) - { - list.add(new BakedQuad(Ints.concat(vertexToInts(0.5f, 1.0f, 0, -1, texture, 8, 0), vertexToInts(0.5f, 1.0f, 1, -1, texture, 8, 16), vertexToInts(1, 1.0f, 1, -1, texture, 16, 16), vertexToInts(1, 1.0f, 0, -1, texture, 16, 0)), -1, EnumFacing.UP)); - } - else - { - list.add(new BakedQuad(Ints.concat(vertexToInts(0, 1.0f, 0, -1, texture, 0, 0), vertexToInts(0, 1.0f, 1, -1, texture, 0, 16), vertexToInts(0.5f, 1.0f, 1, -1, texture, 8, 16), vertexToInts(0.5f, 1.0f, 0, -1, texture, 8, 0)), -1, EnumFacing.DOWN)); - } - } - - @Override - public boolean isAmbientOcclusion() - { - return true; - } - - @Override - public boolean isGui3d() - { - return true; - } - - @Override - public boolean isBuiltInRenderer() - { - return false; - } - - @Override - public TextureAtlasSprite getParticleTexture() - { - return texture; - } - - @Override - public ItemCameraTransforms getItemCameraTransforms() - { - return ItemCameraTransforms.DEFAULT; - } - - @Override - public List getFaceQuads(EnumFacing side) - { - return Collections.emptyList(); - } - - @Override - public List getGeneralQuads() - { - return list; - } - - @Override - public VertexFormat getFormat() - { - return null; - } - }; - - class TestBlock extends Block - { - protected TestBlock() - { - super(Material.glass); - setHardness(7); - setCreativeTab(CreativeTabs.tabBlock); - } - - @Override - public boolean isOpaqueCube() - { - return false; - } - - public boolean isFullCube() - { - return false; - } - - @Override - public boolean canRenderInLayer(BlockRenderLayer layer) - { - return layer == BlockRenderLayer.SOLID || layer == BlockRenderLayer.TRANSLUCENT; - } - }; - - class SmartModel implements IBakedModel, ISmartBlockModel - { - IFlexibleBakedModel solid; - IFlexibleBakedModel translucent; - - @Override - public List getFaceQuads(EnumFacing p_177551_1_) - { - return Collections.emptyList(); - } - - @Override - public List getGeneralQuads() - { - return Collections.emptyList(); - } - - @Override - public boolean isAmbientOcclusion() - { - return true; - } - - @Override - public boolean isGui3d() - { - return true; - } - - @Override - public boolean isBuiltInRenderer() - { - return false; - } - - @Override - public TextureAtlasSprite getParticleTexture() - { - return null; - } - - @Override - public ItemCameraTransforms getItemCameraTransforms() - { - return ItemCameraTransforms.DEFAULT; - } - - @Override - public IBakedModel handleBlockState(IBlockState state) - { - if (solid == null) - { - BlockModelShapes models = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes(); - translucent = new TestBakedModel(models.getModelForState(Blocks.stained_glass.getStateFromMeta(3)).getParticleTexture(), true); - solid = new TestBakedModel(models.getModelForState(Blocks.cobblestone.getDefaultState()).getParticleTexture(), false); - } - - if (net.minecraftforge.client.MinecraftForgeClient.getRenderLayer() == BlockRenderLayer.SOLID) - { - return solid; - } - else - { - return translucent; - } - } - }; - - @SubscribeEvent - public void onModelBakeEvent(ModelBakeEvent event) - { - event.modelRegistry.putObject(new ModelResourceLocation("layerbreakingtest:layer_breaking_test"), new SmartModel()); - } - - @EventHandler - public void init(FMLInitializationEvent event) - { - if (ENABLE && event.getSide() == Side.CLIENT) - { - MinecraftForge.EVENT_BUS.register(this); - GameRegistry.registerBlock(testBlock = new TestBlock(), "layer_breaking_test"); - } - } -} diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index 8ae2a8b81b..dd7cf87675 100644 --- a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -8,21 +8,24 @@ import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; 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.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.model.IModel; @@ -93,15 +96,15 @@ public class ModelAnimationDebug } @Override - public boolean isOpaqueCube() { return false; } + public boolean isOpaqueCube(IBlockState state) { return false; } @Override - public boolean isFullCube() { return false; } + public boolean isFullCube(IBlockState state) { return false; } @Override public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { - return this.getDefaultState().withProperty(FACING, BlockPistonBase.getFacingFromEntity(world, pos, placer)); + return this.getDefaultState().withProperty(FACING, BlockPistonBase.func_185647_a(pos, placer)); } @Override @@ -140,7 +143,7 @@ public class ModelAnimationDebug }*/ @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if(world.isRemote) { @@ -209,13 +212,13 @@ public class ModelAnimationDebug "chamber", "blocks/redstone_block", "trunk", "blocks/end_stone" ); - if(base instanceof IRetexturableModel) + if(base instanceof IRetexturableModel) { - base = ((IRetexturableModel)base).retexture(textures); + base = ((IRetexturableModel)base).retexture(textures); } - if(ring instanceof IRetexturableModel) + if(ring instanceof IRetexturableModel) { - ring = ((IRetexturableModel)ring).retexture(textures); + ring = ((IRetexturableModel)ring).retexture(textures); } IModel model = new MultiModel( new ResourceLocation(ModelAnimationDebug.MODID, "builtin/engine"), @@ -225,7 +228,7 @@ public class ModelAnimationDebug "base", Pair.of(base, TRSRTransformation.identity()) ) ); - return new RenderLiving(manager, new AnimationModelBase(model, new VertexLighterSmoothAo()) + return new RenderLiving(manager, new AnimationModelBase(model, new VertexLighterSmoothAo(Minecraft.getMinecraft().func_184125_al())) { @Override public void handleEvents(EntityChest chest, float time, Iterable pastEvents) @@ -362,11 +365,12 @@ public class ModelAnimationDebug return asm; } - @Override - public void onDataWatcherUpdate(int id) + // FIXME update health + /*@Override + public void func_184206_a(DataParameter key) { - super.onDataWatcherUpdate(id); - if(id == 6) // health + super.func_184206_a(key); + if(field_184632_c.equals(key)) // health { if(cycleLength == null) { @@ -374,7 +378,7 @@ public class ModelAnimationDebug } cycleLength.setValue(getHealth() / 5); } - } + }*/ @Override protected void applyEntityAttributes() diff --git a/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java b/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java index 524b546f04..7f3dfcc425 100644 --- a/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java @@ -1,37 +1,36 @@ package net.minecraftforge.debug; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import net.minecraft.block.BlockContainer; 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.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.ItemOverrideList; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.StateMapperBase; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.creativetab.CreativeTabs; 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.EnumBlockRenderType; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.Vec3; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.event.ModelBakeEvent; -import net.minecraftforge.client.model.ISmartBlockModel; -import net.minecraftforge.client.model.ISmartItemModel; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.property.ExtendedBlockState; @@ -45,9 +44,9 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry; +import com.google.common.collect.ImmutableList; import com.google.common.primitives.Ints; -@SuppressWarnings("deprecation") @Mod(modid = ModelBakeEventDebug.MODID, version = ModelBakeEventDebug.VERSION) public class ModelBakeEventDebug { @@ -136,13 +135,13 @@ public class ModelBakeEventDebug } @Override - public int getRenderType() { return 3; } + public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.MODEL; } @Override - public boolean isOpaqueCube() { return false; } + public boolean isOpaqueCube(IBlockState state) { return false; } @Override - public boolean isFullCube() { return false; } + public boolean isFullCube(IBlockState state) { return false; } @Override public boolean isVisuallyOpaque() { return false; } @@ -154,7 +153,7 @@ public class ModelBakeEventDebug } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntity te = world.getTileEntity(pos); if(te instanceof CustomTileEntity) @@ -210,30 +209,18 @@ public class ModelBakeEventDebug } } - public static class CustomModel implements IBakedModel, ISmartBlockModel, ISmartItemModel + public static class CustomModel implements IBakedModel { private final TextureAtlasSprite base, overlay; //private boolean hasStateSet = false; - private final IExtendedBlockState state; public CustomModel(TextureAtlasSprite base, TextureAtlasSprite overlay) - { - this(base, overlay, null); - } - - public CustomModel(TextureAtlasSprite base, TextureAtlasSprite overlay, IExtendedBlockState state) { this.base = base; this.overlay = overlay; - this.state = state; - } - - @Override - public List getFaceQuads(EnumFacing side) - { - return Collections.emptyList(); } + // TODO update to builder private int[] vertexToInts(float x, float y, float z, int color, TextureAtlasSprite texture, float u, float v) { return new int[] { @@ -258,12 +245,14 @@ public class ModelBakeEventDebug vertexToInts((float)v2.xCoord, (float)v2.yCoord, (float)v2.zCoord, -1, texture, 0, 16), vertexToInts((float)v3.xCoord, (float)v3.yCoord, (float)v3.zCoord, -1, texture, 16, 16), vertexToInts((float)v4.xCoord, (float)v4.yCoord, (float)v4.zCoord, -1, texture, 16, 0) - ), -1, side); + ), -1, side, texture, DefaultVertexFormats.BLOCK); } @Override - public List getGeneralQuads() + public List func_188616_a(IBlockState state, EnumFacing side, long rand) { + if(side != null || !(state instanceof IExtendedBlockState)) return ImmutableList.of(); + IExtendedBlockState exState = (IExtendedBlockState)state; int len = cubeSize * 5 + 1; List ret = new ArrayList(); for(EnumFacing f : EnumFacing.values()) @@ -273,13 +262,10 @@ public class ModelBakeEventDebug { for(int j = 0; j < cubeSize; j++) { - if(state != null) + Integer value = exState.getValue(properties[f.ordinal()]); + if(value != null && (value & (1 << (i * cubeSize + j))) != 0) { - Integer value = state.getValue(properties[f.ordinal()]); - if(value != null && (value & (1 << (i * cubeSize + j))) != 0) - { - ret.add(createSidedBakedQuad((float)(1 + i * 5) / len, (float)(5 + i * 5) / len, (float)(1 + j * 5) / len, (float)(5 + j * 5) / len, 1.0001f, overlay, f)); - } + ret.add(createSidedBakedQuad((float)(1 + i * 5) / len, (float)(5 + i * 5) / len, (float)(1 + j * 5) / len, (float)(5 + j * 5) / len, 1.0001f, overlay, f)); } } } @@ -294,29 +280,16 @@ public class ModelBakeEventDebug public boolean isAmbientOcclusion() { return true; } @Override - public boolean isBuiltInRenderer() { return false; } + public boolean func_188618_c() { return false; } @Override public TextureAtlasSprite getParticleTexture() { return this.base; } @Override - public ItemCameraTransforms getItemCameraTransforms() - { - return ItemCameraTransforms.DEFAULT; - } + public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; } @Override - public IBakedModel handleBlockState(IBlockState state) - { - return new CustomModel(base, overlay, (IExtendedBlockState)state); - } - - @Override - public IBakedModel handleItemState(ItemStack stack) - { - IExtendedBlockState itemState = ((IExtendedBlockState)CustomModelBlock.instance.getDefaultState()).withProperty(properties[1], (1 << (cubeSize * cubeSize)) - 1); - return new CustomModel(base, overlay, itemState); - } + public ItemOverrideList func_188617_f() { return ItemOverrideList.field_188022_a; } } private static Vec3d rotate(Vec3d vec, EnumFacing side) diff --git a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java index a1042a8244..caac6a978b 100644 --- a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java @@ -26,11 +26,13 @@ import net.minecraft.creativetab.CreativeTabs; 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.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.TextComponentString; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.ITickable; import net.minecraft.util.ResourceLocation; import net.minecraft.world.IBlockAccess; @@ -162,7 +164,7 @@ public class ModelLoaderRegistryDebug } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if(world.isRemote) { @@ -249,7 +251,7 @@ public class ModelLoaderRegistryDebug } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (world.getTileEntity(pos) == null) world.setTileEntity(pos, new OBJTesseractTileEntity()); OBJTesseractTileEntity tileEntity = (OBJTesseractTileEntity) world.getTileEntity(pos); @@ -278,8 +280,9 @@ public class ModelLoaderRegistryDebug if (world.isRemote) { - OBJBakedModel objBaked = (OBJBakedModel) Minecraft.getMinecraft().getBlockRendererDispatcher().getModelFromBlockState(state, world, pos); - objBaked.scheduleRebake(); //not necessarily needed for this specific case, but is available + // wtf + //OBJBakedModel objBaked = (OBJBakedModel) Minecraft.getMinecraft().getBlockRendererDispatcher().getModelFromBlockState(state, world, pos); + //objBaked.scheduleRebake(); //not necessarily needed for this specific case, but is available } world.markBlockRangeForRenderUpdate(pos, pos); return false; @@ -428,13 +431,6 @@ public class ModelLoaderRegistryDebug return ((EnumFacing) state.getValue(FACING)).getIndex(); } - @Override - @SideOnly(Side.CLIENT) - public IBlockState getStateForEntityRender(IBlockState state) - { - return this.getDefaultState().withProperty(FACING, EnumFacing.NORTH); - } - @Override public BlockStateContainer createBlockState() { @@ -506,7 +502,7 @@ public class ModelLoaderRegistryDebug } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (world.getTileEntity(pos) != null && world.getTileEntity(pos) instanceof OBJVertexColoring2TileEntity) { @@ -531,6 +527,7 @@ public class ModelLoaderRegistryDebug if (this.worldObj.isRemote) { FMLLog.info("%b", shouldIncrement); + /* IBakedModel bakedModel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelFromBlockState(this.worldObj.getBlockState(this.pos), this.worldObj, this.pos); if (bakedModel != null && bakedModel instanceof OBJBakedModel) { @@ -552,6 +549,7 @@ public class ModelLoaderRegistryDebug { FMLLog.info("incrementing"); String name = materialNames.get(index); + // no objBaked.getModel().getMatLib().changeMaterialColor(name, 0xFF000000); objBaked.scheduleRebake(); index++; @@ -568,12 +566,13 @@ public class ModelLoaderRegistryDebug String name = materialNames.get(index); if (!name.equals(OBJModel.Material.WHITE_NAME)) { + // FIXME objBaked.getModel().getMatLib().changeMaterialColor(name, color); objBaked.scheduleRebake(); } } this.worldObj.markBlockRangeForRenderUpdate(this.pos, this.pos); - } + }*/ } } } diff --git a/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java b/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java index 4aa3c0401a..42906bfd5a 100644 --- a/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java +++ b/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java @@ -2,6 +2,7 @@ package net.minecraftforge.debug; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -36,10 +37,10 @@ public class MultiLayerModelDebug } @Override - public boolean isOpaqueCube() { return false; } + public boolean isOpaqueCube(IBlockState state) { return false; } @Override - public boolean isFullCube() { return false; } + public boolean isFullCube(IBlockState state) { return false; } @Override public boolean canRenderInLayer(BlockRenderLayer layer) diff --git a/src/test/java/net/minecraftforge/test/FOVModifierTest.java b/src/test/java/net/minecraftforge/test/FOVModifierTest.java index c7ded0c58b..53f6869c75 100644 --- a/src/test/java/net/minecraftforge/test/FOVModifierTest.java +++ b/src/test/java/net/minecraftforge/test/FOVModifierTest.java @@ -20,7 +20,7 @@ public class FOVModifierTest { @SubscribeEvent public void getFOVModifier(EntityViewRenderEvent.FOVModifier event) { - if(event.block.getMaterial() == Material.water) + if(event.getState().func_185904_a() == Material.water) event.setFOV(event.getFOV() / 60.0f * 50.0f); } } From cb909eeb59d32cbf651fe6da1954286c73b137be Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sat, 5 Mar 2016 05:02:34 +0300 Subject: [PATCH 032/243] Fixed B3D loader, fixed some obvious errors in ModelLoader. --- .../client/model/ModelLoader.java | 54 ++--- .../client/model/b3d/B3DLoader.java | 217 +++++++++--------- 2 files changed, 131 insertions(+), 140 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 2b327cc79b..eb7731776c 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -32,8 +32,8 @@ import net.minecraft.client.renderer.block.model.ItemModelGenerator; import net.minecraft.client.renderer.block.model.ModelBlock; import net.minecraft.client.renderer.block.model.ModelBlockDefinition; import net.minecraft.client.renderer.block.model.ModelBlockDefinition.MissingVariantException; -import net.minecraft.client.renderer.block.model.ModelBlockDefinition.Variant; -import net.minecraft.client.renderer.block.model.ModelBlockDefinition.Variants; +import net.minecraft.client.renderer.block.model.Variant; +import net.minecraft.client.renderer.block.model.VariantList; import net.minecraft.client.renderer.block.statemap.IStateMapper; import net.minecraft.client.renderer.texture.IIconCreator; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -53,7 +53,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.launchwrapper.Launch; import net.minecraft.util.EnumFacing; -import net.minecraft.util.IRegistry; +import net.minecraft.util.registry.IRegistry; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.animation.Animation; import net.minecraftforge.client.model.animation.IAnimatedModel; @@ -78,7 +78,6 @@ import com.google.common.base.Function; import com.google.common.base.Optional; import com.google.common.base.Throwables; -@SuppressWarnings("ALL") public class ModelLoader extends ModelBakery { private final Map stateModels = Maps.newHashMap(); @@ -132,7 +131,7 @@ public class ModelLoader extends ModelBakery } } }); - IFlexibleBakedModel missingBaked = missingModel.bake(missingModel.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.instance); + IBakedModel missingBaked = missingModel.bake(missingModel.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.instance); for (Entry e : stateModels.entrySet()) { if(e.getValue() == getMissingModel()) @@ -172,7 +171,7 @@ public class ModelLoader extends ModelBakery @Override protected void registerVariant(ModelBlockDefinition definition, ModelResourceLocation location) { - Variants variants = null; + VariantList variants = null; try { variants = definition.getVariants(location.getVariant()); @@ -480,7 +479,7 @@ public class ModelLoader extends ModelBakery { builder.add(loc); } - // mojang hardcode + /*// mojang hardcode if(model.getRootModel() == MODEL_COMPASS && !loc.equals(TextureMap.LOCATION_MISSING_TEXTURE)) { TextureAtlasSprite.setLocationNameCompass(loc.toString()); @@ -488,7 +487,7 @@ public class ModelLoader extends ModelBakery else if(model.getRootModel() == MODEL_CLOCK && !loc.equals(TextureMap.LOCATION_MISSING_TEXTURE)) { TextureAtlasSprite.setLocationNameClock(loc.toString()); - } + }*/ } } for(String s : model.textures.values()) @@ -501,7 +500,7 @@ public class ModelLoader extends ModelBakery return builder.build(); } - public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { if(!Attributes.moreSpecific(format, Attributes.DEFAULT_BAKED_FORMAT)) { @@ -533,11 +532,11 @@ public class ModelLoader extends ModelBakery { return new ItemLayerModel(model).bake(perState, format, bakedTextureGetter); } - if(isCustomRenderer(model)) return new IFlexibleBakedModel.Wrapper(new BuiltInModel(transforms), format); + if(isCustomRenderer(model)) return new BuiltInModel(transforms); return bakeNormal(model, perState, state.apply(Optional.absent()).or(TRSRTransformation.identity()), newTransforms, format, bakedTextureGetter, uvlock); } - private IFlexibleBakedModel bakeNormal(ModelBlock model, IModelState perState, final TRSRTransformation modelState, List newTransforms, VertexFormat format, final Function bakedTextureGetter, boolean uvLocked) + private IBakedModel bakeNormal(ModelBlock model, IModelState perState, final TRSRTransformation modelState, List newTransforms, VertexFormat format, final Function bakedTextureGetter, boolean uvLocked) { TextureAtlasSprite particle = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName("particle"))); SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(model)).setTexture(particle); @@ -567,7 +566,8 @@ public class ModelLoader extends ModelBakery } } - return new ISmartBlockModel.PerspectiveWrapper(new IPerspectiveAwareModel.MapWrapper(new IFlexibleBakedModel.Wrapper(builder.makeBakedModel(), format), perState)) + // FIXME + return new ISmartBlockModel.PerspectiveWrapper(new IPerspectiveAwareModel.MapWrapper(builder.makeBakedModel(), perState)) { public IBakedModel handleBlockState(IBlockState state) { @@ -576,7 +576,7 @@ public class ModelLoader extends ModelBakery }; } - private IBakedModel handleBlockState(IFlexibleBakedModel model, Function bakedTextureGetter, TRSRTransformation modelState, IBlockState state) + private IBakedModel handleBlockState(IBakedModel model, Function bakedTextureGetter, TRSRTransformation modelState, IBlockState state) { if(state instanceof IExtendedBlockState) { @@ -594,7 +594,7 @@ public class ModelLoader extends ModelBakery } @Override - public IModel retexture(ImmutableMap textures) + public VanillaModelWrapper retexture(ImmutableMap textures) { if (textures.isEmpty()) return this; @@ -724,11 +724,11 @@ public class ModelLoader extends ModelBakery private final List models = new ArrayList(); private final IModelState defaultState; - public WeightedRandomModel(ModelResourceLocation parent, Variants variants) + public WeightedRandomModel(ModelResourceLocation parent, VariantList variants) { - this.variants = variants.getVariants(); + this.variants = variants.func_188114_a(); ImmutableList.Builder> builder = ImmutableList.builder(); - for (Variant v : variants.getVariants()) + for (Variant v : this.variants) { ResourceLocation loc = v.getModelLocation(); locations.add(loc); @@ -793,7 +793,7 @@ public class ModelLoader extends ModelBakery return state; } - public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { if(!Attributes.moreSpecific(format, Attributes.DEFAULT_BAKED_FORMAT)) { @@ -812,7 +812,7 @@ public class ModelLoader extends ModelBakery Variant v = variants.get(i); builder.add(model.bake(addUV(v.isUvLocked(), MultiModelState.getPartState(state, model, i)), format, bakedTextureGetter), variants.get(i).getWeight()); } - return new FlexibleWeightedBakedModel(builder.build(), Attributes.DEFAULT_BAKED_FORMAT); + return builder.build(); } public IModelState getDefaultState() @@ -821,22 +821,6 @@ public class ModelLoader extends ModelBakery } } - private static class FlexibleWeightedBakedModel extends WeightedBakedModel implements IFlexibleBakedModel - { - private final VertexFormat format; - - public FlexibleWeightedBakedModel(WeightedBakedModel parent, VertexFormat format) - { - super(parent.models); - this.format = format; - } - - public VertexFormat getFormat() - { - return format; - } - } - public IModel getMissingModel() { if (missingModel == null) diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index eb60e170fe..271ee94185 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -19,11 +19,11 @@ 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.VertexFormat; import net.minecraft.client.resources.IResource; import net.minecraft.client.resources.IResourceManager; -import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; @@ -68,7 +68,6 @@ import com.google.gson.JsonParser; * To enable for your mod call instance.addDomain(modid). * If you need more control over accepted resources - extend the class, and register a new instance with ModelLoaderRegistry. */ -@SuppressWarnings("deprecation") public class B3DLoader implements ICustomModelLoader { public static final B3DLoader instance = new B3DLoader(); @@ -487,7 +486,7 @@ public class B3DLoader implements ICustomModelLoader } @Override - public IModel retexture(ImmutableMap textures) + public ModelWrapper retexture(ImmutableMap textures) { ImmutableMap.Builder builder = ImmutableMap.builder(); for(Map.Entry e : this.textures.entrySet()) @@ -509,7 +508,7 @@ public class B3DLoader implements ICustomModelLoader } @Override - public IModel process(ImmutableMap data) + public ModelWrapper process(ImmutableMap data) { if(data.containsKey("mesh")) { @@ -601,7 +600,7 @@ public class B3DLoader implements ICustomModelLoader private final VertexFormat format; private final ImmutableSet meshes; private final ImmutableMap textures; - private final LoadingCache cache; + private final LoadingCache cache; private ImmutableList quads; @@ -610,9 +609,9 @@ public class B3DLoader implements ICustomModelLoader this(node, state, smooth, gui3d, format, meshes, textures, CacheBuilder.newBuilder() .maximumSize(128) .expireAfterAccess(2, TimeUnit.MINUTES) - .build(new CacheLoader() + .build(new CacheLoader() { - public BakedWrapper load(Integer frame) throws Exception + public B3DState load(Integer frame) throws Exception { IModelState parent = state; Animation newAnimation = node.getAnimation(); @@ -621,12 +620,12 @@ public class B3DLoader implements ICustomModelLoader B3DState ps = (B3DState)parent; parent = ps.getParent(); } - return new BakedWrapper(node, new B3DState(newAnimation, frame, frame, 0, parent), smooth, gui3d, format, meshes, textures); + return new B3DState(newAnimation, frame, frame, 0, parent); } })); } - public BakedWrapper(Node node, IModelState state, boolean smooth, boolean gui3d, VertexFormat format, ImmutableSet meshes, ImmutableMap textures, LoadingCache cache) + public BakedWrapper(Node node, IModelState state, boolean smooth, boolean gui3d, VertexFormat format, ImmutableSet meshes, ImmutableMap textures, LoadingCache cache) { this.node = node; this.state = state; @@ -638,61 +637,113 @@ public class B3DLoader implements ICustomModelLoader this.cache = cache; } - // FIXME merge with handleBlockState @Override - public List getGeneralQuads() + public List func_188616_a(IBlockState state, EnumFacing side, long rand) { + if(side != null) return ImmutableList.of(); + IModelState modelState = this.state; + if(state instanceof IExtendedBlockState) + { + IExtendedBlockState exState = (IExtendedBlockState)state; + if(exState.getUnlistedNames().contains(B3DFrameProperty.instance)) + { + B3DState s = exState.getValue(B3DFrameProperty.instance); + if(s != null) + { + //return getCachedModel(s.getFrame()); + IModelState parent = this.state; + Animation newAnimation = s.getAnimation(); + if(parent instanceof B3DState) + { + B3DState ps = (B3DState)parent; + parent = ps.getParent(); + } + if(newAnimation == null) + { + newAnimation = node.getAnimation(); + } + if(s.getFrame() == s.getNextFrame()) + { + modelState = cache.getUnchecked(s.getFrame()); + } + else + { + modelState = new B3DState(newAnimation, s.getFrame(), s.getNextFrame(), s.getProgress(), parent); + } + } + } + else if(exState.getUnlistedNames().contains(Properties.AnimationProperty)) + { + // FIXME: should animation state handle the parent state, or should it remain here? + IModelState parent = this.state; + if(parent instanceof B3DState) + { + B3DState ps = (B3DState)parent; + parent = ps.getParent(); + } + IModelState newState = exState.getValue(Properties.AnimationProperty); + if(newState != null) + { + modelState = new ModelStateComposition(parent, newState); + } + } + } if(quads == null) { ImmutableList.Builder builder = ImmutableList.builder(); - for(Node child : node.getNodes().values()) - { - builder.addAll(new BakedWrapper(child, state, smooth, gui3d, format, meshes, textures).getGeneralQuads()); - } - if(node.getKind() instanceof Mesh && meshes.contains(node.getName())) - { - Mesh mesh = (Mesh)node.getKind(); - Collection faces = mesh.bake(new Function, Matrix4f>() - { - private final TRSRTransformation global = state.apply(Optional.absent()).or(TRSRTransformation.identity()); - private final LoadingCache, TRSRTransformation> localCache = CacheBuilder.newBuilder() - .maximumSize(32) - .build(new CacheLoader, TRSRTransformation>() - { - public TRSRTransformation load(Node node) throws Exception - { - return state.apply(Optional.of(new NodeJoint(node))).or(TRSRTransformation.identity()); - } - }); - - public Matrix4f apply(Node node) - { - return global.compose(localCache.getUnchecked(node)).getMatrix(); - } - }); - for(Face f : faces) - { - UnpackedBakedQuad.Builder quadBuilder = new UnpackedBakedQuad.Builder(format); - quadBuilder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z)); - quadBuilder.setQuadColored(); - List textures = null; - if(f.getBrush() != null) textures = f.getBrush().getTextures(); - TextureAtlasSprite sprite; - if(textures == null || textures.isEmpty()) sprite = this.textures.get("missingno"); - else if(textures.get(0) == B3DModel.Texture.White) sprite = ModelLoader.White.instance; - else sprite = this.textures.get(textures.get(0).getPath()); - putVertexData(quadBuilder, f.getV1(), f.getNormal(), sprite); - putVertexData(quadBuilder, f.getV2(), f.getNormal(), sprite); - putVertexData(quadBuilder, f.getV3(), f.getNormal(), sprite); - putVertexData(quadBuilder, f.getV3(), f.getNormal(), sprite); - builder.add(quadBuilder.build()); - } - } + generateQuads(builder, node, modelState); quads = builder.build(); } return quads; } + protected void generateQuads(ImmutableList.Builder builder, Node node, final IModelState state) + { + for(Node child : node.getNodes().values()) + { + generateQuads(builder, child, state); + } + if(node.getKind() instanceof Mesh && meshes.contains(node.getName())) + { + Mesh mesh = (Mesh)node.getKind(); + Collection faces = mesh.bake(new Function, Matrix4f>() + { + private final TRSRTransformation global = state.apply(Optional.absent()).or(TRSRTransformation.identity()); + private final LoadingCache, TRSRTransformation> localCache = CacheBuilder.newBuilder() + .maximumSize(32) + .build(new CacheLoader, TRSRTransformation>() + { + public TRSRTransformation load(Node node) throws Exception + { + return state.apply(Optional.of(new NodeJoint(node))).or(TRSRTransformation.identity()); + } + }); + + public Matrix4f apply(Node node) + { + return global.compose(localCache.getUnchecked(node)).getMatrix(); + } + }); + for(Face f : faces) + { + UnpackedBakedQuad.Builder quadBuilder = new UnpackedBakedQuad.Builder(format); + quadBuilder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z)); + quadBuilder.setQuadColored(); + List textures = null; + if(f.getBrush() != null) textures = f.getBrush().getTextures(); + TextureAtlasSprite sprite; + if(textures == null || textures.isEmpty()) sprite = this.textures.get("missingno"); + else if(textures.get(0) == B3DModel.Texture.White) sprite = ModelLoader.White.instance; + else sprite = this.textures.get(textures.get(0).getPath()); + putVertexData(quadBuilder, f.getV1(), f.getNormal(), sprite); + putVertexData(quadBuilder, f.getV2(), f.getNormal(), sprite); + putVertexData(quadBuilder, f.getV3(), f.getNormal(), sprite); + putVertexData(quadBuilder, f.getV3(), f.getNormal(), sprite); + builder.add(quadBuilder.build()); + } + } + } + private final void putVertexData(UnpackedBakedQuad.Builder builder, Vertex v, Vector3f faceNormal, TextureAtlasSprite sprite) { // TODO handle everything not handled (texture transformations, bones, transformations, normals, e.t.c) @@ -772,60 +823,16 @@ public class B3DLoader implements ICustomModelLoader return ItemCameraTransforms.DEFAULT; } - // FIXME merge with getQuads - @Override - public BakedWrapper handleBlockState(IBlockState state) - { - if(state instanceof IExtendedBlockState) - { - IExtendedBlockState exState = (IExtendedBlockState)state; - if(exState.getUnlistedNames().contains(B3DFrameProperty.instance)) - { - B3DState s = exState.getValue(B3DFrameProperty.instance); - if(s != null) - { - //return getCachedModel(s.getFrame()); - IModelState parent = this.state; - Animation newAnimation = s.getAnimation(); - if(parent instanceof B3DState) - { - B3DState ps = (B3DState)parent; - parent = ps.getParent(); - } - if(newAnimation == null) - { - newAnimation = node.getAnimation(); - } - if(s.getFrame() == s.getNextFrame()) - { - return cache.getUnchecked(s.getFrame()); - } - B3DState newState = new B3DState(newAnimation, s.getFrame(), s.getNextFrame(), s.getProgress(), parent); - return new BakedWrapper(node, newState, smooth, gui3d, format, meshes, textures); - } - } - else if(exState.getUnlistedNames().contains(Properties.AnimationProperty)) - { - // FIXME: should animation state handle the parent state, or should it remain here? - IModelState parent = this.state; - if(parent instanceof B3DState) - { - B3DState ps = (B3DState)parent; - parent = ps.getParent(); - } - IModelState newState = exState.getValue(Properties.AnimationProperty); - if(newState != null) - { - return new BakedWrapper(node, new ModelStateComposition(parent, newState), smooth, gui3d, format, meshes, textures); - } - } - } - return this; - } - public Pair handlePerspective(TransformType cameraTransformType) { return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, state, cameraTransformType); } + + @Override + public ItemOverrideList func_188617_f() + { + // TODO handle items + return ItemOverrideList.field_188022_a; + } } } From c5e10c8cb8aa46db4978e7ad8250a219129d0226 Mon Sep 17 00:00:00 2001 From: cpw Date: Fri, 4 Mar 2016 21:19:13 -0500 Subject: [PATCH 033/243] LanguageManager NetHandlerPlayClient --- .../network/NetHandlerPlayClient.java.patch | 23 ++++++++++++++++++- .../resources/LanguageManager.java.patch | 10 ++++++++ .../NetHandlerPlayClient.java.patch.rej | 23 ------------------- .../resources/LanguageManager.java.patch.rej | 9 -------- 4 files changed, 32 insertions(+), 33 deletions(-) create mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch delete mode 100644 rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch index 131b84df66..211b26c4ca 100644 --- a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch @@ -28,7 +28,19 @@ } } -@@ -1082,6 +1084,10 @@ +@@ -848,6 +850,11 @@ + float f = (float)(packetIn.getYaw() * 360) / 256.0F; + float f1 = (float)(packetIn.getPitch() * 360) / 256.0F; + EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.getEntityType(), this.gameController.theWorld); ++ if (entitylivingbase == null) ++ { ++ net.minecraftforge.fml.common.FMLLog.info("Server attempted to spawn an unknown entity using ID: {0} at ({1}, {2}, {3}) Skipping!", packetIn.getEntityType(), d0, d1, d2); ++ return; ++ } + EntityTracker.func_187254_a(entitylivingbase, d0, d1, d2); + entitylivingbase.renderYawOffset = entitylivingbase.rotationYawHead = (float)(packetIn.getHeadPitch() * 360) / 256.0F; + Entity[] aentity = entitylivingbase.getParts(); +@@ -1082,6 +1089,10 @@ { entityplayer.openContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e()); } @@ -39,3 +51,12 @@ } } +@@ -1378,7 +1389,7 @@ + + if (entity instanceof EntityLivingBase) + { +- Potion potion = Potion.func_188412_a(packetIn.getEffectId()); ++ Potion potion = Potion.func_188412_a(packetIn.getEffectId() & 0xFF); + + if (potion != null) + { diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch new file mode 100644 index 0000000000..e4bd44cd85 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/LanguageManager.java ++++ ../src-work/minecraft/net/minecraft/client/resources/LanguageManager.java +@@ -73,6 +73,7 @@ + } + + currentLocale.loadLocaleDataFiles(resourceManager, list); ++ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(currentLocale.properties, this.currentLanguage); + LanguageMap.replaceWith(currentLocale.properties); + } + diff --git a/rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej b/rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej deleted file mode 100644 index 24785c80a7..0000000000 --- a/rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej +++ /dev/null @@ -1,23 +0,0 @@ -++++ REJECTED PATCH 3 - float f = (float)(packetIn.getYaw() * 360) / 256.0F; - float f1 = (float)(packetIn.getPitch() * 360) / 256.0F; - EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.getEntityType(), this.gameController.theWorld); -+ if (entitylivingbase == null) -+ { -+ net.minecraftforge.fml.common.FMLLog.info("Server attempted to spawn an unknown entity using ID: {0} at ({1}, {2}, {3}) Skipping!", packetIn.getEntityType(), d0, d1, d2); -+ return; -+ } - entitylivingbase.serverPosX = packetIn.getX(); - entitylivingbase.serverPosY = packetIn.getY(); - entitylivingbase.serverPosZ = packetIn.getZ(); -++++ END PATCH -++++ REJECTED PATCH 5 - - if (entity instanceof EntityLivingBase) - { -- PotionEffect potioneffect = new PotionEffect(packetIn.getEffectId(), packetIn.getDuration(), packetIn.getAmplifier(), false, packetIn.func_179707_f()); -+ PotionEffect potioneffect = new PotionEffect(packetIn.getEffectId() & 0xff, packetIn.getDuration(), packetIn.getAmplifier(), false, packetIn.func_179707_f()); - potioneffect.setPotionDurationMax(packetIn.func_149429_c()); - ((EntityLivingBase)entity).addPotionEffect(potioneffect); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej deleted file mode 100644 index 0f67502075..0000000000 --- a/rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - } - - currentLocale.loadLocaleDataFiles(resourceManager, list); -+ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(currentLocale.properties, this.currentLanguage); - StringTranslate.replaceWith(currentLocale.properties); - } - -++++ END PATCH From 7735ff779104857b287906640321a95ee553f692 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sat, 5 Mar 2016 05:29:22 +0300 Subject: [PATCH 034/243] ModelBox, PositionTextureVertex, TexturedQuad. Does anyone really use those on the server? --- .../minecraft/client/model/ModelBox.java.patch | 8 ++++++++ .../model/PositionTextureVertex.java.patch | 13 +++++++++++++ .../client/model/TexturedQuad.java.patch | 18 ++++++++++++++++++ .../client/model/ModelBox.java.patch.rej | 9 --------- .../model/PositionTextureVertex.java.patch.rej | 12 ------------ .../client/model/TexturedQuad.java.patch.rej | 12 ------------ 6 files changed, 39 insertions(+), 33 deletions(-) create mode 100644 patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch delete mode 100644 rejects/minecraft/net/minecraft/client/model/ModelBox.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/model/TexturedQuad.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch index a1f4c6a456..5cacc5fd41 100644 --- a/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch @@ -8,3 +8,11 @@ public class ModelBox { private PositionTextureVertex[] vertexPositions; +@@ -81,6 +80,7 @@ + } + } + ++ @SideOnly(Side.CLIENT) + public void render(VertexBuffer renderer, float scale) + { + for (int i = 0; i < this.quadList.length; ++i) diff --git a/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch new file mode 100644 index 0000000000..1552e73aa0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/client/model/PositionTextureVertex.java ++++ ../src-work/minecraft/net/minecraft/client/model/PositionTextureVertex.java +@@ -1,10 +1,7 @@ + package net.minecraft.client.model; + + import net.minecraft.util.math.Vec3d; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public class PositionTextureVertex + { + public Vec3d vector3D; diff --git a/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch new file mode 100644 index 0000000000..1048fc20ce --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/client/model/TexturedQuad.java ++++ ../src-work/minecraft/net/minecraft/client/model/TexturedQuad.java +@@ -7,7 +7,6 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public class TexturedQuad + { + public PositionTextureVertex[] vertexPositions; +@@ -43,6 +42,7 @@ + this.vertexPositions = apositiontexturevertex; + } + ++ @SideOnly(Side.CLIENT) + public void draw(VertexBuffer renderer, float scale) + { + Vec3d vec3d = this.vertexPositions[1].vector3D.subtractReverse(this.vertexPositions[0].vector3D); diff --git a/rejects/minecraft/net/minecraft/client/model/ModelBox.java.patch.rej b/rejects/minecraft/net/minecraft/client/model/ModelBox.java.patch.rej deleted file mode 100644 index bb47a7107b..0000000000 --- a/rejects/minecraft/net/minecraft/client/model/ModelBox.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 2 - } - } - -+ @SideOnly(Side.CLIENT) - public void render(WorldRenderer renderer, float scale) - { - for (int i = 0; i < this.quadList.length; ++i) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch.rej b/rejects/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch.rej deleted file mode 100644 index c8880a5ec7..0000000000 --- a/rejects/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch.rej +++ /dev/null @@ -1,12 +0,0 @@ -++++ REJECTED PATCH 1 - package net.minecraft.client.model; - - import net.minecraft.util.Vec3; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public class PositionTextureVertex - { - public Vec3 vector3D; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/model/TexturedQuad.java.patch.rej b/rejects/minecraft/net/minecraft/client/model/TexturedQuad.java.patch.rej deleted file mode 100644 index b01f45d0fa..0000000000 --- a/rejects/minecraft/net/minecraft/client/model/TexturedQuad.java.patch.rej +++ /dev/null @@ -1,12 +0,0 @@ -++++ REJECTED PATCH 1 - import net.minecraft.client.renderer.WorldRenderer; - import net.minecraft.client.renderer.vertex.DefaultVertexFormats; - import net.minecraft.util.Vec3; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public class TexturedQuad - { - public PositionTextureVertex[] vertexPositions; -++++ END PATCH From 3c7bda77e3d834c86d62f3770a1f67dcec4870fd Mon Sep 17 00:00:00 2001 From: cpw Date: Fri, 4 Mar 2016 21:30:38 -0500 Subject: [PATCH 035/243] ServerPinger PlayerList --- .../client/network/ServerPinger.java.patch | 7 +- .../server/management/PlayerList.java.patch | 140 +++++++++--------- 2 files changed, 70 insertions(+), 77 deletions(-) rename rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej => patches.mcp/minecraft/net/minecraft/client/network/ServerPinger.java.patch (57%) rename rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej => patches.mcp/minecraft/net/minecraft/server/management/PlayerList.java.patch (65%) diff --git a/rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej b/patches.mcp/minecraft/net/minecraft/client/network/ServerPinger.java.patch similarity index 57% rename from rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/client/network/ServerPinger.java.patch index b9e4af4e1b..9323892313 100644 --- a/rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/client/network/ServerPinger.java.patch @@ -1,9 +1,10 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/client/network/ServerPinger.java ++++ ../src-work/minecraft/net/minecraft/client/network/ServerPinger.java +@@ -150,6 +150,7 @@ server.setBase64EncodedIconData((String)null); } + net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(server, serverstatusresponse); this.field_175092_e = Minecraft.getSystemTime(); - networkmanager.sendPacket(new C01PacketPing(this.field_175092_e)); + networkmanager.sendPacket(new CPacketPing(this.field_175092_e)); this.field_147403_d = true; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej b/patches.mcp/minecraft/net/minecraft/server/management/PlayerList.java.patch similarity index 65% rename from rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej rename to patches.mcp/minecraft/net/minecraft/server/management/PlayerList.java.patch index 44d627c7e8..8ee09c07aa 100644 --- a/rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej +++ b/patches.mcp/minecraft/net/minecraft/server/management/PlayerList.java.patch @@ -1,4 +1,6 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/server/management/PlayerList.java ++++ ../src-work/minecraft/net/minecraft/server/management/PlayerList.java +@@ -101,7 +101,7 @@ this.maxPlayers = 8; } @@ -7,8 +9,7 @@ { GameProfile gameprofile = playerIn.getGameProfile(); PlayerProfileCache playerprofilecache = this.mcServer.getPlayerProfileCache(); -++++ END PATCH -++++ REJECTED PATCH 2 +@@ -110,6 +110,17 @@ playerprofilecache.addEntry(gameprofile); NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(playerIn); playerIn.setWorld(this.mcServer.worldServerForDimension(playerIn.dimension)); @@ -16,8 +17,8 @@ + World playerWorld = this.mcServer.worldServerForDimension(playerIn.dimension); + if (playerWorld == null) + { -+ playerIn.dimension=0; -+ playerWorld=this.mcServer.worldServerForDimension(0); ++ playerIn.dimension = 0; ++ playerWorld = this.mcServer.worldServerForDimension(0); + BlockPos spawnPoint = playerWorld.provider.getRandomizedSpawnPoint(); + playerIn.setPosition(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ()); + } @@ -26,36 +27,32 @@ playerIn.theItemInWorldManager.setWorld((WorldServer)playerIn.worldObj); String s1 = "local"; -++++ END PATCH -++++ REJECTED PATCH 3 +@@ -123,7 +134,7 @@ WorldInfo worldinfo = worldserver.getWorldInfo(); BlockPos blockpos = worldserver.getSpawnPoint(); this.setPlayerGameTypeBasedOnOther(playerIn, (EntityPlayerMP)null, worldserver); - NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.mcServer, netManager, playerIn); + playerIn.playerNetServerHandler = nethandlerplayserver; - nethandlerplayserver.sendPacket(new S01PacketJoinGame(playerIn.getEntityId(), playerIn.theItemInWorldManager.getGameType(), worldinfo.isHardcoreModeEnabled(), worldserver.provider.getDimensionId(), worldserver.getDifficulty(), this.getMaxPlayers(), worldinfo.getTerrainType(), worldserver.getGameRules().getBoolean("reducedDebugInfo"))); - nethandlerplayserver.sendPacket(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(this.getServerInstance().getServerModName()))); - nethandlerplayserver.sendPacket(new S41PacketServerDifficulty(worldinfo.getDifficulty(), worldinfo.isDifficultyLocked())); -++++ END PATCH -++++ REJECTED PATCH 4 + nethandlerplayserver.sendPacket(new SPacketJoinGame(playerIn.getEntityId(), playerIn.theItemInWorldManager.getGameType(), worldinfo.isHardcoreModeEnabled(), worldserver.provider.func_186058_p().func_186068_a(), worldserver.getDifficulty(), this.getMaxPlayers(), worldinfo.getTerrainType(), worldserver.getGameRules().getBoolean("reducedDebugInfo"))); + nethandlerplayserver.sendPacket(new SPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(this.getServerInstance().getServerModName()))); + nethandlerplayserver.sendPacket(new SPacketServerDifficulty(worldinfo.getDifficulty(), worldinfo.isDifficultyLocked())); +@@ -213,6 +224,7 @@ + } playerIn.addSelfToInternalCraftingInventory(); - + net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(playerIn); - if (nbttagcompound != null && nbttagcompound.hasKey("Riding", 10)) - { - Entity entity = EntityList.createEntityFromNBT(nbttagcompound.getCompoundTag("Riding"), worldserver); -++++ END PATCH -++++ REJECTED PATCH 5 - playerIn.readFromNBT(nbttagcompound); - nbttagcompound1 = nbttagcompound; + } + + protected void sendScoreboard(ServerScoreboard scoreboardIn, EntityPlayerMP playerIn) +@@ -302,6 +314,7 @@ + nbttagcompound1 = this.mcServer.func_184110_aI().func_188257_a(FixTypes.PLAYER, nbttagcompound); + playerIn.readFromNBT(nbttagcompound1); logger.debug("loading single player"); + net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(playerIn, this.playerNBTManagerObj, playerIn.getUniqueID().toString()); } else { -++++ END PATCH -++++ REJECTED PATCH 6 +@@ -311,8 +324,24 @@ return nbttagcompound1; } @@ -72,6 +69,7 @@ + return ((net.minecraft.world.storage.SaveHandler)this.playerNBTManagerObj).getPlayerNBT(player); + } + } ++ protected void writePlayerData(EntityPlayerMP playerIn) { + if (playerIn.playerNetServerHandler == null) return; @@ -79,35 +77,31 @@ this.playerNBTManagerObj.writePlayerData(playerIn); StatisticsFile statisticsfile = (StatisticsFile)this.playerStatFiles.get(playerIn.getUniqueID()); -++++ END PATCH -++++ REJECTED PATCH 7 - this.uuidToPlayerMap.put(playerIn.getUniqueID(), playerIn); - this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {playerIn})); - WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); +@@ -334,6 +363,7 @@ + playerIn.playerNetServerHandler.sendPacket(new SPacketPlayerListItem(SPacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {(EntityPlayerMP)this.playerEntityList.get(i)})); + } + + net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); worldserver.spawnEntityInWorld(playerIn); this.preparePlayer(playerIn, (WorldServer)null); - -++++ END PATCH -++++ REJECTED PATCH 8 + } +@@ -345,6 +375,7 @@ public void playerLoggedOut(EntityPlayerMP playerIn) { + net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(playerIn); + WorldServer worldserver = playerIn.getServerForPlayer(); playerIn.triggerAchievement(StatList.leaveGameStat); this.writePlayerData(playerIn); - WorldServer worldserver = playerIn.getServerForPlayer(); -++++ END PATCH -++++ REJECTED PATCH 9 +@@ -379,6 +410,7 @@ this.uuidToPlayerMap.remove(uuid); this.playerStatFiles.remove(uuid); } + net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); - this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn})); + this.sendPacketToAllPlayers(new SPacketPlayerListItem(SPacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn})); } -++++ END PATCH -++++ REJECTED PATCH 10 +@@ -462,13 +494,23 @@ public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd) { @@ -123,7 +117,7 @@ + playerIn.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(playerIn); playerIn.getServerForPlayer().getEntityTracker().untrackEntity(playerIn); - playerIn.getServerForPlayer().getPlayerManager().removePlayer(playerIn); + playerIn.getServerForPlayer().func_184164_w().removePlayer(playerIn); this.playerEntityList.remove(playerIn); this.mcServer.worldServerForDimension(playerIn.dimension).removePlayerEntityDangerously(playerIn); - BlockPos blockpos = playerIn.getBedLocation(); @@ -131,19 +125,19 @@ + BlockPos blockpos = playerIn.getBedLocation(dimension); + boolean flag = playerIn.isSpawnForced(dimension); playerIn.dimension = dimension; - ItemInWorldManager iteminworldmanager; + PlayerInteractionManager playerinteractionmanager; -++++ END PATCH -++++ REJECTED PATCH 11 - EntityPlayerMP entityplayermp = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), iteminworldmanager); +@@ -484,7 +526,8 @@ + EntityPlayerMP entityplayermp = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), playerinteractionmanager); entityplayermp.playerNetServerHandler = playerIn.playerNetServerHandler; entityplayermp.clonePlayer(playerIn, conqueredEnd); +- entityplayermp.setEntityId(playerIn.getEntityId()); + entityplayermp.dimension = dimension; - entityplayermp.setEntityId(playerIn.getEntityId()); ++ entityplayermp.setEntityId(playerIn.getEntityId()); entityplayermp.func_174817_o(playerIn); - WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); -++++ END PATCH -++++ REJECTED PATCH 12 + entityplayermp.func_184819_a(playerIn.func_184591_cq()); + +@@ -531,6 +574,7 @@ this.uuidToPlayerMap.put(entityplayermp.getUniqueID(), entityplayermp); entityplayermp.addSelfToInternalCraftingInventory(); entityplayermp.setHealth(entityplayermp.getHealth()); @@ -151,32 +145,34 @@ return entityplayermp; } - public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension) +@@ -545,15 +589,20 @@ + + public void func_187242_a(EntityPlayerMP p_187242_1_, int p_187242_2_) { -+ transferPlayerToDimension(playerIn, dimension, mcServer.worldServerForDimension(dimension).getDefaultTeleporter()); ++ transferPlayerToDimension(p_187242_1_, p_187242_2_, mcServer.worldServerForDimension(p_187242_2_).getDefaultTeleporter()); + } + -+ public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension, net.minecraft.world.Teleporter teleporter) ++ public void transferPlayerToDimension(EntityPlayerMP p_187242_1_, int p_187242_2_, net.minecraft.world.Teleporter teleporter) + { - int i = playerIn.dimension; - WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); - playerIn.dimension = dimension; - WorldServer worldserver1 = this.mcServer.worldServerForDimension(playerIn.dimension); -- playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, playerIn.worldObj.getDifficulty(), playerIn.worldObj.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); -+ playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); - worldserver.removePlayerEntityDangerously(playerIn); - playerIn.isDead = false; -- this.transferEntityToWorld(playerIn, i, worldserver, worldserver1); -+ this.transferEntityToWorld(playerIn, i, worldserver, worldserver1, teleporter); - this.preparePlayer(playerIn, worldserver); - playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch); - playerIn.theItemInWorldManager.setWorld(worldserver1); -++++ END PATCH -++++ REJECTED PATCH 13 + int i = p_187242_1_.dimension; + WorldServer worldserver = this.mcServer.worldServerForDimension(p_187242_1_.dimension); + p_187242_1_.dimension = p_187242_2_; + WorldServer worldserver1 = this.mcServer.worldServerForDimension(p_187242_1_.dimension); +- p_187242_1_.playerNetServerHandler.sendPacket(new SPacketRespawn(p_187242_1_.dimension, p_187242_1_.worldObj.getDifficulty(), p_187242_1_.worldObj.getWorldInfo().getTerrainType(), p_187242_1_.theItemInWorldManager.getGameType())); ++ p_187242_1_.playerNetServerHandler.sendPacket(new SPacketRespawn(p_187242_1_.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), p_187242_1_.theItemInWorldManager.getGameType())); + this.func_187243_f(p_187242_1_); + worldserver.removePlayerEntityDangerously(p_187242_1_); + p_187242_1_.isDead = false; +- this.transferEntityToWorld(p_187242_1_, i, worldserver, worldserver1); ++ this.transferEntityToWorld(p_187242_1_, i, worldserver, worldserver1, teleporter); + this.preparePlayer(p_187242_1_, worldserver); + p_187242_1_.playerNetServerHandler.setPlayerLocation(p_187242_1_.posX, p_187242_1_.posY, p_187242_1_.posZ, p_187242_1_.rotationYaw, p_187242_1_.rotationPitch); + p_187242_1_.theItemInWorldManager.setWorld(worldserver1); +@@ -565,17 +614,27 @@ { - playerIn.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), potioneffect)); + p_187242_1_.playerNetServerHandler.sendPacket(new SPacketEntityEffect(p_187242_1_.getEntityId(), potioneffect)); } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(playerIn, i, dimension); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_187242_1_, i, p_187242_2_); } public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) @@ -199,22 +195,20 @@ p_82448_3_.theProfiler.startSection("moving"); - if (entityIn.dimension == -1) -+ if (false && entityIn.dimension == -1) //Forge Kill it but dont comment out so we can rename it. ++ if (false && entityIn.dimension == -1) { d0 = MathHelper.clamp_double(d0 / d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); d1 = MathHelper.clamp_double(d1 / d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); -++++ END PATCH -++++ REJECTED PATCH 14 +@@ -586,7 +645,7 @@ p_82448_3_.updateEntityWithOptionalForce(entityIn, false); } } - else if (entityIn.dimension == 0) -+ else if (false && entityIn.dimension == 0) //Forge Kill it but dont comment out so we can rename it. ++ else if (false && entityIn.dimension == 0) { d0 = MathHelper.clamp_double(d0 * d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); d1 = MathHelper.clamp_double(d1 * d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); -++++ END PATCH -++++ REJECTED PATCH 15 +@@ -597,7 +656,8 @@ p_82448_3_.updateEntityWithOptionalForce(entityIn, false); } } @@ -224,8 +218,7 @@ { BlockPos blockpos; -++++ END PATCH -++++ REJECTED PATCH 16 +@@ -632,7 +692,7 @@ if (entityIn.isEntityAlive()) { entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch); @@ -234,4 +227,3 @@ p_82448_4_.spawnEntityInWorld(entityIn); p_82448_4_.updateEntityWithOptionalForce(entityIn, false); } -++++ END PATCH From 0f2cead3c886bb7763441a5c5721bc73ddddce37 Mon Sep 17 00:00:00 2001 From: cpw Date: Fri, 4 Mar 2016 22:11:43 -0500 Subject: [PATCH 036/243] WorldServer: NOTE - ChestGenHooks has NOT been updated in accordance with plans for removing it GuiStats Fixup deletion of egg handling in entity registry? --- .../gui/achievement/GuiStats.java.patch | 11 -- .../minecraft/world/WorldServer.java.patch | 111 ++++++++++++++++-- .../gui/achievement/GuiStats.java.patch.rej | 62 ---------- .../world/WorldServer.java.patch.rej | 108 ----------------- .../fml/common/registry/EntityRegistry.java | 28 +++++ 5 files changed, 127 insertions(+), 193 deletions(-) delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch delete mode 100644 rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch deleted file mode 100644 index d120f752da..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiStats.java -+++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiStats.java -@@ -877,7 +877,7 @@ - super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, GuiStats.this.fontRendererObj.FONT_HEIGHT * 4); - this.setShowSelectionBox(false); - -- for (EntityList.EntityEggInfo entitylist$entityegginfo : EntityList.entityEggs.values()) -+ for (EntityList.EntityEggInfo entitylist$entityegginfo : com.google.common.collect.Iterables.concat(EntityList.entityEggs.values(), net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().values())) - { - if (GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d) > 0 || GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e) > 0) - { diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch index 3e6d94c700..606ef18568 100644 --- a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch @@ -1,6 +1,48 @@ --- ../src-base/minecraft/net/minecraft/world/WorldServer.java +++ ../src-work/minecraft/net/minecraft/world/WorldServer.java -@@ -214,6 +214,10 @@ +@@ -97,30 +97,39 @@ + private int blockEventCacheIndex; + private List pendingTickListEntriesThisTick = Lists.newArrayList(); + ++ /** Stores the recently processed (lighting) chunks */ ++ protected Set doneChunks = new java.util.HashSet(); ++ public List customTeleporters = new ArrayList(); ++ + public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) + { + super(saveHandlerIn, info, DimensionType.func_186069_a(dimensionId).func_186070_d(), profilerIn, false); + this.mcServer = server; + this.theEntityTracker = new EntityTracker(this); + this.thePlayerManager = new PlayerManager(this); ++ // Guarantee the dimension ID was not reset by the provider ++ int providerDim = this.provider.dimensionId; + this.provider.registerWorld(this); ++ this.provider.dimensionId = providerDim; + this.chunkProvider = this.createChunkProvider(); ++ perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn)); + this.worldTeleporter = new Teleporter(this); + this.calculateInitialSkylight(); + this.calculateInitialWeather(); + this.getWorldBorder().setSize(server.getMaxWorldSize()); ++ net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this); + } + + public World init() + { + this.mapStorage = new MapStorage(this.saveHandler); + String s = VillageCollection.fileNameForProvider(this.provider); +- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); ++ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); + + if (villagecollection == null) + { + this.villageCollectionObj = new VillageCollection(this); +- this.mapStorage.setData(s, this.villageCollectionObj); ++ this.perWorldStorage.setData(s, this.villageCollectionObj); + } + else + { +@@ -214,6 +223,10 @@ this.villageSiege.tick(); this.theProfiler.endStartSection("portalForcer"); this.worldTeleporter.removeStalePortalLocations(this.getTotalWorldTime()); @@ -11,7 +53,7 @@ this.theProfiler.endSection(); this.sendQueuedBlockEvents(); } -@@ -221,12 +225,14 @@ +@@ -221,12 +234,14 @@ public BiomeGenBase.SpawnListEntry getSpawnListEntryForTypeAt(EnumCreatureType creatureType, BlockPos pos) { List list = this.getChunkProvider().getPossibleCreatures(creatureType, pos); @@ -26,7 +68,7 @@ return list != null && !list.isEmpty() ? list.contains(spawnListEntry) : false; } -@@ -272,10 +278,7 @@ +@@ -272,10 +287,7 @@ private void resetRainAndThunder() { @@ -38,7 +80,16 @@ } public boolean areAllPlayersAsleep() -@@ -409,7 +412,7 @@ +@@ -380,7 +392,7 @@ + chunk.func_150804_b(false); + this.theProfiler.endStartSection("thunder"); + +- if (flag && flag1 && this.rand.nextInt(100000) == 0) ++ if (this.provider.canDoLightning(chunk) && flag && flag1 && this.rand.nextInt(100000) == 0) + { + this.updateLCG = this.updateLCG * 3 + 1013904223; + int l = this.updateLCG >> 2; +@@ -409,7 +421,7 @@ this.theProfiler.endStartSection("iceandsnow"); @@ -47,7 +98,7 @@ { this.updateLCG = this.updateLCG * 3 + 1013904223; int j2 = this.updateLCG >> 2; -@@ -527,6 +530,9 @@ +@@ -527,6 +539,9 @@ if (blockIn.requiresUpdates()) { i = 8; @@ -57,7 +108,7 @@ if (this.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i))) { -@@ -588,7 +594,7 @@ +@@ -588,7 +603,7 @@ public void updateEntities() { @@ -66,7 +117,7 @@ { if (this.updateEntityTick++ >= 300) { -@@ -712,6 +718,9 @@ +@@ -712,6 +727,9 @@ { NextTickListEntry nextticklistentry1 = (NextTickListEntry)iterator.next(); iterator.remove(); @@ -76,7 +127,7 @@ int k = 0; if (this.isAreaLoaded(nextticklistentry1.position.add(-k, -k, -k), nextticklistentry1.position.add(k, k, k))) -@@ -838,22 +847,40 @@ +@@ -838,22 +856,40 @@ { List list = Lists.newArrayList(); @@ -124,7 +175,7 @@ return !this.mcServer.isBlockProtected(this, pos, player) && this.getWorldBorder().contains(pos); } -@@ -919,6 +946,7 @@ +@@ -919,6 +955,7 @@ } else { @@ -132,7 +183,15 @@ this.findingSpawnPoint = true; BiomeProvider biomeprovider = this.provider.getWorldChunkManager(); List list = biomeprovider.getBiomesToSpawnIn(); -@@ -1047,6 +1075,7 @@ +@@ -1003,6 +1040,7 @@ + } + + chunkproviderserver.func_186027_a(p_73044_1_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); + + for (Chunk chunk : Lists.newArrayList(chunkproviderserver.func_152380_a())) + { +@@ -1047,6 +1085,7 @@ this.worldInfo.setBorderLerpTime(this.getWorldBorder().getTimeUntilTarget()); this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.func_184103_al().getHostPlayerData()); this.mapStorage.saveAllData(); @@ -140,7 +199,7 @@ } public boolean spawnEntityInWorld(Entity entityIn) -@@ -1161,6 +1190,7 @@ +@@ -1161,6 +1200,7 @@ public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) { Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking); @@ -148,7 +207,35 @@ explosion.doExplosionA(); explosion.doExplosionB(false); -@@ -1329,6 +1359,11 @@ +@@ -1240,19 +1280,23 @@ + this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(8, this.thunderingStrength), this.provider.func_186058_p().func_186068_a()); + } + ++ /* The function in use here has been replaced in order to only send the weather info to players in the correct dimension, ++ * rather than to all players on the server. This is what causes the client-side rain, as the ++ * client believes that it has started raining locally, rather than in another dimension. ++ */ + if (flag != this.isRaining()) + { + if (flag) + { +- this.mcServer.func_184103_al().sendPacketToAllPlayers(new SPacketChangeGameState(2, 0.0F)); ++ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(2, 0.0F), this.provider.dimensionId); + } + else + { +- this.mcServer.func_184103_al().sendPacketToAllPlayers(new SPacketChangeGameState(1, 0.0F)); ++ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(1, 0.0F), this.provider.dimensionId); + } + +- this.mcServer.func_184103_al().sendPacketToAllPlayers(new SPacketChangeGameState(7, this.rainingStrength)); +- this.mcServer.func_184103_al().sendPacketToAllPlayers(new SPacketChangeGameState(8, this.thunderingStrength)); ++ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); ++ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); + } + } + +@@ -1329,6 +1373,11 @@ return this.mcServer.isCallingFromMinecraftThread(); } diff --git a/rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej deleted file mode 100644 index 52c077ed65..0000000000 --- a/rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej +++ /dev/null @@ -1,62 +0,0 @@ -++++ REJECTED PATCH 1 - import java.util.Collections; - import java.util.Comparator; - import java.util.List; -+ -+import net.minecraft.block.Block; - import net.minecraft.client.Minecraft; - import net.minecraft.client.audio.PositionedSoundRecord; - import net.minecraft.client.gui.GuiButton; -++++ END PATCH -++++ REJECTED PATCH 2 - for (StatCrafting statcrafting : StatList.objectMineStats) - { - boolean flag = false; -- int i = Item.getIdFromItem(statcrafting.func_150959_a()); -+ int i = Block.getIdFromBlock(Block.getBlockFromItem(statcrafting.func_150959_a())); -+ int itemId = Item.getIdFromItem(statcrafting.func_150959_a()); - - if (GuiStats.this.field_146546_t.readStat(statcrafting) > 0) - { - flag = true; - } -- else if (StatList.objectUseStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectUseStats[i]) > 0) -+ else if (StatList.objectUseStats[itemId] != null && GuiStats.this.field_146546_t.readStat(StatList.objectUseStats[itemId]) > 0) - { - flag = true; - } -- else if (StatList.objectCraftStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectCraftStats[i]) > 0) -+ else if (StatList.objectCraftStats[itemId] != null && GuiStats.this.field_146546_t.readStat(StatList.objectCraftStats[itemId]) > 0) - { - flag = true; - } -++++ END PATCH -++++ REJECTED PATCH 3 - { - public int compare(StatCrafting p_compare_1_, StatCrafting p_compare_2_) - { -- int j = Item.getIdFromItem(p_compare_1_.func_150959_a()); -- int k = Item.getIdFromItem(p_compare_2_.func_150959_a()); -+ int j; -+ int k; -+ if (StatsBlock.this.field_148217_o == 2) { -+ j = Block.getIdFromBlock(Block.getBlockFromItem(p_compare_1_.func_150959_a())); -+ k = Block.getIdFromBlock(Block.getBlockFromItem(p_compare_2_.func_150959_a())); -+ } else { -+ j = Item.getIdFromItem(p_compare_1_.func_150959_a()); -+ k = Item.getIdFromItem(p_compare_2_.func_150959_a()); -+ } - StatBase statbase = null; - StatBase statbase1 = null; - -++++ END PATCH -++++ REJECTED PATCH 5 - protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) - { - EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(entryID); -- String s = I18n.format("entity." + EntityList.getStringFromID(entitylist$entityegginfo.spawnedID) + ".name", new Object[0]); -+ String s = I18n.format("entity." + entitylist$entityegginfo.name + ".name", new Object[0]); - int i = GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d); - int j = GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e); - String s1 = I18n.format("stat.entityKills", new Object[] {Integer.valueOf(i), s}); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej b/rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej deleted file mode 100644 index 217fa3a260..0000000000 --- a/rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej +++ /dev/null @@ -1,108 +0,0 @@ -++++ REJECTED PATCH 1 - private static final List bonusChestContent = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.stick, 0, 1, 3, 10), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.planks), 0, 1, 3, 10), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.log), 0, 1, 3, 10), new WeightedRandomChestContent(Items.stone_axe, 0, 1, 1, 3), new WeightedRandomChestContent(Items.wooden_axe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.stone_pickaxe, 0, 1, 1, 3), new WeightedRandomChestContent(Items.wooden_pickaxe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.apple, 0, 2, 3, 5), new WeightedRandomChestContent(Items.bread, 0, 2, 3, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.log2), 0, 1, 3, 10)}); - private List pendingTickListEntriesThisTick = Lists.newArrayList(); - -+ /** Stores the recently processed (lighting) chunks */ -+ protected Set doneChunks = new java.util.HashSet(); -+ public List customTeleporters = new ArrayList(); -+ private static boolean initChest = false; -+ public static void fillChestHook() -+ { -+ if (!initChest) -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.BONUS_CHEST, bonusChestContent, 10, 10); -+ initChest = true; -+ } -+ - public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) - { - super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false); - this.mcServer = server; - this.theEntityTracker = new EntityTracker(this); - this.thePlayerManager = new PlayerManager(this); -+ // Guarantee the dimension ID was not reset by the provider -+ int providerDim = this.provider.dimensionId; - this.provider.registerWorld(this); -+ this.provider.dimensionId = providerDim; - this.chunkProvider = this.createChunkProvider(); -+ perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn)); - this.worldTeleporter = new Teleporter(this); - this.calculateInitialSkylight(); - this.calculateInitialWeather(); - this.getWorldBorder().setSize(server.getMaxWorldSize()); -+ net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this); - } - - public World init() - { - this.mapStorage = new MapStorage(this.saveHandler); - String s = VillageCollection.fileNameForProvider(this.provider); -- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); -+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); - - if (villagecollection == null) - { - this.villageCollectionObj = new VillageCollection(this); -- this.mapStorage.setData(s, this.villageCollectionObj); -+ this.perWorldStorage.setData(s, this.villageCollectionObj); - } - else - { -++++ END PATCH -++++ REJECTED PATCH 5 - chunk.func_150804_b(false); - this.theProfiler.endStartSection("thunder"); - -- if (this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) -+ if (this.provider.canDoLightning(chunk) && this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) - { - this.updateLCG = this.updateLCG * 3 + 1013904223; - int i1 = this.updateLCG >> 2; -++++ END PATCH -++++ REJECTED PATCH 12 - - protected void createBonusChest() - { -- WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(bonusChestContent, 10); -+ WorldGeneratorBonusChest worldgeneratorbonuschest = net.minecraftforge.common.ForgeHooks.getBonusChest(rand); - - for (int i = 0; i < 10; ++i) - { -++++ END PATCH -++++ REJECTED PATCH 13 - } - - this.chunkProvider.saveChunks(p_73044_1_, progressCallback); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); - - for (Chunk chunk : Lists.newArrayList(this.theChunkProviderServer.func_152380_a())) - { -++++ END PATCH -++++ REJECTED PATCH 16 - this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionId()); - } - -+ /* The function in use here has been replaced in order to only send the weather info to players in the correct dimension, -+ * rather than to all players on the server. This is what causes the client-side rain, as the -+ * client believes that it has started raining locally, rather than in another dimension. -+ */ - if (flag != this.isRaining()) - { - if (flag) - { -- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F)); -+ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(2, 0.0F), this.provider.dimensionId); - } - else - { -- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(1, 0.0F)); -+ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(1, 0.0F), this.provider.dimensionId); - } - -- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, this.rainingStrength)); -- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, this.thunderingStrength)); -+ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); -+ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); - } - } - -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java index 7a6506ca03..51fb8e02a0 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java @@ -198,6 +198,34 @@ public class EntityRegistry entityRegistrations.put(mc, er); } + /** + * Registers a spawn egg for the specified entity class. + * The class must already be registered in the EntityList.classToStringMapping. + * This can be done either by using the global ID system, or preferably the registerModEntity functions above. + * Once registered mob eggs can be created by using minecraft:spawn_egg with NBT entry 'entity_name' with + * value of the name this class is registered in the classToStringMapping with. + * + * @param entityClass The entity class + * @param primary Primary egg color + * @param secondary Secondary egg color + * + * @throws IllegalArgumentException if entityClass is not registered in classToStringMapping. + * + */ + + public static void registerEgg(Class entityClass, int primary, int secondary) + { + if (EntityList.classToStringMapping.containsKey(entityClass)) + { + String name = EntityList.classToStringMapping.get(entityClass); + EntityList.entityEggs.put(name, new EntityList.EntityEggInfo(name, primary, secondary)); + FMLLog.fine("Registering entity egg '%s' for %s", name, entityClass); + } + else + { + FMLLog.fine("Failed registering entity egg %s (No entity found)", entityClass.getName()); + } + } /** * Registers in the minecraft Entity ID list. This is generally not a good idea and shouldn't be used. * Simply use {@link #registerModEntity(Class, String, int, Object, int, int, boolean, int, int)} instead. From 70670d70ea2b6f5c5e45d71935024924b472f8c2 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sun, 6 Mar 2016 01:31:54 +0300 Subject: [PATCH 037/243] Removed generics from IModel subinterfaces, add ed ModelProcessingHelper instead. --- .../client/model/BlockStateLoader.java | 19 ++------- .../client/model/IModelCustomData.java | 4 +- .../client/model/IModelSimpleProperties.java | 6 +-- .../client/model/IRetexturableModel.java | 4 +- .../client/model/ItemLayerModel.java | 2 +- .../client/model/ModelDynBucket.java | 2 +- .../client/model/ModelFluid.java | 2 +- .../client/model/ModelLoader.java | 2 +- .../client/model/ModelProcessingHelper.java | 42 +++++++++++++++++++ .../client/model/MultiLayerModel.java | 2 +- .../client/model/b3d/B3DLoader.java | 2 +- .../client/model/obj/OBJModel.java | 2 +- .../debug/ModelAnimationDebug.java | 11 ++--- 13 files changed, 63 insertions(+), 37 deletions(-) create mode 100644 src/main/java/net/minecraftforge/client/model/ModelProcessingHelper.java diff --git a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java index 8a0081f6d7..65f40be4bc 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java +++ b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java @@ -148,21 +148,10 @@ public class BlockStateLoader private IModel runModelHooks(IModel base, boolean smooth, boolean gui3d, ImmutableMap textureMap, ImmutableMap customData) { - if (!customData.isEmpty() && base instanceof IModelCustomData) - { - base = ((IModelCustomData)base).process(customData); - } - - if (!textureMap.isEmpty() && base instanceof IRetexturableModel) - { - base = ((IRetexturableModel)base).retexture(textureMap); - } - - if (base instanceof IModelSimpleProperties) - { - base = ((IModelSimpleProperties) base).smoothLighting(smooth).gui3d(gui3d); - } - + base = ModelProcessingHelper.customData(base, customData); + base = ModelProcessingHelper.retexture(base, textureMap); + base = ModelProcessingHelper.smoothLighting(base, smooth); + base = ModelProcessingHelper.gui3d(base, gui3d); return base; } diff --git a/src/main/java/net/minecraftforge/client/model/IModelCustomData.java b/src/main/java/net/minecraftforge/client/model/IModelCustomData.java index ec5471645a..76d8e10397 100644 --- a/src/main/java/net/minecraftforge/client/model/IModelCustomData.java +++ b/src/main/java/net/minecraftforge/client/model/IModelCustomData.java @@ -2,12 +2,12 @@ package net.minecraftforge.client.model; import com.google.common.collect.ImmutableMap; -public interface IModelCustomData> extends IModel +public interface IModelCustomData extends IModel { /** * Allows the model to process custom data from the variant definition. * If unknown data is encountered it should be skipped. * @return a new model, with data applied. */ - M process(ImmutableMap customData); + IModel process(ImmutableMap customData); } diff --git a/src/main/java/net/minecraftforge/client/model/IModelSimpleProperties.java b/src/main/java/net/minecraftforge/client/model/IModelSimpleProperties.java index 0e963ef057..0c9b7858ab 100644 --- a/src/main/java/net/minecraftforge/client/model/IModelSimpleProperties.java +++ b/src/main/java/net/minecraftforge/client/model/IModelSimpleProperties.java @@ -3,8 +3,8 @@ package net.minecraftforge.client.model; /** * Implement this if the model can process "smooth_lighting" or "gui3d" attributes from the json. */ -public interface IModelSimpleProperties> extends IModel +public interface IModelSimpleProperties extends IModel { - M smoothLighting(boolean value); - M gui3d(boolean value); + IModel smoothLighting(boolean value); + IModel gui3d(boolean value); } diff --git a/src/main/java/net/minecraftforge/client/model/IRetexturableModel.java b/src/main/java/net/minecraftforge/client/model/IRetexturableModel.java index 98016dcc64..eb6248706a 100644 --- a/src/main/java/net/minecraftforge/client/model/IRetexturableModel.java +++ b/src/main/java/net/minecraftforge/client/model/IRetexturableModel.java @@ -2,7 +2,7 @@ package net.minecraftforge.client.model; import com.google.common.collect.ImmutableMap; -public interface IRetexturableModel> extends IModel +public interface IRetexturableModel extends IModel { /** * Applies new textures to the model. @@ -21,5 +21,5 @@ public interface IRetexturableModel> extends IMo * @param textures New * @return Model with textures applied. */ - M retexture(ImmutableMap textures); + IModel retexture(ImmutableMap textures); } diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index f129e83a58..4bc494ba13 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -29,7 +29,7 @@ import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -public class ItemLayerModel implements IRetexturableModel +public class ItemLayerModel implements IRetexturableModel { public static final ItemLayerModel instance = new ItemLayerModel(ImmutableList.of()); diff --git a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java index 932ebfc531..6dd0d0e948 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java +++ b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java @@ -39,7 +39,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; -public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableModel +public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableModel { public static final ModelResourceLocation LOCATION = new ModelResourceLocation(new ResourceLocation("forge", "dynbucket"), "inventory"); diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index d08f4af9eb..67a73e8a2b 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -43,7 +43,7 @@ import com.google.common.collect.Maps; import com.google.gson.JsonElement; import com.google.gson.JsonParser; -public class ModelFluid implements IModelCustomData +public class ModelFluid implements IModelCustomData { public static final ModelFluid waterModel = new ModelFluid(FluidRegistry.WATER); public static final ModelFluid lavaModel = new ModelFluid(FluidRegistry.LAVA); diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index eb7731776c..cac257b47f 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -409,7 +409,7 @@ public class ModelLoader extends ModelBakery textures.addAll(model.getTextures()); } - private class VanillaModelWrapper implements IRetexturableModel, IModelSimpleProperties, IAnimatedModel + private class VanillaModelWrapper implements IRetexturableModel, IModelSimpleProperties, IAnimatedModel { private final ResourceLocation location; private final ModelBlock model; diff --git a/src/main/java/net/minecraftforge/client/model/ModelProcessingHelper.java b/src/main/java/net/minecraftforge/client/model/ModelProcessingHelper.java new file mode 100644 index 0000000000..a9b9e26e51 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/ModelProcessingHelper.java @@ -0,0 +1,42 @@ +package net.minecraftforge.client.model; + +import com.google.common.collect.ImmutableMap; + +public class ModelProcessingHelper +{ + public static IModel retexture(IModel model, ImmutableMap textures) + { + if(model instanceof IRetexturableModel) + { + model = ((IRetexturableModel)model).retexture(textures); + } + return model; + } + + public static IModel customData(IModel model, ImmutableMap customData) + { + if(model instanceof IModelCustomData) + { + model = ((IModelCustomData)model).process(customData); + } + return model; + } + + public static IModel smoothLighting(IModel model, boolean smooth) + { + if(model instanceof IModelSimpleProperties) + { + model = ((IModelSimpleProperties)model).smoothLighting(smooth); + } + return model; + } + + public static IModel gui3d(IModel model, boolean gui3d) + { + if(model instanceof IModelSimpleProperties) + { + model = ((IModelSimpleProperties)model).gui3d(gui3d); + } + return model; + } +} diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index 27423c7a94..c63e5c35b4 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -32,7 +32,7 @@ import com.google.common.collect.ImmutableMap; import com.google.gson.JsonElement; import com.google.gson.JsonParser; -public class MultiLayerModel implements IModelCustomData +public class MultiLayerModel implements IModelCustomData { public static final MultiLayerModel instance = new MultiLayerModel(ImmutableMap., ModelResourceLocation>of()); diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 271ee94185..5b8ee3628b 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -400,7 +400,7 @@ public class B3DLoader implements ICustomModelLoader } } - public static class ModelWrapper implements IRetexturableModel, IModelCustomData, IModelSimpleProperties, IAnimatedModel + public static class ModelWrapper implements IRetexturableModel, IModelCustomData, IModelSimpleProperties, IAnimatedModel { private final ResourceLocation modelLocation; private final B3DModel model; diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index 07ab890824..f1c76c892a 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -53,7 +53,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -public class OBJModel implements IRetexturableModel, IModelCustomData +public class OBJModel implements IRetexturableModel, IModelCustomData { //private Gson GSON = new GsonBuilder().create(); private MaterialLibrary matLib; diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index dd7cf87675..8eab7e65e6 100644 --- a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -33,6 +33,7 @@ import net.minecraftforge.client.model.IModelState; import net.minecraftforge.client.model.IRetexturableModel; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.ModelLoaderRegistry; +import net.minecraftforge.client.model.ModelProcessingHelper; import net.minecraftforge.client.model.MultiModel; import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.client.model.animation.Animation; @@ -212,14 +213,8 @@ public class ModelAnimationDebug "chamber", "blocks/redstone_block", "trunk", "blocks/end_stone" ); - if(base instanceof IRetexturableModel) - { - base = ((IRetexturableModel)base).retexture(textures); - } - if(ring instanceof IRetexturableModel) - { - ring = ((IRetexturableModel)ring).retexture(textures); - } + base = ModelProcessingHelper.retexture(base, textures); + ring = ModelProcessingHelper.retexture(base, textures); IModel model = new MultiModel( new ResourceLocation(ModelAnimationDebug.MODID, "builtin/engine"), ring, From 3e22a2b90dd392a3598bed6c50a00182814e7a8f Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sun, 6 Mar 2016 02:51:39 +0300 Subject: [PATCH 038/243] Model UV lock handling from the state to the model, fixed most compile errors in ModelLoader, disabled it (and ModelBakeEvent) until it's functional, fixed some errors in ForgeHooksClient. --- .../block/model/ModelManager.java.patch | 7 +- .../client/ForgeHooksClient.java | 10 +- .../client/event/ModelBakeEvent.java | 32 ++-- .../client/model/BlockStateLoader.java | 8 +- .../client/model/IModelUVLock.java | 6 + .../client/model/ModelLoader.java | 158 +++++++++--------- .../client/model/ModelProcessingHelper.java | 9 + src/main/resources/forge_at.cfg | 7 +- .../minecraftforge/debug/ItemTileDebug.java | 2 +- .../debug/ModelBakeEventDebug.java | 4 +- 10 files changed, 131 insertions(+), 112 deletions(-) create mode 100644 src/main/java/net/minecraftforge/client/model/IModelUVLock.java diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch index 6ce4d19a58..54256d1f3c 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch @@ -1,14 +1,15 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java -@@ -24,9 +24,10 @@ +@@ -24,9 +24,11 @@ public void onResourceManagerReload(IResourceManager resourceManager) { - ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider); -+ ModelBakery modelbakery = new net.minecraftforge.client.model.ModelLoader(resourceManager, this.texMap, this.modelProvider); ++ // FIXME: reenable after ModelLoader is fixed ++ ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider); //new net.minecraftforge.client.model.ModelLoader(resourceManager, this.texMap, this.modelProvider); this.modelRegistry = modelbakery.setupModelRegistry(); this.defaultModel = (IBakedModel)this.modelRegistry.getObject(ModelBakery.MODEL_MISSING); -+ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelRegistry, modelbakery); ++ //net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelRegistry, modelbakery); this.modelProvider.reloadModels(); } diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 7d258b2685..106a8e7699 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -71,7 +71,6 @@ import net.minecraftforge.client.event.RenderHandEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent; -import net.minecraftforge.client.model.IFlexibleBakedModel; import net.minecraftforge.client.model.IModelPart; import net.minecraftforge.client.model.IPerspectiveAwareModel; import net.minecraftforge.client.model.ModelLoader; @@ -356,11 +355,10 @@ public class ForgeHooksClient } */ - public static void onModelBake(ModelManager modelManager, IRegistry modelRegistry, ModelBakery modelBakery) + public static void onModelBake(ModelManager modelManager, IRegistry modelRegistry, ModelLoader modelLoader) { - ModelLoader loader = (ModelLoader)modelBakery; - MinecraftForge.EVENT_BUS.post(new ModelBakeEvent(modelManager, modelRegistry, loader)); - loader.onPostBakeEvent(modelRegistry); + MinecraftForge.EVENT_BUS.post(new ModelBakeEvent(modelManager, modelRegistry, modelLoader)); + modelLoader.onPostBakeEvent(modelRegistry); } public static Matrix4f getMatrix(ItemTransformVec3f transform) @@ -389,7 +387,7 @@ public class ForgeHooksClient { if(model instanceof IPerspectiveAwareModel) { - Pair pair = ((IPerspectiveAwareModel)model).handlePerspective(cameraTransformType); + Pair pair = ((IPerspectiveAwareModel)model).handlePerspective(cameraTransformType); if(pair.getRight() != null) multiplyCurrentGlMatrix(pair.getRight()); return pair.getLeft(); diff --git a/src/main/java/net/minecraftforge/client/event/ModelBakeEvent.java b/src/main/java/net/minecraftforge/client/event/ModelBakeEvent.java index 4a0210ec3e..dd20b202dc 100644 --- a/src/main/java/net/minecraftforge/client/event/ModelBakeEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ModelBakeEvent.java @@ -1,7 +1,6 @@ package net.minecraftforge.client.event; import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelManager; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.registry.IRegistry; @@ -12,25 +11,32 @@ import net.minecraftforge.fml.common.eventhandler.Event; * Fired when the ModelManager is notified of the resource manager reloading. * Called after model registry is setup, but before it's passed to BlockModelShapes. */ +// TODO: try to merge with ICustomModelLoader public class ModelBakeEvent extends Event { - public final ModelManager modelManager; - public final IRegistry modelRegistry; - @Deprecated - public final ModelBakery modelBakery; - public final ModelLoader modelLoader; - - @Deprecated - public ModelBakeEvent(ModelManager modelManager, IRegistry modelRegistry, ModelBakery modelBakery) - { - this(modelManager, modelRegistry, (ModelLoader)modelBakery); - } + private final ModelManager modelManager; + private final IRegistry modelRegistry; + private final ModelLoader modelLoader; public ModelBakeEvent(ModelManager modelManager, IRegistry modelRegistry, ModelLoader modelLoader) { this.modelManager = modelManager; this.modelRegistry = modelRegistry; - this.modelBakery = modelLoader; this.modelLoader = modelLoader; } + + public ModelManager getModelManager() + { + return modelManager; + } + + public IRegistry getModelRegistry() + { + return modelRegistry; + } + + public ModelLoader getModelLoader() + { + return modelLoader; + } } diff --git a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java index 65f40be4bc..4e70d85a4f 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java +++ b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java @@ -146,12 +146,13 @@ public class BlockStateLoader this.gui3d = gui3d; } - private IModel runModelHooks(IModel base, boolean smooth, boolean gui3d, ImmutableMap textureMap, ImmutableMap customData) + private 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; } @@ -166,7 +167,7 @@ public class BlockStateLoader if (hasBase) { - base = runModelHooks(base, smooth, gui3d, textures, customData); + base = runModelHooks(base, smooth, gui3d, this.func_188049_c(), textures, customData); if (size <= 0) return base; @@ -193,9 +194,8 @@ public class BlockStateLoader } IModelState partState = new ModelStateComposition(baseTr, part.getState()); - if (part.isUVLock()) partState = new ModelLoader.UVLock(partState); - models.put(entry.getKey(), Pair.of(runModelHooks(model, part.smooth, part.gui3d, part.getTextures(), part.getCustomData()), partState)); + models.put(entry.getKey(), Pair.of(runModelHooks(model, part.smooth, part.gui3d, part.uvLock, part.getTextures(), part.getCustomData()), partState)); } return new MultiModel(func_188046_a(), hasBase ? base : null, baseTr, models.build()); diff --git a/src/main/java/net/minecraftforge/client/model/IModelUVLock.java b/src/main/java/net/minecraftforge/client/model/IModelUVLock.java new file mode 100644 index 0000000000..aa3dd8fdf0 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/IModelUVLock.java @@ -0,0 +1,6 @@ +package net.minecraftforge.client.model; + +public interface IModelUVLock extends IModel +{ + public IModel uvlock(boolean value); +} diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index cac257b47f..77de53614a 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -17,12 +17,14 @@ import java.util.Set; import com.google.common.base.Joiner; import com.google.common.collect.*; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockModelShapes; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.ItemModelMesher; +import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.BlockPart; import net.minecraft.client.renderer.block.model.BlockPartFace; import net.minecraft.client.renderer.block.model.BlockPartRotation; @@ -162,16 +164,42 @@ public class ModelLoader extends ModelBakery ProgressBar blockBar = ProgressManager.push("ModelLoader: blocks", variants.size()); for(ModelResourceLocation variant : variants) { - loadVariants(ImmutableList.of(variant)); + loadVariant(variant); blockBar.step(variant.toString()); } ProgressManager.pop(blockBar); } + // FIXME: all the new shiny multipart things + private void loadVariant(ModelResourceLocation variant) + { + try + { + ModelBlockDefinition modelblockdefinition = this.getModelBlockDefinition(variant); + + try + { + this.registerVariant(modelblockdefinition, variant); + } + catch (Exception ex) + { + FMLLog.getLogger().warn("Unable to load variant: " + variant.getVariant() + " from " + variant, ex); + } + } + catch (Exception ex) + { + FMLLog.getLogger().warn("Unable to load definition " + variant, ex); + } + } + + // FIXME: this is probably not the hook point anymore @Override protected void registerVariant(ModelBlockDefinition definition, ModelResourceLocation location) { - VariantList variants = null; + // for now + super.registerVariant(definition, location); + + /*VariantList variants = null; try { variants = definition.getVariants(location.getVariant()); @@ -190,7 +218,7 @@ public class ModelLoader extends ModelBakery { throw new RuntimeException(e); } - } + }*/ } private void storeException(ResourceLocation location, Exception exception) @@ -387,7 +415,7 @@ public class ModelLoader extends ModelBakery IModel getVariantModel(ModelResourceLocation location) { - loadVariants(ImmutableList.of(location)); + loadVariant(location); IModel model = stateModels.get(location); if(model == null) model = getMissingModel(); return model; @@ -409,16 +437,18 @@ public class ModelLoader extends ModelBakery textures.addAll(model.getTextures()); } - private class VanillaModelWrapper implements IRetexturableModel, IModelSimpleProperties, IAnimatedModel + private class VanillaModelWrapper implements IRetexturableModel, IModelSimpleProperties, IModelUVLock, IAnimatedModel { private final ResourceLocation location; private final ModelBlock model; + private final boolean uvlock; private final ModelBlockAnimation animation; - public VanillaModelWrapper(ResourceLocation location, ModelBlock model, ModelBlockAnimation animation) + public VanillaModelWrapper(ResourceLocation location, ModelBlock model, boolean uvlock, ModelBlockAnimation animation) { this.location = location; this.model = model; + this.uvlock = uvlock; this.animation = animation; } @@ -500,7 +530,7 @@ public class ModelLoader extends ModelBakery return builder.build(); } - public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) + public IBakedModel bake(IModelState state, final VertexFormat format, Function bakedTextureGetter) { if(!Attributes.moreSpecific(format, Attributes.DEFAULT_BAKED_FORMAT)) { @@ -517,12 +547,6 @@ public class ModelLoader extends ModelBakery } ItemCameraTransforms transforms = model.func_181682_g(); - boolean uvlock = false; - if(state instanceof UVLock) - { - uvlock = true; - state = ((UVLock)state).getParent(); - } Map tMap = Maps.newHashMap(); tMap.putAll(IPerspectiveAwareModel.MapWrapper.getTransforms(transforms)); tMap.putAll(IPerspectiveAwareModel.MapWrapper.getTransforms(state)); @@ -532,14 +556,14 @@ public class ModelLoader extends ModelBakery { return new ItemLayerModel(model).bake(perState, format, bakedTextureGetter); } - if(isCustomRenderer(model)) return new BuiltInModel(transforms); + if(isCustomRenderer(model)) return new BuiltInModel(transforms, model.func_187967_g()); return bakeNormal(model, perState, state.apply(Optional.absent()).or(TRSRTransformation.identity()), newTransforms, format, bakedTextureGetter, uvlock); } private IBakedModel bakeNormal(ModelBlock model, IModelState perState, final TRSRTransformation modelState, List newTransforms, VertexFormat format, final Function bakedTextureGetter, boolean uvLocked) { TextureAtlasSprite particle = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName("particle"))); - SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(model)).setTexture(particle); + SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(model, model.func_187967_g())).setTexture(particle); for(int i = 0; i < model.getElements().size(); i++) { BlockPart part = model.getElements().get(i); @@ -566,31 +590,27 @@ public class ModelLoader extends ModelBakery } } - // FIXME - return new ISmartBlockModel.PerspectiveWrapper(new IPerspectiveAwareModel.MapWrapper(builder.makeBakedModel(), perState)) + return new IPerspectiveAwareModel.MapWrapper(builder.makeBakedModel(), perState) { - public IBakedModel handleBlockState(IBlockState state) + @Override + public List func_188616_a(IBlockState state, EnumFacing side, long rand) { - return VanillaModelWrapper.this.handleBlockState(parent, bakedTextureGetter, modelState, state); - } - }; - } - - private IBakedModel handleBlockState(IBakedModel model, Function bakedTextureGetter, TRSRTransformation modelState, IBlockState state) - { - if(state instanceof IExtendedBlockState) - { - IExtendedBlockState exState = (IExtendedBlockState)state; - if(exState.getUnlistedNames().contains(Properties.AnimationProperty)) - { - IModelState newState = exState.getValue(Properties.AnimationProperty); - if(newState != null) + if(state instanceof IExtendedBlockState) { - return VanillaModelWrapper.this.bake(new ModelStateComposition(modelState, newState), model.getFormat(), bakedTextureGetter); + IExtendedBlockState exState = (IExtendedBlockState)state; + if(exState.getUnlistedNames().contains(Properties.AnimationProperty)) + { + IModelState newState = exState.getValue(Properties.AnimationProperty); + IExtendedBlockState newExState = exState.withProperty(Properties.AnimationProperty, null); + if(newState != null) + { + return VanillaModelWrapper.this.bake(new ModelStateComposition(modelState, newState), format, bakedTextureGetter).func_188616_a(newExState, side, rand); + } + } } - } - } - return model; + return super.func_188616_a(state, side, rand); + }; + }; } @Override @@ -607,7 +627,7 @@ public class ModelLoader extends ModelBakery ModelBlock newModel = new ModelBlock(this.model.getParentLocation(), elements, Maps.newHashMap(this.model.textures), this.model.isAmbientOcclusion(), this.model.isGui3d(), //New Textures man VERY IMPORTANT - model.func_181682_g()); + model.func_181682_g(), Lists.newArrayList(model.func_187966_f())); newModel.name = this.model.name; newModel.parent = this.model.parent; @@ -651,7 +671,7 @@ public class ModelLoader extends ModelBakery } } - return new VanillaModelWrapper(location, newModel, animation); + return new VanillaModelWrapper(location, newModel, uvlock, animation); } @Override @@ -676,10 +696,10 @@ public class ModelLoader extends ModelBakery { return this; } - ModelBlock newModel = new ModelBlock(model.getParentLocation(), model.getElements(), model.textures, value, model.isGui3d(), model.func_181682_g()); + ModelBlock newModel = new ModelBlock(model.getParentLocation(), model.getElements(), model.textures, value, model.isGui3d(), model.func_181682_g(), Lists.newArrayList(model.func_187966_f())); newModel.parent = model.parent; newModel.name = model.name; - return new VanillaModelWrapper(location, newModel, animation); + return new VanillaModelWrapper(location, newModel, uvlock, animation); } @Override @@ -689,31 +709,20 @@ public class ModelLoader extends ModelBakery { return this; } - ModelBlock newModel = new ModelBlock(model.getParentLocation(), model.getElements(), model.textures, model.ambientOcclusion, value, model.func_181682_g()); + ModelBlock newModel = new ModelBlock(model.getParentLocation(), model.getElements(), model.textures, model.ambientOcclusion, value, model.func_181682_g(), Lists.newArrayList(model.func_187966_f())); newModel.parent = model.parent; newModel.name = model.name; - return new VanillaModelWrapper(location, newModel, animation); - } - } - - @Deprecated // rework in 1.9 - public static class UVLock implements IModelState - { - private final IModelState parent; - - public UVLock(IModelState parent) - { - this.parent = parent; + return new VanillaModelWrapper(location, newModel, uvlock, animation); } - public IModelState getParent() + @Override + public IModel uvlock(boolean value) { - return parent; - } - - public Optional apply(Optional part) - { - return parent.apply(part); + if(uvlock == value) + { + return this; + } + return new VanillaModelWrapper(location, model, value, animation); } } @@ -730,7 +739,7 @@ public class ModelLoader extends ModelBakery ImmutableList.Builder> builder = ImmutableList.builder(); for (Variant v : this.variants) { - ResourceLocation loc = v.getModelLocation(); + ResourceLocation loc = v.func_188046_a(); locations.add(loc); IModel model = null; @@ -787,12 +796,6 @@ public class ModelLoader extends ModelBakery return Collections.emptyList(); } - private IModelState addUV(boolean uv, IModelState state) - { - if(uv) return new UVLock(state); - return state; - } - public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { if(!Attributes.moreSpecific(format, Attributes.DEFAULT_BAKED_FORMAT)) @@ -803,14 +806,14 @@ public class ModelLoader extends ModelBakery { Variant v = variants.get(0); IModel model = models.get(0); - return model.bake(addUV(v.isUvLocked(), MultiModelState.getPartState(state, model, 0)), format, bakedTextureGetter); + return model.bake(MultiModelState.getPartState(state, model, 0), format, bakedTextureGetter); } WeightedBakedModel.Builder builder = new WeightedBakedModel.Builder(); for(int i = 0; i < variants.size(); i++) { IModel model = models.get(i); Variant v = variants.get(i); - builder.add(model.bake(addUV(v.isUvLocked(), MultiModelState.getPartState(state, model, i)), format, bakedTextureGetter), variants.get(i).getWeight()); + builder.add(model.bake(MultiModelState.getPartState(state, model, i), format, bakedTextureGetter), variants.get(i).func_188047_d()); } return builder.build(); } @@ -878,7 +881,7 @@ public class ModelLoader extends ModelBakery } ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getResourceDomain(), "armatures/" + modelPath + ".json"); ModelBlockAnimation animation = Animation.INSTANCE.loadVanillaAnimation(armatureLocation); - return loader.new VanillaModelWrapper(modelLocation, loader.loadModel(modelLocation), animation); + return loader.new VanillaModelWrapper(modelLocation, loader.loadModel(modelLocation), false, animation); } } @@ -898,6 +901,7 @@ public class ModelLoader extends ModelBakery return true; } + // TODO: check if this code is correct @Override public boolean load(IResourceManager manager, ResourceLocation location) { @@ -905,16 +909,10 @@ public class ModelLoader extends ModelBakery Graphics2D graphics = image.createGraphics(); graphics.setBackground(Color.WHITE); graphics.clearRect(0, 0, 16, 16); - BufferedImage[] images = new BufferedImage[Minecraft.getMinecraft().gameSettings.mipmapLevels + 1]; - images[0] = image; - try - { - loadSprite(images, null); - } - catch(IOException e) - { - throw new RuntimeException(e); - } + int[][] pixels = new int[Minecraft.getMinecraft().gameSettings.mipmapLevels + 1][]; + pixels[0] = new int[image.getWidth() * image.getHeight()]; + image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels[0], 0, image.getWidth()); + this.framesTextureData.add(pixels); return false; } diff --git a/src/main/java/net/minecraftforge/client/model/ModelProcessingHelper.java b/src/main/java/net/minecraftforge/client/model/ModelProcessingHelper.java index a9b9e26e51..c4d5d82dfc 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelProcessingHelper.java +++ b/src/main/java/net/minecraftforge/client/model/ModelProcessingHelper.java @@ -39,4 +39,13 @@ public class ModelProcessingHelper } return model; } + + public static IModel uvlock(IModel model, boolean uvlock) + { + if(model instanceof IModelUVLock) + { + model = ((IModelUVLock)model).uvlock(uvlock); + } + return model; + } } diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index 4f78e56d38..3eaa618f68 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -115,6 +115,7 @@ protected net.minecraft.block.state.BlockStateContainer$StateImplementation fiel public net.minecraft.client.renderer.block.model.ModelBlock field_178318_c # textures public net.minecraft.client.renderer.block.model.ModelBlock field_178315_d # parent public net.minecraft.client.renderer.block.model.ModelBlock field_178322_i # ambientOcclusion +public net.minecraft.client.renderer.block.model.ModelBlock func_187966_f()Ljava/util/List; # getOverrides protected net.minecraft.client.renderer.block.model.ModelBakery field_177602_b # LOCATIONS_BUILTIN_TEXTURES protected net.minecraft.client.renderer.block.model.ModelBakery field_177598_f # resourceManager protected net.minecraft.client.renderer.block.model.ModelBakery field_177599_g # sprites @@ -141,8 +142,8 @@ protected net.minecraft.client.renderer.block.model.ModelBakery func_177580_d(Ln # EnumFacing public net.minecraft.util.EnumFacing field_82609_l # VALUES public net.minecraft.util.EnumFacing field_176754_o # HORIZONTALS -#public net.minecraft.client.renderer.VertexBuffer func_78909_a(I)I # getColorIndex -#public net.minecraft.client.renderer.VertexBuffer func_178972_a(IIIII)V # putColorRGBA +public net.minecraft.client.renderer.VertexBuffer func_78909_a(I)I # getColorIndex +public net.minecraft.client.renderer.VertexBuffer func_178972_a(IIIII)V # putColorRGBA # ModelBlock Constructor #public net.minecraft.client.renderer.block.model.ModelBlock (Lnet/minecraft/util/ResourceLocation;Ljava/util/List;Ljava/util/Map;ZZLnet/minecraft/client/renderer/block/model/ItemCameraTransforms;)V # RenderLivingEntity @@ -263,4 +264,4 @@ private-f net/minecraft/world/gen/ChunkProviderHell/field_73174_n #perlin3 public-f net/minecraft/world/gen/ChunkProviderHell/field_185946_g #scale public-f net/minecraft/world/gen/ChunkProviderHell/field_185947_h #depth private-f net/minecraft/world/gen/ChunkProviderHell/field_185939_I #netherCaveGenerator -private-f net/minecraft/world/gen/ChunkProviderHell/field_73172_c #netherBridgeGenerator \ No newline at end of file +private-f net/minecraft/world/gen/ChunkProviderHell/field_73172_c #netherBridgeGenerator diff --git a/src/test/java/net/minecraftforge/debug/ItemTileDebug.java b/src/test/java/net/minecraftforge/debug/ItemTileDebug.java index 0539661ed0..644155865b 100644 --- a/src/test/java/net/minecraftforge/debug/ItemTileDebug.java +++ b/src/test/java/net/minecraftforge/debug/ItemTileDebug.java @@ -83,7 +83,7 @@ public class ItemTileDebug @SubscribeEvent public void onModelBakeEvent(ModelBakeEvent event) { - event.modelManager.getBlockModelShapes().registerBuiltInBlocks(TestBlock.instance); + event.getModelManager().getBlockModelShapes().registerBuiltInBlocks(TestBlock.instance); } } diff --git a/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java b/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java index 7f3dfcc425..654f7731a2 100644 --- a/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java @@ -117,8 +117,8 @@ public class ModelBakeEventDebug TextureAtlasSprite base = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/slime"); TextureAtlasSprite overlay = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/redstone_block"); IBakedModel customModel = new CustomModel(base, overlay); - event.modelRegistry.putObject(ClientProxy.blockLocation, customModel); - event.modelRegistry.putObject(ClientProxy.itemLocation, customModel); + event.getModelRegistry().putObject(ClientProxy.blockLocation, customModel); + event.getModelRegistry().putObject(ClientProxy.itemLocation, customModel); } } From ee823413121558dd4744bdd2251d86516f3e7b4e Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sun, 6 Mar 2016 03:00:08 +0300 Subject: [PATCH 039/243] Made OBJModel.java compile. --- .../minecraftforge/client/model/obj/OBJModel.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index f1c76c892a..7d6879ca3b 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -24,6 +24,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; 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.VertexFormat; import net.minecraft.client.resources.IResource; @@ -1324,8 +1325,9 @@ public class OBJModel implements IRetexturableModel, IModelCustomData // FIXME: merge with getQuads @Override - public List getGeneralQuads() + public List func_188616_a(IBlockState blockState, EnumFacing side, long rand) { + if(side != null) return ImmutableList.of(); if (quads == null) { quads = Collections.synchronizedSet(new LinkedHashSet()); @@ -1491,7 +1493,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData } // FIXME: merge with getQuads - @Override + /* @Override public OBJBakedModel handleBlockState(IBlockState state) { if (state instanceof IExtendedBlockState) @@ -1511,7 +1513,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData } } return this; - } + }*/ private void updateStateVisibilityMap(OBJState state) { @@ -1584,6 +1586,12 @@ public class OBJModel implements IRetexturableModel, IModelCustomData { return this.model.modelLocation.toString(); } + + @Override + public ItemOverrideList func_188617_f() + { + return ItemOverrideList.field_188022_a; + } } @SuppressWarnings("serial") From 206a21d5639809a8e0483e9aa6e7dfa6dfc0cd4e Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 6 Mar 2016 16:54:47 -0800 Subject: [PATCH 040/243] Fixed errrors in Fluids package. TODO: Make BlockLiquid implement IFluidBlock and REMOVE FluidContainerRegsitry. Everything *should* be able to use IFluidContainer directly. --- .../block/BlockStaticLiquid.java.patch | 11 +++ .../TileEntityBrewingStand.java.patch | 2 +- .../minecraft/util/ActionResult.java.patch | 13 +++ .../minecraftforge/fluids/BlockFluidBase.java | 82 +++++++++---------- .../fluids/BlockFluidClassic.java | 30 ++++--- .../fluids/BlockFluidFinite.java | 14 ++-- .../java/net/minecraftforge/fluids/Fluid.java | 12 +-- .../fluids/FluidContainerRegistry.java | 9 +- .../minecraftforge/fluids/FluidRegistry.java | 11 +-- .../net/minecraftforge/fluids/FluidStack.java | 16 ++-- .../net/minecraftforge/fluids/FluidTank.java | 3 - .../minecraftforge/fluids/FluidTankInfo.java | 3 - .../net/minecraftforge/fluids/FluidUtil.java | 4 +- .../minecraftforge/fluids/IFluidBlock.java | 4 +- .../fluids/IFluidContainerItem.java | 16 ++-- .../minecraftforge/fluids/IFluidHandler.java | 2 - .../net/minecraftforge/fluids/IFluidTank.java | 13 ++- .../fluids/ItemFluidContainer.java | 3 - .../fluids/TileFluidHandler.java | 3 - .../fluids/UniversalBucket.java | 51 ++++++------ .../items/ItemHandlerHelper.java | 6 +- 21 files changed, 149 insertions(+), 159 deletions(-) create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockStaticLiquid.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/ActionResult.java.patch diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockStaticLiquid.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockStaticLiquid.java.patch new file mode 100644 index 0000000000..bbc3288ce5 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockStaticLiquid.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockStaticLiquid.java ++++ ../src-work/minecraft/net/minecraft/block/BlockStaticLiquid.java +@@ -52,7 +52,7 @@ + { + blockpos = blockpos.add(rand.nextInt(3) - 1, 1, rand.nextInt(3) - 1); + +- if (blockpos.getY() >= 0 && blockpos.getY() < 256 && !worldIn.isBlockLoaded(blockpos)) ++ if (blockpos.getY() >= 0 && blockpos.getY() < worldIn.getHeight() && !worldIn.isBlockLoaded(blockpos)) + { + return; + } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch index 6fc6691e52..b70efb2280 100644 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -36,7 +36,7 @@ + if (itemstack.getItem().hasContainerItem(itemstack)) { - ItemStack itemstack1 = new ItemStack(itemstack.getItem().getContainerItem()); -+ ItemStack itemstack1 = new ItemStack(itemstack.getItem().getContainerItem(itemstack)); ++ ItemStack itemstack1 = itemstack.getItem().getContainerItem(itemstack); if (itemstack.stackSize <= 0) { diff --git a/patches.mcp/minecraft/net/minecraft/util/ActionResult.java.patch b/patches.mcp/minecraft/net/minecraft/util/ActionResult.java.patch new file mode 100644 index 0000000000..28c5a82cff --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/ActionResult.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/util/ActionResult.java ++++ ../src-work/minecraft/net/minecraft/util/ActionResult.java +@@ -20,4 +20,10 @@ + { + return this.field_188400_b; + } ++ ++ //Just a generic helper function to make typecasing easier... ++ public static ActionResult newResult(EnumActionResult result, T value) ++ { ++ return new ActionResult(result, value); ++ } + } diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java b/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java index 75bd31edf6..9f1cd6ff29 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java @@ -7,16 +7,15 @@ import net.minecraft.block.Block; 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.Entity; import net.minecraft.init.Blocks; import net.minecraft.item.Item; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.property.ExtendedBlockState; @@ -34,8 +33,6 @@ import com.google.common.collect.Maps; * * It is highly recommended that you extend this class or one of the Forge-provided child classes. * - * @author King Lemming, OvermindDL1 - * */ @SuppressWarnings("unchecked") public abstract class BlockFluidBase extends Block implements IFluidBlock @@ -110,7 +107,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock protected float quantaPerBlockFloat = 8F; protected int density = 1; protected int densityDir = -1; - protected int temperature = 295; + protected int temperature = 295; protected int tickRate = 20; protected BlockRenderLayer renderLayer = BlockRenderLayer.TRANSLUCENT; @@ -128,7 +125,6 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock public BlockFluidBase(Fluid fluid, Material material) { super(material); - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); this.setTickRandomly(true); this.disableStats(); @@ -146,7 +142,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[] { LEVEL }, FLUID_RENDER_PROPS); } @@ -154,7 +150,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock @Override public int getMetaFromState(IBlockState state) { - return ((Integer)state.getValue(LEVEL)).intValue(); + return state.getValue(LEVEL); } public BlockFluidBase setQuantaPerBlock(int quantaPerBlock) { @@ -204,19 +200,19 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock { if (world.isAirBlock(pos)) return true; - Block block = world.getBlockState(pos).getBlock(); + IBlockState state = world.getBlockState(pos); - if (block == this) + if (state.getBlock() == this) { return false; } - if (displacements.containsKey(block)) + if (displacements.containsKey(state.getBlock())) { - return displacements.get(block); + return displacements.get(state.getBlock()); } - Material material = block.getMaterial(); + Material material = state.func_185904_a(); if (material.blocksMovement() || material == Material.portal) { return false; @@ -225,16 +221,16 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock int density = getDensity(world, pos); if (density == Integer.MAX_VALUE) { - return true; + return true; } if (this.density > density) { - return true; + return true; } else { - return false; + return false; } } @@ -265,7 +261,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return false; } - Material material = block.getMaterial(); + Material material = state.func_185904_a(); if (material.blocksMovement() || material == Material.portal) { return false; @@ -274,17 +270,17 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock int density = getDensity(world, pos); if (density == Integer.MAX_VALUE) { - block.dropBlockAsItem(world, pos, state, 0); - return true; + block.dropBlockAsItem(world, pos, state, 0); + return true; } if (this.density > density) { - return true; + return true; } else { - return false; + return false; } } @@ -340,10 +336,10 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock } @Override - public Vec3 modifyAcceleration(World world, BlockPos pos, Entity entity, Vec3 vec) + public Vec3d modifyAcceleration(World world, BlockPos pos, Entity entity, Vec3d vec) { if (densityDir > 0) return vec; - Vec3 vec_flow = this.getFlowVector(world, pos); + Vec3d vec_flow = this.getFlowVector(world, pos); return vec.addVector( vec_flow.xCoord * (quantaPerBlock * 4), vec_flow.yCoord * (quantaPerBlock * 4), @@ -351,24 +347,24 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock } @Override - public int getLightValue(IBlockAccess world, BlockPos pos) + public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) { if (maxScaledLight == 0) { - return super.getLightValue(world, pos); + return super.getLightValue(state, world, pos); } - int data = ((Integer)world.getBlockState(pos).getValue(LEVEL)).intValue(); + int data = state.getValue(LEVEL); return (int) (data / quantaPerBlockFloat * maxScaledLight); } @Override - public boolean isOpaqueCube() + public boolean isOpaqueCube(IBlockState state) { return false; } @Override - public boolean isFullCube() + public boolean isFullCube(IBlockState state) { return false; } @@ -384,7 +380,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock */ @Override - public int getMixedBrightnessForBlock(IBlockAccess world, BlockPos pos) + public int func_185484_c(IBlockState state, IBlockAccess world, BlockPos pos) { int lightThis = world.getCombinedLight(pos, 0); int lightUp = world.getCombinedLight(pos.up(), 0); @@ -404,10 +400,10 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock } @Override - public boolean shouldSideBeRendered(IBlockAccess world, BlockPos pos, EnumFacing side) + public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { - Block block = world.getBlockState(pos).getBlock(); - if (block.getMaterial() == this.blockMaterial) + IBlockState neighbor = world.getBlockState(pos.offset(side)); + if (neighbor.func_185904_a() == state.func_185904_a()) { return false; } @@ -419,7 +415,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock { return true; } - return super.shouldSideBeRendered(world, pos, side); + return super.shouldSideBeRendered(state, world, pos, side); } @Override @@ -490,12 +486,12 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock public static double getFlowDirection(IBlockAccess world, BlockPos pos) { - Block block = world.getBlockState(pos).getBlock(); - if (!block.getMaterial().isLiquid()) + IBlockState state = world.getBlockState(pos); + if (!state.func_185904_a().isLiquid()) { return -1000.0; } - Vec3 vec = ((BlockFluidBase) block).getFlowVector(world, pos); + Vec3d vec = ((BlockFluidBase)state.getBlock()).getFlowVector(world, pos); return vec.xCoord == 0.0D && vec.zCoord == 0.0D ? -1000.0D : Math.atan2(vec.zCoord, vec.xCoord) - Math.PI / 2D; } @@ -558,7 +554,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock IBlockState up = world.getBlockState(pos.down(densityDir)); if (here.getBlock() == this) { - if (up.getBlock().getMaterial().isLiquid() || up.getBlock() instanceof IFluidBlock) + if (up.func_185904_a().isLiquid() || up.getBlock() instanceof IFluidBlock) { return 1; } @@ -568,12 +564,12 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return 0.875F; } } - return !here.getBlock().getMaterial().isSolid() && up.getBlock() == this ? 1 : this.getQuantaPercentage(world, pos) * 0.875F; + return !here.func_185904_a().isSolid() && up.getBlock() == this ? 1 : this.getQuantaPercentage(world, pos) * 0.875F; } - public Vec3 getFlowVector(IBlockAccess world, BlockPos pos) + public Vec3d getFlowVector(IBlockAccess world, BlockPos pos) { - Vec3 vec = new Vec3(0.0D, 0.0D, 0.0D); + Vec3d vec = new Vec3d(0.0D, 0.0D, 0.0D); int decay = quantaPerBlock - getQuantaValue(world, pos); for (int side = 0; side < 4; ++side) @@ -593,7 +589,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock int otherDecay = quantaPerBlock - getQuantaValue(world, pos2); if (otherDecay >= quantaPerBlock) { - if (!world.getBlockState(pos2).getBlock().getMaterial().blocksMovement()) + if (!world.getBlockState(pos2).func_185904_a().blocksMovement()) { otherDecay = quantaPerBlock - getQuantaValue(world, pos2.down()); if (otherDecay >= 0) @@ -646,4 +642,4 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock if (remaining > 1) remaining = 1.0f; return remaining * (density > 0 ? 1 : -1); } -} \ No newline at end of file +} diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java b/src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java index e982879e29..f3d60cc372 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java @@ -2,7 +2,6 @@ package net.minecraftforge.fluids; import java.util.Random; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -15,8 +14,6 @@ import net.minecraft.world.World; * * It is highly recommended that you use/extend this class for "classic" fluid blocks. * - * @author King Lemming - * */ public class BlockFluidClassic extends BlockFluidBase { @@ -56,14 +53,14 @@ public class BlockFluidClassic extends BlockFluidBase return -1; } - int quantaRemaining = quantaPerBlock - ((Integer)state.getValue(LEVEL)).intValue(); + int quantaRemaining = quantaPerBlock - state.getValue(LEVEL); return quantaRemaining; } @Override public boolean canCollideCheck(IBlockState state, boolean fullHit) { - return fullHit && ((Integer)state.getValue(LEVEL)).intValue() == 0; + return fullHit && state.getValue(LEVEL) == 0; } @Override @@ -73,20 +70,20 @@ public class BlockFluidClassic extends BlockFluidBase } @Override - public int getLightValue(IBlockAccess world, BlockPos pos) + public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) { if (maxScaledLight == 0) { - return super.getLightValue(world, pos); + return super.getLightValue(state, world, pos); } - int data = quantaPerBlock - ((Integer)world.getBlockState(pos).getValue(LEVEL)).intValue() - 1; + int data = quantaPerBlock - state.getValue(LEVEL) - 1; return (int) (data / quantaPerBlockFloat * maxScaledLight); } @Override public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { - int quantaRemaining = quantaPerBlock - ((Integer)state.getValue(LEVEL)).intValue(); + int quantaRemaining = quantaPerBlock - state.getValue(LEVEL); int expQuanta = -101; // check adjacent block levels if non-source @@ -171,7 +168,8 @@ public class BlockFluidClassic extends BlockFluidBase public boolean isSourceBlock(IBlockAccess world, BlockPos pos) { - return world.getBlockState(pos).getBlock() == this && ((Integer)world.getBlockState(pos).getValue(LEVEL)).intValue() == 0; + IBlockState state = world.getBlockState(pos); + return state.getBlock() == this && state.getValue(LEVEL) == 0; } protected boolean[] getOptimalFlowDirections(World world, BlockPos pos) @@ -280,18 +278,18 @@ public class BlockFluidClassic extends BlockFluidBase { if (world.isAirBlock(pos)) return true; - Block block = world.getBlockState(pos).getBlock(); - if (block == this) + IBlockState state = world.getBlockState(pos); + if (state.getBlock() == this) { return true; } - if (displacements.containsKey(block)) + if (displacements.containsKey(state.getBlock())) { - return displacements.get(block); + return displacements.get(state.getBlock()); } - Material material = block.getMaterial(); + Material material = state.func_185904_a(); if (material.blocksMovement() || material == Material.water || material == Material.lava || @@ -312,7 +310,7 @@ public class BlockFluidClassic extends BlockFluidBase } else { - return false; + return false; } } diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java b/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java index 6c048ce545..af0b81035a 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java @@ -6,8 +6,8 @@ import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -16,8 +16,6 @@ import net.minecraft.world.World; * * It is highly recommended that you use/extend this class for finite fluid blocks. * - * @author OvermindDL1, KingLemming - * */ public class BlockFluidFinite extends BlockFluidBase { @@ -30,7 +28,7 @@ public class BlockFluidFinite extends BlockFluidBase public int getQuantaValue(IBlockAccess world, BlockPos pos) { IBlockState state = world.getBlockState(pos); - if (state.getBlock().isAir(world, pos)) + if (state.getBlock().isAir(state, world, pos)) { return 0; } @@ -39,13 +37,13 @@ public class BlockFluidFinite extends BlockFluidBase { return -1; } - return ((Integer)state.getValue(LEVEL)) + 1; + return state.getValue(LEVEL) + 1; } @Override public boolean canCollideCheck(IBlockState state, boolean fullHit) { - return fullHit && ((Integer)state.getValue(LEVEL)) == quantaPerBlock - 1; + return fullHit && state.getValue(LEVEL) == quantaPerBlock - 1; } @Override @@ -58,7 +56,7 @@ public class BlockFluidFinite extends BlockFluidBase public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { boolean changed = false; - int quantaRemaining = ((Integer)state.getValue(LEVEL)) + 1; + int quantaRemaining = state.getValue(LEVEL) + 1; // Flow vertically if possible int prevRemaining = quantaRemaining; @@ -242,4 +240,4 @@ public class BlockFluidFinite extends BlockFluidBase { return true; } -} \ No newline at end of file +} diff --git a/src/main/java/net/minecraftforge/fluids/Fluid.java b/src/main/java/net/minecraftforge/fluids/Fluid.java index 4ecfd4a408..8ed8477f14 100644 --- a/src/main/java/net/minecraftforge/fluids/Fluid.java +++ b/src/main/java/net/minecraftforge/fluids/Fluid.java @@ -3,8 +3,8 @@ package net.minecraftforge.fluids; import java.util.Locale; import net.minecraft.block.Block; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.translation.I18n; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLLog; import net.minecraft.item.EnumRarity; @@ -24,8 +24,6 @@ import net.minecraft.item.EnumRarity; * The default values can be used as a reference point for mods adding fluids such as oil or heavy * water. * - * @author King Lemming - * */ public class Fluid { @@ -165,12 +163,6 @@ public class Fluid return this.fluidName; } - @Deprecated // Modders should never actually use int ID, use String - public final int getID() - { - return FluidRegistry.getFluidID(this.fluidName); - } - public final Block getBlock() { return block; @@ -187,7 +179,7 @@ public class Fluid public String getLocalizedName(FluidStack stack) { String s = this.getUnlocalizedName(); - return s == null ? "" : StatCollector.translateToLocal(s); + return s == null ? "" : I18n.translateToLocal(s); } /** diff --git a/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java index da4d535047..ce0f2adbb5 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java @@ -19,9 +19,10 @@ import net.minecraftforge.common.MinecraftForge; * * For more complex items, use {@link IFluidContainerItem} instead. * - * @author King Lemming - * + * Deprecated: We will eventually be moving this ALL away from a registry and instead EVERYTHING will use IFluidContainerItem. + * We need to decide a way of swaping Items/Stacks. */ +@Deprecated public abstract class FluidContainerRegistry { // Holder object that implements HashCode for an ItemStack, @@ -168,8 +169,8 @@ public abstract class FluidContainerRegistry } if (data.fluid == null || data.fluid.getFluid() == null) { - FMLLog.bigWarning("Invalid registration attempt for a fluid container item %s has occurred. The registration has been denied to prevent crashes. The mod responsible for the registration needs to correct this.", data.filledContainer.getItem().getUnlocalizedName(data.filledContainer)); - return false; + FMLLog.bigWarning("Invalid registration attempt for a fluid container item %s has occurred. The registration has been denied to prevent crashes. The mod responsible for the registration needs to correct this.", data.filledContainer.getItem().getUnlocalizedName(data.filledContainer)); + return false; } containerFluidMap.put(new ContainerKey(data.filledContainer), data); diff --git a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java index d04e335821..ba32b29e34 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java @@ -13,7 +13,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagString; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; +import net.minecraft.util.text.translation.I18n; import net.minecraftforge.common.MinecraftForge; import com.google.common.base.Strings; @@ -32,9 +32,6 @@ import net.minecraftforge.fml.common.registry.RegistryDelegate; /** * Handles Fluid registrations. Fluids MUST be registered in order to function. - * - * @author King Lemming, CovertJaguar (LiquidDictionary) - * */ public abstract class FluidRegistry { @@ -56,14 +53,14 @@ public abstract class FluidRegistry public static final Fluid WATER = new Fluid("water", new ResourceLocation("blocks/water_still"), new ResourceLocation("blocks/water_flow")) { @Override public String getLocalizedName(FluidStack fs) { - return StatCollector.translateToLocal("tile.water.name"); + return I18n.translateToLocal("tile.water.name"); } }.setBlock(Blocks.water).setUnlocalizedName(Blocks.water.getUnlocalizedName()); public static final Fluid LAVA = new Fluid("lava", new ResourceLocation("blocks/lava_still"), new ResourceLocation("blocks/lava_flow")) { @Override public String getLocalizedName(FluidStack fs) { - return StatCollector.translateToLocal("tile.lava.name"); + return I18n.translateToLocal("tile.lava.name"); } }.setBlock(Blocks.lava).setLuminosity(15).setDensity(3000).setViscosity(6000).setTemperature(1300).setUnlocalizedName(Blocks.lava.getUnlocalizedName()); @@ -447,4 +444,4 @@ public abstract class FluidRegistry fluid = fluids.get(name); } } -} \ No newline at end of file +} diff --git a/src/main/java/net/minecraftforge/fluids/FluidStack.java b/src/main/java/net/minecraftforge/fluids/FluidStack.java index 616b55c49a..fbff1e5e0e 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidStack.java +++ b/src/main/java/net/minecraftforge/fluids/FluidStack.java @@ -13,8 +13,6 @@ import net.minecraftforge.fml.common.registry.RegistryDelegate; * {@link #isFluidStackIdentical(FluidStack)} to determine if FluidID, Amount and NBT Tag are all * equal. * - * @author King Lemming, SirSengir (LiquidStack) - * */ public class FluidStack { @@ -34,7 +32,7 @@ public class FluidStack FMLLog.bigWarning("Failed attempt to create a FluidStack for an unregistered Fluid %s (type %s)", fluid.getName(), fluid.getClass().getName()); throw new IllegalArgumentException("Cannot create a fluidstack from an unregistered fluid"); } - this.fluidDelegate = FluidRegistry.makeDelegate(fluid); + this.fluidDelegate = FluidRegistry.makeDelegate(fluid); this.amount = amount; } @@ -187,12 +185,12 @@ public class FluidStack @Override public final int hashCode() { - int code = 1; - code = 31*code + getFluid().hashCode(); - code = 31*code + amount; - if (tag != null) - code = 31*code + tag.hashCode(); - return code; + int code = 1; + code = 31*code + getFluid().hashCode(); + code = 31*code + amount; + if (tag != null) + code = 31*code + tag.hashCode(); + return code; } /** diff --git a/src/main/java/net/minecraftforge/fluids/FluidTank.java b/src/main/java/net/minecraftforge/fluids/FluidTank.java index 0f7e6e7de0..4969137daf 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidTank.java +++ b/src/main/java/net/minecraftforge/fluids/FluidTank.java @@ -6,9 +6,6 @@ import net.minecraft.tileentity.TileEntity; /** * Reference implementation of {@link IFluidTank}. Use/extend this or implement your own. - * - * @author King Lemming, cpw (LiquidTank) - * */ public class FluidTank implements IFluidTank { diff --git a/src/main/java/net/minecraftforge/fluids/FluidTankInfo.java b/src/main/java/net/minecraftforge/fluids/FluidTankInfo.java index a61ca4e4c8..ad1fba81f2 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidTankInfo.java +++ b/src/main/java/net/minecraftforge/fluids/FluidTankInfo.java @@ -2,9 +2,6 @@ package net.minecraftforge.fluids; /** * Wrapper class used to encapsulate information about an IFluidTank. - * - * @author King Lemming - * */ public final class FluidTankInfo { diff --git a/src/main/java/net/minecraftforge/fluids/FluidUtil.java b/src/main/java/net/minecraftforge/fluids/FluidUtil.java index 02b1fae1d5..2ea86794ff 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidUtil.java +++ b/src/main/java/net/minecraftforge/fluids/FluidUtil.java @@ -5,12 +5,14 @@ import net.minecraft.crash.CrashReportCategory; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.SoundEvents; import net.minecraft.inventory.IInventory; 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.ReportedException; +import net.minecraft.util.SoundCategory; import net.minecraft.world.World; import net.minecraftforge.common.ForgeModContainer; import net.minecraftforge.items.IItemHandler; @@ -402,7 +404,7 @@ public class FluidUtil { if (world != null && pos != null) { - world.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "random.pop", 0.2F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + world.func_184148_a(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.field_187638_cR, SoundCategory.PLAYERS, 0.2F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); } return true; } diff --git a/src/main/java/net/minecraftforge/fluids/IFluidBlock.java b/src/main/java/net/minecraftforge/fluids/IFluidBlock.java index 49b8dfc37f..5bd19dbfdd 100644 --- a/src/main/java/net/minecraftforge/fluids/IFluidBlock.java +++ b/src/main/java/net/minecraftforge/fluids/IFluidBlock.java @@ -8,8 +8,6 @@ import net.minecraft.world.World; * * NOTE: Using/extending the reference implementations {@link BlockFluidBase} is encouraged. * - * @author King Lemming - * */ public interface IFluidBlock { @@ -49,4 +47,4 @@ public interface IFluidBlock * @return */ float getFilledPercentage(World world, BlockPos pos); -} \ No newline at end of file +} diff --git a/src/main/java/net/minecraftforge/fluids/IFluidContainerItem.java b/src/main/java/net/minecraftforge/fluids/IFluidContainerItem.java index 04957b9cdf..f640403e8e 100644 --- a/src/main/java/net/minecraftforge/fluids/IFluidContainerItem.java +++ b/src/main/java/net/minecraftforge/fluids/IFluidContainerItem.java @@ -5,18 +5,16 @@ import net.minecraft.item.ItemStack; /** * Implement this interface on Item classes that support external manipulation of their internal * fluid storage. - * + * * A reference implementation is provided {@link ItemFluidContainer}. - * + * * NOTE: Use of NBT data on the containing ItemStack is encouraged. - * - * @author King Lemming - * + * */ public interface IFluidContainerItem { /** - * + * * @param container * ItemStack which is the fluid container. * @return FluidStack representing the fluid in the container, null if the container is empty. @@ -24,7 +22,7 @@ public interface IFluidContainerItem FluidStack getFluid(ItemStack container); /** - * + * * @param container * ItemStack which is the fluid container. * @return Capacity of this fluid container. @@ -32,7 +30,7 @@ public interface IFluidContainerItem int getCapacity(ItemStack container); /** - * + * * @param container * ItemStack which is the fluid container. * @param resource @@ -45,7 +43,7 @@ public interface IFluidContainerItem int fill(ItemStack container, FluidStack resource, boolean doFill); /** - * + * * @param container * ItemStack which is the fluid container. * @param maxDrain diff --git a/src/main/java/net/minecraftforge/fluids/IFluidHandler.java b/src/main/java/net/minecraftforge/fluids/IFluidHandler.java index 27880f4a97..a788328a8d 100644 --- a/src/main/java/net/minecraftforge/fluids/IFluidHandler.java +++ b/src/main/java/net/minecraftforge/fluids/IFluidHandler.java @@ -8,8 +8,6 @@ import net.minecraft.util.EnumFacing; * * A reference implementation is provided {@link TileFluidHandler}. * - * @author King Lemming - * */ public interface IFluidHandler { diff --git a/src/main/java/net/minecraftforge/fluids/IFluidTank.java b/src/main/java/net/minecraftforge/fluids/IFluidTank.java index 7416761854..ec64a94759 100644 --- a/src/main/java/net/minecraftforge/fluids/IFluidTank.java +++ b/src/main/java/net/minecraftforge/fluids/IFluidTank.java @@ -2,11 +2,8 @@ package net.minecraftforge.fluids; /** * A tank is the unit of interaction with Fluid inventories. - * + * * A reference implementation can be found at {@link FluidTank}. - * - * @author King Lemming, cpw (ILiquidTank) - * */ public interface IFluidTank { @@ -28,15 +25,15 @@ public interface IFluidTank /** * Returns a wrapper object {@link FluidTankInfo } containing the capacity of the tank and the * FluidStack it holds. - * + * * Should prevent manipulation of the IFluidTank. See {@link FluidTank}. - * + * * @return State information for the IFluidTank. */ FluidTankInfo getInfo(); /** - * + * * @param resource * FluidStack attempting to fill the tank. * @param doFill @@ -46,7 +43,7 @@ public interface IFluidTank int fill(FluidStack resource, boolean doFill); /** - * + * * @param maxDrain * Maximum amount of fluid to be removed from the container. * @param doFill diff --git a/src/main/java/net/minecraftforge/fluids/ItemFluidContainer.java b/src/main/java/net/minecraftforge/fluids/ItemFluidContainer.java index 85e4699412..6127133e2a 100644 --- a/src/main/java/net/minecraftforge/fluids/ItemFluidContainer.java +++ b/src/main/java/net/minecraftforge/fluids/ItemFluidContainer.java @@ -6,9 +6,6 @@ import net.minecraft.nbt.NBTTagCompound; /** * Reference implementation of {@link IFluidContainerItem}. Use/extend this or implement your own. - * - * @author King Lemming - * */ public class ItemFluidContainer extends Item implements IFluidContainerItem { diff --git a/src/main/java/net/minecraftforge/fluids/TileFluidHandler.java b/src/main/java/net/minecraftforge/fluids/TileFluidHandler.java index a48f2ee954..f90247f6aa 100644 --- a/src/main/java/net/minecraftforge/fluids/TileFluidHandler.java +++ b/src/main/java/net/minecraftforge/fluids/TileFluidHandler.java @@ -7,9 +7,6 @@ import net.minecraft.util.EnumFacing; /** * Reference Tile Entity implementation of {@link IFluidHandler}. Use/extend this or write your own. - * - * @author King Lemming - * */ public class TileFluidHandler extends TileEntity implements IFluidHandler { diff --git a/src/main/java/net/minecraftforge/fluids/UniversalBucket.java b/src/main/java/net/minecraftforge/fluids/UniversalBucket.java index 86a4452808..03ceb7797d 100644 --- a/src/main/java/net/minecraftforge/fluids/UniversalBucket.java +++ b/src/main/java/net/minecraftforge/fluids/UniversalBucket.java @@ -6,15 +6,19 @@ 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.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.stats.StatList; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.translation.I18n; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.StatCollector; +import net.minecraft.util.SoundCategory; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.FillBucketEvent; import net.minecraftforge.fml.common.eventhandler.Event; @@ -88,27 +92,27 @@ public class UniversalBucket extends Item implements IFluidContainerItem String unloc = this.getUnlocalizedNameInefficiently(stack); - if (StatCollector.canTranslate(unloc + "." + fluidStack.getFluid().getName())) + if (I18n.canTranslate(unloc + "." + fluidStack.getFluid().getName())) { - return StatCollector.translateToLocal(unloc + "." + fluidStack.getFluid().getName()); + return I18n.translateToLocal(unloc + "." + fluidStack.getFluid().getName()); } - return StatCollector.translateToLocalFormatted(unloc + ".name", fluidStack.getLocalizedName()); + return I18n.translateToLocalFormatted(unloc + ".name", fluidStack.getLocalizedName()); } @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) + public ActionResult onItemRightClick(ItemStack itemstack, World world, EntityPlayer player, EnumHand hand) { FluidStack fluidStack = getFluid(itemstack); // empty bucket shouldn't exist, do nothing since it should be handled by the bucket event if (fluidStack == null) { - return itemstack; + return ActionResult.newResult(EnumActionResult.PASS, itemstack); } // clicked on a block? - MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, false); - if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + RayTraceResult mop = this.getMovingObjectPositionFromPlayer(world, player, false); + if (mop != null && mop.typeOfHit == RayTraceResult.Type.BLOCK) { BlockPos clickPos = mop.getBlockPos(); // can we place liquid there? @@ -125,7 +129,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem && !player.capabilities.isCreativeMode) { // success! - player.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + player.triggerAchievement(StatList.func_188057_b(this)); itemstack.stackSize--; ItemStack emptyStack = empty != null ? empty.copy() : new ItemStack(this); @@ -133,13 +137,13 @@ public class UniversalBucket extends Item implements IFluidContainerItem // check whether we replace the item or add the empty one to the inventory if (itemstack.stackSize <= 0) { - return emptyStack; + return ActionResult.newResult(EnumActionResult.SUCCESS, emptyStack); } else { // add empty bucket to player inventory ItemHandlerHelper.giveItemToPlayer(player, emptyStack); - return itemstack; + return ActionResult.newResult(EnumActionResult.SUCCESS, itemstack); } } } @@ -147,7 +151,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem } // couldn't place liquid there2 - return itemstack; + return ActionResult.newResult(EnumActionResult.FAIL, itemstack); } @@ -158,7 +162,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem return false; } - Material material = worldIn.getBlockState(pos).getBlock().getMaterial(); + Material material = worldIn.getBlockState(pos).func_185904_a(); boolean isSolid = material.isSolid(); // can only place in air or non-solid blocks @@ -173,8 +177,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem int i = pos.getX(); int j = pos.getY(); int k = pos.getZ(); - worldIn.playSoundEffect((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k - + 0.5F), "random.fizz", 0.5F, + worldIn.func_184133_a(null, pos, SoundEvents.field_187646_bt, SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F); for (int l = 0; l < 8; ++l) @@ -206,21 +209,21 @@ public class UniversalBucket extends Item implements IFluidContainerItem } // not for us to handle - if (event.current == null || - !event.current.isItemEqual(empty) || - (nbtSensitive && ItemStack.areItemStackTagsEqual(event.current, empty))) + if (event.getEmptyBucket() == null || + !event.getEmptyBucket().isItemEqual(empty) || + (nbtSensitive && ItemStack.areItemStackTagsEqual(event.getEmptyBucket(), empty))) { return; } // needs to target a block - if (event.target == null || event.target.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) + if (event.getTarget() == null || event.getTarget().typeOfHit != RayTraceResult.Type.BLOCK) { return; } - World world = event.world; - BlockPos pos = event.target.getBlockPos(); + World world = event.getWorld(); + BlockPos pos = event.getTarget().getBlockPos(); IBlockState state = world.getBlockState(pos); // Note that water and lava are NOT an instance of IFluidBlock! They are therefore not handled by this code! if (state.getBlock() instanceof IFluidBlock) @@ -243,7 +246,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem // set it as the result event.setResult(Event.Result.ALLOW); - event.result = filledBucket; + event.setFilledBucket(filledBucket); } else { diff --git a/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java b/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java index 433b3f48e0..a373a1c163 100644 --- a/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java +++ b/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java @@ -2,8 +2,10 @@ package net.minecraftforge.items; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.SoundCategory; import net.minecraft.world.World; import net.minecraftforge.items.wrapper.PlayerMainInvWrapper; @@ -155,8 +157,8 @@ public class ItemHandlerHelper // play sound if something got picked up if (remainder == null || remainder.stackSize != stack.stackSize) { - world.playSoundEffect(player.posX, player.posY, player.posZ, - "random.pop", 0.2F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + world.func_184148_a(player, player.posX, player.posY, player.posZ, + SoundEvents.field_187638_cR, SoundCategory.PLAYERS, 0.2F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); } // drop remaining itemstack into the world From 09bac53ed68e55c33286e7cd42c8469bb6f56821 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 6 Mar 2016 17:01:52 -0800 Subject: [PATCH 041/243] Fishing is now a loot table no more need for FishingHooks. {LootTables still need to be evaludated if they need extra hooks, but thats later} Goodbye 44 compile errors! --- .../minecraftforge/common/FishingHooks.java | 113 ------------------ 1 file changed, 113 deletions(-) delete mode 100644 src/main/java/net/minecraftforge/common/FishingHooks.java diff --git a/src/main/java/net/minecraftforge/common/FishingHooks.java b/src/main/java/net/minecraftforge/common/FishingHooks.java deleted file mode 100644 index 70c10185ad..0000000000 --- a/src/main/java/net/minecraftforge/common/FishingHooks.java +++ /dev/null @@ -1,113 +0,0 @@ -package net.minecraftforge.common; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Random; - -import com.google.common.base.Predicate; - -import net.minecraft.entity.projectile.EntityFishHook; -import net.minecraft.item.ItemStack; -import net.minecraft.stats.StatBase; -import net.minecraft.stats.StatList; -import net.minecraft.util.MathHelper; -import net.minecraft.util.WeightedRandom; -import net.minecraft.util.WeightedRandomFishable; - -public class FishingHooks -{ - private static ArrayList fish = new ArrayList(); - private static ArrayList junk = new ArrayList(); - private static ArrayList treasure = new ArrayList(); - - public static void addFish(WeightedRandomFishable item) { fish.add(item); } - public static void addJunk(WeightedRandomFishable item) { junk.add(item); } - public static void addTreasure(WeightedRandomFishable item) { treasure.add(item); } - - public static void removeFish(Predicate test) { remove(fish.iterator(), test); } - public static void removeJunk(Predicate test) { remove(junk.iterator(), test); } - public static void removeTreasure(Predicate test) { remove(treasure.iterator(), test); } - - public static ItemStack getRandomFishable(Random rand, float chance) - { - return getRandomFishable(rand, chance, 0, 0); - } - - public static ItemStack getRandomFishable(Random rand, float chance, int luck, int speed) - { - float junkChance = 0.1F - luck * 0.025F - speed * 0.01F; - float treasureChance = 0.05F + luck * 0.01F - speed * 0.01F; - junkChance = MathHelper.clamp_float(junkChance, 0.0F, 1.0F); - treasureChance = MathHelper.clamp_float(treasureChance, 0.0F, 1.0F); - - if (chance < junkChance) - { - return ((WeightedRandomFishable)WeightedRandom.getRandomItem(rand, junk)).getItemStack(rand); - } - - chance -= junkChance; - if (chance < treasureChance) - { - return ((WeightedRandomFishable)WeightedRandom.getRandomItem(rand, treasure)).getItemStack(rand); - } - - chance -= treasureChance; - // this is done in EntityFishHook.func_146033_f. more loot types expected? - { - return ((WeightedRandomFishable)WeightedRandom.getRandomItem(rand, fish)).getItemStack(rand); - } - } - - public static FishableCategory getFishableCategory(float chance, int luck, int speed) - { - float junkChance = 0.1F - luck * 0.025F - speed * 0.01F; - float treasureChance = 0.05F + luck * 0.01F - speed * 0.01F; - junkChance = MathHelper.clamp_float(junkChance, 0.0F, 1.0F); - treasureChance = MathHelper.clamp_float(treasureChance, 0.0F, 1.0F); - - if (chance < junkChance) - { - return FishableCategory.JUNK; - } - - chance -= junkChance; - if (chance < treasureChance) - { - return FishableCategory.TREASURE; - } - - chance -= treasureChance; - // this is done in EntityFishHook.func_146033_f. more loot types expected? - { - return FishableCategory.FISH; - } - } - - private static void remove(Iterator iter, Predicate test) - { - while (iter.hasNext()) - if (!test.apply(iter.next())) - iter.remove(); - } - - static - { - fish.addAll(EntityFishHook.FISH); - junk.addAll(EntityFishHook.JUNK); - treasure.addAll(EntityFishHook.TREASURE); - } - - public static enum FishableCategory - { - JUNK(StatList.junkFishedStat), - TREASURE(StatList.treasureFishedStat), - FISH(StatList.fishCaughtStat); - - public final StatBase stat; - - FishableCategory(StatBase stat) - { - this.stat = stat; - } - } -} \ No newline at end of file From a83fe44d8a90b4db18b162a2e249eeca22cd7b92 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 6 Mar 2016 18:02:44 -0800 Subject: [PATCH 042/243] Temporary hack to fix MCP mappings for param names we are using that is causing compile errors. --- build.gradle | 12 +++++++++++ .../projectile/EntityFishHook.java.patch.rej | 21 ------------------- 2 files changed, 12 insertions(+), 21 deletions(-) delete mode 100644 rejects/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch.rej diff --git a/build.gradle b/build.gradle index cf8043dae8..db62cdfb5e 100644 --- a/build.gradle +++ b/build.gradle @@ -374,3 +374,15 @@ String getVersionFromJava(File file) // should be remvoed, and the jenkisn fixed when no longer building with FG 1.2 task setupForge { dependsOn 'setup' } task buildPackages { dependsOn 'build' } + +//Temporary hack to fix compile errors caused by 1.8.9 mappings on 1.9 +task fixParams << { + logger.lifecycle('Fixing param names!') + def params = new File(extractMcpMappings.destinationDir, 'params.csv') + def text = params.text + text = text.replaceAll('p_150893_2_,block,', 'p_150893_2_,state,') + text = text.replaceAll('p_148611_1_,sound,', 'p_148611_1_,p_sound,') + params.write(text) +} +fixParams.dependsOn('extractMcpMappings') +extractMcpMappings.finalizedBy('fixParams') diff --git a/rejects/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch.rej b/rejects/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch.rej deleted file mode 100644 index c55c19e5d6..0000000000 --- a/rejects/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch.rej +++ /dev/null @@ -1,21 +0,0 @@ -++++ REJECTED PATCH 1 - } - } - -+ @SuppressWarnings("unused") - private ItemStack getFishingResult() - { - float f = this.worldObj.rand.nextFloat(); - int i = EnchantmentHelper.getLuckOfSeaModifier(this.angler); - int j = EnchantmentHelper.getLureModifier(this.angler); -+ -+ if (true) -+ { -+ this.angler.addStat(net.minecraftforge.common.FishingHooks.getFishableCategory(f, i, j).stat, 1); -+ return net.minecraftforge.common.FishingHooks.getRandomFishable(this.rand, f, i, j); -+ } -+ - float f1 = 0.1F - (float)i * 0.025F - (float)j * 0.01F; - float f2 = 0.05F + (float)i * 0.01F - (float)j * 0.01F; - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -++++ END PATCH From 2847644368572c84489d3a2886d01f7d7babeb43 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 6 Mar 2016 18:45:21 -0800 Subject: [PATCH 043/243] NetworkDispatcher/FMLProxyPacket 41 more errors cleaned. --- .../network/handshake/NetworkDispatcher.java | 48 +++++++++---------- .../network/internal/FMLProxyPacket.java | 16 +++---- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java b/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java index a88abe4cf8..e99d59767e 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java +++ b/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java @@ -27,12 +27,12 @@ import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.INetHandlerPlayClient; -import net.minecraft.network.play.client.C17PacketCustomPayload; -import net.minecraft.network.play.server.S01PacketJoinGame; -import net.minecraft.network.play.server.S3FPacketCustomPayload; -import net.minecraft.network.play.server.S40PacketDisconnect; -import net.minecraft.server.management.ServerConfigurationManager; -import net.minecraft.util.TextComponentString; +import net.minecraft.network.play.client.CPacketCustomPayload; +import net.minecraft.network.play.server.SPacketJoinGame; +import net.minecraft.network.play.server.SPacketCustomPayload; +import net.minecraft.network.play.server.SPacketDisconnect; +import net.minecraft.server.management.PlayerList; +import net.minecraft.util.text.TextComponentString; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -73,7 +73,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple return net; } - public static NetworkDispatcher allocAndSet(NetworkManager manager, ServerConfigurationManager scm) + public static NetworkDispatcher allocAndSet(NetworkManager manager, PlayerList scm) { NetworkDispatcher net = new NetworkDispatcher(manager, scm); manager.channel().attr(FML_DISPATCHER).getAndSet(net); @@ -84,7 +84,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple public static final AttributeKey IS_LOCAL = AttributeKey.valueOf("fml:isLocal"); public static final AttributeKey FML_GAMEDATA_SNAPSHOT = AttributeKey.valueOf("fml:gameDataSnapshot"); public final NetworkManager manager; - private final ServerConfigurationManager scm; + private final PlayerList scm; private EntityPlayerMP player; private ConnectionState state; private ConnectionType connectionType; @@ -110,7 +110,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple PacketLoggingHandler.register(manager); } - public NetworkDispatcher(NetworkManager manager, ServerConfigurationManager scm) + public NetworkDispatcher(NetworkManager manager, PlayerList scm) { super(Packet.class, false); this.manager = manager; @@ -206,7 +206,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple int dimension = playerNBT.getInteger("Dimension"); if (DimensionManager.isDimensionRegistered(dimension)) { - return dimension; + return dimension; } } return 0; @@ -243,13 +243,13 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple protected void channelRead0(ChannelHandlerContext ctx, Packet msg) throws Exception { boolean handled = false; - if (msg instanceof C17PacketCustomPayload) + if (msg instanceof CPacketCustomPayload) { - handled = handleServerSideCustomPacket((C17PacketCustomPayload) msg, ctx); + handled = handleServerSideCustomPacket((CPacketCustomPayload) msg, ctx); } - else if (msg instanceof S3FPacketCustomPayload) + else if (msg instanceof SPacketCustomPayload) { - handled = handleClientSideCustomPacket((S3FPacketCustomPayload)msg, ctx); + handled = handleClientSideCustomPacket((SPacketCustomPayload)msg, ctx); } else if (state != ConnectionState.CONNECTED && state != ConnectionState.HANDSHAKECOMPLETE) { @@ -263,7 +263,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple private boolean handleVanilla(Packet msg) { - if (state == ConnectionState.AWAITING_HANDSHAKE && msg instanceof S01PacketJoinGame) + if (state == ConnectionState.AWAITING_HANDSHAKE && msg instanceof SPacketJoinGame) { handshakeChannel.pipeline().fireUserEventTriggered(msg); } @@ -304,7 +304,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple kickWithMessage("This is modded. No modded response received. Bye!"); } @SuppressWarnings("unchecked") - private void kickWithMessage(String message) + private void kickWithMessage(String message) { final TextComponentString TextComponentString = new TextComponentString(message); if (side == Side.CLIENT) @@ -313,7 +313,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple } else { - manager.sendPacket(new S40PacketDisconnect(TextComponentString), new GenericFutureListener>() + manager.sendPacket(new SPacketDisconnect(TextComponentString), new GenericFutureListener>() { @Override public void operationComplete(Future result) @@ -326,7 +326,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple } private MultiPartCustomPayload multipart = null; - private boolean handleClientSideCustomPacket(S3FPacketCustomPayload msg, ChannelHandlerContext context) + private boolean handleClientSideCustomPacket(SPacketCustomPayload msg, ChannelHandlerContext context) { String channelName = msg.getChannelName(); if ("FML|MP".equals(channelName)) @@ -389,7 +389,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple return false; } - private boolean handleServerSideCustomPacket(C17PacketCustomPayload msg, ChannelHandlerContext context) + private boolean handleServerSideCustomPacket(CPacketCustomPayload msg, ChannelHandlerContext context) { if (state == ConnectionState.AWAITING_HANDSHAKE) { @@ -457,11 +457,11 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple { if (side == Side.CLIENT) { - MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ClientDisconnectionFromServerEvent(manager)); + MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ClientDisconnectionFromServerEvent(manager)); } else { - MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ServerDisconnectionFromClientEvent(manager)); + MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ServerDisconnectionFromClientEvent(manager)); } cleanAttributes(ctx); ctx.disconnect(promise); @@ -476,7 +476,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple } else { - MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ServerDisconnectionFromClientEvent(manager)); + MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ServerDisconnectionFromClientEvent(manager)); } cleanAttributes(ctx); ctx.close(promise); @@ -582,12 +582,12 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple FMLLog.fine("Received override dimension %d", overrideDim); } - public int getOverrideDimension(S01PacketJoinGame packetIn) { + public int getOverrideDimension(SPacketJoinGame packetIn) { FMLLog.fine("Overriding dimension: using %d", this.overrideLoginDim); return this.overrideLoginDim != 0 ? this.overrideLoginDim : packetIn.getDimension(); } - private class MultiPartCustomPayload extends S3FPacketCustomPayload + private class MultiPartCustomPayload extends SPacketCustomPayload { private String channel; private byte[] data; diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLProxyPacket.java b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLProxyPacket.java index 66a9cd302d..b05b8b13b9 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLProxyPacket.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLProxyPacket.java @@ -13,8 +13,8 @@ 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.client.C17PacketCustomPayload; -import net.minecraft.network.play.server.S3FPacketCustomPayload; +import net.minecraft.network.play.client.CPacketCustomPayload; +import net.minecraft.network.play.server.SPacketCustomPayload; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.network.FMLNetworkException; import net.minecraftforge.fml.common.network.NetworkRegistry; @@ -39,13 +39,13 @@ public class FMLProxyPacket implements Packet { private static Multiset badPackets = ConcurrentHashMultiset.create(); private static int packetCountWarning = Integers.parseInt(System.getProperty("fml.badPacketCounter", "100"), 100); - public FMLProxyPacket(S3FPacketCustomPayload original) + public FMLProxyPacket(SPacketCustomPayload original) { this(original.getBufferData(), original.getChannelName()); this.target = Side.CLIENT; } - public FMLProxyPacket(C17PacketCustomPayload original) + public FMLProxyPacket(CPacketCustomPayload original) { this(original.getBufferData(), original.getChannelName()); this.target = Side.SERVER; @@ -121,7 +121,7 @@ public class FMLProxyPacket implements Packet { } public Packet toC17Packet() { - return new C17PacketCustomPayload(channel, payload); + return new CPacketCustomPayload(channel, payload); } static final int PART_SIZE = 0x1000000 - 0x50; // Make it a constant so that it gets inlined below. @@ -133,7 +133,7 @@ public class FMLProxyPacket implements Packet { if (data.length < PART_SIZE) { - ret.add(new S3FPacketCustomPayload(channel, new PacketBuffer(payload.duplicate()))); + ret.add(new SPacketCustomPayload(channel, new PacketBuffer(payload.duplicate()))); } else { @@ -146,7 +146,7 @@ public class FMLProxyPacket implements Packet { preamble.writeString(channel); preamble.writeByte(parts); preamble.writeInt(data.length); - ret.add(new S3FPacketCustomPayload("FML|MP", preamble)); + ret.add(new SPacketCustomPayload("FML|MP", preamble)); int offset = 0; for (int x = 0; x < parts; x++) @@ -156,7 +156,7 @@ public class FMLProxyPacket implements Packet { tmp[0] = (byte)(x & 0xFF); System.arraycopy(data, offset, tmp, 1, tmp.length - 1); offset += tmp.length - 1; - ret.add(new S3FPacketCustomPayload("FML|MP", new PacketBuffer(Unpooled.wrappedBuffer(tmp)))); + ret.add(new SPacketCustomPayload("FML|MP", new PacketBuffer(Unpooled.wrappedBuffer(tmp)))); } } return ret; From b342bf848125e5136d292b917724c752e562e2e2 Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 6 Mar 2016 23:07:25 -0500 Subject: [PATCH 044/243] Some fixups for FML, and use the FML registry for potions --- .../net/minecraft/potion/Potion.java.patch | 19 +++++++++++++++++-- .../network/internal/EntitySpawnHandler.java | 2 +- .../common/network/internal/FMLMessage.java | 8 ++++---- .../network/internal/FMLNetworkHandler.java | 4 ++-- .../fml/common/registry/GameData.java | 4 +--- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch b/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch index 98abf7344b..e908c64196 100644 --- a/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch @@ -1,6 +1,21 @@ --- ../src-base/minecraft/net/minecraft/potion/Potion.java +++ ../src-work/minecraft/net/minecraft/potion/Potion.java -@@ -195,7 +195,6 @@ +@@ -18,12 +18,13 @@ + import net.minecraft.util.StringUtils; + import net.minecraft.util.math.MathHelper; + import net.minecraft.util.registry.RegistryNamespaced; ++import net.minecraftforge.fml.common.registry.GameData; + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + + public class Potion + { +- public static final RegistryNamespaced field_188414_b = new RegistryNamespaced(); ++ public static final RegistryNamespaced field_188414_b = GameData.getPotionRegistry(); + private final Map attributeModifierMap = Maps.newHashMap(); + private final boolean isBadEffect; + private final int liquidColor; +@@ -195,7 +196,6 @@ return this.statusIconIndex; } @@ -8,7 +23,7 @@ public boolean isBadEffect() { return this.isBadEffect; -@@ -266,7 +265,37 @@ +@@ -266,7 +266,37 @@ return modifier.getAmount() * (double)(p_111183_1_ + 1); } diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java b/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java index 00c1f70794..be45fec147 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java @@ -126,7 +126,7 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler 0) diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java index a19c46187c..2a70bbea5f 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java @@ -6,11 +6,11 @@ import io.netty.buffer.Unpooled; import java.io.IOException; import java.util.List; +import net.minecraft.network.datasync.EntityDataManager; import org.apache.logging.log4j.Level; import com.google.common.base.Throwables; -import net.minecraft.entity.DataWatcher; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.network.PacketBuffer; @@ -157,7 +157,7 @@ public abstract class FMLMessage { double speedScaledX; double speedScaledY; double speedScaledZ; - List dataWatcherList; + List> dataWatcherList; ByteBuf dataStream; public EntitySpawnMessage() {} @@ -193,7 +193,7 @@ public abstract class FMLMessage { PacketBuffer pb = new PacketBuffer(tmpBuf); try { - entity.getDataWatcher().writeTo(pb); + entity.func_184212_Q().func_187216_a(pb); } catch (IOException e) { FMLLog.log(Level.FATAL,e,"Encountered fatal exception trying to send entity spawn data watchers"); @@ -247,7 +247,7 @@ public abstract class FMLMessage { scaledHeadYaw = dat.readByte() * 360F / 256F; try { - dataWatcherList = DataWatcher.readWatchedListFromPacketBuffer(new PacketBuffer(dat)); + dataWatcherList = EntityDataManager.func_187215_b(new PacketBuffer(dat)); } catch (IOException e) { FMLLog.log(Level.FATAL, e, "There was a critical error decoding the datawatcher stream for a mod entity."); diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java index 2bbafe3642..6dd48390a5 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java @@ -27,7 +27,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.Container; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; -import net.minecraft.server.management.ServerConfigurationManager; +import net.minecraft.server.management.PlayerList; import net.minecraft.world.World; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -59,7 +59,7 @@ public class FMLNetworkHandler public static final int LOGIN_TIMEOUT = Integers.parseInt(System.getProperty("fml.loginTimeout","600"),600); private static EnumMap channelPair; - public static void fmlServerHandshake(ServerConfigurationManager scm, NetworkManager manager, EntityPlayerMP player) + public static void fmlServerHandshake(PlayerList scm, NetworkManager manager, EntityPlayerMP player) { NetworkDispatcher dispatcher = NetworkDispatcher.allocAndSet(manager, scm); dispatcher.serverToClientHandshake(player); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index 80e94566c5..525f9cde55 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -254,9 +254,7 @@ public class GameData @Override public void onAdd(Potion potion, int id) { - // fix the data in the potion and the potions-array - potion.id = id; - Potion.potionTypes[id] = potion; + // no op for the minute? } } } \ No newline at end of file From 01912a459a4f23836c3c533f0e7815aa621f6de3 Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 6 Mar 2016 23:18:36 -0500 Subject: [PATCH 045/243] Some more FML related fixups --- .../net/minecraft/util/IntIdentityHashBiMap.java.patch | 10 ++++++++++ .../fml/common/network/FMLOutboundHandler.java | 6 +++--- .../registry/FMLControlledNamespacedRegistry.java | 7 ++++--- .../fml/common/registry/PersistentRegistryManager.java | 2 -- 4 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 patches.mcp/minecraft/net/minecraft/util/IntIdentityHashBiMap.java.patch diff --git a/patches.mcp/minecraft/net/minecraft/util/IntIdentityHashBiMap.java.patch b/patches.mcp/minecraft/net/minecraft/util/IntIdentityHashBiMap.java.patch new file mode 100644 index 0000000000..2b9932be97 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/IntIdentityHashBiMap.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/util/IntIdentityHashBiMap.java ++++ ../src-work/minecraft/net/minecraft/util/IntIdentityHashBiMap.java +@@ -166,7 +166,6 @@ + return Iterators.filter(Iterators.forArray(this.field_186820_d), Predicates.notNull()); + } + +- @SideOnly(Side.CLIENT) + public void func_186812_a() + { + Arrays.fill(this.field_186818_b, (Object)null); diff --git a/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java b/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java index 11d4715cfd..5db838deaa 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java @@ -128,7 +128,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter { public List selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet) { ImmutableList.Builder builder = ImmutableList.builder(); - for (EntityPlayerMP player : (List)FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList) + for (EntityPlayerMP player : (List)FMLCommonHandler.instance().getMinecraftServerInstance().func_184103_al().getPlayerList()) { NetworkDispatcher dispatcher = player.playerNetServerHandler.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get(); if (dispatcher != null) builder.add(dispatcher); @@ -156,7 +156,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter { { int dimension = (Integer)args; ImmutableList.Builder builder = ImmutableList.builder(); - for (EntityPlayerMP player : (List)FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList) + for (EntityPlayerMP player : (List)FMLCommonHandler.instance().getMinecraftServerInstance().func_184103_al().getPlayerList()) { if (dimension == player.dimension) { @@ -190,7 +190,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter { { TargetPoint tp = (TargetPoint)args; ImmutableList.Builder builder = ImmutableList.builder(); - for (EntityPlayerMP player : (List)FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList) + for (EntityPlayerMP player : (List)FMLCommonHandler.instance().getMinecraftServerInstance().func_184103_al().getPlayerList()) { if (player.dimension == tp.dimension) { diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index 22b66734c8..b18c2cf51c 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -17,6 +17,7 @@ import com.google.common.collect.HashBiMap; import com.google.common.collect.Iterators; import com.google.common.collect.Maps; import com.google.common.collect.Sets; +import net.minecraft.util.IntIdentityHashBiMap; import org.apache.commons.lang3.Validate; import org.apache.logging.log4j.Level; @@ -170,7 +171,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul this.dummiedLocations.clear(); this.dummiedLocations.addAll(otherRegistry.dummiedLocations); - underlyingIntegerMap = new ObjectIntIdentityMap(); + underlyingIntegerMap.func_186812_a(); registryObjects.clear(); for (I thing : otherRegistry.typeSafeIterable()) @@ -556,7 +557,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul throw new IllegalArgumentException("The object to be added to the registry is not of the right type. Reflection/ASM hackery? Registry bug?"); } - underlyingIntegerMap.put(thing, id); // obj <-> id + underlyingIntegerMap.func_186814_a(thing, id); // obj <-> id super.putObject(name, thing); // name <-> obj availabilityMap.set(id); if (addCallback != null) @@ -758,7 +759,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul for (I i : this.underlyingIntegerMap) { - addCallback.onAdd(i, this.underlyingIntegerMap.get(i)); + addCallback.onAdd(i, this.underlyingIntegerMap.func_186808_c(i)); } } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index 8e8c4f7051..379e298f51 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -152,8 +152,6 @@ public class PersistentRegistryManager // Empty the blockstate map before loading GameData.getBlockStateIDMap().clear(); - // Clean up potion array before reloading it from the snapshot - Arrays.fill(Potion.potionTypes, null); // Load the snapshot into the "STAGING" registry for (Map.Entry snapshotEntry : snapshot.entries.entrySet()) From e49e6a9e09b14cfbe897c67ec5773b3c1ea3091d Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 6 Mar 2016 23:20:06 -0500 Subject: [PATCH 046/243] Fix up import in Potion --- .../net/minecraft/potion/Potion.java.patch | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch b/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch index e908c64196..dc766effa5 100644 --- a/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch @@ -1,21 +1,15 @@ --- ../src-base/minecraft/net/minecraft/potion/Potion.java +++ ../src-work/minecraft/net/minecraft/potion/Potion.java -@@ -18,12 +18,13 @@ - import net.minecraft.util.StringUtils; - import net.minecraft.util.math.MathHelper; - import net.minecraft.util.registry.RegistryNamespaced; -+import net.minecraftforge.fml.common.registry.GameData; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; +@@ -23,7 +23,7 @@ public class Potion { - public static final RegistryNamespaced field_188414_b = new RegistryNamespaced(); -+ public static final RegistryNamespaced field_188414_b = GameData.getPotionRegistry(); ++ public static final RegistryNamespaced field_188414_b = net.minecraftforge.fml.common.registry.GameData.getPotionRegistry(); private final Map attributeModifierMap = Maps.newHashMap(); private final boolean isBadEffect; private final int liquidColor; -@@ -195,7 +196,6 @@ +@@ -195,7 +195,6 @@ return this.statusIconIndex; } @@ -23,7 +17,7 @@ public boolean isBadEffect() { return this.isBadEffect; -@@ -266,7 +266,37 @@ +@@ -266,7 +265,37 @@ return modifier.getAmount() * (double)(p_111183_1_ + 1); } From 2dcb2187c0a3c6a4a2d860b6abb04d61acb427ad Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 6 Mar 2016 23:42:30 -0500 Subject: [PATCH 047/243] Some client handler cleanup --- .../gui/GuiListWorldSelectionEntry.java.patch | 11 ++++++++++ .../client/gui/GuiSelectWorld.java.patch.rej | 10 ---------- .../fml/client/FMLClientHandler.java | 20 ++++++++++--------- .../fml/client/GuiOldSaveLoadConfirm.java | 3 +-- 4 files changed, 23 insertions(+), 21 deletions(-) create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java.patch delete mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java.patch new file mode 100644 index 0000000000..3731eb6579 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java +@@ -242,7 +242,7 @@ + + if (this.field_186784_e.getSaveLoader().canLoadWorld(this.field_186786_g.getFileName())) + { +- this.field_186784_e.launchIntegratedServer(this.field_186786_g.getFileName(), this.field_186786_g.getDisplayName(), (WorldSettings)null); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(field_186785_f, this.field_186786_g); + } + } + diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch.rej deleted file mode 100644 index d588a78c5e..0000000000 --- a/rejects/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - - if (this.mc.getSaveLoader().canLoadWorld(s)) - { -- this.mc.launchIntegratedServer(s, s1, (WorldSettings)null); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(this, s, s1); - } - } - } -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java index 3f24d4e62c..a782e3042a 100644 --- a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java +++ b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java @@ -30,16 +30,17 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiIngameMenu; +import net.minecraft.client.gui.GuiListWorldSelectionEntry; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.GuiSelectWorld; +import net.minecraft.client.gui.GuiWorldSelection; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.ServerListEntryNormal; import net.minecraft.client.multiplayer.GuiConnecting; import net.minecraft.client.multiplayer.ServerData; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.network.NetHandlerPlayClient; -import net.minecraft.client.network.OldServerPinger; +import net.minecraft.client.network.ServerPinger; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.AbstractResourcePack; import net.minecraft.client.resources.FallbackResourceManager; @@ -67,6 +68,7 @@ import net.minecraft.util.IThreadListener; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StringUtils; import net.minecraft.world.WorldSettings; +import net.minecraft.world.storage.SaveFormatComparator; import net.minecraft.world.storage.SaveFormatOld; import net.minecraftforge.client.model.animation.Animation; import net.minecraftforge.fml.client.registry.RenderingRegistry; @@ -123,7 +125,7 @@ import com.google.gson.JsonObject; /** * Handles primary communication from hooked code into the system * - * The FML entry point is {@link #beginMinecraftLoading(Minecraft, List)} called from + * The FML entry point is {@link #beginMinecraftLoading(Minecraft, List, IReloadableResourceManager)} called from * {@link Minecraft} * * Obfuscated code should focus on this class and other members of the "server" @@ -666,9 +668,9 @@ public class FMLClientHandler implements IFMLSidedHandler { return new File(client.mcDataDir, "saves"); } - public void tryLoadExistingWorld(GuiSelectWorld selectWorldGUI, String dirName, String saveName) + public void tryLoadExistingWorld(GuiWorldSelection selectWorldGUI, SaveFormatComparator comparator) { - File dir = new File(getSavesDir(), dirName); + File dir = new File(getSavesDir(), comparator.getFileName()); NBTTagCompound leveldat; try { @@ -682,20 +684,20 @@ public class FMLClientHandler implements IFMLSidedHandler } catch (Exception e1) { - FMLLog.warning("There appears to be a problem loading the save %s, both level files are unreadable.", dirName); + FMLLog.warning("There appears to be a problem loading the save %s, both level files are unreadable.", comparator.getFileName()); return; } } NBTTagCompound fmlData = leveldat.getCompoundTag("FML"); if (fmlData.hasKey("ModItemData")) { - showGuiScreen(new GuiOldSaveLoadConfirm(dirName, saveName, selectWorldGUI)); + showGuiScreen(new GuiOldSaveLoadConfirm(comparator.getFileName(), comparator.getDisplayName(), selectWorldGUI)); } else { try { - client.launchIntegratedServer(dirName, saveName, (WorldSettings)null); + client.launchIntegratedServer(comparator.getFileName(), comparator.getDisplayName(), (WorldSettings)null); } catch (StartupQuery.AbortedException e) { @@ -820,7 +822,7 @@ public class FMLClientHandler implements IFMLSidedHandler public void connectToServerAtStartup(String host, int port) { setupServerList(); - OldServerPinger osp = new OldServerPinger(); + ServerPinger osp = new ServerPinger(); ServerData serverData = new ServerData("Command Line", host+":"+port,false); try { diff --git a/src/main/java/net/minecraftforge/fml/client/GuiOldSaveLoadConfirm.java b/src/main/java/net/minecraftforge/fml/client/GuiOldSaveLoadConfirm.java index ccc4269dd4..9244883935 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiOldSaveLoadConfirm.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiOldSaveLoadConfirm.java @@ -6,7 +6,7 @@ import java.io.IOException; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiLabel; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.GuiSelectWorld; +import net.minecraft.client.gui.GuiWorldSelection; import net.minecraft.client.gui.GuiYesNo; import net.minecraft.client.gui.GuiYesNoCallback; import net.minecraft.world.WorldSettings; @@ -57,7 +57,6 @@ public class GuiOldSaveLoadConfirm extends GuiYesNo implements GuiYesNoCallback { if (button.id == 1) { - ObfuscationReflectionHelper.setPrivateValue(GuiSelectWorld.class, (GuiSelectWorld)parentScreen, false, "field_"+"146634_i"); FMLClientHandler.instance().showGuiScreen(parent); } else From 020bf5ee987d4f26e25502f11967f0622d41dfbc Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 6 Mar 2016 23:46:27 -0500 Subject: [PATCH 048/243] Remove two patches that aren't needed anymore --- .../net/minecraft/entity/EntityAgeable.java.patch.rej | 10 ---------- .../net/minecraft/entity/EntityList.java.patch.rej | 11 ----------- 2 files changed, 21 deletions(-) delete mode 100644 rejects/minecraft/net/minecraft/entity/EntityAgeable.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej diff --git a/rejects/minecraft/net/minecraft/entity/EntityAgeable.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityAgeable.java.patch.rej deleted file mode 100644 index 81b980feba..0000000000 --- a/rejects/minecraft/net/minecraft/entity/EntityAgeable.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - { - if (!this.worldObj.isRemote) - { -- Class oclass = EntityList.getClassFromID(itemstack.getMetadata()); -+ Class oclass = EntityList.stringToClassMapping.get(net.minecraft.item.ItemMonsterPlacer.getEntityName(itemstack)); - - if (oclass != null && this.getClass() == oclass) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej deleted file mode 100644 index 81dca3b0fd..0000000000 --- a/rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej +++ /dev/null @@ -1,11 +0,0 @@ -++++ REJECTED PATCH 4 - - public static class EntityEggInfo - { -+ @Deprecated // This is not always a valid number in the global ID list. - public final int spawnedID; -+ public final String name; - public final int primaryColor; - public final int secondaryColor; - public final StatBase field_151512_d; -++++ END PATCH From ade3bbad1449a174f68e0d9dd893f9fba6b8ea92 Mon Sep 17 00:00:00 2001 From: cpw Date: Mon, 7 Mar 2016 00:08:29 -0500 Subject: [PATCH 049/243] Command fixups --- .../server/command/ForgeCommand.java | 39 +++++++------------ .../console/ConsoleCommandCompleter.java | 4 +- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/src/main/java/net/minecraftforge/server/command/ForgeCommand.java b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java index bd2b2eb3c2..1f133aa68f 100644 --- a/src/main/java/net/minecraftforge/server/command/ForgeCommand.java +++ b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java @@ -17,12 +17,6 @@ import net.minecraftforge.server.ForgeTimeTracker; public class ForgeCommand extends CommandBase { private static final DecimalFormat timeFormatter = new DecimalFormat("########0.000"); - private WeakReference server; - - public ForgeCommand(MinecraftServer server) - { - this.server = new WeakReference(server); - } @Override public String getCommandName() @@ -42,7 +36,7 @@ public class ForgeCommand extends CommandBase { return 2; } @Override - public void processCommand(ICommandSender sender, String[] args) throws CommandException + public void func_184881_a(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (args.length == 0) { @@ -54,15 +48,15 @@ public class ForgeCommand extends CommandBase { } else if ("tps".equals(args[0])) { - displayTPS(sender,args); + displayTPS(server, sender,args); } else if ("tpslog".equals(args[0])) { - doTPSLog(sender,args); + doTPSLog(server, sender,args); } else if ("track".equals(args[0])) { - handleTracking(sender, args); + handleTracking(server, sender, args); } else { @@ -71,7 +65,7 @@ public class ForgeCommand extends CommandBase { } @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + public List func_184883_a(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { @@ -80,7 +74,7 @@ public class ForgeCommand extends CommandBase { else if (args.length == 2) { if ("tps".equals(args[0])) { - return getListOfStringsMatchingLastWord(args, getServer().worldTickTimes.keySet()); + return getListOfStringsMatchingLastWord(args, server.worldTickTimes.keySet()); } else if ("track".equals(args[0])) { @@ -90,7 +84,7 @@ public class ForgeCommand extends CommandBase { return null; } - private void handleTracking(ICommandSender sender, String[] args) throws CommandException + private void handleTracking(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (args.length != 3) { @@ -101,7 +95,7 @@ public class ForgeCommand extends CommandBase { if ("te".equals(type)) { - doTurnOnTileEntityTracking(sender, duration); + doTurnOnTileEntityTracking(server, sender, duration); } else { @@ -109,19 +103,19 @@ public class ForgeCommand extends CommandBase { } } - private void doTurnOnTileEntityTracking(ICommandSender sender, int duration) + private void doTurnOnTileEntityTracking(MinecraftServer server, ICommandSender sender, int duration) { ForgeTimeTracker.tileEntityTrackingDuration = duration; ForgeTimeTracker.tileEntityTracking = true; sender.addChatMessage(new TextComponentTranslation("commands.forge.tracking.te.enabled", duration)); } - private void doTPSLog(ICommandSender sender, String[] args) + private void doTPSLog(MinecraftServer server, ICommandSender sender, String[] args) { } - private void displayTPS(ICommandSender sender, String[] args) throws CommandException + private void displayTPS(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { int dim = 0; boolean summary = true; @@ -134,17 +128,17 @@ public class ForgeCommand extends CommandBase { { for (Integer dimId : DimensionManager.getIDs()) { - double worldTickTime = ForgeCommand.mean(this.getServer().worldTickTimes.get(dimId)) * 1.0E-6D; + double worldTickTime = ForgeCommand.mean(server.worldTickTimes.get(dimId)) * 1.0E-6D; double worldTPS = Math.min(1000.0/worldTickTime, 20); sender.addChatMessage(new TextComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dimId), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS))); } - double meanTickTime = ForgeCommand.mean(this.getServer().tickTimeArray) * 1.0E-6D; + double meanTickTime = ForgeCommand.mean(server.tickTimeArray) * 1.0E-6D; double meanTPS = Math.min(1000.0/meanTickTime, 20); sender.addChatMessage(new TextComponentTranslation("commands.forge.tps.summary","Overall", timeFormatter.format(meanTickTime), timeFormatter.format(meanTPS))); } else { - double worldTickTime = ForgeCommand.mean(this.getServer().worldTickTimes.get(dim)) * 1.0E-6D; + double worldTickTime = ForgeCommand.mean(server.worldTickTimes.get(dim)) * 1.0E-6D; double worldTPS = Math.min(1000.0/worldTickTime, 20); sender.addChatMessage(new TextComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dim), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS))); } @@ -160,9 +154,4 @@ public class ForgeCommand extends CommandBase { return sum / values.length; } - - private MinecraftServer getServer() - { - return this.server.get(); - } } diff --git a/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java b/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java index 89ab4ac83a..9b46bc670f 100644 --- a/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java +++ b/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java @@ -47,8 +47,8 @@ public final class ConsoleCommandCompleter implements Completer @Override public List call() throws Exception { - return ConsoleCommandCompleter.this.server.getTabCompletions(ConsoleCommandCompleter.this.server, input, - ConsoleCommandCompleter.this.server.getPosition()); + return ConsoleCommandCompleter.this.server.func_184104_a(ConsoleCommandCompleter.this.server, input, + ConsoleCommandCompleter.this.server.getPosition(), false/* we're not a command block */); } }); try From f0e5baa8e561368de5dc53859728fee766617abd Mon Sep 17 00:00:00 2001 From: cpw Date: Mon, 7 Mar 2016 00:23:00 -0500 Subject: [PATCH 050/243] Few more compile fixups --- .../minecraftforge/common/util/FakePlayer.java | 15 ++++++++------- .../minecraftforge/event/ForgeEventFactory.java | 3 ++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/minecraftforge/common/util/FakePlayer.java b/src/main/java/net/minecraftforge/common/util/FakePlayer.java index 27223a93e5..c9ba77dd98 100644 --- a/src/main/java/net/minecraftforge/common/util/FakePlayer.java +++ b/src/main/java/net/minecraftforge/common/util/FakePlayer.java @@ -2,15 +2,16 @@ package net.minecraftforge.common.util; import com.mojang.authlib.GameProfile; +import net.minecraft.entity.Entity; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.network.play.client.C15PacketClientSettings; -import net.minecraft.server.management.ItemInWorldManager; +import net.minecraft.network.play.client.CPacketClientSettings; +import net.minecraft.server.management.PlayerInteractionManager; import net.minecraft.stats.StatBase; import net.minecraft.util.DamageSource; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.WorldServer; @@ -19,10 +20,10 @@ public class FakePlayer extends EntityPlayerMP { public FakePlayer(WorldServer world, GameProfile name) { - super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new ItemInWorldManager(world)); + super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new PlayerInteractionManager(world)); } - @Override public Vec3 getPositionVector(){ return new Vec3(0, 0, 0); } + @Override public Vec3d getPositionVector(){ return new Vec3d(0, 0, 0); } @Override public boolean canCommandSenderUseCommand(int i, String s){ return false; } @Override public void addChatComponentMessage(ITextComponent chatmessagecomponent){} @Override public void addStat(StatBase par1StatBase, int par2){} @@ -31,6 +32,6 @@ public class FakePlayer extends EntityPlayerMP @Override public boolean canAttackPlayer(EntityPlayer player){ return false; } @Override public void onDeath(DamageSource source){ return; } @Override public void onUpdate(){ return; } - @Override public void travelToDimension(int dim){ return; } - @Override public void handleClientSettings(C15PacketClientSettings pkt){ return; } + @Override public Entity func_184204_a(int dim){ return this; } + @Override public void handleClientSettings(CPacketClientSettings pkt){ return; } } diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index 0c1fcaeb0e..0a4c646df0 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -27,6 +27,7 @@ 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.util.math.Vec3d; import net.minecraft.util.text.ITextComponent; import net.minecraft.world.Explosion; import net.minecraft.world.World; @@ -133,7 +134,7 @@ public class ForgeEventFactory return onPlayerInteract(player, action, world, pos, face, null); } - public static PlayerInteractEvent onPlayerInteract(EntityPlayer player, Action action, World world, BlockPos pos, EnumFacing face, Vec3 localPos) + public static PlayerInteractEvent onPlayerInteract(EntityPlayer player, Action action, World world, BlockPos pos, EnumFacing face, Vec3d localPos) { PlayerInteractEvent event = new PlayerInteractEvent(player, action, pos, face, world, localPos); MinecraftForge.EVENT_BUS.post(event); From 26ca27193c265609a3e1f20827f4bd445855cf9a Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 7 Mar 2016 21:06:54 -0800 Subject: [PATCH 051/243] More patch work, client patches. --- .../net/minecraft/block/Block.java.patch | 89 +++++++++++-------- .../block/BlockDoublePlant.java.patch | 7 +- .../net/minecraft/block/BlockTorch.java.patch | 15 +++- .../client/audio/SoundManager.java.patch | 23 +++++ .../client/entity/EntityPlayerSP.java.patch | 13 +++ .../minecraft/client/gui/GuiChat.java.patch | 10 +++ .../achievement/GuiAchievements.java.patch | 54 +++++++++-- .../multiplayer/PlayerControllerMP.java.patch | 72 +++++++++++++-- .../client/particle/EffectRenderer.java.patch | 19 +++- .../renderer/texture/TextureMap.java.patch | 15 ++-- .../entity/player/EntityPlayer.java.patch | 46 +++++----- .../net/minecraft/item/Item.java.patch | 26 ++---- .../net/minecraft/item/ItemShears.java.patch | 4 +- .../net/minecraft/item/ItemTool.java.patch | 27 +++--- .../minecraft/util/TabCompleter.java.patch | 39 ++++++++ .../world/biome/BiomeGenHills.java.patch | 15 +++- .../client/audio/SoundManager.java.patch.rej | 25 ------ .../entity/EntityPlayerSP.java.patch.rej | 14 --- .../client/gui/GuiChat.java.patch.rej | 40 --------- .../GuiAchievements.java.patch.rej | 46 ---------- .../PlayerControllerMP.java.patch.rej | 77 ---------------- .../particle/EffectRenderer.java.patch.rej | 19 ---- .../renderer/RenderGlobal.java.patch.rej | 19 ---- .../texture/TextureMap.java.patch.rej | 13 --- .../net/minecraftforge/common/ForgeHooks.java | 5 +- .../event/ForgeEventFactory.java | 14 +-- .../event/entity/PlaySoundAtEntityEvent.java | 26 ++++-- .../event/world/BlockEvent.java | 11 +-- 28 files changed, 380 insertions(+), 403 deletions(-) create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/util/TabCompleter.java.patch delete mode 100644 rejects/minecraft/net/minecraft/client/audio/SoundManager.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch index fe404d8742..e7e3d5218a 100644 --- a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch @@ -1,6 +1,14 @@ --- ../src-base/minecraft/net/minecraft/block/Block.java +++ ../src-work/minecraft/net/minecraft/block/Block.java -@@ -46,8 +46,9 @@ +@@ -17,6 +17,7 @@ + import net.minecraft.entity.item.EntityItem; + import net.minecraft.entity.item.EntityXPOrb; + import net.minecraft.entity.player.EntityPlayer; ++import net.minecraft.init.Blocks; + import net.minecraft.init.Enchantments; + import net.minecraft.item.Item; + import net.minecraft.item.ItemBlock; +@@ -46,8 +47,9 @@ public class Block { private static final ResourceLocation AIR_ID = new ResourceLocation("air"); @@ -12,7 +20,7 @@ public static final AxisAlignedBB field_185505_j = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); public static final AxisAlignedBB field_185506_k = null; private CreativeTabs displayOnCreativeTab; -@@ -70,6 +71,9 @@ +@@ -70,6 +72,9 @@ private IBlockState defaultBlockState; private String unlocalizedName; @@ -22,7 +30,7 @@ public static int getIdFromBlock(Block blockIn) { return blockRegistry.getIDForObject(blockIn); -@@ -83,7 +87,8 @@ +@@ -83,7 +88,8 @@ public static Block getBlockById(int id) { @@ -32,16 +40,16 @@ } public static IBlockState getStateById(int id) -@@ -268,7 +273,7 @@ +@@ -268,7 +274,7 @@ public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) { - return false; -+ return getMaterial().isReplaceable(); ++ return worldIn.getBlockState(pos).func_185904_a().isReplaceable(); } public Block setHardness(float hardness) -@@ -305,9 +310,10 @@ +@@ -305,9 +311,10 @@ return this.needsRandomTick; } @@ -53,7 +61,7 @@ } public AxisAlignedBB func_185496_a(IBlockState p_185496_1_, IBlockAccess p_185496_2_, BlockPos p_185496_3_) -@@ -346,13 +352,13 @@ +@@ -346,13 +353,13 @@ @SideOnly(Side.CLIENT) public int func_185484_c(IBlockState p_185484_1_, IBlockAccess p_185484_2_, BlockPos p_185484_3_) { @@ -69,7 +77,7 @@ } else { -@@ -415,7 +421,7 @@ +@@ -415,7 +422,7 @@ } } @@ -78,7 +86,7 @@ } @SideOnly(Side.CLIENT) -@@ -472,6 +478,10 @@ +@@ -472,6 +479,10 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { @@ -89,7 +97,7 @@ } public int quantityDropped(Random random) -@@ -486,8 +496,7 @@ +@@ -486,8 +497,7 @@ public float getPlayerRelativeBlockHardness(IBlockState playerIn, EntityPlayer worldIn, World pos, BlockPos p_180647_4_) { @@ -99,7 +107,7 @@ } public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture) -@@ -497,20 +506,16 @@ +@@ -497,20 +507,16 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { @@ -125,7 +133,7 @@ } } } -@@ -518,8 +523,13 @@ +@@ -518,8 +524,13 @@ public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) { @@ -140,7 +148,7 @@ float f = 0.5F; double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -@@ -588,7 +598,7 @@ +@@ -588,7 +599,7 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { @@ -149,7 +157,7 @@ } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand side, ItemStack hitX, EnumFacing hitY, float hitZ, float p_180639_9_, float p_180639_10_) -@@ -638,25 +648,35 @@ +@@ -638,25 +649,35 @@ player.triggerAchievement(StatList.func_188055_a(this)); player.addExhaustion(0.025F); @@ -188,7 +196,7 @@ } protected ItemStack createStackedBlock(IBlockState state) -@@ -747,6 +767,7 @@ +@@ -747,6 +768,7 @@ entityIn.motionY = 0.0D; } @@ -196,7 +204,7 @@ public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) { return new ItemStack(Item.getItemFromBlock(this), 1, this.damageDropped(p_185473_3_)); -@@ -844,6 +865,1162 @@ +@@ -844,6 +866,1165 @@ return "Block{" + blockRegistry.getNameForObject(this) + "}"; } @@ -245,7 +253,6 @@ + */ + public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ return getMaterial().isOpaque() && isFullCube() && !canProvidePower(); + return state.func_185904_a().isOpaque() && state.func_185917_h() && !state.func_185897_m(); + } + @@ -283,7 +290,7 @@ + + if (this instanceof BlockSlab) + { -+ return isFullBlock() ++ return base_state.func_185913_b() + || (state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP ) + || (state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM && side == EnumFacing.DOWN); + } @@ -378,6 +385,7 @@ + * Note: When used in multiplayer, this is called on both client and + * server sides! + * ++ * @param state The current state. + * @param world The current world + * @param player The player damaging the block, may be null + * @param pos Block position in world @@ -385,9 +393,10 @@ + * Can be useful to delay the destruction of tile entities till after harvestBlock + * @return True if the block is actually destroyed. + */ -+ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) ++ public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) + { -+ return world.setBlockToAir(pos); ++ this.onBlockHarvested(world, pos, state, player); ++ return world.setBlockState(pos, Blocks.air.getDefaultState(), world.isRemote ? 11 : 3); + } + + /** @@ -761,13 +770,14 @@ + * Determines if a torch can be placed on the top surface of this block. + * Useful for creating your own block that torches can be on, such as fences. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @return True to allow the torch to be placed + */ -+ public boolean canPlaceTorchOnTop(IBlockAccess world, BlockPos pos) ++ public boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ if (isSideSolid(world, pos, EnumFacing.UP)) ++ if (state.isSideSolid(world, pos, EnumFacing.UP)) + { + return true; + } @@ -835,13 +845,14 @@ + * control over the particles. Useful when you have entirely different + * texture sheets for different sides/locations in the world. + * ++ * @param state The current state + * @param world The current world + * @param target The target the player is looking at {x/y/z/side/sub} + * @param effectRenderer A reference to the current effect renderer. + * @return True to prevent vanilla digging particles form spawning. + */ + @SideOnly(Side.CLIENT) -+ public boolean addHitEffects(World worldObj, RayTraceResult target, net.minecraft.client.particle.EffectRenderer effectRenderer) ++ public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, net.minecraft.client.particle.EffectRenderer effectRenderer) + { + return false; + } @@ -886,35 +897,35 @@ + IBlockState plant = plantable.getPlant(world, pos.offset(direction)); + net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); + -+ if (plant.getBlock() == net.minecraft.init.Blocks.cactus && this == net.minecraft.init.Blocks.cactus) ++ if (plant.getBlock() == Blocks.cactus && this == Blocks.cactus) + { + return true; + } + -+ if (plant.getBlock() == net.minecraft.init.Blocks.reeds && this == net.minecraft.init.Blocks.reeds) ++ if (plant.getBlock() == Blocks.reeds && this == Blocks.reeds) + { + return true; + } + -+ if (plantable instanceof BlockBush && ((BlockBush)plantable).canPlaceBlockOn(this)) ++ if (plantable instanceof BlockBush && ((BlockBush)plantable).func_185514_i(state)) + { + return true; + } + + switch (plantType) + { -+ case Desert: return this == net.minecraft.init.Blocks.sand || this == net.minecraft.init.Blocks.hardened_clay || this == net.minecraft.init.Blocks.stained_hardened_clay || this == net.minecraft.init.Blocks.dirt; -+ case Nether: return this == net.minecraft.init.Blocks.soul_sand; -+ case Crop: return this == net.minecraft.init.Blocks.farmland; -+ case Cave: return isSideSolid(world, pos, EnumFacing.UP); -+ case Plains: return this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.farmland; -+ case Water: return getMaterial() == Material.water && ((Integer)state.getValue(BlockLiquid.LEVEL)) == 0; ++ case Desert: return this == Blocks.sand || this == Blocks.hardened_clay || this == Blocks.stained_hardened_clay || this == Blocks.dirt; ++ case Nether: return this == Blocks.soul_sand; ++ case Crop: return this == Blocks.farmland; ++ case Cave: return state.isSideSolid(world, pos, EnumFacing.UP); ++ case Plains: return this == Blocks.grass || this == Blocks.dirt || this == Blocks.farmland; ++ case Water: return state.func_185904_a() == Material.water && state.getValue(BlockLiquid.LEVEL) == 0; + case Beach: -+ boolean isBeach = this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.sand; -+ boolean hasWater = (world.getBlockState(pos.east()).getBlock().getMaterial() == Material.water || -+ world.getBlockState(pos.west()).getBlock().getMaterial() == Material.water || -+ world.getBlockState(pos.north()).getBlock().getMaterial() == Material.water || -+ world.getBlockState(pos.south()).getBlock().getMaterial() == Material.water); ++ boolean isBeach = this == Blocks.grass || this == Blocks.dirt || this == Blocks.sand; ++ boolean hasWater = (world.getBlockState(pos.east()).func_185904_a() == Material.water || ++ world.getBlockState(pos.west()).func_185904_a() == Material.water || ++ world.getBlockState(pos.north()).func_185904_a() == Material.water || ++ world.getBlockState(pos.south()).func_185904_a() == Material.water); + return isBeach && hasWater; + } + @@ -1139,9 +1150,9 @@ + * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side + * @return Whether Block#isProvidingWeakPower should be called when determining indirect power + */ -+ public boolean shouldCheckWeakPower(IBlockAccess world, BlockPos pos, EnumFacing side) ++ public boolean shouldCheckWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) + { -+ return isNormalCube(); ++ return state.func_185915_l(); + } + + /** diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch index d8814ad416..f63ceb1764 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch @@ -54,7 +54,7 @@ return true; } } -@@ -284,6 +279,32 @@ +@@ -284,6 +279,33 @@ return Block.EnumOffsetType.XZ; } @@ -65,6 +65,7 @@ + EnumPlantType type = (EnumPlantType)state.getValue(VARIANT); + return state.getValue(HALF) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS); + } ++ + @Override + public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { @@ -74,11 +75,11 @@ + if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.GRASS.getMeta())); + return ret; + } ++ + @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) + { + //Forge: Break both parts on the client to prevent the top part flickering as default type for a few frames. -+ IBlockState state = world.getBlockState(pos); + if (state.getBlock() == this && state.getValue(HALF) == EnumBlockHalf.LOWER && world.getBlockState(pos.up()).getBlock() == this) + world.setBlockToAir(pos.up()); + return world.setBlockToAir(pos); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch index 9eba3ac141..44dde77555 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch @@ -1,11 +1,20 @@ --- ../src-base/minecraft/net/minecraft/block/BlockTorch.java +++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java -@@ -86,7 +86,7 @@ +@@ -79,14 +79,14 @@ + + private boolean canPlaceOn(World worldIn, BlockPos pos) + { +- if (worldIn.getBlockState(pos).func_185896_q()) ++ IBlockState state = worldIn.getBlockState(pos); ++ if (state.isSideSolid(worldIn, pos, EnumFacing.UP)) + { + return true; + } else { - Block block = worldIn.getBlockState(pos).getBlock(); +- Block block = worldIn.getBlockState(pos).getBlock(); - return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block == Blocks.stained_glass; -+ return block.canPlaceTorchOnTop(worldIn, pos); ++ return state.getBlock().canPlaceTorchOnTop(state, worldIn, pos); } } diff --git a/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch index 2afdefe87f..a4124c09a9 100644 --- a/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -16,3 +16,26 @@ } private synchronized void loadSoundSystem() +@@ -350,6 +352,9 @@ + } + else + { ++ p_sound = net.minecraftforge.client.ForgeHooksClient.playSound(this, p_sound); ++ if (p_sound == null) return; ++ + if (!this.field_188777_o.isEmpty()) + { + for (ISoundEventListener isoundeventlistener : this.field_188777_o) +@@ -400,10 +405,12 @@ + if (sound.func_188723_h()) + { + this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation1), resourcelocation1.toString(), flag, p_sound.getXPosF(), p_sound.getYPosF(), p_sound.getZPosF(), p_sound.getAttenuationType().getTypeInt(), f); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, p_sound, s)); + } + else + { + this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation1), resourcelocation1.toString(), flag, p_sound.getXPosF(), p_sound.getYPosF(), p_sound.getZPosF(), p_sound.getAttenuationType().getTypeInt(), f); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, p_sound, s)); + } + + logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {sound.func_188719_a(), resourcelocation1, s}); diff --git a/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch index 88eedb390b..15cec7e267 100644 --- a/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -56,3 +56,16 @@ { d2 = 1.0D - d1; i = 5; +@@ -515,6 +528,12 @@ + + public void func_184185_a(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_) + { ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_184185_1_, p_184185_2_, p_184185_3_); ++ if (event.isCanceled() || event.getSound() == null) return; ++ p_184185_1_ = event.getSound(); ++ p_184185_2_ = event.getVolume(); ++ p_184185_3_ = event.getPitch(); ++ + this.worldObj.func_184134_a(this.posX, this.posY, this.posZ, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false); + } + diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch new file mode 100644 index 0000000000..e3b5707827 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java +@@ -250,6 +250,7 @@ + + public BlockPos func_186839_b() + { ++ + BlockPos blockpos = null; + + if (this.field_186853_g.objectMouseOver != null && this.field_186853_g.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch index 391e1aa7c0..7efb6b7a73 100644 --- a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch @@ -11,7 +11,22 @@ public GuiAchievements(GuiScreen parentScreenIn, StatFileWriter statFileWriterIn) { this.parentScreen = parentScreenIn; -@@ -64,6 +68,7 @@ +@@ -57,6 +61,14 @@ + int j = 141; + this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.field_187982_f.displayColumn * 24 - i / 2 - 12); + this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.field_187982_f.displayRow * 24 - j / 2); ++ minecraftAchievements.clear(); ++ for (Achievement achievement : AchievementList.field_187981_e) ++ { ++ if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement)) ++ { ++ minecraftAchievements.add(achievement); ++ } ++ } + } + + public void initGui() +@@ -64,6 +76,7 @@ this.mc.getNetHandler().addToSendQueue(new CPacketClientStatus(CPacketClientStatus.State.REQUEST_STATS)); this.buttonList.clear(); this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0]))); @@ -19,7 +34,7 @@ } protected void actionPerformed(GuiButton button) throws IOException -@@ -74,6 +79,16 @@ +@@ -74,6 +87,16 @@ { this.mc.displayGuiScreen(this.parentScreen); } @@ -36,7 +51,7 @@ } } -@@ -257,7 +272,9 @@ +@@ -257,7 +280,9 @@ GlStateManager.depthFunc(518); GlStateManager.pushMatrix(); GlStateManager.translate((float)i1, (float)j1, -200.0F); @@ -47,7 +62,34 @@ GlStateManager.enableTexture2D(); GlStateManager.disableLighting(); GlStateManager.enableRescaleNormal(); -@@ -432,6 +449,7 @@ +@@ -331,11 +356,12 @@ + GlStateManager.depthFunc(515); + this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND); + +- for (int j5 = 0; j5 < AchievementList.field_187981_e.size(); ++j5) ++ java.util.List achievementList = (currentPage == -1 ? minecraftAchievements : net.minecraftforge.common.AchievementPage.getAchievementPage(currentPage).getAchievements()); ++ for (int j5 = 0; j5 < achievementList.size(); ++j5) + { + Achievement achievement1 = (Achievement)AchievementList.field_187981_e.get(j5); + +- if (achievement1.parentAchievement != null) ++ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement)) + { + int k5 = achievement1.displayColumn * 24 - i + 11; + int l5 = achievement1.displayRow * 24 - j + 11; +@@ -389,9 +415,9 @@ + GlStateManager.enableRescaleNormal(); + GlStateManager.enableColorMaterial(); + +- for (int i6 = 0; i6 < AchievementList.field_187981_e.size(); ++i6) ++ for (int i6 = 0; i6 < achievementList.size(); ++i6) + { +- Achievement achievement2 = (Achievement)AchievementList.field_187981_e.get(i6); ++ Achievement achievement2 = achievementList.get(i6); + int l6 = achievement2.displayColumn * 24 - i; + int j7 = achievement2.displayRow * 24 - j; + +@@ -432,6 +458,7 @@ this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND); @@ -55,7 +97,7 @@ if (achievement2.getSpecial()) { this.drawTexturedModalRect(l6 - 2, j7 - 2, 26, 202, 26, 26); -@@ -440,6 +458,7 @@ +@@ -440,6 +467,7 @@ { this.drawTexturedModalRect(l6 - 2, j7 - 2, 0, 202, 26, 26); } @@ -63,7 +105,7 @@ if (!this.statFileWriter.canUnlockAchievement(achievement2)) { -@@ -448,7 +467,7 @@ +@@ -448,7 +476,7 @@ this.itemRender.func_175039_a(false); } diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index 84c1d4b583..f19ab2b404 100644 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -1,25 +1,85 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java -@@ -162,11 +162,18 @@ +@@ -121,6 +121,12 @@ + } + } - if (itemstack1.stackSize == 0) ++ ItemStack stack = mc.thePlayer.func_184614_ca(); ++ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, p_187103_1_, mc.thePlayer)) ++ { ++ return false; ++ } ++ + if (this.currentGameType.isCreative() && this.mc.thePlayer.func_184614_ca() != null && this.mc.thePlayer.func_184614_ca().getItem() instanceof ItemSword) + { + return false; +@@ -142,14 +148,7 @@ + else + { + world.playAuxSFX(2001, p_187103_1_, Block.getStateId(iblockstate)); +- block.onBlockHarvested(world, p_187103_1_, iblockstate, this.mc.thePlayer); +- boolean flag = world.setBlockState(p_187103_1_, Blocks.air.getDefaultState(), 11); + +- if (flag) +- { +- block.onBlockDestroyedByPlayer(world, p_187103_1_, iblockstate); +- } +- + this.currentBlock = new BlockPos(this.currentBlock.getX(), -1, this.currentBlock.getZ()); + + if (!this.currentGameType.isCreative()) +@@ -160,13 +159,20 @@ + { + itemstack1.onBlockDestroyed(world, iblockstate, p_187103_1_, this.mc.thePlayer); + +- if (itemstack1.stackSize == 0) ++ if (itemstack1.stackSize <= 0) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.mc.thePlayer, itemstack1, EnumHand.MAIN_HAND); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.mc.thePlayer, itemstack1, EnumHand.MAIN_HAND); this.mc.thePlayer.func_184611_a(EnumHand.MAIN_HAND, (ItemStack)null); } } } -+ boolean flag = block1.removedByPlayer(world, pos, mc.thePlayer, false); ++ boolean flag = block.removedByPlayer(iblockstate, world, p_187103_1_, mc.thePlayer, false); + + if (flag) + { -+ block1.onBlockDestroyedByPlayer(world, pos, iblockstate); ++ block.onBlockDestroyedByPlayer(world, p_187103_1_, iblockstate); + } return flag; } } -@@ -453,9 +460,10 @@ +@@ -373,11 +379,15 @@ + { + if (this.currentGameType != WorldSettings.GameType.SPECTATOR) + { ++ net.minecraft.item.Item item = p_187099_3_ == null ? null : p_187099_3_.getItem(); ++ EnumActionResult ret = item == null ? EnumActionResult.PASS : item.onItemUseFirst(p_187099_3_, p_187099_1_, p_187099_2_, p_187099_4_, p_187099_5_, f, f1, f2, p_187099_7_); ++ if (ret != EnumActionResult.PASS) return ret; ++ + IBlockState iblockstate = p_187099_2_.getBlockState(p_187099_4_); + +- if ((!p_187099_1_.isSneaking() || p_187099_1_.func_184614_ca() == null && p_187099_1_.func_184592_cb() == null) && iblockstate.getBlock().onBlockActivated(p_187099_2_, p_187099_4_, iblockstate, p_187099_1_, p_187099_7_, p_187099_3_, p_187099_5_, f, f1, f2)) ++ if ((!p_187099_1_.isSneaking() || (p_187099_1_.func_184614_ca() == null || item.doesSneakBypassUse(p_187099_3_, p_187099_2_, p_187099_4_, p_187099_1_)) && p_187099_1_.func_184592_cb() == null)) + { +- flag = true; ++ flag = iblockstate.getBlock().onBlockActivated(p_187099_2_, p_187099_4_, iblockstate, p_187099_1_, p_187099_7_, p_187099_3_, p_187099_5_, f, f1, f2); + } + + if (!flag && p_187099_3_ != null && p_187099_3_.getItem() instanceof ItemBlock) +@@ -418,7 +428,9 @@ + } + else + { +- return p_187099_3_.onItemUse(p_187099_1_, p_187099_2_, p_187099_4_, p_187099_7_, p_187099_5_, f, f1, f2); ++ EnumActionResult ret = p_187099_3_.onItemUse(p_187099_1_, p_187099_2_, p_187099_4_, p_187099_7_, p_187099_5_, f, f1, f2); ++ if (p_187099_3_.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187099_1_, p_187099_3_, p_187099_7_); ++ return ret; + } + } + else +@@ -453,9 +465,10 @@ { p_187101_1_.func_184611_a(p_187101_4_, itemstack); diff --git a/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch index 522791b865..b41676c704 100644 --- a/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch @@ -10,7 +10,24 @@ import java.util.ArrayDeque; import java.util.Iterator; import java.util.List; -@@ -460,4 +463,13 @@ +@@ -143,6 +146,7 @@ + + public void addEffect(EntityFX effect) + { ++ if (effect == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs. + this.field_187241_h.add(effect); + } + +@@ -376,7 +380,7 @@ + + public void addBlockDestroyEffects(BlockPos pos, IBlockState state) + { +- if (state.func_185904_a() != Material.air) ++ if (state.getBlock().isAir(state, worldObj, pos) && !state.getBlock().addDestroyEffects(worldObj, pos, this)) + { + state = state.func_185899_b(this.worldObj, pos); + int i = 4; +@@ -460,4 +464,13 @@ return "" + i; } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 07b2b98bff..7d50d76851 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -97,7 +97,7 @@ this.missingImage.generateMipmaps(this.mipmapLevels); stitcher.addSprite(this.missingImage); + skipFirst = false; -+ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 3); ++ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 2); try { @@ -105,7 +105,7 @@ stitcher.doStitch(); } catch (StitcherException stitcherexception) -@@ -150,9 +183,11 @@ +@@ -150,11 +183,16 @@ } logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); @@ -113,11 +113,16 @@ TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); Map map = Maps.newHashMap(this.mapRegisteredSprites); -+ bar.step("Uploading GL texture"); ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); ++ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture mipmap and upload", stitcher.getStichSlots().size()); ++ for (TextureAtlasSprite textureatlassprite1 : stitcher.getStichSlots()) { ++ bar.step(textureatlassprite1.getIconName()); if (textureatlassprite1 == this.missingImage || this.func_184397_a(resourceManager, textureatlassprite1)) -@@ -185,6 +220,13 @@ + { + String s = textureatlassprite1.getIconName(); +@@ -185,6 +223,13 @@ { textureatlassprite2.copyFrom(this.missingImage); } @@ -131,7 +136,7 @@ } private boolean func_184397_a(IResourceManager p_184397_1_, final TextureAtlasSprite p_184397_2_) -@@ -317,4 +359,37 @@ +@@ -317,4 +362,37 @@ { return this.missingImage; } diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index 2a1e1236c2..4532e82c38 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -105,7 +105,7 @@ } public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem) -@@ -746,15 +773,24 @@ +@@ -746,15 +773,22 @@ protected ItemStack func_184816_a(EntityItem p_184816_1_) { @@ -125,13 +125,11 @@ + public float getBreakSpeed(IBlockState state, BlockPos pos) + { -+ ItemStack stack = this.inventory.getCurrentItem(); -+ float f = (stack == null ? 1.0F : stack.getItem().getDigSpeed(stack, state)); -+ ++ float f = this.inventory.func_184438_a(state); if (f > 1.0F) { int i = EnchantmentHelper.func_185293_e(this); -@@ -804,12 +840,13 @@ +@@ -804,12 +838,13 @@ f /= 5.0F; } @@ -147,7 +145,7 @@ } public void readEntityFromNBT(NBTTagCompound tagCompund) -@@ -845,6 +882,16 @@ +@@ -845,6 +880,16 @@ this.spawnForced = tagCompund.getBoolean("SpawnForced"); } @@ -164,7 +162,7 @@ this.foodStats.readNBT(tagCompund); this.capabilities.readCapabilitiesFromNBT(tagCompund); -@@ -877,6 +924,23 @@ +@@ -877,6 +922,23 @@ tagCompound.setBoolean("SpawnForced", this.spawnForced); } @@ -188,7 +186,7 @@ this.foodStats.writeNBT(tagCompound); this.capabilities.writeCapabilitiesToNBT(tagCompound); tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT()); -@@ -884,6 +948,7 @@ +@@ -884,6 +946,7 @@ public boolean attackEntityFrom(DamageSource source, float amount) { @@ -196,7 +194,7 @@ if (this.isEntityInvulnerable(source)) { return false; -@@ -966,6 +1031,7 @@ +@@ -966,6 +1029,7 @@ if (this.field_184627_bm.stackSize <= 0) { EnumHand enumhand = this.func_184600_cs(); @@ -204,7 +202,7 @@ if (enumhand == EnumHand.MAIN_HAND) { -@@ -1001,8 +1067,12 @@ +@@ -1001,8 +1065,12 @@ { if (!this.isEntityInvulnerable(damageSrc)) { @@ -217,7 +215,7 @@ float f = damageAmount; damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); this.setAbsorptionAmount(this.getAbsorptionAmount() - (f - damageAmount)); -@@ -1067,6 +1137,7 @@ +@@ -1067,6 +1135,7 @@ } else { @@ -225,7 +223,7 @@ ItemStack itemstack = p_184822_2_ != null ? p_184822_2_.copy() : null; if (!p_184822_1_.func_184230_a(this, p_184822_2_, p_184822_3_)) -@@ -1123,6 +1194,7 @@ +@@ -1123,6 +1192,7 @@ public void attackTargetEntityWithCurrentItem(Entity targetEntity) { @@ -233,7 +231,7 @@ if (targetEntity.canAttackWithItem()) { if (!targetEntity.hitByEntity(this)) -@@ -1410,6 +1482,8 @@ +@@ -1410,6 +1480,8 @@ public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation) { @@ -242,7 +240,7 @@ if (!this.worldObj.isRemote) { if (this.isPlayerSleeping() || !this.isEntityAlive()) -@@ -1449,9 +1523,10 @@ +@@ -1449,9 +1521,10 @@ this.setSize(0.2F, 0.2F); @@ -256,7 +254,7 @@ float f = 0.5F; float f1 = 0.5F; -@@ -1514,13 +1589,14 @@ +@@ -1514,13 +1587,14 @@ public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn) { @@ -274,7 +272,7 @@ if (blockpos == null) { -@@ -1529,6 +1605,10 @@ +@@ -1529,6 +1603,10 @@ this.setPosition((double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.1F), (double)((float)blockpos.getZ() + 0.5F)); } @@ -285,7 +283,7 @@ this.sleeping = false; -@@ -1547,14 +1627,15 @@ +@@ -1547,14 +1625,15 @@ private boolean isInBed() { @@ -304,7 +302,7 @@ { if (!forceSpawn) { -@@ -1569,16 +1650,17 @@ +@@ -1569,16 +1648,17 @@ } else { @@ -325,7 +323,7 @@ switch (enumfacing) { -@@ -1618,16 +1700,24 @@ +@@ -1618,16 +1698,24 @@ public BlockPos getBedLocation() { @@ -352,7 +350,7 @@ if (pos != null) { this.spawnChunk = pos; -@@ -1822,6 +1912,10 @@ +@@ -1822,6 +1910,10 @@ super.fall(distance, damageMultiplier); } @@ -363,7 +361,7 @@ } protected void resetHeight() -@@ -2022,6 +2116,18 @@ +@@ -2022,6 +2114,18 @@ this.xpSeed = oldPlayer.xpSeed; this.theInventoryEnderChest = oldPlayer.theInventoryEnderChest; this.func_184212_Q().func_187227_b(field_184827_bp, oldPlayer.func_184212_Q().func_187225_a(field_184827_bp)); @@ -382,7 +380,7 @@ } protected boolean canTriggerWalking() -@@ -2120,7 +2226,10 @@ +@@ -2120,7 +2224,10 @@ public ITextComponent getDisplayName() { @@ -394,7 +392,7 @@ itextcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); itextcomponent.getChatStyle().setChatHoverEvent(this.getHoverEvent()); itextcomponent.getChatStyle().setInsertion(this.getName()); -@@ -2129,7 +2238,7 @@ +@@ -2129,7 +2236,7 @@ public float getEyeHeight() { @@ -403,7 +401,7 @@ if (this.isPlayerSleeping()) { -@@ -2340,6 +2449,136 @@ +@@ -2340,6 +2447,136 @@ return (float)this.getEntityAttribute(SharedMonsterAttributes.field_188792_h).getAttributeValue(); } diff --git a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch index 4f4b6169d3..cd28b89f8f 100644 --- a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch @@ -57,7 +57,7 @@ Vec3d vec3d1 = vec3d.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); return worldIn.rayTraceBlocks(vec3d, vec3d1, useLiquids, !useLiquids, false); } -@@ -422,11 +431,629 @@ +@@ -422,11 +431,619 @@ return false; } @@ -110,22 +110,12 @@ + * @param world The Current World + * @param pos Target position + * @param side The side of the target hit -+ * @return Return true to prevent any further processing. ++ * @param hand Which hand the item is being held in. ++ * @return Return PASS to allow vanilla handling, any other to skip normal code. + */ -+ 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) + { -+ return false; -+ } -+ -+ /** -+ * Metadata-sensitive version of getStrVsBlock -+ * @param itemstack The Item Stack -+ * @param state The block state -+ * @return The damage strength -+ */ -+ public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state) -+ { -+ return getStrVsBlock(itemstack, state.getBlock()); ++ return EnumActionResult.PASS; + } + + protected boolean canRepair = true; @@ -322,7 +312,7 @@ + * @param player The Player that is wielding the item + * @return + */ -+ public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player) ++ public boolean doesSneakBypassUse(ItemStack stack, net.minecraft.world.IBlockAccess world, BlockPos pos, EntityPlayer player) + { + return false; + } @@ -687,7 +677,7 @@ public static void registerItems() { registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() -@@ -935,6 +1562,10 @@ +@@ -935,6 +1552,10 @@ private final float damageVsEntity; private final int enchantability; @@ -698,7 +688,7 @@ private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) { this.harvestLevel = harvestLevel; -@@ -969,9 +1600,36 @@ +@@ -969,9 +1590,36 @@ return this.enchantability; } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch index 6bb523f66b..e317586a72 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch @@ -18,8 +18,8 @@ public boolean canHarvestBlock(IBlockState blockIn) @@ -36,4 +37,71 @@ - Block block = block.getBlock(); - return block != Blocks.web && block.func_185904_a() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, block)) : 15.0F; + Block block = state.getBlock(); + return block != Blocks.web && state.func_185904_a() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, state)) : 15.0F; } + + diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch index 7ddec241ba..958fe75f33 100644 --- a/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch @@ -19,7 +19,19 @@ } protected ItemTool(Item.ToolMaterial p_i46746_1_, Set p_i46746_2_) -@@ -84,7 +96,9 @@ +@@ -42,6 +54,11 @@ + + public float getStrVsBlock(ItemStack stack, IBlockState state) + { ++ for (String type : getToolClasses(stack)) ++ { ++ if (state.getBlock().isToolEffective(type, state)) ++ return efficiencyOnProperMaterial; ++ } + return this.effectiveBlocks.contains(state.getBlock()) ? this.efficiencyOnProperMaterial : 1.0F; + } + +@@ -84,7 +101,9 @@ public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { @@ -30,7 +42,7 @@ } public Multimap getItemAttributeModifiers(EntityEquipmentSlot p_111205_1_) -@@ -99,4 +113,38 @@ +@@ -99,4 +118,27 @@ return multimap; } @@ -56,16 +68,5 @@ + { + return toolClass != null ? com.google.common.collect.ImmutableSet.of(toolClass) : super.getToolClasses(stack); + } -+ -+ @Override -+ public float getDigSpeed(ItemStack stack, net.minecraft.block.state.IBlockState state) -+ { -+ for (String type : getToolClasses(stack)) -+ { -+ if (state.getBlock().isToolEffective(type, state)) -+ return efficiencyOnProperMaterial; -+ } -+ return super.getDigSpeed(stack, state); -+ } + /*===================================== FORGE END =================================*/ } diff --git a/patches.mcp/minecraft/net/minecraft/util/TabCompleter.java.patch b/patches.mcp/minecraft/net/minecraft/util/TabCompleter.java.patch new file mode 100644 index 0000000000..0d235578fc --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/TabCompleter.java.patch @@ -0,0 +1,39 @@ +--- ../src-base/minecraft/net/minecraft/util/TabCompleter.java ++++ ../src-work/minecraft/net/minecraft/util/TabCompleter.java +@@ -53,13 +53,14 @@ + this.field_186844_a.deleteFromCursor(i - this.field_186844_a.getCursorPosition()); + } + +- this.field_186844_a.writeText((String)this.field_186849_f.get(this.field_186848_e++)); ++ this.field_186844_a.writeText(net.minecraft.util.text.TextFormatting.getTextWithoutFormattingCodes(this.field_186849_f.get(this.field_186848_e++))); + } + + private void func_186838_a(String p_186838_1_) + { + if (p_186838_1_.length() >= 1) + { ++ net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_186838_1_); + Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new CPacketTabComplete(p_186838_1_, this.func_186839_b(), this.field_186845_b)); + this.field_186847_d = true; + } +@@ -74,6 +75,12 @@ + this.field_186846_c = false; + this.field_186849_f.clear(); + ++ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete; ++ if (complete != null) ++ { ++ p_186840_1_ = com.google.common.collect.ObjectArrays.concat(complete, p_186840_1_, String.class); ++ } ++ + for (String s : p_186840_1_) + { + if (!s.isEmpty()) +@@ -84,6 +91,7 @@ + + String s1 = this.field_186844_a.getText().substring(this.field_186844_a.func_146197_a(-1, this.field_186844_a.getCursorPosition(), false)); + String s2 = org.apache.commons.lang3.StringUtils.getCommonPrefix(p_186840_1_); ++ s2 = net.minecraft.util.text.TextFormatting.getTextWithoutFormattingCodes(s2); + + if (!s2.isEmpty() && !s1.equalsIgnoreCase(s2)) + { diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch index 6c6c9d0d45..e3803d3ac6 100644 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch @@ -1,6 +1,14 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenHills.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java -@@ -37,28 +37,20 @@ +@@ -2,6 +2,7 @@ + + import java.util.Random; + import net.minecraft.block.BlockSilverfish; ++import net.minecraft.block.state.IBlockState; + import net.minecraft.init.Blocks; + import net.minecraft.util.math.BlockPos; + import net.minecraft.world.World; +@@ -37,28 +38,20 @@ public void decorate(World worldIn, Random rand, BlockPos pos) { super.decorate(worldIn, rand, pos); @@ -36,7 +44,7 @@ } public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_) -@@ -86,4 +78,23 @@ +@@ -86,4 +79,24 @@ EXTRA_TREES, MUTATED; } @@ -51,7 +59,8 @@ + { + BlockPos blockpos = pos.add(rand.nextInt(16), rand.nextInt(28) + 4, rand.nextInt(16)); + -+ if (worldIn.getBlockState(blockpos).getBlock().isReplaceableOreGen(worldIn, blockpos, net.minecraft.block.state.pattern.BlockMatcher.forBlock(Blocks.stone))) ++ IBlockState state = worldIn.getBlockState(blockpos); ++ if (state.getBlock().isReplaceableOreGen(state, worldIn, blockpos, net.minecraft.block.state.pattern.BlockMatcher.forBlock(Blocks.stone))) + { + worldIn.setBlockState(blockpos, Blocks.emerald_ore.getDefaultState(), 2); + } diff --git a/rejects/minecraft/net/minecraft/client/audio/SoundManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/audio/SoundManager.java.patch.rej deleted file mode 100644 index 40bbf0f88a..0000000000 --- a/rejects/minecraft/net/minecraft/client/audio/SoundManager.java.patch.rej +++ /dev/null @@ -1,25 +0,0 @@ -++++ REJECTED PATCH 3 - } - else - { -+ sound = net.minecraftforge.client.ForgeHooksClient.playSound(this, sound); -+ if (sound == null) return; -+ - SoundEventAccessorComposite soundeventaccessorcomposite = this.sndHandler.getSound(sound.getSoundLocation()); - - if (soundeventaccessorcomposite == null) -++++ END PATCH -++++ REJECTED PATCH 4 - if (soundpoolentry.isStreamingSound()) - { - this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, sound, s)); - } - else - { - this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, sound, s)); - } - - logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.getSoundPoolEntryLocation(), soundeventaccessorcomposite.getSoundEventLocation(), s}); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch.rej b/rejects/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch.rej deleted file mode 100644 index 18c2281ff0..0000000000 --- a/rejects/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch.rej +++ /dev/null @@ -1,14 +0,0 @@ -++++ REJECTED PATCH 3 - - public void playSound(String name, float volume, float pitch) - { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, name, volume, pitch); -+ if (event.isCanceled() || event.name == null) return; -+ name = event.name; -+ volume = event.newVolume; -+ pitch = event.newPitch; -+ - this.worldObj.playSound(this.posX, this.posY, this.posZ, name, volume, pitch, false); - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej deleted file mode 100644 index fb030ae4df..0000000000 --- a/rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej +++ /dev/null @@ -1,40 +0,0 @@ -++++ REJECTED PATCH 1 - this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(stringbuilder.toString()), 1); - } - -- this.inputField.writeText((String)this.foundPlayerNames.get(this.autocompleteIndex++)); -+ this.inputField.writeText(net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes((String)this.foundPlayerNames.get(this.autocompleteIndex++))); - } - - private void sendAutocompleteRequest(String p_146405_1_, String p_146405_2_) - { - if (p_146405_1_.length() >= 1) - { -+ net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_146405_1_, p_146405_2_); - BlockPos blockpos = null; - - if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) -++++ END PATCH -++++ REJECTED PATCH 2 - this.playerNamesFound = false; - this.foundPlayerNames.clear(); - -+ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete; -+ if (complete != null) -+ { -+ p_146406_1_ = com.google.common.collect.ObjectArrays.concat(complete, p_146406_1_, String.class); -+ } -+ - for (String s : p_146406_1_) - { - if (s.length() > 0) -++++ END PATCH -++++ REJECTED PATCH 3 - - String s1 = this.inputField.getText().substring(this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false)); - String s2 = StringUtils.getCommonPrefix(p_146406_1_); -+ s2 = net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes(s2); - - if (s2.length() > 0 && !s1.equalsIgnoreCase(s2)) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch.rej deleted file mode 100644 index f680758a6a..0000000000 --- a/rejects/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch.rej +++ /dev/null @@ -1,46 +0,0 @@ -++++ REJECTED PATCH 2 - int j = 141; - this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - i / 2 - 12); - this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - j / 2); -+ minecraftAchievements.clear(); -+ for (Achievement achievement : AchievementList.achievementList) -+ { -+ if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement)) -+ { -+ minecraftAchievements.add(achievement); -+ } -+ } - } - - public void initGui() -++++ END PATCH -++++ REJECTED PATCH 6 - GlStateManager.depthFunc(515); - this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND); - -- for (int j5 = 0; j5 < AchievementList.achievementList.size(); ++j5) -+ java.util.List achievementList = (currentPage == -1 ? minecraftAchievements : net.minecraftforge.common.AchievementPage.getAchievementPage(currentPage).getAchievements()); -+ for (int j5 = 0; j5 < achievementList.size(); ++j5) - { -- Achievement achievement1 = (Achievement)AchievementList.achievementList.get(j5); -+ Achievement achievement1 = achievementList.get(j5); - -- if (achievement1.parentAchievement != null) -+ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement)) - { - int k5 = achievement1.displayColumn * 24 - i + 11; - int l5 = achievement1.displayRow * 24 - j + 11; -++++ END PATCH -++++ REJECTED PATCH 7 - GlStateManager.enableRescaleNormal(); - GlStateManager.enableColorMaterial(); - -- for (int i6 = 0; i6 < AchievementList.achievementList.size(); ++i6) -+ for (int i6 = 0; i6 < achievementList.size(); ++i6) - { -- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(i6); -+ Achievement achievement2 = achievementList.get(i6); - int l6 = achievement2.displayColumn * 24 - i; - int j7 = achievement2.displayRow * 24 - j; - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej b/rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej deleted file mode 100644 index ef2f8c7808..0000000000 --- a/rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej +++ /dev/null @@ -1,77 +0,0 @@ -++++ REJECTED PATCH 1 - } - } - -+ ItemStack stack = mc.thePlayer.getCurrentEquippedItem(); -+ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, pos, mc.thePlayer)) -+ { -+ return false; -+ } -+ - if (this.currentGameType.isCreative() && this.mc.thePlayer.getHeldItem() != null && this.mc.thePlayer.getHeldItem().getItem() instanceof ItemSword) - { - return false; -++++ END PATCH -++++ REJECTED PATCH 2 - else - { - world.playAuxSFX(2001, pos, Block.getStateId(iblockstate)); -- boolean flag = world.setBlockToAir(pos); - -- if (flag) -- { -- block1.onBlockDestroyedByPlayer(world, pos, iblockstate); -- } -- - this.currentBlock = new BlockPos(this.currentBlock.getX(), -1, this.currentBlock.getZ()); - - if (!this.currentGameType.isCreative()) -++++ END PATCH -++++ REJECTED PATCH 4 - { - if (this.currentGameType != WorldSettings.GameType.SPECTATOR) - { -+ -+ if (heldStack != null && -+ heldStack.getItem() != null && -+ heldStack.getItem().onItemUseFirst(heldStack, player, worldIn, hitPos, side, f, f1, f2)) -+ { -+ return true; -+ } -+ - IBlockState iblockstate = worldIn.getBlockState(hitPos); - -- if ((!player.isSneaking() || player.getHeldItem() == null) && iblockstate.getBlock().onBlockActivated(worldIn, hitPos, iblockstate, player, side, f, f1, f2)) -+ if ((!player.isSneaking() || player.getHeldItem() == null || player.getHeldItem().getItem().doesSneakBypassUse(worldIn, hitPos, player))) - { -- flag = true; -+ flag = iblockstate.getBlock().onBlockActivated(worldIn, hitPos, iblockstate, player, side, f, f1, f2); - } - - if (!flag && heldStack != null && heldStack.getItem() instanceof ItemBlock) -++++ END PATCH -++++ REJECTED PATCH 5 - } - else - { -- return heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2); -+ if (!heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2)) return false; -+ if (heldStack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, heldStack); -+ return true; - } - } - else -++++ END PATCH -++++ REJECTED PATCH 6 - { - playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack; - -- if (itemstack.stackSize == 0) -+ if (itemstack.stackSize <= 0) - { - playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null; -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(playerIn, itemstack); - } - - return true; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch.rej deleted file mode 100644 index 713339bfd8..0000000000 --- a/rejects/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch.rej +++ /dev/null @@ -1,19 +0,0 @@ -++++ REJECTED PATCH 1 - - public void addEffect(EntityFX effect) - { -+ if (effect == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs. - int i = effect.getFXLayer(); - int j = effect.getAlpha() != 1.0F ? 0 : 1; - -++++ END PATCH -++++ REJECTED PATCH 2 - - public void addBlockDestroyEffects(BlockPos pos, IBlockState state) - { -- if (state.getBlock().getMaterial() != Material.air) -+ if (!state.getBlock().isAir(worldObj, pos) && !state.getBlock().addDestroyEffects(worldObj, pos, this)) - { - state = state.getBlock().getActualState(state, this.worldObj, pos); - int i = 4; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej deleted file mode 100644 index 3a8a04466b..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej +++ /dev/null @@ -1,19 +0,0 @@ -++++ REJECTED PATCH 13 - if (recordName != null) - { - ItemRecord itemrecord = ItemRecord.getRecord(recordName); -+ ResourceLocation resource = null; - - if (itemrecord != null) - { - this.mc.ingameGUI.setRecordPlayingMessage(itemrecord.getRecordNameLocal()); -+ resource = itemrecord.getRecordResource(recordName); - } - -- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(new ResourceLocation(recordName), (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); -+ if (resource == null) resource = new ResourceLocation(recordName); -+ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(resource, (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); - this.mapSoundPositions.put(blockPosIn, positionedsoundrecord); - this.mc.getSoundHandler().playSound(positionedsoundrecord); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej deleted file mode 100644 index b48a3f0884..0000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej +++ /dev/null @@ -1,13 +0,0 @@ -++++ REJECTED PATCH 7 - this.mipmapLevels = k1; - } - -+ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.mapRegisteredSprites.size()); - for (final TextureAtlasSprite textureatlassprite1 : this.mapRegisteredSprites.values()) - { -+ if (skipFirst) break; -+ bar.step(textureatlassprite1.getIconName()); - try - { - textureatlassprite1.generateMipmaps(this.mipmapLevels); -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index a64dc75254..c2d747ab1c 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -59,6 +59,7 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagString; import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.Packet; +import net.minecraft.network.play.server.SPacketBlockChange; import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityNote; @@ -671,7 +672,7 @@ public class ForgeHooks // Tell client the block is gone immediately then process events if (world.getTileEntity(pos) == null) { - S23PacketBlockChange packet = new S23PacketBlockChange(world, pos); + SPacketBlockChange packet = new SPacketBlockChange(world, pos); packet.blockState = Blocks.air.getDefaultState(); entityPlayer.playerNetServerHandler.sendPacket(packet); } @@ -937,4 +938,4 @@ public class ForgeHooks MovingObjectPosition movingObjectPosition = rayTraceEyes(entity, length); return movingObjectPosition == null ? null : movingObjectPosition.hitVec; } -} \ No newline at end of file +} diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index 0a4c646df0..1658023fca 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -25,6 +25,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; @@ -335,18 +336,7 @@ public class ForgeEventFactory return event.canUpdate; } - /** - * Use {@link #onPlaySoundAtEntity(Entity,String,float,float)} - */ - @Deprecated - public static String onPlaySoundAt(Entity entity, String name, float volume, float pitch) - { - PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, volume, pitch); - MinecraftForge.EVENT_BUS.post(event); - return event.name; - } - - public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, String name, float volume, float pitch) + public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, SoundEvent name, float volume, float pitch) { PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, volume, pitch); MinecraftForge.EVENT_BUS.post(event); diff --git a/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java b/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java index 5b933ebd87..8947e32bae 100644 --- a/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java @@ -2,6 +2,7 @@ package net.minecraftforge.event.entity; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.Entity; +import net.minecraft.util.SoundEvent; /** * PlaySoundAtEntityEvent is fired a sound is to be played at an Entity
@@ -25,14 +26,14 @@ import net.minecraft.entity.Entity; **/ @Cancelable public class PlaySoundAtEntityEvent extends EntityEvent -{ - public String name; - public final float volume; - public final float pitch; - public float newVolume; - public float newPitch; - - public PlaySoundAtEntityEvent(Entity entity, String name, float volume, float pitch) +{ + private SoundEvent name; + private final float volume; + private final float pitch; + private float newVolume; + private float newPitch; + + public PlaySoundAtEntityEvent(Entity entity, SoundEvent name, float volume, float pitch) { super(entity); this.name = name; @@ -41,4 +42,13 @@ public class PlaySoundAtEntityEvent extends EntityEvent this.newVolume = volume; this.newPitch = pitch; } + + public SoundEvent getSound(){ return this.name; } + public float getDefaultVolume() { return this.volume; } + public float getDefaultPitch() { return this.pitch; } + public float getVolume() { return this.newVolume; } + public float getPitch() { return this.newPitch; } + public void setSound(SoundEvent value) { this.name = value; } + public void setVolume(float value) { this.newVolume = value; } + public void setPitch(float value) { this.newPitch = value; } } diff --git a/src/main/java/net/minecraftforge/event/world/BlockEvent.java b/src/main/java/net/minecraftforge/event/world/BlockEvent.java index 9ad5a61ebc..7815685e30 100644 --- a/src/main/java/net/minecraftforge/event/world/BlockEvent.java +++ b/src/main/java/net/minecraftforge/event/world/BlockEvent.java @@ -6,6 +6,7 @@ import java.util.List; import net.minecraft.block.state.IBlockState; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Enchantments; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; @@ -78,14 +79,14 @@ public class BlockEvent extends Event this.player = player; if (state == null || !ForgeHooks.canHarvestBlock(state.getBlock(), player, world, pos) || // Handle empty block or player unable to break block scenario - (state.getBlock().canSilkHarvest(world, pos, world.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player))) // If the block is being silk harvested, the exp dropped is 0 + (state.getBlock().canSilkHarvest(world, pos, world.getBlockState(pos), player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, player.func_184614_ca()) > 0)) // If the block is being silk harvested, the exp dropped is 0 { this.exp = 0; } else { - int bonusLevel = EnchantmentHelper.getFortuneModifier(player); - this.exp = state.getBlock().getExpDrop(world, pos, bonusLevel); + int bonusLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185308_t, player.func_184614_ca()); + this.exp = state.getBlock().getExpDrop(state, world, pos, bonusLevel); } } @@ -133,13 +134,13 @@ public class BlockEvent extends Event { super(blockSnapshot.world, blockSnapshot.pos, blockSnapshot.getCurrentBlock()); this.player = player; - this.itemInHand = player.getCurrentEquippedItem(); + this.itemInHand = player.func_184614_ca(); this.blockSnapshot = blockSnapshot; this.placedBlock = blockSnapshot.getCurrentBlock(); this.placedAgainst = placedAgainst; if (DEBUG) { - System.out.printf("Created PlaceEvent - [PlacedBlock: %s ][PlacedAgainst: %s ][ItemStack: %s ][Player: %s ]\n", placedBlock, placedAgainst, player.getCurrentEquippedItem(), player); + System.out.printf("Created PlaceEvent - [PlacedBlock: %s ][PlacedAgainst: %s ][ItemStack: %s ][Player: %s ]\n", placedBlock, placedAgainst, itemInHand, player); } } } From 776eb00ed394f2e059f26127337ae2117d605c8b Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 7 Mar 2016 23:34:40 -0800 Subject: [PATCH 052/243] 10 more rejects down. 98 errors 6 rejects left. --- .../net/minecraft/block/Block.java.patch | 62 ++++---- .../minecraft/block/BlockFlowerPot.java.patch | 4 +- .../minecraft/block/BlockLadder.java.patch | 2 +- .../minecraft/block/BlockTrapDoor.java.patch | 21 +++ .../net/minecraft/block/BlockVine.java.patch | 2 +- .../minecraft/client/gui/GuiIngame.java.patch | 12 ++ .../net/minecraft/entity/Entity.java.patch | 110 +++++-------- .../minecraft/entity/EntityHanging.java.patch | 12 ++ .../entity/EntityLivingBase.java.patch | 144 ++++++++++++++---- .../entity/item/EntityMinecart.java.patch | 13 +- .../ContainerBrewingStand.java.patch | 21 +++ .../inventory/ContainerPlayer.java.patch | 12 ++ .../inventory/ContainerRepair.java.patch | 14 +- .../net/minecraft/item/Item.java.patch | 20 +-- .../server/MinecraftServer.java.patch | 2 +- .../net/minecraft/world/World.java.patch | 10 +- .../minecraft/world/WorldServer.java.patch | 14 +- .../world/biome/BiomeGenHills.java.patch | 14 +- .../minecraft/entity/Entity.java.patch.rej | 59 ------- .../entity/EntityHanging.java.patch.rej | 11 -- .../entity/EntityLivingBase.java.patch.rej | 76 --------- .../ContainerBrewingStand.java.patch.rej | 30 ---- .../inventory/ContainerPlayer.java.patch.rej | 11 -- .../client/ClientCommandHandler.java | 4 +- .../client/ForgeHooksClient.java | 41 +++-- .../minecraftforge/client/GuiIngameForge.java | 76 +++++---- .../client/event/DrawBlockHighlightEvent.java | 3 +- .../client/event/RenderGameOverlayEvent.java | 4 +- .../event/sound/PlayBackgroundMusicEvent.java | 16 -- .../event/sound/PlaySoundEffectEvent.java | 11 -- .../sound/PlaySoundEffectSourceEvent.java | 16 -- .../client/event/sound/PlaySoundEvent.java | 5 +- .../event/sound/PlayStreamingEvent.java | 27 ---- .../client/event/sound/SoundEvent.java | 11 +- .../client/event/sound/SoundLoadEvent.java | 5 +- .../client/event/sound/SoundResultEvent.java | 26 ---- .../client/event/sound/SoundSetupEvent.java | 5 +- .../common/DimensionManager.java | 16 +- .../net/minecraftforge/common/ForgeHooks.java | 28 ++-- .../common/brewing/BrewingRecipeRegistry.java | 6 +- 40 files changed, 400 insertions(+), 576 deletions(-) create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiIngame.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch delete mode 100644 rejects/minecraft/net/minecraft/entity/Entity.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/EntityHanging.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej delete mode 100644 src/main/java/net/minecraftforge/client/event/sound/PlayBackgroundMusicEvent.java delete mode 100644 src/main/java/net/minecraftforge/client/event/sound/PlaySoundEffectEvent.java delete mode 100644 src/main/java/net/minecraftforge/client/event/sound/PlaySoundEffectSourceEvent.java delete mode 100644 src/main/java/net/minecraftforge/client/event/sound/PlayStreamingEvent.java delete mode 100644 src/main/java/net/minecraftforge/client/event/sound/SoundResultEvent.java diff --git a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch index e7e3d5218a..a5c568e361 100644 --- a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch @@ -1,14 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/Block.java +++ ../src-work/minecraft/net/minecraft/block/Block.java -@@ -17,6 +17,7 @@ - import net.minecraft.entity.item.EntityItem; - import net.minecraft.entity.item.EntityXPOrb; - import net.minecraft.entity.player.EntityPlayer; -+import net.minecraft.init.Blocks; - import net.minecraft.init.Enchantments; - import net.minecraft.item.Item; - import net.minecraft.item.ItemBlock; -@@ -46,8 +47,9 @@ +@@ -46,8 +46,9 @@ public class Block { private static final ResourceLocation AIR_ID = new ResourceLocation("air"); @@ -20,7 +12,7 @@ public static final AxisAlignedBB field_185505_j = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); public static final AxisAlignedBB field_185506_k = null; private CreativeTabs displayOnCreativeTab; -@@ -70,6 +72,9 @@ +@@ -70,6 +71,9 @@ private IBlockState defaultBlockState; private String unlocalizedName; @@ -30,7 +22,7 @@ public static int getIdFromBlock(Block blockIn) { return blockRegistry.getIDForObject(blockIn); -@@ -83,7 +88,8 @@ +@@ -83,7 +87,8 @@ public static Block getBlockById(int id) { @@ -40,7 +32,7 @@ } public static IBlockState getStateById(int id) -@@ -268,7 +274,7 @@ +@@ -268,7 +273,7 @@ public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) { @@ -49,7 +41,7 @@ } public Block setHardness(float hardness) -@@ -305,9 +311,10 @@ +@@ -305,9 +310,10 @@ return this.needsRandomTick; } @@ -61,7 +53,7 @@ } public AxisAlignedBB func_185496_a(IBlockState p_185496_1_, IBlockAccess p_185496_2_, BlockPos p_185496_3_) -@@ -346,13 +353,13 @@ +@@ -346,13 +352,13 @@ @SideOnly(Side.CLIENT) public int func_185484_c(IBlockState p_185484_1_, IBlockAccess p_185484_2_, BlockPos p_185484_3_) { @@ -77,7 +69,7 @@ } else { -@@ -415,7 +422,7 @@ +@@ -415,7 +421,7 @@ } } @@ -86,7 +78,7 @@ } @SideOnly(Side.CLIENT) -@@ -472,6 +479,10 @@ +@@ -472,6 +478,10 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { @@ -97,7 +89,7 @@ } public int quantityDropped(Random random) -@@ -486,8 +497,7 @@ +@@ -486,8 +496,7 @@ public float getPlayerRelativeBlockHardness(IBlockState playerIn, EntityPlayer worldIn, World pos, BlockPos p_180647_4_) { @@ -107,7 +99,7 @@ } public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture) -@@ -497,20 +507,16 @@ +@@ -497,20 +506,16 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { @@ -133,7 +125,7 @@ } } } -@@ -518,8 +524,13 @@ +@@ -518,8 +523,13 @@ public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) { @@ -148,7 +140,7 @@ float f = 0.5F; double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -@@ -588,7 +599,7 @@ +@@ -588,7 +598,7 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { @@ -157,7 +149,7 @@ } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand side, ItemStack hitX, EnumFacing hitY, float hitZ, float p_180639_9_, float p_180639_10_) -@@ -638,25 +649,35 @@ +@@ -638,25 +648,35 @@ player.triggerAchievement(StatList.func_188055_a(this)); player.addExhaustion(0.025F); @@ -196,7 +188,7 @@ } protected ItemStack createStackedBlock(IBlockState state) -@@ -747,6 +768,7 @@ +@@ -747,6 +767,7 @@ entityIn.motionY = 0.0D; } @@ -204,7 +196,7 @@ public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) { return new ItemStack(Item.getItemFromBlock(this), 1, this.damageDropped(p_185473_3_)); -@@ -844,6 +866,1165 @@ +@@ -844,6 +865,1167 @@ return "Block{" + blockRegistry.getNameForObject(this) + "}"; } @@ -234,12 +226,13 @@ + /** + * Checks if a player or entity can use this block to 'climb' like a ladder. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @param entity The entity trying to use the ladder, CAN be null. + * @return True if the block should act like a ladder + */ -+ public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return false; } ++ public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return false; } + + /** + * Return true if the block is a normal, solid cube. This @@ -396,7 +389,7 @@ + public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) + { + this.onBlockHarvested(world, pos, state, player); -+ return world.setBlockState(pos, Blocks.air.getDefaultState(), world.isRemote ? 11 : 3); ++ return world.setBlockState(pos, net.minecraft.init.Blocks.air.getDefaultState(), world.isRemote ? 11 : 3); + } + + /** @@ -834,7 +827,7 @@ + * @param numberOfParticles that vanilla would have spawned. + * @return True to prevent vanilla landing particles form spawning. + */ -+ public boolean addLandingEffects(net.minecraft.world.WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles ) ++ public boolean addLandingEffects(IBlockState state, net.minecraft.world.WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles ) + { + return false; + } @@ -897,12 +890,12 @@ + IBlockState plant = plantable.getPlant(world, pos.offset(direction)); + net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); + -+ if (plant.getBlock() == Blocks.cactus && this == Blocks.cactus) ++ if (plant.getBlock() == net.minecraft.init.Blocks.cactus && this == net.minecraft.init.Blocks.cactus) + { + return true; + } + -+ if (plant.getBlock() == Blocks.reeds && this == Blocks.reeds) ++ if (plant.getBlock() == net.minecraft.init.Blocks.reeds && this == net.minecraft.init.Blocks.reeds) + { + return true; + } @@ -914,14 +907,14 @@ + + switch (plantType) + { -+ case Desert: return this == Blocks.sand || this == Blocks.hardened_clay || this == Blocks.stained_hardened_clay || this == Blocks.dirt; -+ case Nether: return this == Blocks.soul_sand; -+ case Crop: return this == Blocks.farmland; ++ case Desert: return this == net.minecraft.init.Blocks.sand || this == net.minecraft.init.Blocks.hardened_clay || this == net.minecraft.init.Blocks.stained_hardened_clay || this == net.minecraft.init.Blocks.dirt; ++ case Nether: return this == net.minecraft.init.Blocks.soul_sand; ++ case Crop: return this == net.minecraft.init.Blocks.farmland; + case Cave: return state.isSideSolid(world, pos, EnumFacing.UP); -+ case Plains: return this == Blocks.grass || this == Blocks.dirt || this == Blocks.farmland; ++ case Plains: return this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.farmland; + case Water: return state.func_185904_a() == Material.water && state.getValue(BlockLiquid.LEVEL) == 0; + case Beach: -+ boolean isBeach = this == Blocks.grass || this == Blocks.dirt || this == Blocks.sand; ++ boolean isBeach = this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.sand; + boolean hasWater = (world.getBlockState(pos.east()).func_185904_a() == Material.water || + world.getBlockState(pos.west()).func_185904_a() == Material.water || + world.getBlockState(pos.north()).func_185904_a() == Material.water || @@ -1255,6 +1248,7 @@ + * Called when the entity is inside this block, may be used to determined if the entity can breathing, + * display material overlays, or if the entity can swim inside a block. + * ++ * @param state The current block state + * @param world that is being tested. + * @param blockpos position thats being tested. + * @param iblockstate state at world/blockpos @@ -1264,7 +1258,7 @@ + * @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment. + * @return null for default behavior, true if the entity is within the material, false if it was not. + */ -+ public Boolean isEntityInsideMaterial(World world, BlockPos blockpos, IBlockState iblockstate, Entity entity, double yToTest, Material materialIn, boolean testingHead) ++ public Boolean isEntityInsideMaterial(IBlockState state, IBlockAccess world, BlockPos blockpos, IBlockState iblockstate, Entity entity, double yToTest, Material materialIn, boolean testingHead) + { + return null; + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch index f5dff58105..0e6bf83a5b 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch @@ -30,10 +30,10 @@ + return ret; + } + @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 (willHarvest) return true; //If it will harvest, delay deletion of the block until after getDrops -+ return super.removedByPlayer(world, pos, player, willHarvest); ++ return super.removedByPlayer(state, world, pos, player, willHarvest); + } + @Override + public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack tool) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch index ee66a27545..ce3dc11ddd 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch @@ -26,5 +26,5 @@ return new BlockStateContainer(this, new IProperty[] {FACING}); } + -+ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } ++ @Override public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch new file mode 100644 index 0000000000..e2af917e9c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java +@@ -241,6 +241,18 @@ + return new BlockStateContainer(this, new IProperty[] {FACING, OPEN, HALF}); + } + ++ @Override ++ public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) ++ { ++ if (state.getValue(OPEN)) ++ { ++ IBlockState down = world.getBlockState(pos.down()); ++ if (down.getBlock() == net.minecraft.init.Blocks.ladder) ++ return down.getValue(BlockLadder.FACING) == state.getValue(FACING); ++ } ++ return false; ++ } ++ + public static enum DoorHalf implements IStringSerializable + { + TOP("top"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch index e939dca263..d2eff4f1ea 100644 --- a/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch @@ -23,7 +23,7 @@ return i; } + /*************************FORGE START***********************************/ -+ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity){ return true; } ++ @Override public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity){ return true; } + @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } + @Override + public java.util.List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngame.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngame.java.patch new file mode 100644 index 0000000000..2b9853f16a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngame.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiIngame.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngame.java +@@ -360,7 +360,8 @@ + + BlockPos blockpos = raytraceresult.getBlockPos(); + +- if (!this.mc.theWorld.getBlockState(blockpos).getBlock().hasTileEntity() || !(this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory)) ++ net.minecraft.block.state.IBlockState state = this.mc.theWorld.getBlockState(blockpos); ++ if (!state.getBlock().hasTileEntity(state) || !(this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory)) + { + return; + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch b/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch index 3b2451cc9d..7518d29e80 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch @@ -9,12 +9,11 @@ { private static final Logger field_184243_a = LogManager.getLogger(); private static final AxisAlignedBB ZERO_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); -@@ -195,8 +195,20 @@ +@@ -195,8 +195,16 @@ this.dataWatcher.func_187214_a(field_184242_az, ""); this.dataWatcher.func_187214_a(field_184234_aB, Boolean.valueOf(false)); this.entityInit(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); -+ for (net.minecraftforge.common.IExtendedEntityProperties props : extendedProperties.values()) props.init(this, worldIn); + capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this); } @@ -22,39 +21,49 @@ + private NBTTagCompound customEntityData; + public boolean captureDrops = false; + public java.util.ArrayList capturedDrops = new java.util.ArrayList(); -+ -+ @Deprecated //ToDo: Move to Capabilities? -+ protected java.util.HashMap extendedProperties = new java.util.HashMap(); + private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities; + public int getEntityId() { return this.entityId; -@@ -1534,6 +1546,23 @@ +@@ -1134,12 +1142,12 @@ + BlockPos blockpos = new BlockPos(this.posX, d0, this.posZ); + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + ++ Boolean result = iblockstate.getBlock().isEntityInsideMaterial(iblockstate, this.worldObj, blockpos, iblockstate, this, d0, materialIn, true); ++ if (result != null) return result; ++ + if (iblockstate.func_185904_a() == materialIn) + { +- float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F; +- float f1 = (float)(blockpos.getY() + 1) - f; +- boolean flag = d0 < (double)f1; +- return !flag && this instanceof EntityPlayer ? false : flag; ++ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(materialIn, this, blockpos); + } + else + { +@@ -1534,6 +1542,9 @@ tagCompund.setTag("Tags", nbttaglist); } + if (customEntityData != null) tagCompund.setTag("ForgeData", customEntityData); -+ for (String identifier : this.extendedProperties.keySet()) -+ { -+ try -+ { -+ net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); -+ props.saveNBTData(tagCompund); -+ } -+ catch (Throwable t) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe("Failed to save extended properties for %s. This is a mod issue.", identifier); -+ t.printStackTrace(); -+ } -+ } -+ + if (this.capabilities != null) tagCompund.setTag("ForgeCaps", this.capabilities.serializeNBT()); + this.writeEntityToNBT(tagCompund); if (this.func_184207_aI()) -@@ -1715,7 +1744,10 @@ +@@ -1629,6 +1640,9 @@ + this.setSilent(tagCompund.getBoolean("Silent")); + this.func_184195_f(tagCompund.getBoolean("Glowing")); + ++ if (tagCompund.hasKey("ForgeData")) customEntityData = tagCompund.getCompoundTag("ForgeData"); ++ if (this.capabilities != null && tagCompund.hasKey("ForgeCaps")) this.capabilities.deserializeNBT(tagCompund.getCompoundTag("ForgeCaps")); ++ + if (tagCompund.hasKey("Tags", 9)) + { + this.field_184236_aF.clear(); +@@ -1715,7 +1729,10 @@ { EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, itemStackIn); entityitem.setDefaultPickupDelay(); @@ -66,7 +75,15 @@ return entityitem; } else -@@ -2279,6 +2311,7 @@ +@@ -1824,6 +1841,7 @@ + + public boolean func_184205_a(Entity p_184205_1_, boolean p_184205_2_) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_184205_1_, true)) return false; + if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) + { + if (this.func_184218_aH()) +@@ -2279,6 +2297,7 @@ { if (!this.worldObj.isRemote && !this.isDead) { @@ -74,7 +91,7 @@ this.worldObj.theProfiler.startSection("changeDimension"); MinecraftServer minecraftserver = this.func_184102_h(); int i = this.dimension; -@@ -2372,7 +2405,7 @@ +@@ -2372,7 +2391,7 @@ public float getExplosionResistance(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn) { @@ -83,7 +100,7 @@ } public boolean verifyExplosion(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn, float p_174816_5_) -@@ -2662,6 +2695,210 @@ +@@ -2662,6 +2681,165 @@ EnchantmentHelper.applyArthropodEnchantments(entityLivingBaseIn, entityIn); } @@ -199,51 +216,6 @@ + } + + /** -+ * Register the instance of IExtendedProperties into the entity's collection. -+ * @param identifier The identifier which you can use to retrieve these properties for the entity. -+ * @param properties The instanceof IExtendedProperties to register -+ * @return The identifier that was used to register the extended properties. Empty String indicates an error. If your requested key already existed, this will return a modified one that is unique. -+ */ -+ public String registerExtendedProperties(String identifier, net.minecraftforge.common.IExtendedEntityProperties properties) -+ { -+ if (identifier == null) -+ { -+ net.minecraftforge.fml.common.FMLLog.warning("Someone is attempting to register extended properties using a null identifier. This is not allowed. Aborting. This may have caused instability."); -+ return ""; -+ } -+ if (properties == null) -+ { -+ net.minecraftforge.fml.common.FMLLog.warning("Someone is attempting to register null extended properties. This is not allowed. Aborting. This may have caused instability."); -+ return ""; -+ } -+ -+ String baseIdentifier = identifier; -+ int identifierModCount = 1; -+ while (this.extendedProperties.containsKey(identifier)) -+ { -+ identifier = String.format("%s%d", baseIdentifier, identifierModCount++); -+ } -+ -+ if (baseIdentifier != identifier) -+ { -+ net.minecraftforge.fml.common.FMLLog.info("An attempt was made to register exended properties using an existing key. The duplicate identifier (%s) has been remapped to %s.", baseIdentifier, identifier); -+ } -+ -+ this.extendedProperties.put(identifier, properties); -+ return identifier; -+ } -+ -+ /** -+ * Gets the extended properties identified by the passed in key -+ * @param identifier The key that identifies the extended properties. -+ * @return The instance of IExtendedProperties that was found, or null. -+ */ -+ public net.minecraftforge.common.IExtendedEntityProperties getExtendedProperties(String identifier) -+ { -+ return this.extendedProperties.get(identifier); -+ } -+ -+ /** + * If a rider of this entity can interact with this entity. Should return true on the + * ridden entity if so. + * diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch new file mode 100644 index 0000000000..e92e37ef7e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityHanging.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityHanging.java +@@ -139,6 +139,9 @@ + BlockPos blockpos1 = blockpos.offset(enumfacing, k + i1).up(l + j1); + IBlockState iblockstate = this.worldObj.getBlockState(blockpos1); + ++ if (iblockstate.isSideSolid(this.worldObj, blockpos1, this.facingDirection)) ++ continue; ++ + if (!iblockstate.func_185904_a().isSolid() && !BlockRedstoneDiode.func_185546_B(iblockstate)) + { + return false; diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index d267a16705..6db21f1932 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -1,6 +1,27 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java -@@ -363,7 +363,7 @@ +@@ -190,9 +190,11 @@ + float f = (float)MathHelper.ceiling_float_int(this.fallDistance - 3.0F); + + if (p_184231_4_.func_185904_a() != Material.air) ++ if (p_184231_4_.getBlock().isAir(p_184231_4_, worldObj, p_184231_5_)) + { + double d0 = Math.min((double)(0.2F + f / 15.0F), 2.5D); + int i = (int)(150.0D * d0); ++ if (!p_184231_4_.getBlock().addLandingEffects(p_184231_4_, (WorldServer)this.worldObj, p_184231_5_, p_184231_4_, this, i)) + ((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.BLOCK_DUST, this.posX, this.posY, this.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] {Block.getStateId(p_184231_4_)}); + } + } +@@ -264,7 +266,7 @@ + } + } + +- if (!this.worldObj.isRemote && this.func_184218_aH() && this.func_184187_bx() instanceof EntityLivingBase) ++ if (!this.worldObj.isRemote && this.func_184218_aH() && this.func_184187_bx() != null && this.func_184187_bx().shouldDismountInWater(this)) + { + this.func_184210_p(); + } +@@ -363,7 +365,7 @@ if (!this.worldObj.isRemote && (this.isPlayer() || this.recentlyHit > 0 && this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot"))) { int i = this.getExperiencePoints(this.attackingPlayer); @@ -9,7 +30,7 @@ while (i > 0) { int j = EntityXPOrb.getXPSplit(i); -@@ -424,6 +424,7 @@ +@@ -424,6 +426,7 @@ { this.entityLivingToAttack = livingBase; this.revengeTimer = this.ticksExisted; @@ -17,7 +38,7 @@ } public EntityLivingBase getLastAttacker() -@@ -775,6 +776,8 @@ +@@ -775,6 +778,8 @@ public void heal(float healAmount) { @@ -26,7 +47,7 @@ float f = this.getHealth(); if (f > 0.0F) -@@ -795,6 +798,7 @@ +@@ -795,6 +800,7 @@ public boolean attackEntityFrom(DamageSource source, float amount) { @@ -34,7 +55,7 @@ if (this.isEntityInvulnerable(source)) { return false; -@@ -883,9 +887,9 @@ +@@ -883,9 +889,9 @@ this.recentlyHit = 100; this.attackingPlayer = (EntityPlayer)entity; } @@ -46,24 +67,49 @@ if (entitywolf.isTamed()) { -@@ -982,6 +986,16 @@ - return true; - } - } -+ -+ captureDrops = false; -+ -+ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, cause, capturedDrops, i, recentlyHit > 0)) -+ { -+ for (EntityItem item : capturedDrops) -+ { -+ worldObj.spawnEntityInWorld(item); -+ } -+ } - } +@@ -1007,6 +1013,7 @@ - return false; -@@ -1139,6 +1153,9 @@ + public void onDeath(DamageSource cause) + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; + if (!this.dead) + { + Entity entity = cause.getEntity(); +@@ -1034,11 +1041,24 @@ + i = EnchantmentHelper.func_185283_h((EntityLivingBase)entity); + } + ++ captureDrops = true; ++ capturedDrops.clear(); ++ + if (this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot")) + { + boolean flag = this.recentlyHit > 0; + this.func_184610_a(flag, i, cause); + } ++ ++ captureDrops = false; ++ ++ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, cause, capturedDrops, i, recentlyHit > 0)) ++ { ++ for (EntityItem item : capturedDrops) ++ { ++ worldObj.spawnEntityInWorld(item); ++ } ++ } + } + + this.worldObj.setEntityState(this, (byte)3); +@@ -1113,7 +1133,7 @@ + BlockPos blockpos = new BlockPos(i, j, k); + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + Block block = iblockstate.getBlock(); +- return block != Blocks.ladder && block != Blocks.vine ? block instanceof BlockTrapDoor && this.func_184604_a(blockpos, iblockstate) : true; ++ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(iblockstate, worldObj, new BlockPos(i, j, k), this); + } + } + +@@ -1139,6 +1159,9 @@ public void fall(float distance, float damageMultiplier) { @@ -73,7 +119,7 @@ super.fall(distance, damageMultiplier); PotionEffect potioneffect = this.getActivePotionEffect(MobEffects.jump); float f = potioneffect == null ? 0.0F : (float)(potioneffect.getAmplifier() + 1); -@@ -1231,6 +1248,8 @@ +@@ -1231,6 +1254,8 @@ { if (!this.isEntityInvulnerable(damageSrc)) { @@ -82,7 +128,7 @@ damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); float f = damageAmount; -@@ -1279,6 +1298,11 @@ +@@ -1279,6 +1304,11 @@ public void func_184609_a(EnumHand p_184609_1_) { @@ -94,7 +140,41 @@ if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) { this.swingProgressInt = -1; -@@ -1586,6 +1610,7 @@ +@@ -1476,6 +1506,7 @@ + + public void dismountEntity(Entity p_110145_1_) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_110145_1_, false)) return; + if (!(p_110145_1_ instanceof EntityBoat) && !(p_110145_1_ instanceof EntityHorse)) + { + double d1 = p_110145_1_.posX; +@@ -1500,7 +1531,7 @@ + + if (!this.worldObj.func_184143_b(axisalignedbb1)) + { +- if (this.worldObj.getBlockState(new BlockPos(d11, this.posY, d12)).func_185896_q()) ++ if (this.worldObj.getBlockState(new BlockPos(d11, this.posY, d12)).isSideSolid(worldObj, new BlockPos(d11, this.posY, d12), EnumFacing.UP)) + { + this.setPositionAndUpdate(d11, this.posY + 1.0D, d12); + return; +@@ -1508,14 +1539,14 @@ + + BlockPos blockpos = new BlockPos(d11, this.posY - 1.0D, d12); + +- if (this.worldObj.getBlockState(blockpos).func_185896_q() || this.worldObj.getBlockState(blockpos).func_185904_a() == Material.water) ++ if (this.worldObj.getBlockState(blockpos).isSideSolid(worldObj, blockpos, EnumFacing.UP) || this.worldObj.getBlockState(blockpos).func_185904_a() == Material.water) + { + d1 = d11; + d13 = this.posY + 1.0D; + d14 = d12; + } + } +- else if (!this.worldObj.func_184143_b(axisalignedbb1.offset(0.0D, 1.0D, 0.0D)) && this.worldObj.getBlockState(new BlockPos(d11, this.posY + 1.0D, d12)).func_185896_q()) ++ else if (!this.worldObj.func_184143_b(axisalignedbb1.offset(0.0D, 1.0D, 0.0D)) && this.worldObj.getBlockState(new BlockPos(d11, this.posY + 1.0D, d12)).isSideSolid(worldObj, new BlockPos(d11, this.posY + 1.0D, d12), EnumFacing.UP)) + { + d1 = d11; + d13 = this.posY + 2.0D; +@@ -1586,6 +1617,7 @@ } this.isAirBorne = true; @@ -102,7 +182,7 @@ } protected void updateAITick() -@@ -1845,6 +1870,7 @@ +@@ -1845,6 +1877,7 @@ public void onUpdate() { @@ -110,7 +190,7 @@ super.onUpdate(); this.func_184608_ct(); -@@ -2351,6 +2377,41 @@ +@@ -2351,6 +2384,41 @@ this.potionsNeedUpdate = true; } @@ -152,7 +232,7 @@ public abstract EnumHandSide func_184591_cq(); public boolean func_184587_cr() -@@ -2371,6 +2432,14 @@ +@@ -2371,6 +2439,14 @@ if (itemstack == this.field_184627_bm) { @@ -167,7 +247,7 @@ if (this.func_184605_cv() <= 25 && this.func_184605_cv() % 4 == 0) { this.func_184584_a(this.field_184627_bm, 5); -@@ -2380,6 +2449,7 @@ +@@ -2380,6 +2456,7 @@ { this.onItemUseFinish(); } @@ -175,7 +255,7 @@ } else { -@@ -2394,8 +2464,10 @@ +@@ -2394,8 +2471,10 @@ if (itemstack != null && !this.func_184587_cr()) { @@ -187,7 +267,7 @@ if (!this.worldObj.isRemote) { -@@ -2478,6 +2550,8 @@ +@@ -2478,6 +2557,8 @@ this.func_184584_a(this.field_184627_bm, 16); ItemStack itemstack = this.field_184627_bm.onItemUseFinish(this.worldObj, this); @@ -196,7 +276,7 @@ if (itemstack != null && itemstack.stackSize == 0) { itemstack = null; -@@ -2508,6 +2582,8 @@ +@@ -2508,6 +2589,8 @@ if (this.field_184627_bm != null) { this.field_184627_bm.onPlayerStoppedUsing(this.worldObj, this, this.func_184605_cv()); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch index 1e93f3997c..a9e284240d 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -215,18 +215,17 @@ { entityIn.motionX *= 0.20000000298023224D; entityIn.motionZ *= 0.20000000298023224D; -@@ -981,7 +1025,222 @@ - { +@@ -982,6 +1026,221 @@ this.func_184212_Q().func_187227_b(field_184270_f, Boolean.valueOf(p_94096_1_)); } -+ + + /* =================================== FORGE START ===========================================*/ + private BlockPos getCurrentRailPosition() + { + int x = MathHelper.floor_double(this.posX); + int y = MathHelper.floor_double(this.posY); + int z = MathHelper.floor_double(this.posZ); - ++ + if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(x, y - 1, z))) y--; + return new BlockPos(x, y, z); + } @@ -251,7 +250,7 @@ + double mX = this.motionX; + double mZ = this.motionZ; + -+ if (this.riddenByEntity != null) ++ if (this.func_184187_bx() != null) + { + mX *= 0.75D; + mZ *= 0.75D; @@ -349,7 +348,7 @@ + */ + public boolean isPoweredCart() + { -+ return getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE; ++ return func_184264_v() == EntityMinecart.Type.FURNACE; + } + + /** @@ -358,7 +357,7 @@ + */ + public boolean canBeRidden() + { -+ return this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE; ++ return this.func_184264_v() == EntityMinecart.Type.RIDEABLE; + } + + /** diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch new file mode 100644 index 0000000000..2ff5ecea87 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerBrewingStand.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java +@@ -196,7 +196,7 @@ + + public boolean isItemValid(ItemStack stack) + { +- return stack != null && PotionHelper.func_185205_a(stack); ++ return stack != null && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack); + } + + public int getSlotStackLimit() +@@ -243,8 +243,7 @@ + } + else + { +- Item item = stack.getItem(); +- return item == Items.potionitem || item == Items.glass_bottle || item == Items.field_185155_bH || item == Items.field_185156_bI; ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack); + } + } + } diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch new file mode 100644 index 0000000000..729349b46f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerPlayer.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerPlayer.java +@@ -48,8 +48,7 @@ + } + else + { +- EntityEquipmentSlot entityequipmentslot1 = EntityLiving.func_184640_d(stack); +- return entityequipmentslot1 == entityequipmentslot; ++ return stack.getItem().isValidArmor(stack, entityequipmentslot, thePlayer); + } + } + @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch index 3d5e67896d..4fe5a03f09 100644 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch +++ b/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch @@ -18,15 +18,21 @@ { int l = ((Integer)iblockstate.getValue(BlockAnvil.DAMAGE)).intValue(); ++l; -@@ -163,6 +165,7 @@ +@@ -160,10 +162,12 @@ + Map map = EnchantmentHelper.getEnchantments(itemstack1); + j = j + itemstack.getRepairCost() + (itemstack2 == null ? 0 : itemstack2.getRepairCost()); + this.materialCost = 0; ++ boolean flag = false; if (itemstack2 != null) { +- boolean flag = itemstack2.getItem() == Items.enchanted_book && !Items.enchanted_book.getEnchantments(itemstack2).hasNoTags(); + if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, j)) return; - boolean flag = itemstack2.getItem() == Items.enchanted_book && !Items.enchanted_book.getEnchantments(itemstack2).hasNoTags(); ++ flag = itemstack2.getItem() == Items.enchanted_book && !Items.enchanted_book.getEnchantments(itemstack2).hasNoTags(); if (itemstack1.isItemStackDamageable() && itemstack1.getItem().getIsRepairable(itemstack, itemstack2)) -@@ -235,7 +238,7 @@ + { +@@ -235,7 +239,7 @@ for (Enchantment enchantment : map.keySet()) { @@ -35,7 +41,7 @@ { flag1 = false; ++i; -@@ -279,6 +282,8 @@ +@@ -279,6 +283,8 @@ } } diff --git a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch index cd28b89f8f..4b6c4ddc57 100644 --- a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch @@ -57,7 +57,7 @@ Vec3d vec3d1 = vec3d.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); return worldIn.rayTraceBlocks(vec3d, vec3d1, useLiquids, !useLiquids, false); } -@@ -422,11 +431,619 @@ +@@ -422,11 +431,609 @@ return false; } @@ -330,19 +330,9 @@ + * @param entity The entity trying to equip the armor + * @return True if the given ItemStack can be inserted in the slot + */ -+ public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) ++ public boolean isValidArmor(ItemStack stack, EntityEquipmentSlot armorType, Entity entity) + { -+ if (this instanceof ItemArmor) -+ { -+ return ((ItemArmor)this).armorType == armorType; -+ } -+ -+ if (armorType == 0) -+ { -+ return this == Item.getItemFromBlock(Blocks.pumpkin) || this == Items.skull; -+ } -+ -+ return false; ++ return net.minecraft.entity.EntityLiving.func_184640_d(stack) == armorType; + } + + /** @@ -677,7 +667,7 @@ public static void registerItems() { registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() -@@ -935,6 +1552,10 @@ +@@ -935,6 +1542,10 @@ private final float damageVsEntity; private final int enchantability; @@ -688,7 +678,7 @@ private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) { this.harvestLevel = harvestLevel; -@@ -969,9 +1590,36 @@ +@@ -969,9 +1580,36 @@ return this.enchantability; } diff --git a/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch index 00b9ef570d..25a020376c 100644 --- a/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -105,7 +105,7 @@ + WorldServer[] tmp = worldServers; + for (WorldServer world : tmp) + { -+ net.minecraftforge.common.DimensionManager.setWorld(world.provider.getDimensionId(), null); ++ net.minecraftforge.common.DimensionManager.setWorld(world.provider.getDimension(), null, this); + } } diff --git a/patches.mcp/minecraft/net/minecraft/world/World.java.patch b/patches.mcp/minecraft/net/minecraft/world/World.java.patch index 4b28a89dfe..98bb2042f6 100644 --- a/patches.mcp/minecraft/net/minecraft/world/World.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/World.java.patch @@ -271,11 +271,10 @@ } } } -@@ -2021,6 +2112,16 @@ - blockpos$pooledmutableblockpos.func_185343_d(k1, l1, i2); +@@ -2022,6 +2113,16 @@ IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos); Block block = iblockstate.getBlock(); -+ + + Boolean result = block.isEntityInsideMaterial(this, blockpos$mutableblockpos, iblockstate, entityIn, (double)l, materialIn, false); + if (result != null && result == true) + { @@ -285,9 +284,10 @@ + continue; + } + else if (result != null && result == false) continue; - ++ if (iblockstate.func_185904_a() == materialIn) { + double d0 = (double)((float)(l1 + 1) - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue())); @@ -2130,6 +2231,7 @@ public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) { @@ -556,7 +556,7 @@ + + Chunk chunk = getChunkFromBlockCoords(pos); + if (chunk == null || chunk.isEmpty()) return _default; -+ return getBlockState(pos).getBlock().isSideSolid(this, pos, side); ++ return getBlockState(pos).isSideSolid(this, pos, side); + } + + /** diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch index 606ef18568..5a29810983 100644 --- a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch @@ -15,16 +15,16 @@ this.theEntityTracker = new EntityTracker(this); this.thePlayerManager = new PlayerManager(this); + // Guarantee the dimension ID was not reset by the provider -+ int providerDim = this.provider.dimensionId; ++ int providerDim = this.provider.getDimension(); this.provider.registerWorld(this); -+ this.provider.dimensionId = providerDim; ++ this.provider.setDimension(providerDim); this.chunkProvider = this.createChunkProvider(); + perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn)); this.worldTeleporter = new Teleporter(this); this.calculateInitialSkylight(); this.calculateInitialWeather(); this.getWorldBorder().setSize(server.getMaxWorldSize()); -+ net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this); ++ net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this, mcServer); } public World init() @@ -220,18 +220,18 @@ if (flag) { - this.mcServer.func_184103_al().sendPacketToAllPlayers(new SPacketChangeGameState(2, 0.0F)); -+ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(2, 0.0F), this.provider.dimensionId); ++ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(2, 0.0F), this.provider.getDimension()); } else { - this.mcServer.func_184103_al().sendPacketToAllPlayers(new SPacketChangeGameState(1, 0.0F)); -+ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(1, 0.0F), this.provider.dimensionId); ++ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(1, 0.0F), this.provider.getDimension()); } - this.mcServer.func_184103_al().sendPacketToAllPlayers(new SPacketChangeGameState(7, this.rainingStrength)); - this.mcServer.func_184103_al().sendPacketToAllPlayers(new SPacketChangeGameState(8, this.thunderingStrength)); -+ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); -+ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); ++ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(7, this.rainingStrength), this.provider.getDimension()); ++ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimension()); } } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch index e3803d3ac6..031f46cf68 100644 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch @@ -1,14 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenHills.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java -@@ -2,6 +2,7 @@ - - import java.util.Random; - import net.minecraft.block.BlockSilverfish; -+import net.minecraft.block.state.IBlockState; - import net.minecraft.init.Blocks; - import net.minecraft.util.math.BlockPos; - import net.minecraft.world.World; -@@ -37,28 +38,20 @@ +@@ -37,28 +37,20 @@ public void decorate(World worldIn, Random rand, BlockPos pos) { super.decorate(worldIn, rand, pos); @@ -44,7 +36,7 @@ } public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_) -@@ -86,4 +79,24 @@ +@@ -86,4 +78,24 @@ EXTRA_TREES, MUTATED; } @@ -59,7 +51,7 @@ + { + BlockPos blockpos = pos.add(rand.nextInt(16), rand.nextInt(28) + 4, rand.nextInt(16)); + -+ IBlockState state = worldIn.getBlockState(blockpos); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); + if (state.getBlock().isReplaceableOreGen(state, worldIn, blockpos, net.minecraft.block.state.pattern.BlockMatcher.forBlock(Blocks.stone))) + { + worldIn.setBlockState(blockpos, Blocks.emerald_ore.getDefaultState(), 2); diff --git a/rejects/minecraft/net/minecraft/entity/Entity.java.patch.rej b/rejects/minecraft/net/minecraft/entity/Entity.java.patch.rej deleted file mode 100644 index ed53bc9e4e..0000000000 --- a/rejects/minecraft/net/minecraft/entity/Entity.java.patch.rej +++ /dev/null @@ -1,59 +0,0 @@ -++++ REJECTED PATCH 4 - IBlockState iblockstate = this.worldObj.getBlockState(blockpos); - Block block = iblockstate.getBlock(); - -+ Boolean result = block.isEntityInsideMaterial(this.worldObj, blockpos, iblockstate, this, d0, materialIn, true); -+ if (result != null) return result; -+ - if (block.getMaterial() == materialIn) - { -- float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F; -- float f1 = (float)(blockpos.getY() + 1) - f; -- boolean flag = d0 < (double)f1; -- return !flag && this instanceof EntityPlayer ? false : flag; -+ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(materialIn, this, blockpos); - } - else - { -++++ END PATCH -++++ REJECTED PATCH 6 - this.setAlwaysRenderNameTag(tagCompund.getBoolean("CustomNameVisible")); - this.cmdResultStats.readStatsFromNBT(tagCompund); - this.setSilent(tagCompund.getBoolean("Silent")); -+ -+ if (tagCompund.hasKey("ForgeData")) customEntityData = tagCompund.getCompoundTag("ForgeData"); -+ for (String identifier : this.extendedProperties.keySet()) -+ { -+ try -+ { -+ net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); -+ props.loadNBTData(tagCompund); -+ } -+ catch (Throwable t) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe("Failed to load extended properties for %s. This is a mod issue.", identifier); -+ t.printStackTrace(); -+ } -+ } -+ -+ //Rawr, legacy code, Vanilla added a UUID, keep this so older maps will convert properly TODO: Remove in 1.9 -+ if (tagCompund.hasKey("PersistentIDMSB") && tagCompund.hasKey("PersistentIDLSB")) -+ { -+ this.entityUniqueID = new UUID(tagCompund.getLong("PersistentIDMSB"), tagCompund.getLong("PersistentIDLSB")); -+ } -+ -+ if (this.capabilities != null && tagCompund.hasKey("ForgeCaps")) this.capabilities.deserializeNBT(tagCompund.getCompoundTag("ForgeCaps")); -+ - this.readEntityFromNBT(tagCompund); - - if (this.shouldSetPosAfterLoading()) -++++ END PATCH -++++ REJECTED PATCH 8 - - public void mountEntity(Entity entityIn) - { -+ if(!(this instanceof EntityLivingBase) && !net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } - this.entityRiderPitchDelta = 0.0D; - this.entityRiderYawDelta = 0.0D; - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/EntityHanging.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityHanging.java.patch.rej deleted file mode 100644 index 9b9b6da9a0..0000000000 --- a/rejects/minecraft/net/minecraft/entity/EntityHanging.java.patch.rej +++ /dev/null @@ -1,11 +0,0 @@ -++++ REJECTED PATCH 1 - { - BlockPos blockpos1 = blockpos.offset(enumfacing, k).up(l); - Block block = this.worldObj.getBlockState(blockpos1).getBlock(); -+ -+ if ( block.isSideSolid( this.worldObj, blockpos1, this.facingDirection )) -+ continue; - - if (!block.getMaterial().isSolid() && !BlockRedstoneDiode.isRedstoneRepeaterBlockID(block)) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej deleted file mode 100644 index 66499b8a99..0000000000 --- a/rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej +++ /dev/null @@ -1,76 +0,0 @@ -++++ REJECTED PATCH 1 - } - - int i = (int)(150.0D * d0); -+ if ( !block.addLandingEffects( (WorldServer)this.worldObj, pos, iblockstate, this, i ) ) - ((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.BLOCK_DUST, this.posX, this.posY, this.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] {Block.getStateId(iblockstate)}); - } - } -++++ END PATCH -++++ REJECTED PATCH 2 - } - } - -- if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase) -+ if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity != null && ridingEntity.shouldDismountInWater(this)) - { - this.mountEntity((Entity)null); - } -++++ END PATCH -++++ REJECTED PATCH 5 - return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; - } - -- @SideOnly(Side.CLIENT) - public void removePotionEffectClient(int potionId) - { - this.activePotionsMap.remove(Integer.valueOf(potionId)); -++++ END PATCH -++++ REJECTED PATCH 9 - - public void onDeath(DamageSource cause) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; - Entity entity = cause.getEntity(); - EntityLivingBase entitylivingbase = this.func_94060_bK(); - -++++ END PATCH -++++ REJECTED PATCH 10 - i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity); - } - -+ captureDrops = true; -+ capturedDrops.clear(); -+ - if (this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot")) - { - this.dropFewItems(this.recentlyHit > 0, i); -++++ END PATCH -++++ REJECTED PATCH 12 - int j = MathHelper.floor_double(this.getEntityBoundingBox().minY); - int k = MathHelper.floor_double(this.posZ); - Block block = this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock(); -- return (block == Blocks.ladder || block == Blocks.vine) && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).isSpectator()); -+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(block, worldObj, new BlockPos(i, j, k), this); - } - - public boolean isEntityAlive() -++++ END PATCH -++++ REJECTED PATCH 16 - - public void dismountEntity(Entity p_110145_1_) - { -+ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_110145_1_, false)){ return; } - double d0 = p_110145_1_.posX; - double d1 = p_110145_1_.getEntityBoundingBox().minY + (double)p_110145_1_.height; - double d2 = p_110145_1_.posZ; -++++ END PATCH -++++ REJECTED PATCH 19 - - public void mountEntity(Entity entityIn) - { -+ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } - if (this.ridingEntity != null && entityIn == null) - { - if (!this.worldObj.isRemote) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch.rej b/rejects/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch.rej deleted file mode 100644 index 663f1630b4..0000000000 --- a/rejects/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch.rej +++ /dev/null @@ -1,30 +0,0 @@ -++++ REJECTED PATCH 1 - - public boolean isItemValid(ItemStack stack) - { -- return stack != null ? stack.getItem().isPotionIngredient(stack) : false; -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack); - } - - public int getSlotStackLimit() -++++ END PATCH -++++ REJECTED PATCH 2 - - public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) - { -- if (stack.getItem() == Items.potionitem && stack.getMetadata() > 0) -+ if (stack.getItem() instanceof net.minecraft.item.ItemPotion && stack.getMetadata() > 0) - { - this.player.triggerAchievement(AchievementList.potion); - } -++++ END PATCH -++++ REJECTED PATCH 3 - - public static boolean canHoldPotion(ItemStack stack) - { -- return stack != null && (stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle); -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack); - } - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej b/rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej deleted file mode 100644 index 9b89b48f7a..0000000000 --- a/rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej +++ /dev/null @@ -1,11 +0,0 @@ -++++ REJECTED PATCH 1 - } - public boolean isItemValid(ItemStack stack) - { -- return stack == null ? false : (stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType == k_f : (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull ? false : k_f == 0)); -+ if (stack == null) return false; -+ return stack.getItem().isValidArmor(stack, k_f, thePlayer); - } - @SideOnly(Side.CLIENT) - public String getSlotTexture() -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java index 1b8b994326..968b944829 100644 --- a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java +++ b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java @@ -103,7 +103,7 @@ public class ClientCommandHandler extends CommandHandler return ret; } - public void autoComplete(String leftOfCursor, String full) + public void autoComplete(String leftOfCursor) { latestAutoComplete = null; @@ -142,4 +142,4 @@ public class ClientCommandHandler extends CommandHandler protected MinecraftServer func_184879_a() { return Minecraft.getMinecraft().getIntegratedServer(); } -} \ No newline at end of file +} diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 106a8e7699..c98196d543 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -113,9 +113,9 @@ public class ForgeHooksClient { Block block = state.getBlock(); - if (block != null && block.isBed(world, pos, entity)) + if (block != null && block.isBed(state, world, pos, entity)) { - glRotatef((float)(block.getBedDirection(world, pos).getHorizontalIndex() * 90), 0.0F, 1.0F, 0.0F); + glRotatef((float)(block.getBedDirection(state, world, pos).getHorizontalIndex() * 90), 0.0F, 1.0F, 0.0F); } } @@ -297,8 +297,7 @@ public class ForgeHooksClient public static ISound playSound(SoundManager manager, ISound sound) { - SoundEventAccessorComposite accessor = manager.sndHandler.getSound(sound.getSoundLocation()); - PlaySoundEvent e = new PlaySoundEvent(manager, sound, (accessor == null ? null : accessor.getSoundCategory())); + PlaySoundEvent e = new PlaySoundEvent(manager, sound); MinecraftForge.EVENT_BUS.post(e); return e.result; } @@ -361,7 +360,7 @@ public class ForgeHooksClient modelLoader.onPostBakeEvent(modelRegistry); } - public static Matrix4f getMatrix(ItemTransformVec3f transform) + public static Matrix4f getMatrix(ItemTransformVec3f transform) { javax.vecmath.Matrix4f m = new javax.vecmath.Matrix4f(), t = new javax.vecmath.Matrix4f(); m.setIdentity(); @@ -383,7 +382,7 @@ public class ForgeHooksClient return m; } - public static IBakedModel handleCameraTransforms(IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType) + public static IBakedModel handleCameraTransforms(IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType) { if(model instanceof IPerspectiveAwareModel) { @@ -598,20 +597,20 @@ public class ForgeHooksClient } } - public static IBakedModel getDamageModel(IBakedModel ibakedmodel, TextureAtlasSprite texture, IBlockState state, IBlockAccess world, BlockPos pos) - { - // TODO custom damage models - // state = state.block.getExtendedState(state, world, pos); - return (new SimpleBakedModel.Builder(state, ibakedmodel, texture, pos)).makeBakedModel(); - } + public static IBakedModel getDamageModel(IBakedModel ibakedmodel, TextureAtlasSprite texture, IBlockState state, IBlockAccess world, BlockPos pos) + { + // TODO custom damage models + // state = state.block.getExtendedState(state, world, pos); + return (new SimpleBakedModel.Builder(state, ibakedmodel, texture, pos)).makeBakedModel(); + } - public static boolean shouldCauseReequipAnimation(ItemStack from, ItemStack to) - { - if(!Objects.equal(from, to) || from == null) - { - return false; - } - // FIXME: 3rd argument? - return from.getItem().shouldCauseReequipAnimation(from, to); - } + public static boolean shouldCauseReequipAnimation(ItemStack from, ItemStack to) + { + if(!Objects.equal(from, to) || from == null) + { + return false; + } + // FIXME: 3rd argument? + return from.getItem().shouldCauseReequipAnimation(from, to); + } } diff --git a/src/main/java/net/minecraftforge/client/GuiIngameForge.java b/src/main/java/net/minecraftforge/client/GuiIngameForge.java index 9e43403110..9e607658fd 100644 --- a/src/main/java/net/minecraftforge/client/GuiIngameForge.java +++ b/src/main/java/net/minecraftforge/client/GuiIngameForge.java @@ -23,9 +23,9 @@ import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.IAttributeInstance; 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.scoreboard.ScoreObjective; import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.scoreboard.Scoreboard; @@ -88,8 +88,8 @@ public class GuiIngameForge extends GuiIngame eventParent = new RenderGameOverlayEvent(partialTicks, res); int width = res.getScaledWidth(); int height = res.getScaledHeight(); - renderHealthMount = mc.thePlayer.ridingEntity instanceof EntityLivingBase; - renderFood = mc.thePlayer.ridingEntity == null; + renderHealthMount = mc.thePlayer.func_184187_bx() instanceof EntityLivingBase; + renderFood = mc.thePlayer.func_184187_bx() == null; renderJumpBar = mc.thePlayer.isRidingHorse(); right_height = 39; @@ -107,12 +107,13 @@ public class GuiIngameForge extends GuiIngame } else { - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + GlStateManager.enableDepth(); + GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); } if (renderHelmet) renderHelmet(res, partialTicks); - if (renderPortal && !mc.thePlayer.isPotionActive(Potion.confusion)) + if (renderPortal && !mc.thePlayer.isPotionActive(MobEffects.confusion)) { renderPortal(res, partialTicks); } @@ -123,9 +124,10 @@ public class GuiIngameForge extends GuiIngame zLevel = -90.0F; rand.setSeed((long)(updateCounter * 312871)); - if (renderCrosshairs) renderCrosshairs(width, height); + if (renderCrosshairs) renderCrosshairs(partialTicks); if (renderBossHealth) renderBossHealth(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); if (this.mc.playerController.shouldDrawHUD() && this.mc.getRenderViewEntity() instanceof EntityPlayer) { if (renderHealth) renderHealth(width, height); @@ -134,6 +136,7 @@ public class GuiIngameForge extends GuiIngame if (renderHealthMount) renderHealthMount(width, height); if (renderAir) renderAir(width, height); } + renderSleepFade(width, height); if (renderJumpBar) @@ -147,7 +150,9 @@ public class GuiIngameForge extends GuiIngame renderToolHightlight(res); renderHUDText(width, height); + renderPotionIcons(res); renderRecordOverlay(width, height, partialTicks); + renderSubtitles(res); renderTitle(width, height, partialTicks); @@ -185,31 +190,37 @@ public class GuiIngameForge extends GuiIngame return res; } - protected void renderCrosshairs(int width, int height) + protected void renderCrosshairs(float partialTicks) { if (pre(CROSSHAIRS)) return; - if (this.showCrosshair()) - { - bind(Gui.icons); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR, 1, 0); - GlStateManager.enableAlpha(); - drawTexturedModalRect(width / 2 - 7, height / 2 - 7, 0, 0, 16, 16); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - GlStateManager.disableBlend(); - } + bind(Gui.icons); + super.func_184045_a(partialTicks, res); post(CROSSHAIRS); } - @Override + protected void renderPotionIcons(ScaledResolution resolution) + { + if (pre(POTION_ICONS)) return; + super.func_184048_a(resolution); + post(POTION_ICONS); + } + + protected void renderSubtitles(ScaledResolution resolution) + { + if (pre(SUBTITLES)) return; + this.field_184049_t.func_184068_a(res); + post(SUBTITLES); + } + + //@Override protected void renderBossHealth() { if (pre(BOSSHEALTH)) return; bind(Gui.icons); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); mc.mcProfiler.startSection("bossHealth"); GlStateManager.enableBlend(); - super.renderBossHealth(); + this.field_184050_w.func_184051_a(); GlStateManager.disableBlend(); mc.mcProfiler.endSection(); post(BOSSHEALTH); @@ -361,7 +372,7 @@ public class GuiIngameForge extends GuiIngame IAttributeInstance attrMaxHealth = player.getEntityAttribute(SharedMonsterAttributes.maxHealth); float healthMax = (float)attrMaxHealth.getAttributeValue(); - float absorb = player.getAbsorptionAmount(); + float absorb = MathHelper.ceiling_float_int(player.getAbsorptionAmount()); int healthRows = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F / 10.0F); int rowHeight = Math.max(10 - (healthRows - 2), 3); @@ -374,7 +385,7 @@ public class GuiIngameForge extends GuiIngame if (rowHeight != 10) left_height += 10 - rowHeight; int regen = -1; - if (player.isPotionActive(Potion.regeneration)) + if (player.isPotionActive(MobEffects.regeneration)) { regen = updateCounter % 25; } @@ -382,8 +393,8 @@ public class GuiIngameForge extends GuiIngame final int TOP = 9 * (mc.theWorld.getWorldInfo().isHardcoreModeEnabled() ? 5 : 0); final int BACKGROUND = (highlight ? 25 : 16); int MARGIN = 16; - if (player.isPotionActive(Potion.poison)) MARGIN += 36; - else if (player.isPotionActive(Potion.wither)) MARGIN += 72; + if (player.isPotionActive(MobEffects.poison)) MARGIN += 36; + else if (player.isPotionActive(MobEffects.wither)) MARGIN += 72; float absorbRemaining = absorb; for (int i = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F) - 1; i >= 0; --i) @@ -409,10 +420,15 @@ public class GuiIngameForge extends GuiIngame if (absorbRemaining > 0.0F) { if (absorbRemaining == absorb && absorb % 2.0F == 1.0F) + { drawTexturedModalRect(x, y, MARGIN + 153, TOP, 9, 9); //17 + absorbRemaining -= 1.0F; + } else + { drawTexturedModalRect(x, y, MARGIN + 144, TOP, 9, 9); //16 - absorbRemaining -= 2.0F; + absorbRemaining -= 2.0F; + } } else { @@ -452,7 +468,7 @@ public class GuiIngameForge extends GuiIngame int icon = 16; byte backgound = 0; - if (mc.thePlayer.isPotionActive(Potion.hunger)) + if (mc.thePlayer.isPotionActive(MobEffects.hunger)) { icon += 36; backgound = 13; @@ -610,7 +626,7 @@ public class GuiIngameForge extends GuiIngame GlStateManager.pushMatrix(); GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); FontRenderer font = highlightingItemStack.getItem().getFontRenderer(highlightingItemStack); if (font != null) { @@ -704,7 +720,7 @@ public class GuiIngameForge extends GuiIngame GlStateManager.pushMatrix(); GlStateManager.translate((float)(width / 2), (float)(height - 68), 0.0F); GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); int color = (recordIsPlaying ? Color.HSBtoRGB(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE); fontrenderer.drawString(recordPlaying, -fontrenderer.getStringWidth(recordPlaying) / 2, -4, color | (opacity << 24)); GlStateManager.disableBlend(); @@ -737,7 +753,7 @@ public class GuiIngameForge extends GuiIngame GlStateManager.pushMatrix(); GlStateManager.translate((float)(width / 2), (float)(height / 2), 0.0F); GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.pushMatrix(); GlStateManager.scale(4.0F, 4.0F, 4.0F); int l = opacity << 24 & -16777216; @@ -793,7 +809,7 @@ public class GuiIngameForge extends GuiIngame protected void renderHealthMount(int width, int height) { EntityPlayer player = (EntityPlayer)mc.getRenderViewEntity(); - Entity tmp = player.ridingEntity; + Entity tmp = player.func_184187_bx(); if (!(tmp instanceof EntityLivingBase)) return; bind(icons); diff --git a/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java b/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java index b962071ebd..0108901947 100644 --- a/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java +++ b/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java @@ -3,7 +3,6 @@ package net.minecraftforge.client.event; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.util.math.RayTraceResult; import net.minecraft.client.renderer.RenderGlobal; @@ -16,7 +15,7 @@ public class DrawBlockHighlightEvent extends Event public final int subID; public final float partialTicks; - public DrawBlockHighlightEvent(RenderGlobal context, EntityPlayer player, RayTraceResult target, int subID, ItemStack currentItem, float partialTicks) + public DrawBlockHighlightEvent(RenderGlobal context, EntityPlayer player, RayTraceResult target, int subID, float partialTicks) { this.context = context; this.player = player; diff --git a/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java b/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java index 0a7671a29e..f70b0f577d 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java @@ -28,7 +28,9 @@ public class RenderGameOverlayEvent extends Event JUMPBAR, CHAT, PLAYER_LIST, - DEBUG + DEBUG, + POTION_ICONS, + SUBTITLES } public final float partialTicks; diff --git a/src/main/java/net/minecraftforge/client/event/sound/PlayBackgroundMusicEvent.java b/src/main/java/net/minecraftforge/client/event/sound/PlayBackgroundMusicEvent.java deleted file mode 100644 index 77a2ad8dd0..0000000000 --- a/src/main/java/net/minecraftforge/client/event/sound/PlayBackgroundMusicEvent.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.minecraftforge.client.event.sound; - -import net.minecraft.client.audio.SoundManager; -import net.minecraft.client.audio.SoundPoolEntry; - -/** - * Raised when the SoundManager tries to play a Background Music file, - * If you return null from this function it will prevent the sound from being played, - * you can return a different entry if you want to change the sound being played. - */ -@Deprecated // Remove in 1.8 -public class PlayBackgroundMusicEvent extends SoundResultEvent -{ - public PlayBackgroundMusicEvent(SoundManager manager, SoundPoolEntry entry) - { super(manager, entry, null, 0.0f, 0.0f); } -} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEffectEvent.java b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEffectEvent.java deleted file mode 100644 index 7c7268fcc2..0000000000 --- a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEffectEvent.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.minecraftforge.client.event.sound; - -import net.minecraft.client.audio.SoundManager; -import net.minecraft.client.audio.SoundPoolEntry; - -@Deprecated //Remove in 1.8 -public class PlaySoundEffectEvent extends SoundResultEvent -{ - public PlaySoundEffectEvent(SoundManager manager, SoundPoolEntry source, String name, float volume, float pitch) - { super(manager, source, name, volume, pitch); } -} diff --git a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEffectSourceEvent.java b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEffectSourceEvent.java deleted file mode 100644 index 82b2600862..0000000000 --- a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEffectSourceEvent.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.minecraftforge.client.event.sound; - -import net.minecraft.client.audio.SoundManager; - -@Deprecated //Remove in 1.8 -public class PlaySoundEffectSourceEvent extends SoundEvent -{ - public final SoundManager manager; - public final String name; - public PlaySoundEffectSourceEvent(SoundManager manager, String name) - { - super(manager); - this.manager = manager; - this.name = name; - } -} diff --git a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java index d3ae0382fb..b7fa7d7c4c 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java @@ -1,7 +1,6 @@ package net.minecraftforge.client.event.sound; import net.minecraft.client.audio.ISound; -import net.minecraft.client.audio.SoundCategory; import net.minecraft.client.audio.SoundManager; /*** @@ -14,14 +13,12 @@ public class PlaySoundEvent extends SoundEvent { public final String name; public final ISound sound; - public final SoundCategory category; public ISound result; - public PlaySoundEvent(SoundManager manager, ISound sound, SoundCategory category) + public PlaySoundEvent(SoundManager manager, ISound sound) { super(manager); this.sound = sound; - this.category = category; this.name = sound.getSoundLocation().getResourcePath(); this.result = sound; } diff --git a/src/main/java/net/minecraftforge/client/event/sound/PlayStreamingEvent.java b/src/main/java/net/minecraftforge/client/event/sound/PlayStreamingEvent.java deleted file mode 100644 index 9dda41e81e..0000000000 --- a/src/main/java/net/minecraftforge/client/event/sound/PlayStreamingEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.minecraftforge.client.event.sound; - -import net.minecraft.client.audio.SoundManager; -import net.minecraft.client.audio.SoundPoolEntry; - -/** - * Raised when the SoundManager tries to play a 'Streaming' file, - * in vanilla it is only the Jukebox that uses this function. - * - * If you return null from this function it will prevent the sound from being played, - * you can return a different entry if you want to change the sound being played. - * - */ -@Deprecated -public class PlayStreamingEvent extends SoundResultEvent -{ - public final float x; - public final float y; - public final float z; - public PlayStreamingEvent(SoundManager manager, SoundPoolEntry source, String name, float x, float y, float z) - { - super(manager, source, name, 0.0f, 0.0f); - this.x = x; - this.y = y; - this.z = z; - } -} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java b/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java index c13d55b4b4..dbfecd03a7 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java @@ -3,8 +3,6 @@ package net.minecraftforge.client.event.sound; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.client.audio.ISound; import net.minecraft.client.audio.SoundManager; -import net.minecraft.client.audio.SoundPoolEntry; -import net.minecraftforge.common.MinecraftForge; public class SoundEvent extends Event { @@ -14,13 +12,6 @@ public class SoundEvent extends Event this.manager = manager; } - @Deprecated - public static SoundPoolEntry getResult(SoundResultEvent event) - { - MinecraftForge.EVENT_BUS.post(event); - return event.result; - } - public static class SoundSourceEvent extends SoundEvent { public final ISound sound; @@ -35,4 +26,4 @@ public class SoundEvent extends Event this.uuid = uuid; } } -} \ No newline at end of file +} diff --git a/src/main/java/net/minecraftforge/client/event/sound/SoundLoadEvent.java b/src/main/java/net/minecraftforge/client/event/sound/SoundLoadEvent.java index eaff83becb..bcede8ad9f 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/SoundLoadEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/SoundLoadEvent.java @@ -3,16 +3,13 @@ package net.minecraftforge.client.event.sound; import net.minecraft.client.audio.SoundManager; /** - * Raised by the SoundManager.loadSoundSettings, this would be a good place for + * Raised by the SoundManager.loadSoundSettings, this would be a good place for * adding your custom sounds to the SoundPool. */ public class SoundLoadEvent extends SoundEvent { - @Deprecated - public final SoundManager manager; public SoundLoadEvent(SoundManager manager) { super(manager); - this.manager = manager; } } diff --git a/src/main/java/net/minecraftforge/client/event/sound/SoundResultEvent.java b/src/main/java/net/minecraftforge/client/event/sound/SoundResultEvent.java deleted file mode 100644 index c3d431b640..0000000000 --- a/src/main/java/net/minecraftforge/client/event/sound/SoundResultEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.minecraftforge.client.event.sound; - -import net.minecraft.client.audio.SoundManager; -import net.minecraft.client.audio.SoundPoolEntry; - -@Deprecated //Remove in 1.8 -public abstract class SoundResultEvent extends SoundEvent -{ - public final SoundManager manager; - public final SoundPoolEntry source; - public final String name; - public final float volume; - public final float pitch; - public SoundPoolEntry result; - - public SoundResultEvent(SoundManager manager, SoundPoolEntry source, String name, float volume, float pitch) - { - super(manager); - this.manager = manager; - this.source = source; - this.name = name; - this.volume = volume; - this.pitch = pitch; - this.result = source; - } -} diff --git a/src/main/java/net/minecraftforge/client/event/sound/SoundSetupEvent.java b/src/main/java/net/minecraftforge/client/event/sound/SoundSetupEvent.java index 2c6b454125..ef5cb37ed5 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/SoundSetupEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/SoundSetupEvent.java @@ -3,16 +3,13 @@ package net.minecraftforge.client.event.sound; import net.minecraft.client.audio.SoundManager; /** - * This event is raised by the SoundManager when it does its first setup of the + * This event is raised by the SoundManager when it does its first setup of the * SoundSystemConfig's codecs, use this function to add your own codecs. */ public class SoundSetupEvent extends SoundEvent { - @Deprecated - public final SoundManager manager; public SoundSetupEvent(SoundManager manager) { super(manager); - this.manager = manager; } } diff --git a/src/main/java/net/minecraftforge/common/DimensionManager.java b/src/main/java/net/minecraftforge/common/DimensionManager.java index 096457fc31..246ce6c9a6 100644 --- a/src/main/java/net/minecraftforge/common/DimensionManager.java +++ b/src/main/java/net/minecraftforge/common/DimensionManager.java @@ -186,19 +186,19 @@ public class DimensionManager return worlds.keySet().toArray(new Integer[worlds.size()]); //Only loaded dims, since usually used to cycle through loaded worlds } - public static void setWorld(int id, WorldServer world) + public static void setWorld(int id, WorldServer world, MinecraftServer server) { if (world != null) { worlds.put(id, world); weakWorldMap.put(world, world); - MinecraftServer.getServer().worldTickTimes.put(id, new long[100]); + server.worldTickTimes.put(id, new long[100]); FMLLog.info("Loading dimension %d (%s) (%s)", id, world.getWorldInfo().getWorldName(), world.getMinecraftServer()); } else { worlds.remove(id); - MinecraftServer.getServer().worldTickTimes.remove(id); + server.worldTickTimes.remove(id); FMLLog.info("Unloading dimension %d", id); } @@ -220,7 +220,7 @@ public class DimensionManager tmp.add(entry.getValue()); } - MinecraftServer.getServer().worldServers = tmp.toArray(new WorldServer[tmp.size()]); + server.worldServers = tmp.toArray(new WorldServer[tmp.size()]); } public static void initDimension(int dim) @@ -334,7 +334,7 @@ public class DimensionManager { MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(w)); w.flush(); - setWorld(id, null); + setWorld(id, null, w.getMinecraftServer()); } } } @@ -414,16 +414,16 @@ public class DimensionManager if (DimensionManager.getWorld(0) != null) { return ((SaveHandler)DimensionManager.getWorld(0).getSaveHandler()).getWorldDirectory(); - } + }/* else if (MinecraftServer.getServer() != null) { MinecraftServer srv = MinecraftServer.getServer(); SaveHandler saveHandler = (SaveHandler) srv.getActiveAnvilConverter().getSaveLoader(srv.getFolderName(), false); return saveHandler.getWorldDirectory(); - } + }*/ else { return null; } } -} \ No newline at end of file +} diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index c2d747ab1c..052d76944d 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -20,6 +20,7 @@ import java.util.regex.Pattern; import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; +import net.minecraft.block.BlockTrapDoor; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -73,6 +74,7 @@ import net.minecraft.util.math.AxisAlignedBB; 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.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextFormatting; @@ -487,13 +489,13 @@ public class ForgeHooks return (MinecraftForge.EVENT_BUS.post(event) ? null : new float[]{event.distance, event.damageMultiplier}); } - public static boolean isLivingOnLadder(Block block, World world, BlockPos pos, EntityLivingBase entity) + public static boolean isLivingOnLadder(IBlockState state, World world, BlockPos pos, EntityLivingBase entity) { boolean isSpectator = (entity instanceof EntityPlayer && ((EntityPlayer)entity).isSpectator()); if (isSpectator) return false; if (!ForgeModContainer.fullBoundingBoxLadders) { - return block != null && block.isLadder(world, pos, entity); + return state != null && state.getBlock().isLadder(state, world, pos, entity); } else { @@ -508,7 +510,8 @@ public class ForgeHooks for (int z2 = mZ; z2 < bb.maxZ; z2++) { BlockPos tmp = new BlockPos(x2, y2, z2); - if (world.getBlockState(tmp).getBlock().isLadder(world, tmp, entity)) + state = world.getBlockState(tmp); + if (state.getBlock().isLadder(state, world, tmp, entity)) { return true; } @@ -542,7 +545,7 @@ public class ForgeHooks return null; } - player.joinEntityItemWithWorld(event.entityItem); + player.getEntityWorld().spawnEntityInWorld(event.entityItem); return event.entityItem; } @@ -870,11 +873,6 @@ public class ForgeHooks return null; } - public static WorldGeneratorBonusChest getBonusChest(Random rand) - { - return new WorldGeneratorBonusChest(ChestGenHooks.getItems(ChestGenHooks.BONUS_CHEST, rand), ChestGenHooks.getCount(ChestGenHooks.BONUS_CHEST, rand)); - } - public static boolean isInsideOfMaterial(Material material, Entity entity, BlockPos pos) { IBlockState state = entity.worldObj.getBlockState(pos); @@ -926,16 +924,16 @@ public class ForgeHooks return !event.isCanceled(); } - public static MovingObjectPosition rayTraceEyes(EntityLivingBase entity, double length) + public static RayTraceResult rayTraceEyes(EntityLivingBase entity, double length) { - Vec3 startPos = new Vec3(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ); - Vec3 endPos = startPos.add(new Vec3(entity.getLookVec().xCoord * length, entity.getLookVec().yCoord * length, entity.getLookVec().zCoord * length)); + Vec3d startPos = new Vec3d(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ); + Vec3d endPos = startPos.add(new Vec3d(entity.getLookVec().xCoord * length, entity.getLookVec().yCoord * length, entity.getLookVec().zCoord * length)); return entity.worldObj.rayTraceBlocks(startPos, endPos); } - public static Vec3 rayTraceEyeHitVec(EntityLivingBase entity, double length) + public static Vec3d rayTraceEyeHitVec(EntityLivingBase entity, double length) { - MovingObjectPosition movingObjectPosition = rayTraceEyes(entity, length); - return movingObjectPosition == null ? null : movingObjectPosition.hitVec; + RayTraceResult git = rayTraceEyes(entity, length); + return git == null ? null : git.hitVec; } } diff --git a/src/main/java/net/minecraftforge/common/brewing/BrewingRecipeRegistry.java b/src/main/java/net/minecraftforge/common/brewing/BrewingRecipeRegistry.java index 07ea61ce77..af55434bc0 100644 --- a/src/main/java/net/minecraftforge/common/brewing/BrewingRecipeRegistry.java +++ b/src/main/java/net/minecraftforge/common/brewing/BrewingRecipeRegistry.java @@ -17,7 +17,7 @@ public class BrewingRecipeRegistry { /** * Adds a recipe to the registry. Due to the nature of the brewing stand * inputs that stack (a.k.a max stack size > 1) are not allowed. - * + * * @param input * The ItemStack that goes in same slots as the water bottles * would. @@ -36,7 +36,7 @@ public class BrewingRecipeRegistry { /** * Adds a recipe to the registry. Due to the nature of the brewing stand * inputs that stack (a.k.a max stack size > 1) are not allowed. - * + * * @param input * The ItemStack that goes in same slots as the water bottles * would. @@ -168,4 +168,4 @@ public class BrewingRecipeRegistry { { return Collections.unmodifiableList(recipes); } -} \ No newline at end of file +} From 4b4146bbedf5bf16886f921d629673b6ab94e345 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 8 Mar 2016 22:43:05 +0300 Subject: [PATCH 053/243] World --- .../net/minecraft/block/Block.java.patch | 5 +- .../client/entity/EntityPlayerSP.java.patch | 8 +- .../net/minecraft/entity/Entity.java.patch | 2 +- .../net/minecraft/world/World.java.patch | 412 +++++++++++++++--- .../minecraft/world/WorldProvider.java.patch | 4 +- .../minecraft/world/chunk/Chunk.java.patch | 9 +- .../net/minecraft/world/World.java.patch.rej | 310 ------------- .../event/ForgeEventFactory.java | 5 +- .../event/entity/PlaySoundAtEntityEvent.java | 9 +- 9 files changed, 369 insertions(+), 395 deletions(-) diff --git a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch index a5c568e361..4798efd86d 100644 --- a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch @@ -196,7 +196,7 @@ public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) { return new ItemStack(Item.getItemFromBlock(this), 1, this.damageDropped(p_185473_3_)); -@@ -844,6 +865,1167 @@ +@@ -844,6 +865,1166 @@ return "Block{" + blockRegistry.getNameForObject(this) + "}"; } @@ -1248,7 +1248,6 @@ + * Called when the entity is inside this block, may be used to determined if the entity can breathing, + * display material overlays, or if the entity can swim inside a block. + * -+ * @param state The current block state + * @param world that is being tested. + * @param blockpos position thats being tested. + * @param iblockstate state at world/blockpos @@ -1258,7 +1257,7 @@ + * @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment. + * @return null for default behavior, true if the entity is within the material, false if it was not. + */ -+ public Boolean isEntityInsideMaterial(IBlockState state, IBlockAccess world, BlockPos blockpos, IBlockState iblockstate, Entity entity, double yToTest, Material materialIn, boolean testingHead) ++ public Boolean isEntityInsideMaterial(IBlockAccess world, BlockPos blockpos, IBlockState iblockstate, Entity entity, double yToTest, Material materialIn, boolean testingHead) + { + return null; + } diff --git a/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch index 15cec7e267..1619065735 100644 --- a/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -56,16 +56,18 @@ { d2 = 1.0D - d1; i = 5; -@@ -515,6 +528,12 @@ +@@ -515,7 +528,13 @@ public void func_184185_a(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_) { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_184185_1_, p_184185_2_, p_184185_3_); +- this.worldObj.func_184134_a(this.posX, this.posY, this.posZ, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false); ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_); + if (event.isCanceled() || event.getSound() == null) return; + p_184185_1_ = event.getSound(); + p_184185_2_ = event.getVolume(); + p_184185_3_ = event.getPitch(); + - this.worldObj.func_184134_a(this.posX, this.posY, this.posZ, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false); ++ this.worldObj.func_184134_a(this.posX, this.posY, this.posZ, p_184185_1_, event.getCategory(), p_184185_2_, p_184185_3_, false); } + public boolean isServerWorld() diff --git a/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch b/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch index 7518d29e80..652a2ff6e8 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch @@ -30,7 +30,7 @@ BlockPos blockpos = new BlockPos(this.posX, d0, this.posZ); IBlockState iblockstate = this.worldObj.getBlockState(blockpos); -+ Boolean result = iblockstate.getBlock().isEntityInsideMaterial(iblockstate, this.worldObj, blockpos, iblockstate, this, d0, materialIn, true); ++ Boolean result = iblockstate.getBlock().isEntityInsideMaterial(this.worldObj, blockpos, iblockstate, this, d0, materialIn, true); + if (result != null) return result; + if (iblockstate.func_185904_a() == materialIn) diff --git a/patches.mcp/minecraft/net/minecraft/world/World.java.patch b/patches.mcp/minecraft/net/minecraft/world/World.java.patch index 98bb2042f6..1d0df9c775 100644 --- a/patches.mcp/minecraft/net/minecraft/world/World.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/World.java.patch @@ -45,7 +45,90 @@ if (this.isBlockLoaded(pos)) { Chunk chunk = this.getChunkFromBlockCoords(pos); -@@ -409,6 +426,9 @@ +@@ -194,7 +211,7 @@ + + public boolean isAirBlock(BlockPos pos) + { +- return this.getBlockState(pos).func_185904_a() == Material.air; ++ return this.getBlockState(pos).getBlock().isAir(this.getBlockState(pos), this, pos); + } + + public boolean isBlockLoaded(BlockPos pos) +@@ -291,23 +308,49 @@ + { + Chunk chunk = this.getChunkFromBlockCoords(pos); + Block block = newState.getBlock(); ++ ++ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; ++ if (this.captureBlockSnapshots && !this.isRemote) ++ { ++ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, pos, flags); ++ this.capturedBlockSnapshots.add(blockSnapshot); ++ } ++ IBlockState oldState = getBlockState(pos); ++ int oldLight = oldState.getLightValue(this, pos); ++ int oldOpacity = oldState.getLightOpacity(this, pos); ++ + IBlockState iblockstate = chunk.setBlockState(pos, newState); + + if (iblockstate == null) + { ++ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); + return false; + } + else + { +- if (newState.func_185891_c() != iblockstate.func_185891_c() || newState.func_185906_d() != iblockstate.func_185906_d()) ++ if (newState.getLightOpacity(this, pos) != oldOpacity || newState.getLightValue(this, pos) != oldLight) + { + this.theProfiler.startSection("checkLight"); + this.checkLight(pos); + this.theProfiler.endSection(); + } + +- if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && chunk.isPopulated()) ++ if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates + { ++ this.markAndNotifyBlock(pos, chunk, iblockstate, newState, flags); ++ } ++ return true; ++ } ++ } ++ } ++ ++ // Split off from original setBlockState(BlockPos, IBlockState, int) method in order to directly send client and physic updates ++ public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState iblockstate, IBlockState newState, int flags) ++ { ++ { ++ { ++ if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && (chunk == null || chunk.isPopulated())) ++ { + this.func_184138_a(pos, iblockstate, newState, flags); + } + +@@ -317,11 +360,9 @@ + + if (newState.func_185912_n()) + { +- this.updateComparatorOutputLevel(pos, block); ++ this.updateComparatorOutputLevel(pos, newState.getBlock()); + } + } +- +- return true; + } + } + } +@@ -336,7 +377,7 @@ + IBlockState iblockstate = this.getBlockState(pos); + Block block = iblockstate.getBlock(); + +- if (iblockstate.func_185904_a() == Material.air) ++ if (block.isAir(iblockstate, this, pos)) + { + return false; + } +@@ -409,6 +450,9 @@ public void notifyNeighborsOfStateChange(BlockPos pos, Block blockType) { @@ -55,7 +138,7 @@ this.notifyBlockOfStateChange(pos.west(), blockType); this.notifyBlockOfStateChange(pos.east(), blockType); this.notifyBlockOfStateChange(pos.down(), blockType); -@@ -419,6 +439,11 @@ +@@ -419,6 +463,11 @@ public void notifyNeighborsOfStateExcept(BlockPos pos, Block blockType, EnumFacing skipSide) { @@ -67,7 +150,16 @@ if (skipSide != EnumFacing.WEST) { this.notifyBlockOfStateChange(pos.west(), blockType); -@@ -782,7 +807,7 @@ +@@ -514,7 +563,7 @@ + { + IBlockState iblockstate = this.getBlockState(blockpos); + +- if (iblockstate.func_185891_c() > 0 && !iblockstate.func_185904_a().isLiquid()) ++ if (iblockstate.getBlock().getLightOpacity(iblockstate, this, blockpos) > 0 && !iblockstate.func_185904_a().isLiquid()) + { + return false; + } +@@ -782,7 +831,7 @@ public boolean isDaytime() { @@ -76,33 +168,21 @@ } public RayTraceResult rayTraceBlocks(Vec3d p_72933_1_, Vec3d p_72933_2_) -@@ -994,6 +1019,12 @@ +@@ -982,6 +1031,13 @@ - public void func_184149_a(BlockPos p_184149_1_, SoundEvent p_184149_2_) + public void func_184148_a(EntityPlayer p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(entityIn, name, volume, pitch); -+ if (event.isCanceled() || event.name == null) return; -+ name = event.name; -+ volume = event.newVolume; -+ pitch = event.newPitch; ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_10_, p_184148_11_); ++ if (event.isCanceled() || event.getSound() == null) return; ++ p_184148_8_ = event.getSound(); ++ p_184148_9_ = event.getCategory(); ++ p_184148_10_ = event.getVolume(); ++ p_184148_11_ = event.getPitch(); + for (int i = 0; i < this.worldAccesses.size(); ++i) { - ((IWorldEventListener)this.worldAccesses.get(i)).func_184377_a(p_184149_2_, p_184149_1_); -@@ -1013,6 +1044,12 @@ - - private void spawnParticle(int particleID, boolean p_175720_2_, double xCood, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int... p_175720_15_) - { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(player, name, volume, pitch); -+ if (event.isCanceled() || event.name == null) return; -+ name = event.name; -+ volume = event.newVolume; -+ pitch = event.newPitch; -+ - for (int i = 0; i < this.worldAccesses.size(); ++i) - { - ((IWorldEventListener)this.worldAccesses.get(i)).spawnParticle(particleID, p_175720_2_, xCood, yCoord, zCoord, xOffset, yOffset, zOffset, p_175720_15_); -@@ -1027,6 +1064,9 @@ + ((IWorldEventListener)this.worldAccesses.get(i)).func_184375_a(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_, p_184148_11_); +@@ -1027,6 +1083,9 @@ public boolean spawnEntityInWorld(Entity entityIn) { @@ -112,7 +192,7 @@ int i = MathHelper.floor_double(entityIn.posX / 16.0D); int j = MathHelper.floor_double(entityIn.posZ / 16.0D); boolean flag = entityIn.forceSpawn; -@@ -1049,6 +1089,8 @@ +@@ -1049,6 +1108,8 @@ this.updateAllPlayersSleepingFlag(); } @@ -121,7 +201,43 @@ this.getChunkFromChunkCoords(i, j).addEntity(entityIn); this.loadedEntityList.add(entityIn); this.onEntityAdded(entityIn); -@@ -1361,6 +1403,12 @@ +@@ -1285,7 +1346,6 @@ + return list; + } + +- @SideOnly(Side.CLIENT) + public void removeWorldAccess(IWorldEventListener worldAccess) + { + this.worldAccesses.remove(worldAccess); +@@ -1348,19 +1408,38 @@ + + public int calculateSkylightSubtracted(float p_72967_1_) + { ++ float f = provider.getSunBrightnessFactor(p_72967_1_); ++ f = 1 - f; ++ return (int)(f * 11); ++ } ++ ++ /** ++ * The current sun brightness factor for this dimension. ++ * 0.0f means no light at all, and 1.0f means maximum sunlight. ++ * Highly recommended for sunlight detection like solar panel. ++ * ++ * @return The current brightness factor ++ * */ ++ public float getSunBrightnessFactor(float p_72967_1_) ++ { + float f = this.getCelestialAngle(p_72967_1_); + float f1 = 1.0F - (MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F); + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); + f1 = 1.0F - f1; + f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength(p_72967_1_) * 5.0F) / 16.0D)); + f1 = (float)((double)f1 * (1.0D - (double)(this.getThunderStrength(p_72967_1_) * 5.0F) / 16.0D)); +- f1 = 1.0F - f1; +- return (int)(f1 * 11.0F); ++ return f1; + } + @SideOnly(Side.CLIENT) public float getSunBrightness(float p_72971_1_) { @@ -134,7 +250,7 @@ float f = this.getCelestialAngle(p_72971_1_); float f1 = 1.0F - (MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.2F); f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1373,6 +1421,12 @@ +@@ -1373,6 +1452,12 @@ @SideOnly(Side.CLIENT) public Vec3d getSkyColor(Entity entityIn, float partialTicks) { @@ -142,12 +258,12 @@ + } + + @SideOnly(Side.CLIENT) -+ public Vec3 getSkyColorBody(Entity entityIn, float partialTicks) ++ public Vec3d getSkyColorBody(Entity entityIn, float partialTicks) + { float f = this.getCelestialAngle(partialTicks); float f1 = MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F; f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1380,9 +1434,7 @@ +@@ -1380,9 +1465,7 @@ int j = MathHelper.floor_double(entityIn.posY); int k = MathHelper.floor_double(entityIn.posZ); BlockPos blockpos = new BlockPos(i, j, k); @@ -158,7 +274,7 @@ float f3 = (float)(l >> 16 & 255) / 255.0F; float f4 = (float)(l >> 8 & 255) / 255.0F; float f5 = (float)(l & 255) / 255.0F; -@@ -1442,11 +1494,22 @@ +@@ -1442,6 +1525,11 @@ public float getCurrentMoonPhaseFactor() { @@ -170,20 +286,34 @@ return WorldProvider.moonPhaseFactors[this.provider.getMoonPhase(this.worldInfo.getWorldTime())]; } - public float getCelestialAngleRadians(float partialTicks) +@@ -1454,6 +1542,12 @@ + @SideOnly(Side.CLIENT) + public Vec3d getCloudColour(float partialTicks) { -+ return this.provider.drawClouds(partialTicks); ++ return this.provider.getCloudColor(partialTicks); + } + + @SideOnly(Side.CLIENT) -+ public Vec3 drawCloudsBody(float partialTicks) ++ public Vec3d getCloudColorBody(float partialTicks) + { float f = this.getCelestialAngle(partialTicks); - return f * ((float)Math.PI * 2F); - } -@@ -1454,6 +1517,12 @@ + float f1 = MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F; + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); +@@ -1509,9 +1603,9 @@ + for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1) + { + blockpos1 = blockpos.down(); +- Material material = chunk.getBlockState(blockpos1).func_185904_a(); ++ IBlockState state = chunk.getBlockState(blockpos1); + +- if (material.blocksMovement() && material != Material.leaves) ++ if (state.func_185904_a().blocksMovement() && !state.getBlock().isLeaves(state, this, blockpos1) && !state.getBlock().isFoliage(this, blockpos1)) + { + break; + } +@@ -1523,6 +1617,12 @@ @SideOnly(Side.CLIENT) - public Vec3d getCloudColour(float partialTicks) + public float getStarBrightness(float partialTicks) { + return this.provider.getStarBrightness(partialTicks); + } @@ -192,26 +322,49 @@ + public float getStarBrightnessBody(float partialTicks) + { float f = this.getCelestialAngle(partialTicks); - float f1 = MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F; + float f1 = 1.0F - (MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.25F); f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1574,7 +1643,15 @@ +@@ -1574,6 +1674,12 @@ entity.addEntityCrashInfo(crashreportcategory); } -- throw new ReportedException(crashreport); + if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) + { + net.minecraftforge.fml.common.FMLLog.severe(crashreport.getCompleteReport()); + removeEntity(entity); + } + else -+ { -+ throw new ReportedException(crashreport); -+ } + throw new ReportedException(crashreport); } - if (entity.isDead) -@@ -1701,15 +1778,20 @@ +@@ -1635,6 +1741,12 @@ + CrashReport crashreport1 = CrashReport.makeCrashReport(throwable1, "Ticking entity"); + CrashReportCategory crashreportcategory1 = crashreport1.makeCategory("Entity being ticked"); + entity2.addEntityCrashInfo(crashreportcategory1); ++ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe(crashreport1.getCompleteReport()); ++ removeEntity(entity2); ++ } ++ else + throw new ReportedException(crashreport1); + } + } +@@ -1684,6 +1796,13 @@ + CrashReport crashreport2 = CrashReport.makeCrashReport(throwable, "Ticking block entity"); + CrashReportCategory crashreportcategory2 = crashreport2.makeCategory("Block entity being ticked"); + tileentity.addInfoToCrashReport(crashreportcategory2); ++ if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe(crashreport2.getCompleteReport()); ++ tileentity.invalidate(); ++ this.removeTileEntity(tileentity.getPos()); ++ } ++ else + throw new ReportedException(crashreport2); + } + } +@@ -1701,15 +1820,20 @@ } } @@ -234,7 +387,7 @@ this.theProfiler.endStartSection("pendingBlockEntities"); if (!this.addedTileEntityList.isEmpty()) -@@ -1748,7 +1830,8 @@ +@@ -1748,7 +1872,8 @@ public boolean addTileEntity(TileEntity tile) { @@ -244,7 +397,7 @@ if (flag && tile instanceof ITickable) { -@@ -1782,9 +1865,13 @@ +@@ -1782,9 +1907,13 @@ { int i = MathHelper.floor_double(entityIn.posX); int j = MathHelper.floor_double(entityIn.posZ); @@ -260,7 +413,16 @@ { entityIn.lastTickPosX = entityIn.posX; entityIn.lastTickPosY = entityIn.posY; -@@ -1983,6 +2070,10 @@ +@@ -1913,7 +2042,7 @@ + { + IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos.func_185343_d(k1, l1, i2)); + +- if (iblockstate.func_185904_a() != Material.air) ++ if (iblockstate.getBlock().isAir(iblockstate, this, new BlockPos(k1, l1, i2))) + { + blockpos$pooledmutableblockpos.func_185344_t(); + return true; +@@ -1983,6 +2112,10 @@ blockpos$pooledmutableblockpos.func_185344_t(); return true; } @@ -271,16 +433,16 @@ } } } -@@ -2022,6 +2113,16 @@ +@@ -2022,6 +2155,16 @@ IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos); Block block = iblockstate.getBlock(); -+ Boolean result = block.isEntityInsideMaterial(this, blockpos$mutableblockpos, iblockstate, entityIn, (double)l, materialIn, false); ++ Boolean result = block.isEntityInsideMaterial(this, blockpos$pooledmutableblockpos, iblockstate, entityIn, (double)l, materialIn, false); + if (result != null && result == true) + { + // Forge: When requested call blocks modifyAcceleration method, and more importantly cause this method to return true, which results in an entity being "inWater" + flag = true; -+ vec3 = block.modifyAcceleration(this, blockpos$mutableblockpos, entityIn, vec3); ++ vec3d = block.modifyAcceleration(this, blockpos$pooledmutableblockpos, entityIn, vec3d); + continue; + } + else if (result != null && result == false) continue; @@ -288,7 +450,17 @@ if (iblockstate.func_185904_a() == materialIn) { double d0 = (double)((float)(l1 + 1) - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue())); -@@ -2130,6 +2231,7 @@ +@@ -2098,6 +2241,9 @@ + { + IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos.func_185343_d(k1, l1, i2)); + ++ Boolean result = iblockstate.getBlock().isAABBInsideMaterial(this, blockpos$pooledmutableblockpos, bb, materialIn); ++ if (result != null) return result; ++ + if (iblockstate.func_185904_a() == materialIn) + { + int j2 = ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue(); +@@ -2130,6 +2276,7 @@ public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) { Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking); @@ -296,7 +468,7 @@ explosion.doExplosionA(); explosion.doExplosionB(true); return explosion; -@@ -2276,19 +2378,27 @@ +@@ -2276,19 +2423,27 @@ else { this.addTileEntity(tileEntityIn); @@ -325,7 +497,7 @@ } else { -@@ -2301,6 +2411,7 @@ +@@ -2301,6 +2456,7 @@ this.getChunkFromBlockCoords(pos).removeTileEntity(pos); } @@ -333,7 +505,16 @@ } public void markTileEntityForRemoval(TileEntity tileEntityIn) -@@ -2350,6 +2461,7 @@ +@@ -2327,7 +2483,7 @@ + if (chunk != null && !chunk.isEmpty()) + { + IBlockState iblockstate = this.getBlockState(pos); +- return iblockstate.func_185904_a().isOpaque() && iblockstate.func_185917_h(); ++ return iblockstate.getBlock().isNormalCube(iblockstate, this, pos); + } + else + { +@@ -2350,6 +2506,7 @@ { this.spawnHostileMobs = hostile; this.spawnPeacefulMobs = peaceful; @@ -341,7 +522,7 @@ } public void tick() -@@ -2359,6 +2471,11 @@ +@@ -2359,6 +2516,11 @@ protected void calculateInitialWeather() { @@ -353,7 +534,7 @@ if (this.worldInfo.isRaining()) { this.rainingStrength = 1.0F; -@@ -2372,6 +2489,11 @@ +@@ -2372,6 +2534,11 @@ protected void updateWeather() { @@ -365,7 +546,7 @@ if (!this.provider.getHasNoSky()) { if (!this.isRemote) -@@ -2491,6 +2613,11 @@ +@@ -2491,6 +2658,11 @@ public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj) { @@ -377,7 +558,7 @@ BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); float f = biomegenbase.getFloatTemperature(pos); -@@ -2532,6 +2659,11 @@ +@@ -2532,6 +2704,11 @@ public boolean canSnowAt(BlockPos pos, boolean checkLight) { @@ -389,7 +570,40 @@ BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); float f = biomegenbase.getFloatTemperature(pos); -@@ -2789,10 +2921,10 @@ +@@ -2549,7 +2726,7 @@ + { + IBlockState iblockstate = this.getBlockState(pos); + +- if (iblockstate.func_185904_a() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos)) ++ if (iblockstate.getBlock().isAir(iblockstate, this, pos) && Blocks.snow_layer.canPlaceBlockAt(this, pos)) + { + return true; + } +@@ -2581,10 +2758,11 @@ + else + { + IBlockState iblockstate = this.getBlockState(pos); +- int i = lightType == EnumSkyBlock.SKY ? 0 : iblockstate.func_185906_d(); +- int j = iblockstate.func_185891_c(); ++ int blockLight = iblockstate.getBlock().getLightValue(iblockstate, this, pos); ++ int i = lightType == EnumSkyBlock.SKY ? 0 : blockLight; ++ int j = iblockstate.getBlock().getLightOpacity(iblockstate, this, pos); + +- if (j >= 15 && iblockstate.func_185906_d() > 0) ++ if (j >= 15 && blockLight > 0) + { + j = 1; + } +@@ -2683,7 +2861,7 @@ + int j4 = j2 + enumfacing.getFrontOffsetY(); + int k4 = k2 + enumfacing.getFrontOffsetZ(); + blockpos$pooledmutableblockpos.func_185343_d(i4, j4, k4); +- int l4 = Math.max(1, this.getBlockState(blockpos$pooledmutableblockpos).func_185891_c()); ++ int l4 = Math.max(1, this.getBlockState(blockpos$pooledmutableblockpos).getBlock().getLightOpacity(this.getBlockState(blockpos$pooledmutableblockpos), this, blockpos$pooledmutableblockpos)); + i3 = this.getLightFor(lightType, blockpos$pooledmutableblockpos); + + if (i3 == l2 - l4 && j < this.lightUpdateBlockList.length) +@@ -2789,10 +2967,10 @@ public List getEntitiesInAABBexcluding(Entity entityIn, AxisAlignedBB boundingBox, Predicate predicate) { List list = Lists.newArrayList(); @@ -404,7 +618,22 @@ for (int i1 = i; i1 <= j; ++i1) { -@@ -2926,11 +3058,13 @@ +@@ -2845,10 +3023,10 @@ + + public List getEntitiesWithinAABB(Class clazz, AxisAlignedBB aabb, Predicate filter) + { +- int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D); +- int j = MathHelper.ceiling_double_int((aabb.maxX + 2.0D) / 16.0D); +- int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D); +- int l = MathHelper.ceiling_double_int((aabb.maxZ + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((aabb.minX - MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.ceiling_double_int((aabb.maxX + MAX_ENTITY_RADIUS) / 16.0D); ++ int k = MathHelper.floor_double((aabb.minZ - MAX_ENTITY_RADIUS) / 16.0D); ++ int l = MathHelper.ceiling_double_int((aabb.maxZ + MAX_ENTITY_RADIUS) / 16.0D); + List list = Lists.newArrayList(); + + for (int i1 = i; i1 < j; ++i1) +@@ -2926,11 +3104,13 @@ public void loadEntities(Collection entityCollection) { @@ -421,7 +650,25 @@ } } -@@ -3215,7 +3349,7 @@ +@@ -2943,7 +3123,7 @@ + { + IBlockState iblockstate = this.getBlockState(pos); + AxisAlignedBB axisalignedbb = p_175716_3_ ? null : blockIn.getDefaultState().func_185890_d(this, pos); +- return axisalignedbb != Block.field_185506_k && !this.checkNoEntityCollision(axisalignedbb.func_186670_a(pos), entityIn) ? false : (iblockstate.func_185904_a() == Material.circuits && blockIn == Blocks.anvil ? true : iblockstate.func_185904_a().isReplaceable() && blockIn.canReplace(this, pos, side, itemStackIn)); ++ return axisalignedbb != Block.field_185506_k && !this.checkNoEntityCollision(axisalignedbb.func_186670_a(pos), entityIn) ? false : (iblockstate.func_185904_a() == Material.circuits && blockIn == Blocks.anvil ? true : iblockstate.getBlock().isReplaceable(this, pos) && blockIn.canReplace(this, pos, side, itemStackIn)); + } + + public int getSeaLevel() +@@ -3026,7 +3206,7 @@ + public int getRedstonePower(BlockPos pos, EnumFacing facing) + { + IBlockState iblockstate = this.getBlockState(pos); +- return iblockstate.func_185915_l() ? this.getStrongPower(pos) : iblockstate.func_185911_a(this, pos, facing); ++ return iblockstate.getBlock().shouldCheckWeakPower(iblockstate, this, pos, facing) ? this.getStrongPower(pos) : iblockstate.func_185911_a(this, pos, facing); + } + + public boolean isBlockPowered(BlockPos pos) +@@ -3215,7 +3395,7 @@ public long getSeed() { @@ -430,7 +677,7 @@ } public long getTotalWorldTime() -@@ -3225,17 +3359,17 @@ +@@ -3225,17 +3405,17 @@ public long getWorldTime() { @@ -451,7 +698,7 @@ if (!this.getWorldBorder().contains(blockpos)) { -@@ -3247,7 +3381,7 @@ +@@ -3247,7 +3427,7 @@ public void setSpawnPoint(BlockPos pos) { @@ -460,7 +707,7 @@ } @SideOnly(Side.CLIENT) -@@ -3267,12 +3401,18 @@ +@@ -3267,12 +3447,18 @@ if (!this.loadedEntityList.contains(entityIn)) { @@ -479,7 +726,7 @@ return true; } -@@ -3366,8 +3506,7 @@ +@@ -3366,8 +3552,7 @@ public boolean isBlockinHighHumidity(BlockPos pos) { @@ -489,7 +736,7 @@ } public MapStorage getMapStorage() -@@ -3426,12 +3565,12 @@ +@@ -3426,12 +3611,12 @@ public int getHeight() { @@ -504,7 +751,7 @@ } public Random setRandomSeed(int p_72843_1_, int p_72843_2_, int p_72843_3_) -@@ -3481,7 +3620,7 @@ +@@ -3481,7 +3666,7 @@ @SideOnly(Side.CLIENT) public double getHorizon() { @@ -513,7 +760,7 @@ } public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) -@@ -3515,7 +3654,7 @@ +@@ -3515,7 +3700,7 @@ public void updateComparatorOutputLevel(BlockPos pos, Block blockIn) { @@ -522,7 +769,30 @@ { BlockPos blockpos = pos.offset(enumfacing); -@@ -3600,6 +3739,83 @@ +@@ -3523,18 +3708,14 @@ + { + IBlockState iblockstate = this.getBlockState(blockpos); + +- if (Blocks.unpowered_comparator.func_185547_C(iblockstate)) ++ iblockstate.getBlock().onNeighborChange(this, blockpos, pos); ++ if (iblockstate.getBlock().isNormalCube(iblockstate, this, blockpos)) + { +- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); +- } +- else if (iblockstate.func_185915_l()) +- { + blockpos = blockpos.offset(enumfacing); + iblockstate = this.getBlockState(blockpos); +- +- if (Blocks.unpowered_comparator.func_185547_C(iblockstate)) ++ if (iblockstate.getBlock().getWeakChanges(this, blockpos)) + { +- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); ++ iblockstate.getBlock().onNeighborChange(this, blockpos, pos); + } + } + } +@@ -3600,6 +3781,83 @@ return i >= -k && i <= k && j >= -k && j <= k; } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch index 6172c74f1b..e30b710874 100644 --- a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -262,9 +262,9 @@ + } + + @SideOnly(Side.CLIENT) -+ public Vec3d drawClouds(float partialTicks) ++ public Vec3d getCloudColor(float partialTicks) + { -+ return worldObj.drawCloudsBody(partialTicks); ++ return worldObj.getCloudColorBody(partialTicks); + } + + /** diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch index cc85a3ee62..c44a0d49fc 100644 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -246,7 +246,14 @@ } public BiomeGenBase getBiome(BlockPos pos, BiomeProvider chunkManager) -@@ -1239,7 +1253,7 @@ +@@ -1233,13 +1247,13 @@ + BlockPos blockpos1 = blockpos.add(k, (j << 4) + i1, l); + boolean flag = i1 == 0 || i1 == 15 || k == 0 || k == 15 || l == 0 || l == 15; + +- if (this.storageArrays[j] == field_186036_a && flag || this.storageArrays[j] != field_186036_a && this.storageArrays[j].get(k, i1, l).func_185904_a() == Material.air) ++ if (this.storageArrays[j] == field_186036_a && flag || this.storageArrays[j] != field_186036_a && this.storageArrays[j].get(k, i1, l).getBlock().isAir(this.storageArrays[j].get(k, i1, l), this.worldObj, blockpos1)) + { + for (EnumFacing enumfacing : EnumFacing.values()) { BlockPos blockpos2 = blockpos1.offset(enumfacing); diff --git a/rejects/minecraft/net/minecraft/world/World.java.patch.rej b/rejects/minecraft/net/minecraft/world/World.java.patch.rej index 234b4571b0..bc80f2388c 100644 --- a/rejects/minecraft/net/minecraft/world/World.java.patch.rej +++ b/rejects/minecraft/net/minecraft/world/World.java.patch.rej @@ -1,211 +1,3 @@ -++++ REJECTED PATCH 5 - - public boolean isAirBlock(BlockPos pos) - { -- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; -+ return this.getBlockState(pos).getBlock().isAir(this, pos); - } - - public boolean isBlockLoaded(BlockPos pos) -++++ END PATCH -++++ REJECTED PATCH 6 - { - Chunk chunk = this.getChunkFromBlockCoords(pos); - Block block = newState.getBlock(); -+ -+ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; -+ if (this.captureBlockSnapshots && !this.isRemote) -+ { -+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, pos, flags); -+ this.capturedBlockSnapshots.add(blockSnapshot); -+ } -+ Block oldBlock = getBlockState(pos).getBlock(); -+ int oldLight = oldBlock.getLightValue(this, pos); -+ int oldOpacity = oldBlock.getLightOpacity(this, pos); -+ - IBlockState iblockstate = chunk.setBlockState(pos, newState); - - if (iblockstate == null) - { -+ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); - return false; - } - else - { - Block block1 = iblockstate.getBlock(); - -- if (block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue() != block1.getLightValue()) -+ if (block.getLightOpacity(this, pos) != oldOpacity || block.getLightValue(this, pos) != oldLight) - { - this.theProfiler.startSection("checkLight"); - this.checkLight(pos); - this.theProfiler.endSection(); - } - -- if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && chunk.isPopulated()) -+ if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates - { -- this.markBlockForUpdate(pos); -+ this.markAndNotifyBlock(pos, chunk, iblockstate, newState, flags); // Modularize client and physic updates - } - -+ return true; -+ } -+ } -+ } -+ -+ // Split off from original setBlockState(BlockPos, IBlockState Block p_147465_4_, int) method in order to directly send client and physic updates -+ public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState old, IBlockState new_, int flags) -+ { -+ if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && (chunk == null || chunk.isPopulated())) -+ { -+ this.markBlockForUpdate(pos); -+ } -+ { -+ { - if (!this.isRemote && (flags & 1) != 0) - { -- this.notifyNeighborsRespectDebug(pos, iblockstate.getBlock()); -+ this.notifyNeighborsRespectDebug(pos, new_.getBlock()); - -- if (block.hasComparatorInputOverride()) -+ if (new_.getBlock().hasComparatorInputOverride()) - { -- this.updateComparatorOutputLevel(pos, block); -+ this.updateComparatorOutputLevel(pos, new_.getBlock()); - } - } -- -- return true; - } - } - } -++++ END PATCH -++++ REJECTED PATCH 14 - - public int calculateSkylightSubtracted(float p_72967_1_) - { -+ float f = provider.getSunBrightnessFactor(p_72967_1_); -+ f = 1 - f; -+ return (int)(f * 11); -+ } -+ -+ /** -+ * The current sun brightness factor for this dimension. -+ * 0.0f means no light at all, and 1.0f means maximum sunlight. -+ * Highly recommended for sunlight detection like solar panel. -+ * -+ * @return The current brightness factor -+ * */ -+ public float getSunBrightnessFactor(float p_72967_1_) -+ { - float f = this.getCelestialAngle(p_72967_1_); - float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F); - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); - f1 = 1.0F - f1; - f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength(p_72967_1_) * 5.0F) / 16.0D)); - f1 = (float)((double)f1 * (1.0D - (double)(this.getThunderStrength(p_72967_1_) * 5.0F) / 16.0D)); -- f1 = 1.0F - f1; -- return (int)(f1 * 11.0F); -+ return f1; - } - -- @SideOnly(Side.CLIENT) - public void removeWorldAccess(IWorldAccess worldAccess) - { - this.worldAccesses.remove(worldAccess); -++++ END PATCH -++++ REJECTED PATCH 20 - for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1) - { - blockpos1 = blockpos.down(); -- Material material = chunk.getBlock(blockpos1).getMaterial(); -+ Block block = chunk.getBlock(blockpos1); - -- if (material.blocksMovement() && material != Material.leaves) -+ if (block.getMaterial().blocksMovement() && !block.isLeaves(this, blockpos1) && !block.isFoliage(this, blockpos1)) - { - break; - } -++++ END PATCH -++++ REJECTED PATCH 23 - CrashReport crashreport1 = CrashReport.makeCrashReport(throwable1, "Ticking entity"); - CrashReportCategory crashreportcategory2 = crashreport1.makeCategory("Entity being ticked"); - entity2.addEntityCrashInfo(crashreportcategory2); -- throw new ReportedException(crashreport1); -+ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe(crashreport1.getCompleteReport()); -+ removeEntity(entity2); -+ } -+ else -+ { -+ throw new ReportedException(crashreport1); -+ } - } - } - -++++ END PATCH -++++ REJECTED PATCH 24 - CrashReport crashreport2 = CrashReport.makeCrashReport(throwable, "Ticking block entity"); - CrashReportCategory crashreportcategory1 = crashreport2.makeCategory("Block entity being ticked"); - tileentity.addInfoToCrashReport(crashreportcategory1); -- throw new ReportedException(crashreport2); -+ if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe(crashreport2.getCompleteReport()); -+ tileentity.invalidate(); -+ this.removeTileEntity(tileentity.getPos()); -+ } -+ else -+ { -+ throw new ReportedException(crashreport2); -+ } - } - } - } -++++ END PATCH -++++ REJECTED PATCH 28 - { - Block block = this.getBlockState(blockpos$mutableblockpos.set(k1, l1, i2)).getBlock(); - -- if (block.getMaterial() != Material.air) -+ if (!block.isAir(this, new BlockPos(k1, l1, i2))) - { - return true; - } -++++ END PATCH -++++ REJECTED PATCH 31 - IBlockState iblockstate = this.getBlockState(blockpos$mutableblockpos.set(k1, l1, i2)); - Block block = iblockstate.getBlock(); - -+ Boolean result = block.isAABBInsideMaterial(this, blockpos$mutableblockpos, bb, materialIn); -+ if (result != null) return result; -+ - if (block.getMaterial() == materialIn) - { - int j2 = ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue(); -++++ END PATCH -++++ REJECTED PATCH 35 - { - IBlockState iblockstate = blockAccess.getBlockState(pos); - Block block = iblockstate.getBlock(); -- return block.getMaterial().isOpaque() && block.isFullCube() ? true : (block instanceof BlockStairs ? iblockstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP : (block instanceof BlockSlab ? iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue() == 7 : false)))); -+ return block.isSideSolid(blockAccess, pos, EnumFacing.UP); - } - - public boolean isBlockNormalCube(BlockPos pos, boolean _default) -++++ END PATCH -++++ REJECTED PATCH 36 - else - { - Block block = this.getBlockState(pos).getBlock(); -- return block.getMaterial().isOpaque() && block.isFullCube(); -+ return block.isNormalCube(this, pos); - } - } - } -++++ END PATCH ++++ REJECTED PATCH 40 { this.activeChunkSet.clear(); @@ -215,105 +7,3 @@ for (int i = 0; i < this.playerEntities.size(); ++i) { ++++ END PATCH -++++ REJECTED PATCH 41 - Block block = chunkIn.getBlock(blockpos); - j = j + p_147467_1_; - k = k + p_147467_2_; -+ BlockPos worldpos = blockpos.add(p_147467_1_, 0, p_147467_2_); - -- if (block.getMaterial() == Material.air && this.getLight(blockpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, blockpos) <= 0) -+ if (block.isAir(this, worldpos) && this.getLight(worldpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, worldpos) <= 0) //Forge: isAir, and fix arguments to world positions instead of chunk position - { - EntityPlayer entityplayer = this.getClosestPlayer((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, 8.0D); - -++++ END PATCH -++++ REJECTED PATCH 44 - { - Block block = this.getBlockState(pos).getBlock(); - -- if (block.getMaterial() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos)) -+ if (block.isAir(this, pos) && Blocks.snow_layer.canPlaceBlockAt(this, pos)) - { - return true; - } -++++ END PATCH -++++ REJECTED PATCH 45 - else - { - Block block = this.getBlockState(pos).getBlock(); -- int i = lightType == EnumSkyBlock.SKY ? 0 : block.getLightValue(); -- int j = block.getLightOpacity(); -+ int blockLight = block.getLightValue(this, pos); -+ int i = lightType == EnumSkyBlock.SKY ? 0 : blockLight; -+ int j = block.getLightOpacity(this, pos); - -- if (j >= 15 && block.getLightValue() > 0) -+ if (j >= 15 && blockLight > 0) - { - j = 1; - } -++++ END PATCH -++++ REJECTED PATCH 47 - - public List getEntitiesWithinAABB(Class clazz, AxisAlignedBB aabb, Predicate filter) - { -- int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D); -- int j = MathHelper.floor_double((aabb.maxX + 2.0D) / 16.0D); -- int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D); -- int l = MathHelper.floor_double((aabb.maxZ + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((aabb.minX - MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.floor_double((aabb.maxX + MAX_ENTITY_RADIUS) / 16.0D); -+ int k = MathHelper.floor_double((aabb.minZ - MAX_ENTITY_RADIUS) / 16.0D); -+ int l = MathHelper.floor_double((aabb.maxZ + MAX_ENTITY_RADIUS) / 16.0D); - List list = Lists.newArrayList(); - - for (int i1 = i; i1 <= j; ++i1) -++++ END PATCH -++++ REJECTED PATCH 49 - { - Block block = this.getBlockState(pos).getBlock(); - AxisAlignedBB axisalignedbb = p_175716_3_ ? null : blockIn.getCollisionBoundingBox(this, pos, blockIn.getDefaultState()); -- return axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, entityIn) ? false : (block.getMaterial() == Material.circuits && blockIn == Blocks.anvil ? true : block.getMaterial().isReplaceable() && blockIn.canReplace(this, pos, side, itemStackIn)); -+ if (axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, entityIn)) return false; -+ if (block.getMaterial() == Material.circuits && blockIn == Blocks.anvil) return true; -+ return block.isReplaceable(this, pos) && blockIn.canReplace(this, pos, side, itemStackIn); - } - - public int getSeaLevel() -++++ END PATCH -++++ REJECTED PATCH 50 - { - IBlockState iblockstate = this.getBlockState(pos); - Block block = iblockstate.getBlock(); -- return block.isNormalCube() ? this.getStrongPower(pos) : block.getWeakPower(this, pos, iblockstate, facing); -+ return block.shouldCheckWeakPower(this, pos, facing) ? this.getStrongPower(pos) : block.getWeakPower(this, pos, iblockstate, facing); - } - - public boolean isBlockPowered(BlockPos pos) -++++ END PATCH -++++ REJECTED PATCH 59 - { - IBlockState iblockstate = this.getBlockState(blockpos); - -- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) -+ iblockstate.getBlock().onNeighborChange(this, blockpos, pos); -+ if (iblockstate.getBlock().isNormalCube(this, blockpos)) - { -- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); -- } -- else if (iblockstate.getBlock().isNormalCube()) -- { -- blockpos = blockpos.offset(enumfacing); -- iblockstate = this.getBlockState(blockpos); -- -- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) -+ BlockPos posOther = blockpos.offset(enumfacing); -+ Block other = getBlockState(posOther).getBlock(); -+ if (other.getWeakChanges(this, posOther)) - { -- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); -+ other.onNeighborChange(this, posOther, pos); - } - } - } -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index 1658023fca..32577b125e 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -25,6 +25,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; @@ -336,9 +337,9 @@ public class ForgeEventFactory return event.canUpdate; } - public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, SoundEvent name, float volume, float pitch) + public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, SoundEvent name, SoundCategory category, float volume, float pitch) { - PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, volume, pitch); + PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, category, volume, pitch); MinecraftForge.EVENT_BUS.post(event); return event; } diff --git a/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java b/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java index 8947e32bae..7ca05f304d 100644 --- a/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java @@ -2,6 +2,7 @@ package net.minecraftforge.event.entity; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.Entity; +import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvent; /** @@ -28,27 +29,31 @@ import net.minecraft.util.SoundEvent; public class PlaySoundAtEntityEvent extends EntityEvent { private SoundEvent name; + private SoundCategory category; private final float volume; private final float pitch; private float newVolume; private float newPitch; - public PlaySoundAtEntityEvent(Entity entity, SoundEvent name, float volume, float pitch) + public PlaySoundAtEntityEvent(Entity entity, SoundEvent name, SoundCategory category, float volume, float pitch) { super(entity); this.name = name; + this.category = category; this.volume = volume; this.pitch = pitch; this.newVolume = volume; this.newPitch = pitch; } - public SoundEvent getSound(){ return this.name; } + public SoundEvent getSound() { return this.name; } + public SoundCategory getCategory() { return this.category; } public float getDefaultVolume() { return this.volume; } public float getDefaultPitch() { return this.pitch; } public float getVolume() { return this.newVolume; } public float getPitch() { return this.newPitch; } public void setSound(SoundEvent value) { this.name = value; } + public void setCategory(SoundCategory category) { this.category = category; } public void setVolume(float value) { this.newVolume = value; } public void setPitch(float value) { this.newPitch = value; } } From befbb4552268e5916e8ea422d9d1e6460ed8893e Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 8 Mar 2016 23:33:28 +0300 Subject: [PATCH 054/243] Most of ItemInWorldManager reject, various small error fixes. --- .../network/NetHandlerPlayClient.java.patch | 10 +- .../entity/EntityLivingBase.java.patch | 2 +- .../entity/player/EntityPlayerMP.java.patch | 2 +- .../net/minecraft/item/Item.java.patch | 6 +- .../PlayerInteractionManager.java.patch | 213 ++++++++++++++++++ .../ItemInWorldManager.java.patch.rej | 205 ----------------- .../net/minecraftforge/common/ForgeHooks.java | 10 +- .../common/WorldSpecificSaveHandler.java | 2 +- .../common/chunkio/QueuedChunk.java | 2 +- .../common/util/BlockSnapshot.java | 4 +- src/main/resources/forge_at.cfg | 2 +- 11 files changed, 233 insertions(+), 225 deletions(-) create mode 100644 patches.mcp/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch index 211b26c4ca..fcb57fff8a 100644 --- a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch @@ -13,7 +13,7 @@ public void handleChat(SPacketChat packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); -+ net.minecraft.util.IChatComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(packetIn.getType(), packetIn.getChatComponent()); ++ net.minecraft.util.text.ITextComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(packetIn.getType(), packetIn.getChatComponent()); + if (message == null) return; if (packetIn.getType() == 2) @@ -40,17 +40,17 @@ EntityTracker.func_187254_a(entitylivingbase, d0, d1, d2); entitylivingbase.renderYawOffset = entitylivingbase.rotationYawHead = (float)(packetIn.getHeadPitch() * 360) / 256.0F; Entity[] aentity = entitylivingbase.getParts(); -@@ -1082,6 +1089,10 @@ +@@ -1179,6 +1186,10 @@ { - entityplayer.openContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e()); + tileentity.readFromNBT(packetIn.getNbtCompound()); } + else + { + tileentity.onDataPacket(netManager, packetIn); + } - } - } + if (flag && this.gameController.currentScreen instanceof GuiCommandBlock) + { @@ -1378,7 +1389,7 @@ if (entity instanceof EntityLivingBase) diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 6db21f1932..2bb4e0964a 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -132,7 +132,7 @@ public void func_184609_a(EnumHand p_184609_1_) { -+ ItemStack stack = this.getHeldItem(); ++ ItemStack stack = this.func_184586_b(p_184609_1_); + if (stack != null && stack.getItem() != null) + { + if (stack.getItem().onEntitySwing(this, stack)) return; diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch index 4e12cfdae6..08230f74aa 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -60,7 +60,7 @@ public Entity func_184204_a(int p_184204_1_) { -+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return; ++ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return this; this.field_184851_cj = true; if (this.dimension == 1 && p_184204_1_ == 1) diff --git a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch index 4b6c4ddc57..8077e84545 100644 --- a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch @@ -360,7 +360,7 @@ + * @param type The subtype, can be null or "overlay" + * @return Path of texture to bind, or null to use default + */ -+ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) ++ public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) + { + return null; + } @@ -383,12 +383,12 @@ + * + * @param entityLiving The entity wearing the armor + * @param itemStack The itemStack to render the model of -+ * @param armorSlot 0=head, 1=torso, 2=legs, 3=feet ++ * @param armorSlot The slot the armor is in + * @param _default Original armor model. Will have attributes set. + * @return A ModelBiped to render instead of the default + */ + @SideOnly(Side.CLIENT) -+ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot, net.minecraft.client.model.ModelBiped _default) ++ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, net.minecraft.client.model.ModelBiped _default) + { + return null; + } diff --git a/patches.mcp/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch new file mode 100644 index 0000000000..3111f6a970 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch @@ -0,0 +1,213 @@ +--- ../src-base/minecraft/net/minecraft/server/management/PlayerInteractionManager.java ++++ ../src-work/minecraft/net/minecraft/server/management/PlayerInteractionManager.java +@@ -27,6 +27,8 @@ + + public class PlayerInteractionManager + { ++ /** Forge reach distance */ ++ private double blockReachDistance = 5.0d; + public World theWorld; + public EntityPlayerMP thisPlayerMP; + private WorldSettings.GameType gameType = WorldSettings.GameType.NOT_SET; +@@ -88,7 +90,7 @@ + IBlockState iblockstate = this.theWorld.getBlockState(this.field_180241_i); + Block block = iblockstate.getBlock(); + +- if (iblockstate.func_185904_a() == Material.air) ++ if (block.isAir(iblockstate, theWorld, field_180241_i)) + { + this.receivedFinishDiggingPacket = false; + } +@@ -115,7 +117,7 @@ + IBlockState iblockstate1 = this.theWorld.getBlockState(this.field_180240_f); + Block block1 = iblockstate1.getBlock(); + +- if (iblockstate1.func_185904_a() == Material.air) ++ if (block1.isAir(iblockstate1, theWorld, field_180240_f)) + { + this.theWorld.sendBlockBreakProgress(this.thisPlayerMP.getEntityId(), this.field_180240_f, -1); + this.durabilityRemainingOnBlock = -1; +@@ -124,7 +126,7 @@ + else + { + int k = this.curblockDamage - this.initialDamage; +- float f1 = iblockstate1.func_185903_a(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180241_i) * (float)(k + 1); ++ float f1 = iblockstate1.func_185903_a(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180240_f) * (float)(k + 1); // Forge: Fix network break progress using wrong position + int l = (int)(f1 * 10.0F); + + if (l != this.durabilityRemainingOnBlock) +@@ -138,6 +140,14 @@ + + public void onBlockClicked(BlockPos pos, EnumFacing side) + { ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thisPlayerMP, ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, theWorld, pos, side, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(thisPlayerMP, getBlockReachDistance() + 1)); ++ if (event.isCanceled()) ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new SPacketBlockChange(theWorld, pos)); ++ return; ++ } ++ + if (this.isCreative()) + { + if (!this.theWorld.extinguishFire((EntityPlayer)null, pos, side)) +@@ -173,17 +183,32 @@ + } + } + +- this.theWorld.extinguishFire((EntityPlayer)null, pos, side); + this.initialDamage = this.curblockDamage; + float f = 1.0F; + +- if (iblockstate.func_185904_a() != Material.air) ++ if (!iblockstate.getBlock().isAir(iblockstate, theWorld, pos)) + { +- block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); ++ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); ++ this.theWorld.extinguishFire((EntityPlayer)null, pos, side); ++ } ++ else ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new SPacketBlockChange(theWorld, pos)); ++ } + f = iblockstate.func_185903_a(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos); + } ++ if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ if (f >= 1.0F) ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new SPacketBlockChange(theWorld, pos)); ++ } ++ return; ++ } + +- if (iblockstate.func_185904_a() != Material.air && f >= 1.0F) ++ if (iblockstate.getBlock().isAir(iblockstate, theWorld, pos) && f >= 1.0F) + { + this.tryHarvestBlock(pos); + } +@@ -205,7 +230,7 @@ + int i = this.curblockDamage - this.initialDamage; + IBlockState iblockstate = this.theWorld.getBlockState(pos); + +- if (iblockstate.func_185904_a() != Material.air) ++ if (iblockstate.getBlock().isAir(iblockstate, theWorld, pos)) + { + float f = iblockstate.func_185903_a(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos) * (float)(i + 1); + +@@ -234,9 +259,14 @@ + + private boolean removeBlock(BlockPos pos) + { ++ return removeBlock(pos, false); ++ } ++ ++ private boolean removeBlock(BlockPos pos, boolean canHarvest) ++ { + IBlockState iblockstate = this.theWorld.getBlockState(pos); + iblockstate.getBlock().onBlockHarvested(this.theWorld, pos, iblockstate, this.thisPlayerMP); +- boolean flag = this.theWorld.setBlockToAir(pos); ++ boolean flag = iblockstate.getBlock().removedByPlayer(iblockstate, theWorld, pos, thisPlayerMP, canHarvest); + + if (flag) + { +@@ -248,7 +278,8 @@ + + public boolean tryHarvestBlock(BlockPos pos) + { +- if (this.gameType.isCreative() && this.thisPlayerMP.func_184614_ca() != null && this.thisPlayerMP.func_184614_ca().getItem() instanceof ItemSword) ++ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(theWorld, gameType, thisPlayerMP, pos); ++ if (exp == -1) + { + return false; + } +@@ -264,41 +295,22 @@ + } + else + { +- if (this.gameType.isAdventure()) +- { +- if (this.gameType == WorldSettings.GameType.SPECTATOR) +- { +- return false; +- } ++ ItemStack stack = thisPlayerMP.func_184614_ca(); ++ if (stack != null && stack.getItem().onBlockStartBreak(stack, pos, thisPlayerMP)) return false; + +- if (!this.thisPlayerMP.isAllowEdit()) +- { +- ItemStack itemstack = this.thisPlayerMP.func_184614_ca(); +- +- if (itemstack == null) +- { +- return false; +- } +- +- if (!itemstack.canDestroy(iblockstate.getBlock())) +- { +- return false; +- } +- } +- } +- + this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, pos, Block.getStateId(iblockstate)); +- boolean flag1 = this.removeBlock(pos); ++ boolean flag1 = false; + + if (this.isCreative()) + { ++ flag1 = this.removeBlock(pos); + this.thisPlayerMP.playerNetServerHandler.sendPacket(new SPacketBlockChange(this.theWorld, pos)); + } + else + { + ItemStack itemstack1 = this.thisPlayerMP.func_184614_ca(); + ItemStack itemstack2 = itemstack1 == null ? null : itemstack1.copy(); +- boolean flag = this.thisPlayerMP.func_184823_b(iblockstate); ++ boolean flag = iblockstate.getBlock().canHarvestBlock(theWorld, pos, thisPlayerMP); + + if (itemstack1 != null) + { +@@ -310,12 +322,18 @@ + } + } + ++ flag1 = this.removeBlock(pos, flag); + if (flag1 && flag) + { + iblockstate.getBlock().harvestBlock(this.theWorld, this.thisPlayerMP, pos, iblockstate, tileentity, itemstack2); + } + } + ++ // Drop experience ++ if (!this.isCreative() && flag1 && exp > 0) ++ { ++ iblockstate.getBlock().dropXpOnBlockBreak(theWorld, pos, exp); ++ } + return flag1; + } + } +@@ -359,6 +377,7 @@ + if (itemstack.stackSize == 0) + { + p_187250_1_.func_184611_a(p_187250_4_, (ItemStack)null); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187250_1_, itemstack, p_187250_4_); + } + + if (!p_187250_1_.func_184587_cr()) +@@ -445,4 +464,13 @@ + { + this.theWorld = serverWorld; + } ++ ++ public double getBlockReachDistance() ++ { ++ return blockReachDistance; ++ } ++ public void setBlockReachDistance(double distance) ++ { ++ blockReachDistance = distance; ++ } + } diff --git a/rejects/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch.rej b/rejects/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch.rej index 58d956d21c..a9f9605b4b 100644 --- a/rejects/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch.rej +++ b/rejects/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch.rej @@ -1,193 +1,3 @@ -++++ REJECTED PATCH 1 - - public class ItemInWorldManager - { -+ /** Forge reach distance */ -+ private double blockReachDistance = 5.0d; - public World theWorld; - public EntityPlayerMP thisPlayerMP; - private WorldSettings.GameType gameType = WorldSettings.GameType.NOT_SET; -++++ END PATCH -++++ REJECTED PATCH 2 - else - { - int k = this.curblockDamage - this.initialDamage; -- float f1 = block1.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180241_i) * (float)(k + 1); -+ float f1 = block1.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180240_f) * (float)(k + 1); //Forge: Fix network break progress using wrong position - int l = (int)(f1 * 10.0F); - - if (l != this.durabilityRemainingOnBlock) -++++ END PATCH -++++ REJECTED PATCH 3 - - public void onBlockClicked(BlockPos pos, EnumFacing side) - { -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thisPlayerMP, -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, theWorld, pos, side, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(thisPlayerMP, getBlockReachDistance() + 1)); -+ if (event.isCanceled()) -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); -+ return; -+ } -+ - if (this.isCreative()) - { - if (!this.theWorld.extinguishFire((EntityPlayer)null, pos, side)) -++++ END PATCH -++++ REJECTED PATCH 4 - } - } - -- this.theWorld.extinguishFire((EntityPlayer)null, pos, side); -+ // - this.initialDamage = this.curblockDamage; - float f = 1.0F; - -- if (block.getMaterial() != Material.air) -+ if (!block.isAir(theWorld, pos)) - { -- block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); -+ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); -+ this.theWorld.extinguishFire((EntityPlayer)null, pos, side); -+ } -+ else -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); -+ } - f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos); - } - -- if (block.getMaterial() != Material.air && f >= 1.0F) -+ if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) - { -+ if (f >= 1.0F) -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); -+ } -+ return; -+ } -+ -+ if (!block.isAir(theWorld, pos) && f >= 1.0F) -+ { - this.tryHarvestBlock(pos); - } - else -++++ END PATCH -++++ REJECTED PATCH 5 - int i = this.curblockDamage - this.initialDamage; - Block block = this.theWorld.getBlockState(pos).getBlock(); - -- if (block.getMaterial() != Material.air) -+ if (!block.isAir(theWorld, pos)) - { - float f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos) * (float)(i + 1); - -++++ END PATCH -++++ REJECTED PATCH 6 - - private boolean removeBlock(BlockPos pos) - { -+ return removeBlock(pos, false); -+ } -+ private boolean removeBlock(BlockPos pos, boolean canHarvest) -+ { - IBlockState iblockstate = this.theWorld.getBlockState(pos); - iblockstate.getBlock().onBlockHarvested(this.theWorld, pos, iblockstate, this.thisPlayerMP); -- boolean flag = this.theWorld.setBlockToAir(pos); -+ boolean flag = iblockstate.getBlock().removedByPlayer(theWorld, pos, thisPlayerMP, canHarvest); - - if (flag) - { -++++ END PATCH -++++ REJECTED PATCH 7 - - public boolean tryHarvestBlock(BlockPos pos) - { -- if (this.gameType.isCreative() && this.thisPlayerMP.getHeldItem() != null && this.thisPlayerMP.getHeldItem().getItem() instanceof ItemSword) -+ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(theWorld, gameType, thisPlayerMP, pos); -+ if (exp == -1) - { - return false; - } -++++ END PATCH -++++ REJECTED PATCH 8 - IBlockState iblockstate = this.theWorld.getBlockState(pos); - TileEntity tileentity = this.theWorld.getTileEntity(pos); - -- if (this.gameType.isAdventure()) -- { -- if (this.gameType == WorldSettings.GameType.SPECTATOR) -- { -- return false; -- } -+ ItemStack stack = thisPlayerMP.getCurrentEquippedItem(); -+ if (stack != null && stack.getItem().onBlockStartBreak(stack, pos, thisPlayerMP)) return false; - -- if (!this.thisPlayerMP.isAllowEdit()) -- { -- ItemStack itemstack = this.thisPlayerMP.getCurrentEquippedItem(); -- -- if (itemstack == null) -- { -- return false; -- } -- -- if (!itemstack.canDestroy(iblockstate.getBlock())) -- { -- return false; -- } -- } -- } -- - this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, pos, Block.getStateId(iblockstate)); -- boolean flag1 = this.removeBlock(pos); -+ boolean flag1 = false; - - if (this.isCreative()) - { -+ flag1 = this.removeBlock(pos); - this.thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(this.theWorld, pos)); - } - else - { - ItemStack itemstack1 = this.thisPlayerMP.getCurrentEquippedItem(); -- boolean flag = this.thisPlayerMP.canHarvestBlock(iblockstate.getBlock()); -+ boolean flag = iblockstate.getBlock().canHarvestBlock(theWorld, pos, thisPlayerMP); - - if (itemstack1 != null) - { -++++ END PATCH -++++ REJECTED PATCH 9 - } - } - -+ flag1 = this.removeBlock(pos, flag); - if (flag1 && flag) - { - iblockstate.getBlock().harvestBlock(this.theWorld, this.thisPlayerMP, pos, iblockstate, tileentity); - } - } - -+ // Drop experiance -+ if (!this.isCreative() && flag1 && exp > 0) -+ { -+ iblockstate.getBlock().dropXpOnBlockBreak(theWorld, pos, exp); -+ } - return flag1; - } - } -++++ END PATCH -++++ REJECTED PATCH 10 - if (itemstack.stackSize == 0) - { - player.inventory.mainInventory[player.inventory.currentItem] = null; -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemstack); - } - - if (!player.isUsingItem()) -++++ END PATCH ++++ REJECTED PATCH 11 } else @@ -259,18 +69,3 @@ } ++++ END PATCH -++++ REJECTED PATCH 12 - { - this.theWorld = serverWorld; - } -+ -+ public double getBlockReachDistance() -+ { -+ return blockReachDistance; -+ } -+ public void setBlockReachDistance(double distance) -+ { -+ blockReachDistance = distance; -+ } - } -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 052d76944d..96b81ce95f 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -137,24 +137,24 @@ public class ForgeHooks public static boolean canHarvestBlock(Block block, EntityPlayer player, IBlockAccess world, BlockPos pos) { - if (block.getMaterial().isToolNotRequired()) + IBlockState state = world.getBlockState(pos); + state = state.getBlock().getActualState(state, world, pos); + if (state.func_185904_a().isToolNotRequired()) { return true; } ItemStack stack = player.inventory.getCurrentItem(); - IBlockState state = world.getBlockState(pos); - state = state.getBlock().getActualState(state, world, pos); String tool = block.getHarvestTool(state); if (stack == null || tool == null) { - return player.canHarvestBlock(block); + return player.func_184823_b(state); } int toolLevel = stack.getItem().getHarvestLevel(stack, tool); if (toolLevel < 0) { - return player.canHarvestBlock(block); + return player.func_184823_b(state); } return toolLevel >= block.getHarvestLevel(state); diff --git a/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java b/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java index 50064f3627..1e6044d0a0 100644 --- a/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java +++ b/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java @@ -50,7 +50,7 @@ public class WorldSpecificSaveHandler implements ISaveHandler dataDir.mkdirs(); } File file = new File(dataDir, name + ".dat"); - if (!file.exists() && name.equalsIgnoreCase("FORTRESS") && world.provider.getDimensionId() == -1) //Only copy over the fortress.dat for the vanilla nether. + if (!file.exists() && name.equalsIgnoreCase("FORTRESS") && world.provider.getDimension() == -1) //Only copy over the fortress.dat for the vanilla nether. { File parentFile = parent.getMapFileFromName(name); if (parentFile.exists()) diff --git a/src/main/java/net/minecraftforge/common/chunkio/QueuedChunk.java b/src/main/java/net/minecraftforge/common/chunkio/QueuedChunk.java index f093b996bc..039d75c636 100644 --- a/src/main/java/net/minecraftforge/common/chunkio/QueuedChunk.java +++ b/src/main/java/net/minecraftforge/common/chunkio/QueuedChunk.java @@ -43,7 +43,7 @@ class QueuedChunk { result.append(" z: " + z + NEW_LINE); result.append(" loader: " + loader + NEW_LINE ); result.append(" world: " + world.getWorldInfo().getWorldName() + NEW_LINE); - result.append(" dimension: " + world.provider.getDimensionId() + NEW_LINE); + result.append(" dimension: " + world.provider.getDimension() + NEW_LINE); result.append(" provider: " + world.provider.getClass().getName() + NEW_LINE); result.append("}"); diff --git a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java index 60104a0f7e..a3566afab7 100644 --- a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java +++ b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java @@ -35,7 +35,7 @@ public class BlockSnapshot implements Serializable public BlockSnapshot(World world, BlockPos pos, IBlockState state) { this.world = world; - this.dimId = world.provider.getDimensionId(); + this.dimId = world.provider.getDimension(); this.pos = pos; this.replacedBlock = state; this.blockIdentifier = GameRegistry.findUniqueIdentifierFor(state.getBlock()); @@ -57,7 +57,7 @@ public class BlockSnapshot implements Serializable public BlockSnapshot(World world, BlockPos pos, IBlockState state, NBTTagCompound nbt) { this.world = world; - this.dimId = world.provider.getDimensionId(); + this.dimId = world.provider.getDimension(); this.pos = pos.getImmutable(); this.replacedBlock = state; this.blockIdentifier = GameRegistry.findUniqueIdentifierFor(state.getBlock()); diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index 3eaa618f68..db03009167 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -17,7 +17,7 @@ public net.minecraft.block.Block func_149715_a(F)Lnet.minecraft.block.Block; #se public net.minecraft.block.Block func_149722_s()Lnet.minecraft.block.Block; #setBlockUnbreakable public net.minecraft.block.Block func_149675_a(Z)Lnet.minecraft.block.Block; #setTickRandomly #public net.minecraft.block.Block func_149676_a(FFFFFF)V #setBlockBounds -#public net.minecraft.block.Block func_180637_b(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;I)V # dropXpOnBlockBreak +public net.minecraft.block.Block func_180637_b(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;I)V # dropXpOnBlockBreak # BlockFire public net.minecraft.block.BlockFire func_176532_c(Lnet/minecraft/block/Block;)I # getFireSpreadSpeed public net.minecraft.block.BlockFire func_176534_d(Lnet/minecraft/block/Block;)I # getFireSpreadSpeed From fffbc0f078706122bcebb7714e24c591f444b453 Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 8 Mar 2016 16:23:54 -0500 Subject: [PATCH 055/243] Some more forge code fixes --- .../java/net/minecraftforge/client/model/MultiModel.java | 2 +- .../net/minecraftforge/common/ForgeInternalHandler.java | 4 +++- .../minecraftforge/common/WorldSpecificSaveHandler.java | 8 +++++++- .../net/minecraftforge/common/util/BlockSnapshot.java | 6 +++--- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/MultiModel.java b/src/main/java/net/minecraftforge/client/model/MultiModel.java index 6280f598c7..28b3884876 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiModel.java @@ -142,7 +142,7 @@ public class MultiModel implements IModel { quads.addAll(bakedPart.func_188616_a(null, null, 0)); } - builder.put(Optional.absent(), quads.build()); + builder.put(Optional.absent(), quads.build()); this.quads = builder.build(); } return quads.get(Optional.fromNullable(side)); diff --git a/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java b/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java index f1a0f243da..a7eb78d02f 100644 --- a/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java +++ b/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java @@ -1,5 +1,7 @@ package net.minecraftforge.common; +import com.google.common.base.Optional; +import net.minecraft.network.datasync.DataSerializers; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -25,7 +27,7 @@ public class ForgeInternalHandler Entity entity = event.entity; if (entity.getClass().equals(EntityItem.class)) { - ItemStack stack = entity.getDataWatcher().getWatchableObjectItemStack(10); + ItemStack stack = ((EntityItem)entity).getEntityItem(); if (stack == null) { diff --git a/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java b/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java index 1e6044d0a0..8d649ae011 100644 --- a/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java +++ b/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java @@ -3,6 +3,7 @@ package net.minecraftforge.common; import java.io.File; import java.io.IOException; +import net.minecraft.world.gen.structure.template.TemplateManager; import org.apache.logging.log4j.Level; import com.google.common.io.Files; @@ -38,7 +39,6 @@ public class WorldSpecificSaveHandler implements ISaveHandler @Override public void saveWorldInfo(WorldInfo var1){ parent.saveWorldInfo(var1); } @Override public IPlayerFileData getPlayerNBTManager() { return parent.getPlayerNBTManager(); } @Override public void flush() { parent.flush(); } - @Override public String getWorldDirectoryName() { return parent.getWorldDirectoryName(); } @Override public File getWorldDirectory() { return parent.getWorldDirectory(); } @Override @@ -68,4 +68,10 @@ public class WorldSpecificSaveHandler implements ISaveHandler return file; } + @Override + public TemplateManager func_186340_h() + { + return parent.func_186340_h(); + } + } diff --git a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java index a3566afab7..467eaa0eb2 100644 --- a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java +++ b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java @@ -139,7 +139,7 @@ public class BlockSnapshot implements Serializable public TileEntity getTileEntity() { if (nbt != null) - return TileEntity.createAndLoadEntity(nbt); + return TileEntity.func_184246_b(getWorld().getMinecraftServer(), nbt); else return null; } @@ -170,7 +170,7 @@ public class BlockSnapshot implements Serializable } world.setBlockState(pos, replaced, applyPhysics ? 3 : 2); - world.markBlockForUpdate(pos); + world.func_184138_a(pos, current, replaced, applyPhysics ? 3 : 2); TileEntity te = null; if (nbt != null) { @@ -205,7 +205,7 @@ public class BlockSnapshot implements Serializable } world.setBlockState(pos, replaced, applyPhysics ? 3 : 2); - world.markBlockForUpdate(pos); + world.func_184138_a(pos, current, replaced, applyPhysics ? 3 : 2); TileEntity te = null; if (nbt != null) { From a44d76652b09eb20066625b2002db603618e7d3d Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 8 Mar 2016 16:30:00 -0500 Subject: [PATCH 056/243] Another compilation fix More patch tweaks for compilation errors. onItemUseTick takes an entity now, cos skellies use stuff too --- .../entity/EntityLivingBase.java.patch | 21 +++++++++---------- .../net/minecraft/item/Item.java.patch | 2 +- .../common/ForgeModContainer.java | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 2bb4e0964a..b27b6a34c3 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -190,7 +190,7 @@ super.onUpdate(); this.func_184608_ct(); -@@ -2351,6 +2384,41 @@ +@@ -2351,6 +2384,40 @@ this.potionsNeedUpdate = true; } @@ -200,18 +200,17 @@ + */ + public void curePotionEffects(ItemStack curativeItem) + { -+ Iterator potionKey = activePotionsMap.keySet().iterator(); + if (worldObj.isRemote) return; ++ Iterator iterator = this.activePotionsMap.values().iterator(); + -+ while (potionKey.hasNext()) ++ while (iterator.hasNext()) + { -+ Integer key = potionKey.next(); -+ PotionEffect effect = (PotionEffect)activePotionsMap.get(key); ++ PotionEffect effect = iterator.next(); + + if (effect.isCurativeItem(curativeItem)) + { -+ potionKey.remove(); + onFinishedPotionEffect(effect); ++ iterator.remove(); + this.potionsNeedUpdate = true; + } + } @@ -232,7 +231,7 @@ public abstract EnumHandSide func_184591_cq(); public boolean func_184587_cr() -@@ -2371,6 +2439,14 @@ +@@ -2371,6 +2438,14 @@ if (itemstack == this.field_184627_bm) { @@ -247,7 +246,7 @@ if (this.func_184605_cv() <= 25 && this.func_184605_cv() % 4 == 0) { this.func_184584_a(this.field_184627_bm, 5); -@@ -2380,6 +2456,7 @@ +@@ -2380,6 +2455,7 @@ { this.onItemUseFinish(); } @@ -255,7 +254,7 @@ } else { -@@ -2394,8 +2471,10 @@ +@@ -2394,8 +2470,10 @@ if (itemstack != null && !this.func_184587_cr()) { @@ -267,7 +266,7 @@ if (!this.worldObj.isRemote) { -@@ -2478,6 +2557,8 @@ +@@ -2478,6 +2556,8 @@ this.func_184584_a(this.field_184627_bm, 16); ItemStack itemstack = this.field_184627_bm.onItemUseFinish(this.worldObj, this); @@ -276,7 +275,7 @@ if (itemstack != null && itemstack.stackSize == 0) { itemstack = null; -@@ -2508,6 +2589,8 @@ +@@ -2508,6 +2588,8 @@ if (this.field_184627_bm != null) { this.field_184627_bm.onPlayerStoppedUsing(this.worldObj, this, this.func_184605_cv()); diff --git a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch index 8077e84545..d4adc405e6 100644 --- a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch @@ -159,7 +159,7 @@ + * @param player The Player using the item + * @param count The amount of time in tick the item has been used for continuously + */ -+ public void onUsingTick(ItemStack stack, EntityPlayer player, int count) ++ public void onUsingTick(ItemStack stack, EntityLivingBase player, int count) + { + } + diff --git a/src/main/java/net/minecraftforge/common/ForgeModContainer.java b/src/main/java/net/minecraftforge/common/ForgeModContainer.java index dfe2346f5b..3ef4c7c7ba 100644 --- a/src/main/java/net/minecraftforge/common/ForgeModContainer.java +++ b/src/main/java/net/minecraftforge/common/ForgeModContainer.java @@ -354,7 +354,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC @Subscribe public void serverStarting(FMLServerStartingEvent evt) { - evt.registerServerCommand(new ForgeCommand(evt.getServer())); + evt.registerServerCommand(new ForgeCommand()); } @Override public NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info) From 25256c8ddd5c11016cffc51d75c398af1aac94eb Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 8 Mar 2016 23:22:54 -0500 Subject: [PATCH 057/243] More fixups, removing chestgenstuff aggressively. Use loot tables. Any missing ones WILL be added by Mojang. --- .../net/minecraft/item/Item.java.patch | 33 ++++--------------- .../network/ServerStatusResponse.java.patch | 2 +- .../minecraft/world/WorldServer.java.patch | 4 +-- .../client/model/ModelDynBucket.java | 3 +- .../net/minecraftforge/common/ForgeHooks.java | 2 +- src/main/resources/forge_at.cfg | 2 +- 6 files changed, 13 insertions(+), 33 deletions(-) diff --git a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch index d4adc405e6..b8507eda8f 100644 --- a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch @@ -57,7 +57,7 @@ Vec3d vec3d1 = vec3d.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); return worldIn.rayTraceBlocks(vec3d, vec3d1, useLiquids, !useLiquids, false); } -@@ -422,11 +431,609 @@ +@@ -422,11 +431,588 @@ return false; } @@ -96,7 +96,7 @@ + * by a user in the displayed name, such as a mode of operation. + * + * @param item the ItemStack for the item. -+ * @param the name that will be displayed unless it is changed in this method. ++ * @param displayName the name that will be displayed unless it is changed in this method. + */ + public String getHighlightTip( ItemStack item, String displayName ) + { @@ -283,27 +283,6 @@ + } + + /** -+ * Generates the base Random item for a specific instance of the chest gen, -+ * Enchanted books use this to pick a random enchantment. -+ * -+ * @param chest The chest category to generate for -+ * @param rnd World RNG -+ * @param original Original result registered with the chest gen hooks. -+ * @return New values to use as the random item, typically this will be original -+ */ -+ @Deprecated // LootTables! -+ public net.minecraft.util.WeightedRandomChestContent getChestGenBase(net.minecraftforge.common.ChestGenHooks chest, Random rnd, net.minecraft.util.WeightedRandomChestContent original) -+ { -+ if (this instanceof ItemEnchantedBook) -+ { -+ return ((ItemEnchantedBook)this).getRandom(rnd, -+ original.minStackSize, -+ original.maxStackSize, original.itemWeight); -+ } -+ return original; -+ } -+ -+ /** + * + * Should this item, when held, allow sneak-clicks to pass through to the underlying block? + * @@ -500,7 +479,7 @@ + } + + /** -+ * ItemStack sensitive version of {@link #canHarvestBlock(Block)} ++ * ItemStack sensitive version of {@link #canHarvestBlock(IBlockState)} + * @param state The block trying to harvest + * @param stack The itemstack used to harvest the block + * @return true if can harvest the block @@ -515,7 +494,7 @@ + * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit() + * + * @param stack The ItemStack -+ * @return THe maximum number this item can be stacked to ++ * @return The maximum number this item can be stacked to + */ + public int getItemStackLimit(ItemStack stack) + { @@ -667,7 +646,7 @@ public static void registerItems() { registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() -@@ -935,6 +1542,10 @@ +@@ -935,6 +1521,10 @@ private final float damageVsEntity; private final int enchantability; @@ -678,7 +657,7 @@ private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) { this.harvestLevel = harvestLevel; -@@ -969,9 +1580,36 @@ +@@ -969,9 +1559,36 @@ return this.enchantability; } diff --git a/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch b/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch index e893acae61..ce50f6b636 100644 --- a/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch +++ b/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch @@ -69,7 +69,7 @@ + ret = this.json; + if (ret == null) + { -+ ret = net.minecraft.network.status.server.S00PacketServerInfo.GSON.toJson(this); ++ ret = net.minecraft.network.status.server.SPacketServerInfo.GSON.toJson(this); + this.json = ret; + } + mutex.release(); diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch index 5a29810983..0b06244efd 100644 --- a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch @@ -103,7 +103,7 @@ { i = 8; + //Keeping here as a note for future when it may be restored. -+ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.position.getX() >> 4, nextticklistentry.position.getZ() >> 4)); ++ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(pos.getX() >> 4, pos.getZ() >> 4)); + i = isForced ? 0 : 8; if (this.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i))) @@ -241,7 +241,7 @@ + public java.io.File getChunkSaveLocation() + { -+ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)theChunkProviderServer.chunkLoader).chunkSaveLocation; ++ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)getChunkProvider().chunkLoader).chunkSaveLocation; + } + static class ServerBlockEventList extends ArrayList diff --git a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java index 6dd0d0e948..e0faedf6bb 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java +++ b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java @@ -14,6 +14,7 @@ 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.ItemOverride; import net.minecraft.client.renderer.block.model.ItemOverrideList; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -228,7 +229,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableMo public static final BakedDynBucketOverrideHandler INSTANCE = new BakedDynBucketOverrideHandler(); private BakedDynBucketOverrideHandler() { - super(ImmutableList.of()); + super(ImmutableList.of()); } @Override diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 96b81ce95f..405e2249c8 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -690,7 +690,7 @@ public class ForgeHooks if (event.isCanceled()) { // Let the client know the block still exists - entityPlayer.playerNetServerHandler.sendPacket(new S23PacketBlockChange(world, pos)); + entityPlayer.playerNetServerHandler.sendPacket(new SPacketBlockChange(world, pos)); // Update any tile entity data for this block TileEntity tileentity = world.getTileEntity(pos); diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index db03009167..9e50ea7be7 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -150,7 +150,7 @@ public net.minecraft.client.renderer.VertexBuffer func_178972_a(IIIII)V # putCol #public net.minecraft.client.renderer.entity.RenderLivingBase func_177094_a(Lnet/minecraft/client/renderer/entity/layers/LayerRenderer;)Z # addLayer # S00PacketServerInfo -#public net.minecraft.network.status.server.S00PacketServerInfo field_149297_a # GSON +public net.minecraft.network.status.server.SPacketServerInfo field_149297_a # GSON #Main FML Access Transformer configuration file # TileEntity addMapping From 56a0d125bda415c51e6b9e824ff888f1ba4221fa Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 8 Mar 2016 23:39:37 -0500 Subject: [PATCH 058/243] Remove more chestgenhooks stuff. Clean up some more ATs --- .../WeightedRandomChestContent.java.patch | 32 --- ...ComponentScatteredFeaturePieces.java.patch | 35 --- .../minecraftforge/common/ChestGenHooks.java | 230 ------------------ .../common/chunkio/ChunkIOProvider.java | 6 +- src/main/resources/forge_at.cfg | 6 +- 5 files changed, 7 insertions(+), 302 deletions(-) delete mode 100644 patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch delete mode 100644 src/main/java/net/minecraftforge/common/ChestGenHooks.java diff --git a/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch b/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch deleted file mode 100644 index 577624b951..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/WeightedRandomChestContent.java -+++ ../src-work/minecraft/net/minecraft/util/WeightedRandomChestContent.java -@@ -20,11 +20,29 @@ - this.maxStackSize = maximumChance; - } - -+ // -- Forge hooks -+ /** -+ * Allow a mod to submit a custom implementation that can delegate item stack generation beyond simple stack lookup -+ * -+ * @param random The current random for generation -+ * @param newInventory The inventory being generated (do not populate it, but you can refer to it) -+ * @return An array of {@link ItemStack} to put into the chest -+ */ -+ @Deprecated // New loottable system shouldn't need this. Need to research more. -+ protected ItemStack[] generateChestContent(Random random, net.minecraft.inventory.IInventory newInventory) -+ { -+ return net.minecraftforge.common.ChestGenHooks.generateStacks(random, theItemId, minStackSize, maxStackSize); -+ } -+ - public static void generateDispenserContents(Random random, List listIn, TileEntityDispenser dispenser, int max) - { - for (int i = 0; i < max; ++i) - { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, listIn); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, dispenser); -+ for (ItemStack stack : stacks) -+ dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), stack); -+ if (true) continue; // Forge: Skip the rest we replace it. - int j = weightedrandomchestcontent.minStackSize + random.nextInt(weightedrandomchestcontent.maxStackSize - weightedrandomchestcontent.minStackSize + 1); - - if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch deleted file mode 100644 index 713c9cc049..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java -@@ -451,6 +451,11 @@ - private static final List field_175815_j = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.arrow, 0, 2, 7, 30)}); - private static ComponentScatteredFeaturePieces.JunglePyramid.Stones junglePyramidsRandomScatteredStones = new ComponentScatteredFeaturePieces.JunglePyramid.Stones(); - -+ static -+ { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_DISPENSER, field_175815_j, 2, 2); -+ } -+ - public JunglePyramid() - { - } -@@ -607,9 +612,10 @@ - this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 4, -3, 1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 3, -3, 1, structureBoundingBoxIn); - -+ net.minecraftforge.common.ChestGenHooks dispenser = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_DISPENSER); - if (!this.field_74945_j) - { -- this.field_74945_j = this.func_186166_a(worldIn, structureBoundingBoxIn, randomIn, 3, -2, 1, EnumFacing.NORTH, field_175815_j, 2); -+ this.field_74945_j = this.func_186166_a(worldIn, structureBoundingBoxIn, randomIn, 3, -2, 1, EnumFacing.NORTH, dispenser.getItems(randomIn), dispenser.getCount(randomIn)); - } - - this.setBlockState(worldIn, Blocks.vine.getDefaultState().withProperty(BlockVine.SOUTH, Boolean.valueOf(true)), 3, -2, 2, structureBoundingBoxIn); -@@ -626,7 +632,7 @@ - - if (!this.field_74946_k) - { -- this.field_74946_k = this.func_186166_a(worldIn, structureBoundingBoxIn, randomIn, 9, -2, 3, EnumFacing.WEST, field_175815_j, 2); -+ this.field_74946_k = this.func_186166_a(worldIn, structureBoundingBoxIn, randomIn, 9, -2, 3, EnumFacing.WEST, dispenser.getItems(randomIn), dispenser.getCount(randomIn)); - } - - this.setBlockState(worldIn, Blocks.vine.getDefaultState().withProperty(BlockVine.EAST, Boolean.valueOf(true)), 8, -1, 3, structureBoundingBoxIn); diff --git a/src/main/java/net/minecraftforge/common/ChestGenHooks.java b/src/main/java/net/minecraftforge/common/ChestGenHooks.java deleted file mode 100644 index 8d2cc0a753..0000000000 --- a/src/main/java/net/minecraftforge/common/ChestGenHooks.java +++ /dev/null @@ -1,230 +0,0 @@ -package net.minecraftforge.common; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.WeightedRandom; -import net.minecraft.util.WeightedRandomChestContent; -import net.minecraft.world.WorldServer; -import net.minecraft.world.gen.feature.WorldGenDungeons; -import net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces.DesertPyramid; -import net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces.JunglePyramid; -import net.minecraft.world.gen.structure.StructureMineshaftPieces; -import net.minecraft.world.gen.structure.StructureNetherBridgePieces; -import net.minecraft.world.gen.structure.StructureOceanMonument; -import net.minecraft.world.gen.structure.StructureStrongholdPieces; -import net.minecraft.world.gen.structure.StructureVillagePieces; -import net.minecraftforge.oredict.OreDictionary; - -public class ChestGenHooks -{ - //Currently implemented categories for chests/dispensers, Dungeon loot is still in DungeonHooks - public static final String PYRAMID_JUNGLE_DISPENSER = "pyramidJungleDispenser"; // TODO: Convert to a Loot Table - public static final String BONUS_CHEST = "bonusChest"; - public static final String DUNGEON_CHEST = "dungeonChest"; - - private static final HashMap chestInfo = new HashMap(); - private static boolean hasInit = false; - static - { - init(); - } - - private static void init() - { - if (hasInit) - { - return; - } - - hasInit = true; - // This causes the classes static initializers to run - new WorldGenDungeons(); - new JunglePyramid(); - WorldServer.fillChestHook(); - } - - // INTERNAL DO NO USE - public static void init(String category, List items, int min, int max) - { - chestInfo.put(category, new ChestGenHooks(category, items, min, max)); - } - - static void addDungeonLoot(ChestGenHooks dungeon, ItemStack item, int weight, int min, int max) - { - dungeon.addItem(new WeightedRandomChestContent(item, min, max, weight)); - } - - /** - * Retrieves, or creates the info class for the specified category. - * - * @param category The category name - * @return A instance of ChestGenHooks for the specified category. - */ - public static ChestGenHooks getInfo(String category) - { - if (!chestInfo.containsKey(category)) - { - chestInfo.put(category, new ChestGenHooks(category)); - } - return chestInfo.get(category); - } - - /** - * Generates an array of items based on the input min/max count. - * If the stack can not hold the total amount, it will be split into - * stacks of size 1. - * - * @param rand A random number generator - * @param source Source item stack - * @param min Minimum number of items - * @param max Maximum number of items - * @return An array containing the generated item stacks - */ - public static ItemStack[] generateStacks(Random rand, ItemStack source, int min, int max) - { - int count = min + (rand.nextInt(max - min + 1)); - - ItemStack[] ret; - if (source.getItem() == null) - { - ret = new ItemStack[0]; - } - else if (count > source.getMaxStackSize()) - { - ret = new ItemStack[count]; - for (int x = 0; x < count; x++) - { - ret[x] = source.copy(); - ret[x].stackSize = 1; - } - } - else - { - ret = new ItemStack[1]; - ret[0] = source.copy(); - ret[0].stackSize = count; - } - return ret; - } - - //shortcut functions, See the non-static versions below - public static List getItems(String category, Random rnd){ return getInfo(category).getItems(rnd); } - public static int getCount(String category, Random rand){ return getInfo(category).getCount(rand); } - public static void addItem(String category, WeightedRandomChestContent item){ getInfo(category).addItem(item); } - public static void removeItem(String category, ItemStack item){ getInfo(category).removeItem(item); } - public static ItemStack getOneItem(String category, Random rand){ return getInfo(category).getOneItem(rand); } - - @SuppressWarnings("unused") - private String category; - private int countMin = 0; - private int countMax = 0; - private ArrayList contents = new ArrayList(); - - public ChestGenHooks(String category) - { - this.category = category; - } - - public ChestGenHooks(String category, List items, int min, int max) - { - this(category); - for (WeightedRandomChestContent item : items) - { - contents.add(item); - } - countMin = min; - countMax = max; - } - - /** - * Adds a new entry into the possible items to generate. - * - * @param item The item to add. - */ - public void addItem(WeightedRandomChestContent item) - { - contents.add(item); - } - - /** - * Removes all items that match the input item stack, Only metadata and item ID are checked. - * If the input item has a metadata of -1, all metadatas will match. - * - * @param item The item to check - */ - public void removeItem(ItemStack item) - { - Iterator itr = contents.iterator(); - while(itr.hasNext()) - { - WeightedRandomChestContent cont = itr.next(); - if (item.isItemEqual(cont.theItemId) || (item.getItemDamage() == OreDictionary.WILDCARD_VALUE && item.getItem() == cont.theItemId.getItem())) - { - itr.remove(); - } - } - } - - /** - * Gets an array of all random objects that are associated with this category. - * - * @return The random objects - */ - public List getItems(Random rnd) - { - ArrayList ret = new ArrayList(); - - for (WeightedRandomChestContent orig : contents) - { - Item item = orig.theItemId.getItem(); - - if (item != null) - { - WeightedRandomChestContent n = item.getChestGenBase(this, rnd, orig); - if (n != null) - { - ret.add(n); - } - } - } - - return ret; - } - - /** - * Gets a random number between countMin and countMax. - * - * @param rand A RNG - * @return A random number where countMin <= num <= countMax - */ - public int getCount(Random rand) - { - return countMin < countMax ? countMin + rand.nextInt(countMax - countMin) : countMin; - } - - /** - * Returns a single ItemStack from the possible items in this registry, - * Useful if you just want a quick and dirty random Item. - * - * @param rand A Random Number gen - * @return A single ItemStack, or null if it could not get one. - */ - public ItemStack getOneItem(Random rand) - { - WeightedRandomChestContent item = (WeightedRandomChestContent)WeightedRandom.getRandomItem(rand, getItems(rand)); - ItemStack[] stacks = ChestGenHooks.generateStacks(rand, item.theItemId, item.minStackSize, item.maxStackSize); - return (stacks.length > 0 ? stacks[0] : null); - } - - //Accessors - public int getMin(){ return countMin; } - public int getMax(){ return countMax; } - public void setMin(int value){ countMin = value; } - public void setMax(int value){ countMax = value; } -} diff --git a/src/main/java/net/minecraftforge/common/chunkio/ChunkIOProvider.java b/src/main/java/net/minecraftforge/common/chunkio/ChunkIOProvider.java index 8e7c904fdb..b7534633c9 100644 --- a/src/main/java/net/minecraftforge/common/chunkio/ChunkIOProvider.java +++ b/src/main/java/net/minecraftforge/common/chunkio/ChunkIOProvider.java @@ -45,11 +45,11 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider Date: Tue, 8 Mar 2016 23:49:19 -0500 Subject: [PATCH 059/243] Potion cleanup. Moar fixes! --- .../minecraft/potion/PotionEffect.java.patch | 37 ++++++++++++++- .../minecraft/potion/Potion.java.patch.rej | 46 ------------------- .../potion/PotionEffect.java.patch.rej | 39 ---------------- src/main/resources/forge_at.cfg | 2 + 4 files changed, 38 insertions(+), 86 deletions(-) delete mode 100644 rejects/minecraft/net/minecraft/potion/Potion.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch index ce1861eb1d..dd9931e561 100644 --- a/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ b/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch @@ -1,6 +1,41 @@ --- ../src-base/minecraft/net/minecraft/potion/PotionEffect.java +++ ../src-work/minecraft/net/minecraft/potion/PotionEffect.java -@@ -240,4 +240,53 @@ +@@ -19,6 +19,8 @@ + @SideOnly(Side.CLIENT) + private boolean isPotionDurationMax; + private boolean field_188421_h; ++ /** List of ItemStack that can cure the potion effect **/ ++ private java.util.List curativeItems; + + public PotionEffect(Potion p_i46811_1_) + { +@@ -42,6 +44,8 @@ + this.amplifier = p_i46814_3_; + this.isAmbient = p_i46814_4_; + this.field_188421_h = p_i46814_5_; ++ this.curativeItems = new java.util.ArrayList(); ++ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket)); + } + + public PotionEffect(PotionEffect other) +@@ -51,6 +55,7 @@ + this.amplifier = other.amplifier; + this.isAmbient = other.isAmbient; + this.field_188421_h = other.field_188421_h; ++ this.curativeItems = other.curativeItems; + } + + public void combine(PotionEffect other) +@@ -200,7 +205,7 @@ + + public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) + { +- int i = nbt.getByte("Id"); ++ int i = nbt.getByte("Id") & 0xFF; + Potion potion = Potion.func_188412_a(i); + + if (potion == null) +@@ -240,4 +245,53 @@ { return this.isPotionDurationMax; } diff --git a/rejects/minecraft/net/minecraft/potion/Potion.java.patch.rej b/rejects/minecraft/net/minecraft/potion/Potion.java.patch.rej deleted file mode 100644 index ccb6a70e3e..0000000000 --- a/rejects/minecraft/net/minecraft/potion/Potion.java.patch.rej +++ /dev/null @@ -1,46 +0,0 @@ -++++ REJECTED PATCH 1 - - public class Potion - { -- public static final Potion[] potionTypes = new Potion[32]; -+ public static final Potion[] potionTypes = new Potion[256]; - private static final Map field_180150_I = Maps.newHashMap(); - public static final Potion field_180151_b = null; - public static final Potion moveSpeed = (new Potion(1, new ResourceLocation("speed"), false, 8171462)).setPotionName("potion.moveSpeed").setIconIndex(0, 0).registerPotionAttributeModifier(SharedMonsterAttributes.movementSpeed, "91AEAA56-376B-4498-935B-2F7F68070635", 0.20000000298023224D, 2); -++++ END PATCH -++++ REJECTED PATCH 2 - private double effectiveness; - private boolean usable; - -+ @Deprecated // use the Constructor without potion ID or everything will explode. - protected Potion(int potionID, ResourceLocation location, boolean badEffect, int potionColor) - { -- this.id = potionID; -- potionTypes[potionID] = this; -+ net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().register(potionID, location, this); - field_180150_I.put(location, this); - this.isBadEffect = badEffect; - -++++ END PATCH -++++ REJECTED PATCH 3 - this.liquidColor = potionColor; - } - -+ protected Potion(ResourceLocation location, boolean badEffect, int potionColor) { -+ this(-1, location, badEffect, potionColor); -+ } -+ - public static Potion getPotionFromResourceLocation(String location) - { -- return (Potion)field_180150_I.get(new ResourceLocation(location)); -+ return net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().getObject(new ResourceLocation(location)); - } - - public static Set getPotionLocations() - { -- return field_180150_I.keySet(); -+ return net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().getKeys(); - } - - protected Potion setIconIndex(int p_76399_1_, int p_76399_2_) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej b/rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej deleted file mode 100644 index cc6804782b..0000000000 --- a/rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej +++ /dev/null @@ -1,39 +0,0 @@ -++++ REJECTED PATCH 1 - @SideOnly(Side.CLIENT) - private boolean isPotionDurationMax; - private boolean showParticles; -+ /** List of ItemStack that can cure the potion effect **/ -+ private java.util.List curativeItems; - - public PotionEffect(int id, int effectDuration) - { -++++ END PATCH -++++ REJECTED PATCH 2 - this.amplifier = effectAmplifier; - this.isAmbient = ambient; - this.showParticles = showParticles; -+ this.curativeItems = new java.util.ArrayList(); -+ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket)); - } - - public PotionEffect(PotionEffect other) -++++ END PATCH -++++ REJECTED PATCH 3 - this.amplifier = other.amplifier; - this.isAmbient = other.isAmbient; - this.showParticles = other.showParticles; -+ this.curativeItems = other.curativeItems; - } - - public void combine(PotionEffect other) -++++ END PATCH -++++ REJECTED PATCH 4 - - public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) - { -- int i = nbt.getByte("Id"); -+ int i = nbt.getByte("Id") & 0xff; - - if (i >= 0 && i < Potion.potionTypes.length && Potion.potionTypes[i] != null) - { -++++ END PATCH diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index 29fab7690f..b0672ad85c 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -32,6 +32,8 @@ public net.minecraft.item.Item func_77627_a(Z)Lnet.minecraft.item.Item; #setHasS #public net.minecraft.client.entity.EntityPlayerSP func_71012_a(Lnet/minecraft/entity/item/EntityItem;)V #joinEntityItemWithWorld public net.minecraft.entity.player.EntityPlayer func_71053_j()V #closeScreen #public uf.b #FD:EntityPlayer/field_71076_b #sleepTimer +# EntityTrackerEntry +public net.minecraft.entity.EntityTrackerEntry field_73134_o # trackingPlayers # World Gen Chests Related public net.minecraft.util.WeightedRandomChestContent * # Save Location From aa24916736d7e82bb9045c505f48b483a909f417 Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 9 Mar 2016 00:48:32 -0500 Subject: [PATCH 060/243] Finish world, chunkloading should work again? --- .../net/minecraft/world/World.java.patch | 6 ++++- .../minecraft/world/WorldServer.java.patch | 9 +++++++ .../net/minecraft/world/World.java.patch.rej | 9 ------- .../common/ForgeChunkManager.java | 25 +++++++++++++++++++ .../event/entity/player/PlayerDropsEvent.java | 2 +- 5 files changed, 40 insertions(+), 11 deletions(-) delete mode 100644 rejects/minecraft/net/minecraft/world/World.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/world/World.java.patch b/patches.mcp/minecraft/net/minecraft/world/World.java.patch index 1d0df9c775..b06145937f 100644 --- a/patches.mcp/minecraft/net/minecraft/world/World.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/World.java.patch @@ -792,7 +792,7 @@ } } } -@@ -3600,6 +3781,83 @@ +@@ -3600,6 +3781,87 @@ return i >= -k && i <= k && j >= -k && j <= k; } @@ -839,6 +839,10 @@ + return net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this); + } + ++ public Iterator getPersistentChunkIterable(Iterator chunkIterator) ++ { ++ return net.minecraftforge.common.ForgeChunkManager.getPersistentChunksIterableFor(this, chunkIterator); ++ } + /** + * Readded as it was removed, very useful helper function + * diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch index 0b06244efd..3c4eda1149 100644 --- a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch @@ -80,6 +80,15 @@ } public boolean areAllPlayersAsleep() +@@ -368,7 +380,7 @@ + boolean flag1 = this.isThundering(); + this.theProfiler.startSection("pollingChunks"); + +- for (Iterator iterator = this.thePlayerManager.func_187300_b(); iterator.hasNext(); this.theProfiler.endSection()) ++ for (Iterator iterator = getPersistentChunkIterable(this.thePlayerManager.func_187300_b()); iterator.hasNext(); this.theProfiler.endSection()) + { + this.theProfiler.startSection("getChunk"); + Chunk chunk = (Chunk)iterator.next(); @@ -380,7 +392,7 @@ chunk.func_150804_b(false); this.theProfiler.endStartSection("thunder"); diff --git a/rejects/minecraft/net/minecraft/world/World.java.patch.rej b/rejects/minecraft/net/minecraft/world/World.java.patch.rej deleted file mode 100644 index bc80f2388c..0000000000 --- a/rejects/minecraft/net/minecraft/world/World.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 40 - { - this.activeChunkSet.clear(); - this.theProfiler.startSection("buildList"); -+ this.activeChunkSet.addAll(getPersistentChunks().keySet()); - - for (int i = 0; i < this.playerEntities.size(); ++i) - { -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java index 8c52939d62..c5eb772a96 100644 --- a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java +++ b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java @@ -14,6 +14,10 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; + +import com.google.common.base.Function; +import com.google.common.collect.Iterables; +import com.google.common.collect.Iterators; import org.apache.logging.log4j.Level; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; @@ -54,6 +58,8 @@ import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import net.minecraftforge.common.util.Constants; +import javax.annotation.Nullable; + /** * Manages chunkloading for mods. * @@ -105,6 +111,25 @@ public class ForgeChunkManager MOD_PROP_ORDER.add("maximumChunksPerTicket"); } + public static Iterator getPersistentChunksIterableFor(final World world, Iterator chunkIterator) + { + final ImmutableSetMultimap persistentChunksFor = getPersistentChunksFor(world); + final ImmutableSet.Builder builder = ImmutableSet.builder(); + world.theProfiler.startSection("forcedChunkLoading"); + builder.addAll(Iterators.transform(persistentChunksFor.keys().iterator(), new Function() { + @Nullable + @Override + public Chunk apply(@Nullable ChunkCoordIntPair input) + { + return world.getChunkFromChunkCoords(input.chunkXPos, input.chunkZPos); + } + })); + world.theProfiler.endStartSection("regularChunkLoading"); + builder.addAll(chunkIterator); + world.theProfiler.endSection(); + return builder.build().iterator(); + } + /** * All mods requiring chunkloading need to implement this to handle the * re-registration of chunk tickets at world loading time diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerDropsEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerDropsEvent.java index d3f5246806..d9f12cadb2 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerDropsEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerDropsEvent.java @@ -31,7 +31,7 @@ public class PlayerDropsEvent extends LivingDropsEvent { super(entity, source, drops, (source.getEntity() instanceof EntityPlayer) ? - EnchantmentHelper.getLootingModifier(((EntityPlayer)source.getEntity())) : 0, + EnchantmentHelper.func_185283_h(((EntityPlayer)source.getEntity())) : 0, recentlyHit); this.entityPlayer = entity; From e8a7e281101c251023481ad27d74dbe8ab5144ca Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 9 Mar 2016 00:59:28 -0500 Subject: [PATCH 061/243] Another AT, for the player --- src/main/java/net/minecraftforge/event/ForgeEventFactory.java | 2 +- src/main/resources/forge_at.cfg | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index 32577b125e..6b0917d49c 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -366,7 +366,7 @@ public class ForgeEventFactory { for (EntityItem item : capturedDrops) { - player.joinEntityItemWithWorld(item); + player.func_184816_a(item); } } } diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index b0672ad85c..dbd1886383 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -172,6 +172,8 @@ public net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher fie public net.minecraft.client.renderer.EntityRenderer func_175069_a(Lnet/minecraft/util/ResourceLocation;)V #loadShader ## WeightedRandomItem public net.minecraft.util.WeightedRandom$Item field_76292_a #probability +# EntityPlayer +public net.minecraft.entity.player.EntityPlayer func_184816_a(Lnet/minecraft/entity/item/EntityItem;)Lnet/minecraft/item/ItemStack; # dropItemAndGetStack ## EntityPlayerMP getNextWindowId public net.minecraft.entity.player.EntityPlayerMP func_71117_bO()V public net.minecraft.entity.player.EntityPlayerMP field_71139_cq From 846910b8c8755fc66b123af02ba4b467164033ee Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 9 Mar 2016 01:08:42 -0500 Subject: [PATCH 062/243] Fix up PlayerSP for the AT --- src/main/resources/forge_at.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index dbd1886383..534b145cd4 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -174,6 +174,8 @@ public net.minecraft.client.renderer.EntityRenderer func_175069_a(Lnet/minecraft public net.minecraft.util.WeightedRandom$Item field_76292_a #probability # EntityPlayer public net.minecraft.entity.player.EntityPlayer func_184816_a(Lnet/minecraft/entity/item/EntityItem;)Lnet/minecraft/item/ItemStack; # dropItemAndGetStack +# EntityPlayerSP +public net.minecraft.client.entity.EntityPlayerSP func_184816_a(Lnet/minecraft/entity/item/EntityItem;)Lnet/minecraft/item/ItemStack; # dropItemAndGetStack ## EntityPlayerMP getNextWindowId public net.minecraft.entity.player.EntityPlayerMP func_71117_bO()V public net.minecraft.entity.player.EntityPlayerMP field_71139_cq From 7b7156e87fccfa402b640ea63851a21d797202b0 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 9 Mar 2016 14:11:56 -0800 Subject: [PATCH 063/243] Interaction hooks need to be re-added but compiles {Doesn't run} --- .../client/renderer/ItemRenderer.java.patch | 4 +- .../entity/player/EntityPlayer.java.patch | 2 +- .../client/ForgeHooksClient.java | 12 +- .../client/model/ModelLoader.java | 4 +- .../net/minecraftforge/common/ForgeHooks.java | 8 +- .../entity/player/PlayerDestroyItemEvent.java | 2 +- .../items/wrapper/PlayerArmorInvWrapper.java | 12 +- .../debug/NoPotionEffectRenderTest.java | 8 +- .../debug/PotionRegistryDebug.java | 48 ++++---- .../test/ClientCommandTest.java | 4 +- .../test/NoBedSleepingTest.java | 106 ++++++++++++------ 11 files changed, 136 insertions(+), 74 deletions(-) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index 0b1fdfb9bb..ec372f4e72 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -51,8 +51,8 @@ float f = entityplayersp.func_184825_o(1.0F); - this.field_187469_f += MathHelper.clamp_float((Objects.equal(this.field_187467_d, itemstack) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); - this.field_187471_h += MathHelper.clamp_float((float)(Objects.equal(this.field_187468_e, itemstack1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); -+ this.field_187469_f += MathHelper.clamp_float((net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187467_d, itemstack) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); -+ this.field_187471_h += MathHelper.clamp_float((float)(net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187468_e, itemstack1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); ++ this.field_187469_f += MathHelper.clamp_float((net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187467_d, itemstack, entityplayersp.inventory.currentItem) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); ++ this.field_187471_h += MathHelper.clamp_float((float)(net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187468_e, itemstack1, -1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); } if (this.field_187469_f < 0.1F) diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index 4532e82c38..e347436882 100644 --- a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -107,7 +107,7 @@ public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem) @@ -746,15 +773,22 @@ - protected ItemStack func_184816_a(EntityItem p_184816_1_) + public ItemStack func_184816_a(EntityItem p_184816_1_) { + if (captureDrops) capturedDrops.add(p_184816_1_); + else // Forge: Don't indent to keep patch smaller. diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index c98196d543..4ead4cae4f 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -604,13 +604,19 @@ public class ForgeHooksClient return (new SimpleBakedModel.Builder(state, ibakedmodel, texture, pos)).makeBakedModel(); } - public static boolean shouldCauseReequipAnimation(ItemStack from, ItemStack to) + private static int slotMainHand = 0; + public static boolean shouldCauseReequipAnimation(ItemStack from, ItemStack to, int slot) { if(!Objects.equal(from, to) || from == null) { return false; } - // FIXME: 3rd argument? - return from.getItem().shouldCauseReequipAnimation(from, to); + boolean changed = false; + if (slot != -1) + { + changed = slot != slotMainHand; + slotMainHand = slot; + } + return from.getItem().shouldCauseReequipAnimation(from, to, changed); } } diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 77de53614a..0c3ea9f1e3 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -249,7 +249,7 @@ public class ModelLoader extends ModelBakery } registerVariantNames(); - + List itemVariants = Lists.newArrayList(); for(Item item : GameData.getItemRegistry().typeSafeIterable()) { @@ -560,7 +560,7 @@ public class ModelLoader extends ModelBakery return bakeNormal(model, perState, state.apply(Optional.absent()).or(TRSRTransformation.identity()), newTransforms, format, bakedTextureGetter, uvlock); } - private IBakedModel bakeNormal(ModelBlock model, IModelState perState, final TRSRTransformation modelState, List newTransforms, VertexFormat format, final Function bakedTextureGetter, boolean uvLocked) + private IBakedModel bakeNormal(ModelBlock model, IModelState perState, final TRSRTransformation modelState, List newTransforms, final VertexFormat format, final Function bakedTextureGetter, boolean uvLocked) { TextureAtlasSprite particle = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName("particle"))); SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(model, model.func_187967_g())).setTexture(particle); diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 405e2249c8..cecc177a68 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -656,7 +656,7 @@ public class ForgeHooks { // Logic from tryHarvestBlock for pre-canceling the event boolean preCancelEvent = false; - if (gameType.isCreative() && entityPlayer.getHeldItem() != null && entityPlayer.getHeldItem().getItem() instanceof ItemSword) + if (gameType.isCreative() && entityPlayer.func_184614_ca() != null && entityPlayer.func_184614_ca().getItem() instanceof ItemSword) preCancelEvent = true; if (gameType.isAdventure()) @@ -666,7 +666,7 @@ public class ForgeHooks if (!entityPlayer.isAllowEdit()) { - ItemStack itemstack = entityPlayer.getCurrentEquippedItem(); + ItemStack itemstack = entityPlayer.func_184614_ca(); if (itemstack == null || !itemstack.canDestroy(world.getBlockState(pos).getBlock())) preCancelEvent = true; } @@ -865,7 +865,7 @@ public class ForgeHooks stack = stack.getItem().getContainerItem(stack); if (stack != null && stack.isItemStackDamageable() && stack.getMetadata() > stack.getMaxDamage()) { - MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(craftingPlayer.get(), stack)); + ForgeEventFactory.onPlayerDestroyItem(craftingPlayer.get(), stack, null); return null; } return stack; @@ -904,7 +904,7 @@ public class ForgeHooks public static boolean onPlayerAttackTarget(EntityPlayer player, Entity target) { if (MinecraftForge.EVENT_BUS.post(new AttackEntityEvent(player, target))) return false; - ItemStack stack = player.getCurrentEquippedItem(); + ItemStack stack = player.func_184614_ca(); if (stack != null && stack.getItem().onLeftClickEntity(stack, player, target)) return false; return true; } diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java index 65fe0a1663..69de7e6194 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java @@ -27,7 +27,7 @@ import net.minecraft.util.EnumHand; public class PlayerDestroyItemEvent extends PlayerEvent { private final ItemStack original; - private final EnumHand hand; + private final EnumHand hand; // May be null if this player destroies the item by any use besides holding it. public PlayerDestroyItemEvent(EntityPlayer player, ItemStack original, EnumHand hand) { super(player); diff --git a/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java index d440f3892d..c0df1e3055 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java @@ -1,6 +1,7 @@ package net.minecraftforge.items.wrapper; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; public class PlayerArmorInvWrapper extends InvWrapper @@ -31,8 +32,17 @@ public class PlayerArmorInvWrapper extends InvWrapper @Override public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { + EntityEquipmentSlot equ = null; + for (EntityEquipmentSlot s : EntityEquipmentSlot.values()) + { + if (s.func_188453_a() == EntityEquipmentSlot.Type.ARMOR && s.func_188454_b() == slot) + { + equ = s; + break; + } + } // check if it's valid for the armor slot - if (slot < 4 && stack != null && stack.getItem().isValidArmor(stack, 3 - slot, inventoryPlayer.player)) + if (slot < 4 && stack != null && stack.getItem().isValidArmor(stack, equ, inventoryPlayer.player)) { return super.insertItem(slot + offset, stack, simulate); } diff --git a/src/test/java/net/minecraftforge/debug/NoPotionEffectRenderTest.java b/src/test/java/net/minecraftforge/debug/NoPotionEffectRenderTest.java index f8d779140d..2bb868cb76 100644 --- a/src/test/java/net/minecraftforge/debug/NoPotionEffectRenderTest.java +++ b/src/test/java/net/minecraftforge/debug/NoPotionEffectRenderTest.java @@ -5,6 +5,7 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.registry.GameData; @Mod( modid = NoPotionEffectRenderTest.modID, name = "No Potion Effect Render Test", version = "0.0.0" ) public class NoPotionEffectRenderTest { @@ -12,13 +13,14 @@ public class NoPotionEffectRenderTest { @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { - TestPotion INSTANCE = new TestPotion(30, new ResourceLocation(modID, "test_potion"), false, 0xff00ff); + TestPotion INSTANCE = new TestPotion(new ResourceLocation(modID, "test_potion"), false, 0xff00ff); + GameData.getPotionRegistry().register(-1, new ResourceLocation(modID, "test_potion"), INSTANCE); } public static class TestPotion extends Potion { - public TestPotion(int potionID, ResourceLocation location, boolean badEffect, int potionColor) { - super(potionID, location, badEffect, potionColor); + public TestPotion(ResourceLocation location, boolean badEffect, int potionColor) { + super(badEffect, potionColor); } @Override diff --git a/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java b/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java index 460567bea5..bcd958d877 100644 --- a/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java +++ b/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java @@ -6,13 +6,18 @@ import gnu.trove.set.hash.TIntHashSet; import java.util.Random; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +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.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.registry.GameData; @Mod(modid=PotionRegistryDebug.MODID) public class PotionRegistryDebug { @@ -20,8 +25,10 @@ public class PotionRegistryDebug { @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { - new PotionForge(new ResourceLocation("forge", "forge"), false, 0xff00ff); // test automatic id distribution - new PotionForge(200, new ResourceLocation("forge", "forgy"), true, 0x00ff00); // test that ids above 127 work + Potion forge = new PotionForge(new ResourceLocation("forge", "forge"), false, 0xff00ff); // test automatic id distribution + Potion forgy = new PotionForge(new ResourceLocation("forge", "forgy"), true, 0x00ff00); // test that ids above 127 work + GameData.getPotionRegistry().register(-1, new ResourceLocation("forge", "forge"), forge); //TODo: Generic this out in GameRegistry, 'RegistryEntry' base type? + GameData.getPotionRegistry().register(200, new ResourceLocation("forge", "forgy"), forgy); Random rand = new Random(); TIntSet taken = new TIntHashSet(100); @@ -29,7 +36,7 @@ public class PotionRegistryDebug { taken.add(ra); // a new potion with a random id so that forge has to remap it - new PotionForge(ra, new ResourceLocation("forge", "realRandomPotion"), false, 0x0000ff); + //new PotionForge(ra, new ResourceLocation("forge", "realRandomPotion"), false, 0x0000ff); for(int i = 0; i < 20; i++) { int r = rand.nextInt(200) + 35; @@ -39,25 +46,19 @@ public class PotionRegistryDebug { taken.add(r); // this potions will most likely not have the same IDs between server and client. // The forge handshake on connect should fix this. - new PotionForge(r, new ResourceLocation("forge", "randomPotion" + r), false, 0xff00ff); + //new PotionForge(new ResourceLocation("forge", "randomPotion" + r), false, 0xff00ff); } } protected class PotionForge extends Potion { - - public PotionForge(int potionID, ResourceLocation location, boolean badEffect, int potionColor) { - super(potionID, location, badEffect, potionColor); - setPotionName("potion." + location.getResourcePath()); - } - protected PotionForge(ResourceLocation location, boolean badEffect, int potionColor) { - super(location, badEffect, potionColor); + super(badEffect, potionColor); setPotionName("potion." + location.getResourcePath()); } @Override public void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc) { - Potion potion = Potion.potionTypes[effect.getPotionID()]; + Potion potion = effect.func_188419_a(); mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite("minecraft:blocks/fire_layer_0"); @@ -67,16 +68,21 @@ public class PotionRegistryDebug { int width = 18; int height = width; -/* + + float r = (float)(potion.getLiquidColor() >> 24 & 255) / 255.0F; + float g = (float)(potion.getLiquidColor() >> 16 & 255) / 255.0F; + float b = (float)(potion.getLiquidColor() >> 8 & 255) / 255.0F; + float a = (float)(potion.getLiquidColor() & 255) / 255.0F; + Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer VertexBuffer = tessellator.getVertexBuffer(); - VertexBuffer.startDrawingQuads(); - VertexBuffer.setColorOpaque_I(potion.getLiquidColor()); - VertexBuffer.addVertexWithUV((double) x, (double) (y + height), 0.0D, sprite.getMinU(), sprite.getMaxV()); - VertexBuffer.addVertexWithUV((double)(x + width), (double)(y + height), 0.0D, sprite.getMaxU(), sprite.getMaxV()); - VertexBuffer.addVertexWithUV((double)(x + width), (double)y, 0.0D, sprite.getMaxU(), sprite.getMinV()); - VertexBuffer.addVertexWithUV((double)x, (double)y, 0.0D, sprite.getMinU(), sprite.getMinV()); - tessellator.draw();*/ + VertexBuffer buf = tessellator.getWorldRenderer(); + buf.begin(7, DefaultVertexFormats.POSITION_TEX); + GlStateManager.color(r, g, b, a); + buf.pos((double) x, (double)(y + height), 0.0D).func_187315_a(sprite.getMinU(), sprite.getMaxV()).endVertex(); + buf.pos((double)(x + width), (double)(y + height), 0.0D).func_187315_a(sprite.getMaxU(), sprite.getMaxV()).endVertex(); + buf.pos((double)(x + width), (double) y, 0.0D).func_187315_a(sprite.getMaxU(), sprite.getMinV()).endVertex(); + buf.pos((double) x, (double) y, 0.0D).func_187315_a(sprite.getMinU(), sprite.getMinV()).endVertex(); + tessellator.draw(); } } } diff --git a/src/test/java/net/minecraftforge/test/ClientCommandTest.java b/src/test/java/net/minecraftforge/test/ClientCommandTest.java index 3d8157e3f6..6e4a1d2e34 100644 --- a/src/test/java/net/minecraftforge/test/ClientCommandTest.java +++ b/src/test/java/net/minecraftforge/test/ClientCommandTest.java @@ -37,13 +37,13 @@ public class ClientCommandTest { } @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) + public boolean func_184882_a(MinecraftServer server, ICommandSender sender) { return true; } @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + public List func_184883_a(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { if (args.length > 0) { diff --git a/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java b/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java index c231fcd2cf..88ea98dc39 100644 --- a/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java +++ b/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java @@ -1,16 +1,26 @@ package net.minecraftforge.test; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer.EnumStatus; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTBase.NBTPrimitive; +import net.minecraft.nbt.NBTTagByte; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; -import net.minecraftforge.common.IExtendedEntityProperties; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.EntityEvent.EntityConstructing; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityInject; +import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.common.capabilities.ICapabilitySerializable; +import net.minecraftforge.common.capabilities.Capability.IStorage; +import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; import net.minecraftforge.event.entity.player.SleepingLocationCheckEvent; import net.minecraftforge.fml.common.Mod; @@ -24,64 +34,90 @@ public class NoBedSleepingTest { public static final String MODID = "ForgeDebugNoBedSleeping"; public static final String VERSION = "1.0"; + @CapabilityInject(IExtraSleeping.class) + private static final Capability SLEEP_CAP = null; @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { GameRegistry.registerItem(ItemSleepingPill.instance, ItemSleepingPill.name); + CapabilityManager.INSTANCE.register(IExtraSleeping.class, new Storage(), DefaultImpl.class); MinecraftForge.EVENT_BUS.register(new EventHandler()); } public static class EventHandler { @SubscribeEvent - public void onEntityConstruct(EntityConstructing evt) + public void onEntityConstruct(AttachCapabilitiesEvent evt) { - evt.entity.registerExtendedProperties(ExtendedPropertySleeping.name, new ExtendedPropertySleeping()); + evt.addCapability(new ResourceLocation(MODID, "IExtraSleeping"), new ICapabilitySerializable() + { + IExtraSleeping inst = SLEEP_CAP.getDefaultInstance(); + @Override + public boolean hasCapability(Capability capability, EnumFacing facing) { + return capability == SLEEP_CAP; + } + + @SuppressWarnings("unchecked") + @Override + public T getCapability(Capability capability, EnumFacing facing) { + return capability == SLEEP_CAP ? (T)inst : null; + } + + @Override + public NBTPrimitive serializeNBT() { + return (NBTPrimitive)SLEEP_CAP.getStorage().writeNBT(SLEEP_CAP, inst, null); + } + + @Override + public void deserializeNBT(NBTPrimitive nbt) { + SLEEP_CAP.getStorage().readNBT(SLEEP_CAP, inst, null, nbt); + } + }); } @SubscribeEvent public void onBedCheck(SleepingLocationCheckEvent evt) { - final IExtendedEntityProperties property = evt.entityPlayer.getExtendedProperties(ExtendedPropertySleeping.name); - if (property instanceof ExtendedPropertySleeping && ((ExtendedPropertySleeping) property).isSleeping) + final IExtraSleeping sleep = evt.entityPlayer.getCapability(SLEEP_CAP, null); + if (sleep != null && sleep.isSleeping()) evt.setResult(Result.ALLOW); } @SubscribeEvent public void onWakeUp(PlayerWakeUpEvent evt) { - final IExtendedEntityProperties property = evt.entityPlayer.getExtendedProperties(ExtendedPropertySleeping.name); - if (property instanceof ExtendedPropertySleeping) - ((ExtendedPropertySleeping) property).isSleeping = false; + final IExtraSleeping sleep = evt.entityPlayer.getCapability(SLEEP_CAP, null); + if (sleep != null) + sleep.setSleeping(false); } } - public static class ExtendedPropertySleeping implements IExtendedEntityProperties + public interface IExtraSleeping { + boolean isSleeping(); + void setSleeping(boolean value); + } + + public static class Storage implements IStorage { - private static final String TAG_NAME = "IsSleepingExt"; - - public static final String name = "is_sleeping"; - - public boolean isSleeping; - @Override - public void saveNBTData(NBTTagCompound compound) + public NBTBase writeNBT(Capability capability, IExtraSleeping instance, EnumFacing side) { - compound.setBoolean(TAG_NAME, isSleeping); + return new NBTTagByte((byte)(instance.isSleeping() ? 1 : 0)); } @Override - public void loadNBTData(NBTTagCompound compound) - { - this.isSleeping = compound.getBoolean(TAG_NAME); - } - - @Override - public void init(Entity entity, World world) + public void readNBT(Capability capability, IExtraSleeping instance, EnumFacing side, NBTBase nbt) { + instance.setSleeping(((NBTPrimitive)nbt).getByte() == 1); } + } + public static class DefaultImpl implements IExtraSleeping + { + private boolean isSleeping = false; + @Override public boolean isSleeping() { return isSleeping; } + @Override public void setSleeping(boolean value) { this.isSleeping = value; } } public static class ItemSleepingPill extends Item @@ -95,19 +131,21 @@ public class NoBedSleepingTest setUnlocalizedName(MODID + ":" + name); } - public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + @Override + public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) { - if (!worldIn.isRemote) + if (!world.isRemote) { - final EnumStatus result = playerIn.trySleep(playerIn.getPosition()); + final EnumStatus result = player.trySleep(player.getPosition()); if (result == EnumStatus.OK) { - final IExtendedEntityProperties property = playerIn.getExtendedProperties(ExtendedPropertySleeping.name); - if (property instanceof ExtendedPropertySleeping) - ((ExtendedPropertySleeping) property).isSleeping = true; + final IExtraSleeping sleep = player.getCapability(SLEEP_CAP, null); + if (sleep != null) + sleep.setSleeping(true); + return ActionResult.newResult(EnumActionResult.SUCCESS, stack); } } - return itemStackIn; + return ActionResult.newResult(EnumActionResult.PASS, stack); } } } From 90b2c86a9fd8b0333220239fc1c001ac3d3f6ec6 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 9 Mar 2016 14:41:13 -0800 Subject: [PATCH 064/243] Added bypass functions to Defaulted registry, DO NOT USE THIS MODDERS FORGE INTERNAL ONLY. And some other fixups for running. --- .../minecraft/potion/PotionEffect.java.patch | 24 ++++++++----------- ...egistryNamespacedDefaultedByKey.java.patch | 14 +++++++++++ .../FMLControlledNamespacedRegistry.java | 2 +- .../debug/ForgeBlockStatesLoaderDebug.java | 4 ++-- 4 files changed, 27 insertions(+), 17 deletions(-) create mode 100644 patches.mcp/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java.patch diff --git a/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch index dd9931e561..c89501ebfc 100644 --- a/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ b/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch @@ -9,16 +9,7 @@ public PotionEffect(Potion p_i46811_1_) { -@@ -42,6 +44,8 @@ - this.amplifier = p_i46814_3_; - this.isAmbient = p_i46814_4_; - this.field_188421_h = p_i46814_5_; -+ this.curativeItems = new java.util.ArrayList(); -+ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket)); - } - - public PotionEffect(PotionEffect other) -@@ -51,6 +55,7 @@ +@@ -51,6 +53,7 @@ this.amplifier = other.amplifier; this.isAmbient = other.isAmbient; this.field_188421_h = other.field_188421_h; @@ -26,7 +17,7 @@ } public void combine(PotionEffect other) -@@ -200,7 +205,7 @@ +@@ -200,7 +203,7 @@ public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) { @@ -35,7 +26,7 @@ Potion potion = Potion.func_188412_a(i); if (potion == null) -@@ -240,4 +245,53 @@ +@@ -240,4 +243,58 @@ { return this.isPotionDurationMax; } @@ -47,6 +38,11 @@ + */ + public java.util.List getCurativeItems() + { ++ if (this.curativeItems == null) //Lazy load this so that we don't create a circular dep on Items. ++ { ++ this.curativeItems = new java.util.ArrayList(); ++ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket)); ++ } + return this.curativeItems; + } + @@ -57,7 +53,7 @@ + */ + public boolean isCurativeItem(net.minecraft.item.ItemStack stack) + { -+ for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) ++ for (net.minecraft.item.ItemStack curativeItem : this.getCurativeItems()) + { + if (curativeItem.isItemEqual(stack)) + { @@ -85,7 +81,7 @@ + { + if (!this.isCurativeItem(stack)) + { -+ this.curativeItems.add(stack); ++ this.getCurativeItems().add(stack); + } + } } diff --git a/patches.mcp/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java.patch b/patches.mcp/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java.patch new file mode 100644 index 0000000000..ad6c8d499f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java ++++ ../src-work/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java +@@ -57,4 +57,11 @@ + V v = super.func_186801_a(p_186801_1_); + return (V)(v == null ? this.defaultValue : v); + } ++ ++ //Bypass functions to allow querying this registry WITHOUT getting the defaulted value. ++ // MODDERS DO NOT USE THIS IS FOR FORGE INTERNAL CHECKS ++ public int getIDForObjectBypass(V bypass) { return super.getIDForObject(bypass); } ++ public K getNameForObjectBypass(V value) { return super.getNameForObject(value); } ++ public V getObjectBypass(K name) { return super.getObject(name); } ++ public V getObjectByIdBypass(int id){ return super.getObjectById(id); } + } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index b18c2cf51c..95145a0fd4 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -276,7 +276,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul */ public int getId(I thing) { - return getIDForObject(thing); + return getIDForObjectBypass(thing); } /** diff --git a/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java b/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java index 9c34e9fca7..f8de9ec2fb 100644 --- a/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java +++ b/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java @@ -122,8 +122,8 @@ public class ForgeBlockStatesLoaderDebug { } public static enum CustomVariant implements IStringSerializable { - TypeA, - TypeB; + type_a, + type_b; public String getName() { return this.toString(); }; } From e4da09df2a1aa52c7a1934e372e71a3e32dd3823 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 9 Mar 2016 14:52:32 -0800 Subject: [PATCH 065/243] Bump version info. Rather important. --- .../net/minecraftforge/common/ForgeVersion.java | 16 ++++++---------- .../net/minecraftforge/fml/common/Loader.java | 6 +++--- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/main/java/net/minecraftforge/common/ForgeVersion.java b/src/main/java/net/minecraftforge/common/ForgeVersion.java index 35ee2385d3..9660989000 100644 --- a/src/main/java/net/minecraftforge/common/ForgeVersion.java +++ b/src/main/java/net/minecraftforge/common/ForgeVersion.java @@ -31,17 +31,17 @@ import net.minecraftforge.fml.common.versioning.ComparableVersion; public class ForgeVersion { //This number is incremented every time we remove deprecated code/major API changes, never reset - public static final int majorVersion = 11; + public static final int majorVersion = 12; //This number is incremented every minecraft release, never reset - public static final int minorVersion = 15; + public static final int minorVersion = 16; //This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version - public static final int revisionVersion = 1; + public static final int revisionVersion = 0; //This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code. public static final int buildVersion = 0; // This is the minecraft version we're building for - used in various places in Forge/FML code - public static final String mcVersion = "1.8.9"; + public static final String mcVersion = "1.9"; // This is the MCP data version we're using - public static final String mcpVersion = "9.19"; + public static final String mcpVersion = "9.23"; @SuppressWarnings("unused") private static Status status = PENDING; @SuppressWarnings("unused") @@ -239,16 +239,12 @@ public class ForgeVersion } // Gather a list of mods that have opted in to this update system by providing a URL. - // Small hack needed to support a interface change until we force a recompile. public static Map gatherMods() { Map ret = new HashMap(); for (ModContainer mod : Loader.instance().getActiveModList()) { - URL url = null; - try { - url = mod.getUpdateUrl(); - } catch (AbstractMethodError abs) { } //TODO: Remove this in 1.8.8+? + URL url = mod.getUpdateUrl(); if (url != null) ret.put(mod, url); } diff --git a/src/main/java/net/minecraftforge/fml/common/Loader.java b/src/main/java/net/minecraftforge/fml/common/Loader.java index 51e3e153cb..157b27d3af 100644 --- a/src/main/java/net/minecraftforge/fml/common/Loader.java +++ b/src/main/java/net/minecraftforge/fml/common/Loader.java @@ -113,7 +113,7 @@ import com.google.gson.JsonParser; @SuppressWarnings("unused") public class Loader { - public static final String MC_VERSION = "1.8.9"; + public static final String MC_VERSION = net.minecraftforge.common.ForgeVersion.mcVersion; private static final Splitter DEPENDENCYPARTSPLITTER = Splitter.on(":").omitEmptyStrings().trimResults(); private static final Splitter DEPENDENCYSPLITTER = Splitter.on(";").omitEmptyStrings().trimResults(); /** @@ -705,7 +705,7 @@ public class Loader // before elements are things we are loaded before (so they are our dependants) if ("required-before".equals(instruction) || "before".equals(instruction)) { - dependants.add(VersionParser.parseVersionReference(target)); + dependants.add(VersionParser.parseVersionReference(target)); } // after elements are things that load before we do (so they are out dependencies) else if ("required-after".equals(instruction) || "after".equals(instruction)) @@ -984,7 +984,7 @@ public class Loader public void fireRemapEvent(Map remapBlocks, Map remapItems, boolean isFreezing) { - modController.propogateStateMessage(new FMLModIdMappingEvent(remapBlocks, remapItems, isFreezing)); + modController.propogateStateMessage(new FMLModIdMappingEvent(remapBlocks, remapItems, isFreezing)); } public void runtimeDisableMod(String modId) From 873899a62baa77fb97e9fbc6d730a30b1c9e66be Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 9 Mar 2016 15:15:52 -0800 Subject: [PATCH 066/243] Fixed position being shifted before being sent to shouldSideBeRendered. --- patches.mcp/minecraft/net/minecraft/block/Block.java.patch | 2 +- .../client/model/pipeline/ForgeBlockModelRenderer.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch index 4798efd86d..6cf1659ec8 100644 --- a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch @@ -74,7 +74,7 @@ } - return !pos.getBlockState(side.offset(p_176225_4_)).func_185914_p(); -+ return !pos.getBlockState(side.offset(p_176225_4_)).doesSideBlockRendering(pos, side, p_176225_4_); ++ return !pos.getBlockState(side.offset(p_176225_4_)).doesSideBlockRendering(pos, side.offset(p_176225_4_), p_176225_4_.getOpposite()); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java b/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java index cb4635dcfc..f7a79cd299 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java @@ -110,7 +110,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer quads = model.func_188616_a(state, side, rand); if(!quads.isEmpty()) { - if(!checkSides || state.func_185894_c(world, pos.offset(side), side)) + if(!checkSides || state.func_185894_c(world, pos, side)) { if(empty) lighter.updateBlockInfo(); empty = false; From 173cec4149e5f21a6813d3bc1aa41a026b4bd279 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 10 Mar 2016 03:38:58 +0300 Subject: [PATCH 067/243] Fix perspective transformations for left-handed items, disable ModelAnimationDebug until model loading is fixed. --- .../net/minecraft/client/renderer/RenderItem.java.patch | 4 ++-- .../client/renderer/entity/RenderEntityItem.java.patch | 4 ++-- .../java/net/minecraftforge/client/ForgeHooksClient.java | 9 ++++++--- .../net/minecraftforge/debug/ModelAnimationDebug.java | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch index 08d107de7e..4b085ab179 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch @@ -44,7 +44,7 @@ - ItemCameraTransforms itemcameratransforms = p_184394_2_.getItemCameraTransforms(); - ItemCameraTransforms.func_188034_a(itemcameratransforms.getTransform(p_184394_3_), p_184394_4_); + // TODO: check if negative scale is a thing -+ p_184394_2_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_184394_2_, p_184394_3_); ++ p_184394_2_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_184394_2_, p_184394_3_, p_184394_4_); - if (this.func_183005_a(itemcameratransforms.getTransform(p_184394_3_))) - { @@ -59,7 +59,7 @@ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.setupGuiTransform(p_184390_2_, p_184390_3_, p_184390_4_.isGui3d()); - p_184390_4_.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GUI); -+ p_184390_4_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_184390_4_, ItemCameraTransforms.TransformType.GUI); ++ p_184390_4_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_184390_4_, ItemCameraTransforms.TransformType.GUI, false); this.renderItem(p_184390_1_, p_184390_4_); GlStateManager.disableAlpha(); GlStateManager.disableRescaleNormal(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch index c045d35453..b58a69c6de 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch @@ -38,7 +38,7 @@ } - ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); -+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND); ++ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); this.itemRenderer.renderItem(itemstack, ibakedmodel); GlStateManager.popMatrix(); } @@ -47,7 +47,7 @@ } - ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); -+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND); ++ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); this.itemRenderer.renderItem(itemstack, ibakedmodel); GlStateManager.popMatrix(); - GlStateManager.translate(0.0F * f, 0.0F * f1, 0.09375F * f2); diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 4ead4cae4f..41c4343a59 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -90,7 +90,6 @@ import com.google.common.base.Objects; import com.google.common.base.Optional; import com.google.common.collect.Maps; -@SuppressWarnings("deprecation") public class ForgeHooksClient { //private static final ResourceLocation ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png"); @@ -360,6 +359,7 @@ public class ForgeHooksClient modelLoader.onPostBakeEvent(modelRegistry); } + @SuppressWarnings("deprecation") public static Matrix4f getMatrix(ItemTransformVec3f transform) { javax.vecmath.Matrix4f m = new javax.vecmath.Matrix4f(), t = new javax.vecmath.Matrix4f(); @@ -382,10 +382,12 @@ public class ForgeHooksClient return m; } - public static IBakedModel handleCameraTransforms(IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType) + @SuppressWarnings("deprecation") + public static IBakedModel handleCameraTransforms(IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, boolean leftHandHackery) { if(model instanceof IPerspectiveAwareModel) { + // FIXME: left hand hackery Pair pair = ((IPerspectiveAwareModel)model).handlePerspective(cameraTransformType); if(pair.getRight() != null) multiplyCurrentGlMatrix(pair.getRight()); @@ -393,7 +395,7 @@ public class ForgeHooksClient } else { - model.getItemCameraTransforms().applyTransform(cameraTransformType); + ItemCameraTransforms.func_188034_a(model.getItemCameraTransforms().getTransform(cameraTransformType), leftHandHackery); } return model; } @@ -573,6 +575,7 @@ public class ForgeHooksClient } } + @SuppressWarnings("deprecation") public static Optional applyTransform(ItemTransformVec3f transform, Optional part) { if(part.isPresent()) return Optional.absent(); diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index 8eab7e65e6..d1b1ecaf3a 100644 --- a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -64,7 +64,7 @@ import org.apache.commons.lang3.tuple.Pair; import com.google.common.collect.ImmutableMap; -@Mod(modid = ModelAnimationDebug.MODID, version = ModelAnimationDebug.VERSION) +//@Mod(modid = ModelAnimationDebug.MODID, version = ModelAnimationDebug.VERSION) public class ModelAnimationDebug { public static final String MODID = "forgedebugmodelanimation"; From 301d4b9fa0a6ef920524bd50b8eb7e40ebb36645 Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 9 Mar 2016 19:59:30 -0500 Subject: [PATCH 068/243] Fix race condition between server ticks and the netlogin code handshaking for FML --- .../network/NetHandlerPlayServer.java.patch | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch index 2facd3bb90..6af352b365 100644 --- a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -1,6 +1,14 @@ --- ../src-base/minecraft/net/minecraft/network/NetHandlerPlayServer.java +++ ../src-work/minecraft/net/minecraft/network/NetHandlerPlayServer.java -@@ -612,7 +612,10 @@ +@@ -159,6 +159,7 @@ + + public void update() + { ++ if (this.playerEntity.playerNetServerHandler != this) return; // FORGE: sometimes the netqueue will tick while login is occuring, causing an NPE. We shouldn't tick until the connection is complete + this.func_184342_d(); + this.playerEntity.onUpdateEntity(); + this.playerEntity.setPositionAndRotation(this.field_184349_l, this.field_184350_m, this.field_184351_n, this.playerEntity.rotationYaw, this.playerEntity.rotationPitch); +@@ -612,7 +613,10 @@ double d2 = this.playerEntity.posZ - ((double)blockpos.getZ() + 0.5D); double d3 = d0 * d0 + d1 * d1 + d2 * d2; @@ -12,7 +20,7 @@ { return; } -@@ -670,7 +673,9 @@ +@@ -670,7 +674,9 @@ if (blockpos.getY() < this.serverController.getBuildLimit() - 1 || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit()) { @@ -23,7 +31,7 @@ { this.playerEntity.theItemInWorldManager.func_187251_a(this.playerEntity, worldserver, itemstack, enumhand, blockpos, enumfacing, p_184337_1_.func_187026_d(), p_184337_1_.func_187025_e(), p_184337_1_.func_187020_f()); } -@@ -689,6 +694,7 @@ +@@ -689,6 +695,7 @@ if (itemstack != null && itemstack.stackSize == 0) { this.playerEntity.func_184611_a(enumhand, (ItemStack)null); @@ -31,7 +39,7 @@ itemstack = null; } } -@@ -703,12 +709,14 @@ +@@ -703,12 +710,14 @@ if (itemstack != null) { @@ -46,7 +54,7 @@ itemstack = null; } } -@@ -888,7 +896,9 @@ +@@ -888,7 +897,9 @@ } else { @@ -57,7 +65,7 @@ this.serverController.func_184103_al().sendChatMsgImpl(itextcomponent, false); } -@@ -1057,7 +1067,7 @@ +@@ -1057,7 +1068,7 @@ return; } From 98f606d4d2e8217ab685610a669d2ec28f484bda Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 9 Mar 2016 20:08:24 -0500 Subject: [PATCH 069/243] Move the patch into the fml override handler, for less patch --- .../network/NetHandlerPlayServer.java.patch | 20 ++++++------------- .../network/handshake/NetworkDispatcher.java | 2 ++ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch index 6af352b365..2facd3bb90 100644 --- a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -1,14 +1,6 @@ --- ../src-base/minecraft/net/minecraft/network/NetHandlerPlayServer.java +++ ../src-work/minecraft/net/minecraft/network/NetHandlerPlayServer.java -@@ -159,6 +159,7 @@ - - public void update() - { -+ if (this.playerEntity.playerNetServerHandler != this) return; // FORGE: sometimes the netqueue will tick while login is occuring, causing an NPE. We shouldn't tick until the connection is complete - this.func_184342_d(); - this.playerEntity.onUpdateEntity(); - this.playerEntity.setPositionAndRotation(this.field_184349_l, this.field_184350_m, this.field_184351_n, this.playerEntity.rotationYaw, this.playerEntity.rotationPitch); -@@ -612,7 +613,10 @@ +@@ -612,7 +612,10 @@ double d2 = this.playerEntity.posZ - ((double)blockpos.getZ() + 0.5D); double d3 = d0 * d0 + d1 * d1 + d2 * d2; @@ -20,7 +12,7 @@ { return; } -@@ -670,7 +674,9 @@ +@@ -670,7 +673,9 @@ if (blockpos.getY() < this.serverController.getBuildLimit() - 1 || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit()) { @@ -31,7 +23,7 @@ { this.playerEntity.theItemInWorldManager.func_187251_a(this.playerEntity, worldserver, itemstack, enumhand, blockpos, enumfacing, p_184337_1_.func_187026_d(), p_184337_1_.func_187025_e(), p_184337_1_.func_187020_f()); } -@@ -689,6 +695,7 @@ +@@ -689,6 +694,7 @@ if (itemstack != null && itemstack.stackSize == 0) { this.playerEntity.func_184611_a(enumhand, (ItemStack)null); @@ -39,7 +31,7 @@ itemstack = null; } } -@@ -703,12 +710,14 @@ +@@ -703,12 +709,14 @@ if (itemstack != null) { @@ -54,7 +46,7 @@ itemstack = null; } } -@@ -888,7 +897,9 @@ +@@ -888,7 +896,9 @@ } else { @@ -65,7 +57,7 @@ this.serverController.func_184103_al().sendChatMsgImpl(itextcomponent, false); } -@@ -1057,7 +1068,7 @@ +@@ -1057,7 +1067,7 @@ return; } diff --git a/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java b/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java index e99d59767e..86c135f755 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java +++ b/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java @@ -189,6 +189,8 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple { completeServerSideConnection(ConnectionType.MODDED); } + // FORGE: sometimes the netqueue will tick while login is occuring, causing an NPE. We shouldn't tick until the connection is complete + if (this.playerEntity.playerNetServerHandler != this) return; super.update(); } }; From cf93859095d3531f49dac3f92da0b4c2353d5339 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 10 Mar 2016 04:19:54 +0300 Subject: [PATCH 070/243] Fix items rendering too low in first person. --- src/main/java/net/minecraftforge/client/ForgeHooksClient.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 41c4343a59..7fc12267d1 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -608,6 +608,7 @@ public class ForgeHooksClient } private static int slotMainHand = 0; + // FIXME public static boolean shouldCauseReequipAnimation(ItemStack from, ItemStack to, int slot) { if(!Objects.equal(from, to) || from == null) @@ -620,6 +621,6 @@ public class ForgeHooksClient changed = slot != slotMainHand; slotMainHand = slot; } - return from.getItem().shouldCauseReequipAnimation(from, to, changed); + return !from.getItem().shouldCauseReequipAnimation(from, to, changed); } } From 8e9b403fbf02aa8310e64f2230591ae788b10d93 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 10 Mar 2016 04:48:13 +0300 Subject: [PATCH 071/243] Fixed (hopefully) perspective transformations for custom models too. --- .../minecraftforge/client/ForgeHooksClient.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 7fc12267d1..dac0b718b3 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -382,20 +382,34 @@ public class ForgeHooksClient return m; } + private static final Matrix4f flipX; + static { + flipX = new Matrix4f(); + flipX.setIdentity(); + flipX.m00 = -1; + } + @SuppressWarnings("deprecation") public static IBakedModel handleCameraTransforms(IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, boolean leftHandHackery) { if(model instanceof IPerspectiveAwareModel) { - // FIXME: left hand hackery Pair pair = ((IPerspectiveAwareModel)model).handlePerspective(cameraTransformType); + Matrix4f matrix = new Matrix4f(pair.getRight()); + if(leftHandHackery) + { + matrix.mul(flipX, matrix); + matrix.mul(matrix, flipX); + } if(pair.getRight() != null) multiplyCurrentGlMatrix(pair.getRight()); return pair.getLeft(); } else { + //if(leftHandHackery) GlStateManager.scale(-1, 1, 1); ItemCameraTransforms.func_188034_a(model.getItemCameraTransforms().getTransform(cameraTransformType), leftHandHackery); + //if(leftHandHackery) GlStateManager.scale(-1, 1, 1); } return model; } From cdf8a820a63282191cc652198387afa39613defa Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 9 Mar 2016 23:00:44 -0500 Subject: [PATCH 072/243] Capture Biome Registry within FML --- .../world/biome/BiomeGenBase.java.patch | 9 +++++++++ .../fml/common/registry/GameData.java | 16 ++++++++++++++++ .../registry/PersistentRegistryManager.java | 1 + 3 files changed, 26 insertions(+) diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch index f39cc259f6..826d96b122 100644 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch @@ -1,5 +1,14 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenBase.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenBase.java +@@ -70,7 +70,7 @@ + protected static final WorldGenTrees worldGeneratorTrees = new WorldGenTrees(false); + protected static final WorldGenBigTree worldGeneratorBigTree = new WorldGenBigTree(false); + protected static final WorldGenSwamp worldGeneratorSwamp = new WorldGenSwamp(); +- public static final RegistryNamespaced field_185377_q = new RegistryNamespaced(); ++ public static final RegistryNamespaced field_185377_q = net.minecraftforge.fml.common.registry.GameData.getBiomeRegistry(); + private final String biomeName; + private final float minHeight; + private final float maxHeight; @@ -128,11 +128,12 @@ this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1)); this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index 525f9cde55..54715ed988 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -21,6 +21,8 @@ import net.minecraft.item.ItemBlock; import net.minecraft.potion.Potion; import net.minecraft.util.ObjectIntIdentityMap; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.RegistryNamespaced; +import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; @@ -36,6 +38,8 @@ public class GameData static final int MAX_ITEM_ID = 31999; public static final int MIN_POTION_ID = 0; // 0-~31 are vanilla, forge start at 32 public static final int MAX_POTION_ID = 255; // S1DPacketEntityEffect sends bytes, we can only use 255 + public static final int MIN_BIOME_ID = 0; // 0-~31 are vanilla, forge start at 32 + public static final int MAX_BIOME_ID = 255; // S1DPacketEntityEffect sends bytes, we can only use 255 private static final GameData mainData = new GameData(); // public api @@ -69,6 +73,8 @@ public class GameData return getMain().iPotionRegistry; } + public static FMLControlledNamespacedRegistry getBiomeRegistry() { return getMain().iBiomeRegistry; } + /*************************************************** * INTERNAL CODE FROM HERE ON DO NOT USE! @@ -114,6 +120,7 @@ public class GameData private final FMLControlledNamespacedRegistry iBlockRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BLOCKS, Block.class, new ResourceLocation("minecraft:air"), MAX_BLOCK_ID, MIN_BLOCK_ID, true, BlockStateCapture.INSTANCE); private final FMLControlledNamespacedRegistry iItemRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ITEMS, Item.class, null, MAX_ITEM_ID, MIN_ITEM_ID, true, ItemBlockCapture.INSTANCE); private final FMLControlledNamespacedRegistry iPotionRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONS, Potion.class, null, MAX_POTION_ID, MIN_POTION_ID, false, PotionArrayCapture.INSTANCE); + private final FMLControlledNamespacedRegistry iBiomeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BIOMES, BiomeGenBase.class, null, MAX_BIOME_ID, MIN_BIOME_ID, false, BiomeCapture.INSTANCE); int registerItem(Item item, String name) // from GameRegistry { @@ -257,4 +264,13 @@ public class GameData // no op for the minute? } } + private static class BiomeCapture implements FMLControlledNamespacedRegistry.AddCallback + { + static final BiomeCapture INSTANCE = new BiomeCapture(); + + @Override + public void onAdd(BiomeGenBase potion, int id) { + // no op for the minute? + } + } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index 379e298f51..c87476d030 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -129,6 +129,7 @@ public class PersistentRegistryManager public static final ResourceLocation BLOCKS = new ResourceLocation("minecraft:blocks"); public static final ResourceLocation ITEMS = new ResourceLocation("minecraft:items"); public static final ResourceLocation POTIONS = new ResourceLocation("minecraft:potions"); + public static final ResourceLocation BIOMES = new ResourceLocation("minecraft:biomes"); public static FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class registryType, ResourceLocation optionalDefaultKey, int maxId, int minId, boolean hasDelegates, FMLControlledNamespacedRegistry.AddCallback addCallback) { From 5c9808ada813edd5ab1b4850a33b1a9b0b51f7de Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Fri, 11 Mar 2016 00:43:18 +0300 Subject: [PATCH 073/243] Fixed emply hand not rendering in first person. --- src/main/java/net/minecraftforge/client/ForgeHooksClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index dac0b718b3..55fa5373c1 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -627,7 +627,7 @@ public class ForgeHooksClient { if(!Objects.equal(from, to) || from == null) { - return false; + return Objects.equal(from, to); } boolean changed = false; if (slot != -1) From 018c67d969b6e21fa9f80d11ffd73bb4220f53bd Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Fri, 11 Mar 2016 00:57:05 +0300 Subject: [PATCH 074/243] Fixed incorrect rendering state caused by transparent rendering pass for entities. --- .../client/renderer/EntityRenderer.java.patch | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index a2f88c78c4..d19583066d 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -114,7 +114,7 @@ renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); GlStateManager.enableAlpha(); } -@@ -1366,6 +1368,15 @@ +@@ -1366,6 +1368,17 @@ GlStateManager.shadeModel(7425); this.mc.mcProfiler.endStartSection("translucent"); renderglobal.renderBlockLayer(BlockRenderLayer.TRANSLUCENT, (double)partialTicks, pass, entity); @@ -124,13 +124,15 @@ + this.mc.mcProfiler.endStartSection("entities"); + net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); + renderglobal.renderEntities(entity, icamera, partialTicks); ++ // restore blending function changed by RenderGlobal.preRenderDamagedBlocks ++ GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); + RenderHelper.disableStandardItemLighting(); + } GlStateManager.shadeModel(7424); GlStateManager.depthMask(true); GlStateManager.enableCull(); -@@ -1378,6 +1389,9 @@ +@@ -1378,6 +1391,9 @@ this.renderCloudsCheck(renderglobal, partialTicks, pass); } @@ -140,7 +142,7 @@ this.mc.mcProfiler.endStartSection("hand"); if (this.renderHand) -@@ -1490,6 +1504,13 @@ +@@ -1490,6 +1506,13 @@ protected void renderRainSnow(float partialTicks) { @@ -154,7 +156,7 @@ float f = this.mc.theWorld.getRainStrength(partialTicks); if (f > 0.0F) -@@ -1820,6 +1841,13 @@ +@@ -1820,6 +1843,13 @@ this.fogColorBlue = f7; } @@ -168,7 +170,7 @@ GlStateManager.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); } -@@ -1830,7 +1858,9 @@ +@@ -1830,7 +1860,9 @@ GlStateManager.func_187432_a(0.0F, -1.0F, 0.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); IBlockState iblockstate = ActiveRenderInfo.func_186703_a(this.mc.theWorld, entity, partialTicks); @@ -179,7 +181,7 @@ if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(MobEffects.blindness)) { float f1 = 5.0F; -@@ -1915,6 +1945,7 @@ +@@ -1915,6 +1947,7 @@ GlStateManager.setFogStart(f * 0.05F); GlStateManager.setFogEnd(Math.min(f, 192.0F) * 0.5F); } From 93c1c737e1d2b878a57aca7b323a9678b6009438 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Fri, 11 Mar 2016 01:26:04 +0300 Subject: [PATCH 075/243] Fixed armor rendering --- .../client/renderer/entity/layers/LayerArmorBase.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch index a03dab6fa4..5ba4fa1404 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch @@ -15,7 +15,7 @@ - case LEATHER: int i = itemarmor.getColor(itemstack); + { -+ if (i != -1) // Allow this for anything, not only cloth ++ if (i != 0xFFFFFF) // Allow this for anything, not only cloth + { float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; From 52e877bdd03d53848c824b7175906a8e76ed37c3 Mon Sep 17 00:00:00 2001 From: cpw Date: Fri, 11 Mar 2016 19:59:24 -0500 Subject: [PATCH 076/243] Switch to srg patches --- build.gradle | 6 +- .../net/minecraft/block/Block.java.patch | 299 +++++----- .../minecraft/block/BlockBanner.java.patch | 18 +- .../net/minecraft/block/BlockBush.java.patch | 41 +- .../minecraft/block/BlockButton.java.patch | 9 +- .../minecraft/block/BlockCactus.java.patch | 24 +- .../net/minecraft/block/BlockChest.java.patch | 6 +- .../net/minecraft/block/BlockCocoa.java.patch | 6 +- .../net/minecraft/block/BlockCrops.java.patch | 52 +- .../minecraft/block/BlockDeadBush.java.patch | 27 +- .../net/minecraft/block/BlockDoor.java.patch | 10 +- .../block/BlockDoublePlant.java.patch | 23 +- .../minecraft/block/BlockDragonEgg.java.patch | 20 + .../minecraft/block/BlockFalling.java.patch | 22 +- .../minecraft/block/BlockFarmland.java.patch | 4 +- .../net/minecraft/block/BlockFire.java.patch | 150 +++-- .../minecraft/block/BlockFlowerPot.java.patch | 14 +- .../net/minecraft/block/BlockGrass.java.patch | 18 +- .../block/BlockHugeMushroom.java.patch | 6 +- .../net/minecraft/block/BlockIce.java.patch | 25 +- .../minecraft/block/BlockLadder.java.patch | 24 +- .../minecraft/block/BlockLeaves.java.patch | 43 +- .../net/minecraft/block/BlockLever.java.patch | 4 +- .../net/minecraft/block/BlockLog.java.patch | 14 +- .../block/BlockMobSpawner.java.patch | 6 +- .../minecraft/block/BlockMushroom.java.patch | 6 +- .../minecraft/block/BlockMycelium.java.patch | 10 +- .../block/BlockNetherWart.java.patch | 18 +- .../minecraft/block/BlockNewLeaf.java.patch | 20 +- .../net/minecraft/block/BlockNote.java.patch | 8 +- .../minecraft/block/BlockOldLeaf.java.patch | 19 +- .../net/minecraft/block/BlockOre.java.patch | 7 +- .../net/minecraft/block/BlockPane.java.patch | 25 +- .../block/BlockPistonBase.java.patch | 32 +- .../block/BlockPistonMoving.java.patch | 27 +- .../minecraft/block/BlockPotato.java.patch | 24 +- .../minecraft/block/BlockPumpkin.java.patch | 8 +- .../minecraft/block/BlockQuartz.java.patch | 6 +- .../minecraft/block/BlockRailBase.java.patch | 61 +- .../block/BlockRedstoneComparator.java.patch | 4 +- .../block/BlockRedstoneDiode.java.patch | 4 +- .../block/BlockRedstoneOre.java.patch | 6 +- .../block/BlockRedstoneWire.java.patch | 70 ++- .../net/minecraft/block/BlockReed.java.patch | 23 +- .../block/BlockRotatedPillar.java.patch | 13 +- .../minecraft/block/BlockSapling.java.patch | 2 +- .../net/minecraft/block/BlockSkull.java.patch | 19 +- .../net/minecraft/block/BlockSlab.java.patch | 30 +- .../net/minecraft/block/BlockSnow.java.patch | 30 +- .../minecraft/block/BlockStairs.java.patch | 16 +- .../block/BlockStaticLiquid.java.patch | 11 + .../net/minecraft/block/BlockStem.java.patch | 12 +- .../minecraft/block/BlockTallGrass.java.patch | 29 +- .../net/minecraft/block/BlockTorch.java.patch | 21 +- .../minecraft/block/BlockTrapDoor.java.patch | 54 +- .../block/BlockTripWireHook.java.patch | 16 +- .../net/minecraft/block/BlockVine.java.patch | 23 +- .../BlockPistonStructureHelper.java.patch | 28 +- .../block/state/BlockState.java.patch | 53 -- .../block/state/BlockStateBase.java.patch | 6 +- .../state/BlockStateContainer.java.patch | 86 +++ .../block/state/IBlockProperties.java.patch | 27 + .../client/LoadingScreenRenderer.java.patch | 4 +- .../net/minecraft/client/Minecraft.java.patch | 281 ++++----- .../client/audio/SoundManager.java.patch | 24 +- .../entity/AbstractClientPlayer.java.patch | 2 +- .../client/entity/EntityPlayerSP.java.patch | 22 +- .../client/gui/FontRenderer.java.patch | 54 +- .../minecraft/client/gui/GuiButton.java.patch | 4 +- .../minecraft/client/gui/GuiChat.java.patch | 39 +- .../client/gui/GuiCreateWorld.java.patch | 8 +- .../minecraft/client/gui/GuiIngame.java.patch | 12 + .../gui/GuiListWorldSelectionEntry.java.patch | 11 + .../client/gui/GuiMainMenu.java.patch | 8 +- .../client/gui/GuiOverlayDebug.java.patch | 4 +- .../minecraft/client/gui/GuiScreen.java.patch | 20 +- .../client/gui/GuiSelectWorld.java.patch | 11 - .../minecraft/client/gui/GuiSlot.java.patch | 24 +- .../gui/GuiUtilRenderComponents.java.patch | 6 +- .../gui/ServerListEntryNormal.java.patch | 2 +- .../achievement/GuiAchievements.java.patch | 19 +- .../gui/achievement/GuiStats.java.patch | 69 --- .../gui/inventory/GuiContainer.java.patch | 12 +- .../inventory/GuiContainerCreative.java.patch | 45 +- .../client/model/ModelBox.java.patch | 2 +- .../client/model/ModelRenderer.java.patch | 12 +- .../model/PositionTextureVertex.java.patch | 4 +- .../client/model/TexturedQuad.java.patch | 17 +- .../ChunkProviderClient.java.patch | 2 +- .../multiplayer/GuiConnecting.java.patch | 6 +- .../multiplayer/PlayerControllerMP.java.patch | 82 +-- .../client/multiplayer/WorldClient.java.patch | 4 +- .../network/NetHandlerLoginClient.java.patch | 4 +- .../network/NetHandlerPlayClient.java.patch | 34 +- ...ger.java.patch => ServerPinger.java.patch} | 6 +- .../client/particle/EffectRenderer.java.patch | 32 +- .../renderer/BlockModelRenderer.java.patch | 24 - .../renderer/BlockModelShapes.java.patch | 2 +- .../BlockRendererDispatcher.java.patch | 72 +-- .../client/renderer/EntityRenderer.java.patch | 89 ++- .../InventoryEffectRenderer.java.patch | 12 +- .../renderer/ItemModelMesher.java.patch | 21 +- .../client/renderer/ItemRenderer.java.patch | 44 +- .../client/renderer/OpenGlHelper.java.patch | 4 +- .../client/renderer/RenderGlobal.java.patch | 65 +- .../client/renderer/RenderItem.java.patch | 97 +++ ...rer.java.patch => VertexBuffer.java.patch} | 19 +- .../WorldVertexBufferUploader.java.patch | 51 +- .../renderer/block/model/BakedQuad.java.patch | 38 +- .../block/model/FaceBakery.java.patch | 79 +-- .../block/model/IBakedModel.java.patch | 10 + .../model/ItemCameraTransforms.java.patch | 34 +- .../block/model/ItemOverrideList.java.patch | 40 ++ .../block}/model/ModelBakery.java.patch | 101 ++-- .../model/ModelBlockDefinition.java.patch | 22 +- .../block/model/ModelManager.java.patch | 15 + .../block}/model/ModelRotation.java.patch | 4 +- .../renderer/block/model/Variant.java.patch | 20 + .../block/statemap/StateMap.java.patch | 4 +- .../renderer/chunk/RenderChunk.java.patch | 28 +- .../entity/RenderEntityItem.java.patch | 63 +- .../renderer/entity/RenderItem.java.patch | 90 --- ...java.patch => RenderLivingBase.java.patch} | 48 +- .../renderer/entity/RenderManager.java.patch | 15 +- .../renderer/entity/RenderPlayer.java.patch | 6 +- .../entity/layers/LayerArmorBase.java.patch | 89 ++- .../entity/layers/LayerBipedArmor.java.patch | 4 +- .../renderer/texture/Stitcher.java.patch | 11 +- .../texture/TextureAtlasSprite.java.patch | 2 +- .../renderer/texture/TextureMap.java.patch | 86 ++- .../renderer/texture/TextureUtil.java.patch | 4 +- .../tileentity/RenderItemFrame.java.patch | 8 +- .../TileEntityItemStackRenderer.java.patch | 2 +- .../TileEntityRendererDispatcher.java.patch | 8 +- .../TileEntitySpecialRenderer.java.patch | 2 +- .../FallbackResourceManager.java.patch | 2 +- .../resources/LanguageManager.java.patch | 2 +- .../resources/model/IBakedModel.java.patch | 9 - .../resources/model/ModelManager.java.patch | 14 - .../client/settings/GameSettings.java.patch | 2 +- .../client/shader/Framebuffer.java.patch | 4 +- .../minecraft/command/CommandBase.java.patch | 8 +- .../command/CommandEnchant.java.patch | 10 +- .../minecraft/command/CommandFill.java.patch | 20 +- .../command/CommandHandler.java.patch | 16 +- ...r.java.patch => EntitySelector.java.patch} | 6 +- .../command/server/CommandSetBlock.java.patch | 14 +- .../server/CommandTestForBlock.java.patch | 8 +- .../crash/CrashReportCategory.java.patch | 2 +- .../enchantment/Enchantment.java.patch | 38 +- .../enchantment/EnchantmentHelper.java.patch | 38 +- .../net/minecraft/entity/Entity.java.patch | 208 ++----- .../minecraft/entity/EntityAgeable.java.patch | 11 - .../minecraft/entity/EntityHanging.java.patch | 16 +- .../minecraft/entity/EntityList.java.patch | 38 +- .../minecraft/entity/EntityLiving.java.patch | 8 +- .../entity/EntityLivingBase.java.patch | 246 +++++--- .../EntityMinecartCommandBlock.java.patch | 10 - .../minecraft/entity/EntityTracker.java.patch | 12 +- .../entity/EntityTrackerEntry.java.patch | 21 +- ...a.patch => EntityAIAttackMelee.java.patch} | 14 +- .../entity/boss/EntityDragon.java.patch | 20 +- .../entity/boss/EntityWither.java.patch | 10 +- .../entity/boss/IBossDisplayData.java.patch | 10 - .../effect/EntityLightningBolt.java.patch | 2 +- .../entity/item/EntityEnderPearl.java.patch | 6 +- .../entity/item/EntityFallingBlock.java.patch | 10 + .../entity/item/EntityItem.java.patch | 28 +- .../entity/item/EntityItemFrame.java.patch | 2 +- .../entity/item/EntityMinecart.java.patch | 77 +-- .../EntityMinecartCommandBlock.java.patch | 10 + .../item/EntityMinecartContainer.java.patch | 18 +- .../item/EntityMinecartEmpty.java.patch | 11 +- .../item/EntityMinecartFurnace.java.patch | 13 +- .../item/EntityMinecartHopper.java.patch | 8 +- .../entity/item/EntityXPOrb.java.patch | 4 +- .../entity/monster/EntityEnderman.java.patch | 23 +- .../entity/monster/EntityMagmaCube.java.patch | 2 +- .../entity/monster/EntitySlime.java.patch | 10 +- .../entity/monster/EntityZombie.java.patch | 25 +- .../entity/passive/EntityHorse.java.patch | 2 +- .../entity/passive/EntityMooshroom.java.patch | 34 +- .../entity/passive/EntityOcelot.java.patch | 10 +- .../entity/passive/EntitySheep.java.patch | 18 +- .../entity/passive/EntityVillager.java.patch | 22 +- .../entity/player/EntityPlayer.java.patch | 295 ++++----- .../entity/player/EntityPlayerMP.java.patch | 61 +- .../entity/player/InventoryPlayer.java.patch | 23 +- .../projectile/EntityFishHook.java.patch | 22 - .../net/minecraft/init/Bootstrap.java.patch | 297 +++++++--- .../minecraft/inventory/Container.java.patch | 2 +- .../ContainerBrewingStand.java.patch | 36 +- .../inventory/ContainerEnchantment.java.patch | 12 +- .../inventory/ContainerPlayer.java.patch | 16 +- .../inventory/ContainerRepair.java.patch | 31 +- .../inventory/SlotCrafting.java.patch | 2 +- .../inventory/SlotFurnaceOutput.java.patch | 2 +- .../net/minecraft/item/Item.java.patch | 166 ++---- .../net/minecraft/item/ItemArmor.java.patch | 29 +- .../net/minecraft/item/ItemBlock.java.patch | 16 +- .../net/minecraft/item/ItemBow.java.patch | 43 +- .../net/minecraft/item/ItemBucket.java.patch | 17 +- .../minecraft/item/ItemBucketMilk.java.patch | 4 +- .../net/minecraft/item/ItemDye.java.patch | 43 +- .../minecraft/item/ItemEmptyMap.java.patch | 8 +- .../item/ItemFlintAndSteel.java.patch | 8 +- .../net/minecraft/item/ItemHoe.java.patch | 10 +- .../net/minecraft/item/ItemLilyPad.java.patch | 11 +- .../net/minecraft/item/ItemMap.java.patch | 4 +- .../item/ItemMonsterPlacer.java.patch | 105 +--- .../net/minecraft/item/ItemRecord.java.patch | 12 +- .../minecraft/item/ItemSeedFood.java.patch | 23 +- .../net/minecraft/item/ItemSeeds.java.patch | 21 +- .../net/minecraft/item/ItemShears.java.patch | 40 +- .../net/minecraft/item/ItemSkull.java.patch | 37 +- .../net/minecraft/item/ItemSnow.java.patch | 2 +- .../net/minecraft/item/ItemStack.java.patch | 70 +-- .../net/minecraft/item/ItemSword.java.patch | 4 +- .../net/minecraft/item/ItemTool.java.patch | 39 +- .../item/crafting/FurnaceRecipes.java.patch | 4 +- .../minecraft/nbt/NBTTagCompound.java.patch | 4 +- .../network/NetHandlerPlayServer.java.patch | 141 ++--- .../network/NetworkManager.java.patch | 12 +- .../network/NetworkSystem.java.patch | 6 +- .../network/ServerStatusResponse.java.patch | 23 +- ....patch => CPacketCustomPayload.java.patch} | 4 +- ....patch => SPacketCustomPayload.java.patch} | 4 +- .../server/S00PacketServerInfo.java.patch | 11 - .../net/minecraft/potion/Potion.java.patch | 61 +- .../minecraft/potion/PotionEffect.java.patch | 38 +- .../minecraft/realms/RealmsConnect.java.patch | 4 +- .../server/MinecraftServer.java.patch | 86 ++- .../dedicated/DedicatedServer.java.patch | 36 +- .../server/gui/MinecraftServerGui.java.patch | 4 +- .../integrated/IntegratedServer.java.patch | 21 +- .../management/ItemInWorldManager.java.patch | 266 --------- .../PlayerInteractionManager.java.patch | 220 +++++++ .../server/management/PlayerList.java.patch | 377 ++++++++++++ .../management/PlayerManager.java.patch | 212 +------ .../ServerConfigurationManager.java.patch | 223 ------- .../network/NetHandlerLoginServer.java.patch | 16 +- .../net/minecraft/stats/StatList.java.patch | 27 +- .../tileentity/TileEntity.java.patch | 79 +-- .../tileentity/TileEntityBeacon.java.patch | 4 +- .../TileEntityBrewingStand.java.patch | 97 ++- .../tileentity/TileEntityChest.java.patch | 12 +- .../tileentity/TileEntityFurnace.java.patch | 14 +- .../tileentity/TileEntityHopper.java.patch | 8 +- .../tileentity/TileEntityLockable.java.patch | 2 +- .../tileentity/TileEntityNote.java.patch | 2 +- .../tileentity/TileEntityPiston.java.patch | 4 +- .../tileentity/TileEntitySign.java.patch | 2 +- .../minecraft/util/ActionResult.java.patch | 13 + ...java.patch => BlockRenderLayer.java.patch} | 6 +- .../net/minecraft/util/EnumFacing.java.patch | 20 +- .../minecraft/util/IChatComponent.java.patch | 10 - .../util/IntIdentityHashBiMap.java.patch | 10 + .../util/MovingObjectPosition.java.patch | 15 - .../util/ResourceLocation.java.patch | 26 - .../net/minecraft/util/Session.java.patch | 6 +- .../minecraft/util/TabCompleter.java.patch | 39 ++ .../net/minecraft/util/Vec3.java.patch | 35 -- .../WeightedRandomChestContent.java.patch | 68 --- .../util/{ => math}/BlockPos.java.patch | 21 +- .../util/math/RayTraceResult.java.patch | 15 + .../net/minecraft/util/math/Vec3d.java.patch | 19 + ...egistryNamespacedDefaultedByKey.java.patch | 14 + .../util/text/ITextComponent.java.patch | 10 + .../Style.java.patch} | 4 +- .../TextComponentBase.java.patch} | 4 +- .../translation/LanguageMap.java.patch} | 26 +- .../net/minecraft/world/ChunkCache.java.patch | 14 +- .../net/minecraft/world/Explosion.java.patch | 24 +- .../net/minecraft/world/World.java.patch | 559 ++++++++++-------- ...va.patch => WorldEntitySpawner.java.patch} | 35 +- .../minecraft/world/WorldProvider.java.patch | 55 +- .../world/WorldProviderSurface.java.patch | 10 + .../minecraft/world/WorldServer.java.patch | 124 ++-- .../world/WorldServerMulti.java.patch | 14 +- .../net/minecraft/world/WorldType.java.patch | 31 +- .../world/biome/BiomeColorHelper.java.patch | 11 - .../world/biome/BiomeDecorator.java.patch | 170 +++--- .../world/biome/BiomeGenBase.java.patch | 49 +- .../world/biome/BiomeGenForest.java.patch | 12 +- .../world/biome/BiomeGenHills.java.patch | 11 +- .../world/biome/BiomeGenPlains.java.patch | 6 +- .../world/biome/BiomeGenSwamp.java.patch | 2 +- .../world/biome/BiomeProvider.java.patch | 38 ++ .../world/biome/WorldChunkManager.java.patch | 45 -- .../minecraft/world/chunk/Chunk.java.patch | 121 ++-- .../chunk/storage/AnvilChunkLoader.java.patch | 57 +- .../chunk/storage/AnvilSaveHandler.java.patch | 8 +- .../world/chunk/storage/RegionFile.java.patch | 2 +- .../world/gen/ChunkProviderEnd.java.patch | 81 +-- .../gen/ChunkProviderGenerate.java.patch | 110 ---- .../world/gen/ChunkProviderHell.java.patch | 175 +++--- .../gen/ChunkProviderOverworld.java.patch | 101 ++++ .../world/gen/ChunkProviderServer.java.patch | 85 ++- .../world/gen/MapGenCaves.java.patch | 32 +- .../world/gen/MapGenRavine.java.patch | 45 +- .../feature/WorldGenAbstractTree.java.patch | 2 +- .../feature/WorldGenBigMushroom.java.patch | 35 +- .../gen/feature/WorldGenBigTree.java.patch | 8 +- .../gen/feature/WorldGenBirchTree.java.patch | 64 ++ .../world/gen/feature/WorldGenBush.java.patch | 11 + .../gen/feature/WorldGenCanopyTree.java.patch | 23 +- .../gen/feature/WorldGenDeadBush.java.patch | 14 +- .../gen/feature/WorldGenDungeons.java.patch | 22 +- .../gen/feature/WorldGenForest.java.patch | 50 -- .../gen/feature/WorldGenGlowStone1.java.patch | 11 + .../gen/feature/WorldGenGlowStone2.java.patch | 11 + .../gen/feature/WorldGenHellLava.java.patch | 11 + .../gen/feature/WorldGenHugeTrees.java.patch | 25 +- .../gen/feature/WorldGenIceSpike.java.patch | 29 + .../gen/feature/WorldGenLiquids.java.patch | 11 + .../gen/feature/WorldGenMegaJungle.java.patch | 4 +- .../feature/WorldGenMegaPineTree.java.patch | 51 +- .../gen/feature/WorldGenMinable.java.patch | 5 +- .../feature/WorldGenSavannaTree.java.patch | 26 +- .../gen/feature/WorldGenShrub.java.patch | 30 +- .../gen/feature/WorldGenSwamp.java.patch | 90 +-- .../gen/feature/WorldGenTaiga1.java.patch | 24 +- .../gen/feature/WorldGenTaiga2.java.patch | 54 +- .../gen/feature/WorldGenTallGrass.java.patch | 14 +- .../gen/feature/WorldGenTrees.java.patch | 83 +-- .../WorldGeneratorBonusChest.java.patch | 50 +- .../world/gen/layer/GenLayer.java.patch | 9 +- .../world/gen/layer/GenLayerBiome.java.patch | 57 +- ...ComponentScatteredFeaturePieces.java.patch | 79 --- .../gen/structure/MapGenStronghold.java.patch | 9 +- .../gen/structure/MapGenStructure.java.patch | 2 +- .../structure/StructureComponent.java.patch | 4 +- .../StructureMineshaftPieces.java.patch | 33 -- .../StructureNetherBridgePieces.java.patch | 28 - .../gen/structure/StructureStart.java.patch | 4 +- .../StructureStrongholdPieces.java.patch | 75 --- .../StructureVillagePieces.java.patch | 39 +- .../world/storage/MapData.java.patch | 8 +- .../world/storage/SaveFormatOld.java.patch | 27 + .../world/storage/SaveHandler.java.patch | 67 +-- .../world/storage/WorldInfo.java.patch | 14 +- 341 files changed, 5909 insertions(+), 6323 deletions(-) create mode 100644 patches/minecraft/net/minecraft/block/BlockDragonEgg.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockStaticLiquid.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/state/BlockState.java.patch create mode 100644 patches/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch create mode 100644 patches/minecraft/net/minecraft/block/state/IBlockProperties.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch rename patches/minecraft/net/minecraft/client/network/{OldServerPinger.java.patch => ServerPinger.java.patch} (59%) delete mode 100644 patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/RenderItem.java.patch rename patches/minecraft/net/minecraft/client/renderer/{WorldRenderer.java.patch => VertexBuffer.java.patch} (78%) create mode 100644 patches/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch rename patches/minecraft/net/minecraft/client/{resources => renderer/block}/model/ModelBakery.java.patch (53%) create mode 100644 patches/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch rename patches/minecraft/net/minecraft/client/{resources => renderer/block}/model/ModelRotation.java.patch (85%) create mode 100644 patches/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch rename patches/minecraft/net/minecraft/client/renderer/entity/{RendererLivingEntity.java.patch => RenderLivingBase.java.patch} (58%) delete mode 100644 patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch rename patches/minecraft/net/minecraft/command/{PlayerSelector.java.patch => EntitySelector.java.patch} (84%) delete mode 100644 patches/minecraft/net/minecraft/entity/EntityAgeable.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch rename patches/minecraft/net/minecraft/entity/ai/{EntityAIAttackOnCollide.java.patch => EntityAIAttackMelee.java.patch} (88%) delete mode 100644 patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch rename patches/minecraft/net/minecraft/network/play/client/{C17PacketCustomPayload.java.patch => CPacketCustomPayload.java.patch} (74%) rename patches/minecraft/net/minecraft/network/play/server/{S3FPacketCustomPayload.java.patch => SPacketCustomPayload.java.patch} (74%) delete mode 100644 patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch delete mode 100644 patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch create mode 100644 patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch create mode 100644 patches/minecraft/net/minecraft/server/management/PlayerList.java.patch delete mode 100644 patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch create mode 100644 patches/minecraft/net/minecraft/util/ActionResult.java.patch rename patches/minecraft/net/minecraft/util/{EnumWorldBlockLayer.java.patch => BlockRenderLayer.java.patch} (53%) delete mode 100644 patches/minecraft/net/minecraft/util/IChatComponent.java.patch create mode 100644 patches/minecraft/net/minecraft/util/IntIdentityHashBiMap.java.patch delete mode 100644 patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch delete mode 100644 patches/minecraft/net/minecraft/util/ResourceLocation.java.patch create mode 100644 patches/minecraft/net/minecraft/util/TabCompleter.java.patch delete mode 100644 patches/minecraft/net/minecraft/util/Vec3.java.patch delete mode 100644 patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch rename patches/minecraft/net/minecraft/util/{ => math}/BlockPos.java.patch (55%) create mode 100644 patches/minecraft/net/minecraft/util/math/RayTraceResult.java.patch create mode 100644 patches/minecraft/net/minecraft/util/math/Vec3d.java.patch create mode 100644 patches/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java.patch create mode 100644 patches/minecraft/net/minecraft/util/text/ITextComponent.java.patch rename patches/minecraft/net/minecraft/util/{ChatStyle.java.patch => text/Style.java.patch} (56%) rename patches/minecraft/net/minecraft/util/{ChatComponentStyle.java.patch => text/TextComponentBase.java.patch} (58%) rename patches/minecraft/net/minecraft/util/{StringTranslate.java.patch => text/translation/LanguageMap.java.patch} (58%) rename patches/minecraft/net/minecraft/world/{SpawnerAnimals.java.patch => WorldEntitySpawner.java.patch} (74%) create mode 100644 patches/minecraft/net/minecraft/world/WorldProviderSurface.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch create mode 100644 patches/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch create mode 100644 patches/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch diff --git a/build.gradle b/build.gradle index db62cdfb5e..fc806e733c 100644 --- a/build.gradle +++ b/build.gradle @@ -47,11 +47,11 @@ minecraft { projects { forge { rootDir "." - patchDir "patches.mcp/minecraft" + patchDir "patches/minecraft" patchAfter "clean" genPatchesFrom "clean" - genMcpPatches = true - applyMcpPatches = true + genMcpPatches = false + applyMcpPatches = false with common } } diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 5b4a8fa04b..c7da6fc340 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -1,18 +1,18 @@ --- ../src-base/minecraft/net/minecraft/block/Block.java +++ ../src-work/minecraft/net/minecraft/block/Block.java -@@ -38,8 +38,9 @@ +@@ -46,8 +46,9 @@ public class Block { private static final ResourceLocation field_176230_a = new ResourceLocation("air"); - public static final RegistryNamespacedDefaultedByKey field_149771_c = new RegistryNamespacedDefaultedByKey(field_176230_a); - public static final ObjectIntIdentityMap field_176229_d = new ObjectIntIdentityMap(); -+ public static final RegistryNamespacedDefaultedByKey field_149771_c = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); ++ public static final RegistryNamespacedDefaultedByKey field_149771_c = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); + @Deprecated //Modders: DO NOT use this! Use GameRegistry + public static final ObjectIntIdentityMap field_176229_d = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); + public static final AxisAlignedBB field_185505_j = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + public static final AxisAlignedBB field_185506_k = null; private CreativeTabs field_149772_a; - public static final Block.SoundType field_149769_e = new Block.SoundType("stone", 1.0F, 1.0F); - public static final Block.SoundType field_149766_f = new Block.SoundType("wood", 1.0F, 1.0F); -@@ -119,6 +120,9 @@ +@@ -70,6 +71,9 @@ private IBlockState field_176228_M; private String field_149770_b; @@ -22,7 +22,7 @@ public static int func_149682_b(Block p_149682_0_) { return field_149771_c.func_148757_b(p_149682_0_); -@@ -132,7 +136,8 @@ +@@ -83,7 +87,8 @@ public static Block func_149729_e(int p_149729_0_) { @@ -32,16 +32,16 @@ } public static IBlockState func_176220_d(int p_176220_0_) -@@ -303,7 +308,7 @@ +@@ -268,7 +273,7 @@ - public boolean func_176200_f(World p_176200_1_, BlockPos p_176200_2_) + public boolean func_176200_f(IBlockAccess p_176200_1_, BlockPos p_176200_2_) { - return false; -+ return func_149688_o().func_76222_j(); ++ return p_176200_1_.func_180495_p(p_176200_2_).func_185904_a().func_76222_j(); } public Block func_149711_c(float p_149711_1_) -@@ -340,9 +345,10 @@ +@@ -305,9 +310,10 @@ return this.field_149789_z; } @@ -52,33 +52,33 @@ + return hasTileEntity(func_176223_P()); } - public final void func_149676_a(float p_149676_1_, float p_149676_2_, float p_149676_3_, float p_149676_4_, float p_149676_5_, float p_149676_6_) -@@ -359,13 +365,13 @@ - public int func_176207_c(IBlockAccess p_176207_1_, BlockPos p_176207_2_) + public AxisAlignedBB func_185496_a(IBlockState p_185496_1_, IBlockAccess p_185496_2_, BlockPos p_185496_3_) +@@ -346,13 +352,13 @@ + @SideOnly(Side.CLIENT) + public int func_185484_c(IBlockState p_185484_1_, IBlockAccess p_185484_2_, BlockPos p_185484_3_) { - Block block = p_176207_1_.func_180495_p(p_176207_2_).func_177230_c(); -- int i = p_176207_1_.func_175626_b(p_176207_2_, block.func_149750_m()); -+ int i = p_176207_1_.func_175626_b(p_176207_2_, block.getLightValue(p_176207_1_, p_176207_2_)); +- int i = p_185484_2_.func_175626_b(p_185484_3_, p_185484_1_.func_185906_d()); ++ int i = p_185484_2_.func_175626_b(p_185484_3_, p_185484_1_.getLightValue(p_185484_2_, p_185484_3_)); - if (i == 0 && block instanceof BlockSlab) + if (i == 0 && p_185484_1_.func_177230_c() instanceof BlockSlab) { - p_176207_2_ = p_176207_2_.func_177977_b(); - block = p_176207_1_.func_180495_p(p_176207_2_).func_177230_c(); -- return p_176207_1_.func_175626_b(p_176207_2_, block.func_149750_m()); -+ return p_176207_1_.func_175626_b(p_176207_2_, block.getLightValue(p_176207_1_, p_176207_2_)); + p_185484_3_ = p_185484_3_.func_177977_b(); + p_185484_1_ = p_185484_2_.func_180495_p(p_185484_3_); +- return p_185484_2_.func_175626_b(p_185484_3_, p_185484_1_.func_185906_d()); ++ return p_185484_2_.func_175626_b(p_185484_3_, p_185484_1_.getLightValue(p_185484_2_, p_185484_3_)); } else { -@@ -376,7 +382,7 @@ - @SideOnly(Side.CLIENT) - public boolean func_176225_a(IBlockAccess p_176225_1_, BlockPos p_176225_2_, EnumFacing p_176225_3_) - { -- return p_176225_3_ == EnumFacing.DOWN && this.field_149760_C > 0.0D ? true : (p_176225_3_ == EnumFacing.UP && this.field_149756_F < 1.0D ? true : (p_176225_3_ == EnumFacing.NORTH && this.field_149754_D > 0.0D ? true : (p_176225_3_ == EnumFacing.SOUTH && this.field_149757_G < 1.0D ? true : (p_176225_3_ == EnumFacing.WEST && this.field_149759_B > 0.0D ? true : (p_176225_3_ == EnumFacing.EAST && this.field_149755_E < 1.0D ? true : !p_176225_1_.func_180495_p(p_176225_2_).func_177230_c().func_149662_c()))))); -+ return p_176225_3_ == EnumFacing.DOWN && this.field_149760_C > 0.0D ? true : (p_176225_3_ == EnumFacing.UP && this.field_149756_F < 1.0D ? true : (p_176225_3_ == EnumFacing.NORTH && this.field_149754_D > 0.0D ? true : (p_176225_3_ == EnumFacing.SOUTH && this.field_149757_G < 1.0D ? true : (p_176225_3_ == EnumFacing.WEST && this.field_149759_B > 0.0D ? true : (p_176225_3_ == EnumFacing.EAST && this.field_149755_E < 1.0D ? true : !p_176225_1_.func_180495_p(p_176225_2_).func_177230_c().doesSideBlockRendering(p_176225_1_, p_176225_2_, p_176225_3_)))))); +@@ -415,7 +421,7 @@ + } + } + +- return !p_176225_2_.func_180495_p(p_176225_3_.func_177972_a(p_176225_4_)).func_185914_p(); ++ return !p_176225_2_.func_180495_p(p_176225_3_.func_177972_a(p_176225_4_)).doesSideBlockRendering(p_176225_2_, p_176225_3_.func_177972_a(p_176225_4_), p_176225_4_.func_176734_d()); } - public boolean func_176212_b(IBlockAccess p_176212_1_, BlockPos p_176212_2_, EnumFacing p_176212_3_) -@@ -453,6 +459,10 @@ + @SideOnly(Side.CLIENT) +@@ -472,6 +478,10 @@ public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) { @@ -89,17 +89,17 @@ } public int func_149745_a(Random p_149745_1_) -@@ -467,8 +477,7 @@ +@@ -486,8 +496,7 @@ - public float func_180647_a(EntityPlayer p_180647_1_, World p_180647_2_, BlockPos p_180647_3_) + public float func_180647_a(IBlockState p_180647_1_, EntityPlayer p_180647_2_, World p_180647_3_, BlockPos p_180647_4_) { -- float f = this.func_176195_g(p_180647_2_, p_180647_3_); -- return f < 0.0F ? 0.0F : (!p_180647_1_.func_146099_a(this) ? p_180647_1_.func_180471_a(this) / f / 100.0F : p_180647_1_.func_180471_a(this) / f / 30.0F); -+ return net.minecraftforge.common.ForgeHooks.blockStrength(p_180647_2_.func_180495_p(p_180647_3_), p_180647_1_, p_180647_2_, p_180647_3_); +- float f = p_180647_1_.func_185887_b(p_180647_3_, p_180647_4_); +- return f < 0.0F ? 0.0F : (!p_180647_2_.func_184823_b(p_180647_1_) ? p_180647_2_.func_184813_a(p_180647_1_) / f / 100.0F : p_180647_2_.func_184813_a(p_180647_1_) / f / 30.0F); ++ return net.minecraftforge.common.ForgeHooks.blockStrength(p_180647_1_, p_180647_2_, p_180647_3_, p_180647_4_); } public final void func_176226_b(World p_176226_1_, BlockPos p_176226_2_, IBlockState p_176226_3_, int p_176226_4_) -@@ -478,20 +487,16 @@ +@@ -497,20 +506,16 @@ public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { @@ -125,7 +125,7 @@ } } } -@@ -499,8 +504,13 @@ +@@ -518,8 +523,13 @@ public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) { @@ -140,7 +140,7 @@ float f = 0.5F; double d0 = (double)(p_180635_0_.field_73012_v.nextFloat() * f) + (double)(1.0F - f) * 0.5D; double d1 = (double)(p_180635_0_.field_73012_v.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -@@ -687,7 +697,7 @@ +@@ -588,7 +598,7 @@ public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { @@ -148,15 +148,15 @@ + return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().func_176200_f(p_176196_1_, p_176196_2_); } - public boolean func_180639_a(World p_180639_1_, BlockPos p_180639_2_, IBlockState p_180639_3_, EntityPlayer p_180639_4_, EnumFacing p_180639_5_, float p_180639_6_, float p_180639_7_, float p_180639_8_) -@@ -799,25 +809,35 @@ - p_180657_2_.func_71029_a(StatList.field_75934_C[func_149682_b(this)]); + public boolean func_180639_a(World p_180639_1_, BlockPos p_180639_2_, IBlockState p_180639_3_, EntityPlayer p_180639_4_, EnumHand p_180639_5_, ItemStack p_180639_6_, EnumFacing p_180639_7_, float p_180639_8_, float p_180639_9_, float p_180639_10_) +@@ -638,25 +648,35 @@ + p_180657_2_.func_71029_a(StatList.func_188055_a(this)); p_180657_2_.func_71020_j(0.025F); -- if (this.func_149700_E() && EnchantmentHelper.func_77502_d(p_180657_2_)) -+ if (this.canSilkHarvest(p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), p_180657_2_) && EnchantmentHelper.func_77502_d(p_180657_2_)) +- if (this.func_149700_E() && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) ++ if (this.canSilkHarvest(p_180657_1_, p_180657_3_, p_180657_4_, p_180657_2_) && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) { -+ java.util.ArrayList items = new java.util.ArrayList(); ++ java.util.List items = new java.util.ArrayList(); ItemStack itemstack = this.func_180643_i(p_180657_4_); if (itemstack != null) @@ -165,7 +165,7 @@ + items.add(itemstack); } + -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), 0, 1.0f, true, p_180657_2_); ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_4_, 0, 1.0f, true, p_180657_2_); + for (ItemStack stack : items) + { + func_180635_a(p_180657_1_, p_180657_3_, stack); @@ -174,7 +174,7 @@ else { + harvesters.set(p_180657_2_); - int i = EnchantmentHelper.func_77517_e(p_180657_2_); + int i = EnchantmentHelper.func_77506_a(Enchantments.field_185308_t, p_180657_6_); this.func_176226_b(p_180657_1_, p_180657_3_, p_180657_4_, i); + harvesters.set(null); } @@ -183,12 +183,20 @@ + @Deprecated //Forge: State sensitive version protected boolean func_149700_E() { -- return this.func_149686_d() && !this.field_149758_A; -+ return this.func_149686_d() && !this.hasTileEntity(silk_check_state.get()); +- return this.func_176223_P().func_185917_h() && !this.field_149758_A; ++ return this.func_176223_P().func_185917_h() && !this.hasTileEntity(silk_check_state.get()); } protected ItemStack func_180643_i(IBlockState p_180643_1_) -@@ -1010,6 +1030,1147 @@ +@@ -747,6 +767,7 @@ + p_176216_2_.field_70181_x = 0.0D; + } + ++ @Deprecated // Forge: Use more sensitive version below: getPickBlock + public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) + { + return new ItemStack(Item.func_150898_a(this), 1, this.func_180651_a(p_185473_3_)); +@@ -844,6 +865,1166 @@ return "Block{" + field_149771_c.func_177774_c(this) + "}"; } @@ -200,42 +208,45 @@ + /** + * Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15 + * ++ * @param state Block state + * @param world The current world + * @param pos Block position in world + * @return The light value + */ -+ public int getLightValue(IBlockAccess world, BlockPos pos) ++ public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ Block block = world.func_180495_p(pos).func_177230_c(); -+ if (block != this) ++ IBlockState other = world.func_180495_p(pos); ++ if (other.func_177230_c() != this) + { -+ return block.getLightValue(world, pos); ++ return other.getLightValue(world, pos); + } -+ return func_149750_m(); ++ return state.func_185906_d(); + } + + /** + * Checks if a player or entity can use this block to 'climb' like a ladder. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @param entity The entity trying to use the ladder, CAN be null. + * @return True if the block should act like a ladder + */ -+ public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return false; } ++ public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return false; } + + /** + * Return true if the block is a normal, solid cube. This + * determines indirect power state, entity ejection from blocks, and a few + * others. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @return True if the block is a full cube + */ -+ public boolean isNormalCube(IBlockAccess world, BlockPos pos) ++ public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ return func_149688_o().func_76218_k() && func_149686_d() && !func_149744_f(); ++ return state.func_185904_a().func_76218_k() && state.func_185917_h() && !state.func_185897_m(); + } + + /** @@ -249,26 +260,30 @@ + * @param side The side to check + * @return True if the block is opaque on the specified side. + */ -+ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face) ++ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) + { -+ return func_149662_c(); ++ return state.func_185914_p(); + } + + /** + * Checks if the block is a solid face on the given side, used by placement logic. + * ++ * @param base_state The base state, getActualState should be called first + * @param world The current world + * @param pos Block position in world + * @param side The side to check + * @return True if the block is solid on the specified side. + */ -+ public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) ++ public boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side) + { -+ IBlockState state = this.func_176221_a(world.func_180495_p(pos), world, pos); ++ if (base_state.func_185896_q()) // Short circuit to vanilla function if its true ++ return true; ++ ++ IBlockState state = this.func_176221_a(base_state, world, pos); + + if (this instanceof BlockSlab) + { -+ return func_149730_j() ++ return base_state.func_185913_b() + || (state.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP ) + || (state.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.BOTTOM && side == EnumFacing.DOWN); + } @@ -308,7 +323,7 @@ + { + return true; + } -+ return isNormalCube(world, pos); ++ return isNormalCube(state, world, pos); + } + + /** @@ -330,13 +345,14 @@ + * useful for creating pure logic-blocks that will be invisible + * to the player and otherwise interact as air would. + * ++ * @param sata The current state + * @param world The current world + * @param pos Block position in world + * @return True if the block considered air + */ -+ public boolean isAir(IBlockAccess world, BlockPos pos) ++ public boolean isAir(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ return func_149688_o() == Material.field_151579_a; ++ return state.func_185904_a() == Material.field_151579_a; + } + + /** @@ -362,6 +378,7 @@ + * Note: When used in multiplayer, this is called on both client and + * server sides! + * ++ * @param state The current state. + * @param world The current world + * @param player The player damaging the block, may be null + * @param pos Block position in world @@ -369,9 +386,10 @@ + * Can be useful to delay the destruction of tile entities till after harvestBlock + * @return True if the block is actually destroyed. + */ -+ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) ++ public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) + { -+ return world.func_175698_g(pos); ++ this.func_176208_a(world, pos, state, player); ++ return world.func_180501_a(pos, net.minecraft.init.Blocks.field_150350_a.func_176223_P(), world.field_72995_K ? 11 : 3); + } + + /** @@ -535,23 +553,15 @@ + * Determines if a specified mob type can spawn on this block, returning false will + * prevent any mob from spawning on the block. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @param type The Mob Category Type + * @return True to allow a mob of the specified category to spawn, false to prevent it. + */ -+ public boolean canCreatureSpawn(IBlockAccess world, BlockPos pos, net.minecraft.entity.EntityLiving.SpawnPlacementType type) ++ public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, net.minecraft.entity.EntityLiving.SpawnPlacementType type) + { -+ IBlockState state = world.func_180495_p(pos); -+ if (this instanceof BlockSlab) -+ { -+ return (func_149730_j() || state.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP); -+ } -+ else if (this instanceof BlockStairs) -+ { -+ return state.func_177229_b(BlockStairs.field_176308_b) == BlockStairs.EnumHalf.TOP; -+ } -+ return isSideSolid(world, pos, EnumFacing.UP); ++ return isSideSolid(state, world, pos, EnumFacing.UP); + } + + /** @@ -559,12 +569,13 @@ + * players to sleep in it, though the block has to specifically + * perform the sleeping functionality in it's activated event. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @param player The player or camera entity, null in some cases. + * @return True to treat this as a bed + */ -+ public boolean isBed(IBlockAccess world, BlockPos pos, Entity player) ++ public boolean isBed(IBlockState state, IBlockAccess world, BlockPos pos, Entity player) + { + return this == net.minecraft.init.Blocks.field_150324_C; + } @@ -573,12 +584,13 @@ + * Returns the position that the player is moved to upon + * waking up, or respawning at the bed. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @param player The player or camera entity, null in some cases. + * @return The spawn position + */ -+ public BlockPos getBedSpawnPosition(IBlockAccess world, BlockPos pos, EntityPlayer player) ++ public BlockPos getBedSpawnPosition(IBlockState state, IBlockAccess world, BlockPos pos, EntityPlayer player) + { + if (world instanceof World) + return BlockBed.func_176468_a((World)world, pos, 0); @@ -608,13 +620,14 @@ + * Returns the direction of the block. Same values that + * are returned by BlockDirectional + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @return Bed direction + */ -+ public EnumFacing getBedDirection(IBlockAccess world, BlockPos pos) ++ public EnumFacing getBedDirection(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ return (EnumFacing)func_176221_a(world.func_180495_p(pos), world, pos).func_177229_b(BlockDirectional.field_176387_N); ++ return (EnumFacing)func_176221_a(state, world, pos).func_177229_b(BlockHorizontal.field_185512_D); + } + + /** @@ -632,19 +645,20 @@ + /** + * Called when a leaf should start its decay process. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + */ -+ public void beginLeavesDecay(World world, BlockPos pos){} ++ public void beginLeavesDecay(IBlockState state, World world, BlockPos pos){} + + /** + * Determines if this block can prevent leaves connected to it from decaying. -+ * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @return true if the presence this block can prevent leaves from decaying. + */ -+ public boolean canSustainLeaves(IBlockAccess world, BlockPos pos) ++ public boolean canSustainLeaves(IBlockState state, IBlockAccess world, BlockPos pos) + { + return false; + } @@ -652,25 +666,27 @@ + /** + * Determines if this block is considered a leaf block, used to apply the leaf decay and generation system. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @return true if this block is considered leaves. + */ -+ public boolean isLeaves(IBlockAccess world, BlockPos pos) ++ public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ return func_149688_o() == Material.field_151584_j; ++ return state.func_185904_a() == Material.field_151584_j; + } + + /** + * Used during tree growth to determine if newly generated leaves can replace this block. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @return true if this block can be replaced by growing leaves. + */ -+ public boolean canBeReplacedByLeaves(IBlockAccess world, BlockPos pos) ++ public boolean canBeReplacedByLeaves(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ return !func_149730_j(); ++ return !state.func_185913_b(); + } + + /** @@ -687,15 +703,16 @@ + /** + * Determines if the current block is replaceable by Ore veins during world generation. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @param target The generic target block the gen is looking for, Standards define stone + * for overworld generation, and neatherack for the nether. + * @return True to allow this block to be replaced by a ore + */ -+ public boolean isReplaceableOreGen(World world, BlockPos pos, com.google.common.base.Predicate target) ++ public boolean isReplaceableOreGen(IBlockState state, IBlockAccess world, BlockPos pos, com.google.common.base.Predicate target) + { -+ return target.apply(world.func_180495_p(pos)); ++ return target.apply(state); + } + + /** @@ -731,27 +748,29 @@ + * Determine if this block can make a redstone connection on the side provided, + * Useful to control which sides are inputs and outputs for redstone wires. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @param side The side that is trying to make the connection, CAN BE NULL + * @return True to make the connection + */ -+ public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side) ++ public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) + { -+ return func_149744_f() && side != null; ++ return state.func_185897_m() && side != null; + } + + /** + * Determines if a torch can be placed on the top surface of this block. + * Useful for creating your own block that torches can be on, such as fences. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @return True to allow the torch to be placed + */ -+ public boolean canPlaceTorchOnTop(IBlockAccess world, BlockPos pos) ++ public boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ if (isSideSolid(world, pos, EnumFacing.UP)) ++ if (state.isSideSolid(world, pos, EnumFacing.UP)) + { + return true; + } @@ -780,22 +799,9 @@ + * @param target The full target the player is looking at + * @return A ItemStack to add to the player's inventory, Null if nothing should be added. + */ -+ 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 getPickBlock(target, world, pos); -+ } -+ @Deprecated -+ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos) -+ { -+ Item item = func_180665_b(world, pos); -+ -+ if (item == null) -+ { -+ return null; -+ } -+ -+ Block block = item instanceof ItemBlock && !func_149648_K() ? Block.func_149634_a(item) : this; -+ return new ItemStack(item, 1, block.func_176222_j(world, pos)); ++ return func_185473_a(world, pos, state); + } + + /** @@ -821,7 +827,7 @@ + * @param numberOfParticles that vanilla would have spawned. + * @return True to prevent vanilla landing particles form spawning. + */ -+ public boolean addLandingEffects(net.minecraft.world.WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles ) ++ public boolean addLandingEffects(IBlockState state, net.minecraft.world.WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles ) + { + return false; + } @@ -832,13 +838,14 @@ + * control over the particles. Useful when you have entirely different + * texture sheets for different sides/locations in the world. + * ++ * @param state The current state + * @param world The current world + * @param target The target the player is looking at {x/y/z/side/sub} + * @param effectRenderer A reference to the current effect renderer. + * @return True to prevent vanilla digging particles form spawning. + */ + @SideOnly(Side.CLIENT) -+ public boolean addHitEffects(World worldObj, MovingObjectPosition target, net.minecraft.client.particle.EffectRenderer effectRenderer) ++ public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, net.minecraft.client.particle.EffectRenderer effectRenderer) + { + return false; + } @@ -871,15 +878,15 @@ + * Plains check if its grass or dirt + * Water check if its still water + * ++ * @param state The Current state + * @param world The current world + * @param pos Block position in world + * @param direction The direction relative to the given position the plant wants to be, typically its UP + * @param plantable The plant that wants to check + * @return True to allow the plant to be planted/stay. + */ -+ 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, net.minecraftforge.common.IPlantable plantable) + { -+ IBlockState state = world.func_180495_p(pos); + IBlockState plant = plantable.getPlant(world, pos.func_177972_a(direction)); + net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.func_177972_a(direction)); + @@ -893,7 +900,7 @@ + return true; + } + -+ if (plantable instanceof BlockBush && ((BlockBush)plantable).func_149854_a(this)) ++ if (plantable instanceof BlockBush && ((BlockBush)plantable).func_185514_i(state)) + { + return true; + } @@ -903,15 +910,15 @@ + case Desert: return this == net.minecraft.init.Blocks.field_150354_m || this == net.minecraft.init.Blocks.field_150405_ch || this == net.minecraft.init.Blocks.field_150406_ce || this == net.minecraft.init.Blocks.field_150346_d; + case Nether: return this == net.minecraft.init.Blocks.field_150425_aM; + case Crop: return this == net.minecraft.init.Blocks.field_150458_ak; -+ case Cave: return isSideSolid(world, pos, EnumFacing.UP); ++ case Cave: return state.isSideSolid(world, pos, EnumFacing.UP); + case Plains: return this == net.minecraft.init.Blocks.field_150349_c || this == net.minecraft.init.Blocks.field_150346_d || this == net.minecraft.init.Blocks.field_150458_ak; -+ case Water: return func_149688_o() == Material.field_151586_h && ((Integer)state.func_177229_b(BlockLiquid.field_176367_b)) == 0; ++ case Water: return state.func_185904_a() == Material.field_151586_h && state.func_177229_b(BlockLiquid.field_176367_b) == 0; + case Beach: + boolean isBeach = this == net.minecraft.init.Blocks.field_150349_c || this == net.minecraft.init.Blocks.field_150346_d || this == net.minecraft.init.Blocks.field_150354_m; -+ boolean hasWater = (world.func_180495_p(pos.func_177974_f()).func_177230_c().func_149688_o() == Material.field_151586_h || -+ world.func_180495_p(pos.func_177976_e()).func_177230_c().func_149688_o() == Material.field_151586_h || -+ world.func_180495_p(pos.func_177978_c()).func_177230_c().func_149688_o() == Material.field_151586_h || -+ world.func_180495_p(pos.func_177968_d()).func_177230_c().func_149688_o() == Material.field_151586_h); ++ boolean hasWater = (world.func_180495_p(pos.func_177974_f()).func_185904_a() == Material.field_151586_h || ++ world.func_180495_p(pos.func_177976_e()).func_185904_a() == Material.field_151586_h || ++ world.func_180495_p(pos.func_177978_c()).func_185904_a() == Material.field_151586_h || ++ world.func_180495_p(pos.func_177968_d()).func_185904_a() == Material.field_151586_h); + return isBeach && hasWater; + } + @@ -927,11 +934,12 @@ + * + * Note: This happens DURING the generation, the generation may not be complete when this is called. + * ++ * @param state The current state + * @param world Current world + * @param pos Block position in world + * @param source Source plant's position in world + */ -+ public void onPlantGrow(World world, BlockPos pos, BlockPos source) ++ public void onPlantGrow(IBlockState state, World world, BlockPos pos, BlockPos source) + { + if (this == net.minecraft.init.Blocks.field_150349_c || this == net.minecraft.init.Blocks.field_150458_ak) + { @@ -966,27 +974,43 @@ + * Recommended that you have your tile entity call relight after being placed if you + * rely on it for light info. + * ++ * @param state The Block state + * @param world The current world + * @param pos Block position in world + * @return The amount of light to block, 0 for air, 255 for fully opaque. + */ -+ public int getLightOpacity(IBlockAccess world, BlockPos pos) ++ public int getLightOpacity(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ return func_149717_k(); ++ return state.func_185891_c(); + } + + /** + * Determines if this block is can be destroyed by the specified entities normal behavior. + * ++ * @param state The current state + * @param world The current world + * @param pos Block position in world + * @return True to allow the ender dragon to destroy this block + */ -+ public boolean canEntityDestroy(IBlockAccess world, BlockPos pos, Entity entity) ++ public boolean canEntityDestroy(IBlockState state, IBlockAccess world, BlockPos pos, Entity entity) + { + if (entity instanceof net.minecraft.entity.boss.EntityDragon) + { -+ return this != net.minecraft.init.Blocks.field_180401_cv && this != net.minecraft.init.Blocks.field_150343_Z && this != net.minecraft.init.Blocks.field_150377_bs && this != net.minecraft.init.Blocks.field_150357_h && this != net.minecraft.init.Blocks.field_150483_bI; ++ return this != net.minecraft.init.Blocks.field_180401_cv && ++ this != net.minecraft.init.Blocks.field_150343_Z && ++ this != net.minecraft.init.Blocks.field_150377_bs && ++ this != net.minecraft.init.Blocks.field_150357_h && ++ this != net.minecraft.init.Blocks.field_150384_bq && ++ this != net.minecraft.init.Blocks.field_150378_br && ++ this != net.minecraft.init.Blocks.field_150483_bI && ++ this != net.minecraft.init.Blocks.field_185776_dc && ++ this != net.minecraft.init.Blocks.field_185777_dd && ++ this != net.minecraft.init.Blocks.field_150411_aY && ++ this != net.minecraft.init.Blocks.field_185775_db; ++ } ++ else if (entity instanceof net.minecraft.entity.boss.EntityWither) ++ { ++ return net.minecraft.entity.boss.EntityWither.func_181033_a(this); + } + + return true; @@ -1019,7 +1043,7 @@ + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { + IBlockState state = world.func_180495_p(pos); -+ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) ++ for (IProperty prop : state.func_177228_b().keySet()) + { + if (prop.func_177701_a().equals("facing") || prop.func_177701_a().equals("rotation")) + { @@ -1040,10 +1064,11 @@ + public EnumFacing[] getValidRotations(World world, BlockPos pos) + { + IBlockState state = world.func_180495_p(pos); -+ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) ++ for (IProperty prop : state.func_177228_b().keySet()) + { + if (prop.func_177701_a().equals("facing") && prop.func_177699_b() == EnumFacing.class) + { ++ @SuppressWarnings("unchecked") + java.util.Collection values = ((java.util.Collection)prop.func_177700_c()); + return values.toArray(new EnumFacing[values.size()]); + } @@ -1070,10 +1095,11 @@ + * @param color The color to change to + * @return If the recoloring was successful + */ ++ @SuppressWarnings({ "unchecked", "rawtypes" }) + public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, net.minecraft.item.EnumDyeColor color) + { + IBlockState state = world.func_180495_p(pos); -+ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) ++ for (IProperty prop : state.func_177228_b().keySet()) + { + if (prop.func_177701_a().equals("color") && prop.func_177699_b() == net.minecraft.item.EnumDyeColor.class) + { @@ -1091,12 +1117,13 @@ + /** + * Gathers how much experience this block drops when broken. + * ++ * @param state The current state + * @param world The world + * @param pos Block position + * @param fortune + * @return Amount of XP from breaking this block. + */ -+ public int getExpDrop(IBlockAccess world, BlockPos pos, int fortune) ++ public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune) + { + return 0; + } @@ -1116,9 +1143,9 @@ + * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side + * @return Whether Block#isProvidingWeakPower should be called when determining indirect power + */ -+ public boolean shouldCheckWeakPower(IBlockAccess world, BlockPos pos, EnumFacing side) ++ public boolean shouldCheckWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) + { -+ return func_149721_r(); ++ return state.func_185915_l(); + } + + /** @@ -1220,7 +1247,7 @@ + /** + * Called when the entity is inside this block, may be used to determined if the entity can breathing, + * display material overlays, or if the entity can swim inside a block. -+ * ++ * + * @param world that is being tested. + * @param blockpos position thats being tested. + * @param iblockstate state at world/blockpos @@ -1230,15 +1257,15 @@ + * @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment. + * @return null for default behavior, true if the entity is within the material, false if it was not. + */ -+ public Boolean isEntityInsideMaterial(World world, BlockPos blockpos, IBlockState iblockstate, Entity entity, double yToTest, Material materialIn, boolean testingHead) ++ public Boolean isEntityInsideMaterial(IBlockAccess world, BlockPos blockpos, IBlockState iblockstate, Entity entity, double yToTest, Material materialIn, boolean testingHead) + { + return null; + } -+ ++ + /** + * Called when boats or fishing hooks are inside the block to check if they are inside + * the material requested. -+ * ++ * + * @param world world that is being tested. + * @param pos block thats being tested. + * @param boundingBox box to test, generally the bounds of an entity that are besting tested. @@ -1254,7 +1281,7 @@ + * Queries if this block should render in a given layer. + * ISmartBlockModel can use MinecraftForgeClient.getRenderLayer to alter their model based on layer + */ -+ public boolean canRenderInLayer(EnumWorldBlockLayer layer) ++ public boolean canRenderInLayer(BlockRenderLayer layer) + { + return func_180664_k() == layer; + } diff --git a/patches/minecraft/net/minecraft/block/BlockBanner.java.patch b/patches/minecraft/net/minecraft/block/BlockBanner.java.patch index 4aa9b6d55c..f2e82e73ed 100644 --- a/patches/minecraft/net/minecraft/block/BlockBanner.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockBanner.java.patch @@ -1,21 +1,13 @@ --- ../src-base/minecraft/net/minecraft/block/BlockBanner.java +++ ../src-work/minecraft/net/minecraft/block/BlockBanner.java -@@ -85,22 +85,7 @@ +@@ -104,14 +104,7 @@ public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { -- TileEntity tileentity = p_180653_1_.func_175625_s(p_180653_2_); +- ItemStack itemstack = this.func_185549_e(p_180653_1_, p_180653_2_, p_180653_3_); - -- if (tileentity instanceof TileEntityBanner) +- if (itemstack != null) { -- ItemStack itemstack = new ItemStack(Items.field_179564_cE, 1, ((TileEntityBanner)tileentity).func_175115_b()); -- NBTTagCompound nbttagcompound = new NBTTagCompound(); -- tileentity.func_145841_b(nbttagcompound); -- nbttagcompound.func_82580_o("x"); -- nbttagcompound.func_82580_o("y"); -- nbttagcompound.func_82580_o("z"); -- nbttagcompound.func_82580_o("id"); -- itemstack.func_77983_a("BlockEntityTag", nbttagcompound); - func_180635_a(p_180653_1_, p_180653_2_, itemstack); - } - else @@ -23,7 +15,7 @@ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); } } -@@ -133,6 +118,28 @@ +@@ -138,6 +131,28 @@ } } @@ -51,4 +43,4 @@ + public static class BlockBannerHanging extends BlockBanner { - public BlockBannerHanging() + protected static final AxisAlignedBB field_185551_d = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 0.78125D, 1.0D); diff --git a/patches/minecraft/net/minecraft/block/BlockBush.java.patch b/patches/minecraft/net/minecraft/block/BlockBush.java.patch index c8c22a6eb9..1bd0b0e43e 100644 --- a/patches/minecraft/net/minecraft/block/BlockBush.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockBush.java.patch @@ -1,40 +1,40 @@ --- ../src-base/minecraft/net/minecraft/block/BlockBush.java +++ ../src-work/minecraft/net/minecraft/block/BlockBush.java -@@ -13,7 +13,7 @@ +@@ -14,7 +14,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class BlockBush extends Block +public class BlockBush extends Block implements net.minecraftforge.common.IPlantable { - protected BlockBush() - { -@@ -36,7 +36,7 @@ + protected static final AxisAlignedBB field_185515_b = new AxisAlignedBB(0.30000001192092896D, 0.0D, 0.30000001192092896D, 0.699999988079071D, 0.6000000238418579D, 0.699999988079071D); + +@@ -37,7 +37,8 @@ public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { -- return super.func_176196_c(p_176196_1_, p_176196_2_) && this.func_149854_a(p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c()); -+ return super.func_176196_c(p_176196_1_, p_176196_2_) && p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c().canSustainPlant(p_176196_1_, p_176196_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this); +- return super.func_176196_c(p_176196_1_, p_176196_2_) && this.func_185514_i(p_176196_1_.func_180495_p(p_176196_2_.func_177977_b())); ++ IBlockState soil = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()); ++ return super.func_176196_c(p_176196_1_, p_176196_2_) && soil.func_177230_c().canSustainPlant(soil, p_176196_1_, p_176196_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this); } - protected boolean func_149854_a(Block p_149854_1_) -@@ -66,7 +66,10 @@ + protected boolean func_185514_i(IBlockState p_185514_1_) +@@ -67,6 +68,11 @@ public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) { -- return this.func_149854_a(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c()); -+ BlockPos down = p_180671_2_.func_177977_b(); -+ Block soil = p_180671_1_.func_180495_p(down).func_177230_c(); -+ if (p_180671_3_.func_177230_c() != this) return this.func_149854_a(soil); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. -+ return soil.canSustainPlant(p_180671_1_, down, net.minecraft.util.EnumFacing.UP, this); ++ if (p_180671_3_.func_177230_c() == this) //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. ++ { ++ IBlockState soil = p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()); ++ return soil.func_177230_c().canSustainPlant(soil, p_180671_1_, p_180671_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this); ++ } + return this.func_185514_i(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b())); } - public AxisAlignedBB func_180640_a(World p_180640_1_, BlockPos p_180640_2_, IBlockState p_180640_3_) -@@ -89,4 +92,33 @@ - { - return EnumWorldBlockLayer.CUTOUT; +@@ -90,6 +96,35 @@ + return false; } -+ + + @Override + public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) + { @@ -63,4 +63,7 @@ + if (state.func_177230_c() != this) return func_176223_P(); + return state; + } - } ++ + @SideOnly(Side.CLIENT) + public BlockRenderLayer func_180664_k() + { diff --git a/patches/minecraft/net/minecraft/block/BlockButton.java.patch b/patches/minecraft/net/minecraft/block/BlockButton.java.patch index 58cd177066..984b01117d 100644 --- a/patches/minecraft/net/minecraft/block/BlockButton.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockButton.java.patch @@ -1,12 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockButton.java +++ ../src-work/minecraft/net/minecraft/block/BlockButton.java -@@ -74,8 +74,7 @@ - +@@ -89,7 +89,7 @@ protected static boolean func_181088_a(World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_) { -- BlockPos blockpos = p_181088_1_.func_177972_a(p_181088_2_); -- return p_181088_2_ == EnumFacing.DOWN ? World.func_175683_a(p_181088_0_, blockpos) : p_181088_0_.func_180495_p(blockpos).func_177230_c().func_149721_r(); -+ return p_181088_2_ == EnumFacing.DOWN && World.func_175683_a(p_181088_0_, p_181088_1_.func_177977_b()) ? true : p_181088_0_.isSideSolid(p_181088_1_.func_177972_a(p_181088_2_), p_181088_2_.func_176734_d()); + BlockPos blockpos = p_181088_1_.func_177972_a(p_181088_2_); +- return p_181088_2_ == EnumFacing.DOWN ? p_181088_0_.func_180495_p(blockpos).func_185896_q() : p_181088_0_.func_180495_p(blockpos).func_185915_l(); ++ return p_181088_0_.func_180495_p(blockpos).isSideSolid(p_181088_0_, blockpos, p_181088_2_.func_176734_d()); } public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) diff --git a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch index 17dfb0356e..7d568610dd 100644 --- a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch @@ -8,21 +8,22 @@ +public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable { public static final PropertyInteger field_176587_a = PropertyInteger.func_177719_a("age", 0, 15); - -@@ -109,7 +109,7 @@ + protected static final AxisAlignedBB field_185593_b = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.9375D, 0.9375D); +@@ -110,8 +110,8 @@ + } } - Block block = p_176586_1_.func_180495_p(p_176586_2_.func_177977_b()).func_177230_c(); -- return block == Blocks.field_150434_aF || block == Blocks.field_150354_m; -+ return block.canSustainPlant(p_176586_1_, p_176586_2_.func_177977_b(), EnumFacing.UP, this); +- Block block = p_176586_1_.func_180495_p(p_176586_2_.func_177977_b()).func_177230_c(); +- return block == Blocks.field_150434_aF || block == Blocks.field_150354_m && !p_176586_1_.func_180495_p(p_176586_2_.func_177984_a()).func_185904_a().func_76224_d(); ++ IBlockState state = p_176586_1_.func_180495_p(p_176586_2_.func_177977_b()); ++ return state.func_177230_c().canSustainPlant(state, p_176586_1_, p_176586_2_, EnumFacing.UP, this) && !p_176586_1_.func_180495_p(p_176586_2_.func_177984_a()).func_185904_a().func_76224_d(); } public void func_180634_a(World p_180634_1_, BlockPos p_180634_2_, IBlockState p_180634_3_, Entity p_180634_4_) -@@ -137,4 +137,16 @@ - { - return new BlockState(this, new IProperty[] {field_176587_a}); +@@ -135,6 +135,18 @@ + return ((Integer)p_176201_1_.func_177229_b(field_176587_a)).intValue(); } -+ + + @Override + public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) + { @@ -34,4 +35,7 @@ + { + return func_176223_P(); + } - } ++ + protected BlockStateContainer func_180661_e() + { + return new BlockStateContainer(this, new IProperty[] {field_176587_a}); diff --git a/patches/minecraft/net/minecraft/block/BlockChest.java.patch b/patches/minecraft/net/minecraft/block/BlockChest.java.patch index 90f209e193..08fcab8974 100644 --- a/patches/minecraft/net/minecraft/block/BlockChest.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockChest.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockChest.java +++ ../src-work/minecraft/net/minecraft/block/BlockChest.java -@@ -527,7 +527,7 @@ +@@ -506,7 +506,7 @@ private boolean func_176456_n(World p_176456_1_, BlockPos p_176456_2_) { -- return p_176456_1_.func_180495_p(p_176456_2_.func_177984_a()).func_177230_c().func_149721_r(); -+ return p_176456_1_.isSideSolid(p_176456_2_.func_177984_a(), EnumFacing.DOWN, false); +- return p_176456_1_.func_180495_p(p_176456_2_.func_177984_a()).func_185915_l(); ++ return p_176456_1_.func_180495_p(p_176456_2_.func_177984_a()).isSideSolid(p_176456_1_, p_176456_2_, EnumFacing.DOWN); } private boolean func_176453_o(World p_176453_1_, BlockPos p_176453_2_) diff --git a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch index 5ecbf9a686..bbdb460ba9 100644 --- a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java +++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java -@@ -137,7 +137,14 @@ +@@ -131,7 +131,14 @@ public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { @@ -16,7 +16,7 @@ int j = 1; if (i >= 2) -@@ -147,8 +154,9 @@ +@@ -141,8 +148,9 @@ for (int k = 0; k < j; ++k) { @@ -26,4 +26,4 @@ + return dropped; } - @SideOnly(Side.CLIENT) + public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) diff --git a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch index ed9298153e..55eadae084 100644 --- a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockCrops.java +++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java -@@ -81,11 +81,11 @@ +@@ -116,11 +116,11 @@ float f1 = 0.0F; IBlockState iblockstate = p_180672_1_.func_180495_p(blockpos.func_177982_a(i, 0, j)); - if (iblockstate.func_177230_c() == Blocks.field_150458_ak) -+ if (iblockstate.func_177230_c().canSustainPlant(p_180672_1_, blockpos.func_177982_a(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)p_180672_0_)) ++ if (iblockstate.func_177230_c().canSustainPlant(iblockstate, p_180672_1_, blockpos.func_177982_a(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)p_180672_0_)) { f1 = 1.0F; @@ -14,45 +14,20 @@ { f1 = 3.0F; } -@@ -126,7 +126,7 @@ +@@ -161,7 +161,8 @@ public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) { -- return (p_180671_1_.func_175699_k(p_180671_2_) >= 8 || p_180671_1_.func_175678_i(p_180671_2_)) && this.func_149854_a(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c()); -+ return (p_180671_1_.func_175699_k(p_180671_2_) >= 8 || p_180671_1_.func_175678_i(p_180671_2_)) && p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c().canSustainPlant(p_180671_1_, p_180671_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this); +- return (p_180671_1_.func_175699_k(p_180671_2_) >= 8 || p_180671_1_.func_175678_i(p_180671_2_)) && this.func_185514_i(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b())); ++ IBlockState soil = p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()); ++ return (p_180671_1_.func_175699_k(p_180671_2_) >= 8 || p_180671_1_.func_175678_i(p_180671_2_)) && soil.func_177230_c().canSustainPlant(soil, p_180671_1_, p_180671_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this); } protected Item func_149866_i() -@@ -142,24 +142,6 @@ - public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) - { - super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, 0); -- -- if (!p_180653_1_.field_72995_K) -- { -- int i = ((Integer)p_180653_3_.func_177229_b(field_176488_a)).intValue(); -- -- if (i >= 7) -- { -- int j = 3 + p_180653_5_; -- -- for (int k = 0; k < j; ++k) -- { -- if (p_180653_1_.field_73012_v.nextInt(15) <= i) -- { -- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(this.func_149866_i(), 1, 0)); -- } -- } -- } -- } +@@ -174,11 +175,33 @@ + return Items.field_151015_O; } - public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) -@@ -202,4 +184,26 @@ - { - return new BlockState(this, new IProperty[] {field_176488_a}); - } -+ + @Override + public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { @@ -74,4 +49,13 @@ + } + return ret; + } - } ++ + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) + { + super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, 0); + +- if (!p_180653_1_.field_72995_K) ++ if (false && !p_180653_1_.field_72995_K) // Forge: NOP all this. + { + int i = this.func_185527_x(p_180653_3_); + diff --git a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch index a350513b45..5ef70af15e 100644 --- a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch @@ -1,26 +1,25 @@ --- ../src-base/minecraft/net/minecraft/block/BlockDeadBush.java +++ ../src-work/minecraft/net/minecraft/block/BlockDeadBush.java -@@ -14,7 +14,7 @@ - import net.minecraft.util.BlockPos; +@@ -16,7 +16,7 @@ + import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockDeadBush extends BlockBush +public class BlockDeadBush extends BlockBush implements net.minecraftforge.common.IShearable { - protected BlockDeadBush() - { -@@ -45,14 +45,15 @@ + protected static final AxisAlignedBB field_185516_a = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D); - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) +@@ -57,7 +57,7 @@ + + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_, ItemStack p_180657_6_) { -- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) +- if (!p_180657_1_.field_72995_K && p_180657_6_ != null && p_180657_6_.func_77973_b() == Items.field_151097_aZ) ++ if (false && !p_180657_1_.field_72995_K && p_180657_6_ != null && p_180657_6_.func_77973_b() == Items.field_151097_aZ) // Forge: Noop { -- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); -- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150330_I, 1, 0)); -- } -- else -- { - super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); + p_180657_2_.func_71029_a(StatList.func_188055_a(this)); + func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150330_I, 1, 0)); +@@ -67,4 +67,11 @@ + super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_); } } + @@ -28,6 +27,6 @@ + @Override + public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(Blocks.field_150330_I))); ++ return java.util.Arrays.asList(new ItemStack(Blocks.field_150330_I)); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch index de31efb01b..51d575be8a 100644 --- a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockDoor.java +++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java -@@ -154,7 +154,7 @@ +@@ -107,7 +107,7 @@ { if (this.field_149764_J == Material.field_151573_f) { @@ -9,12 +9,12 @@ } else { -@@ -272,7 +272,7 @@ +@@ -219,7 +219,7 @@ public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { -- return p_176196_2_.func_177956_o() >= 255 ? false : World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()) && super.func_176196_c(p_176196_1_, p_176196_2_) && super.func_176196_c(p_176196_1_, p_176196_2_.func_177984_a()); -+ return p_176196_2_.func_177956_o() >= p_176196_1_.func_72800_K() - 1 ? false : World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()) && super.func_176196_c(p_176196_1_, p_176196_2_) && super.func_176196_c(p_176196_1_, p_176196_2_.func_177984_a()); +- return p_176196_2_.func_177956_o() >= 255 ? false : p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_185896_q() && super.func_176196_c(p_176196_1_, p_176196_2_) && super.func_176196_c(p_176196_1_, p_176196_2_.func_177984_a()); ++ return p_176196_2_.func_177956_o() >= p_176196_1_.func_72800_K() - 1 ? false : p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).isSideSolid(p_176196_1_, p_176196_2_.func_177977_b(), EnumFacing.UP) && super.func_176196_c(p_176196_1_, p_176196_2_) && super.func_176196_c(p_176196_1_, p_176196_2_.func_177984_a()); } - public int func_149656_h() + public EnumPushReaction func_149656_h(IBlockState p_149656_1_) diff --git a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch index 2218435af4..1a92f21a62 100644 --- a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch @@ -9,7 +9,7 @@ { public static final PropertyEnum field_176493_a = PropertyEnum.func_177709_a("variant", BlockDoublePlant.EnumPlantType.class); public static final PropertyEnum field_176492_b = PropertyEnum.func_177709_a("half", BlockDoublePlant.EnumBlockHalf.class); -@@ -90,6 +90,8 @@ +@@ -88,6 +88,8 @@ Block block = (Block)(flag ? this : p_176475_1_.func_180495_p(blockpos).func_177230_c()); Block block1 = (Block)(flag ? p_176475_1_.func_180495_p(blockpos1).func_177230_c() : this); @@ -18,7 +18,7 @@ if (block == this) { p_176475_1_.func_180501_a(blockpos, Blocks.field_150350_a.func_176223_P(), 2); -@@ -98,17 +100,13 @@ +@@ -96,17 +98,13 @@ if (block1 == this) { p_176475_1_.func_180501_a(blockpos1, Blocks.field_150350_a.func_176223_P(), 3); @@ -37,24 +37,24 @@ if (p_180671_3_.func_177229_b(field_176492_b) == BlockDoublePlant.EnumBlockHalf.UPPER) { return p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c() == this; -@@ -158,7 +156,6 @@ +@@ -149,7 +147,6 @@ - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_, ItemStack p_180657_6_) { -- if (p_180657_1_.field_72995_K || p_180657_2_.func_71045_bC() == null || p_180657_2_.func_71045_bC().func_77973_b() != Items.field_151097_aZ || p_180657_4_.func_177229_b(field_176492_b) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.func_176489_b(p_180657_1_, p_180657_3_, p_180657_4_, p_180657_2_)) +- if (p_180657_1_.field_72995_K || p_180657_6_ == null || p_180657_6_.func_77973_b() != Items.field_151097_aZ || p_180657_4_.func_177229_b(field_176492_b) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.func_176489_b(p_180657_1_, p_180657_3_, p_180657_4_, p_180657_2_)) { - super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); + super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_); } -@@ -221,8 +218,6 @@ +@@ -212,8 +209,6 @@ else { - p_176489_4_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); + p_176489_4_.func_71029_a(StatList.func_188055_a(this)); - int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).func_177044_a(); - func_180635_a(p_176489_1_, p_176489_2_, new ItemStack(Blocks.field_150329_H, 2, i)); return true; } } -@@ -293,6 +288,32 @@ +@@ -284,6 +279,33 @@ return Block.EnumOffsetType.XZ; } @@ -65,6 +65,7 @@ + EnumPlantType type = (EnumPlantType)state.func_177229_b(field_176493_a); + return state.func_177229_b(field_176492_b) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS); + } ++ + @Override + public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { @@ -74,11 +75,11 @@ + if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.field_150329_H, 2, BlockTallGrass.EnumType.GRASS.func_177044_a())); + return ret; + } ++ + @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) + { + //Forge: Break both parts on the client to prevent the top part flickering as default type for a few frames. -+ IBlockState state = world.func_180495_p(pos); + if (state.func_177230_c() == this && state.func_177229_b(field_176492_b) == EnumBlockHalf.LOWER && world.func_180495_p(pos.func_177984_a()).func_177230_c() == this) + world.func_175698_g(pos.func_177984_a()); + return world.func_175698_g(pos); diff --git a/patches/minecraft/net/minecraft/block/BlockDragonEgg.java.patch b/patches/minecraft/net/minecraft/block/BlockDragonEgg.java.patch new file mode 100644 index 0000000000..2eb9dd2a20 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockDragonEgg.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockDragonEgg.java ++++ ../src-work/minecraft/net/minecraft/block/BlockDragonEgg.java +@@ -48,7 +48,7 @@ + + private void func_180683_d(World p_180683_1_, BlockPos p_180683_2_) + { +- if (BlockFalling.func_185759_i(p_180683_1_.func_180495_p(p_180683_2_.func_177977_b())) && p_180683_2_.func_177956_o() >= 0) ++ if (p_180683_1_.func_175623_d(p_180683_2_.func_177977_b()) && BlockFalling.func_185759_i(p_180683_1_.func_180495_p(p_180683_2_.func_177977_b())) && p_180683_2_.func_177956_o() >= 0) + { + int i = 32; + +@@ -61,7 +61,7 @@ + p_180683_1_.func_175698_g(p_180683_2_); + BlockPos blockpos; + +- for (blockpos = p_180683_2_; BlockFalling.func_185759_i(p_180683_1_.func_180495_p(blockpos)) && blockpos.func_177956_o() > 0; blockpos = blockpos.func_177977_b()) ++ for (blockpos = p_180683_2_; p_180683_1_.func_175623_d(blockpos) && BlockFalling.func_185759_i(p_180683_1_.func_180495_p(blockpos)) && blockpos.func_177956_o() > 0; blockpos = blockpos.func_177977_b()) + { + ; + } diff --git a/patches/minecraft/net/minecraft/block/BlockFalling.java.patch b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch index 811cb1a2c5..60dba8b047 100644 --- a/patches/minecraft/net/minecraft/block/BlockFalling.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch @@ -1,10 +1,20 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFalling.java +++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java -@@ -86,6 +86,7 @@ +@@ -44,7 +44,7 @@ - public static boolean func_180685_d(World p_180685_0_, BlockPos p_180685_1_) + private void func_176503_e(World p_176503_1_, BlockPos p_176503_2_) { -+ if (p_180685_0_.func_175623_d(p_180685_1_)) return true; - Block block = p_180685_0_.func_180495_p(p_180685_1_).func_177230_c(); - Material material = block.field_149764_J; - return block == Blocks.field_150480_ab || material == Material.field_151579_a || material == Material.field_151586_h || material == Material.field_151587_i; +- if (func_185759_i(p_176503_1_.func_180495_p(p_176503_2_.func_177977_b())) && p_176503_2_.func_177956_o() >= 0) ++ if (p_176503_1_.func_175623_d(p_176503_2_) && func_185759_i(p_176503_1_.func_180495_p(p_176503_2_.func_177977_b())) && p_176503_2_.func_177956_o() >= 0) + { + int i = 32; + +@@ -62,7 +62,7 @@ + p_176503_1_.func_175698_g(p_176503_2_); + BlockPos blockpos; + +- for (blockpos = p_176503_2_.func_177977_b(); func_185759_i(p_176503_1_.func_180495_p(blockpos)) && blockpos.func_177956_o() > 0; blockpos = blockpos.func_177977_b()) ++ for (blockpos = p_176503_2_.func_177977_b(); p_176503_1_.func_175623_d(blockpos) && func_185759_i(p_176503_1_.func_180495_p(blockpos)) && blockpos.func_177956_o() > 0; blockpos = blockpos.func_177977_b()) + { + ; + } diff --git a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch index 7547658d37..6332eeec8b 100644 --- a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java +++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java -@@ -89,7 +89,7 @@ +@@ -87,7 +87,7 @@ private boolean func_176529_d(World p_176529_1_, BlockPos p_176529_2_) { Block block = p_176529_1_.func_180495_p(p_176529_2_.func_177984_a()).func_177230_c(); - return block instanceof BlockCrops || block instanceof BlockStem; -+ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(p_176529_1_, p_176529_2_, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block); ++ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(p_176529_1_.func_180495_p(p_176529_2_), p_176529_1_, p_176529_2_, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block); } private boolean func_176530_e(World p_176530_1_, BlockPos p_176530_2_) diff --git a/patches/minecraft/net/minecraft/block/BlockFire.java.patch b/patches/minecraft/net/minecraft/block/BlockFire.java.patch index 05ab962bc2..62f2ba905f 100644 --- a/patches/minecraft/net/minecraft/block/BlockFire.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFire.java.patch @@ -1,34 +1,23 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFire.java +++ ../src-work/minecraft/net/minecraft/block/BlockFire.java -@@ -41,18 +41,24 @@ - int j = p_176221_3_.func_177956_o(); - int k = p_176221_3_.func_177952_p(); +@@ -37,7 +37,15 @@ -- if (!World.func_175683_a(p_176221_2_, p_176221_3_.func_177977_b()) && !Blocks.field_150480_ab.func_176535_e(p_176221_2_, p_176221_3_.func_177977_b())) -+ if (!World.func_175683_a(p_176221_2_, p_176221_3_.func_177977_b()) && !Blocks.field_150480_ab.canCatchFire(p_176221_2_, p_176221_3_.func_177977_b(), EnumFacing.UP)) - { - boolean flag = (i + j + k & 1) == 1; - boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1; - int l = 0; + public IBlockState func_176221_a(IBlockState p_176221_1_, IBlockAccess p_176221_2_, BlockPos p_176221_3_) + { +- return !p_176221_2_.func_180495_p(p_176221_3_.func_177977_b()).func_185896_q() && !Blocks.field_150480_ab.func_176535_e(p_176221_2_, p_176221_3_.func_177977_b()) ? p_176221_1_.func_177226_a(field_176545_N, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177978_c()))).func_177226_a(field_176546_O, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177974_f()))).func_177226_a(field_176541_P, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177968_d()))).func_177226_a(field_176539_Q, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177976_e()))).func_177226_a(field_176542_R, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177984_a()))) : this.func_176223_P(); ++ if (!p_176221_2_.func_180495_p(p_176221_3_.func_177977_b()).isSideSolid(p_176221_2_, p_176221_3_.func_177977_b(), EnumFacing.UP) && !Blocks.field_150480_ab.canCatchFire(p_176221_2_, p_176221_3_.func_177977_b(), EnumFacing.UP)) ++ { ++ return p_176221_1_.func_177226_a(field_176545_N, this.canCatchFire(p_176221_2_, p_176221_3_.func_177978_c(), EnumFacing.SOUTH)) ++ .func_177226_a(field_176546_O, this.canCatchFire(p_176221_2_, p_176221_3_.func_177974_f(), EnumFacing.WEST)) ++ .func_177226_a(field_176541_P, this.canCatchFire(p_176221_2_, p_176221_3_.func_177968_d(), EnumFacing.NORTH)) ++ .func_177226_a(field_176539_Q, this.canCatchFire(p_176221_2_, p_176221_3_.func_177976_e(), EnumFacing.EAST)) ++ .func_177226_a(field_176542_R, this.canCatchFire(p_176221_2_, p_176221_3_.func_177984_a(), EnumFacing.DOWN)); ++ } ++ return this.func_176223_P(); + } -- if (this.func_176535_e(p_176221_2_, p_176221_3_.func_177984_a())) -+ if (this.canCatchFire(p_176221_2_, p_176221_3_.func_177984_a(), EnumFacing.DOWN)) - { - l = flag ? 1 : 2; - } - -- return p_176221_1_.func_177226_a(field_176545_N, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177978_c()))).func_177226_a(field_176546_O, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177974_f()))).func_177226_a(field_176541_P, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177968_d()))).func_177226_a(field_176539_Q, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177976_e()))).func_177226_a(field_176542_R, Integer.valueOf(l)).func_177226_a(field_176540_b, Boolean.valueOf(flag1)).func_177226_a(field_176544_M, Boolean.valueOf(flag)); -+ return p_176221_1_.func_177226_a(field_176545_N, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177978_c(), EnumFacing.SOUTH))) -+ .func_177226_a(field_176546_O, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177974_f(), EnumFacing.EAST ))) -+ .func_177226_a(field_176541_P, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177968_d(), EnumFacing.NORTH))) -+ .func_177226_a(field_176539_Q, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177976_e(), EnumFacing.EAST ))) -+ .func_177226_a(field_176542_R, Integer.valueOf(l)) -+ .func_177226_a(field_176540_b, Boolean.valueOf(flag1)) -+ .func_177226_a(field_176544_M, Boolean.valueOf(flag)); - } - else - { -@@ -108,6 +114,7 @@ + protected BlockFire() +@@ -90,6 +98,7 @@ public void func_180686_a(Block p_180686_1_, int p_180686_2_, int p_180686_3_) { @@ -36,7 +25,7 @@ this.field_149849_a.put(p_180686_1_, Integer.valueOf(p_180686_2_)); this.field_149848_b.put(p_180686_1_, Integer.valueOf(p_180686_3_)); } -@@ -147,13 +154,8 @@ +@@ -129,13 +138,8 @@ } Block block = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_177230_c(); @@ -48,10 +37,19 @@ - flag = true; - } - - if (!flag && p_180650_1_.func_72896_J() && this.func_176537_d(p_180650_1_, p_180650_2_)) - { - p_180650_1_.func_175698_g(p_180650_2_); -@@ -182,7 +184,7 @@ + int i = ((Integer)p_180650_3_.func_177229_b(field_176543_a)).intValue(); + + if (!flag && p_180650_1_.func_72896_J() && this.func_176537_d(p_180650_1_, p_180650_2_) && p_180650_4_.nextFloat() < 0.2F + (float)i * 0.03F) +@@ -156,7 +160,7 @@ + { + if (!this.func_176533_e(p_180650_1_, p_180650_2_)) + { +- if (!p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_185896_q() || i > 3) ++ if (!p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).isSideSolid(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP) || i > 3) + { + p_180650_1_.func_175698_g(p_180650_2_); + } +@@ -164,7 +168,7 @@ return; } @@ -60,7 +58,7 @@ { p_180650_1_.func_175698_g(p_180650_2_); return; -@@ -197,12 +199,12 @@ +@@ -179,12 +183,12 @@ j = -50; } @@ -79,7 +77,7 @@ for (int k = -1; k <= 1; ++k) { -@@ -261,22 +263,30 @@ +@@ -243,45 +247,53 @@ return false; } @@ -104,14 +102,44 @@ + this.tryCatchFire(p_176536_1_, p_176536_2_, p_176536_3_, p_176536_4_, p_176536_5_, EnumFacing.UP); + } -+ private void tryCatchFire(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_, EnumFacing face) +- if (p_176536_4_.nextInt(p_176536_3_) < i) ++ private void tryCatchFire(World worldIn, BlockPos pos, int chance, Random random, int age, EnumFacing face) + { -+ int i = p_176536_1_.func_180495_p(p_176536_2_).func_177230_c().getFlammability(p_176536_1_, p_176536_2_, face); ++ int i = worldIn.func_180495_p(pos).func_177230_c().getFlammability(worldIn, pos, face); + - if (p_176536_4_.nextInt(p_176536_3_) < i) ++ if (random.nextInt(chance) < i) { - IBlockState iblockstate = p_176536_1_.func_180495_p(p_176536_2_); -@@ -308,7 +318,7 @@ +- IBlockState iblockstate = p_176536_1_.func_180495_p(p_176536_2_); ++ IBlockState iblockstate = worldIn.func_180495_p(pos); + +- if (p_176536_4_.nextInt(p_176536_5_ + 10) < 5 && !p_176536_1_.func_175727_C(p_176536_2_)) ++ if (random.nextInt(age + 10) < 5 && !worldIn.func_175727_C(pos)) + { +- int j = p_176536_5_ + p_176536_4_.nextInt(5) / 4; ++ int j = age + random.nextInt(5) / 4; + + if (j > 15) + { + j = 15; + } + +- p_176536_1_.func_180501_a(p_176536_2_, this.func_176223_P().func_177226_a(field_176543_a, Integer.valueOf(j)), 3); ++ worldIn.func_180501_a(pos, this.func_176223_P().func_177226_a(field_176543_a, Integer.valueOf(j)), 3); + } + else + { +- p_176536_1_.func_175698_g(p_176536_2_); ++ worldIn.func_175698_g(pos); + } + + if (iblockstate.func_177230_c() == Blocks.field_150335_W) + { +- Blocks.field_150335_W.func_176206_d(p_176536_1_, p_176536_2_, iblockstate.func_177226_a(BlockTNT.field_176246_a, Boolean.valueOf(true))); ++ Blocks.field_150335_W.func_176206_d(worldIn, pos, iblockstate.func_177226_a(BlockTNT.field_176246_a, Boolean.valueOf(true))); + } + } + } +@@ -290,7 +302,7 @@ { for (EnumFacing enumfacing : EnumFacing.values()) { @@ -120,7 +148,7 @@ { return true; } -@@ -329,7 +339,7 @@ +@@ -311,7 +323,7 @@ for (EnumFacing enumfacing : EnumFacing.values()) { @@ -129,7 +157,7 @@ } return i; -@@ -341,9 +351,10 @@ +@@ -323,9 +335,10 @@ return false; } @@ -141,57 +169,57 @@ } public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) -@@ -382,9 +393,9 @@ - p_180655_1_.func_72980_b((double)((float)p_180655_2_.func_177958_n() + 0.5F), (double)((float)p_180655_2_.func_177956_o() + 0.5F), (double)((float)p_180655_2_.func_177952_p() + 0.5F), "fire.fire", 1.0F + p_180655_4_.nextFloat(), p_180655_4_.nextFloat() * 0.7F + 0.3F, false); +@@ -364,9 +377,9 @@ + p_180655_2_.func_184134_a((double)((float)p_180655_3_.func_177958_n() + 0.5F), (double)((float)p_180655_3_.func_177956_o() + 0.5F), (double)((float)p_180655_3_.func_177952_p() + 0.5F), SoundEvents.field_187643_bs, SoundCategory.BLOCKS, 1.0F + p_180655_4_.nextFloat(), p_180655_4_.nextFloat() * 0.7F + 0.3F, false); } -- if (!World.func_175683_a(p_180655_1_, p_180655_2_.func_177977_b()) && !Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177977_b())) -+ if (!World.func_175683_a(p_180655_1_, p_180655_2_.func_177977_b()) && !Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177977_b(), EnumFacing.UP)) +- if (!p_180655_2_.func_180495_p(p_180655_3_.func_177977_b()).func_185896_q() && !Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177977_b())) ++ if (!p_180655_2_.func_180495_p(p_180655_3_.func_177977_b()).isSideSolid(p_180655_2_, p_180655_3_.func_177977_b(), EnumFacing.UP) && !Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177977_b(), EnumFacing.UP)) { -- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177976_e())) -+ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177976_e(), EnumFacing.EAST)) +- if (Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177976_e())) ++ if (Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177976_e(), EnumFacing.EAST)) { for (int j = 0; j < 2; ++j) { -@@ -395,7 +406,7 @@ +@@ -377,7 +390,7 @@ } } -- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177974_f())) -+ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177974_f(), EnumFacing.WEST)) +- if (Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177974_f())) ++ if (Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177974_f(), EnumFacing.WEST)) { for (int k = 0; k < 2; ++k) { -@@ -406,7 +417,7 @@ +@@ -388,7 +401,7 @@ } } -- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177978_c())) -+ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177978_c(), EnumFacing.SOUTH)) +- if (Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177978_c())) ++ if (Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177978_c(), EnumFacing.SOUTH)) { for (int l = 0; l < 2; ++l) { -@@ -417,7 +428,7 @@ +@@ -399,7 +412,7 @@ } } -- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177968_d())) -+ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177968_d(), EnumFacing.NORTH)) +- if (Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177968_d())) ++ if (Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177968_d(), EnumFacing.NORTH)) { for (int i1 = 0; i1 < 2; ++i1) { -@@ -428,7 +439,7 @@ +@@ -410,7 +423,7 @@ } } -- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177984_a())) -+ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177984_a(), EnumFacing.DOWN)) +- if (Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177984_a())) ++ if (Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177984_a(), EnumFacing.DOWN)) { for (int j1 = 0; j1 < 2; ++j1) { -@@ -476,4 +487,19 @@ +@@ -458,4 +471,19 @@ { - return new BlockState(this, new IProperty[] {field_176543_a, field_176545_N, field_176546_O, field_176541_P, field_176539_Q, field_176542_R, field_176540_b, field_176544_M}); + return new BlockStateContainer(this, new IProperty[] {field_176543_a, field_176545_N, field_176546_O, field_176541_P, field_176539_Q, field_176542_R}); } + + /*================================= Forge Start ======================================*/ diff --git a/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch index 24229b07bf..cf36d9316f 100644 --- a/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java +++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java -@@ -169,13 +169,6 @@ +@@ -148,13 +148,6 @@ public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) { @@ -14,8 +14,8 @@ super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_); } -@@ -395,6 +388,31 @@ - return EnumWorldBlockLayer.CUTOUT; +@@ -374,6 +367,31 @@ + return BlockRenderLayer.CUTOUT; } + @@ -30,15 +30,15 @@ + return ret; + } + @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 (willHarvest) return true; //If it will harvest, delay deletion of the block until after getDrops -+ return super.removedByPlayer(world, pos, player, willHarvest); ++ return super.removedByPlayer(state, world, pos, player, willHarvest); + } + @Override -+ public void func_180657_a(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) ++ public void func_180657_a(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack tool) + { -+ super.func_180657_a(world, player, pos, state, te); ++ super.func_180657_a(world, player, pos, state, te, tool); + world.func_175698_g(pos); + } + /*===========================FORGE END==========================================*/ diff --git a/patches/minecraft/net/minecraft/block/BlockGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch index 7f957e591d..d56f0539ba 100644 --- a/patches/minecraft/net/minecraft/block/BlockGrass.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch @@ -1,24 +1,24 @@ --- ../src-base/minecraft/net/minecraft/block/BlockGrass.java +++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java -@@ -58,7 +58,7 @@ +@@ -38,7 +38,7 @@ { if (!p_180650_1_.field_72995_K) { -- if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_177230_c().func_149717_k() > 2) -+ if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_177230_c().getLightOpacity(p_180650_1_, p_180650_2_.func_177984_a()) > 2) +- if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_185891_c() > 2) ++ if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).getLightOpacity(p_180650_1_, p_180650_2_.func_177984_a()) > 2) { p_180650_1_.func_175656_a(p_180650_2_, Blocks.field_150346_d.func_176223_P()); } -@@ -72,7 +72,7 @@ - Block block = p_180650_1_.func_180495_p(blockpos.func_177984_a()).func_177230_c(); - IBlockState iblockstate = p_180650_1_.func_180495_p(blockpos); +@@ -58,7 +58,7 @@ + IBlockState iblockstate = p_180650_1_.func_180495_p(blockpos.func_177984_a()); + IBlockState iblockstate1 = p_180650_1_.func_180495_p(blockpos); -- if (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos.func_177984_a()) >= 4 && block.func_149717_k() <= 2) -+ if (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos.func_177984_a()) >= 4 && block.getLightOpacity(p_180650_1_, blockpos.func_177984_a()) <= 2) +- if (iblockstate1.func_177230_c() == Blocks.field_150346_d && iblockstate1.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos.func_177984_a()) >= 4 && iblockstate.func_185891_c() <= 2) ++ if (iblockstate1.func_177230_c() == Blocks.field_150346_d && iblockstate1.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos.func_177984_a()) >= 4 && iblockstate.getLightOpacity(p_180650_1_, p_180650_2_.func_177984_a()) <= 2) { p_180650_1_.func_175656_a(blockpos, Blocks.field_150349_c.func_176223_P()); } -@@ -110,7 +110,7 @@ +@@ -96,7 +96,7 @@ { if (j >= i / 16) { diff --git a/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch index cfc4d531f6..c4f0ba3963 100644 --- a/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch @@ -1,13 +1,13 @@ --- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java +++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java -@@ -79,6 +79,20 @@ - return new BlockState(this, new IProperty[] {field_176380_a}); +@@ -221,6 +221,20 @@ + return new BlockStateContainer(this, new IProperty[] {field_176380_a}); } + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { + IBlockState state = world.func_180495_p(pos); -+ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) ++ for (IProperty prop : (java.util.Set>)state.func_177228_b().keySet()) + { + if (prop.func_177701_a().equals("variant")) + { diff --git a/patches/minecraft/net/minecraft/block/BlockIce.java.patch b/patches/minecraft/net/minecraft/block/BlockIce.java.patch index b2ff04fe65..e7570c6932 100644 --- a/patches/minecraft/net/minecraft/block/BlockIce.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockIce.java.patch @@ -1,35 +1,34 @@ --- ../src-base/minecraft/net/minecraft/block/BlockIce.java +++ ../src-work/minecraft/net/minecraft/block/BlockIce.java -@@ -38,14 +38,17 @@ - p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); +@@ -40,14 +40,19 @@ + p_180657_2_.func_71029_a(StatList.func_188055_a(this)); p_180657_2_.func_71020_j(0.025F); -- if (this.func_149700_E() && EnchantmentHelper.func_77502_d(p_180657_2_)) -+ if (this.canSilkHarvest(p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), p_180657_2_) && EnchantmentHelper.func_77502_d(p_180657_2_)) +- if (this.func_149700_E() && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) ++ if (this.canSilkHarvest(p_180657_1_, p_180657_3_, p_180657_4_, p_180657_2_) && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) { + java.util.List items = new java.util.ArrayList(); ItemStack itemstack = this.func_180643_i(p_180657_4_); -- if (itemstack != null) -- { + if (itemstack != null) + { - func_180635_a(p_180657_1_, p_180657_3_, itemstack); -- } -+ if (itemstack != null) items.add(itemstack); -+ -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), 0, 1.0f, true, p_180657_2_); ++ items.add(itemstack); + } + ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_4_, 0, 1.0f, true, p_180657_2_); + for (ItemStack is : items) + func_180635_a(p_180657_1_, p_180657_3_, is); } else { -@@ -56,7 +59,9 @@ +@@ -58,7 +63,9 @@ } - int i = EnchantmentHelper.func_77517_e(p_180657_2_); + int i = EnchantmentHelper.func_77506_a(Enchantments.field_185308_t, p_180657_6_); + harvesters.set(p_180657_2_); this.func_176226_b(p_180657_1_, p_180657_3_, p_180657_4_, i); + harvesters.set(null); - Material material = p_180657_1_.func_180495_p(p_180657_3_.func_177977_b()).func_177230_c().func_149688_o(); + Material material = p_180657_1_.func_180495_p(p_180657_3_.func_177977_b()).func_185904_a(); if (material.func_76230_c() || material.func_76224_d()) diff --git a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch index 84fa2d3dbb..4251c5bd57 100644 --- a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch @@ -1,30 +1,30 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLadder.java +++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java -@@ -78,7 +78,10 @@ +@@ -61,7 +61,10 @@ public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { -- return p_176196_1_.func_180495_p(p_176196_2_.func_177976_e()).func_177230_c().func_149721_r() ? true : (p_176196_1_.func_180495_p(p_176196_2_.func_177974_f()).func_177230_c().func_149721_r() ? true : (p_176196_1_.func_180495_p(p_176196_2_.func_177978_c()).func_177230_c().func_149721_r() ? true : p_176196_1_.func_180495_p(p_176196_2_.func_177968_d()).func_177230_c().func_149721_r())); -+ return p_176196_1_.isSideSolid(p_176196_2_.func_177976_e(), EnumFacing.EAST, true) || -+ p_176196_1_.isSideSolid(p_176196_2_.func_177974_f(), EnumFacing.WEST, true) || -+ p_176196_1_.isSideSolid(p_176196_2_.func_177978_c(), EnumFacing.SOUTH, true) || -+ p_176196_1_.isSideSolid(p_176196_2_.func_177968_d(), EnumFacing.NORTH, true); +- return p_176196_1_.func_180495_p(p_176196_2_.func_177976_e()).func_185915_l() ? true : (p_176196_1_.func_180495_p(p_176196_2_.func_177974_f()).func_185915_l() ? true : (p_176196_1_.func_180495_p(p_176196_2_.func_177978_c()).func_185915_l() ? true : p_176196_1_.func_180495_p(p_176196_2_.func_177968_d()).func_185915_l())); ++ return p_176196_1_.func_180495_p(p_176196_2_.func_177976_e()).isSideSolid(p_176196_1_, p_176196_2_.func_177976_e(), EnumFacing.EAST) || ++ p_176196_1_.func_180495_p(p_176196_2_.func_177974_f()).isSideSolid(p_176196_1_, p_176196_2_.func_177974_f(), EnumFacing.WEST) || ++ p_176196_1_.func_180495_p(p_176196_2_.func_177978_c()).isSideSolid(p_176196_1_, p_176196_2_.func_177978_c(), EnumFacing.SOUTH) || ++ p_176196_1_.func_180495_p(p_176196_2_.func_177968_d()).isSideSolid(p_176196_1_, p_176196_2_.func_177968_d(), EnumFacing.NORTH); } public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) -@@ -116,7 +119,7 @@ +@@ -99,7 +102,7 @@ protected boolean func_176381_b(World p_176381_1_, BlockPos p_176381_2_, EnumFacing p_176381_3_) { -- return p_176381_1_.func_180495_p(p_176381_2_.func_177972_a(p_176381_3_.func_176734_d())).func_177230_c().func_149721_r(); -+ return p_176381_1_.isSideSolid(p_176381_2_.func_177972_a(p_176381_3_.func_176734_d()), p_176381_3_, true); +- return p_176381_1_.func_180495_p(p_176381_2_.func_177972_a(p_176381_3_.func_176734_d())).func_185915_l(); ++ return p_176381_1_.func_180495_p(p_176381_2_.func_177972_a(p_176381_3_.func_176734_d())).isSideSolid(p_176381_1_, p_176381_2_.func_177972_a(p_176381_3_.func_176734_d()), p_176381_3_); } public IBlockState func_176203_a(int p_176203_1_) -@@ -146,4 +149,6 @@ +@@ -139,4 +142,6 @@ { - return new BlockState(this, new IProperty[] {field_176382_a}); + return new BlockStateContainer(this, new IProperty[] {field_176382_a}); } + -+ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } ++ @Override public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } } diff --git a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch index 4dcb42a4dc..201fd60135 100644 --- a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch @@ -1,39 +1,39 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java +++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java -@@ -18,7 +18,7 @@ +@@ -17,7 +17,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; --public abstract class BlockLeaves extends BlockLeavesBase -+public abstract class BlockLeaves extends BlockLeavesBase implements net.minecraftforge.common.IShearable +-public abstract class BlockLeaves extends Block ++public abstract class BlockLeaves extends Block implements net.minecraftforge.common.IShearable { public static final PropertyBool field_176237_a = PropertyBool.func_177716_a("decayable"); public static final PropertyBool field_176236_b = PropertyBool.func_177716_a("check_decay"); -@@ -75,9 +75,9 @@ +@@ -53,9 +53,9 @@ BlockPos blockpos = p_180663_2_.func_177982_a(j1, k1, l1); IBlockState iblockstate = p_180663_1_.func_180495_p(blockpos); -- if (iblockstate.func_177230_c().func_149688_o() == Material.field_151584_j && !((Boolean)iblockstate.func_177229_b(field_176236_b)).booleanValue()) -+ if (iblockstate.func_177230_c().isLeaves(p_180663_1_, blockpos)) +- if (iblockstate.func_185904_a() == Material.field_151584_j && !((Boolean)iblockstate.func_177229_b(field_176236_b)).booleanValue()) ++ if (iblockstate.func_177230_c().isLeaves(iblockstate, p_180663_1_, blockpos)) { - p_180663_1_.func_180501_a(blockpos, iblockstate.func_177226_a(field_176236_b, Boolean.valueOf(true)), 4); -+ iblockstate.func_177230_c().beginLeavesDecay(p_180663_1_, blockpos); ++ iblockstate.func_177230_c().beginLeavesDecay(iblockstate, p_180663_1_, blockpos); } } } -@@ -117,9 +117,9 @@ - { - Block block = p_180650_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2)).func_177230_c(); +@@ -96,9 +96,9 @@ + IBlockState iblockstate = p_180650_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2)); + Block block = iblockstate.func_177230_c(); - if (block != Blocks.field_150364_r && block != Blocks.field_150363_s) -+ if (!block.canSustainLeaves(p_180650_1_, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2))) ++ if (!block.canSustainLeaves(iblockstate, p_180650_1_, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2))) { -- if (block.func_149688_o() == Material.field_151584_j) -+ if (block.isLeaves(p_180650_1_, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2))) +- if (iblockstate.func_185904_a() == Material.field_151584_j) ++ if (block.isLeaves(iblockstate, p_180650_1_, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2))) { this.field_150128_a[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2; } -@@ -226,40 +226,7 @@ +@@ -205,40 +205,7 @@ public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { @@ -75,18 +75,16 @@ } protected void func_176234_a(World p_176234_1_, BlockPos p_176234_2_, IBlockState p_176234_3_, int p_176234_4_) -@@ -296,4 +263,48 @@ - } +@@ -274,6 +241,49 @@ public abstract BlockPlanks.EnumType func_176233_b(int p_176233_1_); -+ + + @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } -+ @Override public boolean isLeaves(IBlockAccess world, BlockPos pos){ return true; } ++ @Override public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos){ return true; } + + @Override -+ public void beginLeavesDecay(World world, BlockPos pos) ++ public void beginLeavesDecay(IBlockState state, World world, BlockPos pos) + { -+ IBlockState state = world.func_180495_p(pos); + if (!(Boolean)state.func_177229_b(field_176236_b)) + { + world.func_180501_a(pos, state.func_177226_a(field_176236_b, true), 4); @@ -123,4 +121,7 @@ + return ret; + } + - } ++ + @SideOnly(Side.CLIENT) + public boolean func_176225_a(IBlockState p_176225_1_, IBlockAccess p_176225_2_, BlockPos p_176225_3_, EnumFacing p_176225_4_) + { diff --git a/patches/minecraft/net/minecraft/block/BlockLever.java.patch b/patches/minecraft/net/minecraft/block/BlockLever.java.patch index 7bee933219..b3e399cd01 100644 --- a/patches/minecraft/net/minecraft/block/BlockLever.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLever.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLever.java +++ ../src-work/minecraft/net/minecraft/block/BlockLever.java -@@ -237,6 +237,12 @@ - return new BlockState(this, new IProperty[] {field_176360_a, field_176359_b}); +@@ -295,6 +295,12 @@ + return new BlockStateContainer(this, new IProperty[] {field_176360_a, field_176359_b}); } + diff --git a/patches/minecraft/net/minecraft/block/BlockLog.java.patch b/patches/minecraft/net/minecraft/block/BlockLog.java.patch index a6247c0c2b..6268339217 100644 --- a/patches/minecraft/net/minecraft/block/BlockLog.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLog.java.patch @@ -1,22 +1,22 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLog.java +++ ../src-work/minecraft/net/minecraft/block/BlockLog.java -@@ -33,9 +33,9 @@ +@@ -34,9 +34,9 @@ { IBlockState iblockstate = p_180663_1_.func_180495_p(blockpos); -- if (iblockstate.func_177230_c().func_149688_o() == Material.field_151584_j && !((Boolean)iblockstate.func_177229_b(BlockLeaves.field_176236_b)).booleanValue()) -+ if (iblockstate.func_177230_c().isLeaves(p_180663_1_, blockpos)) +- if (iblockstate.func_185904_a() == Material.field_151584_j && !((Boolean)iblockstate.func_177229_b(BlockLeaves.field_176236_b)).booleanValue()) ++ if (iblockstate.func_177230_c().isLeaves(iblockstate, p_180663_1_, blockpos)) { - p_180663_1_.func_180501_a(blockpos, iblockstate.func_177226_a(BlockLeaves.field_176236_b, Boolean.valueOf(true)), 4); -+ iblockstate.func_177230_c().beginLeavesDecay(p_180663_1_, blockpos); ++ iblockstate.func_177230_c().beginLeavesDecay(iblockstate, p_180663_1_, blockpos); } } } -@@ -46,6 +46,9 @@ - return super.func_180642_a(p_180642_1_, p_180642_2_, p_180642_3_, p_180642_4_, p_180642_5_, p_180642_6_, p_180642_7_, p_180642_8_).func_177226_a(field_176299_a, BlockLog.EnumAxis.func_176870_a(p_180642_3_.func_176740_k())); +@@ -69,6 +69,9 @@ + } } -+ @Override public boolean canSustainLeaves(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } ++ @Override public boolean canSustainLeaves(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } + @Override public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } + public static enum EnumAxis implements IStringSerializable diff --git a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch index 89062cf381..49d79f3fce 100644 --- a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java +++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java -@@ -37,10 +37,14 @@ +@@ -39,10 +39,14 @@ public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); @@ -9,11 +9,11 @@ } + @Override -+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { + return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); + } + - public boolean func_149662_c() + public boolean func_149662_c(IBlockState p_149662_1_) { return false; diff --git a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch index c78e7fc1da..ff671be04e 100644 --- a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java +++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java -@@ -71,7 +71,7 @@ +@@ -78,7 +78,7 @@ if (p_180671_2_.func_177956_o() >= 0 && p_180671_2_.func_177956_o() < 256) { IBlockState iblockstate = p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()); -- return iblockstate.func_177230_c() == Blocks.field_150391_bh ? true : (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.PODZOL ? true : p_180671_1_.func_175699_k(p_180671_2_) < 13 && this.func_149854_a(iblockstate.func_177230_c())); -+ return iblockstate.func_177230_c() == Blocks.field_150391_bh ? true : (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.PODZOL ? true : p_180671_1_.func_175699_k(p_180671_2_) < 13 && iblockstate.func_177230_c().canSustainPlant(p_180671_1_, p_180671_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this)); +- return iblockstate.func_177230_c() == Blocks.field_150391_bh ? true : (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.PODZOL ? true : p_180671_1_.func_175699_k(p_180671_2_) < 13 && this.func_185514_i(iblockstate)); ++ return iblockstate.func_177230_c() == Blocks.field_150391_bh ? true : (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.PODZOL ? true : p_180671_1_.func_175699_k(p_180671_2_) < 13 && iblockstate.func_177230_c().canSustainPlant(iblockstate, p_180671_1_, p_180671_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this)); } else { diff --git a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch index c7bd1a280d..f97644492f 100644 --- a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch @@ -4,17 +4,17 @@ { if (!p_180650_1_.field_72995_K) { -- if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_177230_c().func_149717_k() > 2) -+ if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_177230_c().getLightOpacity(p_180650_1_, p_180650_2_.func_177984_a()) > 2) +- if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_185891_c() > 2) ++ if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).getLightOpacity(p_180650_1_, p_180650_2_.func_177984_a()) > 2) { p_180650_1_.func_175656_a(p_180650_2_, Blocks.field_150346_d.func_176223_P().func_177226_a(BlockDirt.field_176386_a, BlockDirt.DirtType.DIRT)); } @@ -53,7 +53,7 @@ IBlockState iblockstate = p_180650_1_.func_180495_p(blockpos); - Block block = p_180650_1_.func_180495_p(blockpos.func_177984_a()).func_177230_c(); + IBlockState iblockstate1 = p_180650_1_.func_180495_p(blockpos.func_177984_a()); -- if (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos.func_177984_a()) >= 4 && block.func_149717_k() <= 2) -+ if (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos.func_177984_a()) >= 4 && block.getLightOpacity(p_180650_1_, blockpos.func_177984_a()) <= 2) +- if (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos.func_177984_a()) >= 4 && iblockstate1.func_185891_c() <= 2) ++ if (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos.func_177984_a()) >= 4 && iblockstate1.getLightOpacity(p_180650_1_, blockpos.func_177984_a()) <= 2) { p_180650_1_.func_175656_a(blockpos, this.func_176223_P()); } diff --git a/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch index 959b41a0be..3424c6cd86 100644 --- a/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java +++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java -@@ -38,7 +38,7 @@ +@@ -42,7 +42,7 @@ public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) { -- return this.func_149854_a(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c()); +- return this.func_185514_i(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b())); + return super.func_180671_f(p_180671_1_, p_180671_2_, p_180671_3_); } public void func_180650_b(World p_180650_1_, BlockPos p_180650_2_, IBlockState p_180650_3_, Random p_180650_4_) -@@ -54,9 +54,11 @@ +@@ -58,9 +58,11 @@ super.func_180650_b(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_4_); } @@ -22,11 +22,10 @@ { int i = 1; -@@ -107,4 +109,24 @@ - { - return new BlockState(this, new IProperty[] {field_176486_a}); +@@ -106,6 +108,26 @@ + return ((Integer)p_176201_1_.func_177229_b(field_176486_a)).intValue(); } -+ + + @Override + public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { @@ -46,4 +45,7 @@ + + return ret; + } - } ++ + protected BlockStateContainer func_180661_e() + { + return new BlockStateContainer(this, new IProperty[] {field_176486_a}); diff --git a/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch index 9cfc326686..7efe335afe 100644 --- a/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch @@ -1,24 +1,22 @@ --- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java +++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java -@@ -99,14 +99,15 @@ +@@ -98,7 +98,7 @@ - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_, ItemStack p_180657_6_) { -- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) +- if (!p_180657_1_.field_72995_K && p_180657_6_ != null && p_180657_6_.func_77973_b() == Items.field_151097_aZ) ++ if (false && !p_180657_1_.field_72995_K && p_180657_6_ != null && p_180657_6_.func_77973_b() == Items.field_151097_aZ) //Forge: Noop this { -- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); -- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Item.func_150898_a(this), 1, ((BlockPlanks.EnumType)p_180657_4_.func_177229_b(field_176240_P)).func_176839_a() - 4)); -- } -- else -- { - super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); + p_180657_2_.func_71029_a(StatList.func_188055_a(this)); + func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Item.func_150898_a(this), 1, ((BlockPlanks.EnumType)p_180657_4_.func_177229_b(field_176240_P)).func_176839_a() - 4)); +@@ -108,4 +108,10 @@ + super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_); } } + + @Override + public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ IBlockState state = world.func_180495_p(pos); -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.func_177229_b(field_176240_P)).func_176839_a() - 4))); ++ return java.util.Arrays.asList(new ItemStack(this, 1, world.func_180495_p(pos).func_177229_b(field_176240_P).func_176839_a() - 4)); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockNote.java.patch b/patches/minecraft/net/minecraft/block/BlockNote.java.patch index 6899eb8770..d3ec274fc1 100644 --- a/patches/minecraft/net/minecraft/block/BlockNote.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNote.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockNote.java +++ ../src-work/minecraft/net/minecraft/block/BlockNote.java -@@ -58,7 +58,9 @@ +@@ -64,7 +64,9 @@ if (tileentity instanceof TileEntityNote) { TileEntityNote tileentitynote = (TileEntityNote)tileentity; @@ -8,9 +8,9 @@ tileentitynote.func_145877_a(); + if (old == tileentitynote.field_145879_a) return false; tileentitynote.func_175108_a(p_180639_1_, p_180639_2_); - p_180639_4_.func_71029_a(StatList.field_181735_S); + p_180639_4_.func_71029_a(StatList.field_188087_U); } -@@ -98,6 +100,10 @@ +@@ -104,6 +106,10 @@ public boolean func_180648_a(World p_180648_1_, BlockPos p_180648_2_, IBlockState p_180648_3_, int p_180648_4_, int p_180648_5_) { @@ -19,5 +19,5 @@ + p_180648_4_ = e.instrument.ordinal(); + p_180648_5_ = e.getVanillaNoteId(); float f = (float)Math.pow(2.0D, (double)(p_180648_5_ - 12) / 12.0D); - p_180648_1_.func_72908_a((double)p_180648_2_.func_177958_n() + 0.5D, (double)p_180648_2_.func_177956_o() + 0.5D, (double)p_180648_2_.func_177952_p() + 0.5D, "note." + this.func_176433_b(p_180648_4_), 3.0F, f); + p_180648_1_.func_184133_a((EntityPlayer)null, p_180648_2_, this.func_185576_e(p_180648_4_), SoundCategory.BLOCKS, 3.0F, f); p_180648_1_.func_175688_a(EnumParticleTypes.NOTE, (double)p_180648_2_.func_177958_n() + 0.5D, (double)p_180648_2_.func_177956_o() + 1.2D, (double)p_180648_2_.func_177952_p() + 0.5D, (double)p_180648_5_ / 24.0D, 0.0D, 0.0D, new int[0]); diff --git a/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch index c81ddd5619..c056b175b3 100644 --- a/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch @@ -1,21 +1,28 @@ --- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java +++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java -@@ -142,11 +142,17 @@ - if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) +@@ -14,6 +14,7 @@ + import net.minecraft.stats.StatList; + import net.minecraft.tileentity.TileEntity; + 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; +@@ -103,11 +104,16 @@ + if (!p_180657_1_.field_72995_K && p_180657_6_ != null && p_180657_6_.func_77973_b() == Items.field_151097_aZ) { - p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); + p_180657_2_.func_71029_a(StatList.func_188055_a(this)); - func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Item.func_150898_a(this), 1, ((BlockPlanks.EnumType)p_180657_4_.func_177229_b(field_176239_P)).func_176839_a())); } else { - super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); + super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_); } } + + @Override + public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) + { -+ IBlockState state = world.func_180495_p(pos); -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.func_177229_b(field_176239_P)).func_176839_a()))); ++ return java.util.Arrays.asList(new ItemStack(this, 1, world.func_180495_p(pos).func_177229_b(field_176239_P).func_176839_a())); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockOre.java.patch b/patches/minecraft/net/minecraft/block/BlockOre.java.patch index a08f33decc..15b1046bc1 100644 --- a/patches/minecraft/net/minecraft/block/BlockOre.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockOre.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockOre.java +++ ../src-work/minecraft/net/minecraft/block/BlockOre.java -@@ -58,34 +58,40 @@ +@@ -59,34 +59,39 @@ public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); @@ -8,9 +8,8 @@ - if (this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_) != Item.func_150898_a(this)) + } + @Override -+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ IBlockState state = world.func_180495_p(pos); + Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); + if (this.func_180660_a(state, rand, fortune) != Item.func_150898_a(this)) { @@ -48,4 +47,4 @@ + return 0; } - public int func_176222_j(World p_176222_1_, BlockPos p_176222_2_) + public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) diff --git a/patches/minecraft/net/minecraft/block/BlockPane.java.patch b/patches/minecraft/net/minecraft/block/BlockPane.java.patch index bf26e9fafc..0d9d74407a 100644 --- a/patches/minecraft/net/minecraft/block/BlockPane.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPane.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPane.java +++ ../src-work/minecraft/net/minecraft/block/BlockPane.java -@@ -38,7 +38,10 @@ +@@ -105,7 +105,10 @@ public IBlockState func_176221_a(IBlockState p_176221_1_, IBlockAccess p_176221_2_, BlockPos p_176221_3_) { @@ -12,30 +12,15 @@ } public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) -@@ -64,10 +67,10 @@ - - public void func_180638_a(World p_180638_1_, BlockPos p_180638_2_, IBlockState p_180638_3_, AxisAlignedBB p_180638_4_, List p_180638_5_, Entity p_180638_6_) +@@ -182,4 +185,11 @@ { -- boolean flag = this.func_150098_a(p_180638_1_.func_180495_p(p_180638_2_.func_177978_c()).func_177230_c()); -- boolean flag1 = this.func_150098_a(p_180638_1_.func_180495_p(p_180638_2_.func_177968_d()).func_177230_c()); -- boolean flag2 = this.func_150098_a(p_180638_1_.func_180495_p(p_180638_2_.func_177976_e()).func_177230_c()); -- boolean flag3 = this.func_150098_a(p_180638_1_.func_180495_p(p_180638_2_.func_177974_f()).func_177230_c()); -+ boolean flag = this.canPaneConnectTo(p_180638_1_, p_180638_2_, EnumFacing.NORTH); -+ boolean flag1 = this.canPaneConnectTo(p_180638_1_, p_180638_2_, EnumFacing.SOUTH); -+ boolean flag2 = this.canPaneConnectTo(p_180638_1_, p_180638_2_, EnumFacing.WEST); -+ boolean flag3 = this.canPaneConnectTo(p_180638_1_, p_180638_2_, EnumFacing.EAST); - - if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) - { -@@ -186,4 +189,11 @@ - { - return new BlockState(this, new IProperty[] {field_176241_b, field_176242_M, field_176244_O, field_176243_N}); + return new BlockStateContainer(this, new IProperty[] {field_176241_b, field_176242_M, field_176244_O, field_176243_N}); } + + public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir) + { + BlockPos off = pos.func_177972_a(dir); -+ Block block = world.func_180495_p(off).func_177230_c(); -+ return func_150098_a(block) || block.isSideSolid(world, off, dir.func_176734_d()); ++ IBlockState state = world.func_180495_p(off); ++ return func_150098_a(state.func_177230_c()) || state.isSideSolid(world, off, dir.func_176734_d()); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch index db2e7cfaea..d3d13188c0 100644 --- a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch @@ -1,31 +1,31 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java +++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java -@@ -189,7 +189,7 @@ +@@ -235,7 +235,7 @@ } } -- if (!flag1 && block.func_149688_o() != Material.field_151579_a && func_180696_a(block, p_180648_1_, blockpos, enumfacing.func_176734_d(), false) && (block.func_149656_h() == 0 || block == Blocks.field_150331_J || block == Blocks.field_150320_F)) -+ if (!flag1 && !block.isAir(p_180648_1_, blockpos) && func_180696_a(block, p_180648_1_, blockpos, enumfacing.func_176734_d(), false) && (block.func_149656_h() == 0 || block == Blocks.field_150331_J || block == Blocks.field_150320_F)) +- if (!flag1 && iblockstate.func_185904_a() != Material.field_151579_a && func_185646_a(iblockstate, p_180648_1_, blockpos, enumfacing.func_176734_d(), false) && (iblockstate.func_185905_o() == EnumPushReaction.NORMAL || block == Blocks.field_150331_J || block == Blocks.field_150320_F)) ++ if (!flag1 && !iblockstate.func_177230_c().isAir(iblockstate, p_180648_1_, blockpos) && func_185646_a(iblockstate, p_180648_1_, blockpos, enumfacing.func_176734_d(), false) && (iblockstate.func_185905_o() == EnumPushReaction.NORMAL || block == Blocks.field_150331_J || block == Blocks.field_150320_F)) { this.func_176319_a(p_180648_1_, p_180648_2_, enumfacing, false); } -@@ -333,7 +333,7 @@ +@@ -320,7 +320,7 @@ return false; } -- return !(p_180696_0_ instanceof ITileEntityProvider); -+ return !(p_180696_0_.hasTileEntity(p_180696_1_.func_180495_p(p_180696_2_))); +- return !block.func_149716_u(); ++ return !block.hasTileEntity(p_185646_0_); } else { -@@ -371,7 +371,9 @@ +@@ -366,7 +366,9 @@ { - BlockPos blockpos = (BlockPos)list1.get(j); - Block block = p_176319_1_.func_180495_p(blockpos).func_177230_c(); -- block.func_176226_b(p_176319_1_, blockpos, p_176319_1_.func_180495_p(blockpos), 0); -+ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. -+ float chance = block instanceof BlockSnow ? -1.0f : 1.0f; -+ block.func_180653_a(p_176319_1_, blockpos, p_176319_1_.func_180495_p(blockpos), chance, 0); - p_176319_1_.func_175698_g(blockpos); - --i; - ablock[i] = block; + BlockPos blockpos1 = (BlockPos)list2.get(j); + IBlockState iblockstate = p_176319_1_.func_180495_p(blockpos1); +- iblockstate.func_177230_c().func_176226_b(p_176319_1_, blockpos1, iblockstate, 0); ++ // Forge: With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. ++ float chance = iblockstate.func_177230_c() instanceof BlockSnow ? -1.0f : 1.0f; ++ iblockstate.func_177230_c().func_180653_a(p_176319_1_, blockpos1, iblockstate, chance, 0); + p_176319_1_.func_175698_g(blockpos1); + --k; + aiblockstate[k] = iblockstate; diff --git a/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch index 3ba28b443d..9cbc42a5da 100644 --- a/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch @@ -1,32 +1,31 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java +++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java -@@ -109,16 +109,7 @@ +@@ -110,7 +110,7 @@ public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { - if (!p_180653_1_.field_72995_K) -- { -- TileEntityPiston tileentitypiston = this.func_176422_e(p_180653_1_, p_180653_2_); -- -- if (tileentitypiston != null) -- { -- IBlockState iblockstate = tileentitypiston.func_174927_b(); -- iblockstate.func_177230_c().func_176226_b(p_180653_1_, p_180653_2_, iblockstate, 0); -- } -- } ++ if (false && !p_180653_1_.field_72995_K) // Forge: Noop this out + { + TileEntityPiston tileentitypiston = this.func_185589_c(p_180653_1_, p_180653_2_); + +@@ -120,6 +120,7 @@ + iblockstate.func_177230_c().func_176226_b(p_180653_1_, p_180653_2_, iblockstate, 0); + } + } + super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); } - public MovingObjectPosition func_180636_a(World p_180636_1_, BlockPos p_180636_2_, Vec3 p_180636_3_, Vec3 p_180636_4_) -@@ -282,4 +273,16 @@ + public RayTraceResult func_180636_a(IBlockState p_180636_1_, World p_180636_2_, BlockPos p_180636_3_, Vec3d p_180636_4_, Vec3d p_180636_5_) +@@ -190,4 +191,16 @@ { - return new BlockState(this, new IProperty[] {field_176426_a, field_176425_b}); + return new BlockStateContainer(this, new IProperty[] {field_176426_a, field_176425_b}); } + + @Override + public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { -+ TileEntityPiston tileentitypiston = this.func_176422_e(world, pos); ++ TileEntityPiston tileentitypiston = this.func_185589_c(world, pos); + if (tileentitypiston != null) + { + IBlockState pushed = tileentitypiston.func_174927_b(); diff --git a/patches/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch index f507e33360..1e39263618 100644 --- a/patches/minecraft/net/minecraft/block/BlockPotato.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch @@ -1,24 +1,24 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPotato.java +++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java -@@ -22,13 +22,14 @@ - public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) +@@ -27,7 +27,7 @@ { super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); -- + - if (!p_180653_1_.field_72995_K) -- { -- if (((Integer)p_180653_3_.func_177229_b(field_176488_a)).intValue() >= 7 && p_180653_1_.field_73012_v.nextInt(50) == 0) -- { -- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(Items.field_151170_bI)); -- } -- } ++ if (false && !p_180653_1_.field_72995_K) //Forge: Moved to getDrops + { + if (this.func_185525_y(p_180653_3_) && p_180653_1_.field_73012_v.nextInt(50) == 0) + { +@@ -40,4 +40,13 @@ + { + return field_185534_a[((Integer)p_185496_1_.func_177229_b(this.func_185524_e())).intValue()]; } ++ + @Override -+ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { + java.util.List ret = super.getDrops(world, pos, state, fortune); -+ java.util.Random rand = world instanceof World ? ((World)world).field_73012_v : new java.util.Random(); -+ if (((Integer)state.func_177229_b(field_176488_a)) >= 7 && rand.nextInt(50) == 0) ++ if (this.func_185525_y(state) && RANDOM.nextInt(50) == 0) + ret.add(new ItemStack(Items.field_151170_bI)); + return ret; + } diff --git a/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch b/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch index 256bace073..1d4332d11d 100644 --- a/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java +++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java -@@ -115,7 +115,7 @@ +@@ -117,7 +117,7 @@ public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { -- return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().field_149764_J.func_76222_j() && World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()); -+ return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().func_176200_f(p_176196_1_, p_176196_2_) && World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()); +- return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().field_149764_J.func_76222_j() && p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_185896_q(); ++ return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().func_176200_f(p_176196_1_, p_176196_2_) && p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).isSideSolid(p_176196_1_, p_176196_2_, EnumFacing.UP); } - public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) + public IBlockState func_185499_a(IBlockState p_185499_1_, Rotation p_185499_2_) diff --git a/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch b/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch index b78be41ea8..5bc96aff1d 100644 --- a/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch @@ -1,13 +1,13 @@ --- ../src-base/minecraft/net/minecraft/block/BlockQuartz.java +++ ../src-work/minecraft/net/minecraft/block/BlockQuartz.java -@@ -90,6 +90,26 @@ - return new BlockState(this, new IProperty[] {field_176335_a}); +@@ -113,6 +113,26 @@ + return new BlockStateContainer(this, new IProperty[] {field_176335_a}); } + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { + IBlockState state = world.func_180495_p(pos); -+ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) ++ for (IProperty prop : state.func_177228_b().keySet()) + { + if (prop.func_177701_a().equals("variant") && prop.func_177699_b() == EnumType.class) + { diff --git a/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch index 9f7a361650..13fe900057 100644 --- a/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRailBase.java +++ ../src-work/minecraft/net/minecraft/block/BlockRailBase.java -@@ -31,7 +31,7 @@ +@@ -32,7 +32,7 @@ public static boolean func_176563_d(IBlockState p_176563_0_) { Block block = p_176563_0_.func_177230_c(); @@ -9,7 +9,46 @@ } protected BlockRailBase(boolean p_i45389_1_) -@@ -175,6 +175,81 @@ +@@ -65,7 +65,7 @@ + + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) + { +- return p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_185896_q(); ++ return p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).isSideSolid(p_176196_1_, p_176196_2_, EnumFacing.UP); + } + + public void func_176213_c(World p_176213_1_, BlockPos p_176213_2_, IBlockState p_176213_3_) +@@ -88,24 +88,24 @@ + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_176204_3_.func_177229_b(this.func_176560_l()); + boolean flag = false; + +- if (!p_176204_1_.func_180495_p(p_176204_2_.func_177977_b()).func_185896_q()) ++ if (!p_176204_1_.func_180495_p(p_176204_2_.func_177977_b()).isSideSolid(p_176204_1_, p_176204_2_.func_177977_b(), EnumFacing.UP)) + { + flag = true; + } + +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !p_176204_1_.func_180495_p(p_176204_2_.func_177974_f()).func_185896_q()) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !p_176204_1_.func_180495_p(p_176204_2_.func_177974_f()).isSideSolid(p_176204_1_, p_176204_2_.func_177974_f(), EnumFacing.UP)) + { + flag = true; + } +- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !p_176204_1_.func_180495_p(p_176204_2_.func_177976_e()).func_185896_q()) ++ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !p_176204_1_.func_180495_p(p_176204_2_.func_177976_e()).isSideSolid(p_176204_1_, p_176204_2_.func_177976_e(), EnumFacing.UP)) + { + flag = true; + } +- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !p_176204_1_.func_180495_p(p_176204_2_.func_177978_c()).func_185896_q()) ++ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !p_176204_1_.func_180495_p(p_176204_2_.func_177978_c()).isSideSolid(p_176204_1_, p_176204_2_.func_177978_c(), EnumFacing.UP)) + { + flag = true; + } +- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !p_176204_1_.func_180495_p(p_176204_2_.func_177968_d()).func_185896_q()) ++ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !p_176204_1_.func_180495_p(p_176204_2_.func_177968_d()).isSideSolid(p_176204_1_, p_176204_2_.func_177968_d(), EnumFacing.UP)) + { + flag = true; + } +@@ -160,6 +160,81 @@ public abstract IProperty func_176560_l(); @@ -75,7 +114,7 @@ + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { + IBlockState state = world.func_180495_p(pos); -+ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) ++ for (IProperty prop : state.func_177228_b().keySet()) + { + if (prop.func_177701_a().equals("shape")) + { @@ -91,7 +130,7 @@ public static enum EnumRailDirection implements IStringSerializable { NORTH_SOUTH(0, "north_south"), -@@ -245,6 +320,7 @@ +@@ -230,6 +305,7 @@ private IBlockState field_180366_e; private final boolean field_150656_f; private final List field_150657_g = Lists.newArrayList(); @@ -99,17 +138,17 @@ public Rail(World p_i45739_2_, BlockPos p_i45739_3_, IBlockState p_i45739_4_) { -@@ -253,7 +329,8 @@ +@@ -238,7 +314,8 @@ this.field_180366_e = p_i45739_4_; this.field_180365_d = (BlockRailBase)p_i45739_4_.func_177230_c(); - BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_i45739_4_.func_177229_b(BlockRailBase.this.func_176560_l()); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_i45739_4_.func_177229_b(this.field_180365_d.func_176560_l()); - this.field_150656_f = this.field_180365_d.field_150053_a; + this.field_150656_f = !this.field_180365_d.isFlexibleRail(p_i45739_2_, p_i45739_3_); -+ canMakeSlopes = this.field_180365_d.canMakeSlopes(p_i45739_2_, p_i45739_3_); ++ this.canMakeSlopes = this.field_180365_d.canMakeSlopes(p_i45739_2_, p_i45739_3_); this.func_180360_a(blockrailbase$enumraildirection); } -@@ -439,7 +516,7 @@ +@@ -429,7 +506,7 @@ } } @@ -118,7 +157,7 @@ { if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a())) { -@@ -452,7 +529,7 @@ +@@ -442,7 +519,7 @@ } } @@ -127,7 +166,7 @@ { if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.func_177984_a())) { -@@ -595,7 +672,7 @@ +@@ -585,7 +662,7 @@ } } @@ -136,7 +175,7 @@ { if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a())) { -@@ -608,7 +685,7 @@ +@@ -598,7 +675,7 @@ } } diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch index 1ad9b4abf0..84a6de664c 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java -@@ -295,6 +295,21 @@ - return this.func_176223_P().func_177226_a(field_176387_N, p_180642_8_.func_174811_aO().func_176734_d()).func_177226_a(field_176464_a, Boolean.valueOf(false)).func_177226_a(field_176463_b, BlockRedstoneComparator.Mode.COMPARE); +@@ -310,6 +310,21 @@ + return this.func_176223_P().func_177226_a(field_185512_D, p_180642_8_.func_174811_aO().func_176734_d()).func_177226_a(field_176464_a, Boolean.valueOf(false)).func_177226_a(field_176463_b, BlockRedstoneComparator.Mode.COMPARE); } + @Override diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch index fe20ed8f63..f9a8730485 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java -@@ -198,6 +198,8 @@ +@@ -204,6 +204,8 @@ { - EnumFacing enumfacing = (EnumFacing)p_176400_3_.func_177229_b(field_176387_N); + EnumFacing enumfacing = (EnumFacing)p_176400_3_.func_177229_b(field_185512_D); BlockPos blockpos = p_176400_2_.func_177972_a(enumfacing.func_176734_d()); + if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(p_176400_1_, p_176400_2_, p_176400_1_.func_180495_p(p_176400_2_), java.util.EnumSet.of(enumfacing.func_176734_d())).isCanceled()) + return; diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch index daefa904ed..7762d1ea3c 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java -@@ -91,12 +91,16 @@ +@@ -92,12 +92,16 @@ public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); @@ -8,9 +8,9 @@ - if (this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_) != Item.func_150898_a(this)) + @Override -+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ if (this.func_180660_a(world.func_180495_p(pos), RANDOM, fortune) != Item.func_150898_a(this)) ++ if (this.func_180660_a(state, RANDOM, fortune) != Item.func_150898_a(this)) { - int i = 1 + p_180653_1_.field_73012_v.nextInt(5); - this.func_180637_b(p_180653_1_, p_180653_2_, i); diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch index 69aa76b4dc..e824763bca 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch @@ -1,59 +1,65 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java -@@ -58,10 +58,10 @@ +@@ -97,15 +97,15 @@ BlockPos blockpos = p_176341_2_.func_177972_a(p_176341_3_); - Block block = p_176341_1_.func_180495_p(p_176341_2_.func_177972_a(p_176341_3_)).func_177230_c(); + IBlockState iblockstate = p_176341_1_.func_180495_p(p_176341_2_.func_177972_a(p_176341_3_)); -- if (!func_176343_a(p_176341_1_.func_180495_p(blockpos), p_176341_3_) && (block.func_149637_q() || !func_176346_d(p_176341_1_.func_180495_p(blockpos.func_177977_b())))) -+ if (!canRestoneConnect(p_176341_1_, blockpos, p_176341_3_) && (block.func_149637_q() || !canRestoneConnect(p_176341_1_, blockpos.func_177977_b(), null))) +- if (!func_176343_a(p_176341_1_.func_180495_p(blockpos), p_176341_3_) && (iblockstate.func_185915_l() || !func_176346_d(p_176341_1_.func_180495_p(blockpos.func_177977_b())))) ++ if (!canConnectTo(p_176341_1_.func_180495_p(blockpos), p_176341_3_, p_176341_1_, blockpos) && (iblockstate.func_185915_l() || !func_176340_e(p_176341_1_, blockpos.func_177977_b()))) { - Block block1 = p_176341_1_.func_180495_p(p_176341_2_.func_177984_a()).func_177230_c(); -- return !block1.func_149637_q() && block.func_149637_q() && func_176346_d(p_176341_1_.func_180495_p(blockpos.func_177984_a())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; -+ return !block1.func_149637_q() && block.func_149637_q() && canRestoneConnect(p_176341_1_, blockpos.func_177984_a(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; - } - else - { -@@ -359,35 +359,24 @@ - Block block = iblockstate.func_177230_c(); - boolean flag = block.func_149721_r(); - boolean flag1 = p_176339_1_.func_180495_p(p_176339_2_.func_177984_a()).func_177230_c().func_149721_r(); -- return !flag1 && flag && func_176340_e(p_176339_1_, blockpos.func_177984_a()) ? true : (func_176343_a(iblockstate, p_176339_3_) ? true : (block == Blocks.field_150416_aS && iblockstate.func_177229_b(BlockRedstoneDiode.field_176387_N) == p_176339_3_ ? true : !flag && func_176340_e(p_176339_1_, blockpos.func_177977_b()))); -+ return !flag1 && flag && canRestoneConnect(p_176339_1_, blockpos.func_177984_a(), null) ? true : (canRestoneConnect(p_176339_1_, blockpos, p_176339_3_) ? true : (block == Blocks.field_150416_aS && iblockstate.func_177229_b(BlockRedstoneDiode.field_176387_N) == p_176339_3_ ? true : !flag && canRestoneConnect(p_176339_1_, blockpos.func_177977_b(), null))); + IBlockState iblockstate1 = p_176341_1_.func_180495_p(p_176341_2_.func_177984_a()); + + if (!iblockstate1.func_185915_l()) + { +- boolean flag = p_176341_1_.func_180495_p(blockpos).func_185896_q() || p_176341_1_.func_180495_p(blockpos).func_177230_c() == Blocks.field_150426_aN; ++ boolean flag = p_176341_1_.func_180495_p(blockpos).isSideSolid(p_176341_1_, blockpos, EnumFacing.UP) || p_176341_1_.func_180495_p(blockpos).func_177230_c() == Blocks.field_150426_aN; + +- if (flag && func_176346_d(p_176341_1_.func_180495_p(blockpos.func_177984_a()))) ++ if (flag && func_176340_e(p_176341_1_, blockpos.func_177984_a())) + { + if (iblockstate.func_185898_k()) + { +@@ -406,35 +406,30 @@ + IBlockState iblockstate = p_176339_1_.func_180495_p(blockpos); + boolean flag = iblockstate.func_185915_l(); + boolean flag1 = p_176339_1_.func_180495_p(p_176339_2_.func_177984_a()).func_185915_l(); +- return !flag1 && flag && func_176340_e(p_176339_1_, blockpos.func_177984_a()) ? true : (func_176343_a(iblockstate, p_176339_3_) ? true : (iblockstate.func_177230_c() == Blocks.field_150416_aS && iblockstate.func_177229_b(BlockRedstoneDiode.field_185512_D) == p_176339_3_ ? true : !flag && func_176340_e(p_176339_1_, blockpos.func_177977_b()))); ++ return !flag1 && flag && func_176340_e(p_176339_1_, blockpos.func_177984_a()) ? true : (canConnectTo(iblockstate, p_176339_3_, p_176339_1_, p_176339_2_) ? true : (iblockstate.func_177230_c() == Blocks.field_150416_aS && iblockstate.func_177229_b(BlockRedstoneDiode.field_185512_D) == p_176339_3_ ? true : !flag && func_176340_e(p_176339_1_, blockpos.func_177977_b()))); } -- protected static boolean func_176340_e(IBlockAccess p_176340_0_, BlockPos p_176340_1_) -+ protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side) + protected static boolean func_176340_e(IBlockAccess p_176340_0_, BlockPos p_176340_1_) { - return func_176346_d(p_176340_0_.func_180495_p(p_176340_1_)); -- } -- ++ return canConnectTo(p_176340_0_.func_180495_p(p_176340_1_), null, p_176340_0_, p_176340_1_); + } + - protected static boolean func_176346_d(IBlockState p_176346_0_) -- { ++ protected static boolean canConnectTo(IBlockState blockState, EnumFacing side, IBlockAccess world, BlockPos pos) + { - return func_176343_a(p_176346_0_, (EnumFacing)null); - } -- ++ Block block = blockState.func_177230_c(); + - protected static boolean func_176343_a(IBlockState p_176343_0_, EnumFacing p_176343_1_) - { - Block block = p_176343_0_.func_177230_c(); - -- if (block == Blocks.field_150488_af) -+ IBlockState state = world.func_180495_p(pos); -+ if (state.func_177230_c() == Blocks.field_150488_af) + if (block == Blocks.field_150488_af) { return true; } -- else if (Blocks.field_150413_aR.func_149907_e(block)) -+ else if (Blocks.field_150413_aR.func_149907_e(state.func_177230_c())) +- else if (Blocks.field_150413_aR.func_185547_C(p_176343_0_)) ++ else if (Blocks.field_150413_aR.func_185547_C(blockState)) { -- EnumFacing enumfacing = (EnumFacing)p_176343_0_.func_177229_b(BlockRedstoneRepeater.field_176387_N); +- EnumFacing enumfacing = (EnumFacing)p_176343_0_.func_177229_b(BlockRedstoneRepeater.field_185512_D); - return enumfacing == p_176343_1_ || enumfacing.func_176734_d() == p_176343_1_; -+ EnumFacing direction = (EnumFacing)state.func_177229_b(BlockRedstoneRepeater.field_176387_N); -+ return direction == side || direction.func_176734_d() == side; ++ EnumFacing enumfacing = (EnumFacing)blockState.func_177229_b(BlockRedstoneRepeater.field_185512_D); ++ return enumfacing == side || enumfacing.func_176734_d() == side; } else { -- return block.func_149744_f() && p_176343_1_ != null; -+ return state.func_177230_c().canConnectRedstone(world, pos, side); +- return p_176343_0_.func_185897_m() && p_176343_1_ != null; ++ return blockState.func_177230_c().canConnectRedstone(blockState, world, pos, side); } } diff --git a/patches/minecraft/net/minecraft/block/BlockReed.java.patch b/patches/minecraft/net/minecraft/block/BlockReed.java.patch index 95f05667f0..3fccec1b8f 100644 --- a/patches/minecraft/net/minecraft/block/BlockReed.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockReed.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockReed.java +++ ../src-work/minecraft/net/minecraft/block/BlockReed.java -@@ -18,7 +18,7 @@ +@@ -19,7 +19,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -8,20 +8,22 @@ +public class BlockReed extends Block implements net.minecraftforge.common.IPlantable { public static final PropertyInteger field_176355_a = PropertyInteger.func_177719_a("age", 0, 15); + protected static final AxisAlignedBB field_185701_b = new AxisAlignedBB(0.125D, 0.0D, 0.125D, 0.875D, 1.0D, 0.875D); +@@ -69,7 +69,9 @@ -@@ -65,6 +65,7 @@ public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { - Block block = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c(); -+ if (block.canSustainPlant(p_176196_1_, p_176196_2_.func_177977_b(), EnumFacing.UP, this)) return true; +- Block block = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c(); ++ IBlockState state = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()); ++ Block block = state.func_177230_c(); ++ if (block.canSustainPlant(state, p_176196_1_, p_176196_2_.func_177977_b(), EnumFacing.UP, this)) return true; if (block == this) { -@@ -164,4 +165,15 @@ - { - return new BlockState(this, new IProperty[] {field_176355_a}); +@@ -162,6 +164,17 @@ + return ((Integer)p_176201_1_.func_177229_b(field_176355_a)).intValue(); } -+ + + @Override + public net.minecraftforge.common.EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) + { @@ -32,4 +34,7 @@ + { + return this.func_176223_P(); + } - } ++ + protected BlockStateContainer func_180661_e() + { + return new BlockStateContainer(this, new IProperty[] {field_176355_a}); diff --git a/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch b/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch index bd37149277..d4e280aaf8 100644 --- a/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRotatedPillar.java +++ ../src-work/minecraft/net/minecraft/block/BlockRotatedPillar.java -@@ -18,4 +18,18 @@ - { +@@ -28,6 +28,21 @@ super(p_i46385_1_, p_i46385_2_); } -+ -+ public boolean rotateBlock(net.minecraft.world.World world, net.minecraft.util.BlockPos pos, EnumFacing axis) + ++ @Override ++ public boolean rotateBlock(net.minecraft.world.World world, BlockPos pos, EnumFacing axis) + { + net.minecraft.block.state.IBlockState state = world.func_180495_p(pos); + for (net.minecraft.block.properties.IProperty prop : state.func_177228_b().keySet()) @@ -18,4 +18,7 @@ + } + return false; + } - } ++ + public IBlockState func_185499_a(IBlockState p_185499_1_, Rotation p_185499_2_) + { + switch (p_185499_2_) diff --git a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch index 1bef67eb0b..752aa85b64 100644 --- a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSapling.java +++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java -@@ -71,6 +71,7 @@ +@@ -77,6 +77,7 @@ public void func_176476_e(World p_176476_1_, BlockPos p_176476_2_, IBlockState p_176476_3_, Random p_176476_4_) { diff --git a/patches/minecraft/net/minecraft/block/BlockSkull.java.patch b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch index 3ec9807b9c..a7327502a5 100644 --- a/patches/minecraft/net/minecraft/block/BlockSkull.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSkull.java +++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java -@@ -121,10 +121,6 @@ - return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).func_145904_a() : super.func_176222_j(p_176222_1_, p_176222_2_); +@@ -116,10 +116,6 @@ + return new ItemStack(Items.field_151144_bL, 1, i); } - public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) @@ -11,7 +11,7 @@ public void func_176208_a(World p_176208_1_, BlockPos p_176208_2_, IBlockState p_176208_3_, EntityPlayer p_176208_4_) { if (p_176208_4_.field_71075_bZ.field_75098_d) -@@ -132,13 +128,18 @@ +@@ -127,22 +123,27 @@ p_176208_3_ = p_176208_3_.func_177226_a(field_176417_b, Boolean.valueOf(true)); p_176208_1_.func_180501_a(p_176208_2_, p_176208_3_, 4); } @@ -25,22 +25,25 @@ - if (!p_180663_1_.field_72995_K) + super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_); + } -+ public java.util.List getDrops(IBlockAccess p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_, int fortune) ++ public java.util.List getDrops(IBlockAccess worldIn, BlockPos pos, IBlockState state, int fortune) + { + java.util.List ret = new java.util.ArrayList(); { - if (!((Boolean)p_180663_3_.func_177229_b(field_176417_b)).booleanValue()) +- if (!((Boolean)p_180663_3_.func_177229_b(field_176417_b)).booleanValue()) ++ if (!((Boolean)state.func_177229_b(field_176417_b)).booleanValue()) { -@@ -147,7 +148,7 @@ +- TileEntity tileentity = p_180663_1_.func_175625_s(p_180663_2_); ++ TileEntity tileentity = worldIn.func_175625_s(pos); + if (tileentity instanceof TileEntitySkull) { TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; -- ItemStack itemstack = new ItemStack(Items.field_151144_bL, 1, this.func_176222_j(p_180663_1_, p_180663_2_)); +- ItemStack itemstack = this.func_185473_a(p_180663_1_, p_180663_2_, p_180663_3_); + ItemStack itemstack = new ItemStack(Items.field_151144_bL, 1, tileentityskull.func_145904_a()); if (tileentityskull.func_145904_a() == 3 && tileentityskull.func_152108_a() != null) { -@@ -157,12 +158,11 @@ +@@ -152,12 +153,11 @@ itemstack.func_77978_p().func_74782_a("SkullOwner", nbttagcompound); } diff --git a/patches/minecraft/net/minecraft/block/BlockSlab.java.patch b/patches/minecraft/net/minecraft/block/BlockSlab.java.patch index 56f1865a14..0acded7082 100644 --- a/patches/minecraft/net/minecraft/block/BlockSlab.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSlab.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSlab.java +++ ../src-work/minecraft/net/minecraft/block/BlockSlab.java -@@ -91,6 +91,17 @@ +@@ -50,6 +50,17 @@ return this.func_176552_j(); } + @Override -+ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ if ( func_149662_c() ) ++ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ if ( state.func_185914_p() ) + return true; -+ ++ + // face is on the block being rendered, not this block. + EnumBlockHalf side = world.func_180495_p(pos).func_177229_b(field_176554_a); + return (side == EnumBlockHalf.TOP && face == EnumFacing.DOWN) || (side == EnumBlockHalf.BOTTOM && face == EnumFacing.UP); @@ -18,21 +18,19 @@ public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) { IBlockState iblockstate = super.func_180642_a(p_180642_1_, p_180642_2_, p_180642_3_, p_180642_4_, p_180642_5_, p_180642_6_, p_180642_7_, p_180642_8_).func_177226_a(field_176554_a, BlockSlab.EnumBlockHalf.BOTTOM); -@@ -118,15 +129,8 @@ +@@ -77,13 +88,14 @@ { return false; } - else -- { -- BlockPos blockpos = p_176225_2_.func_177972_a(p_176225_3_.func_176734_d()); -- IBlockState iblockstate = p_176225_1_.func_180495_p(p_176225_2_); -- IBlockState iblockstate1 = p_176225_1_.func_180495_p(blockpos); -- boolean flag = func_150003_a(iblockstate.func_177230_c()) && iblockstate.func_177229_b(field_176554_a) == BlockSlab.EnumBlockHalf.TOP; -- boolean flag1 = func_150003_a(iblockstate1.func_177230_c()) && iblockstate1.func_177229_b(field_176554_a) == BlockSlab.EnumBlockHalf.TOP; -- return flag1 ? (p_176225_3_ == EnumFacing.DOWN ? true : (p_176225_3_ == EnumFacing.UP && super.func_176225_a(p_176225_1_, p_176225_2_, p_176225_3_) ? true : !func_150003_a(iblockstate.func_177230_c()) || !flag)) : (p_176225_3_ == EnumFacing.UP ? true : (p_176225_3_ == EnumFacing.DOWN && super.func_176225_a(p_176225_1_, p_176225_2_, p_176225_3_) ? true : !func_150003_a(iblockstate.func_177230_c()) || flag)); -- } -+ // additional logic breaks doesSideBlockRendering and is no longer useful. -+ return super.func_176225_a(p_176225_1_, p_176225_2_, p_176225_3_); ++ else if (false) // Forge: Additional logic breaks doesSideBlockRendering and is no longer useful. + { + IBlockState iblockstate = p_176225_2_.func_180495_p(p_176225_3_.func_177972_a(p_176225_4_)); + boolean flag = func_185675_i(iblockstate) && iblockstate.func_177229_b(field_176554_a) == BlockSlab.EnumBlockHalf.TOP; + boolean flag1 = func_185675_i(p_176225_1_) && p_176225_1_.func_177229_b(field_176554_a) == BlockSlab.EnumBlockHalf.TOP; + return flag1 ? (p_176225_4_ == EnumFacing.DOWN ? true : (p_176225_4_ == EnumFacing.UP && super.func_176225_a(p_176225_1_, p_176225_2_, p_176225_3_, p_176225_4_) ? true : !func_185675_i(iblockstate) || !flag)) : (p_176225_4_ == EnumFacing.UP ? true : (p_176225_4_ == EnumFacing.DOWN && super.func_176225_a(p_176225_1_, p_176225_2_, p_176225_3_, p_176225_4_) ? true : !func_185675_i(iblockstate) || flag)); + } ++ return super.func_176225_a(p_176225_1_, p_176225_2_, p_176225_3_, p_176225_4_); } @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch index cc8659d20d..9561436743 100644 --- a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSnow.java +++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java -@@ -79,7 +79,7 @@ +@@ -73,7 +73,7 @@ { IBlockState iblockstate = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()); Block block = iblockstate.func_177230_c(); -- return block != Blocks.field_150432_aD && block != Blocks.field_150403_cj ? (block.func_149688_o() == Material.field_151584_j ? true : (block == this && ((Integer)iblockstate.func_177229_b(field_176315_a)).intValue() >= 7 ? true : block.func_149662_c() && block.field_149764_J.func_76230_c())) : false; -+ return block != Blocks.field_150432_aD && block != Blocks.field_150403_cj ? (block.isLeaves(p_176196_1_, p_176196_2_.func_177977_b()) ? true : (block == this && ((Integer)iblockstate.func_177229_b(field_176315_a)).intValue() >= 7 ? true : block.func_149662_c() && block.field_149764_J.func_76230_c())) : false; +- return block != Blocks.field_150432_aD && block != Blocks.field_150403_cj ? (iblockstate.func_185904_a() == Material.field_151584_j ? true : (block == this && ((Integer)iblockstate.func_177229_b(field_176315_a)).intValue() >= 7 ? true : iblockstate.func_185914_p() && iblockstate.func_185904_a().func_76230_c())) : false; ++ return block != Blocks.field_150432_aD && block != Blocks.field_150403_cj ? (iblockstate.func_177230_c().isLeaves(iblockstate, p_176196_1_, p_176196_2_.func_177977_b()) ? true : (block == this && ((Integer)iblockstate.func_177229_b(field_176315_a)).intValue() >= 7 ? true : iblockstate.func_185914_p() && iblockstate.func_185904_a().func_76230_c())) : false; } public void func_176204_a(World p_176204_1_, BlockPos p_176204_2_, IBlockState p_176204_3_, Block p_176204_4_) -@@ -91,7 +91,6 @@ +@@ -85,7 +85,6 @@ { if (!this.func_176196_c(p_176314_1_, p_176314_2_)) { @@ -17,18 +17,18 @@ p_176314_1_.func_175698_g(p_176314_2_); return false; } -@@ -103,9 +102,8 @@ +@@ -97,9 +96,8 @@ - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_, ItemStack p_180657_6_) { - func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Items.field_151126_ay, ((Integer)p_180657_4_.func_177229_b(field_176315_a)).intValue() + 1, 0)); -+ super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); ++ super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_); p_180657_1_.func_175698_g(p_180657_3_); -- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); +- p_180657_2_.func_71029_a(StatList.func_188055_a(this)); } public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) -@@ -115,14 +113,13 @@ +@@ -109,14 +107,13 @@ public int func_149745_a(Random p_149745_1_) { @@ -44,10 +44,12 @@ p_180650_1_.func_175698_g(p_180650_2_); } } -@@ -152,4 +149,6 @@ - { - return new BlockState(this, new IProperty[] {field_176315_a}); +@@ -150,6 +147,8 @@ + return ((Integer)p_176201_1_.func_177229_b(field_176315_a)).intValue() - 1; } -+ + + @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.func_177229_b(field_176315_a)) + 1; } - } ++ + protected BlockStateContainer func_180661_e() + { + return new BlockStateContainer(this, new IProperty[] {field_176315_a}); diff --git a/patches/minecraft/net/minecraft/block/BlockStairs.java.patch b/patches/minecraft/net/minecraft/block/BlockStairs.java.patch index dccaada1d6..3f83775111 100644 --- a/patches/minecraft/net/minecraft/block/BlockStairs.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockStairs.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/block/BlockStairs.java +++ ../src-work/minecraft/net/minecraft/block/BlockStairs.java -@@ -68,6 +68,19 @@ - return false; +@@ -443,6 +443,19 @@ + return new BlockStateContainer(this, new IProperty[] {field_176309_a, field_176308_b, field_176310_M}); } + @Override -+ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ if ( func_149662_c() ) ++ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ if ( state.func_185914_p() ) + return true; -+ ++ + // face is on the block being rendered, not this block. + IBlockState iblockstate = world.func_180495_p(pos); + EnumHalf half = iblockstate.func_177229_b(field_176308_b); @@ -17,6 +17,6 @@ + return side == face.func_176734_d() || (half == EnumHalf.TOP && face == EnumFacing.DOWN) || (half == EnumHalf.BOTTOM && face == EnumFacing.UP); + } + - public boolean func_149686_d() + public static enum EnumHalf implements IStringSerializable { - return false; + TOP("top"), diff --git a/patches/minecraft/net/minecraft/block/BlockStaticLiquid.java.patch b/patches/minecraft/net/minecraft/block/BlockStaticLiquid.java.patch new file mode 100644 index 0000000000..f6973261e7 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockStaticLiquid.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockStaticLiquid.java ++++ ../src-work/minecraft/net/minecraft/block/BlockStaticLiquid.java +@@ -52,7 +52,7 @@ + { + blockpos = blockpos.func_177982_a(p_180650_4_.nextInt(3) - 1, 1, p_180650_4_.nextInt(3) - 1); + +- if (blockpos.func_177956_o() >= 0 && blockpos.func_177956_o() < 256 && !p_180650_1_.func_175667_e(blockpos)) ++ if (blockpos.func_177956_o() >= 0 && blockpos.func_177956_o() < p_180650_1_.func_72800_K() && !p_180650_1_.func_175667_e(blockpos)) + { + return; + } diff --git a/patches/minecraft/net/minecraft/block/BlockStem.java.patch b/patches/minecraft/net/minecraft/block/BlockStem.java.patch index 90fd806ba9..2b37ff3d33 100644 --- a/patches/minecraft/net/minecraft/block/BlockStem.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockStem.java.patch @@ -1,15 +1,19 @@ --- ../src-base/minecraft/net/minecraft/block/BlockStem.java +++ ../src-work/minecraft/net/minecraft/block/BlockStem.java -@@ -94,7 +94,7 @@ +@@ -89,9 +89,10 @@ + } + p_180650_2_ = p_180650_2_.func_177972_a(EnumFacing.Plane.HORIZONTAL.func_179518_a(p_180650_4_)); - Block block = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_177230_c(); +- Block block = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_177230_c(); ++ IBlockState soil = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()); ++ Block block = soil.func_177230_c(); - if (p_180650_1_.func_180495_p(p_180650_2_).func_177230_c().field_149764_J == Material.field_151579_a && (block == Blocks.field_150458_ak || block == Blocks.field_150346_d || block == Blocks.field_150349_c)) -+ if (p_180650_1_.func_175623_d(p_180650_2_) && (block.canSustainPlant(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP, this) || block == Blocks.field_150346_d || block == Blocks.field_150349_c)) ++ if (p_180650_1_.func_175623_d(p_180650_2_) && (block.canSustainPlant(soil, p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP, this) || block == Blocks.field_150346_d || block == Blocks.field_150349_c)) { p_180650_1_.func_175656_a(p_180650_2_, this.field_149877_a.func_176223_P()); } -@@ -148,24 +148,29 @@ +@@ -109,24 +110,29 @@ public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); diff --git a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch index e9629da029..37298ca359 100644 --- a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch @@ -8,17 +8,17 @@ +public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable { public static final PropertyEnum field_176497_a = PropertyEnum.func_177709_a("type", BlockTallGrass.EnumType.class); - -@@ -43,7 +43,7 @@ + protected static final AxisAlignedBB field_185522_c = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D); +@@ -41,7 +41,7 @@ public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) { -- return this.func_149854_a(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c()); +- return this.func_185514_i(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b())); + return super.func_180671_f(p_180671_1_, p_180671_2_, p_180671_3_); } - public boolean func_176200_f(World p_176200_1_, BlockPos p_176200_2_) -@@ -53,7 +53,7 @@ + public boolean func_176200_f(IBlockAccess p_176200_1_, BlockPos p_176200_2_) +@@ -51,7 +51,7 @@ public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) { @@ -27,21 +27,16 @@ } public int func_149679_a(int p_149679_1_, Random p_149679_2_) -@@ -63,13 +63,7 @@ +@@ -61,7 +61,7 @@ - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_, ItemStack p_180657_6_) { -- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) +- if (!p_180657_1_.field_72995_K && p_180657_6_ != null && p_180657_6_.func_77973_b() == Items.field_151097_aZ) ++ if (false && !p_180657_1_.field_72995_K && p_180657_6_ != null && p_180657_6_.func_77973_b() == Items.field_151097_aZ) // Forge: Noop Taken care of by IShearable { -- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); -- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150329_H, 1, ((BlockTallGrass.EnumType)p_180657_4_.func_177229_b(field_176497_a)).func_177044_a())); -- } -- else -- { - super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); - } - } -@@ -204,4 +198,22 @@ + p_180657_2_.func_71029_a(StatList.func_188055_a(this)); + func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150329_H, 1, ((BlockTallGrass.EnumType)p_180657_4_.func_177229_b(field_176497_a)).func_177044_a())); +@@ -181,4 +181,22 @@ } } } diff --git a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch index ec723e30dc..2b6f02aa29 100644 --- a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch @@ -1,15 +1,24 @@ --- ../src-base/minecraft/net/minecraft/block/BlockTorch.java +++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java -@@ -63,7 +63,7 @@ +@@ -79,14 +79,14 @@ + + private boolean func_176594_d(World p_176594_1_, BlockPos p_176594_2_) + { +- if (p_176594_1_.func_180495_p(p_176594_2_).func_185896_q()) ++ IBlockState state = p_176594_1_.func_180495_p(p_176594_2_); ++ if (state.isSideSolid(p_176594_1_, p_176594_2_, EnumFacing.UP)) + { + return true; + } else { - Block block = p_176594_1_.func_180495_p(p_176594_2_).func_177230_c(); +- Block block = p_176594_1_.func_180495_p(p_176594_2_).func_177230_c(); - return block instanceof BlockFence || block == Blocks.field_150359_w || block == Blocks.field_150463_bK || block == Blocks.field_150399_cn; -+ return block.canPlaceTorchOnTop(p_176594_1_, p_176594_2_); ++ return state.func_177230_c().canPlaceTorchOnTop(state, p_176594_1_, p_176594_2_); } } -@@ -84,7 +84,7 @@ +@@ -107,7 +107,7 @@ { BlockPos blockpos = p_176595_2_.func_177972_a(p_176595_3_.func_176734_d()); boolean flag = p_176595_3_.func_176740_k().func_176722_c(); @@ -18,7 +27,7 @@ } public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) -@@ -97,7 +97,7 @@ +@@ -120,7 +120,7 @@ { for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) { @@ -27,7 +36,7 @@ { return this.func_176223_P().func_177226_a(field_176596_a, enumfacing); } -@@ -130,7 +130,7 @@ +@@ -153,7 +153,7 @@ EnumFacing enumfacing1 = enumfacing.func_176734_d(); boolean flag = false; diff --git a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch index 0eb19ae31f..92f9775918 100644 --- a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch @@ -1,43 +1,21 @@ --- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java +++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java -@@ -25,6 +25,8 @@ - - public class BlockTrapDoor extends Block - { -+ /** Set this to allow trapdoors to remain free-floating */ -+ public static boolean disableValidation = false; - public static final PropertyDirection field_176284_a = PropertyDirection.func_177712_a("facing", EnumFacing.Plane.HORIZONTAL); - public static final PropertyBool field_176283_b = PropertyBool.func_177716_a("open"); - public static final PropertyEnum field_176285_M = PropertyEnum.func_177709_a("half", BlockTrapDoor.DoorHalf.class); -@@ -140,9 +142,10 @@ - { - if (!p_176204_1_.field_72995_K) - { -+ EnumFacing direction = (EnumFacing)p_176204_3_.func_177229_b(field_176284_a); - BlockPos blockpos = p_176204_2_.func_177972_a(((EnumFacing)p_176204_3_.func_177229_b(field_176284_a)).func_176734_d()); - -- if (!func_150119_a(p_176204_1_.func_180495_p(blockpos).func_177230_c())) -+ if (!(func_150119_a(p_176204_1_.func_180495_p(blockpos).func_177230_c()) || p_176204_1_.isSideSolid(blockpos, direction, true))) - { - p_176204_1_.func_175698_g(p_176204_2_); - this.func_176226_b(p_176204_1_, p_176204_2_, p_176204_3_, 0); -@@ -186,7 +189,10 @@ - - public boolean func_176198_a(World p_176198_1_, BlockPos p_176198_2_, EnumFacing p_176198_3_) - { -- return !p_176198_3_.func_176740_k().func_176720_b() && func_150119_a(p_176198_1_.func_180495_p(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d())).func_177230_c()); -+ if (disableValidation) return true; -+ EnumFacing dir = p_176198_3_.func_176734_d(); -+ p_176198_2_ = p_176198_2_.func_177972_a(dir); -+ return !p_176198_3_.func_176740_k().func_176720_b() && (func_150119_a(p_176198_1_.func_180495_p(p_176198_2_).func_177230_c()) || p_176198_1_.isSideSolid(p_176198_2_, p_176198_3_, true)); +@@ -241,6 +241,18 @@ + return new BlockStateContainer(this, new IProperty[] {field_176284_a, field_176283_b, field_176285_M}); } - protected static EnumFacing func_176281_b(int p_176281_0_) -@@ -223,6 +229,7 @@ - - private static boolean func_150119_a(Block p_150119_0_) ++ @Override ++ public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) ++ { ++ if (state.func_177229_b(field_176283_b)) ++ { ++ IBlockState down = world.func_180495_p(pos.func_177977_b()); ++ if (down.func_177230_c() == net.minecraft.init.Blocks.field_150468_ap) ++ return down.func_177229_b(BlockLadder.field_176382_a) == state.func_177229_b(field_176284_a); ++ } ++ return false; ++ } ++ + public static enum DoorHalf implements IStringSerializable { -+ if (disableValidation) return true; - return p_150119_0_.field_149764_J.func_76218_k() && p_150119_0_.func_149686_d() || p_150119_0_ == Blocks.field_150426_aN || p_150119_0_ instanceof BlockSlab || p_150119_0_ instanceof BlockStairs; - } - + TOP("top"), diff --git a/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch b/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch index 6a6ba2054f..6850b831b4 100644 --- a/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch @@ -1,28 +1,28 @@ --- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java +++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java -@@ -58,14 +58,14 @@ +@@ -77,14 +77,14 @@ public boolean func_176198_a(World p_176198_1_, BlockPos p_176198_2_, EnumFacing p_176198_3_) { -- return p_176198_3_.func_176740_k().func_176722_c() && p_176198_1_.func_180495_p(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d())).func_177230_c().func_149721_r(); -+ return p_176198_3_.func_176740_k().func_176722_c() && p_176198_1_.isSideSolid(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d()), p_176198_3_, true); +- return p_176198_3_.func_176740_k().func_176722_c() && p_176198_1_.func_180495_p(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d())).func_185915_l(); ++ return p_176198_3_.func_176740_k().func_176722_c() && p_176198_1_.func_180495_p(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d())).isSideSolid(p_176198_1_, p_176198_2_.func_177972_a(p_176198_3_.func_176734_d()), p_176198_3_); } public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) { -- if (p_176196_1_.func_180495_p(p_176196_2_.func_177972_a(enumfacing)).func_177230_c().func_149721_r()) -+ if (p_176196_1_.isSideSolid(p_176196_2_.func_177972_a(enumfacing), enumfacing.func_176734_d(), true)) +- if (p_176196_1_.func_180495_p(p_176196_2_.func_177972_a(enumfacing)).func_185915_l()) ++ if (p_176196_1_.func_180495_p(p_176196_2_.func_177972_a(enumfacing)).isSideSolid(p_176196_1_, p_176196_2_.func_177972_a(enumfacing), enumfacing.func_176734_d())) { return true; } -@@ -99,7 +99,7 @@ +@@ -118,7 +118,7 @@ { EnumFacing enumfacing = (EnumFacing)p_176204_3_.func_177229_b(field_176264_a); -- if (!p_176204_1_.func_180495_p(p_176204_2_.func_177972_a(enumfacing.func_176734_d())).func_177230_c().func_149721_r()) -+ if (!p_176204_1_.isSideSolid(p_176204_2_.func_177972_a(enumfacing.func_176734_d()), enumfacing, true)) +- if (!p_176204_1_.func_180495_p(p_176204_2_.func_177972_a(enumfacing.func_176734_d())).func_185915_l()) ++ if (!p_176204_1_.func_180495_p(p_176204_2_.func_177972_a(enumfacing.func_176734_d())).isSideSolid(p_176204_1_, p_176204_2_.func_177972_a(enumfacing.func_176734_d()), enumfacing)) { this.func_176226_b(p_176204_1_, p_176204_2_, p_176204_3_, 0); p_176204_1_.func_175698_g(p_176204_2_); diff --git a/patches/minecraft/net/minecraft/block/BlockVine.java.patch b/patches/minecraft/net/minecraft/block/BlockVine.java.patch index e64d0dd18a..f4f42e06c9 100644 --- a/patches/minecraft/net/minecraft/block/BlockVine.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockVine.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockVine.java +++ ../src-work/minecraft/net/minecraft/block/BlockVine.java -@@ -25,7 +25,7 @@ +@@ -26,7 +26,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -9,26 +9,21 @@ { public static final PropertyBool field_176277_a = PropertyBool.func_177716_a("up"); public static final PropertyBool field_176273_b = PropertyBool.func_177716_a("north"); -@@ -387,13 +387,7 @@ +@@ -342,7 +342,7 @@ - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_, ItemStack p_180657_6_) { -- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) +- if (!p_180657_1_.field_72995_K && p_180657_6_ != null && p_180657_6_.func_77973_b() == Items.field_151097_aZ) ++ if (false && !p_180657_1_.field_72995_K && p_180657_6_ != null && p_180657_6_.func_77973_b() == Items.field_151097_aZ) // Forge: Noop, Covered by IShearable { -- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); -- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150395_bd, 1, 0)); -- } -- else -- { - super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); - } - } -@@ -474,4 +468,14 @@ + p_180657_2_.func_71029_a(StatList.func_188055_a(this)); + func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150395_bd, 1, 0)); +@@ -457,4 +457,14 @@ return i; } + /*************************FORGE START***********************************/ -+ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity){ return true; } ++ @Override public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity){ return true; } + @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } + @Override + public java.util.List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) diff --git a/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch b/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch index 9b66c108cb..7d8c103108 100644 --- a/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch +++ b/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch @@ -1,29 +1,29 @@ --- ../src-base/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java +++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java -@@ -78,7 +78,7 @@ - { - Block block = this.field_177261_a.func_180495_p(p_177251_1_).func_177230_c(); +@@ -80,7 +80,7 @@ + IBlockState iblockstate = this.field_177261_a.func_180495_p(p_177251_1_); + Block block = iblockstate.func_177230_c(); -- if (block.func_149688_o() == Material.field_151579_a) -+ if (block.isAir(field_177261_a, p_177251_1_)) +- if (iblockstate.func_185904_a() == Material.field_151579_a) ++ if (iblockstate.func_177230_c().isAir(iblockstate, this.field_177261_a, p_177251_1_)) { return true; } -@@ -109,7 +109,7 @@ - BlockPos blockpos = p_177251_1_.func_177967_a(this.field_177257_d.func_176734_d(), i); - block = this.field_177261_a.func_180495_p(blockpos).func_177230_c(); +@@ -112,7 +112,7 @@ + iblockstate = this.field_177261_a.func_180495_p(blockpos); + block = iblockstate.func_177230_c(); -- if (block.func_149688_o() == Material.field_151579_a || !BlockPistonBase.func_180696_a(block, this.field_177261_a, blockpos, this.field_177257_d, false) || blockpos.equals(this.field_177259_b)) -+ if (block.isAir(field_177261_a, blockpos)|| !BlockPistonBase.func_180696_a(block, this.field_177261_a, blockpos, this.field_177257_d, false) || blockpos.equals(this.field_177259_b)) +- if (iblockstate.func_185904_a() == Material.field_151579_a || !BlockPistonBase.func_185646_a(iblockstate, this.field_177261_a, blockpos, this.field_177257_d, false) || blockpos.equals(this.field_177259_b)) ++ if (iblockstate.func_177230_c().isAir(iblockstate, this.field_177261_a, blockpos) || !BlockPistonBase.func_185646_a(iblockstate, this.field_177261_a, blockpos, this.field_177257_d, false) || blockpos.equals(this.field_177259_b)) { break; } -@@ -156,7 +156,7 @@ +@@ -159,7 +159,7 @@ - block = this.field_177261_a.func_180495_p(blockpos1).func_177230_c(); + iblockstate = this.field_177261_a.func_180495_p(blockpos1); -- if (block.func_149688_o() == Material.field_151579_a) -+ if (block.isAir(field_177261_a, blockpos1)) +- if (iblockstate.func_185904_a() == Material.field_151579_a) ++ if (iblockstate.func_177230_c().isAir(iblockstate, this.field_177261_a, blockpos1)) { return true; } diff --git a/patches/minecraft/net/minecraft/block/state/BlockState.java.patch b/patches/minecraft/net/minecraft/block/state/BlockState.java.patch deleted file mode 100644 index 8d775ed119..0000000000 --- a/patches/minecraft/net/minecraft/block/state/BlockState.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/state/BlockState.java -+++ ../src-work/minecraft/net/minecraft/block/state/BlockState.java -@@ -38,6 +38,16 @@ - - public BlockState(Block p_i45663_1_, IProperty... p_i45663_2_) - { -+ this(p_i45663_1_, p_i45663_2_, null); -+ } -+ -+ protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) -+ { -+ return new StateImplementation(block, properties); -+ } -+ -+ protected BlockState(Block p_i45663_1_, IProperty[] p_i45663_2_, ImmutableMap, com.google.common.base.Optional> unlistedProperties) -+ { - this.field_177627_c = p_i45663_1_; - Arrays.sort(p_i45663_2_, new Comparator() - { -@@ -53,7 +63,7 @@ - for (List list1 : Cartesian.func_179321_a(this.func_177620_e())) - { - Map map1 = MapPopulator.func_179400_b(this.field_177624_d, list1); -- BlockState.StateImplementation blockstate$stateimplementation = new BlockState.StateImplementation(p_i45663_1_, ImmutableMap.copyOf(map1)); -+ BlockState.StateImplementation blockstate$stateimplementation = createState(p_i45663_1_, ImmutableMap.copyOf(map1), unlistedProperties); - map.put(map1, blockstate$stateimplementation); - list.add(blockstate$stateimplementation); - } -@@ -132,6 +142,13 @@ - } - } - -+ protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable) -+ { -+ this.field_177239_a = blockIn; -+ this.field_177237_b = propertiesIn; -+ this.field_177238_c = propertyValueTable; -+ } -+ - public , V extends T> IBlockState func_177226_a(IProperty p_177226_1_, V p_177226_2_) - { - if (!this.field_177237_b.containsKey(p_177226_1_)) -@@ -199,5 +216,10 @@ - map.put(p_177236_1_, p_177236_2_); - return map; - } -+ -+ public ImmutableTable getPropertyValueTable() -+ { -+ return field_177238_c; -+ } - } - } diff --git a/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch b/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch index a8c5028636..e6d4fff7f3 100644 --- a/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch +++ b/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/state/BlockStateBase.java +++ ../src-work/minecraft/net/minecraft/block/state/BlockStateBase.java -@@ -67,4 +67,9 @@ +@@ -71,4 +71,9 @@ return stringbuilder.toString(); } -+ -+ public com.google.common.collect.ImmutableTable getPropertyValueTable() ++ ++ public com.google.common.collect.ImmutableTable, Comparable, IBlockState> getPropertyValueTable() + { + return null; + } diff --git a/patches/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch b/patches/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch new file mode 100644 index 0000000000..8b119b7e21 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch @@ -0,0 +1,86 @@ +--- ../src-base/minecraft/net/minecraft/block/state/BlockStateContainer.java ++++ ../src-work/minecraft/net/minecraft/block/state/BlockStateContainer.java +@@ -55,12 +55,22 @@ + + public BlockStateContainer(Block p_i45663_1_, IProperty... p_i45663_2_) + { +- this.field_177627_c = p_i45663_1_; ++ this(p_i45663_1_, p_i45663_2_, null); ++ } ++ ++ protected StateImplementation createState(Block block, ImmutableMap, Comparable> properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) ++ { ++ return new StateImplementation(block, properties); ++ } ++ ++ protected BlockStateContainer(Block blockIn, IProperty[] properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) ++ { ++ this.field_177627_c = blockIn; + Map < String, IProperty> map = Maps. < String, IProperty> newHashMap(); + +- for (IProperty iproperty : p_i45663_2_) ++ for (IProperty iproperty : properties) + { +- func_185919_a(p_i45663_1_, iproperty); ++ func_185919_a(blockIn, iproperty); + map.put(iproperty.func_177701_a(), iproperty); + } + +@@ -71,7 +81,7 @@ + for (List < Comparable> list : Cartesian.func_179321_a(this.func_177620_e())) + { + Map < IProperty, Comparable> map1 = MapPopulator. < IProperty, Comparable> func_179400_b(this.field_177624_d.values(), list); +- BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation = new BlockStateContainer.StateImplementation(p_i45663_1_, ImmutableMap.copyOf(map1)); ++ BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map1), unlistedProperties); + map2.put(map1, blockstatecontainer$stateimplementation); + list1.add(blockstatecontainer$stateimplementation); + } +@@ -163,6 +173,13 @@ + this.field_177237_b = p_i45660_2_; + } + ++ protected StateImplementation(Block blockIn, ImmutableMap, Comparable> propertiesIn, ImmutableTable, Comparable, IBlockState> propertyValueTable) ++ { ++ this.field_177239_a = blockIn; ++ this.field_177237_b = propertiesIn; ++ this.field_177238_c = propertyValueTable; ++ } ++ + public Collection < IProperty> func_177227_a() + { + return Collections. < IProperty> unmodifiableCollection(this.field_177237_b.keySet()); +@@ -414,5 +431,34 @@ + { + return this.field_177239_a.func_185481_k(this); + } ++ ++ //Forge Start ++ public ImmutableTable, Comparable, IBlockState> getPropertyValueTable() ++ { ++ return field_177238_c; ++ } ++ ++ @Override ++ public int getLightOpacity(IBlockAccess world, BlockPos pos) ++ { ++ return this.field_177239_a.getLightOpacity(this, world, pos); ++ } ++ ++ @Override ++ public int getLightValue(IBlockAccess world, BlockPos pos) ++ { ++ return this.field_177239_a.getLightValue(this, world, pos); ++ } ++ ++ public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) ++ { ++ return this.field_177239_a.isSideSolid(this, world, pos, side); ++ } ++ ++ @Override ++ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing side) ++ { ++ return this.field_177239_a.doesSideBlockRendering(this, world, pos, side); ++ } + } + } diff --git a/patches/minecraft/net/minecraft/block/state/IBlockProperties.java.patch b/patches/minecraft/net/minecraft/block/state/IBlockProperties.java.patch new file mode 100644 index 0000000000..e90318ea8f --- /dev/null +++ b/patches/minecraft/net/minecraft/block/state/IBlockProperties.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/block/state/IBlockProperties.java ++++ ../src-work/minecraft/net/minecraft/block/state/IBlockProperties.java +@@ -25,9 +25,13 @@ + + boolean func_185913_b(); + ++ @Deprecated //Forge location aware version below + int func_185891_c(); ++ int getLightOpacity(IBlockAccess world, BlockPos pos); + ++ @Deprecated //Forge location aware version below + int func_185906_d(); ++ int getLightValue(IBlockAccess world, BlockPos pos); + + @SideOnly(Side.CLIENT) + boolean func_185895_e(); +@@ -88,5 +92,10 @@ + + RayTraceResult func_185910_a(World p_185910_1_, BlockPos p_185910_2_, Vec3d p_185910_3_, Vec3d p_185910_4_); + ++ @Deprecated // Forge: Use isSideSolid(IBlockAccess, BlockPos, EnumFacing.UP) instead + boolean func_185896_q(); ++ ++ //Forge added functions ++ boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing side); ++ boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side); + } diff --git a/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch b/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch index 2d8b6e47e0..176c164749 100644 --- a/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch @@ -9,10 +9,10 @@ + if (!net.minecraftforge.fml.client.FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) //FML Don't render while FML's pre-screen is rendering + { Tessellator tessellator = Tessellator.func_178181_a(); - WorldRenderer worldrenderer = tessellator.func_178180_c(); + VertexBuffer vertexbuffer = tessellator.func_178180_c(); this.field_73725_b.func_110434_K().func_110577_a(Gui.field_110325_k); @@ -174,6 +178,12 @@ - GlStateManager.func_179120_a(770, 771, 1, 0); + GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); this.field_73725_b.field_71466_p.func_175063_a(this.field_73726_c, (float)((k - this.field_73725_b.field_71466_p.func_78256_a(this.field_73726_c)) / 2), (float)(l / 2 - 4 - 16), 16777215); this.field_73725_b.field_71466_p.func_175063_a(this.field_73727_a, (float)((k - this.field_73725_b.field_71466_p.func_78256_a(this.field_73727_a)) / 2), (float)(l / 2 - 4 + 8), 16777215); + } diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 30d858ec0a..8a29254d6d 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/Minecraft.java +++ ../src-work/minecraft/net/minecraft/client/Minecraft.java -@@ -301,7 +301,6 @@ - this.field_152355_az = (new YggdrasilAuthenticationService(p_i45547_1_.field_178745_a.field_178751_c, UUID.randomUUID().toString())).createMinecraftSessionService(); +@@ -318,7 +318,6 @@ + this.field_152355_az = (new YggdrasilAuthenticationService(this.field_110453_aa, UUID.randomUUID().toString())).createMinecraftSessionService(); this.field_71449_j = p_i45547_1_.field_178745_a.field_178752_a; field_147123_G.info("Setting user: " + this.field_71449_j.func_111285_a()); - field_147123_G.info("(Session ID is " + this.field_71449_j.func_111286_b() + ")"); this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a; this.field_71443_c = p_i45547_1_.field_178743_b.field_178764_a > 0 ? p_i45547_1_.field_178743_b.field_178764_a : 1; this.field_71440_d = p_i45547_1_.field_178743_b.field_178762_b > 0 ? p_i45547_1_.field_178743_b.field_178762_b : 1; -@@ -415,10 +414,10 @@ +@@ -432,10 +431,10 @@ this.field_110451_am = new SimpleReloadableResourceManager(this.field_110452_an); this.field_135017_as = new LanguageManager(this.field_110452_an, this.field_71474_y.field_74363_ab); this.field_110451_am.func_110542_a(this.field_135017_as); @@ -18,10 +18,10 @@ this.field_110451_am.func_110542_a(this.field_71446_o); - this.func_180510_a(this.field_71446_o); + net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.field_71446_o); - this.func_175595_al(); this.field_152350_aA = new SkinManager(this.field_71446_o, new File(this.field_110446_Y, "skins"), this.field_152355_az); - this.field_71469_aa = new AnvilSaveConverter(new File(this.field_71412_D, "saves")); -@@ -453,6 +452,8 @@ + this.field_71469_aa = new AnvilSaveConverter(new File(this.field_71412_D, "saves"), this.field_184131_U); + this.field_147127_av = new SoundHandler(this.field_110451_am, this.field_71474_y); +@@ -469,6 +468,8 @@ } }); this.field_71417_B = new MouseHelper(); @@ -30,13 +30,13 @@ this.func_71361_d("Pre startup"); GlStateManager.func_179098_w(); GlStateManager.func_179103_j(7425); -@@ -466,17 +467,21 @@ +@@ -482,19 +483,23 @@ GlStateManager.func_179096_D(); GlStateManager.func_179128_n(5888); this.func_71361_d("Startup"); - this.field_147128_au = new TextureMap("textures"); + bar.step("Loading Texture Map"); -+ this.field_147128_au = new TextureMap("textures",true); ++ this.field_147128_au = new TextureMap("textures", true); this.field_147128_au.func_147633_a(this.field_71474_y.field_151442_I); this.field_71446_o.func_110580_a(TextureMap.field_110575_b, this.field_147128_au); this.field_71446_o.func_110577_a(TextureMap.field_110575_b); @@ -44,16 +44,18 @@ + bar.step("Loading Model Manager"); this.field_175617_aL = new ModelManager(this.field_147128_au); this.field_110451_am.func_110542_a(this.field_175617_aL); + this.field_184127_aH = BlockColors.func_186723_a(); + this.field_184128_aI = ItemColors.func_186729_a(this.field_184127_aH); + bar.step("Loading Item Renderer"); - this.field_175621_X = new RenderItem(this.field_71446_o, this.field_175617_aL); + this.field_175621_X = new RenderItem(this.field_71446_o, this.field_175617_aL, this.field_184128_aI); this.field_175616_W = new RenderManager(this.field_71446_o, this.field_175621_X); this.field_175620_Y = new ItemRenderer(this); this.field_110451_am.func_110542_a(this.field_175621_X); + bar.step("Loading Entity Renderer"); this.field_71460_t = new EntityRenderer(this, this.field_110451_am); this.field_110451_am.func_110542_a(this.field_71460_t); - this.field_175618_aM = new BlockRendererDispatcher(this.field_175617_aL.func_174954_c(), this.field_71474_y); -@@ -486,22 +491,25 @@ + this.field_175618_aM = new BlockRendererDispatcher(this.field_175617_aL.func_174954_c(), this.field_184127_aH); +@@ -504,23 +509,26 @@ this.field_71458_u = new GuiAchievement(this); GlStateManager.func_179083_b(0, 0, this.field_71443_c, this.field_71440_d); this.field_71452_i = new EffectRenderer(this.field_71441_e, this.field_71446_o); @@ -77,12 +79,13 @@ + net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(field_71446_o, field_152354_ay); this.field_152354_ay = null; this.field_71461_s = new LoadingScreenRenderer(this); + this.field_184132_p = new DebugRenderer(this); + net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete(); if (this.field_71474_y.field_74353_u && !this.field_71431_Q) { this.func_71352_k(); -@@ -681,21 +689,23 @@ +@@ -692,21 +700,23 @@ File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); Bootstrap.func_179870_a(p_71377_1_.func_71502_e()); @@ -109,7 +112,7 @@ } public boolean func_152349_b() -@@ -883,11 +893,6 @@ +@@ -899,11 +909,6 @@ public void func_147108_a(GuiScreen p_147108_1_) { @@ -121,8 +124,8 @@ if (p_147108_1_ == null && this.field_71441_e == null) { p_147108_1_ = new GuiMainMenu(); -@@ -897,6 +902,17 @@ - p_147108_1_ = new GuiGameOver(); +@@ -913,6 +918,17 @@ + p_147108_1_ = new GuiGameOver((ITextComponent)null); } + GuiScreen old = this.field_71462_r; @@ -136,10 +139,10 @@ + old.func_146281_b(); + } + - if (p_147108_1_ instanceof GuiMainMenu) + if (p_147108_1_ instanceof GuiMainMenu || p_147108_1_ instanceof GuiMultiplayer) { this.field_71474_y.field_74330_P = false; -@@ -1030,9 +1046,11 @@ +@@ -1051,9 +1067,11 @@ if (!this.field_71454_w) { @@ -151,47 +154,28 @@ } this.field_71424_I.func_76319_b(); -@@ -1377,7 +1395,7 @@ +@@ -1393,9 +1411,9 @@ + { + BlockPos blockpos = this.field_71476_x.func_178782_a(); - if (this.field_71441_e.func_180495_p(blockpos).func_177230_c().func_149688_o() != Material.field_151579_a && this.field_71442_b.func_180512_c(blockpos, this.field_71476_x.field_178784_b)) +- if (this.field_71441_e.func_180495_p(blockpos).func_185904_a() != Material.field_151579_a && this.field_71442_b.func_180512_c(blockpos, this.field_71476_x.field_178784_b)) ++ if (!this.field_71441_e.func_175623_d(blockpos) && this.field_71442_b.func_180512_c(blockpos, this.field_71476_x.field_178784_b)) { - this.field_71452_i.func_180532_a(blockpos, this.field_71476_x.field_178784_b); + this.field_71452_i.addBlockHitEffects(blockpos, this.field_71476_x); - this.field_71439_g.func_71038_i(); + this.field_71439_g.func_184609_a(EnumHand.MAIN_HAND); } } -@@ -1463,15 +1481,19 @@ +@@ -1429,7 +1447,7 @@ case BLOCK: BlockPos blockpos = this.field_71476_x.func_178782_a(); -- if (this.field_71441_e.func_180495_p(blockpos).func_177230_c().func_149688_o() != Material.field_151579_a) +- if (this.field_71441_e.func_180495_p(blockpos).func_185904_a() != Material.field_151579_a) + if (!this.field_71441_e.func_175623_d(blockpos)) { - int i = itemstack != null ? itemstack.field_77994_a : 0; - -+ -+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_71439_g, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.field_71441_e, blockpos, this.field_71476_x.field_178784_b, this.field_71476_x.field_72307_f).isCanceled(); -+ if (result) { //Forge: Kept separate to simplify patch - if (this.field_71442_b.func_178890_a(this.field_71439_g, this.field_71441_e, itemstack, blockpos, this.field_71476_x.field_178784_b, this.field_71476_x.field_72307_f)) - { - flag = false; - this.field_71439_g.func_71038_i(); - } -+ } - - if (itemstack == null) - { -@@ -1494,7 +1516,8 @@ - { - ItemStack itemstack1 = this.field_71439_g.field_71071_by.func_70448_g(); - -- if (itemstack1 != null && this.field_71442_b.func_78769_a(this.field_71439_g, this.field_71441_e, itemstack1)) -+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_71439_g, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, field_71441_e, null, null, null).isCanceled(); -+ if (result && itemstack1 != null && this.field_71442_b.func_78769_a(this.field_71439_g, this.field_71441_e, itemstack1)) - { - this.field_71460_t.field_78516_c.func_78445_c(); - } -@@ -1598,6 +1621,8 @@ + this.field_71442_b.func_180511_b(blockpos, this.field_71476_x.field_178784_b); + break; +@@ -1623,6 +1641,8 @@ --this.field_71467_ac; } @@ -200,40 +184,40 @@ this.field_71424_I.func_76320_a("gui"); if (!this.field_71445_n) -@@ -1690,6 +1715,8 @@ - - while (Mouse.next()) - { -+ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; -+ - int i = Mouse.getEventButton(); - KeyBinding.func_74510_a(i - 100, Mouse.getEventButtonState()); - -@@ -1745,6 +1772,7 @@ - this.field_71462_r.func_146274_d(); - } +@@ -1734,6 +1754,7 @@ + this.field_71457_ai = 0; + this.field_71441_e.func_72897_h(this.field_71439_g); } + net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput(); } - if (this.field_71429_W > 0) -@@ -1923,6 +1951,7 @@ - } - } - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput(); - } - - for (int l = 0; l < 9; ++l) -@@ -2119,12 +2148,15 @@ + this.field_71424_I.func_76318_c("gameRenderer"); +@@ -1821,6 +1842,7 @@ this.field_71453_ak.func_74428_b(); } + net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick(); -+ this.field_71424_I.func_76319_b(); this.field_71423_H = func_71386_F(); } +@@ -1926,6 +1948,7 @@ + this.field_71474_y.field_181657_aC = this.field_71474_y.field_74330_P && GuiScreen.func_175283_s(); + } + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput(); + } + } + +@@ -2166,6 +2189,8 @@ + { + while (Mouse.next()) + { ++ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; ++ + int i = Mouse.getEventButton(); + KeyBinding.func_74510_a(i - 100, Mouse.getEventButtonState()); + +@@ -2231,6 +2256,7 @@ public void func_71371_a(String p_71371_1_, String p_71371_2_, WorldSettings p_71371_3_) { @@ -241,7 +225,7 @@ this.func_71403_a((WorldClient)null); System.gc(); ISaveHandler isavehandler = this.field_71469_aa.func_75804_a(p_71371_1_, false); -@@ -2160,6 +2192,12 @@ +@@ -2273,6 +2299,12 @@ while (!this.field_71437_Z.func_71200_ad()) { @@ -254,24 +238,24 @@ String s = this.field_71437_Z.func_71195_b_(); if (s != null) -@@ -2185,8 +2223,14 @@ +@@ -2298,8 +2330,14 @@ SocketAddress socketaddress = this.field_71437_Z.func_147137_ag().func_151270_a(); NetworkManager networkmanager = NetworkManager.func_150722_a(socketaddress); networkmanager.func_150719_a(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); -- networkmanager.func_179290_a(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); -- networkmanager.func_179290_a(new C00PacketLoginStart(this.func_110432_I().func_148256_e())); -+ networkmanager.func_179290_a(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true)); +- networkmanager.func_179290_a(new C00Handshake(107, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); +- networkmanager.func_179290_a(new CPacketLoginStart(this.func_110432_I().func_148256_e())); ++ networkmanager.func_179290_a(new C00Handshake(107, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true)); + com.mojang.authlib.GameProfile gameProfile = this.func_110432_I().func_148256_e(); + if (!this.func_110432_I().hasCachedProperties()) + { + gameProfile = field_152355_az.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. + this.func_110432_I().setProperties(gameProfile.getProperties()); + } -+ networkmanager.func_179290_a(new C00PacketLoginStart(gameProfile)); ++ networkmanager.func_179290_a(new CPacketLoginStart(gameProfile)); this.field_71453_ak = networkmanager; } -@@ -2197,6 +2241,8 @@ +@@ -2310,6 +2348,8 @@ public void func_71353_a(WorldClient p_71353_1_, String p_71353_2_) { @@ -280,10 +264,10 @@ if (p_71353_1_ == null) { NetHandlerPlayClient nethandlerplayclient = this.func_147114_u(); -@@ -2210,6 +2256,18 @@ +@@ -2322,6 +2362,18 @@ + if (this.field_71437_Z != null && this.field_71437_Z.func_175578_N()) { this.field_71437_Z.func_71263_m(); - this.field_71437_Z.func_175592_a(); + if (field_71461_s != null) + { + this.field_71461_s.func_73719_c(I18n.func_135052_a("forge.client.shutdown.internal")); @@ -299,7 +283,7 @@ } this.field_71437_Z = null; -@@ -2232,6 +2290,7 @@ +@@ -2345,6 +2397,7 @@ this.field_71456_v.func_181029_i(); this.func_71351_a((ServerData)null); this.field_71455_al = false; @@ -307,77 +291,72 @@ } this.field_147127_av.func_147690_c(); -@@ -2336,126 +2395,10 @@ - if (this.field_71476_x != null) +@@ -2461,159 +2514,8 @@ + { + if (this.field_71476_x != null && this.field_71476_x.field_72313_a != RayTraceResult.Type.MISS) { - boolean flag = this.field_71439_g.field_71075_bZ.field_75098_d; -- int i = 0; -- boolean flag1 = false; +- boolean flag = this.field_71439_g.field_71075_bZ.field_75098_d; - TileEntity tileentity = null; -- Item item; +- ItemStack itemstack; - -- if (this.field_71476_x.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK) +- if (this.field_71476_x.field_72313_a == RayTraceResult.Type.BLOCK) - { - BlockPos blockpos = this.field_71476_x.func_178782_a(); -- Block block = this.field_71441_e.func_180495_p(blockpos).func_177230_c(); +- IBlockState iblockstate = this.field_71441_e.func_180495_p(blockpos); +- Block block = iblockstate.func_177230_c(); - -- if (block.func_149688_o() == Material.field_151579_a) +- if (iblockstate.func_185904_a() == Material.field_151579_a) - { - return; - } - -- item = block.func_180665_b(this.field_71441_e, blockpos); +- itemstack = block.func_185473_a(this.field_71441_e, blockpos, iblockstate); - -- if (item == null) +- if (itemstack == null) - { - return; - } - -- if (flag && GuiScreen.func_146271_m()) +- if (flag && GuiScreen.func_146271_m() && block.func_149716_u()) - { - tileentity = this.field_71441_e.func_175625_s(blockpos); - } -- -- Block block1 = item instanceof ItemBlock && !block.func_149648_K() ? Block.func_149634_a(item) : block; -- i = block1.func_176222_j(this.field_71441_e, blockpos); -- flag1 = item.func_77614_k(); - } - else - { -- if (this.field_71476_x.field_72313_a != MovingObjectPosition.MovingObjectType.ENTITY || this.field_71476_x.field_72308_g == null || !flag) +- if (this.field_71476_x.field_72313_a != RayTraceResult.Type.ENTITY || this.field_71476_x.field_72308_g == null || !flag) - { - return; - } - - if (this.field_71476_x.field_72308_g instanceof EntityPainting) - { -- item = Items.field_151159_an; +- itemstack = new ItemStack(Items.field_151159_an); - } - else if (this.field_71476_x.field_72308_g instanceof EntityLeashKnot) - { -- item = Items.field_151058_ca; +- itemstack = new ItemStack(Items.field_151058_ca); - } - else if (this.field_71476_x.field_72308_g instanceof EntityItemFrame) - { - EntityItemFrame entityitemframe = (EntityItemFrame)this.field_71476_x.field_72308_g; -- ItemStack itemstack = entityitemframe.func_82335_i(); +- ItemStack itemstack1 = entityitemframe.func_82335_i(); - -- if (itemstack == null) +- if (itemstack1 == null) - { -- item = Items.field_151160_bD; +- itemstack = new ItemStack(Items.field_151160_bD); - } - else - { -- item = itemstack.func_77973_b(); -- i = itemstack.func_77960_j(); -- flag1 = true; +- itemstack = ItemStack.func_77944_b(itemstack1); - } - } - else if (this.field_71476_x.field_72308_g instanceof EntityMinecart) - { - EntityMinecart entityminecart = (EntityMinecart)this.field_71476_x.field_72308_g; +- Item item; - -- switch (entityminecart.func_180456_s()) +- switch (entityminecart.func_184264_v()) - { - case FURNACE: - item = Items.field_151109_aJ; @@ -397,53 +376,91 @@ - default: - item = Items.field_151143_au; - } +- +- itemstack = new ItemStack(item); - } - else if (this.field_71476_x.field_72308_g instanceof EntityBoat) - { -- item = Items.field_151124_az; +- itemstack = new ItemStack(((EntityBoat)this.field_71476_x.field_72308_g).func_184455_j()); - } - else if (this.field_71476_x.field_72308_g instanceof EntityArmorStand) - { -- item = Items.field_179565_cj; +- itemstack = new ItemStack(Items.field_179565_cj); +- } +- else if (this.field_71476_x.field_72308_g instanceof EntityEnderCrystal) +- { +- itemstack = new ItemStack(Items.field_185158_cP); - } - else - { -- item = Items.field_151063_bx; -- i = EntityList.func_75619_a(this.field_71476_x.field_72308_g); -- flag1 = true; +- String s = EntityList.func_75621_b(this.field_71476_x.field_72308_g); - -- if (!EntityList.field_75627_a.containsKey(Integer.valueOf(i))) +- if (!EntityList.field_75627_a.containsKey(s)) - { - return; - } +- +- itemstack = new ItemStack(Items.field_151063_bx); +- ItemMonsterPlacer.func_185078_a(itemstack, s); - } - } - - InventoryPlayer inventoryplayer = this.field_71439_g.field_71071_by; - -- if (tileentity == null) +- if (itemstack.func_77973_b() == null) - { -- inventoryplayer.func_146030_a(item, i, flag1, flag); +- String s1 = ""; +- +- if (this.field_71476_x.field_72313_a == RayTraceResult.Type.BLOCK) +- { +- s1 = ((ResourceLocation)Block.field_149771_c.func_177774_c(this.field_71441_e.func_180495_p(this.field_71476_x.func_178782_a()).func_177230_c())).toString(); +- } +- else if (this.field_71476_x.field_72313_a == RayTraceResult.Type.ENTITY) +- { +- s1 = EntityList.func_75621_b(this.field_71476_x.field_72308_g); +- } +- +- field_147123_G.warn("Picking on: [{}] {} gave null item", new Object[] {this.field_71476_x.field_72313_a, s1}); - } - else - { -- ItemStack itemstack1 = this.func_181036_a(item, i, tileentity); -- inventoryplayer.func_70299_a(inventoryplayer.field_70461_c, itemstack1); -- } +- InventoryPlayer inventoryplayer = this.field_71439_g.field_71071_by; - -+ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.field_71476_x, this.field_71439_g, this.field_71441_e)) return; +- if (tileentity != null) +- { +- this.func_184119_a(itemstack, tileentity); +- } +- +- int i = inventoryplayer.func_184429_b(itemstack); +- +- if (flag) +- { +- inventoryplayer.func_184434_a(itemstack); +- this.field_71442_b.func_78761_a(this.field_71439_g.func_184586_b(EnumHand.MAIN_HAND), 36 + inventoryplayer.field_70461_c); +- } +- else if (i != -1) +- { +- if (InventoryPlayer.func_184435_e(i)) +- { +- inventoryplayer.field_70461_c = i; +- } +- else +- { +- this.field_71442_b.func_187100_a(i); +- } +- } +- } ++ net.minecraftforge.common.ForgeHooks.onPickBlock(this.field_71476_x, this.field_71439_g, this.field_71441_e); + // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions - if (flag) - { - int j = this.field_71439_g.field_71069_bz.field_75151_b.size() - 9 + inventoryplayer.field_70461_c; -@@ -2756,18 +2699,8 @@ + } + } + +@@ -2909,18 +2811,8 @@ public static int func_71369_N() { - for (int i = 16384; i > 0; i >>= 1) - { -- GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)((ByteBuffer)null)); -- int j = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); +- GlStateManager.func_187419_a(32868, 0, 6408, i, i, 0, 6408, 5121, (IntBuffer)null); +- int j = GlStateManager.func_187411_c(32868, 0, 4096); - - if (j != 0) - { @@ -457,15 +474,3 @@ } public boolean func_70002_Q() -@@ -2924,9 +2857,9 @@ - { - this.func_147108_a(new GuiYesNo(new GuiYesNoCallback() - { -- public void func_73878_a(boolean p_73878_1_, int p_73878_2_) -+ public void func_73878_a(boolean result, int id) - { -- if (p_73878_1_) -+ if (result) - { - Minecraft.this.func_152346_Z().func_152930_t(); - } diff --git a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch index 90c31e7915..c5d7b20efa 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/audio/SoundManager.java +++ ../src-work/minecraft/net/minecraft/client/audio/SoundManager.java -@@ -69,6 +69,7 @@ +@@ -76,6 +76,7 @@ { SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); @@ -8,34 +8,34 @@ } catch (SoundSystemException soundsystemexception) { -@@ -80,6 +81,7 @@ - { +@@ -100,6 +101,7 @@ + this.func_148613_b(); this.func_148608_i(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundLoadEvent(this)); } private synchronized void func_148608_i() -@@ -316,6 +318,9 @@ +@@ -350,6 +352,9 @@ } else { + p_148611_1_ = net.minecraftforge.client.ForgeHooksClient.playSound(this, p_148611_1_); + if (p_148611_1_ == null) return; + - SoundEventAccessorComposite soundeventaccessorcomposite = this.field_148622_c.func_147680_a(p_148611_1_.func_147650_b()); - - if (soundeventaccessorcomposite == null) -@@ -357,10 +362,12 @@ - if (soundpoolentry.func_148648_d()) + if (!this.field_188777_o.isEmpty()) + { + for (ISoundEventListener isoundeventlistener : this.field_188777_o) +@@ -400,10 +405,12 @@ + if (sound.func_188723_h()) { - this.field_148620_e.newStreamingSource(false, s, func_148612_a(resourcelocation), resourcelocation.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f1); + this.field_148620_e.newStreamingSource(false, s, func_148612_a(resourcelocation1), resourcelocation1.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, p_148611_1_, s)); } else { - this.field_148620_e.newSource(false, s, func_148612_a(resourcelocation), resourcelocation.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f1); + this.field_148620_e.newSource(false, s, func_148612_a(resourcelocation1), resourcelocation1.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, p_148611_1_, s)); } - field_148621_b.debug(field_148623_a, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.func_148652_a(), soundeventaccessorcomposite.func_148729_c(), s}); + field_148621_b.debug(field_148623_a, "Playing sound {} for event {} as channel {}", new Object[] {sound.func_188719_a(), resourcelocation1, s}); diff --git a/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch b/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch index 840d193e0f..74fca0297a 100644 --- a/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java +++ ../src-work/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java -@@ -128,6 +128,6 @@ +@@ -148,6 +148,6 @@ f *= 1.0F - f1 * 0.15F; } diff --git a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch index 8182064b71..df0c1af3d2 100644 --- a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java +++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java -@@ -345,6 +345,15 @@ +@@ -400,6 +400,15 @@ this.field_71159_c.field_71456_v.func_146158_b().func_146227_a(p_146105_1_); } @@ -16,7 +16,7 @@ protected boolean func_145771_j(double p_145771_1_, double p_145771_3_, double p_145771_5_) { if (this.field_70145_X) -@@ -357,30 +366,34 @@ +@@ -412,30 +421,34 @@ double d0 = p_145771_1_ - (double)blockpos.func_177958_n(); double d1 = p_145771_5_ - (double)blockpos.func_177952_p(); @@ -56,16 +56,18 @@ { d2 = 1.0D - d1; i = 5; -@@ -448,6 +461,12 @@ +@@ -515,7 +528,13 @@ - public void func_85030_a(String p_85030_1_, float p_85030_2_, float p_85030_3_) + public void func_184185_a(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_) { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_85030_1_, p_85030_2_, p_85030_3_); -+ if (event.isCanceled() || event.name == null) return; -+ p_85030_1_ = event.name; -+ p_85030_2_ = event.newVolume; -+ p_85030_3_ = event.newPitch; +- this.field_70170_p.func_184134_a(this.field_70165_t, this.field_70163_u, this.field_70161_v, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false); ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_); ++ if (event.isCanceled() || event.getSound() == null) return; ++ p_184185_1_ = event.getSound(); ++ p_184185_2_ = event.getVolume(); ++ p_184185_3_ = event.getPitch(); + - this.field_70170_p.func_72980_b(this.field_70165_t, this.field_70163_u, this.field_70161_v, p_85030_1_, p_85030_2_, p_85030_3_, false); ++ this.field_70170_p.func_184134_a(this.field_70165_t, this.field_70163_u, this.field_70161_v, p_184185_1_, event.getCategory(), p_184185_2_, p_184185_3_, false); } + public boolean func_70613_aW() diff --git a/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch b/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch index 1e1f1185d1..284b9d37a7 100644 --- a/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch @@ -17,25 +17,25 @@ } private void func_111272_d() -@@ -105,7 +106,7 @@ +@@ -106,7 +107,7 @@ try { -- bufferedimage = TextureUtil.func_177053_a(Minecraft.func_71410_x().func_110442_L().func_110536_a(this.field_111273_g).func_110527_b()); -+ bufferedimage = TextureUtil.func_177053_a(getResourceInputStream(this.field_111273_g)); +- iresource = Minecraft.func_71410_x().func_110442_L().func_110536_a(this.field_111273_g); ++ iresource = getResource(this.field_111273_g); + bufferedimage = TextureUtil.func_177053_a(iresource.func_110527_b()); } catch (IOException ioexception) - { -@@ -165,7 +166,7 @@ +@@ -171,7 +172,7 @@ try { -- inputstream = Minecraft.func_71410_x().func_110442_L().func_110536_a(new ResourceLocation("font/glyph_sizes.bin")).func_110527_b(); -+ inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin")); - inputstream.read(this.field_78287_e); +- iresource = Minecraft.func_71410_x().func_110442_L().func_110536_a(new ResourceLocation("font/glyph_sizes.bin")); ++ iresource = getResource(new ResourceLocation("font/glyph_sizes.bin")); + iresource.func_110527_b().read(this.field_78287_e); } catch (IOException ioexception) -@@ -196,7 +197,7 @@ +@@ -202,7 +203,7 @@ int i = p_78266_1_ % 16 * 8; int j = p_78266_1_ / 16 * 8; int k = p_78266_2_ ? 1 : 0; @@ -43,8 +43,8 @@ + bindTexture(this.field_111273_g); int l = this.field_78286_d[p_78266_1_]; float f = (float)l - 0.01F; - GL11.glBegin(GL11.GL_TRIANGLE_STRIP); -@@ -224,7 +225,7 @@ + GlStateManager.func_187447_r(5); +@@ -230,7 +231,7 @@ private void func_78257_a(int p_78257_1_) { @@ -53,7 +53,7 @@ } protected float func_78277_a(char p_78277_1_, boolean p_78277_2_) -@@ -271,7 +272,7 @@ +@@ -279,7 +280,7 @@ public int func_175065_a(String p_175065_1_, float p_175065_2_, float p_175065_3_, int p_175065_4_, boolean p_175065_5_) { @@ -62,7 +62,7 @@ this.func_78265_b(); int i; -@@ -341,7 +342,7 @@ +@@ -349,7 +350,7 @@ int j1 = this.field_78285_g[i1]; this.field_78304_r = j1; @@ -71,7 +71,7 @@ } else if (i1 == 16) { -@@ -370,7 +371,7 @@ +@@ -378,7 +379,7 @@ this.field_78299_w = false; this.field_78300_v = false; this.field_78301_u = false; @@ -80,7 +80,7 @@ } ++i; -@@ -398,7 +399,7 @@ +@@ -406,7 +407,7 @@ c0 = c1; } @@ -89,7 +89,7 @@ boolean flag = (c0 == 0 || j == -1 || this.field_78293_l) && p_78255_2_; if (flag) -@@ -436,7 +437,16 @@ +@@ -444,7 +445,16 @@ ++f; } @@ -106,7 +106,7 @@ if (this.field_78299_w) { Tessellator tessellator = Tessellator.func_178181_a(); -@@ -509,7 +519,7 @@ +@@ -517,7 +527,7 @@ this.field_78292_o = (float)(p_180455_4_ >> 8 & 255) / 255.0F; this.field_78306_p = (float)(p_180455_4_ & 255) / 255.0F; this.field_78305_q = (float)(p_180455_4_ >> 24 & 255) / 255.0F; @@ -115,19 +115,7 @@ this.field_78295_j = p_180455_2_; this.field_78296_k = p_180455_3_; this.func_78255_a(p_180455_1_, p_180455_5_); -@@ -588,11 +598,6 @@ - int j = this.field_78287_e[p_78263_1_] >>> 4; - int k = this.field_78287_e[p_78263_1_] & 15; - -- if (k > 7) -- { -- k = 15; -- j = 0; -- } - - ++k; - return (k - j) / 2 + 1; -@@ -846,6 +851,26 @@ +@@ -848,6 +858,26 @@ return this.field_78294_m; } @@ -146,11 +134,11 @@ + field_78298_i.func_110577_a(location); + } + -+ protected InputStream getResourceInputStream(ResourceLocation location) throws IOException ++ protected IResource getResource(ResourceLocation location) throws IOException + { -+ return Minecraft.func_71410_x().func_110442_L().func_110536_a(location).func_110527_b(); ++ return Minecraft.func_71410_x().func_110442_L().func_110536_a(location); + } + public int func_175064_b(char p_175064_1_) { - return this.field_78285_g["0123456789abcdef".indexOf(p_175064_1_)]; + int i = "0123456789abcdef".indexOf(p_175064_1_); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch index b212709d6d..4d2f4ad58c 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java -@@ -21,6 +21,7 @@ +@@ -22,6 +22,7 @@ public boolean field_146124_l; public boolean field_146125_m; protected boolean field_146123_n; @@ -8,7 +8,7 @@ public GuiButton(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_, String p_i1020_4_) { -@@ -74,6 +75,11 @@ +@@ -75,6 +76,11 @@ this.func_146119_b(p_146112_1_, p_146112_2_, p_146112_3_); int j = 14737632; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch index 799a580d0a..afbde6bafd 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch @@ -1,39 +1,10 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java -@@ -215,13 +215,14 @@ - this.field_146297_k.field_71456_v.func_146158_b().func_146234_a(new ChatComponentText(stringbuilder.toString()), 1); - } +@@ -250,6 +250,7 @@ -- this.field_146415_a.func_146191_b((String)this.field_146412_t.get(this.field_146413_s++)); -+ this.field_146415_a.func_146191_b(net.minecraft.util.EnumChatFormatting.func_110646_a((String)this.field_146412_t.get(this.field_146413_s++))); - } - - private void func_146405_a(String p_146405_1_, String p_146405_2_) - { - if (p_146405_1_.length() >= 1) - { -+ net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_146405_1_, p_146405_2_); - BlockPos blockpos = null; - - if (this.field_146297_k.field_71476_x != null && this.field_146297_k.field_71476_x.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK) -@@ -281,6 +282,12 @@ - this.field_146417_i = false; - this.field_146412_t.clear(); - -+ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete; -+ if (complete != null) -+ { -+ p_146406_1_ = com.google.common.collect.ObjectArrays.concat(complete, p_146406_1_, String.class); -+ } + public BlockPos func_186839_b() + { + - for (String s : p_146406_1_) - { - if (s.length() > 0) -@@ -291,6 +298,7 @@ + BlockPos blockpos = null; - String s1 = this.field_146415_a.func_146179_b().substring(this.field_146415_a.func_146197_a(-1, this.field_146415_a.func_146198_h(), false)); - String s2 = StringUtils.getCommonPrefix(p_146406_1_); -+ s2 = net.minecraft.util.EnumChatFormatting.func_110646_a(s2); - - if (s2.length() > 0 && !s1.equalsIgnoreCase(s2)) - { + if (this.field_186853_g.field_71476_x != null && this.field_186853_g.field_71476_x.field_72313_a == RayTraceResult.Type.BLOCK) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch index 4f9d297f4d..5261e6fa95 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch @@ -6,10 +6,10 @@ + WorldType.field_77139_a[this.field_146331_K].onGUICreateWorldPress(); + - WorldSettings.GameType worldsettings$gametype = WorldSettings.GameType.func_77142_a(this.field_146342_r); - WorldSettings worldsettings = new WorldSettings(i, worldsettings$gametype, this.field_146341_s, this.field_146337_w, WorldType.field_77139_a[this.field_146331_K]); + WorldSettings worldsettings = new WorldSettings(i, WorldSettings.GameType.func_77142_a(this.field_146342_r), this.field_146341_s, this.field_146337_w, WorldType.field_77139_a[this.field_146331_K]); worldsettings.func_82750_a(this.field_146334_a); -@@ -312,14 +314,7 @@ + +@@ -311,14 +313,7 @@ } else if (p_146284_1_.field_146127_k == 8) { @@ -25,7 +25,7 @@ } } } -@@ -371,7 +366,7 @@ +@@ -370,7 +365,7 @@ this.field_146326_C.field_146125_m = this.field_146344_y; this.field_146320_D.field_146125_m = this.field_146344_y; this.field_146321_E.field_146125_m = this.field_146344_y; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch new file mode 100644 index 0000000000..fea4f60669 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiIngame.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngame.java +@@ -360,7 +360,8 @@ + + BlockPos blockpos = raytraceresult.func_178782_a(); + +- if (!this.field_73839_d.field_71441_e.func_180495_p(blockpos).func_177230_c().func_149716_u() || !(this.field_73839_d.field_71441_e.func_175625_s(blockpos) instanceof IInventory)) ++ net.minecraft.block.state.IBlockState state = this.field_73839_d.field_71441_e.func_180495_p(blockpos); ++ if (!state.func_177230_c().hasTileEntity(state) || !(this.field_73839_d.field_71441_e.func_175625_s(blockpos) instanceof IInventory)) + { + return; + } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java.patch new file mode 100644 index 0000000000..67dff1d65e --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java +@@ -242,7 +242,7 @@ + + if (this.field_186784_e.func_71359_d().func_90033_f(this.field_186786_g.func_75786_a())) + { +- this.field_186784_e.func_71371_a(this.field_186786_g.func_75786_a(), this.field_186786_g.func_75788_b(), (WorldSettings)null); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(field_186785_f, this.field_186786_g); + } + } + diff --git a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch index 76e92d8274..08c531721a 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java -@@ -223,7 +223,8 @@ +@@ -216,7 +216,8 @@ { this.field_146292_n.add(new GuiButton(1, this.field_146294_l / 2 - 100, p_73969_1_, I18n.func_135052_a("menu.singleplayer", new Object[0]))); this.field_146292_n.add(new GuiButton(2, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.func_135052_a("menu.multiplayer", new Object[0]))); @@ -10,7 +10,7 @@ } private void func_73972_b(int p_73972_1_, int p_73972_2_) -@@ -271,6 +272,11 @@ +@@ -264,6 +265,11 @@ this.field_146297_k.func_71400_g(); } @@ -22,8 +22,8 @@ if (p_146284_1_.field_146127_k == 11) { this.field_146297_k.func_71371_a("Demo_World", "Demo_World", DemoWorldServer.field_73071_a); -@@ -516,7 +522,16 @@ - s = s + " Demo"; +@@ -512,7 +518,16 @@ + s = s + ("release".equalsIgnoreCase(this.field_146297_k.func_184123_d()) ? "" : "/" + this.field_146297_k.func_184123_d()); } - this.func_73731_b(this.field_146289_q, s, 2, this.field_146295_m - 10, -1); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch index 0841e6d3c8..689452fc8f 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java -@@ -176,6 +176,9 @@ +@@ -190,6 +190,9 @@ long l = j - k; - List list = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.field_175242_a.func_147111_S() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(func_175240_a(l)), Long.valueOf(func_175240_a(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(func_175240_a(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.func_183029_j()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GL11.glGetString(GL11.GL_VENDOR)}), GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VERSION)}); + List list = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.field_175242_a.func_147111_S() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(func_175240_a(l)), Long.valueOf(func_175240_a(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(func_175240_a(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.func_183029_j()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GlStateManager.func_187416_u(7936)}), GlStateManager.func_187416_u(7937), GlStateManager.func_187416_u(7938)}); + list.add(""); + list.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false)); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch index 1a343c6f6b..329f40f342 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java -@@ -143,7 +143,8 @@ +@@ -141,7 +141,8 @@ } } @@ -10,7 +10,7 @@ } protected void func_146279_a(String p_146279_1_, int p_146279_2_, int p_146279_3_) -@@ -153,6 +154,11 @@ +@@ -151,6 +152,11 @@ protected void func_146283_a(List p_146283_1_, int p_146283_2_, int p_146283_3_) { @@ -22,7 +22,7 @@ if (!p_146283_1_.isEmpty()) { GlStateManager.func_179101_C(); -@@ -163,7 +169,7 @@ +@@ -161,7 +167,7 @@ for (String s : p_146283_1_) { @@ -31,7 +31,7 @@ if (j > i) { -@@ -208,7 +214,7 @@ +@@ -206,7 +212,7 @@ for (int k1 = 0; k1 < p_146283_1_.size(); ++k1) { String s1 = (String)p_146283_1_.get(k1); @@ -40,7 +40,7 @@ if (k1 == 0) { -@@ -436,6 +442,7 @@ +@@ -421,6 +427,7 @@ { this.field_146297_k.field_71456_v.func_146158_b().func_146239_a(p_175281_1_); } @@ -48,7 +48,7 @@ this.field_146297_k.field_71439_g.func_71165_d(p_175281_1_); } -@@ -450,9 +457,15 @@ +@@ -435,9 +442,15 @@ if (guibutton.func_146116_c(this.field_146297_k, p_73864_1_, p_73864_2_)) { @@ -64,7 +64,7 @@ } } } -@@ -482,8 +495,12 @@ +@@ -467,8 +480,12 @@ this.field_146289_q = p_146280_1_.field_71466_p; this.field_146294_l = p_146280_2_; this.field_146295_m = p_146280_3_; @@ -77,7 +77,7 @@ } public void func_183500_a(int p_183500_1_, int p_183500_2_) -@@ -502,7 +519,9 @@ +@@ -487,7 +504,9 @@ { while (Mouse.next()) { @@ -87,7 +87,7 @@ } } -@@ -510,7 +529,9 @@ +@@ -495,7 +514,9 @@ { while (Keyboard.next()) { @@ -97,7 +97,7 @@ } } } -@@ -570,6 +591,7 @@ +@@ -557,6 +578,7 @@ public void func_146276_q_() { this.func_146270_b(0); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch deleted file mode 100644 index d1ee636567..0000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiSelectWorld.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSelectWorld.java -@@ -186,7 +186,7 @@ - - if (this.field_146297_k.func_71359_d().func_90033_f(s)) - { -- this.field_146297_k.func_71371_a(s, s1, (WorldSettings)null); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(this, s, s1); - } - } - } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch index d4b2b22e59..fa8d3be0eb 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -3,15 +3,15 @@ @@ -181,15 +181,8 @@ GlStateManager.func_179106_n(); Tessellator tessellator = Tessellator.func_178181_a(); - WorldRenderer worldrenderer = tessellator.func_178180_c(); + VertexBuffer vertexbuffer = tessellator.func_178180_c(); - this.field_148161_k.func_110434_K().func_110577_a(Gui.field_110325_k); - GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); - float f = 32.0F; -- worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181709_i); -- worldrenderer.func_181662_b((double)this.field_148152_e, (double)this.field_148154_c, 0.0D).func_181673_a((double)((float)this.field_148152_e / f), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); -- worldrenderer.func_181662_b((double)this.field_148151_d, (double)this.field_148154_c, 0.0D).func_181673_a((double)((float)this.field_148151_d / f), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); -- worldrenderer.func_181662_b((double)this.field_148151_d, (double)this.field_148153_b, 0.0D).func_181673_a((double)((float)this.field_148151_d / f), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); -- worldrenderer.func_181662_b((double)this.field_148152_e, (double)this.field_148153_b, 0.0D).func_181673_a((double)((float)this.field_148152_e / f), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- vertexbuffer.func_181668_a(7, DefaultVertexFormats.field_181709_i); +- vertexbuffer.func_181662_b((double)this.field_148152_e, (double)this.field_148154_c, 0.0D).func_187315_a((double)((float)this.field_148152_e / f), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- vertexbuffer.func_181662_b((double)this.field_148151_d, (double)this.field_148154_c, 0.0D).func_187315_a((double)((float)this.field_148151_d / f), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- vertexbuffer.func_181662_b((double)this.field_148151_d, (double)this.field_148153_b, 0.0D).func_187315_a((double)((float)this.field_148151_d / f), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- vertexbuffer.func_181662_b((double)this.field_148152_e, (double)this.field_148153_b, 0.0D).func_187315_a((double)((float)this.field_148152_e / f), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); - tessellator.func_78381_a(); + // Forge: background rendering moved into separate method. + this.drawContainerBackground(tessellator); @@ -25,15 +25,15 @@ + + protected void drawContainerBackground(Tessellator tessellator) + { -+ WorldRenderer worldrenderer = tessellator.func_178180_c(); ++ VertexBuffer buffer = tessellator.func_178180_c(); + this.field_148161_k.func_110434_K().func_110577_a(Gui.field_110325_k); + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + float f = 32.0F; -+ worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181709_i); -+ worldrenderer.func_181662_b((double)this.field_148152_e, (double)this.field_148154_c, 0.0D).func_181673_a((double)((float)this.field_148152_e / f), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); -+ worldrenderer.func_181662_b((double)this.field_148151_d, (double)this.field_148154_c, 0.0D).func_181673_a((double)((float)this.field_148151_d / f), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); -+ worldrenderer.func_181662_b((double)this.field_148151_d, (double)this.field_148153_b, 0.0D).func_181673_a((double)((float)this.field_148151_d / f), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); -+ worldrenderer.func_181662_b((double)this.field_148152_e, (double)this.field_148153_b, 0.0D).func_181673_a((double)((float)this.field_148152_e / f), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ buffer.func_181668_a(7, DefaultVertexFormats.field_181709_i); ++ buffer.func_181662_b((double)this.field_148152_e, (double)this.field_148154_c, 0.0D).func_187315_a((double)((float)this.field_148152_e / f), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ buffer.func_181662_b((double)this.field_148151_d, (double)this.field_148154_c, 0.0D).func_187315_a((double)((float)this.field_148151_d / f), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ buffer.func_181662_b((double)this.field_148151_d, (double)this.field_148153_b, 0.0D).func_187315_a((double)((float)this.field_148151_d / f), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ buffer.func_181662_b((double)this.field_148152_e, (double)this.field_148153_b, 0.0D).func_187315_a((double)((float)this.field_148152_e / f), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); + tessellator.func_78381_a(); + } } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch index be5f0a5aae..90631f9ae5 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch @@ -5,6 +5,6 @@ } + s3 = FontRenderer.func_78282_e(s2) + s3; //Forge: Fix chat formatting not surviving line wrapping. - ChatComponentText chatcomponenttext2 = new ChatComponentText(s3); - chatcomponenttext2.func_150255_a(ichatcomponent1.func_150256_b().func_150232_l()); - list1.add(j + 1, chatcomponenttext2); + TextComponentString textcomponentstring2 = new TextComponentString(s3); + textcomponentstring2.func_150255_a(itextcomponent1.func_150256_b().func_150232_l()); + list1.add(j + 1, textcomponentstring2); diff --git a/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch b/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch index a79cd9dd2e..e3f9b78edd 100644 --- a/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java +++ ../src-work/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java @@ -82,7 +82,7 @@ - boolean flag1 = this.field_148301_e.field_82821_f < 47; + boolean flag1 = this.field_148301_e.field_82821_f < 107; boolean flag2 = flag || flag1; this.field_148300_d.field_71466_p.func_78276_b(this.field_148301_e.field_78847_a, p_180790_2_ + 32 + 3, p_180790_3_ + 1, 16777215); - List list = this.field_148300_d.field_71466_p.func_78271_c(this.field_148301_e.field_78843_d, p_180790_4_ - 32 - 2); diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch index 5512b3cdcd..bba2f8a700 100644 --- a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch @@ -13,10 +13,10 @@ this.field_146562_a = p_i45026_1_; @@ -57,6 +61,14 @@ int j = 141; - this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.field_76004_f.field_75993_a * 24 - i / 2 - 12); - this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.field_76004_f.field_75991_b * 24 - j / 2); + this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.field_187982_f.field_75993_a * 24 - i / 2 - 12); + this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.field_187982_f.field_75991_b * 24 - j / 2); + minecraftAchievements.clear(); -+ for (Achievement achievement : AchievementList.field_76007_e) ++ for (Achievement achievement : AchievementList.field_187981_e) + { + if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement)) + { @@ -27,7 +27,7 @@ public void func_73866_w_() @@ -64,6 +76,7 @@ - this.field_146297_k.func_147114_u().func_147297_a(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS)); + this.field_146297_k.func_147114_u().func_147297_a(new CPacketClientStatus(CPacketClientStatus.State.REQUEST_STATS)); this.field_146292_n.clear(); this.field_146292_n.add(new GuiOptionButton(1, this.field_146294_l / 2 + 24, this.field_146295_m / 2 + 74, 80, 20, I18n.func_135052_a("gui.done", new Object[0]))); + this.field_146292_n.add(button = new GuiButton(2, (field_146294_l - field_146555_f) / 2 + 24, field_146295_m / 2 + 74, 125, 20, net.minecraftforge.common.AchievementPage.getTitle(currentPage))); @@ -66,12 +66,11 @@ GlStateManager.func_179143_c(515); this.field_146297_k.func_110434_K().func_110577_a(field_146561_C); -- for (int j5 = 0; j5 < AchievementList.field_76007_e.size(); ++j5) +- for (int j5 = 0; j5 < AchievementList.field_187981_e.size(); ++j5) + java.util.List achievementList = (currentPage == -1 ? minecraftAchievements : net.minecraftforge.common.AchievementPage.getAchievementPage(currentPage).getAchievements()); + for (int j5 = 0; j5 < achievementList.size(); ++j5) { -- Achievement achievement1 = (Achievement)AchievementList.field_76007_e.get(j5); -+ Achievement achievement1 = achievementList.get(j5); + Achievement achievement1 = (Achievement)AchievementList.field_187981_e.get(j5); - if (achievement1.field_75992_c != null) + if (achievement1.field_75992_c != null && achievementList.contains(achievement1.field_75992_c)) @@ -82,10 +81,10 @@ GlStateManager.func_179091_B(); GlStateManager.func_179142_g(); -- for (int i6 = 0; i6 < AchievementList.field_76007_e.size(); ++i6) +- for (int i6 = 0; i6 < AchievementList.field_187981_e.size(); ++i6) + for (int i6 = 0; i6 < achievementList.size(); ++i6) { -- Achievement achievement2 = (Achievement)AchievementList.field_76007_e.get(i6); +- Achievement achievement2 = (Achievement)AchievementList.field_187981_e.get(i6); + Achievement achievement2 = achievementList.get(i6); int l6 = achievement2.field_75993_a * 24 - i; int j7 = achievement2.field_75991_b * 24 - j; @@ -114,4 +113,4 @@ + GlStateManager.func_179140_f(); //Forge: Make sure Lighting is disabled. Fixes MC-33065 GlStateManager.func_179089_o(); this.field_146296_j.func_180450_b(achievement2.field_75990_d, l6 + 3, j7 + 3); - GlStateManager.func_179112_b(770, 771); + GlStateManager.func_187401_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch deleted file mode 100644 index f2890750df..0000000000 --- a/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiStats.java -+++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiStats.java -@@ -5,6 +5,8 @@ - import java.util.Collections; - import java.util.Comparator; - import java.util.List; -+ -+import net.minecraft.block.Block; - import net.minecraft.client.Minecraft; - import net.minecraft.client.audio.PositionedSoundRecord; - import net.minecraft.client.gui.GuiButton; -@@ -443,17 +445,18 @@ - for (StatCrafting statcrafting : StatList.field_75939_e) - { - boolean flag = false; -- int i = Item.func_150891_b(statcrafting.func_150959_a()); -+ int i = Block.func_149682_b(Block.func_149634_a(statcrafting.func_150959_a())); -+ int itemId = Item.func_150891_b(statcrafting.func_150959_a()); - - if (GuiStats.this.field_146546_t.func_77444_a(statcrafting) > 0) - { - flag = true; - } -- else if (StatList.field_75929_E[i] != null && GuiStats.this.field_146546_t.func_77444_a(StatList.field_75929_E[i]) > 0) -+ else if (StatList.field_75929_E[itemId] != null && GuiStats.this.field_146546_t.func_77444_a(StatList.field_75929_E[itemId]) > 0) - { - flag = true; - } -- else if (StatList.field_75928_D[i] != null && GuiStats.this.field_146546_t.func_77444_a(StatList.field_75928_D[i]) > 0) -+ else if (StatList.field_75928_D[itemId] != null && GuiStats.this.field_146546_t.func_77444_a(StatList.field_75928_D[itemId]) > 0) - { - flag = true; - } -@@ -468,8 +471,15 @@ - { - public int compare(StatCrafting p_compare_1_, StatCrafting p_compare_2_) - { -- int j = Item.func_150891_b(p_compare_1_.func_150959_a()); -- int k = Item.func_150891_b(p_compare_2_.func_150959_a()); -+ int j; -+ int k; -+ if (StatsBlock.this.field_148217_o == 2) { -+ j = Block.func_149682_b(Block.func_149634_a(p_compare_1_.func_150959_a())); -+ k = Block.func_149682_b(Block.func_149634_a(p_compare_2_.func_150959_a())); -+ } else { -+ j = Item.func_150891_b(p_compare_1_.func_150959_a()); -+ k = Item.func_150891_b(p_compare_2_.func_150959_a()); -+ } - StatBase statbase = null; - StatBase statbase1 = null; - -@@ -748,7 +758,7 @@ - super(p_i45510_2_, GuiStats.this.field_146294_l, GuiStats.this.field_146295_m, 32, GuiStats.this.field_146295_m - 64, GuiStats.this.field_146289_q.field_78288_b * 4); - this.func_148130_a(false); - -- for (EntityList.EntityEggInfo entitylist$entityegginfo : EntityList.field_75627_a.values()) -+ for (EntityList.EntityEggInfo entitylist$entityegginfo : com.google.common.collect.Iterables.concat(EntityList.field_75627_a.values(), net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().values())) - { - if (GuiStats.this.field_146546_t.func_77444_a(entitylist$entityegginfo.field_151512_d) > 0 || GuiStats.this.field_146546_t.func_77444_a(entitylist$entityegginfo.field_151513_e) > 0) - { -@@ -784,7 +794,7 @@ - protected void func_180791_a(int p_180791_1_, int p_180791_2_, int p_180791_3_, int p_180791_4_, int p_180791_5_, int p_180791_6_) - { - EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(p_180791_1_); -- String s = I18n.func_135052_a("entity." + EntityList.func_75617_a(entitylist$entityegginfo.field_75613_a) + ".name", new Object[0]); -+ String s = I18n.func_135052_a("entity." + entitylist$entityegginfo.name + ".name", new Object[0]); - int i = GuiStats.this.field_146546_t.func_77444_a(entitylist$entityegginfo.field_151512_d); - int j = GuiStats.this.field_146546_t.func_77444_a(entitylist$entityegginfo.field_151513_e); - String s1 = I18n.func_135052_a("stat.entityKills", new Object[] {Integer.valueOf(i), s}); diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch index 2e03fc6d36..1b2794a76b 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java +++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java -@@ -175,8 +175,11 @@ +@@ -176,8 +176,11 @@ GlStateManager.func_179109_b(0.0F, 0.0F, 32.0F); this.field_73735_i = 200.0F; this.field_146296_j.field_77023_b = 200.0F; @@ -13,9 +13,9 @@ this.field_73735_i = 0.0F; this.field_146296_j.field_77023_b = 0.0F; } -@@ -239,13 +242,12 @@ +@@ -240,13 +243,12 @@ - if (itemstack == null) + if (itemstack == null && p_146977_1_.func_111238_b()) { - String s1 = p_146977_1_.func_178171_c(); + TextureAtlasSprite textureatlassprite = p_146977_1_.getBackgroundSprite(); @@ -30,7 +30,7 @@ this.func_175175_a(i, j, textureatlassprite, 16, 16); GlStateManager.func_179145_e(); flag1 = true; -@@ -326,6 +328,7 @@ +@@ -327,6 +329,7 @@ int j = this.field_147003_i; int k = this.field_147009_r; boolean flag1 = p_73864_1_ < j || p_73864_2_ < k || p_73864_1_ >= j + this.field_146999_f || p_73864_2_ >= k + this.field_147000_g; @@ -38,7 +38,7 @@ int l = -1; if (slot != null) -@@ -463,10 +466,12 @@ +@@ -464,10 +467,12 @@ protected void func_146286_b(int p_146286_1_, int p_146286_2_, int p_146286_3_) { @@ -51,7 +51,7 @@ int k = -1; if (slot != null) -@@ -685,4 +690,16 @@ +@@ -686,4 +691,16 @@ this.field_146297_k.field_71439_g.func_71053_j(); } } diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch index 671aff30bd..a4786eeeb2 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java +++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java -@@ -48,6 +48,8 @@ +@@ -49,6 +49,8 @@ private Slot field_147064_C; private boolean field_147057_D; private CreativeCrafting field_147059_E; @@ -9,16 +9,7 @@ public GuiContainerCreative(EntityPlayer p_i1088_1_) { -@@ -175,7 +177,7 @@ - return; - } - -- if (itemstack1 != null && itemstack2 != null && itemstack1.func_77969_a(itemstack2)) -+ if (itemstack1 != null && itemstack2 != null && itemstack1.func_77969_a(itemstack2) && ItemStack.func_77970_a(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770 - { - if (p_146984_3_ == 0) - { -@@ -259,6 +261,13 @@ +@@ -258,6 +260,13 @@ this.func_147050_b(CreativeTabs.field_78032_a[i]); this.field_147059_E = new CreativeCrafting(this.field_146297_k); this.field_146297_k.field_71439_g.field_71069_bz.func_75132_a(this.field_147059_E); @@ -32,7 +23,7 @@ } else { -@@ -280,7 +289,7 @@ +@@ -279,7 +288,7 @@ protected void func_73869_a(char p_73869_1_, int p_73869_2_) throws IOException { @@ -41,7 +32,7 @@ { if (GameSettings.func_100015_a(this.field_146297_k.field_71474_y.field_74310_D)) { -@@ -318,6 +327,14 @@ +@@ -317,6 +326,14 @@ GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h; guicontainercreative$containercreative.field_148330_a.clear(); @@ -56,7 +47,7 @@ for (Item item : Item.field_150901_e) { if (item != null && item.func_77640_w() != null) -@@ -325,7 +342,13 @@ +@@ -324,7 +341,13 @@ item.func_150895_a(item, (CreativeTabs)null, guicontainercreative$containercreative.field_148330_a); } } @@ -66,11 +57,11 @@ + //split from above for custom search tabs + private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$containercreative) + { -+ if (CreativeTabs.field_78032_a[field_147058_w] == CreativeTabs.field_78027_g) // FORGE: Only add enchanted books to the regular search - for (Enchantment enchantment : Enchantment.field_77331_b) ++ if (CreativeTabs.field_78032_a[field_147058_w] == CreativeTabs.field_78027_g) // FORGE: Only add enchanted books to the regular search + for (Enchantment enchantment : Enchantment.field_185264_b) { if (enchantment != null && enchantment.field_77351_y != null) -@@ -333,7 +356,6 @@ +@@ -332,7 +355,6 @@ Items.field_151134_bR.func_92113_a(enchantment, guicontainercreative$containercreative.field_148330_a); } } @@ -78,7 +69,7 @@ Iterator iterator = guicontainercreative$containercreative.field_148330_a.iterator(); String s1 = this.field_147062_A.func_146179_b().toLowerCase(); -@@ -365,7 +387,7 @@ +@@ -364,7 +386,7 @@ { CreativeTabs creativetabs = CreativeTabs.field_78032_a[field_147058_w]; @@ -87,7 +78,7 @@ { GlStateManager.func_179084_k(); this.field_146289_q.func_78276_b(I18n.func_135052_a(creativetabs.func_78024_c(), new Object[0]), 8, 6, 4210752); -@@ -400,7 +422,7 @@ +@@ -399,7 +421,7 @@ for (CreativeTabs creativetabs : CreativeTabs.field_78032_a) { @@ -96,7 +87,7 @@ { this.func_147050_b(creativetabs); return; -@@ -413,11 +435,13 @@ +@@ -412,11 +434,13 @@ private boolean func_147055_p() { @@ -110,7 +101,7 @@ int i = field_147058_w; field_147058_w = p_147050_1_.func_78021_a(); GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h; -@@ -483,12 +507,14 @@ +@@ -487,12 +511,14 @@ if (this.field_147062_A != null) { @@ -126,7 +117,7 @@ this.func_147053_i(); } else -@@ -558,20 +584,43 @@ +@@ -562,20 +588,43 @@ } super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_); @@ -171,7 +162,7 @@ GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.func_179140_f(); } -@@ -633,16 +682,35 @@ +@@ -637,16 +686,35 @@ RenderHelper.func_74520_c(); CreativeTabs creativetabs = CreativeTabs.field_78032_a[field_147058_w]; @@ -208,7 +199,7 @@ this.field_146297_k.func_110434_K().func_110577_a(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.func_78015_f())); this.func_73729_b(this.field_147003_i, this.field_147009_r, 0, 0, this.field_146999_f, this.field_147000_g); this.field_147062_A.func_146194_f(); -@@ -657,6 +725,14 @@ +@@ -661,6 +729,14 @@ this.func_73729_b(i, j + (int)((float)(k - j - 17) * this.field_147067_x), 232 + (this.func_147055_p() ? 0 : 12), 0, 12, 15); } @@ -223,7 +214,7 @@ this.func_147051_a(creativetabs); if (creativetabs == CreativeTabs.field_78036_m) -@@ -667,6 +743,14 @@ +@@ -671,6 +747,14 @@ protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) { @@ -238,7 +229,7 @@ int i = p_147049_1_.func_78020_k(); int j = 28 * i; int k = 0; -@@ -763,6 +847,8 @@ +@@ -767,6 +851,8 @@ } GlStateManager.func_179140_f(); @@ -247,7 +238,7 @@ this.func_73729_b(l, i1, j, k, 28, j1); this.field_73735_i = 100.0F; this.field_146296_j.field_77023_b = 100.0F; -@@ -789,6 +875,15 @@ +@@ -793,6 +879,15 @@ { this.field_146297_k.func_147108_a(new GuiStats(this, this.field_146297_k.field_71439_g.func_146107_m())); } diff --git a/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch index d91355e164..387c496162 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch +++ b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch @@ -13,6 +13,6 @@ } + @SideOnly(Side.CLIENT) - public void func_178780_a(WorldRenderer p_178780_1_, float p_178780_2_) + public void func_178780_a(VertexBuffer p_178780_1_, float p_178780_2_) { for (int i = 0; i < this.field_78254_i.length; ++i) diff --git a/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch index 77e0a42cb2..4962d8769a 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/model/ModelRenderer.java +++ ../src-work/minecraft/net/minecraft/client/model/ModelRenderer.java -@@ -10,7 +10,6 @@ +@@ -9,7 +9,6 @@ + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; - import org.lwjgl.opengl.GL11; -@SideOnly(Side.CLIENT) public class ModelRenderer { public float field_78801_a; -@@ -109,6 +108,7 @@ +@@ -108,6 +107,7 @@ this.field_78798_e = p_78793_3_; } @@ -16,7 +16,7 @@ public void func_78785_a(float p_78785_1_) { if (!this.field_78807_k) -@@ -190,6 +190,7 @@ +@@ -189,6 +189,7 @@ } } @@ -24,7 +24,7 @@ public void func_78791_b(float p_78791_1_) { if (!this.field_78807_k) -@@ -225,6 +226,7 @@ +@@ -224,6 +225,7 @@ } } @@ -32,7 +32,7 @@ public void func_78794_c(float p_78794_1_) { if (!this.field_78807_k) -@@ -266,6 +268,7 @@ +@@ -265,6 +267,7 @@ } } diff --git a/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch b/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch index dbe66e3035..307bb90b30 100644 --- a/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch +++ b/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch @@ -3,11 +3,11 @@ @@ -1,10 +1,7 @@ package net.minecraft.client.model; - import net.minecraft.util.Vec3; + import net.minecraft.util.math.Vec3d; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -@SideOnly(Side.CLIENT) public class PositionTextureVertex { - public Vec3 field_78243_a; + public Vec3d field_78243_a; diff --git a/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch b/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch index ea7d9cd311..860a67a8b8 100644 --- a/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch +++ b/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch @@ -1,13 +1,18 @@ --- ../src-base/minecraft/net/minecraft/client/model/TexturedQuad.java +++ ../src-work/minecraft/net/minecraft/client/model/TexturedQuad.java -@@ -4,10 +4,7 @@ - import net.minecraft.client.renderer.WorldRenderer; - import net.minecraft.client.renderer.vertex.DefaultVertexFormats; - import net.minecraft.util.Vec3; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; +@@ -7,7 +7,6 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; -@SideOnly(Side.CLIENT) public class TexturedQuad { public PositionTextureVertex[] field_78239_a; +@@ -43,6 +42,7 @@ + this.field_78239_a = apositiontexturevertex; + } + ++ @SideOnly(Side.CLIENT) + public void func_178765_a(VertexBuffer p_178765_1_, float p_178765_2_) + { + Vec3d vec3d = this.field_78239_a[1].field_78243_a.func_72444_a(this.field_78239_a[0].field_78243_a); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch index feb70661e7..97d95aea61 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java -@@ -55,6 +55,7 @@ +@@ -52,6 +52,7 @@ Chunk chunk = new Chunk(this.field_73235_d, p_73158_1_, p_73158_2_); this.field_73236_b.func_76163_a(ChunkCoordIntPair.func_77272_a(p_73158_1_, p_73158_2_), chunk); this.field_73237_c.add(chunk); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch index fbd519d254..0d82da59b0 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch @@ -4,8 +4,8 @@ inetaddress = InetAddress.getByName(p_146367_1_); GuiConnecting.this.field_146371_g = NetworkManager.func_181124_a(inetaddress, p_146367_2_, GuiConnecting.this.field_146297_k.field_71474_y.func_181148_f()); GuiConnecting.this.field_146371_g.func_150719_a(new NetHandlerLoginClient(GuiConnecting.this.field_146371_g, GuiConnecting.this.field_146297_k, GuiConnecting.this.field_146374_i)); -- GuiConnecting.this.field_146371_g.func_179290_a(new C00Handshake(47, p_146367_1_, p_146367_2_, EnumConnectionState.LOGIN)); -+ GuiConnecting.this.field_146371_g.func_179290_a(new C00Handshake(47, p_146367_1_, p_146367_2_, EnumConnectionState.LOGIN, true)); - GuiConnecting.this.field_146371_g.func_179290_a(new C00PacketLoginStart(GuiConnecting.this.field_146297_k.func_110432_I().func_148256_e())); +- GuiConnecting.this.field_146371_g.func_179290_a(new C00Handshake(107, p_146367_1_, p_146367_2_, EnumConnectionState.LOGIN)); ++ GuiConnecting.this.field_146371_g.func_179290_a(new C00Handshake(107, p_146367_1_, p_146367_2_, EnumConnectionState.LOGIN, true)); + GuiConnecting.this.field_146371_g.func_179290_a(new CPacketLoginStart(GuiConnecting.this.field_146297_k.func_110432_I().func_148256_e())); } catch (UnknownHostException unknownhostexception) diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index 891b51bc7c..8cc02cf1a3 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -1,87 +1,93 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java -@@ -111,6 +111,12 @@ +@@ -121,6 +121,12 @@ } } -+ ItemStack stack = field_78776_a.field_71439_g.func_71045_bC(); -+ if (stack != null && stack.func_77973_b() != null && stack.func_77973_b().onBlockStartBreak(stack, p_178888_1_, field_78776_a.field_71439_g)) ++ ItemStack stack = field_78776_a.field_71439_g.func_184614_ca(); ++ if (stack != null && stack.func_77973_b() != null && stack.func_77973_b().onBlockStartBreak(stack, p_187103_1_, field_78776_a.field_71439_g)) + { + return false; + } + - if (this.field_78779_k.func_77145_d() && this.field_78776_a.field_71439_g.func_70694_bm() != null && this.field_78776_a.field_71439_g.func_70694_bm().func_77973_b() instanceof ItemSword) + if (this.field_78779_k.func_77145_d() && this.field_78776_a.field_71439_g.func_184614_ca() != null && this.field_78776_a.field_71439_g.func_184614_ca().func_77973_b() instanceof ItemSword) { return false; -@@ -128,13 +134,7 @@ +@@ -142,14 +148,7 @@ else { - world.func_175718_b(2001, p_178888_1_, Block.func_176210_f(iblockstate)); -- boolean flag = world.func_175698_g(p_178888_1_); + world.func_175718_b(2001, p_187103_1_, Block.func_176210_f(iblockstate)); +- block.func_176208_a(world, p_187103_1_, iblockstate, this.field_78776_a.field_71439_g); +- boolean flag = world.func_180501_a(p_187103_1_, Blocks.field_150350_a.func_176223_P(), 11); - if (flag) - { -- block1.func_176206_d(world, p_178888_1_, iblockstate); +- block.func_176206_d(world, p_187103_1_, iblockstate); - } - this.field_178895_c = new BlockPos(this.field_178895_c.func_177958_n(), -1, this.field_178895_c.func_177952_p()); if (!this.field_78779_k.func_77145_d()) -@@ -152,6 +152,12 @@ +@@ -160,13 +159,20 @@ + { + itemstack1.func_179548_a(world, iblockstate, p_187103_1_, this.field_78776_a.field_71439_g); + +- if (itemstack1.field_77994_a == 0) ++ if (itemstack1.field_77994_a <= 0) + { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_78776_a.field_71439_g, itemstack1, EnumHand.MAIN_HAND); + this.field_78776_a.field_71439_g.func_184611_a(EnumHand.MAIN_HAND, (ItemStack)null); + } } } -+ boolean flag = block1.removedByPlayer(world, p_178888_1_, field_78776_a.field_71439_g, false); ++ boolean flag = block.removedByPlayer(iblockstate, world, p_187103_1_, field_78776_a.field_71439_g, false); + + if (flag) + { -+ block1.func_176206_d(world, p_178888_1_, iblockstate); ++ block.func_176206_d(world, p_187103_1_, iblockstate); + } return flag; } } -@@ -356,11 +362,19 @@ +@@ -373,11 +379,15 @@ { if (this.field_78779_k != WorldSettings.GameType.SPECTATOR) { ++ net.minecraft.item.Item item = p_187099_3_ == null ? null : p_187099_3_.func_77973_b(); ++ EnumActionResult ret = item == null ? EnumActionResult.PASS : item.onItemUseFirst(p_187099_3_, p_187099_1_, p_187099_2_, p_187099_4_, p_187099_5_, f, f1, f2, p_187099_7_); ++ if (ret != EnumActionResult.PASS) return ret; + -+ if (p_178890_3_ != null && -+ p_178890_3_.func_77973_b() != null && -+ p_178890_3_.func_77973_b().onItemUseFirst(p_178890_3_, p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) -+ { -+ return true; -+ } -+ - IBlockState iblockstate = p_178890_2_.func_180495_p(p_178890_4_); + IBlockState iblockstate = p_187099_2_.func_180495_p(p_187099_4_); -- if ((!p_178890_1_.func_70093_af() || p_178890_1_.func_70694_bm() == null) && iblockstate.func_177230_c().func_180639_a(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2)) -+ if ((!p_178890_1_.func_70093_af() || p_178890_1_.func_70694_bm() == null || p_178890_1_.func_70694_bm().func_77973_b().doesSneakBypassUse(p_178890_2_, p_178890_4_, p_178890_1_))) +- if ((!p_187099_1_.func_70093_af() || p_187099_1_.func_184614_ca() == null && p_187099_1_.func_184592_cb() == null) && iblockstate.func_177230_c().func_180639_a(p_187099_2_, p_187099_4_, iblockstate, p_187099_1_, p_187099_7_, p_187099_3_, p_187099_5_, f, f1, f2)) ++ if ((!p_187099_1_.func_70093_af() || (p_187099_1_.func_184614_ca() == null || item.doesSneakBypassUse(p_187099_3_, p_187099_2_, p_187099_4_, p_187099_1_)) && p_187099_1_.func_184592_cb() == null)) { - flag = true; -+ flag = iblockstate.func_177230_c().func_180639_a(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2); ++ flag = iblockstate.func_177230_c().func_180639_a(p_187099_2_, p_187099_4_, iblockstate, p_187099_1_, p_187099_7_, p_187099_3_, p_187099_5_, f, f1, f2); } - if (!flag && p_178890_3_ != null && p_178890_3_.func_77973_b() instanceof ItemBlock) -@@ -393,7 +407,9 @@ + if (!flag && p_187099_3_ != null && p_187099_3_.func_77973_b() instanceof ItemBlock) +@@ -418,7 +428,9 @@ } else { -- return p_178890_3_.func_179546_a(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2); -+ if (!p_178890_3_.func_179546_a(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) return false; -+ if (p_178890_3_.field_77994_a <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_178890_1_, p_178890_3_); -+ return true; +- return p_187099_3_.func_179546_a(p_187099_1_, p_187099_2_, p_187099_4_, p_187099_7_, p_187099_5_, f, f1, f2); ++ EnumActionResult ret = p_187099_3_.func_179546_a(p_187099_1_, p_187099_2_, p_187099_4_, p_187099_7_, p_187099_5_, f, f1, f2); ++ if (p_187099_3_.field_77994_a <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187099_1_, p_187099_3_, p_187099_7_); ++ return ret; } } else -@@ -420,9 +436,10 @@ - { - p_78769_1_.field_71071_by.field_70462_a[p_78769_1_.field_71071_by.field_70461_c] = itemstack; - -- if (itemstack.field_77994_a == 0) -+ if (itemstack.field_77994_a <= 0) +@@ -453,9 +465,10 @@ { - p_78769_1_.field_71071_by.field_70462_a[p_78769_1_.field_71071_by.field_70461_c] = null; -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_78769_1_, itemstack); + p_187101_1_.func_184611_a(p_187101_4_, itemstack); + +- if (itemstack.field_77994_a == 0) ++ if (itemstack.field_77994_a <= 0) + { + p_187101_1_.func_184611_a(p_187101_4_, (ItemStack)null); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187101_1_, itemstack, p_187101_4_); + } } - return true; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch index 0996e6ecd5..e15a04d455 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java -@@ -52,12 +52,13 @@ - super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.func_76570_a(p_i45063_3_), p_i45063_5_, true); +@@ -63,12 +63,13 @@ + this.field_184157_a = Sets.newHashSet(); this.field_73035_a = p_i45063_1_; this.func_72912_H().func_176144_a(p_i45063_4_); - this.func_175652_B(new BlockPos(8, 64, 8)); diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch index 4456528880..5d54f059fe 100644 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java +++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java -@@ -104,7 +104,10 @@ +@@ -106,7 +106,10 @@ { this.field_175091_e = p_147390_1_.func_179730_a(); this.field_147393_d.func_150723_a(EnumConnectionState.PLAY); @@ -11,4 +11,4 @@ + net.minecraftforge.fml.client.FMLClientHandler.instance().setPlayClient(nhpc); } - public void func_147231_a(IChatComponent p_147231_1_) + public void func_147231_a(ITextComponent p_147231_1_) diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch index 4fa630f5fd..54911d8387 100644 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java +++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java -@@ -246,7 +246,7 @@ +@@ -267,7 +267,7 @@ { PacketThreadUtil.func_180031_a(p_147282_1_, this, this.field_147299_f); this.field_147299_f.field_71442_b = new PlayerControllerMP(this.field_147299_f, this); @@ -9,11 +9,11 @@ this.field_147299_f.field_71474_y.field_74318_M = p_147282_1_.func_149192_g(); this.field_147299_f.func_71403_a(this.field_147300_g); this.field_147299_f.field_71439_g.field_71093_bK = p_147282_1_.func_149194_f(); -@@ -750,14 +750,16 @@ - public void func_147251_a(S02PacketChat p_147251_1_) +@@ -785,14 +785,16 @@ + public void func_147251_a(SPacketChat p_147251_1_) { PacketThreadUtil.func_180031_a(p_147251_1_, this, this.field_147299_f); -+ net.minecraft.util.IChatComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_147251_1_.func_179841_c(), p_147251_1_.func_148915_c()); ++ net.minecraft.util.text.ITextComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_147251_1_.func_179841_c(), p_147251_1_.func_148915_c()); + if (message == null) return; if (p_147251_1_.func_179841_c() == 2) @@ -28,7 +28,7 @@ } } -@@ -808,6 +810,11 @@ +@@ -848,6 +850,11 @@ float f = (float)(p_147281_1_.func_149028_l() * 360) / 256.0F; float f1 = (float)(p_147281_1_.func_149030_m() * 360) / 256.0F; EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.func_75616_a(p_147281_1_.func_149025_e(), this.field_147299_f.field_71441_e); @@ -37,10 +37,10 @@ + net.minecraftforge.fml.common.FMLLog.info("Server attempted to spawn an unknown entity using ID: {0} at ({1}, {2}, {3}) Skipping!", p_147281_1_.func_149025_e(), d0, d1, d2); + return; + } - entitylivingbase.field_70118_ct = p_147281_1_.func_149023_f(); - entitylivingbase.field_70117_cu = p_147281_1_.func_149034_g(); - entitylivingbase.field_70116_cv = p_147281_1_.func_149029_h(); -@@ -1133,6 +1140,10 @@ + EntityTracker.func_187254_a(entitylivingbase, d0, d1, d2); + entitylivingbase.field_70761_aq = entitylivingbase.field_70759_as = (float)(p_147281_1_.func_149032_n() * 360) / 256.0F; + Entity[] aentity = entitylivingbase.func_70021_al(); +@@ -1179,6 +1186,10 @@ { tileentity.func_145839_a(p_147273_1_.func_148857_g()); } @@ -48,15 +48,15 @@ + { + tileentity.onDataPacket(field_147302_e, p_147273_1_); + } - } - } -@@ -1341,7 +1352,7 @@ + if (flag && this.field_147299_f.field_71462_r instanceof GuiCommandBlock) + { +@@ -1378,7 +1389,7 @@ if (entity instanceof EntityLivingBase) { -- PotionEffect potioneffect = new PotionEffect(p_147260_1_.func_149427_e(), p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), false, p_147260_1_.func_179707_f()); -+ PotionEffect potioneffect = new PotionEffect(p_147260_1_.func_149427_e() & 0xff, p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), false, p_147260_1_.func_179707_f()); - potioneffect.func_100012_b(p_147260_1_.func_149429_c()); - ((EntityLivingBase)entity).func_70690_d(potioneffect); - } +- Potion potion = Potion.func_188412_a(p_147260_1_.func_149427_e()); ++ Potion potion = Potion.func_188412_a(p_147260_1_.func_149427_e() & 0xFF); + + if (potion != null) + { diff --git a/patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch b/patches/minecraft/net/minecraft/client/network/ServerPinger.java.patch similarity index 59% rename from patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch rename to patches/minecraft/net/minecraft/client/network/ServerPinger.java.patch index d7aad9ec1e..0168e2cc5f 100644 --- a/patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch +++ b/patches/minecraft/net/minecraft/client/network/ServerPinger.java.patch @@ -1,10 +1,10 @@ ---- ../src-base/minecraft/net/minecraft/client/network/OldServerPinger.java -+++ ../src-work/minecraft/net/minecraft/client/network/OldServerPinger.java +--- ../src-base/minecraft/net/minecraft/client/network/ServerPinger.java ++++ ../src-work/minecraft/net/minecraft/client/network/ServerPinger.java @@ -150,6 +150,7 @@ p_147224_1_.func_147407_a((String)null); } + net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(p_147224_1_, serverstatusresponse); this.field_175092_e = Minecraft.func_71386_F(); - networkmanager.func_179290_a(new C01PacketPing(this.field_175092_e)); + networkmanager.func_179290_a(new CPacketPing(this.field_175092_e)); this.field_147403_d = true; diff --git a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch index 08e6f7261a..17332afbd5 100644 --- a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch @@ -1,31 +1,41 @@ --- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java +++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java -@@ -133,6 +133,7 @@ +@@ -3,6 +3,9 @@ + import com.google.common.collect.Lists; + import com.google.common.collect.Maps; + import com.google.common.collect.Queues; ++ ++import akka.actor.FSM.State; ++ + import java.util.ArrayDeque; + import java.util.Iterator; + import java.util.List; +@@ -143,6 +146,7 @@ public void func_78873_a(EntityFX p_78873_1_) { + if (p_78873_1_ == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs. - int i = p_78873_1_.func_70537_b(); - int j = p_78873_1_.func_174838_j() != 1.0F ? 0 : 1; + this.field_187241_h.add(p_78873_1_); + } -@@ -351,7 +352,7 @@ +@@ -376,7 +380,7 @@ public void func_180533_a(BlockPos p_180533_1_, IBlockState p_180533_2_) { -- if (p_180533_2_.func_177230_c().func_149688_o() != Material.field_151579_a) -+ if (!p_180533_2_.func_177230_c().isAir(field_78878_a, p_180533_1_) && !p_180533_2_.func_177230_c().addDestroyEffects(field_78878_a, p_180533_1_, this)) +- if (p_180533_2_.func_185904_a() != Material.field_151579_a) ++ if (p_180533_2_.func_177230_c().isAir(p_180533_2_, field_78878_a, p_180533_1_) && !p_180533_2_.func_177230_c().addDestroyEffects(field_78878_a, p_180533_1_, this)) { - p_180533_2_ = p_180533_2_.func_177230_c().func_176221_a(p_180533_2_, this.field_78878_a, p_180533_1_); + p_180533_2_ = p_180533_2_.func_185899_b(this.field_78878_a, p_180533_1_); int i = 4; -@@ -457,4 +458,13 @@ +@@ -460,4 +464,13 @@ return "" + i; } + -+ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.MovingObjectPosition target) ++ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.math.RayTraceResult target) + { -+ Block block = field_78878_a.func_180495_p(pos).func_177230_c(); -+ if (block != null && !block.addHitEffects(field_78878_a, target, this)) ++ IBlockState state = field_78878_a.func_180495_p(pos); ++ if (state != null && !state.func_177230_c().addHitEffects(state, field_78878_a, target, this)) + { + func_180532_a(pos, target.field_178784_b); + } diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch deleted file mode 100644 index 39f2cb1698..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java -@@ -533,8 +533,19 @@ - @SideOnly(Side.CLIENT) - public static enum EnumNeighborInfo - { -- DOWN(new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.5F, false, new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0]), -- UP(new EnumFacing[]{EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH}, 1.0F, false, new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0]), -+ // -- Forge Patch to Fix Top/Bottom Lighting Interpolation -- -+ // Forge PR - https://github.com/MinecraftForge/MinecraftForge/pull/1892 -+ // Mojang Bug - https://bugs.mojang.com/browse/MC-80148 -+ DOWN( new EnumFacing[]{ EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH }, 0.5F, true, -+ new Orientation[]{ Orientation.FLIP_WEST, Orientation.SOUTH, Orientation.FLIP_WEST, Orientation.FLIP_SOUTH, Orientation.WEST, Orientation.FLIP_SOUTH, Orientation.WEST, Orientation.SOUTH }, -+ new Orientation[]{ Orientation.FLIP_WEST, Orientation.NORTH, Orientation.FLIP_WEST, Orientation.FLIP_NORTH, Orientation.WEST, Orientation.FLIP_NORTH, Orientation.WEST, Orientation.NORTH }, -+ new Orientation[]{ Orientation.FLIP_EAST, Orientation.NORTH, Orientation.FLIP_EAST, Orientation.FLIP_NORTH, Orientation.EAST, Orientation.FLIP_NORTH, Orientation.EAST, Orientation.NORTH }, -+ new Orientation[]{ Orientation.FLIP_EAST, Orientation.SOUTH, Orientation.FLIP_EAST, Orientation.FLIP_SOUTH, Orientation.EAST, Orientation.FLIP_SOUTH, Orientation.EAST, Orientation.SOUTH } ), -+ UP( new EnumFacing[]{ EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH }, 1.0F, true, -+ new Orientation[]{ Orientation.EAST, Orientation.SOUTH, Orientation.EAST, Orientation.FLIP_SOUTH, Orientation.FLIP_EAST, Orientation.FLIP_SOUTH, Orientation.FLIP_EAST, Orientation.SOUTH }, -+ new Orientation[]{ Orientation.EAST, Orientation.NORTH, Orientation.EAST, Orientation.FLIP_NORTH, Orientation.FLIP_EAST, Orientation.FLIP_NORTH, Orientation.FLIP_EAST, Orientation.NORTH }, -+ new Orientation[]{ Orientation.WEST, Orientation.NORTH, Orientation.WEST, Orientation.FLIP_NORTH, Orientation.FLIP_WEST, Orientation.FLIP_NORTH, Orientation.FLIP_WEST, Orientation.NORTH }, -+ new Orientation[]{ Orientation.WEST, Orientation.SOUTH, Orientation.WEST, Orientation.FLIP_SOUTH, Orientation.FLIP_WEST, Orientation.FLIP_SOUTH, Orientation.FLIP_WEST, Orientation.SOUTH } ), - NORTH(new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.WEST}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST}), - SOUTH(new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.DOWN, EnumFacing.UP}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST}), - WEST(new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.6F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.SOUTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.SOUTH}), diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch index af6ec831d7..6ff9d53b7f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelShapes.java +++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelShapes.java -@@ -309,5 +309,6 @@ +@@ -307,5 +307,6 @@ return new ModelResourceLocation(s + "_double_slab", s1); } }); diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch index 72ea50b40f..3b5e95d380 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch @@ -1,49 +1,31 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java +++ ../src-work/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java -@@ -24,7 +24,7 @@ - { - private BlockModelShapes field_175028_a; - private final GameSettings field_175026_b; -- private final BlockModelRenderer field_175027_c = new BlockModelRenderer(); -+ private final BlockModelRenderer field_175027_c = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(); - private final ChestRenderer field_175024_d = new ChestRenderer(); - private final BlockFluidRenderer field_175025_e = new BlockFluidRenderer(); - -@@ -48,6 +48,24 @@ - { - p_175020_1_ = block.func_176221_a(p_175020_1_, p_175020_4_, p_175020_2_); - IBakedModel ibakedmodel = this.field_175028_a.func_178125_b(p_175020_1_); -+ -+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) -+ { -+ IBlockState extendedState = block.getExtendedState(p_175020_1_, p_175020_4_, p_175020_2_); -+ for ( net.minecraft.util.EnumWorldBlockLayer layer : net.minecraft.util.EnumWorldBlockLayer.values() ) -+ { -+ if ( block.canRenderInLayer( layer ) ) -+ { -+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(layer); -+ -+ IBakedModel targetLayer = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); -+ IBakedModel damageModel = (new SimpleBakedModel.Builder(targetLayer, p_175020_3_)).func_177645_b(); -+ this.field_175027_c.func_178259_a(p_175020_4_, damageModel, p_175020_1_, p_175020_2_, Tessellator.func_178181_a().func_178180_c()); -+ } -+ } -+ return; -+ } -+ - IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, p_175020_3_)).func_177645_b(); - this.field_175027_c.func_178259_a(p_175020_4_, ibakedmodel1, p_175020_1_, p_175020_2_, Tessellator.func_178181_a().func_178180_c()); - } -@@ -128,6 +146,12 @@ - ibakedmodel = ((WeightedBakedModel)ibakedmodel).func_177564_a(MathHelper.func_180186_a(p_175022_3_)); - } - -+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) -+ { -+ IBlockState extendedState = block.getExtendedState(p_175022_1_, p_175022_2_, p_175022_3_); -+ ibakedmodel = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); -+ } -+ - return ibakedmodel; +@@ -29,7 +29,7 @@ + public BlockRendererDispatcher(BlockModelShapes p_i46577_1_, BlockColors p_i46577_2_) + { + this.field_175028_a = p_i46577_1_; +- this.field_175027_c = new BlockModelRenderer(p_i46577_2_); ++ this.field_175027_c = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(p_i46577_2_); + this.field_175025_e = new BlockFluidRenderer(p_i46577_2_); } +@@ -44,7 +44,7 @@ + { + p_175020_1_ = p_175020_1_.func_185899_b(p_175020_4_, p_175020_2_); + IBakedModel ibakedmodel = this.field_175028_a.func_178125_b(p_175020_1_); +- IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(p_175020_1_, ibakedmodel, p_175020_3_, p_175020_2_)).func_177645_b(); ++ IBakedModel ibakedmodel1 = net.minecraftforge.client.ForgeHooksClient.getDamageModel(ibakedmodel, p_175020_3_, p_175020_1_, p_175020_4_, p_175020_2_); + this.field_175027_c.func_178267_a(p_175020_4_, ibakedmodel1, p_175020_1_, p_175020_2_, Tessellator.func_178181_a().func_178180_c(), true); + } + } +@@ -76,7 +76,9 @@ + switch (enumblockrendertype) + { + case MODEL: +- return this.field_175027_c.func_178267_a(p_175018_3_, this.func_184389_a(p_175018_1_), p_175018_1_, p_175018_2_, p_175018_4_, true); ++ IBakedModel model = this.func_184389_a(p_175018_1_); ++ p_175018_1_ = p_175018_1_.func_177230_c().getExtendedState(p_175018_1_, p_175018_3_, p_175018_2_); ++ return this.field_175027_c.func_178267_a(p_175018_3_, model, p_175018_1_, p_175018_2_, p_175018_4_, true); + case ENTITYBLOCK_ANIMATED: + return false; + case LIQUID: diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index 6bc47e6d17..6559dc9601 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java -@@ -200,6 +200,7 @@ +@@ -207,6 +207,7 @@ { this.func_175069_a(new ResourceLocation("shaders/post/invert.json")); } @@ -8,25 +8,25 @@ } } -@@ -419,7 +420,7 @@ +@@ -398,7 +399,7 @@ if (d3 < d2 || d2 == 0.0D) { -- if (entity1 == entity.field_70154_o) -+ if (entity1 == entity.field_70154_o && !entity.canRiderInteract()) +- if (entity1.func_184208_bv() == entity.func_184208_bv()) ++ if (entity1.func_184208_bv() == entity.func_184208_bv() && !entity.canRiderInteract()) { if (d2 == 0.0D) { -@@ -512,7 +513,7 @@ +@@ -491,7 +492,7 @@ f = f * 60.0F / 70.0F; } - return f; -+ return net.minecraftforge.client.ForgeHooksClient.getFOVModifier(this, entity, block, p_78481_1_, f); ++ return net.minecraftforge.client.ForgeHooksClient.getFOVModifier(this, entity, iblockstate, p_78481_1_, f); } } -@@ -576,14 +577,8 @@ +@@ -555,14 +556,8 @@ { BlockPos blockpos = new BlockPos(entity); IBlockState iblockstate = this.field_78531_r.field_71441_e.func_180495_p(blockpos); @@ -35,14 +35,14 @@ - if (block == Blocks.field_150324_C) - { -- int j = ((EnumFacing)iblockstate.func_177229_b(BlockBed.field_176387_N)).func_176736_b(); +- int j = ((EnumFacing)iblockstate.func_177229_b(BlockBed.field_185512_D)).func_176736_b(); - GlStateManager.func_179114_b((float)(j * 90), 0.0F, 1.0F, 0.0F); - } - GlStateManager.func_179114_b(entity.field_70126_B + (entity.field_70177_z - entity.field_70126_B) * p_78467_1_ + 180.0F, 0.0F, -1.0F, 0.0F); GlStateManager.func_179114_b(entity.field_70127_C + (entity.field_70125_A - entity.field_70127_C) * p_78467_1_, -1.0F, 0.0F, 0.0F); } -@@ -650,17 +645,20 @@ +@@ -629,17 +624,20 @@ if (!this.field_78531_r.field_71474_y.field_74325_U) { @@ -61,8 +61,8 @@ - { - GlStateManager.func_179114_b(entity.field_70126_B + (entity.field_70177_z - entity.field_70126_B) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); - } -+ Block block = ActiveRenderInfo.func_180786_a(this.field_78531_r.field_71441_e, entity, p_78467_1_); -+ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, block, p_78467_1_, yaw, pitch, roll); ++ IBlockState state = ActiveRenderInfo.func_186703_a(this.field_78531_r.field_71441_e, entity, p_78467_1_); ++ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, state, p_78467_1_, yaw, pitch, roll); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + GlStateManager.func_179114_b(event.roll, 0.0F, 0.0F, 1.0F); + GlStateManager.func_179114_b(event.pitch, 1.0F, 0.0F, 0.0F); @@ -70,7 +70,15 @@ } GlStateManager.func_179109_b(0.0F, -f, 0.0F); -@@ -1103,7 +1101,7 @@ +@@ -757,6 +755,7 @@ + + boolean flag = this.field_78531_r.func_175606_aa() instanceof EntityLivingBase && ((EntityLivingBase)this.field_78531_r.func_175606_aa()).func_70608_bn(); + ++ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(field_78531_r.field_71438_f, p_78476_1_, p_78476_2_)) + if (this.field_78531_r.field_71474_y.field_74320_O == 0 && !flag && !this.field_78531_r.field_71474_y.field_74319_N && !this.field_78531_r.field_71442_b.func_78747_a()) + { + this.func_180436_i(); +@@ -1092,7 +1091,7 @@ try { @@ -79,7 +87,7 @@ } catch (Throwable throwable) { -@@ -1164,7 +1162,7 @@ +@@ -1187,7 +1186,7 @@ if (this.field_78531_r.field_71442_b.func_178889_l() == WorldSettings.GameType.SPECTATOR) { @@ -88,7 +96,7 @@ } else { -@@ -1314,7 +1312,9 @@ +@@ -1312,7 +1311,9 @@ GlStateManager.func_179094_E(); RenderHelper.func_74519_b(); this.field_78531_r.field_71424_I.func_76318_c("entities"); @@ -97,40 +105,34 @@ + net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); RenderHelper.func_74518_a(); this.func_175072_h(); - GlStateManager.func_179128_n(5888); -@@ -1326,6 +1326,7 @@ - EntityPlayer entityplayer = (EntityPlayer)entity; - GlStateManager.func_179118_c(); - this.field_78531_r.field_71424_I.func_76318_c("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, field_78531_r.field_71476_x, 0, entityplayer.func_70694_bm(), p_175068_2_)) - renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_175068_2_); - GlStateManager.func_179141_d(); - } -@@ -1339,6 +1340,7 @@ - EntityPlayer entityplayer1 = (EntityPlayer)entity; + } +@@ -1325,6 +1326,7 @@ + EntityPlayer entityplayer = (EntityPlayer)entity; GlStateManager.func_179118_c(); this.field_78531_r.field_71424_I.func_76318_c("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer1, field_78531_r.field_71476_x, 0, entityplayer1.func_70694_bm(), p_175068_2_)) - renderglobal.func_72731_b(entityplayer1, this.field_78531_r.field_71476_x, 0, p_175068_2_); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, field_78531_r.field_71476_x, 0, p_175068_2_)) + renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_175068_2_); GlStateManager.func_179141_d(); } -@@ -1380,6 +1382,15 @@ +@@ -1366,6 +1368,17 @@ GlStateManager.func_179103_j(7425); this.field_78531_r.field_71424_I.func_76318_c("translucent"); - renderglobal.func_174977_a(EnumWorldBlockLayer.TRANSLUCENT, (double)p_175068_2_, p_175068_1_, entity); + renderglobal.func_174977_a(BlockRenderLayer.TRANSLUCENT, (double)p_175068_2_, p_175068_1_, entity); + if (!this.field_175078_W) //Only render if render pass 0 happens as well. + { + RenderHelper.func_74519_b(); + this.field_78531_r.field_71424_I.func_76318_c("entities"); + net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); + renderglobal.func_180446_a(entity, icamera, p_175068_2_); ++ // restore blending function changed by RenderGlobal.preRenderDamagedBlocks ++ GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); + RenderHelper.func_74518_a(); + } GlStateManager.func_179103_j(7424); GlStateManager.func_179132_a(true); GlStateManager.func_179089_o(); -@@ -1392,8 +1403,12 @@ +@@ -1378,6 +1391,9 @@ this.func_180437_a(renderglobal, p_175068_2_, p_175068_1_); } @@ -139,11 +141,8 @@ + this.field_78531_r.field_71424_I.func_76318_c("hand"); -+ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(renderglobal, p_175068_2_, p_175068_1_)) if (this.field_175074_C) - { - GlStateManager.func_179086_m(256); -@@ -1505,6 +1520,13 @@ +@@ -1490,6 +1506,13 @@ protected void func_78474_d(float p_78474_1_) { @@ -157,11 +156,11 @@ float f = this.field_78531_r.field_71441_e.func_72867_j(p_78474_1_); if (f > 0.0F) -@@ -1830,6 +1852,13 @@ +@@ -1820,6 +1843,13 @@ this.field_175081_S = f7; } -+ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, block, p_78466_1_, this.field_175080_Q, this.field_175082_R, this.field_175081_S); ++ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, iblockstate, p_78466_1_, this.field_175080_Q, this.field_175082_R, this.field_175081_S); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + + this.field_175080_Q = event.red; @@ -171,22 +170,22 @@ GlStateManager.func_179082_a(this.field_175080_Q, this.field_175082_R, this.field_175081_S, 0.0F); } -@@ -1848,6 +1877,10 @@ +@@ -1830,7 +1860,9 @@ + GlStateManager.func_187432_a(0.0F, -1.0F, 0.0F); GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); - Block block = ActiveRenderInfo.func_180786_a(this.field_78531_r.field_71441_e, entity, p_78468_2_); - -+ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, block, p_78468_2_, 0.1F); -+ if (hook >= 0) -+ GlStateManager.func_179095_a(hook); + IBlockState iblockstate = ActiveRenderInfo.func_186703_a(this.field_78531_r.field_71441_e, entity, p_78468_2_); +- ++ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, iblockstate, p_78468_2_, 0.1F); ++ if (hook >= 0) GlStateManager.func_179095_a(hook); + else - if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_70644_a(Potion.field_76440_q)) + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_70644_a(MobEffects.field_76440_q)) { float f1 = 5.0F; -@@ -1925,6 +1958,7 @@ +@@ -1915,6 +1947,7 @@ GlStateManager.func_179102_b(f * 0.05F); GlStateManager.func_179153_c(Math.min(f, 192.0F) * 0.5F); } -+ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, block, p_78468_2_, p_78468_1_, f); ++ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, iblockstate, p_78468_2_, p_78468_1_, f); } GlStateManager.func_179142_g(); diff --git a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch index 8bdca504f1..faade1145e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch @@ -1,28 +1,28 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java -@@ -27,7 +27,12 @@ +@@ -28,7 +28,12 @@ protected void func_175378_g() { - if (!this.field_146297_k.field_71439_g.func_70651_bq().isEmpty()) + boolean hasVisibleEffect = false; + for(PotionEffect potioneffect : this.field_146297_k.field_71439_g.func_70651_bq()) { -+ Potion potion = Potion.field_76425_a[potioneffect.func_76456_a()]; ++ Potion potion = potioneffect.func_188419_a(); + if(potion.shouldRender(potioneffect)) { hasVisibleEffect = true; break; } + } + if (!this.field_146297_k.field_71439_g.func_70651_bq().isEmpty() && hasVisibleEffect) { this.field_147003_i = 160 + (this.field_146294_l - this.field_146999_f - 200) / 2; this.field_147045_u = true; -@@ -70,6 +75,7 @@ - for (PotionEffect potioneffect : this.field_146297_k.field_71439_g.func_70651_bq()) +@@ -71,6 +76,7 @@ + for (PotionEffect potioneffect : Ordering.natural().sortedCopy(collection)) { - Potion potion = Potion.field_76425_a[potioneffect.func_76456_a()]; + Potion potion = potioneffect.func_188419_a(); + if(!potion.shouldRender(potioneffect)) continue; GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); this.field_146297_k.func_110434_K().func_110577_a(field_147001_a); this.func_73729_b(i, j, 0, 166, 140, 32); -@@ -80,6 +86,8 @@ +@@ -81,6 +87,8 @@ this.func_73729_b(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18); } diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch index 09c4a98789..1b7646b17e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch @@ -1,14 +1,13 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/ItemModelMesher.java +++ ../src-work/minecraft/net/minecraft/client/renderer/ItemModelMesher.java -@@ -50,6 +50,11 @@ - } - } +@@ -32,7 +32,9 @@ -+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartItemModel) -+ { -+ ibakedmodel = ((net.minecraftforge.client.model.ISmartItemModel)ibakedmodel).handleItemState(p_178089_1_); -+ } -+ - if (ibakedmodel == null) - { - ibakedmodel = this.field_178090_d.func_174951_a(); + public TextureAtlasSprite func_178087_a(Item p_178087_1_, int p_178087_2_) + { +- return this.func_178089_a(new ItemStack(p_178087_1_, 1, p_178087_2_)).func_177554_e(); ++ ItemStack stack = new ItemStack(p_178087_1_, 1, p_178087_2_); ++ IBakedModel model = this.func_178089_a(stack); ++ return model.func_188617_f().handleItemState(model, stack, null, null).func_177554_e(); + } + + public IBakedModel func_178089_a(ItemStack p_178089_1_) diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index 9e4e3ebcd7..0bbb0a806c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java -@@ -313,7 +313,7 @@ - - if (this.field_78453_b != null) - { -- if (this.field_78453_b.func_77973_b() == Items.field_151098_aY) -+ if (this.field_78453_b.func_77973_b() instanceof net.minecraft.item.ItemMap) - { - this.func_178097_a(abstractclientplayer, f2, f, f1); +@@ -360,7 +360,7 @@ + this.func_187456_a(p_187457_7_, p_187457_5_, enumhandside); } -@@ -365,6 +365,7 @@ + } +- else if (p_187457_6_.func_77973_b() == Items.field_151098_aY) ++ else if (p_187457_6_.func_77973_b() instanceof net.minecraft.item.ItemMap) + { + if (flag && this.field_187468_e == null) + { +@@ -444,6 +444,7 @@ if (this.field_78455_a.field_71439_g.func_70094_T()) { IBlockState iblockstate = this.field_78455_a.field_71441_e.func_180495_p(new BlockPos(this.field_78455_a.field_71439_g)); @@ -17,7 +17,7 @@ EntityPlayer entityplayer = this.field_78455_a.field_71439_g; for (int i = 0; i < 8; ++i) -@@ -378,11 +379,13 @@ +@@ -457,11 +458,13 @@ if (iblockstate1.func_177230_c().func_176214_u()) { iblockstate = iblockstate1; @@ -25,13 +25,13 @@ } } - if (iblockstate.func_177230_c().func_149645_b() != -1) + if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE) { + if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(field_78455_a.field_71439_g, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, overlayPos)) this.func_178108_a(p_78447_1_, this.field_78455_a.func_175602_ab().func_175023_a().func_178122_a(iblockstate)); } } -@@ -391,11 +394,13 @@ +@@ -470,11 +473,13 @@ { if (this.field_78455_a.field_71439_g.func_70055_a(Material.field_151586_h)) { @@ -45,16 +45,14 @@ this.func_78442_d(p_78447_1_); } } -@@ -512,6 +517,12 @@ +@@ -596,8 +601,8 @@ + else { - if (!this.field_78453_b.func_179549_c(itemstack)) - { -+ if (!this.field_78453_b.func_77973_b().shouldCauseReequipAnimation(this.field_78453_b, itemstack, field_78450_g != entityplayer.field_71071_by.field_70461_c)) -+ { -+ this.field_78453_b = itemstack; -+ this.field_78450_g = entityplayer.field_71071_by.field_70461_c; -+ return; -+ } - flag = true; - } + float f = entityplayersp.func_184825_o(1.0F); +- this.field_187469_f += MathHelper.func_76131_a((Objects.equal(this.field_187467_d, itemstack) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); +- this.field_187471_h += MathHelper.func_76131_a((float)(Objects.equal(this.field_187468_e, itemstack1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); ++ this.field_187469_f += MathHelper.func_76131_a((net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187467_d, itemstack, entityplayersp.field_71071_by.field_70461_c) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); ++ this.field_187471_h += MathHelper.func_76131_a((float)(net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187468_e, itemstack1, -1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); } + + if (this.field_187469_f < 0.1F) diff --git a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch index 98273ca48e..41709861e3 100644 --- a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java +++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java -@@ -83,6 +83,10 @@ +@@ -92,6 +92,10 @@ public static int field_176089_P; public static int field_148826_e; @@ -11,7 +11,7 @@ public static void func_77474_a() { ContextCapabilities contextcapabilities = GLContext.getCapabilities(); -@@ -843,6 +847,12 @@ +@@ -852,6 +856,12 @@ { GL13.glMultiTexCoord2f(p_77475_0_, p_77475_1_, p_77475_2_); } diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch index cee9639e68..b71bd566dd 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/RenderGlobal.java +++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java -@@ -525,8 +525,10 @@ +@@ -547,8 +547,10 @@ public void func_180446_a(Entity p_180446_1_, ICamera p_180446_2_, float p_180446_3_) { @@ -11,7 +11,7 @@ --this.field_72740_G; } else -@@ -537,9 +539,12 @@ +@@ -559,9 +561,12 @@ this.field_72769_h.field_72984_F.func_76320_a("prepare"); TileEntityRendererDispatcher.field_147556_a.func_178470_a(this.field_72769_h, this.field_72777_q.func_110434_K(), this.field_72777_q.field_71466_p, this.field_72777_q.func_175606_aa(), p_180446_3_); this.field_175010_j.func_180597_a(this.field_72769_h, this.field_72777_q.field_71466_p, this.field_72777_q.func_175606_aa(), this.field_72777_q.field_147125_j, this.field_72777_q.field_71474_y, p_180446_3_); @@ -24,7 +24,7 @@ Entity entity = this.field_72777_q.func_175606_aa(); double d3 = entity.field_70142_S + (entity.field_70165_t - entity.field_70142_S) * (double)p_180446_3_; double d4 = entity.field_70137_T + (entity.field_70163_u - entity.field_70137_T) * (double)p_180446_3_; -@@ -551,11 +556,15 @@ +@@ -573,11 +578,15 @@ this.field_72777_q.field_71460_t.func_180436_i(); this.field_72769_h.field_72984_F.func_76318_c("global"); List list = this.field_72769_h.func_72910_y(); @@ -40,39 +40,31 @@ ++this.field_72749_I; if (entity1.func_145770_h(d0, d1, d2)) -@@ -577,6 +586,7 @@ - for (int j = 0; j < list.size(); ++j) +@@ -599,6 +608,7 @@ { - Entity entity3 = (Entity)list.get(j); -+ if (!entity3.shouldRenderInPass(pass)) continue; - boolean flag = this.field_72777_q.func_175606_aa() instanceof EntityLivingBase && ((EntityLivingBase)this.field_72777_q.func_175606_aa()).func_70608_bn(); - boolean flag1 = entity3.func_145770_h(d0, d1, d2) && (entity3.field_70158_ak || p_180446_2_.func_78546_a(entity3.func_174813_aQ()) || entity3.field_70153_n == this.field_72777_q.field_71439_g) && entity3 instanceof EntityPlayer; + for (Entity entity2 : classinheritancemultimap) + { ++ if(!entity2.shouldRenderInPass(pass)) continue; + boolean flag = this.field_175010_j.func_178635_a(entity2, p_180446_2_, d0, d1, d2) || entity2.func_184215_y(this.field_72777_q.field_71439_g); -@@ -626,6 +636,7 @@ - } - - entity2 = (Entity)iterator.next(); -+ if (!entity2.shouldRenderInPass(pass)) continue; - flag2 = this.field_175010_j.func_178635_a(entity2, p_180446_2_, d0, d1, d2) || entity2.field_70153_n == this.field_72777_q.field_71439_g; - - if (!flag2) -@@ -654,6 +665,7 @@ + if (flag) +@@ -672,6 +682,7 @@ this.field_72769_h.field_72984_F.func_76318_c("blockentities"); RenderHelper.func_74519_b(); + TileEntityRendererDispatcher.field_147556_a.preDrawBatch(); for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 : this.field_72755_R) { - List list1 = renderglobal$containerlocalrenderinformation1.field_178036_a.func_178571_g().func_178485_b(); -@@ -662,6 +674,7 @@ + List list3 = renderglobal$containerlocalrenderinformation1.field_178036_a.func_178571_g().func_178485_b(); +@@ -680,6 +691,7 @@ { - for (TileEntity tileentity2 : list1) + for (TileEntity tileentity2 : list3) { + if (!tileentity2.shouldRenderInPass(pass) || !p_180446_2_.func_78546_a(tileentity2.getRenderBoundingBox())) continue; TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity2, p_180446_3_, -1); } } -@@ -671,9 +684,11 @@ +@@ -689,9 +701,11 @@ { for (TileEntity tileentity : this.field_181024_n) { @@ -84,7 +76,7 @@ this.func_180443_s(); -@@ -700,7 +715,7 @@ +@@ -718,7 +732,7 @@ Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c(); @@ -93,7 +85,7 @@ { TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity1, p_180446_3_, destroyblockprogress.func_73106_e()); } -@@ -1161,6 +1176,12 @@ +@@ -1210,6 +1224,13 @@ public void func_174976_a(float p_174976_1_, int p_174976_2_) { @@ -103,10 +95,11 @@ + renderer.render(p_174976_1_, field_72769_h, field_72777_q); + return; + } - if (this.field_72777_q.field_71441_e.field_73011_w.func_177502_q() == 1) ++ + if (this.field_72777_q.field_71441_e.field_73011_w.func_186058_p().func_186068_a() == 1) { this.func_180448_r(); -@@ -1378,6 +1399,12 @@ +@@ -1427,6 +1448,12 @@ public void func_180447_b(float p_180447_1_, int p_180447_2_) { @@ -119,7 +112,7 @@ if (this.field_72777_q.field_71441_e.field_73011_w.func_76569_d()) { if (this.field_72777_q.field_71474_y.func_181147_e() == 2) -@@ -1793,8 +1820,11 @@ +@@ -1854,8 +1881,11 @@ double d4 = (double)blockpos.func_177956_o() - d1; double d5 = (double)blockpos.func_177952_p() - d2; Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c(); @@ -132,21 +125,3 @@ { if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) { -@@ -1949,13 +1979,16 @@ - if (p_174961_1_ != null) - { - ItemRecord itemrecord = ItemRecord.func_150926_b(p_174961_1_); -+ ResourceLocation resource = null; - - if (itemrecord != null) - { - this.field_72777_q.field_71456_v.func_73833_a(itemrecord.func_150927_i()); -+ resource = itemrecord.getRecordResource(p_174961_1_); - } - -- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.func_147675_a(new ResourceLocation(p_174961_1_), (float)p_174961_2_.func_177958_n(), (float)p_174961_2_.func_177956_o(), (float)p_174961_2_.func_177952_p()); -+ if (resource == null) resource = new ResourceLocation(p_174961_1_); -+ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.func_147675_a(resource, (float)p_174961_2_.func_177958_n(), (float)p_174961_2_.func_177956_o(), (float)p_174961_2_.func_177952_p()); - this.field_147593_P.put(p_174961_2_, positionedsoundrecord); - this.field_72777_q.func_147118_V().func_147682_a(positionedsoundrecord); - } diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderItem.java.patch new file mode 100644 index 0000000000..fefb800f5e --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/RenderItem.java.patch @@ -0,0 +1,97 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/RenderItem.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/RenderItem.java +@@ -71,7 +71,7 @@ + public RenderItem(TextureManager p_i46552_1_, ModelManager p_i46552_2_, ItemColors p_i46552_3_) + { + this.field_175057_n = p_i46552_1_; +- this.field_175059_m = new ItemModelMesher(p_i46552_2_); ++ this.field_175059_m = new net.minecraftforge.client.ItemModelMesherForge(p_i46552_2_); + this.func_175041_b(); + this.field_184395_f = p_i46552_3_; + } +@@ -223,7 +223,7 @@ + k = k | -16777216; + } + +- this.func_175033_a(p_175032_1_, bakedquad, k); ++ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(p_175032_1_, bakedquad, k); + } + } + +@@ -245,17 +245,7 @@ + public IBakedModel func_184393_a(ItemStack p_184393_1_, World p_184393_2_, EntityLivingBase p_184393_3_) + { + IBakedModel ibakedmodel = this.field_175059_m.func_178089_a(p_184393_1_); +- Item item = p_184393_1_.func_77973_b(); +- +- if (item != null && item.func_185040_i()) +- { +- ResourceLocation resourcelocation = ibakedmodel.func_188617_f().func_188021_a(p_184393_1_, p_184393_2_, p_184393_3_); +- return resourcelocation == null ? ibakedmodel : this.field_175059_m.func_178083_a().func_174953_a(new ModelResourceLocation(resourcelocation, "inventory")); +- } +- else +- { +- return ibakedmodel; +- } ++ return ibakedmodel.func_188617_f().handleItemState(ibakedmodel, p_184393_1_, p_184393_2_, p_184393_3_); + } + + public void func_184392_a(ItemStack p_184392_1_, EntityLivingBase p_184392_2_, ItemCameraTransforms.TransformType p_184392_3_, boolean p_184392_4_) +@@ -279,14 +269,9 @@ + GlStateManager.func_179147_l(); + GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.func_179094_E(); +- ItemCameraTransforms itemcameratransforms = p_184394_2_.func_177552_f(); +- ItemCameraTransforms.func_188034_a(itemcameratransforms.func_181688_b(p_184394_3_), p_184394_4_); ++ // TODO: check if negative scale is a thing ++ p_184394_2_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_184394_2_, p_184394_3_, p_184394_4_); + +- if (this.func_183005_a(itemcameratransforms.func_181688_b(p_184394_3_))) +- { +- GlStateManager.func_187407_a(GlStateManager.CullFace.FRONT); +- } +- + this.func_180454_a(p_184394_1_, p_184394_2_); + GlStateManager.func_187407_a(GlStateManager.CullFace.BACK); + GlStateManager.func_179121_F(); +@@ -319,7 +304,7 @@ + GlStateManager.func_187401_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + this.func_180452_a(p_184390_2_, p_184390_3_, p_184390_4_.func_177556_c()); +- p_184390_4_.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GUI); ++ p_184390_4_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_184390_4_, ItemCameraTransforms.TransformType.GUI, false); + this.func_180454_a(p_184390_1_, p_184390_4_); + GlStateManager.func_179118_c(); + GlStateManager.func_179101_C(); +@@ -426,10 +411,11 @@ + GlStateManager.func_179126_j(); + } + +- if (p_180453_2_.func_77951_h()) ++ if (p_180453_2_.func_77973_b().showDurabilityBar(p_180453_2_)) + { +- int j = (int)Math.round(13.0D - (double)p_180453_2_.func_77952_i() * 13.0D / (double)p_180453_2_.func_77958_k()); +- int i = (int)Math.round(255.0D - (double)p_180453_2_.func_77952_i() * 255.0D / (double)p_180453_2_.func_77958_k()); ++ double health = p_180453_2_.func_77973_b().getDurabilityForDisplay(p_180453_2_); ++ int j = (int)Math.round(13.0D - health * 13.0D); ++ int i = (int)Math.round(255.0D - health * 255.0D); + GlStateManager.func_179140_f(); + GlStateManager.func_179097_i(); + GlStateManager.func_179090_x(); +@@ -440,7 +426,7 @@ + this.func_181565_a(vertexbuffer, p_180453_3_ + 2, p_180453_4_ + 13, 13, 2, 0, 0, 0, 255); + this.func_181565_a(vertexbuffer, p_180453_3_ + 2, p_180453_4_ + 13, 12, 1, (255 - i) / 4, 64, 0, 255); + this.func_181565_a(vertexbuffer, p_180453_3_ + 2, p_180453_4_ + 13, j, 1, 255 - i, i, 0, 255); +- GlStateManager.func_179147_l(); ++ //GlStateManager.enableBlend(); // Forge: Disable Blend because it screws with a lot of things down the line. + GlStateManager.func_179141_d(); + GlStateManager.func_179098_w(); + GlStateManager.func_179145_e(); +@@ -1053,6 +1039,7 @@ + this.func_175029_a(Blocks.field_185779_df, TileEntityStructure.Mode.LOAD.func_185110_a(), "structure_block"); + this.func_175029_a(Blocks.field_185779_df, TileEntityStructure.Mode.CORNER.func_185110_a(), "structure_block"); + this.func_175029_a(Blocks.field_185779_df, TileEntityStructure.Mode.DATA.func_185110_a(), "structure_block"); ++ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.field_175059_m); + } + + public void func_110549_a(IResourceManager p_110549_1_) diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch similarity index 78% rename from patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch rename to patches/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch index bd74c5c478..8f240c8a4a 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch @@ -1,6 +1,6 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/WorldRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/WorldRenderer.java -@@ -506,15 +506,15 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/VertexBuffer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/VertexBuffer.java +@@ -510,15 +510,15 @@ break; case USHORT: case SHORT: @@ -22,20 +22,13 @@ } this.func_181667_k(); -@@ -578,6 +578,16 @@ +@@ -609,4 +609,9 @@ + return this.field_179018_e; } } - -+ public void checkAndGrow() -+ { -+ this.func_181670_b(field_179011_q.func_177338_f()/* / 4 * 4 */); -+ } + + public boolean isColorDisabled() + { + return field_78939_q; + } -+ - @SideOnly(Side.CLIENT) - public class State - { + } diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch index 3102b6d98f..8b9356ee98 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch @@ -1,63 +1,54 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java +++ ../src-work/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java -@@ -23,32 +23,9 @@ +@@ -28,26 +28,8 @@ + int l = vertexformatelement.func_177369_e(); + bytebuffer.position(vertexformat.func_181720_d(j)); - for (int j = 0; j < list.size(); ++j) - { -+ // moved to VertexFormatElement.preDraw - VertexFormatElement vertexformatelement = (VertexFormatElement)list.get(j); -- VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.func_177375_c(); -- int k = vertexformatelement.func_177367_b().func_177397_c(); -- int l = vertexformatelement.func_177369_e(); -- bytebuffer.position(vertexformat.func_181720_d(j)); -- - switch (vertexformatelement$enumusage) - { - case POSITION: -- GL11.glVertexPointer(vertexformatelement.func_177370_d(), k, i, bytebuffer); -- GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); +- GlStateManager.func_187427_b(vertexformatelement.func_177370_d(), k, i, bytebuffer); +- GlStateManager.func_187410_q(32884); - break; - case UV: - OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a + l); -- GL11.glTexCoordPointer(vertexformatelement.func_177370_d(), k, i, bytebuffer); -- GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); +- GlStateManager.func_187404_a(vertexformatelement.func_177370_d(), k, i, bytebuffer); +- GlStateManager.func_187410_q(32888); - OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a); - break; - case COLOR: -- GL11.glColorPointer(vertexformatelement.func_177370_d(), k, i, bytebuffer); -- GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); +- GlStateManager.func_187400_c(vertexformatelement.func_177370_d(), k, i, bytebuffer); +- GlStateManager.func_187410_q(32886); - break; - case NORMAL: -- GL11.glNormalPointer(k, i, bytebuffer); -- GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); +- GlStateManager.func_187446_a(k, i, bytebuffer); +- GlStateManager.func_187410_q(32885); - } ++ // moved to VertexFormatElement.preDraw + vertexformatelement.func_177375_c().preDraw(vertexformat, j, i, bytebuffer); } - GL11.glDrawArrays(p_181679_1_.func_178979_i(), 0, p_181679_1_.func_178989_h()); -@@ -57,26 +34,8 @@ - for (int j1 = list.size(); i1 < j1; ++i1) - { - VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1); -- VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.func_177375_c(); -- int k1 = vertexformatelement1.func_177369_e(); -- + GlStateManager.func_187439_f(p_181679_1_.func_178979_i(), 0, p_181679_1_.func_178989_h()); +@@ -59,23 +41,8 @@ + VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.func_177375_c(); + int k1 = vertexformatelement1.func_177369_e(); + - switch (vertexformatelement$enumusage1) - { - case POSITION: -- GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); +- GlStateManager.func_187429_p(32884); - break; - case UV: - OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a + k1); -- GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); +- GlStateManager.func_187429_p(32888); - OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a); - break; - case COLOR: -- GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); +- GlStateManager.func_187429_p(32886); - GlStateManager.func_179117_G(); - break; - case NORMAL: -- GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); +- GlStateManager.func_187429_p(32885); - } + // moved to VertexFormatElement.postDraw + vertexformatelement1.func_177375_c().postDraw(vertexformat, i1, i, bytebuffer); diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch index 656fce0dfc..8a1013f885 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch @@ -1,13 +1,47 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java -@@ -5,8 +5,9 @@ +@@ -6,15 +6,25 @@ import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class BakedQuad +public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer { -+ @Override public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) { net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); } protected final int[] field_178215_a; protected final int field_178213_b; protected final EnumFacing field_178214_c; + protected final TextureAtlasSprite field_187509_d; + ++ /** ++ * @deprecated Use constructor with the format argument. ++ */ ++ @Deprecated + public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_) + { ++ this(p_i46574_1_, p_i46574_2_, p_i46574_3_, p_i46574_4_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); ++ } ++ ++ public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_, net.minecraft.client.renderer.vertex.VertexFormat format) ++ { ++ this.format = format; + this.field_178215_a = p_i46574_1_; + this.field_178213_b = p_i46574_2_; + this.field_178214_c = p_i46574_3_; +@@ -45,4 +55,17 @@ + { + return this.field_178214_c; + } ++ ++ private final net.minecraft.client.renderer.vertex.VertexFormat format; ++ ++ @Override ++ public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) ++ { ++ net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); ++ } ++ ++ public net.minecraft.client.renderer.vertex.VertexFormat getFormat() ++ { ++ return format; ++ } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch index fb28a524da..4380612607 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -1,82 +1,93 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java -@@ -20,7 +20,12 @@ +@@ -48,14 +48,20 @@ public BakedQuad func_178414_a(Vector3f p_178414_1_, Vector3f p_178414_2_, BlockPartFace p_178414_3_, TextureAtlasSprite p_178414_4_, EnumFacing p_178414_5_, ModelRotation p_178414_6_, BlockPartRotation p_178414_7_, boolean p_178414_8_, boolean p_178414_9_) { -- int[] aint = this.func_178405_a(p_178414_3_, p_178414_4_, p_178414_5_, this.func_178403_a(p_178414_1_, p_178414_2_), p_178414_6_, p_178414_7_, p_178414_8_, p_178414_9_); + return makeBakedQuad(p_178414_1_, p_178414_2_, p_178414_3_, p_178414_4_, p_178414_5_, (net.minecraftforge.client.model.ITransformation)p_178414_6_, p_178414_7_, p_178414_8_, p_178414_9_); + } + + public BakedQuad makeBakedQuad(Vector3f p_178414_1_, Vector3f p_178414_2_, BlockPartFace p_178414_3_, TextureAtlasSprite p_178414_4_, EnumFacing p_178414_5_, net.minecraftforge.client.model.ITransformation p_178414_6_, BlockPartRotation p_178414_7_, boolean p_178414_8_, boolean p_178414_9_) + { -+ int[] aint = this.makeQuadVertexData(p_178414_3_, p_178414_4_, p_178414_5_, this.func_178403_a(p_178414_1_, p_178414_2_), p_178414_6_, p_178414_7_, p_178414_8_, p_178414_9_); - EnumFacing enumfacing = func_178410_a(aint); + BlockFaceUV blockfaceuv = p_178414_3_.field_178243_e; if (p_178414_8_) -@@ -33,16 +38,22 @@ + { +- blockfaceuv = this.func_188010_a(p_178414_3_.field_178243_e, p_178414_5_, p_178414_6_); ++ // TODO fix uvlock for custom rotations ++ //blockfaceuv = this.func_188010_a(face.blockFaceUV, facing, modelRotationIn); + } + +- int[] aint = this.func_188012_a(blockfaceuv, p_178414_4_, p_178414_5_, this.func_178403_a(p_178414_1_, p_178414_2_), p_178414_6_, p_178414_7_, p_178414_9_); ++ int[] aint = this.makeQuadVertexData(blockfaceuv, p_178414_4_, p_178414_5_, this.func_178403_a(p_178414_1_, p_178414_2_), p_178414_6_, p_178414_7_, p_178414_9_); + EnumFacing enumfacing = func_178410_a(aint); + + if (p_178414_7_ == null) +@@ -63,6 +69,7 @@ this.func_178408_a(aint, enumfacing); } + net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing); - return new BakedQuad(aint, p_178414_3_.field_178245_c, enumfacing); + return new BakedQuad(aint, p_178414_3_.field_178245_c, enumfacing, p_178414_4_); } - private int[] func_178405_a(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, ModelRotation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean p_178405_8_) +@@ -73,11 +80,16 @@ + + private int[] func_188012_a(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, ModelRotation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) { -+ return func_178405_a(p_178405_1_, p_178405_2_, p_178405_3_, p_178405_4_, p_178405_5_, p_178405_6_, p_178405_7_, p_178405_8_); ++ return makeQuadVertexData(p_188012_1_, p_188012_2_, p_188012_3_, p_188012_4_, (net.minecraftforge.client.model.ITransformation)p_188012_5_, p_188012_6_, p_188012_7_); + } + -+ private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, net.minecraftforge.client.model.ITransformation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean p_178405_8_) ++ private int[] makeQuadVertexData(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, net.minecraftforge.client.model.ITransformation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) + { int[] aint = new int[28]; for (int i = 0; i < 4; ++i) { -- this.func_178402_a(aint, i, p_178405_3_, p_178405_1_, p_178405_4_, p_178405_2_, p_178405_5_, p_178405_6_, p_178405_7_, p_178405_8_); -+ this.fillVertexData(aint, i, p_178405_3_, p_178405_1_, p_178405_4_, p_178405_2_, p_178405_5_, p_178405_6_, p_178405_7_, p_178405_8_); +- this.func_188015_a(aint, i, p_188012_3_, p_188012_1_, p_188012_4_, p_188012_2_, p_188012_5_, p_188012_6_, p_188012_7_); ++ this.fillVertexData(aint, i, p_188012_3_, p_188012_1_, p_188012_4_, p_188012_2_, p_188012_5_, p_188012_6_, p_188012_7_); } return aint; -@@ -88,12 +99,17 @@ +@@ -123,12 +135,17 @@ - private void func_178402_a(int[] p_178402_1_, int p_178402_2_, EnumFacing p_178402_3_, BlockPartFace p_178402_4_, float[] p_178402_5_, TextureAtlasSprite p_178402_6_, ModelRotation p_178402_7_, BlockPartRotation p_178402_8_, boolean p_178402_9_, boolean p_178402_10_) + private void func_188015_a(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, ModelRotation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_) { -- EnumFacing enumfacing = p_178402_7_.func_177523_a(p_178402_3_); -+ func_178402_a(p_178402_1_, p_178402_2_, p_178402_3_, p_178402_4_, p_178402_5_, p_178402_6_, p_178402_7_, p_178402_8_, p_178402_9_, p_178402_10_); +- EnumFacing enumfacing = p_188015_7_.func_177523_a(p_188015_3_); ++ fillVertexData(p_188015_1_, p_188015_2_, p_188015_3_, p_188015_4_, p_188015_5_, p_188015_6_, (net.minecraftforge.client.model.ITransformation)p_188015_7_, p_188015_8_, p_188015_9_); + } + -+ private void fillVertexData(int[] p_178402_1_, int p_178402_2_, EnumFacing p_178402_3_, BlockPartFace p_178402_4_, float[] p_178402_5_, TextureAtlasSprite p_178402_6_, net.minecraftforge.client.model.ITransformation p_178402_7_, BlockPartRotation p_178402_8_, boolean p_178402_9_, boolean p_178402_10_) ++ private void fillVertexData(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, net.minecraftforge.client.model.ITransformation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_) + { -+ EnumFacing enumfacing = p_178402_7_.rotate(p_178402_3_); - int i = p_178402_10_ ? this.func_178413_a(enumfacing) : -1; - EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.func_179027_a(p_178402_3_).func_179025_a(p_178402_2_); - Vector3f vector3f = new Vector3f(p_178402_5_[enumfacedirection$vertexinformation.field_179184_a], p_178402_5_[enumfacedirection$vertexinformation.field_179182_b], p_178402_5_[enumfacedirection$vertexinformation.field_179183_c]); - this.func_178407_a(vector3f, p_178402_8_); -- int j = this.func_178415_a(vector3f, p_178402_3_, p_178402_2_, p_178402_7_, p_178402_9_); -+ int j = this.rotateVertex(vector3f, p_178402_3_, p_178402_2_, p_178402_7_, p_178402_9_); - this.func_178404_a(p_178402_1_, j, p_178402_2_, vector3f, i, p_178402_6_, p_178402_4_.field_178243_e); ++ EnumFacing enumfacing = p_188015_7_.rotate(p_188015_3_); + int i = p_188015_9_ ? this.func_178413_a(enumfacing) : -1; + EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.func_179027_a(p_188015_3_).func_179025_a(p_188015_2_); + Vector3f vector3f = new Vector3f(p_188015_5_[enumfacedirection$vertexinformation.field_179184_a], p_188015_5_[enumfacedirection$vertexinformation.field_179182_b], p_188015_5_[enumfacedirection$vertexinformation.field_179183_c]); + this.func_178407_a(vector3f, p_188015_8_); +- int j = this.func_188011_a(vector3f, p_188015_3_, p_188015_2_, p_188015_7_); ++ int j = this.rotateVertex(vector3f, p_188015_3_, p_188015_2_, p_188015_7_); + this.func_178404_a(p_188015_1_, j, p_188015_2_, vector3f, i, p_188015_6_, p_188015_4_); } -@@ -154,14 +170,19 @@ +@@ -189,14 +206,19 @@ - public int func_178415_a(Vector3f p_178415_1_, EnumFacing p_178415_2_, int p_178415_3_, ModelRotation p_178415_4_, boolean p_178415_5_) + public int func_188011_a(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, ModelRotation p_188011_4_) { -+ return func_178415_a(p_178415_1_, p_178415_2_, p_178415_3_, p_178415_4_, p_178415_5_); ++ return rotateVertex(p_188011_1_, p_188011_2_, p_188011_3_, (net.minecraftforge.client.model.ITransformation)p_188011_4_); + } + -+ public int rotateVertex(Vector3f p_178415_1_, EnumFacing p_178415_2_, int p_178415_3_, net.minecraftforge.client.model.ITransformation p_178415_4_, boolean p_178415_5_) ++ public int rotateVertex(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, net.minecraftforge.client.model.ITransformation p_188011_4_) + { - if (p_178415_4_ == ModelRotation.X0_Y0) + if (p_188011_4_ == ModelRotation.X0_Y0) { - return p_178415_3_; + return p_188011_3_; } else { -- this.func_178406_a(p_178415_1_, new Vector3f(0.5F, 0.5F, 0.5F), p_178415_4_.func_177525_a(), new Vector3f(1.0F, 1.0F, 1.0F)); -- return p_178415_4_.func_177520_a(p_178415_2_, p_178415_3_); -+ net.minecraftforge.client.ForgeHooksClient.transform(p_178415_1_, p_178415_4_.getMatrix()); -+ return p_178415_4_.rotate(p_178415_2_, p_178415_3_); +- this.func_178406_a(p_188011_1_, new Vector3f(0.5F, 0.5F, 0.5F), p_188011_4_.func_177525_a(), new Vector3f(1.0F, 1.0F, 1.0F)); +- return p_188011_4_.func_177520_a(p_188011_2_, p_188011_3_); ++ net.minecraftforge.client.ForgeHooksClient.transform(p_188011_1_, p_188011_4_.getMatrix()); ++ return p_188011_4_.rotate(p_188011_2_, p_188011_3_); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch new file mode 100644 index 0000000000..af5da1d944 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java +@@ -20,6 +20,7 @@ + + TextureAtlasSprite func_177554_e(); + ++ @Deprecated + ItemCameraTransforms func_177552_f(); + + ItemOverrideList func_188617_f(); diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch index 7d8ba1837b..91ecaba4df 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch @@ -1,18 +1,40 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java -@@ -10,7 +10,11 @@ - import net.minecraftforge.fml.relauncher.Side; +@@ -12,6 +12,9 @@ import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.util.vector.Quaternion; +/* + * @deprecated use {@link net.minecraftforge.client.model.IPerspectiveAwareModel} instead + */ @SideOnly(Side.CLIENT) -+@Deprecated public class ItemCameraTransforms { - public static final ItemCameraTransforms field_178357_a = new ItemCameraTransforms(); -@@ -117,7 +121,7 @@ +@@ -39,6 +42,7 @@ + this(ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a); + } + ++ @Deprecated + public ItemCameraTransforms(ItemCameraTransforms p_i46443_1_) + { + this.field_188036_k = p_i46443_1_.field_188036_k; +@@ -51,6 +55,7 @@ + this.field_181700_p = p_i46443_1_.field_181700_p; + } + ++ @Deprecated + public ItemCameraTransforms(ItemTransformVec3f p_i46569_1_, ItemTransformVec3f p_i46569_2_, ItemTransformVec3f p_i46569_3_, ItemTransformVec3f p_i46569_4_, ItemTransformVec3f p_i46569_5_, ItemTransformVec3f p_i46569_6_, ItemTransformVec3f p_i46569_7_, ItemTransformVec3f p_i46569_8_) + { + this.field_188036_k = p_i46569_1_; +@@ -103,6 +108,7 @@ + return new Quaternion(f3 * f6 * f8 + f4 * f5 * f7, f4 * f5 * f8 - f3 * f6 * f7, f3 * f5 * f8 + f4 * f6 * f7, f4 * f6 * f8 - f3 * f5 * f7); + } + ++ @Deprecated + public ItemTransformVec3f func_181688_b(ItemCameraTransforms.TransformType p_181688_1_) + { + switch (p_181688_1_) +@@ -169,7 +175,7 @@ } @SideOnly(Side.CLIENT) @@ -20,4 +42,4 @@ + public static enum TransformType implements net.minecraftforge.client.model.IModelPart { NONE, - THIRD_PERSON, + THIRD_PERSON_LEFT_HAND, diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch new file mode 100644 index 0000000000..6f23a6d7b4 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch @@ -0,0 +1,40 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java +@@ -1,7 +1,10 @@ + package net.minecraft.client.renderer.block.model; + + import com.google.common.collect.Lists; ++ + import java.util.List; ++ ++import net.minecraft.client.Minecraft; + import net.minecraft.entity.EntityLivingBase; + import net.minecraft.item.ItemStack; + import net.minecraft.util.ResourceLocation; +@@ -27,6 +30,7 @@ + } + } + ++ @Deprecated + public ResourceLocation func_188021_a(ItemStack p_188021_1_, World p_188021_2_, EntityLivingBase p_188021_3_) + { + if (!this.field_188023_b.isEmpty()) +@@ -42,4 +46,18 @@ + + return null; + } ++ ++ public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) ++ { ++ net.minecraft.item.Item item = stack.func_77973_b(); ++ if (item != null && item.func_185040_i()) ++ { ++ ResourceLocation location = func_188021_a(stack, world, entity); ++ if (location != null) ++ { ++ return Minecraft.func_71410_x().func_175599_af().func_175037_a().func_178083_a().func_174953_a(new ModelResourceLocation(location, "inventory")); ++ } ++ } ++ return originalModel; ++ } + } diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch similarity index 53% rename from patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch rename to patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch index 3382ee553b..58f3083416 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch @@ -1,15 +1,15 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/model/ModelBakery.java -+++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelBakery.java -@@ -114,7 +114,7 @@ - } - catch (Exception var6) - { -- field_177603_c.warn("Unable to load variant: " + modelresourcelocation.func_177518_c() + " from " + modelresourcelocation); -+ field_177603_c.warn("Unable to load variant: " + modelresourcelocation.func_177518_c() + " from " + modelresourcelocation, var6); - } - } - catch (Exception exception) -@@ -294,6 +294,7 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java +@@ -132,7 +132,7 @@ + { + if (!modelblockdefinition.func_188002_b()) + { +- field_177603_c.warn("Unable to load variant: " + modelresourcelocation.func_177518_c() + " from " + modelresourcelocation); ++ field_177603_c.warn("Unable to load variant: " + modelresourcelocation.func_177518_c() + " from " + modelresourcelocation, var12); + } + } + } +@@ -370,6 +370,7 @@ protected void func_177592_e() { @@ -17,10 +17,10 @@ this.field_177613_u.put(Item.func_150898_a(Blocks.field_150348_b), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); this.field_177613_u.put(Item.func_150898_a(Blocks.field_150346_d), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); this.field_177613_u.put(Item.func_150898_a(Blocks.field_150344_f), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); -@@ -336,6 +337,10 @@ - this.field_177613_u.put(Item.func_150898_a(Blocks.field_180390_bo), Lists.newArrayList(new String[] {"oak_fence_gate"})); +@@ -413,6 +414,10 @@ this.field_177613_u.put(Item.func_150898_a(Blocks.field_180407_aO), Lists.newArrayList(new String[] {"oak_fence"})); this.field_177613_u.put(Items.field_179570_aq, Lists.newArrayList(new String[] {"oak_door"})); + this.field_177613_u.put(Items.field_151124_az, Lists.newArrayList(new String[] {"oak_boat"})); + for (Entry, Set> e : customVariantNames.entrySet()) + { + this.field_177613_u.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator())); @@ -28,7 +28,7 @@ } protected List func_177596_a(Item p_177596_1_) -@@ -352,7 +357,7 @@ +@@ -429,7 +434,7 @@ protected ResourceLocation func_177583_a(String p_177583_1_) { @@ -37,16 +37,16 @@ return new ResourceLocation(resourcelocation.func_110624_b(), "item/" + resourcelocation.func_110623_a()); } -@@ -395,7 +400,7 @@ +@@ -536,7 +541,7 @@ for (Entry entry : this.field_177615_s.entrySet()) { ResourceLocation resourcelocation = (ResourceLocation)entry.getValue(); -- ModelResourceLocation modelresourcelocation1 = new ModelResourceLocation((String)entry.getKey(), "inventory"); -+ ModelResourceLocation modelresourcelocation1 = net.minecraftforge.client.model.ModelLoader.getInventoryVariant(entry.getKey()); - ModelBlock modelblock1 = (ModelBlock)this.field_177611_h.get(resourcelocation); +- ModelResourceLocation modelresourcelocation = new ModelResourceLocation((String)entry.getKey(), "inventory"); ++ ModelResourceLocation modelresourcelocation = net.minecraftforge.client.model.ModelLoader.getInventoryVariant(entry.getKey()); + ModelBlock modelblock = (ModelBlock)this.field_177611_h.get(resourcelocation); - if (modelblock1 != null && modelblock1.func_178303_d()) -@@ -453,6 +458,11 @@ + if (modelblock != null && modelblock.func_178303_d()) +@@ -623,6 +628,11 @@ private IBakedModel func_177578_a(ModelBlock p_177578_1_, ModelRotation p_177578_2_, boolean p_177578_3_) { @@ -56,26 +56,26 @@ + protected IBakedModel bakeModel(ModelBlock p_177578_1_, net.minecraftforge.client.model.ITransformation p_177578_2_, boolean p_177578_3_) + { TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c("particle"))); - SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(p_177578_1_)).func_177646_a(textureatlassprite); + SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(p_177578_1_, p_177578_1_.func_187967_g())).func_177646_a(textureatlassprite); -@@ -463,13 +473,13 @@ - BlockPartFace blockpartface = (BlockPartFace)blockpart.field_178240_c.get(enumfacing); - TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c(blockpartface.field_178242_d))); +@@ -639,13 +649,13 @@ + BlockPartFace blockpartface = (BlockPartFace)blockpart.field_178240_c.get(enumfacing); + TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c(blockpartface.field_178242_d))); -- if (blockpartface.field_178244_b == null) -+ if (blockpartface.field_178244_b == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(p_177578_2_.getMatrix())) - { -- simplebakedmodel$builder.func_177648_a(this.func_177589_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); -+ simplebakedmodel$builder.func_177648_a(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); - } - else - { -- simplebakedmodel$builder.func_177650_a(p_177578_2_.func_177523_a(blockpartface.field_178244_b), this.func_177589_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); -+ simplebakedmodel$builder.func_177650_a(p_177578_2_.rotate(blockpartface.field_178244_b), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); +- if (blockpartface.field_178244_b == null) ++ if (blockpartface.field_178244_b == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(p_177578_2_.getMatrix())) + { +- simplebakedmodel$builder.func_177648_a(this.func_177589_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); ++ simplebakedmodel$builder.func_177648_a(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); + } + else + { +- simplebakedmodel$builder.func_177650_a(p_177578_2_.func_177523_a(blockpartface.field_178244_b), this.func_177589_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); ++ simplebakedmodel$builder.func_177650_a(p_177578_2_.rotate(blockpartface.field_178244_b), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); + } } } - } -@@ -479,9 +489,14 @@ +@@ -656,9 +666,14 @@ private BakedQuad func_177589_a(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) { @@ -91,28 +91,14 @@ private void func_177597_h() { this.func_177574_i(); -@@ -722,4 +737,35 @@ - field_177617_q.field_178317_b = "class generation marker"; +@@ -878,4 +893,18 @@ + field_177606_o.field_178317_b = "generation marker"; field_177616_r.field_178317_b = "block entity marker"; } -+ -+ /*********************************************************** -+ * FML Start -+ ***********************************************************/ -+ private static Map, Set> customVariantNames = Maps.newHashMap(); -+ /** -+ * @deprecated use registerItemVariants -+ */ -+ @Deprecated -+ public static void addVariantName(Item item, String... names) -+ { -+ if (customVariantNames.containsKey(item.delegate)) -+ customVariantNames.get(item.delegate).addAll(Lists.newArrayList(names)); -+ else -+ customVariantNames.put(item.delegate, Sets.newHashSet(names)); -+ } + -+ public static void registerItemVariants(Item item, T... names) ++ private static Map, Set> customVariantNames = Maps.newHashMap(); ++ ++ public static void registerItemVariants(Item item, ResourceLocation... names) + { + if (!customVariantNames.containsKey(item.delegate)) + { @@ -123,7 +109,4 @@ + customVariantNames.get(item.delegate).add(name.toString()); + } + } -+ /*********************************************************** -+ * FML End -+ ***********************************************************/ } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch index 30299b2902..aef97997d9 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java -@@ -29,7 +29,7 @@ +@@ -31,7 +31,7 @@ public static ModelBlockDefinition func_178331_a(Reader p_178331_0_) { @@ -8,22 +8,4 @@ + return net.minecraftforge.client.model.BlockStateLoader.load(p_178331_0_, field_178333_a); } - public ModelBlockDefinition(Collection p_i46221_1_) -@@ -155,11 +155,17 @@ - return this.field_178437_a; - } - -+ @Deprecated - public ModelRotation func_178432_b() - { - return this.field_178435_b; - } - -+ public net.minecraftforge.client.model.IModelState getState() -+ { -+ return this.field_178435_b; -+ } -+ - public boolean func_178433_c() - { - return this.field_178436_c; + public ModelBlockDefinition(Map p_i46572_1_, Multipart p_i46572_2_) diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch new file mode 100644 index 0000000000..c64c3804fb --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java +@@ -24,9 +24,11 @@ + + public void func_110549_a(IResourceManager p_110549_1_) + { +- ModelBakery modelbakery = new ModelBakery(p_110549_1_, this.field_174956_b, this.field_174957_c); ++ // FIXME: reenable after ModelLoader is fixed ++ ModelBakery modelbakery = new ModelBakery(p_110549_1_, this.field_174956_b, this.field_174957_c); //new net.minecraftforge.client.model.ModelLoader(resourceManager, this.texMap, this.modelProvider); + this.field_174958_a = modelbakery.func_177570_a(); + this.field_174955_d = (IBakedModel)this.field_174958_a.func_82594_a(ModelBakery.field_177604_a); ++ //net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelRegistry, modelbakery); + this.field_174957_c.func_178124_c(); + } + diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch similarity index 85% rename from patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch rename to patches/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch index 893292696c..39044dd39d 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch @@ -1,5 +1,5 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/model/ModelRotation.java -+++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelRotation.java +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java @@ -10,7 +10,7 @@ import org.lwjgl.util.vector.Vector3f; diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch new file mode 100644 index 0000000000..51f084a945 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/Variant.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/Variant.java +@@ -32,11 +32,17 @@ + return this.field_188050_a; + } + ++ @Deprecated + public ModelRotation func_188048_b() + { + return this.field_188051_b; + } + ++ public net.minecraftforge.client.model.IModelState getState() ++ { ++ return this.field_188051_b; ++ } ++ + public boolean func_188049_c() + { + return this.field_188052_c; diff --git a/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch index 0358100332..c0c6918373 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch @@ -4,8 +4,8 @@ } else { -- s = ((IProperty)this.field_178142_a).func_177702_a((Comparable)map.remove(this.field_178142_a)); -+ s = String.format("%s:%s", ((ResourceLocation)Block.field_149771_c.func_177774_c(p_178132_1_.func_177230_c())).func_110624_b(), ((IProperty)this.field_178142_a).func_177702_a((Comparable)map.remove(this.field_178142_a))); +- s = this.func_187490_a(this.field_178142_a, map); ++ s = String.format("%s:%s", Block.field_149771_c.func_177774_c(p_178132_1_.func_177230_c()).func_110624_b(), this.func_187490_a(this.field_178142_a, map)); } if (this.field_178141_c != null) diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch index c7abba8326..e256ce39c0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java +++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java -@@ -131,7 +131,9 @@ +@@ -133,7 +133,9 @@ return; } @@ -11,7 +11,7 @@ p_178581_4_.func_178543_a(compiledchunk); } finally -@@ -158,7 +160,7 @@ +@@ -160,7 +162,7 @@ lvt_10_1_.func_178606_a(blockpos$mutableblockpos); } @@ -20,27 +20,27 @@ { TileEntity tileentity = iblockaccess.func_175625_s(new BlockPos(blockpos$mutableblockpos)); TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.field_147556_a.func_147547_b(tileentity); -@@ -174,7 +176,9 @@ +@@ -176,7 +178,9 @@ } } -- EnumWorldBlockLayer enumworldblocklayer1 = block.func_180664_k(); -+ for(EnumWorldBlockLayer enumworldblocklayer1 : EnumWorldBlockLayer.values()) { -+ if(!block.canRenderInLayer(enumworldblocklayer1)) continue; -+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1); - int j = enumworldblocklayer1.ordinal(); +- BlockRenderLayer blockrenderlayer1 = block.func_180664_k(); ++ for(BlockRenderLayer blockrenderlayer1 : BlockRenderLayer.values()) { ++ if(!block.canRenderInLayer(blockrenderlayer1)) continue; ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(blockrenderlayer1); + int j = blockrenderlayer1.ordinal(); - if (block.func_149645_b() != -1) -@@ -189,6 +193,7 @@ + if (block.func_176223_P().func_185901_i() != EnumBlockRenderType.INVISIBLE) +@@ -191,6 +195,7 @@ - aboolean[j] |= blockrendererdispatcher.func_175018_a(iblockstate, blockpos$mutableblockpos, iblockaccess, worldrenderer); + aboolean[j] |= blockrendererdispatcher.func_175018_a(iblockstate, blockpos$mutableblockpos, iblockaccess, vertexbuffer); } + } } - for (EnumWorldBlockLayer enumworldblocklayer : EnumWorldBlockLayer.values()) -@@ -385,6 +390,26 @@ - return this.field_178593_n; + for (BlockRenderLayer blockrenderlayer : BlockRenderLayer.values()) +@@ -413,6 +418,26 @@ + return this.field_178593_n && this.field_188284_q; } + /* ======================================== FORGE START =====================================*/ diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch index 155cd7b44c..93c9d6fd06 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java -@@ -41,7 +41,7 @@ +@@ -44,7 +44,7 @@ boolean flag = p_177077_9_.func_177556_c(); int i = this.func_177078_a(itemstack); float f = 0.25F; @@ -9,44 +9,53 @@ float f2 = p_177077_9_.func_177552_f().func_181688_b(ItemCameraTransforms.TransformType.GROUND).field_178363_d.y; GlStateManager.func_179109_b((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_); -@@ -110,7 +110,6 @@ +@@ -114,16 +114,13 @@ + GlStateManager.func_179094_E(); + IBakedModel ibakedmodel = this.field_177080_a.func_184393_a(itemstack, p_76986_1_.field_70170_p, (EntityLivingBase)null); + int j = this.func_177077_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_9_, ibakedmodel); +- float f = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.x; +- float f1 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.y; +- float f2 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.z; + boolean flag1 = ibakedmodel.func_177556_c(); - for (int j = 0; j < i; ++j) + if (!flag1) { -- if (ibakedmodel.func_177556_c()) - { - GlStateManager.func_179094_E(); +- float f3 = -0.0F * (float)(j - 1) * 0.5F * f; +- float f4 = -0.0F * (float)(j - 1) * 0.5F * f1; +- float f5 = -0.09375F * (float)(j - 1) * 0.5F * f2; ++ float f3 = -0.0F * (float)(j - 1) * 0.5F; ++ float f4 = -0.0F * (float)(j - 1) * 0.5F; ++ float f5 = -0.09375F * (float)(j - 1) * 0.5F; + GlStateManager.func_179109_b(f3, f4, f5); + } -@@ -119,25 +118,15 @@ - float f = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f1 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f2 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; -- GlStateManager.func_179109_b(f, f1, f2); -+ GlStateManager.func_179109_b(shouldSpreadItems() ? f : 0.0F, shouldSpreadItems() ? f1 : 0.0F, f2); +@@ -144,10 +141,10 @@ + float f7 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f9 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f6 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; +- GlStateManager.func_179109_b(f7, f9, f6); ++ GlStateManager.func_179109_b(shouldSpreadItems() ? f7 : 0, shouldSpreadItems() ? f9 : 0, f6); } -+ if (ibakedmodel.func_177556_c()) - GlStateManager.func_179152_a(0.5F, 0.5F, 0.5F); - ibakedmodel.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GROUND); -+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND); ++ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); this.field_177080_a.func_180454_a(itemstack, ibakedmodel); GlStateManager.func_179121_F(); } -- else -- { -- GlStateManager.func_179094_E(); +@@ -162,10 +159,10 @@ + GlStateManager.func_179109_b(f8, f10, 0.0F); + } + - ibakedmodel.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GROUND); -- this.field_177080_a.func_180454_a(itemstack, ibakedmodel); -- GlStateManager.func_179121_F(); -- float f3 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.x; -- float f4 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.y; -- float f5 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.z; -- GlStateManager.func_179109_b(0.0F * f3, 0.0F * f4, 0.046875F * f5); -- } ++ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); + this.field_177080_a.func_180454_a(itemstack, ibakedmodel); + GlStateManager.func_179121_F(); +- GlStateManager.func_179109_b(0.0F * f, 0.0F * f1, 0.09375F * f2); ++ GlStateManager.func_179109_b(0.0F, 0.0F, 0.09375F); + } } - GlStateManager.func_179121_F(); -@@ -157,4 +146,25 @@ +@@ -192,4 +189,25 @@ { return TextureMap.field_110575_b; } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch deleted file mode 100644 index 253b492fc9..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ /dev/null @@ -1,90 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java -@@ -72,7 +72,7 @@ - public RenderItem(TextureManager p_i46165_1_, ModelManager p_i46165_2_) - { - this.field_175057_n = p_i46165_1_; -- this.field_175059_m = new ItemModelMesher(p_i46165_2_); -+ this.field_175059_m = new net.minecraftforge.client.ItemModelMesherForge(p_i46165_2_); - this.func_175041_b(); - } - -@@ -226,7 +226,7 @@ - k = k | -16777216; - } - -- this.func_175033_a(p_175032_1_, bakedquad, k); -+ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(p_175032_1_, bakedquad, k); - } - } - -@@ -296,6 +296,11 @@ - modelresourcelocation = new ModelResourceLocation("bow_pulling_0", "inventory"); - } - } -+ else -+ { -+ // TODO: maybe switch to the smart player model / normal smart item model? -+ modelresourcelocation = item.getModel(p_175049_1_, entityplayer, entityplayer.func_71052_bv()); -+ } - - if (modelresourcelocation != null) - { -@@ -317,14 +322,9 @@ - GlStateManager.func_179147_l(); - GlStateManager.func_179120_a(770, 771, 1, 0); - GlStateManager.func_179094_E(); -- ItemCameraTransforms itemcameratransforms = p_175040_2_.func_177552_f(); -- itemcameratransforms.func_181689_a(p_175040_3_); -+ // TODO: check if negative scale is a thing -+ p_175040_2_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_175040_2_, p_175040_3_); - -- if (this.func_183005_a(itemcameratransforms.func_181688_b(p_175040_3_))) -- { -- GlStateManager.func_179107_e(1028); -- } -- - this.func_180454_a(p_175040_1_, p_175040_2_); - GlStateManager.func_179107_e(1029); - GlStateManager.func_179121_F(); -@@ -352,7 +352,7 @@ - GlStateManager.func_179112_b(770, 771); - GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); - this.func_180452_a(p_175042_2_, p_175042_3_, ibakedmodel.func_177556_c()); -- ibakedmodel.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GUI); -+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GUI); - this.func_180454_a(p_175042_1_, ibakedmodel); - GlStateManager.func_179118_c(); - GlStateManager.func_179101_C(); -@@ -459,10 +459,11 @@ - GlStateManager.func_179126_j(); - } - -- if (p_180453_2_.func_77951_h()) -+ if (p_180453_2_.func_77973_b().showDurabilityBar(p_180453_2_)) - { -- int j = (int)Math.round(13.0D - (double)p_180453_2_.func_77952_i() * 13.0D / (double)p_180453_2_.func_77958_k()); -- int i = (int)Math.round(255.0D - (double)p_180453_2_.func_77952_i() * 255.0D / (double)p_180453_2_.func_77958_k()); -+ double health = p_180453_2_.func_77973_b().getDurabilityForDisplay(p_180453_2_); -+ int j = (int)Math.round(13.0D - health * 13.0D); -+ int i = (int)Math.round(255.0D - health * 255.0D); - GlStateManager.func_179140_f(); - GlStateManager.func_179097_i(); - GlStateManager.func_179090_x(); -@@ -473,7 +474,7 @@ - this.func_181565_a(worldrenderer, p_180453_3_ + 2, p_180453_4_ + 13, 13, 2, 0, 0, 0, 255); - this.func_181565_a(worldrenderer, p_180453_3_ + 2, p_180453_4_ + 13, 12, 1, (255 - i) / 4, 64, 0, 255); - this.func_181565_a(worldrenderer, p_180453_3_ + 2, p_180453_4_ + 13, j, 1, 255 - i, i, 0, 255); -- GlStateManager.func_179147_l(); -+ //GlStateManager.enableBlend(); // Forge: Disable Blend because it screws with a lot of things down the line. - GlStateManager.func_179141_d(); - GlStateManager.func_179098_w(); - GlStateManager.func_179145_e(); -@@ -1038,6 +1039,7 @@ - this.func_175029_a(Blocks.field_150420_aW, BlockHugeMushroom.EnumType.ALL_INSIDE.func_176896_a(), "brown_mushroom_block"); - this.func_175029_a(Blocks.field_150419_aX, BlockHugeMushroom.EnumType.ALL_INSIDE.func_176896_a(), "red_mushroom_block"); - this.func_175031_a(Blocks.field_150380_bt, "dragon_egg"); -+ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.field_175059_m); - } - - public void func_110549_a(IResourceManager p_110549_1_) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch similarity index 58% rename from patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch rename to patches/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch index 04e75b48e1..8d2a950867 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch @@ -1,51 +1,51 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java -@@ -38,6 +38,9 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java +@@ -32,6 +32,9 @@ protected List> field_177097_h = Lists.>newArrayList(); - protected boolean field_177098_i = false; + protected boolean field_188323_j = false; + public static float NAME_TAG_RANGE = 64.0f; + public static float NAME_TAG_RANGE_SNEAK = 32.0f; + - public RendererLivingEntity(RenderManager p_i46156_1_, ModelBase p_i46156_2_, float p_i46156_3_) + public RenderLivingBase(RenderManager p_i46156_1_, ModelBase p_i46156_2_, float p_i46156_3_) { super(p_i46156_1_); -@@ -83,10 +86,12 @@ +@@ -77,10 +80,12 @@ public void func_76986_a(T p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(p_76986_1_, this, p_76986_2_, p_76986_4_, p_76986_6_))) return; ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(p_76986_1_, this, p_76986_2_, p_76986_4_, p_76986_6_))) return; GlStateManager.func_179094_E(); GlStateManager.func_179129_p(); this.field_77045_g.field_78095_p = this.func_77040_d(p_76986_1_, p_76986_9_); -- this.field_77045_g.field_78093_q = p_76986_1_.func_70115_ae(); -+ boolean shouldSit = p_76986_1_.func_70115_ae() && (p_76986_1_.field_70154_o != null && p_76986_1_.field_70154_o.shouldRiderSit()); +- this.field_77045_g.field_78093_q = p_76986_1_.func_184218_aH(); ++ boolean shouldSit = p_76986_1_.func_184218_aH() && (p_76986_1_.func_184187_bx() != null && p_76986_1_.func_184187_bx().shouldRiderSit()); + this.field_77045_g.field_78093_q = shouldSit; this.field_77045_g.field_78091_s = p_76986_1_.func_70631_g_(); try -@@ -95,7 +100,7 @@ +@@ -89,7 +94,7 @@ float f1 = this.func_77034_a(p_76986_1_.field_70758_at, p_76986_1_.field_70759_as, p_76986_9_); float f2 = f1 - f; -- if (p_76986_1_.func_70115_ae() && p_76986_1_.field_70154_o instanceof EntityLivingBase) -+ if (shouldSit && p_76986_1_.field_70154_o instanceof EntityLivingBase) +- if (p_76986_1_.func_184218_aH() && p_76986_1_.func_184187_bx() instanceof EntityLivingBase) ++ if (shouldSit && p_76986_1_.func_184187_bx() instanceof EntityLivingBase) { - EntityLivingBase entitylivingbase = (EntityLivingBase)p_76986_1_.field_70154_o; + EntityLivingBase entitylivingbase = (EntityLivingBase)p_76986_1_.func_184187_bx(); f = this.func_77034_a(entitylivingbase.field_70760_ar, entitylivingbase.field_70761_aq, p_76986_9_); -@@ -191,6 +196,7 @@ - { - super.func_76986_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(p_76986_1_, this, p_76986_2_, p_76986_4_, p_76986_6_)); +@@ -197,6 +202,7 @@ + GlStateManager.func_179089_o(); + GlStateManager.func_179121_F(); + super.func_76986_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(p_76986_1_, this, p_76986_2_, p_76986_4_, p_76986_6_)); } - protected boolean func_177088_c(T p_177088_1_) -@@ -469,10 +475,11 @@ + public float func_188322_c(T p_188322_1_, float p_188322_2_) +@@ -452,10 +458,11 @@ public void func_177067_a(T p_177067_1_, double p_177067_2_, double p_177067_4_, double p_177067_6_) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(p_177067_1_, this, p_177067_2_, p_177067_4_, p_177067_6_))) return; ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(p_177067_1_, this, p_177067_2_, p_177067_4_, p_177067_6_))) return; if (this.func_177070_b(p_177067_1_)) { double d0 = p_177067_1_.func_70068_e(this.field_76990_c.field_78734_h); @@ -54,11 +54,11 @@ if (d0 < (double)(f * f)) { -@@ -518,6 +525,7 @@ - } +@@ -464,6 +471,7 @@ + this.func_188296_a(p_177067_1_, p_177067_2_, p_177067_4_, p_177067_6_, s, d0); } } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(p_177067_1_, this, p_177067_2_, p_177067_4_, p_177067_6_)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(p_177067_1_, this, p_177067_2_, p_177067_4_, p_177067_6_)); } protected boolean func_177070_b(T p_177070_1_) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch index 267976b536..9292829e3d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -1,27 +1,28 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -@@ -192,7 +192,12 @@ +@@ -204,8 +204,13 @@ this.field_178637_m = new RenderPlayer(this); this.field_178636_l.put("default", this.field_178637_m); this.field_178636_l.put("slim", new RenderPlayer(this, true)); + net.minecraftforge.fml.client.registry.RenderingRegistry.loadEntityRenderers(this, this.field_78729_o); } -+ + + public Map getSkinMap() { + return (Map) java.util.Collections.unmodifiableMap(field_178636_l); + } - ++ public void func_178628_a(double p_178628_1_, double p_178628_3_, double p_178628_5_) { -@@ -241,9 +246,9 @@ + this.field_78725_b = p_178628_1_; +@@ -253,9 +258,9 @@ IBlockState iblockstate = p_180597_1_.func_180495_p(new BlockPos(p_180597_3_)); Block block = iblockstate.func_177230_c(); - if (block == Blocks.field_150324_C) -+ if (block.isBed(p_180597_1_, new BlockPos(p_180597_3_), (EntityLivingBase)p_180597_3_)) ++ if (block.isBed(iblockstate, p_180597_1_, new BlockPos(p_180597_3_), (EntityLivingBase)p_180597_3_)) { -- int i = ((EnumFacing)iblockstate.func_177229_b(BlockBed.field_176387_N)).func_176736_b(); -+ int i = block.getBedDirection(p_180597_1_, new BlockPos(p_180597_3_)).func_176736_b(); +- int i = ((EnumFacing)iblockstate.func_177229_b(BlockBed.field_185512_D)).func_176736_b(); ++ int i = block.getBedDirection(iblockstate, p_180597_1_, new BlockPos(p_180597_3_)).func_176736_b(); this.field_78735_i = (float)(i * 90 + 180); this.field_78732_j = 0.0F; } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch index 9843655945..f54ab04379 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -@@ -49,6 +49,7 @@ +@@ -55,6 +55,7 @@ public void func_76986_a(AbstractClientPlayer p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { @@ -8,9 +8,9 @@ if (!p_76986_1_.func_175144_cb() || this.field_76990_c.field_78734_h == p_76986_1_) { double d0 = p_76986_4_; -@@ -61,6 +62,7 @@ - this.func_177137_d(p_76986_1_); +@@ -69,6 +70,7 @@ super.func_76986_a(p_76986_1_, p_76986_2_, d0, p_76986_6_, p_76986_8_, p_76986_9_); + GlStateManager.func_187440_b(GlStateManager.Profile.PLAYER_SKIN); } + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_)); } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch index 2bbf64ef4a..7d33508e94 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch @@ -1,47 +1,46 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java -@@ -55,29 +55,28 @@ - T t = this.func_177175_a(p_177182_9_); - t.func_178686_a(this.field_177190_a.func_177087_b()); - t.func_78086_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_4_); -+ t = getArmorModelHook(p_177182_1_, itemstack, p_177182_9_, t); - this.func_177179_a(t, p_177182_9_); - boolean flag = this.func_177180_b(p_177182_9_); -- this.field_177190_a.func_110776_a(this.func_177181_a(itemarmor, flag)); -+ this.field_177190_a.func_110776_a(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, null)); +@@ -59,29 +59,27 @@ + T t = this.func_188360_a(p_188361_9_); + t.func_178686_a(this.field_177190_a.func_177087_b()); + t.func_78086_a(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_4_); ++ t = getArmorModelHook(p_188361_1_, itemstack, p_188361_9_, t); + this.func_188359_a(t, p_188361_9_); + boolean flag = this.func_188363_b(p_188361_9_); +- this.field_177190_a.func_110776_a(this.func_177181_a(itemarmor, flag)); ++ this.field_177190_a.func_110776_a(this.getArmorResource(p_188361_1_, itemstack, p_188361_9_, null)); -- switch (itemarmor.func_82812_d()) -- { -- case LEATHER: - int i = itemarmor.func_82814_b(itemstack); -+ { -+ if (i != -1) // Allow this for anything, not only cloth. +- switch (itemarmor.func_82812_d()) +- { +- case LEATHER: + int i = itemarmor.func_82814_b(itemstack); + { - float f = (float)(i >> 16 & 255) / 255.0F; - float f1 = (float)(i >> 8 & 255) / 255.0F; - float f2 = (float)(i & 255) / 255.0F; - GlStateManager.func_179131_c(this.field_177184_f * f, this.field_177185_g * f1, this.field_177192_h * f2, this.field_177187_e); - t.func_78088_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); -- this.field_177190_a.func_110776_a(this.func_177178_a(itemarmor, flag, "overlay")); -- case CHAIN: -- case IRON: -- case GOLD: -- case DIAMOND: -+ this.field_177190_a.func_110776_a(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, "overlay")); -+ } -+ { // Non-colored - GlStateManager.func_179131_c(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); - t.func_78088_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); -- default: ++ if (i != 0xFFFFFF) // Allow this for anything, not only cloth ++ { + float f = (float)(i >> 16 & 255) / 255.0F; + float f1 = (float)(i >> 8 & 255) / 255.0F; + float f2 = (float)(i & 255) / 255.0F; + GlStateManager.func_179131_c(this.field_177184_f * f, this.field_177185_g * f1, this.field_177192_h * f2, this.field_177187_e); + t.func_78088_a(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); +- this.field_177190_a.func_110776_a(this.func_177178_a(itemarmor, flag, "overlay")); +- case CHAIN: +- case IRON: +- case GOLD: +- case DIAMOND: ++ this.field_177190_a.func_110776_a(this.getArmorResource(p_188361_1_, itemstack, p_188361_9_, "overlay")); ++ } ++ { // Non-colored + GlStateManager.func_179131_c(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); + t.func_78088_a(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); +- default: - -- if (!this.field_177193_i && itemstack.func_77948_v()) -+ } -+ // Default -+ if (!this.field_177193_i && itemstack.func_77962_s()) - { - this.func_177183_a(p_177182_1_, t, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); - } -@@ -135,11 +134,13 @@ +- if (!this.field_177193_i && itemstack.func_77948_v()) ++ } // Default ++ if (!this.field_177193_i && itemstack.func_77962_s()) + { + func_188364_a(this.field_177190_a, p_188361_1_, t, p_188361_2_, p_188361_3_, p_188361_4_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); + } +@@ -140,11 +138,13 @@ GlStateManager.func_179084_k(); } @@ -55,21 +54,21 @@ private ResourceLocation func_177178_a(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) { String s = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.func_82812_d().func_179242_c(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); -@@ -157,4 +158,49 @@ +@@ -162,4 +162,49 @@ protected abstract void func_177177_a(); - protected abstract void func_177179_a(T p_177179_1_, int p_177179_2_); + protected abstract void func_188359_a(T p_188359_1_, EntityEquipmentSlot p_188359_2_); + + /*=================================== FORGE START =========================================*/ + + /** + * Hook to allow item-sensitive armor model. for LayerBipedArmor. + */ -+ protected T getArmorModelHook(EntityLivingBase entity, ItemStack itemStack, int slot, T model) ++ protected T getArmorModelHook(EntityLivingBase entity, ItemStack itemStack, EntityEquipmentSlot slot, T model) + { + return model; + } -+ ++ + /** + * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. + * @@ -79,7 +78,7 @@ + * @param type Subtype, can be null or "overlay" + * @return ResourceLocation pointing at the armor's texture + */ -+ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, int slot, String type) ++ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, EntityEquipmentSlot slot, String type) + { + ItemArmor item = (ItemArmor)stack.func_77973_b(); + String texture = item.func_82812_d().func_179242_c(); @@ -90,7 +89,7 @@ + domain = texture.substring(0, idx); + texture = texture.substring(idx + 1); + } -+ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); ++ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (func_188363_b(slot) ? 2 : 1), type == null ? "" : String.format("_%s", type)); + + s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); + ResourceLocation resourcelocation = (ResourceLocation)field_177191_j.get(s1); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch index e391d61ac7..b5b72c1951 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch @@ -1,12 +1,12 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java -@@ -49,4 +49,10 @@ +@@ -51,4 +51,10 @@ { p_177194_1_.func_178719_a(false); } + + @Override -+ protected ModelBiped getArmorModelHook(net.minecraft.entity.EntityLivingBase entity, net.minecraft.item.ItemStack itemStack, int slot, ModelBiped model) ++ protected ModelBiped getArmorModelHook(net.minecraft.entity.EntityLivingBase entity, net.minecraft.item.ItemStack itemStack, EntityEquipmentSlot slot, ModelBiped model) + { + return net.minecraftforge.client.ForgeHooksClient.getArmorModel(entity, itemStack, slot, model); + } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch index 1dbb9630a2..9f4d33cb8d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java -@@ -58,12 +58,17 @@ +@@ -56,18 +56,24 @@ { Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])this.field_94319_a.toArray(new Stitcher.Holder[this.field_94319_a.size()]); Arrays.sort((Object[])astitcher$holder); @@ -18,15 +18,14 @@ throw new StitcherException(stitcher$holder, s); } } -@@ -73,6 +78,7 @@ - this.field_94318_c = MathHelper.func_151236_b(this.field_94318_c); - this.field_94315_d = MathHelper.func_151236_b(this.field_94315_d); - } + + this.field_94318_c = MathHelper.func_151236_b(this.field_94318_c); + this.field_94315_d = MathHelper.func_151236_b(this.field_94315_d); + net.minecraftforge.fml.common.ProgressManager.pop(bar); } public List func_94309_g() -@@ -260,7 +266,7 @@ +@@ -238,7 +244,7 @@ public String toString() { diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch index 7d88952483..5ef4028b9d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java -@@ -402,4 +402,30 @@ +@@ -398,4 +398,30 @@ { return "TextureAtlasSprite{name=\'" + this.field_110984_i + '\'' + ", frameCount=" + this.field_110976_a.size() + ", rotated=" + this.field_130222_e + ", x=" + this.field_110975_c + ", y=" + this.field_110974_d + ", height=" + this.field_130224_d + ", width=" + this.field_130223_c + ", u0=" + this.field_110979_l + ", u1=" + this.field_110980_m + ", v0=" + this.field_110977_n + ", v1=" + this.field_110978_o + '}'; } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 133b68b97c..4a37adc65d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java -@@ -28,6 +28,7 @@ +@@ -26,6 +26,7 @@ @SideOnly(Side.CLIENT) public class TextureMap extends AbstractTexture implements ITickableTextureObject { @@ -8,7 +8,7 @@ private static final Logger field_147635_d = LogManager.getLogger(); public static final ResourceLocation field_174945_f = new ResourceLocation("missingno"); public static final ResourceLocation field_110575_b = new ResourceLocation("textures/atlas/blocks.png"); -@@ -38,6 +39,7 @@ +@@ -36,6 +37,7 @@ private final IIconCreator field_174946_m; private int field_147636_j; private final TextureAtlasSprite field_94249_f; @@ -16,7 +16,7 @@ public TextureMap(String p_i46099_1_) { -@@ -46,12 +48,23 @@ +@@ -44,12 +46,23 @@ public TextureMap(String p_i46100_1_, IIconCreator p_i46100_2_) { @@ -41,7 +41,7 @@ } private void func_110569_e() -@@ -90,12 +103,28 @@ +@@ -88,12 +101,26 @@ int j = Integer.MAX_VALUE; int k = 1 << this.field_147636_j; @@ -53,67 +53,52 @@ for (Entry entry : this.field_110574_e.entrySet()) { TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); - ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.func_94215_i()); - ResourceLocation resourcelocation1 = this.func_147634_a(resourcelocation, 0); -+ bar.step(resourcelocation1.func_110623_a()); + ResourceLocation resourcelocation = this.func_184396_a(textureatlassprite); ++ bar.step(resourcelocation.func_110623_a()); + IResource iresource = null; + if (textureatlassprite.hasCustomLoader(p_110571_1_, resourcelocation)) + { -+ if (!textureatlassprite.load(p_110571_1_, resourcelocation)) ++ if (textureatlassprite.load(p_110571_1_, resourcelocation)) + { -+ j = Math.min(j, Math.min(textureatlassprite.func_94211_a(), textureatlassprite.func_94216_b())); -+ stitcher.func_110934_a(textureatlassprite); ++ continue; + } -+ continue; + } -+ ++ else try { - IResource iresource = p_110571_1_.func_110536_a(resourcelocation1); -@@ -145,12 +174,14 @@ + PngSizeInfo pngsizeinfo = PngSizeInfo.func_188532_a(p_110571_1_.func_110536_a(resourcelocation)); +@@ -103,12 +130,14 @@ } catch (RuntimeException runtimeexception) { -- field_147635_d.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception); -+ //logger.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation1, runtimeexception.getMessage()); +- field_147635_d.error((String)("Unable to parse metadata from " + resourcelocation), (Throwable)runtimeexception); ++ //logger.error((String)("Unable to parse metadata from " + resourcelocation), (Throwable)runtimeexception); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation, runtimeexception.getMessage()); continue; } - catch (IOException ioexception1) + catch (IOException ioexception) { -- field_147635_d.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1); -+ //logger.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation1); +- field_147635_d.error((String)("Using missing texture, unable to load " + resourcelocation), (Throwable)ioexception); ++ //logger.error((String)("Using missing texture, unable to load " + resourcelocation), (Throwable)ioexception); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation); continue; } - -@@ -166,6 +197,7 @@ + finally +@@ -128,6 +157,7 @@ stitcher.func_110934_a(textureatlassprite); } + net.minecraftforge.fml.common.ProgressManager.pop(bar); - int j1 = Math.min(j, k); - int k1 = MathHelper.func_151239_c(j1); + int l = Math.min(j, k); + int i1 = MathHelper.func_151239_c(l); -@@ -175,8 +207,11 @@ - this.field_147636_j = k1; - } - -+ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.field_110574_e.size()); - for (final TextureAtlasSprite textureatlassprite1 : this.field_110574_e.values()) - { -+ if (skipFirst) break; -+ bar.step(textureatlassprite1.func_94215_i()); - try - { - textureatlassprite1.func_147963_d(this.field_147636_j); -@@ -213,9 +248,13 @@ +@@ -139,9 +169,12 @@ this.field_94249_f.func_147963_d(this.field_147636_j); stitcher.func_110934_a(this.field_94249_f); -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); + skipFirst = false; -+ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 3); ++ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 2); try { @@ -121,7 +106,7 @@ stitcher.func_94305_f(); } catch (StitcherException stitcherexception) -@@ -224,9 +263,11 @@ +@@ -150,11 +183,16 @@ } field_147635_d.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.func_110935_a()), Integer.valueOf(stitcher.func_110936_b()), this.field_94254_c}); @@ -129,13 +114,18 @@ TextureUtil.func_180600_a(this.func_110552_b(), this.field_147636_j, stitcher.func_110935_a(), stitcher.func_110936_b()); Map map = Maps.newHashMap(this.field_110574_e); -+ bar.step("Uploading GL texture"); - for (TextureAtlasSprite textureatlassprite2 : stitcher.func_94309_g()) ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); ++ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture mipmap and upload", stitcher.func_94309_g().size()); ++ + for (TextureAtlasSprite textureatlassprite1 : stitcher.func_94309_g()) { - String s = textureatlassprite2.func_94215_i(); -@@ -256,6 +297,13 @@ ++ bar.step(textureatlassprite1.func_94215_i()); + if (textureatlassprite1 == this.field_94249_f || this.func_184397_a(p_110571_1_, textureatlassprite1)) + { + String s = textureatlassprite1.func_94215_i(); +@@ -185,6 +223,13 @@ { - textureatlassprite3.func_94217_a(this.field_94249_f); + textureatlassprite2.func_94217_a(this.field_94249_f); } + + net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); @@ -146,8 +136,8 @@ + net.minecraftforge.fml.common.ProgressManager.pop(bar); } - private ResourceLocation func_147634_a(ResourceLocation p_147634_1_, int p_147634_2_) -@@ -319,4 +367,37 @@ + private boolean func_184397_a(IResourceManager p_184397_1_, final TextureAtlasSprite p_184397_2_) +@@ -317,4 +362,37 @@ { return this.field_94249_f; } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch index a9d758ece2..cb9c3dc8e8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java -@@ -197,9 +197,11 @@ +@@ -202,9 +202,11 @@ public static void func_180600_a(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_) { @@ -12,4 +12,4 @@ + } if (p_180600_1_ >= 0) { - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, p_180600_1_); + GlStateManager.func_187421_b(3553, 33085, p_180600_1_); diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch index d0ec3a7d9f..1cd896209d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java +++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java -@@ -99,15 +99,18 @@ +@@ -105,15 +105,18 @@ GlStateManager.func_179140_f(); int i = p_82402_1_.func_82333_j(); @@ -21,9 +21,9 @@ this.field_76990_c.field_78724_e.func_110577_a(field_110789_a); GlStateManager.func_179114_b(180.0F, 0.0F, 0.0F, 1.0F); float f = 0.0078125F; -@@ -165,6 +168,7 @@ - textureatlassprite.func_94219_l(); - } +@@ -142,6 +145,7 @@ + RenderHelper.func_74518_a(); + GlStateManager.func_179099_b(); } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch index 22634cf060..3977f21e22 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java -@@ -78,6 +78,7 @@ +@@ -98,6 +98,7 @@ { TileEntityRendererDispatcher.field_147556_a.func_147549_a(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F); } diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch index 92a84ea6bf..d1fbb80f33 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java +++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java -@@ -102,11 +102,14 @@ +@@ -106,11 +106,14 @@ { if (p_180546_1_.func_145835_a(this.field_147560_j, this.field_147561_k, this.field_147558_l) < p_180546_1_.func_145833_n()) { @@ -9,13 +9,13 @@ int i = this.field_147550_f.func_175626_b(p_180546_1_.func_174877_v(), 0); int j = i % 65536; int k = i / 65536; - OpenGlHelper.func_77475_a(OpenGlHelper.field_77476_b, (float)j / 1.0F, (float)k / 1.0F); + OpenGlHelper.func_77475_a(OpenGlHelper.field_77476_b, (float)j, (float)k); GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + } BlockPos blockpos = p_180546_1_.func_174877_v(); this.func_178469_a(p_180546_1_, (double)blockpos.func_177958_n() - field_147554_b, (double)blockpos.func_177956_o() - field_147555_c, (double)blockpos.func_177952_p() - field_147552_d, p_180546_2_, p_180546_3_); } -@@ -125,6 +128,11 @@ +@@ -129,6 +132,11 @@ { try { @@ -27,7 +27,7 @@ tileentityspecialrenderer.func_180535_a(p_178469_1_, p_178469_2_, p_178469_4_, p_178469_6_, p_178469_8_, p_178469_9_); } catch (Throwable throwable) -@@ -146,4 +154,49 @@ +@@ -155,4 +163,49 @@ { return this.field_147557_n; } diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch index 2dcbbec257..adf45bb4c5 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch @@ -5,5 +5,5 @@ return false; } + -+ public void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, net.minecraft.client.renderer.WorldRenderer worldRenderer) {} ++ public void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, net.minecraft.client.renderer.VertexBuffer buffer) {} } diff --git a/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch b/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch index fa5296e396..4d42cf3118 100644 --- a/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/resources/FallbackResourceManager.java +++ ../src-work/minecraft/net/minecraft/client/resources/FallbackResourceManager.java -@@ -67,6 +67,7 @@ +@@ -68,6 +68,7 @@ throw new FileNotFoundException(p_110536_1_.toString()); } diff --git a/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch b/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch index 4bc3d483c2..07b5cb7797 100644 --- a/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch @@ -5,6 +5,6 @@ field_135049_a.func_135022_a(p_110549_1_, list); + net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(field_135049_a.field_135032_a, this.field_135048_c); - StringTranslate.func_135063_a(field_135049_a.field_135032_a); + LanguageMap.func_135063_a(field_135049_a.field_135032_a); } diff --git a/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch b/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch deleted file mode 100644 index d792aea1bb..0000000000 --- a/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/model/IBakedModel.java -+++ ../src-work/minecraft/net/minecraft/client/resources/model/IBakedModel.java -@@ -23,5 +23,6 @@ - - TextureAtlasSprite func_177554_e(); - -+ @Deprecated - ItemCameraTransforms func_177552_f(); - } diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch deleted file mode 100644 index 9b92db76e4..0000000000 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/model/ModelManager.java -+++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelManager.java -@@ -24,9 +24,10 @@ - - public void func_110549_a(IResourceManager p_110549_1_) - { -- ModelBakery modelbakery = new ModelBakery(p_110549_1_, this.field_174956_b, this.field_174957_c); -+ ModelBakery modelbakery = new net.minecraftforge.client.model.ModelLoader(p_110549_1_, this.field_174956_b, this.field_174957_c); - this.field_174958_a = modelbakery.func_177570_a(); - this.field_174955_d = (IBakedModel)this.field_174958_a.func_82594_a(ModelBakery.field_177604_a); -+ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.field_174958_a, modelbakery); - this.field_174957_c.func_178124_c(); - } - diff --git a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch index 7d50686a06..5a85b1f679 100644 --- a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch +++ b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/settings/GameSettings.java +++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java -@@ -994,6 +994,7 @@ +@@ -887,6 +887,7 @@ public void func_74303_b() { diff --git a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch index 5c9c777d25..8bcdddcc2b 100644 --- a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch +++ b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/shader/Framebuffer.java +++ ../src-work/minecraft/net/minecraft/client/shader/Framebuffer.java -@@ -119,8 +119,17 @@ +@@ -118,8 +118,17 @@ if (this.field_147619_e) { OpenGlHelper.func_153176_h(OpenGlHelper.field_153199_f, this.field_147624_h); @@ -18,7 +18,7 @@ } this.func_147614_f(); -@@ -280,4 +289,36 @@ +@@ -279,4 +288,36 @@ GlStateManager.func_179086_m(i); this.func_147609_e(); } diff --git a/patches/minecraft/net/minecraft/command/CommandBase.java.patch b/patches/minecraft/net/minecraft/command/CommandBase.java.patch index 1cfdfa4067..49c1eaedf8 100644 --- a/patches/minecraft/net/minecraft/command/CommandBase.java.patch +++ b/patches/minecraft/net/minecraft/command/CommandBase.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/command/CommandBase.java +++ ../src-work/minecraft/net/minecraft/command/CommandBase.java -@@ -329,7 +329,7 @@ - ichatcomponent.func_150258_a(" "); +@@ -369,7 +369,7 @@ + itextcomponent.func_150258_a(" "); } -- IChatComponent ichatcomponent1 = new ChatComponentText(p_147176_1_[i]); -+ IChatComponent ichatcomponent1 = net.minecraftforge.common.ForgeHooks.newChatWithLinks(p_147176_1_[i]); // Forge: links for messages +- ITextComponent itextcomponent1 = new TextComponentString(p_147176_1_[i]); ++ ITextComponent itextcomponent1 = net.minecraftforge.common.ForgeHooks.newChatWithLinks(p_147176_1_[i]); // Forge: links for messages if (p_147176_3_) { diff --git a/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch b/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch index 361b3dc030..f3ca18c30e 100644 --- a/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch +++ b/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/command/CommandEnchant.java +++ ../src-work/minecraft/net/minecraft/command/CommandEnchant.java -@@ -93,7 +93,7 @@ +@@ -85,7 +85,7 @@ { - Enchantment enchantment2 = Enchantment.func_180306_c(l); + Enchantment enchantment1 = Enchantment.func_185262_c(k); -- if (!enchantment2.func_77326_a(enchantment1)) -+ if (!enchantment2.func_77326_a(enchantment1) || !enchantment1.func_77326_a(enchantment2)) //Forge BugFix: Let Both enchantments veto being together +- if (!enchantment.func_77326_a(enchantment1)) ++ if (!enchantment.func_77326_a(enchantment1) || !enchantment1.func_77326_a(enchantment)) //Forge BugFix: Let Both enchantments veto being together { - throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment1.func_77316_c(j), enchantment2.func_77316_c(nbttaglist.func_150305_b(k).func_74765_d("lvl"))}); + throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment.func_77316_c(i), enchantment1.func_77316_c(nbttaglist.func_150305_b(j).func_74765_d("lvl"))}); } diff --git a/patches/minecraft/net/minecraft/command/CommandFill.java.patch b/patches/minecraft/net/minecraft/command/CommandFill.java.patch index c9950fe719..38da66d370 100644 --- a/patches/minecraft/net/minecraft/command/CommandFill.java.patch +++ b/patches/minecraft/net/minecraft/command/CommandFill.java.patch @@ -1,28 +1,28 @@ --- ../src-base/minecraft/net/minecraft/command/CommandFill.java +++ ../src-work/minecraft/net/minecraft/command/CommandFill.java -@@ -48,6 +48,7 @@ +@@ -50,6 +50,7 @@ { - i = func_175764_a(p_71515_2_[7], 0, 15); + i = func_175764_a(p_184881_3_[7], 0, 15); } + IBlockState state = block.func_176203_a(i); BlockPos blockpos2 = new BlockPos(Math.min(blockpos.func_177958_n(), blockpos1.func_177958_n()), Math.min(blockpos.func_177956_o(), blockpos1.func_177956_o()), Math.min(blockpos.func_177952_p(), blockpos1.func_177952_p())); BlockPos blockpos3 = new BlockPos(Math.max(blockpos.func_177958_n(), blockpos1.func_177958_n()), Math.max(blockpos.func_177956_o(), blockpos1.func_177956_o()), Math.max(blockpos.func_177952_p(), blockpos1.func_177952_p())); -@@ -75,7 +76,7 @@ +@@ -77,7 +78,7 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); boolean flag = false; -- if (p_71515_2_.length >= 10 && block.func_149716_u()) -+ if (p_71515_2_.length >= 10 && block.hasTileEntity(state)) +- if (p_184881_3_.length >= 10 && block.func_149716_u()) ++ if (p_184881_3_.length >= 10 && block.hasTileEntity(state)) { - String s = func_147178_a(p_71515_1_, p_71515_2_, 9).func_150260_c(); + String s = func_147178_a(p_184881_2_, p_184881_3_, 9).func_150260_c(); -@@ -116,7 +117,7 @@ +@@ -118,7 +119,7 @@ continue; } } -- else if (p_71515_2_[8].equals("replace") && !block.func_149716_u()) -+ else if (p_71515_2_[8].equals("replace") && !block.hasTileEntity(state)) +- else if (p_184881_3_[8].equals("replace") && !block.func_149716_u()) ++ else if (p_184881_3_[8].equals("replace") && !block.hasTileEntity(state)) { - if (p_71515_2_.length > 9) + if (p_184881_3_.length > 9) { diff --git a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch index ab5182a944..cc10323801 100644 --- a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch +++ b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/command/CommandHandler.java +++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java -@@ -44,6 +44,16 @@ +@@ -46,6 +46,16 @@ } - else if (icommand.func_71519_b(p_71556_1_)) + else if (icommand.func_184882_a(this.func_184879_a(), p_71556_1_)) { + net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(icommand, p_71556_1_, astring); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) @@ -16,13 +16,13 @@ + if (i > -1) { - List list = PlayerSelector.func_179656_b(p_71556_1_, astring[i], Entity.class); -@@ -107,7 +117,7 @@ - ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.generic.exception", new Object[0]); - chatcomponenttranslation.func_150256_b().func_150238_a(EnumChatFormatting.RED); - p_175786_1_.func_145747_a(chatcomponenttranslation); + List list = EntitySelector.func_179656_b(p_71556_1_, astring[i], Entity.class); +@@ -109,7 +119,7 @@ + TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.generic.exception", new Object[0]); + textcomponenttranslation.func_150256_b().func_150238_a(TextFormatting.RED); + p_175786_1_.func_145747_a(textcomponenttranslation); - field_147175_a.warn("Couldn\'t process command: \'" + p_175786_4_ + "\'"); -+ field_147175_a.warn("Couldn\'t process command: \'" + p_175786_4_ + "\'", var9); // Forge: Log stacktrace of unknown exceptions ++ field_147175_a.warn("Couldn\'t process command: \'" + p_175786_4_ + "\'", var9); } return false; diff --git a/patches/minecraft/net/minecraft/command/PlayerSelector.java.patch b/patches/minecraft/net/minecraft/command/EntitySelector.java.patch similarity index 84% rename from patches/minecraft/net/minecraft/command/PlayerSelector.java.patch rename to patches/minecraft/net/minecraft/command/EntitySelector.java.patch index 1aacfa2551..b93a59d9e9 100644 --- a/patches/minecraft/net/minecraft/command/PlayerSelector.java.patch +++ b/patches/minecraft/net/minecraft/command/EntitySelector.java.patch @@ -1,8 +1,8 @@ ---- ../src-base/minecraft/net/minecraft/command/PlayerSelector.java -+++ ../src-work/minecraft/net/minecraft/command/PlayerSelector.java +--- ../src-base/minecraft/net/minecraft/command/EntitySelector.java ++++ ../src-work/minecraft/net/minecraft/command/EntitySelector.java @@ -36,9 +36,9 @@ - public class PlayerSelector + public class EntitySelector { - private static final Pattern field_82389_a = Pattern.compile("^@([pare])(?:\\[([\\w=,!-]*)\\])?$"); + private static final Pattern field_82389_a = Pattern.compile("^@([pare])(?:\\[([\\w\\.=,!-]*)\\])?$"); // FORGE: allow . in entity selectors diff --git a/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch b/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch index e5ef73f0b5..fcb4ea652b 100644 --- a/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch +++ b/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch @@ -1,20 +1,20 @@ --- ../src-base/minecraft/net/minecraft/command/server/CommandSetBlock.java +++ ../src-work/minecraft/net/minecraft/command/server/CommandSetBlock.java -@@ -52,6 +52,8 @@ - i = func_175764_a(p_71515_2_[4], 0, 15); +@@ -54,6 +54,8 @@ + i = func_175764_a(p_184881_3_[4], 0, 15); } + IBlockState state = block.func_176203_a(i); + - World world = p_71515_1_.func_130014_f_(); + World world = p_184881_2_.func_130014_f_(); if (!world.func_175667_e(blockpos)) -@@ -63,7 +65,7 @@ +@@ -65,7 +67,7 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); boolean flag = false; -- if (p_71515_2_.length >= 7 && block.func_149716_u()) -+ if (p_71515_2_.length >= 7 && block.hasTileEntity(state)) +- if (p_184881_3_.length >= 7 && block.func_149716_u()) ++ if (p_184881_3_.length >= 7 && block.hasTileEntity(state)) { - String s = func_147178_a(p_71515_1_, p_71515_2_, 6).func_150260_c(); + String s = func_147178_a(p_184881_2_, p_184881_3_, 6).func_150260_c(); diff --git a/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch b/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch index a9dae5314d..4a1533789a 100644 --- a/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch +++ b/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/command/server/CommandTestForBlock.java +++ ../src-work/minecraft/net/minecraft/command/server/CommandTestForBlock.java -@@ -70,7 +70,7 @@ +@@ -72,7 +72,7 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); boolean flag = false; -- if (p_71515_2_.length >= 6 && block.func_149716_u()) -+ if (p_71515_2_.length >= 6 && block.hasTileEntity(block.func_176203_a(i))) +- if (p_184881_3_.length >= 6 && block.func_149716_u()) ++ if (p_184881_3_.length >= 6 && block.hasTileEntity(block.func_176203_a(i))) { - String s = func_147178_a(p_71515_1_, p_71515_2_, 5).func_150260_c(); + String s = func_147178_a(p_184881_2_, p_184881_3_, 5).func_150260_c(); diff --git a/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch b/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch index 6af34573dd..ab4e3edde9 100644 --- a/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch +++ b/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/crash/CrashReportCategory.java +++ ../src-work/minecraft/net/minecraft/crash/CrashReportCategory.java -@@ -117,8 +117,11 @@ +@@ -122,8 +122,11 @@ } else { diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch index 92f2bc57b1..bd1ecc9102 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -1,15 +1,6 @@ --- ../src-base/minecraft/net/minecraft/enchantment/Enchantment.java +++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java -@@ -61,7 +61,7 @@ - - if (field_180311_a[p_i45771_1_] != null) - { -- throw new IllegalArgumentException("Duplicate enchantment id!"); -+ throw new IllegalArgumentException("Duplicate enchantment id! " + this.getClass() + " and " + field_180311_a[p_i45771_1_].getClass() + " Enchantment ID:" + p_i45771_1_); - } - else - { -@@ -139,7 +139,7 @@ +@@ -118,7 +118,7 @@ public boolean func_92089_a(ItemStack p_92089_1_) { @@ -18,8 +9,8 @@ } public void func_151368_a(EntityLivingBase p_151368_1_, Entity p_151368_2_, int p_151368_3_) -@@ -150,6 +150,45 @@ - { +@@ -134,6 +134,26 @@ + return false; } + /** @@ -33,25 +24,6 @@ + return this.field_77351_y.func_77557_a(stack.func_77973_b()); + } + -+ private static final java.lang.reflect.Field bookSetter = Enchantment.class.getDeclaredFields()[1]; -+ /** -+ * Add to the list of enchantments applicable by the anvil from a book -+ * -+ * @param enchantment -+ */ -+ public static void addToBookList(Enchantment enchantment) -+ { -+ try -+ { -+ net.minecraftforge.common.util.EnumHelper.setFailsafeFieldValue(bookSetter, null, -+ com.google.common.collect.ObjectArrays.concat(field_77331_b, enchantment)); -+ } -+ catch (Exception e) -+ { -+ throw new RuntimeException(e); //Rethrow see what happens -+ } -+ } -+ + /** + * Is this enchantment allowed to be enchanted on books via Enchantment Table + * @return false to disable the vanilla feature @@ -61,6 +33,6 @@ + return true; + } + - static + public static void func_185257_f() { - List list = Lists.newArrayList(); + EntityEquipmentSlot[] aentityequipmentslot = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET}; diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index 6f607d4dd4..010e0173e4 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java +++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java -@@ -296,7 +296,7 @@ +@@ -292,7 +292,7 @@ public static int func_77514_a(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) { Item item = p_77514_3_.func_77973_b(); @@ -9,33 +9,31 @@ if (i <= 0) { -@@ -345,7 +345,7 @@ - public static List func_77513_b(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_) +@@ -339,7 +339,7 @@ { + List list = Lists.newArrayList(); Item item = p_77513_1_.func_77973_b(); - int i = item.func_77619_b(); + int i = item.getItemEnchantability(p_77513_1_); if (i <= 0) { -@@ -387,7 +387,9 @@ +@@ -380,7 +380,8 @@ - for (EnchantmentData enchantmentdata1 : list) - { -- if (!enchantmentdata1.field_76302_b.func_77326_a(Enchantment.func_180306_c(integer.intValue()))) -+ Enchantment e1 = enchantmentdata1.field_76302_b; -+ Enchantment e2 = Enchantment.func_180306_c(integer.intValue()); -+ if (!e1.func_77326_a(e2) || !e2.func_77326_a(e1)) //Forge BugFix: Let Both enchantments veto being together - { - flag = false; - break; -@@ -421,7 +423,8 @@ - - for (Enchantment enchantment : Enchantment.field_77331_b) + while (iterator.hasNext()) { -- if (enchantment != null && (enchantment.field_77351_y.func_77557_a(item) || flag)) -+ if (enchantment == null) continue; -+ if (enchantment.canApplyAtEnchantingTable(p_77505_1_) || (flag && enchantment.isAllowedOnBooks())) +- if (!p_185282_1_.field_76302_b.func_77326_a(((EnchantmentData)iterator.next()).field_76302_b)) ++ Enchantment e2 = iterator.next().field_76302_b; ++ if (!p_185282_1_.field_76302_b.func_77326_a(e2) || !e2.func_77326_a(p_185282_1_.field_76302_b)) //Forge BugFix: Let Both enchantments veto being together { - for (int i = enchantment.func_77319_d(); i <= enchantment.func_77325_b(); ++i) + iterator.remove(); + } +@@ -395,7 +396,7 @@ + + for (Enchantment enchantment : Enchantment.field_185264_b) + { +- if ((!enchantment.func_185261_e() || p_185291_2_) && (enchantment.field_77351_y.func_77557_a(item) || flag)) ++ if ((!enchantment.func_185261_e() || p_185291_2_) && (enchantment.canApplyAtEnchantingTable(p_185291_1_) || (flag || enchantment.isAllowedOnBooks()))) + { + for (int i = enchantment.func_77325_b(); i > enchantment.func_77319_d() - 1; --i) { diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index 8d3e677c09..43f7adfdfe 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -1,113 +1,69 @@ --- ../src-base/minecraft/net/minecraft/entity/Entity.java +++ ../src-work/minecraft/net/minecraft/entity/Entity.java -@@ -49,7 +49,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; +@@ -76,7 +76,7 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; -public abstract class Entity implements ICommandSender +public abstract class Entity implements ICommandSender, net.minecraftforge.common.capabilities.ICapabilitySerializable { + private static final Logger field_184243_a = LogManager.getLogger(); private static final AxisAlignedBB field_174836_a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); - private static int field_70152_a; -@@ -129,6 +129,15 @@ - protected UUID field_96093_i; - private final CommandResultStats field_174837_as; +@@ -195,8 +195,16 @@ + this.field_70180_af.func_187214_a(field_184242_az, ""); + this.field_70180_af.func_187214_a(field_184234_aB, Boolean.valueOf(false)); + this.func_70088_a(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); ++ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this); + } + /** Forge: Used to store custom data for each entity. */ + private NBTTagCompound customEntityData; + public boolean captureDrops = false; + public java.util.ArrayList capturedDrops = new java.util.ArrayList(); -+ -+ @Deprecated //ToDo: Move to Capabilities? -+ protected java.util.HashMap extendedProperties = new java.util.HashMap(); + private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities; + public int func_145782_y() { return this.field_145783_c; -@@ -172,6 +181,9 @@ - this.field_70180_af.func_75682_a(2, ""); - this.field_70180_af.func_75682_a(4, Byte.valueOf((byte)0)); - this.func_70088_a(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); -+ for (net.minecraftforge.common.IExtendedEntityProperties props : extendedProperties.values()) props.init(this, p_i1582_1_); -+ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this); - } +@@ -1134,12 +1142,12 @@ + BlockPos blockpos = new BlockPos(this.field_70165_t, d0, this.field_70161_v); + IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); - protected abstract void func_70088_a(); -@@ -996,12 +1008,12 @@ - IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); - Block block = iblockstate.func_177230_c(); - -+ Boolean result = block.isEntityInsideMaterial(this.field_70170_p, blockpos, iblockstate, this, d0, p_70055_1_, true); -+ if (result != null) return result; ++ Boolean result = iblockstate.func_177230_c().isEntityInsideMaterial(this.field_70170_p, blockpos, iblockstate, this, d0, p_70055_1_, true); ++ if (result != null) return result; + - if (block.func_149688_o() == p_70055_1_) - { -- float f = BlockLiquid.func_149801_b(iblockstate.func_177230_c().func_176201_c(iblockstate)) - 0.11111111F; -- float f1 = (float)(blockpos.func_177956_o() + 1) - f; -- boolean flag = d0 < (double)f1; -- return !flag && this instanceof EntityPlayer ? false : flag; -+ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(p_70055_1_, this, blockpos); - } - else - { -@@ -1356,6 +1368,23 @@ - p_70109_1_.func_74757_a("Silent", this.func_174814_R()); + if (iblockstate.func_185904_a() == p_70055_1_) + { +- float f = BlockLiquid.func_149801_b(iblockstate.func_177230_c().func_176201_c(iblockstate)) - 0.11111111F; +- float f1 = (float)(blockpos.func_177956_o() + 1) - f; +- boolean flag = d0 < (double)f1; +- return !flag && this instanceof EntityPlayer ? false : flag; ++ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(p_70055_1_, this, blockpos); + } + else + { +@@ -1534,6 +1542,9 @@ + p_70109_1_.func_74782_a("Tags", nbttaglist); } + if (customEntityData != null) p_70109_1_.func_74782_a("ForgeData", customEntityData); -+ for (String identifier : this.extendedProperties.keySet()) -+ { -+ try -+ { -+ net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); -+ props.saveNBTData(p_70109_1_); -+ } -+ catch (Throwable t) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe("Failed to save extended properties for %s. This is a mod issue.", identifier); -+ t.printStackTrace(); -+ } -+ } -+ + if (this.capabilities != null) p_70109_1_.func_74782_a("ForgeCaps", this.capabilities.serializeNBT()); + this.func_70014_b(p_70109_1_); - if (this.field_70154_o != null) -@@ -1438,6 +1467,30 @@ - this.func_174805_g(p_70020_1_.func_74767_n("CustomNameVisible")); - this.field_174837_as.func_179668_a(p_70020_1_); + if (this.func_184207_aI()) +@@ -1629,6 +1640,9 @@ this.func_174810_b(p_70020_1_.func_74767_n("Silent")); -+ + this.func_184195_f(p_70020_1_.func_74767_n("Glowing")); + + if (p_70020_1_.func_74764_b("ForgeData")) customEntityData = p_70020_1_.func_74775_l("ForgeData"); -+ for (String identifier : this.extendedProperties.keySet()) -+ { -+ try -+ { -+ net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); -+ props.loadNBTData(p_70020_1_); -+ } -+ catch (Throwable t) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe("Failed to load extended properties for %s. This is a mod issue.", identifier); -+ t.printStackTrace(); -+ } -+ } -+ -+ //Rawr, legacy code, Vanilla added a UUID, keep this so older maps will convert properly TODO: Remove in 1.9 -+ if (p_70020_1_.func_74764_b("PersistentIDMSB") && p_70020_1_.func_74764_b("PersistentIDLSB")) -+ { -+ this.field_96093_i = new UUID(p_70020_1_.func_74763_f("PersistentIDMSB"), p_70020_1_.func_74763_f("PersistentIDLSB")); -+ } -+ + if (this.capabilities != null && p_70020_1_.func_74764_b("ForgeCaps")) this.capabilities.deserializeNBT(p_70020_1_.func_74775_l("ForgeCaps")); + - this.func_70037_a(p_70020_1_); - - if (this.func_142008_O()) -@@ -1512,7 +1565,10 @@ + if (p_70020_1_.func_150297_b("Tags", 9)) + { + this.field_184236_aF.clear(); +@@ -1715,7 +1729,10 @@ { EntityItem entityitem = new EntityItem(this.field_70170_p, this.field_70165_t, this.field_70163_u + (double)p_70099_2_, this.field_70161_v, p_70099_1_); entityitem.func_174869_p(); @@ -119,23 +75,23 @@ return entityitem; } else -@@ -1655,6 +1711,7 @@ +@@ -1824,6 +1841,7 @@ - public void func_70078_a(Entity p_70078_1_) + public boolean func_184205_a(Entity p_184205_1_, boolean p_184205_2_) { -+ if(!(this instanceof EntityLivingBase) && !net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_70078_1_, true)){ return; } - this.field_70149_e = 0.0D; - this.field_70147_f = 0.0D; - -@@ -2049,6 +2106,7 @@ ++ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_184205_1_, true)) return false; + if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) + { + if (this.func_184218_aH()) +@@ -2279,6 +2297,7 @@ { if (!this.field_70170_p.field_72995_K && !this.field_70128_L) { -+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_71027_1_)) return; ++ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return null; this.field_70170_p.field_72984_F.func_76320_a("changeDimension"); - MinecraftServer minecraftserver = MinecraftServer.func_71276_C(); + MinecraftServer minecraftserver = this.func_184102_h(); int i = this.field_71093_bK; -@@ -2092,7 +2150,7 @@ +@@ -2372,7 +2391,7 @@ public float func_180428_a(Explosion p_180428_1_, World p_180428_2_, BlockPos p_180428_3_, IBlockState p_180428_4_) { @@ -144,11 +100,10 @@ } public boolean func_174816_a(Explosion p_174816_1_, World p_174816_2_, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_) -@@ -2353,4 +2411,209 @@ - +@@ -2662,6 +2681,165 @@ EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_); } -+ + + /* ================================== Forge Start =====================================*/ + /** + * Returns a NBTTagCompound that can be used to store custom data for this entity. @@ -179,7 +134,7 @@ + * @param target The full target the player is looking at + * @return A ItemStack to add to the player's inventory, Null if nothing should be added. + */ -+ public ItemStack getPickedResult(MovingObjectPosition target) ++ public ItemStack getPickedResult(RayTraceResult target) + { + if (this instanceof net.minecraft.entity.item.EntityPainting) + { @@ -207,24 +162,23 @@ + } + else if (this instanceof net.minecraft.entity.item.EntityBoat) + { -+ return new ItemStack(net.minecraft.init.Items.field_151124_az); ++ return new ItemStack(((EntityBoat)this).func_184455_j()); + } + else if (this instanceof net.minecraft.entity.item.EntityArmorStand) + { + return new ItemStack(net.minecraft.init.Items.field_179565_cj); + } ++ else if (this instanceof net.minecraft.entity.item.EntityEnderCrystal) ++ { ++ return new ItemStack(net.minecraft.init.Items.field_185158_cP); ++ } + else + { -+ int id = EntityList.func_75619_a(this); -+ if (id > 0 && EntityList.field_75627_a.containsKey(id)) -+ { -+ return new ItemStack(net.minecraft.init.Items.field_151063_bx, 1, id); -+ } + String name = EntityList.func_75621_b(this); -+ if (name != null && net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().containsKey(name)) ++ if (EntityList.field_75627_a.containsKey(name)) + { + ItemStack stack = new ItemStack(net.minecraft.init.Items.field_151063_bx); -+ stack.func_77983_a("entity_name", new net.minecraft.nbt.NBTTagString(name)); ++ net.minecraft.item.ItemMonsterPlacer.func_185078_a(stack, name); + return stack; + } + } @@ -262,51 +216,6 @@ + } + + /** -+ * Register the instance of IExtendedProperties into the entity's collection. -+ * @param identifier The identifier which you can use to retrieve these properties for the entity. -+ * @param properties The instanceof IExtendedProperties to register -+ * @return The identifier that was used to register the extended properties. Empty String indicates an error. If your requested key already existed, this will return a modified one that is unique. -+ */ -+ public String registerExtendedProperties(String identifier, net.minecraftforge.common.IExtendedEntityProperties properties) -+ { -+ if (identifier == null) -+ { -+ net.minecraftforge.fml.common.FMLLog.warning("Someone is attempting to register extended properties using a null identifier. This is not allowed. Aborting. This may have caused instability."); -+ return ""; -+ } -+ if (properties == null) -+ { -+ net.minecraftforge.fml.common.FMLLog.warning("Someone is attempting to register null extended properties. This is not allowed. Aborting. This may have caused instability."); -+ return ""; -+ } -+ -+ String baseIdentifier = identifier; -+ int identifierModCount = 1; -+ while (this.extendedProperties.containsKey(identifier)) -+ { -+ identifier = String.format("%s%d", baseIdentifier, identifierModCount++); -+ } -+ -+ if (baseIdentifier != identifier) -+ { -+ net.minecraftforge.fml.common.FMLLog.info("An attempt was made to register exended properties using an existing key. The duplicate identifier (%s) has been remapped to %s.", baseIdentifier, identifier); -+ } -+ -+ this.extendedProperties.put(identifier, properties); -+ return identifier; -+ } -+ -+ /** -+ * Gets the extended properties identified by the passed in key -+ * @param identifier The key that identifies the extended properties. -+ * @return The instance of IExtendedProperties that was found, or null. -+ */ -+ public net.minecraftforge.common.IExtendedEntityProperties getExtendedProperties(String identifier) -+ { -+ return this.extendedProperties.get(identifier); -+ } -+ -+ /** + * If a rider of this entity can interact with this entity. Should return true on the + * ridden entity if so. + * @@ -353,4 +262,7 @@ + return ret; + } + /* ================================== Forge End =====================================*/ - } ++ + public void func_184178_b(EntityPlayerMP p_184178_1_) + { + } diff --git a/patches/minecraft/net/minecraft/entity/EntityAgeable.java.patch b/patches/minecraft/net/minecraft/entity/EntityAgeable.java.patch deleted file mode 100644 index 68c17bc54f..0000000000 --- a/patches/minecraft/net/minecraft/entity/EntityAgeable.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityAgeable.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityAgeable.java -@@ -31,7 +31,7 @@ - { - if (!this.field_70170_p.field_72995_K) - { -- Class oclass = EntityList.func_90035_a(itemstack.func_77960_j()); -+ Class oclass = EntityList.field_75625_b.get(net.minecraft.item.ItemMonsterPlacer.getEntityName(itemstack)); - - if (oclass != null && this.getClass() == oclass) - { diff --git a/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch b/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch index 29d340d07f..e81fbae7b8 100644 --- a/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch @@ -1,12 +1,12 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityHanging.java +++ ../src-work/minecraft/net/minecraft/entity/EntityHanging.java -@@ -123,6 +123,9 @@ - { - BlockPos blockpos1 = blockpos.func_177967_a(enumfacing, k).func_177981_b(l); - Block block = this.field_70170_p.func_180495_p(blockpos1).func_177230_c(); -+ -+ if ( block.isSideSolid( this.field_70170_p, blockpos1, this.field_174860_b )) -+ continue; +@@ -139,6 +139,9 @@ + BlockPos blockpos1 = blockpos.func_177967_a(enumfacing, k + i1).func_177981_b(l + j1); + IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos1); - if (!block.func_149688_o().func_76220_a() && !BlockRedstoneDiode.func_149909_d(block)) ++ if (iblockstate.isSideSolid(this.field_70170_p, blockpos1, this.field_174860_b)) ++ continue; ++ + if (!iblockstate.func_185904_a().func_76220_a() && !BlockRedstoneDiode.func_185546_B(iblockstate)) { + return false; diff --git a/patches/minecraft/net/minecraft/entity/EntityList.java.patch b/patches/minecraft/net/minecraft/entity/EntityList.java.patch index 0a51ed53ee..479c2500d7 100644 --- a/patches/minecraft/net/minecraft/entity/EntityList.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityList.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityList.java +++ ../src-work/minecraft/net/minecraft/entity/EntityList.java -@@ -88,6 +88,7 @@ +@@ -91,6 +91,7 @@ public static void func_75618_a(Class p_75618_0_, String p_75618_1_, int p_75618_2_) { @@ -8,9 +8,9 @@ if (field_75625_b.containsKey(p_75618_1_)) { throw new IllegalArgumentException("ID is already registered: " + p_75618_1_); -@@ -151,9 +152,10 @@ - p_75615_0_.func_82580_o("Type"); - } +@@ -148,9 +149,10 @@ + { + Entity entity = null; + Class oclass = null; try @@ -20,7 +20,7 @@ if (oclass != null) { -@@ -167,7 +169,17 @@ +@@ -164,7 +166,17 @@ if (entity != null) { @@ -38,31 +38,3 @@ } else { -@@ -343,7 +355,9 @@ - - public static class EntityEggInfo - { -+ @Deprecated // This is not always a valid number in the global ID list. - public final int field_75613_a; -+ public final String name; - public final int field_75611_b; - public final int field_75612_c; - public final StatBase field_151512_d; -@@ -356,6 +370,17 @@ - this.field_75612_c = p_i1583_3_; - this.field_151512_d = StatList.func_151182_a(this); - this.field_151513_e = StatList.func_151176_b(this); -+ this.name = EntityList.func_75617_a(p_i1583_1_); - } -+ -+ public EntityEggInfo(String name, int primaryColor, int secondaryColor) -+ { -+ this.field_75613_a = -1; -+ this.name = name; -+ this.field_75611_b = primaryColor; -+ this.field_75612_c = secondaryColor; -+ this.field_151512_d = (new StatBase("stat.killEntity." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKill", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).func_75971_g(); -+ this.field_151513_e = (new StatBase("stat.entityKilledBy." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKilledBy", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).func_75971_g(); -+ } - } - } diff --git a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch index 915de5e84c..a65718d5ff 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java -@@ -121,6 +121,7 @@ +@@ -171,6 +171,7 @@ public void func_70624_b(EntityLivingBase p_70624_1_) { this.field_70696_bz = p_70624_1_; @@ -8,7 +8,7 @@ } public boolean func_70686_a(Class p_70686_1_) -@@ -498,10 +499,22 @@ +@@ -699,10 +700,22 @@ protected void func_70623_bb() { @@ -31,8 +31,8 @@ else { Entity entity = this.field_70170_p.func_72890_a(this, -1.0D); -@@ -621,7 +634,6 @@ - return this.field_70170_p.func_72917_a(this.func_174813_aQ(), this) && this.field_70170_p.func_72945_a(this, this.func_174813_aQ()).isEmpty() && !this.field_70170_p.func_72953_d(this.func_174813_aQ()); +@@ -835,7 +848,6 @@ + return !this.field_70170_p.func_72953_d(this.func_174813_aQ()) && this.field_70170_p.func_184144_a(this, this.func_174813_aQ()).isEmpty() && this.field_70170_p.func_72917_a(this.func_174813_aQ(), this); } - @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 7906ba9b3b..e9e581bdf3 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -1,24 +1,28 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java -@@ -170,6 +170,7 @@ - } +@@ -190,9 +190,11 @@ + float f = (float)MathHelper.func_76123_f(this.field_70143_R - 3.0F); + if (p_184231_4_.func_185904_a() != Material.field_151579_a) ++ if (p_184231_4_.func_177230_c().isAir(p_184231_4_, field_70170_p, p_184231_5_)) + { + double d0 = Math.min((double)(0.2F + f / 15.0F), 2.5D); int i = (int)(150.0D * d0); -+ if ( !block.addLandingEffects( (WorldServer)this.field_70170_p, p_180433_5_, iblockstate, this, i ) ) - ((WorldServer)this.field_70170_p).func_175739_a(EnumParticleTypes.BLOCK_DUST, this.field_70165_t, this.field_70163_u, this.field_70161_v, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] {Block.func_176210_f(iblockstate)}); ++ if (!p_184231_4_.func_177230_c().addLandingEffects(p_184231_4_, (WorldServer)this.field_70170_p, p_184231_5_, p_184231_4_, this, i)) + ((WorldServer)this.field_70170_p).func_175739_a(EnumParticleTypes.BLOCK_DUST, this.field_70165_t, this.field_70163_u, this.field_70161_v, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] {Block.func_176210_f(p_184231_4_)}); } } -@@ -237,7 +238,7 @@ +@@ -264,7 +266,7 @@ } } -- if (!this.field_70170_p.field_72995_K && this.func_70115_ae() && this.field_70154_o instanceof EntityLivingBase) -+ if (!this.field_70170_p.field_72995_K && this.func_70115_ae() && this.field_70154_o != null && field_70154_o.shouldDismountInWater(this)) +- if (!this.field_70170_p.field_72995_K && this.func_184218_aH() && this.func_184187_bx() instanceof EntityLivingBase) ++ if (!this.field_70170_p.field_72995_K && this.func_184218_aH() && this.func_184187_bx() != null && this.func_184187_bx().shouldDismountInWater(this)) { - this.func_70078_a((Entity)null); + this.func_184210_p(); } -@@ -319,7 +320,7 @@ - if (!this.field_70170_p.field_72995_K && (this.field_70718_bc > 0 || this.func_70684_aJ()) && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")) +@@ -363,7 +365,7 @@ + if (!this.field_70170_p.field_72995_K && (this.func_70684_aJ() || this.field_70718_bc > 0 && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot"))) { int i = this.func_70693_a(this.field_70717_bb); - @@ -26,7 +30,7 @@ while (i > 0) { int j = EntityXPOrb.func_70527_a(i); -@@ -380,6 +381,7 @@ +@@ -424,6 +426,7 @@ { this.field_70755_b = p_70604_1_; this.field_70756_c = this.field_70173_aa; @@ -34,15 +38,7 @@ } public EntityLivingBase func_110144_aD() -@@ -663,7 +665,6 @@ - return this.func_70668_bt() == EnumCreatureAttribute.UNDEAD; - } - -- @SideOnly(Side.CLIENT) - public void func_70618_n(int p_70618_1_) - { - this.field_70713_bf.remove(Integer.valueOf(p_70618_1_)); -@@ -712,6 +713,8 @@ +@@ -775,6 +778,8 @@ public void func_70691_i(float p_70691_1_) { @@ -51,7 +47,7 @@ float f = this.func_110143_aJ(); if (f > 0.0F) -@@ -732,6 +735,7 @@ +@@ -795,6 +800,7 @@ public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -59,7 +55,7 @@ if (this.func_180431_b(p_70097_1_)) { return false; -@@ -797,9 +801,9 @@ +@@ -883,9 +889,9 @@ this.field_70718_bc = 100; this.field_70717_bb = (EntityPlayer)entity; } @@ -71,51 +67,49 @@ if (entitywolf.func_70909_n()) { -@@ -883,6 +887,7 @@ +@@ -1007,6 +1013,7 @@ public void func_70645_a(DamageSource p_70645_1_) { + if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; - Entity entity = p_70645_1_.func_76346_g(); - EntityLivingBase entitylivingbase = this.func_94060_bK(); - -@@ -908,6 +913,9 @@ - i = EnchantmentHelper.func_77519_f((EntityLivingBase)entity); - } - -+ captureDrops = true; -+ capturedDrops.clear(); -+ - if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")) - { - this.func_70628_a(this.field_70718_bc > 0, i); -@@ -918,6 +926,16 @@ - this.func_82164_bB(); + if (!this.field_70729_aU) + { + Entity entity = p_70645_1_.func_76346_g(); +@@ -1034,11 +1041,24 @@ + i = EnchantmentHelper.func_185283_h((EntityLivingBase)entity); } - } -+ -+ captureDrops = false; -+ -+ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, p_70645_1_, capturedDrops, i, field_70718_bc > 0)) -+ { -+ for (EntityItem item : capturedDrops) -+ { -+ field_70170_p.func_72838_d(item); -+ } -+ } - } - this.field_70170_p.func_72960_a(this, (byte)3); -@@ -972,7 +990,7 @@ - int j = MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b); - int k = MathHelper.func_76128_c(this.field_70161_v); - Block block = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)).func_177230_c(); -- return (block == Blocks.field_150468_ap || block == Blocks.field_150395_bd) && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).func_175149_v()); -+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(block, field_70170_p, new BlockPos(i, j, k), this); ++ captureDrops = true; ++ capturedDrops.clear(); ++ + if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")) + { + boolean flag = this.field_70718_bc > 0; + this.func_184610_a(flag, i, p_70645_1_); + } ++ ++ captureDrops = false; ++ ++ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, p_70645_1_, capturedDrops, i, field_70718_bc > 0)) ++ { ++ for (EntityItem item : capturedDrops) ++ { ++ field_70170_p.func_72838_d(item); ++ } ++ } + } + + this.field_70170_p.func_72960_a(this, (byte)3); +@@ -1113,7 +1133,7 @@ + BlockPos blockpos = new BlockPos(i, j, k); + IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); + Block block = iblockstate.func_177230_c(); +- return block != Blocks.field_150468_ap && block != Blocks.field_150395_bd ? block instanceof BlockTrapDoor && this.func_184604_a(blockpos, iblockstate) : true; ++ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(iblockstate, field_70170_p, new BlockPos(i, j, k), this); + } } - public boolean func_70089_S() -@@ -982,6 +1000,9 @@ +@@ -1139,6 +1159,9 @@ public void func_180430_e(float p_180430_1_, float p_180430_2_) { @@ -123,9 +117,9 @@ + if (ret == null) return; + p_180430_1_ = ret[0]; p_180430_2_ = ret[1]; super.func_180430_e(p_180430_1_, p_180430_2_); - PotionEffect potioneffect = this.func_70660_b(Potion.field_76430_j); - float f = potioneffect != null ? (float)(potioneffect.func_76458_c() + 1) : 0.0F; -@@ -1094,6 +1115,8 @@ + PotionEffect potioneffect = this.func_70660_b(MobEffects.field_76430_j); + float f = potioneffect == null ? 0.0F : (float)(potioneffect.func_76458_c() + 1); +@@ -1231,6 +1254,8 @@ { if (!this.func_180431_b(p_70665_1_)) { @@ -134,11 +128,11 @@ p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); float f = p_70665_2_; -@@ -1142,6 +1165,11 @@ +@@ -1279,6 +1304,11 @@ - public void func_71038_i() + public void func_184609_a(EnumHand p_184609_1_) { -+ ItemStack stack = this.func_70694_bm(); ++ ItemStack stack = this.func_184586_b(p_184609_1_); + if (stack != null && stack.func_77973_b() != null) + { + if (stack.func_77973_b().onEntitySwing(this, stack)) return; @@ -146,15 +140,41 @@ if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) { this.field_110158_av = -1; -@@ -1281,6 +1309,7 @@ +@@ -1476,6 +1506,7 @@ public void func_110145_l(Entity p_110145_1_) { -+ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_110145_1_, false)){ return; } - double d0 = p_110145_1_.field_70165_t; - double d1 = p_110145_1_.func_174813_aQ().field_72338_b + (double)p_110145_1_.field_70131_O; - double d2 = p_110145_1_.field_70161_v; -@@ -1346,6 +1375,7 @@ ++ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_110145_1_, false)) return; + if (!(p_110145_1_ instanceof EntityBoat) && !(p_110145_1_ instanceof EntityHorse)) + { + double d1 = p_110145_1_.field_70165_t; +@@ -1500,7 +1531,7 @@ + + if (!this.field_70170_p.func_184143_b(axisalignedbb1)) + { +- if (this.field_70170_p.func_180495_p(new BlockPos(d11, this.field_70163_u, d12)).func_185896_q()) ++ if (this.field_70170_p.func_180495_p(new BlockPos(d11, this.field_70163_u, d12)).isSideSolid(field_70170_p, new BlockPos(d11, this.field_70163_u, d12), EnumFacing.UP)) + { + this.func_70634_a(d11, this.field_70163_u + 1.0D, d12); + return; +@@ -1508,14 +1539,14 @@ + + BlockPos blockpos = new BlockPos(d11, this.field_70163_u - 1.0D, d12); + +- if (this.field_70170_p.func_180495_p(blockpos).func_185896_q() || this.field_70170_p.func_180495_p(blockpos).func_185904_a() == Material.field_151586_h) ++ if (this.field_70170_p.func_180495_p(blockpos).isSideSolid(field_70170_p, blockpos, EnumFacing.UP) || this.field_70170_p.func_180495_p(blockpos).func_185904_a() == Material.field_151586_h) + { + d1 = d11; + d13 = this.field_70163_u + 1.0D; + d14 = d12; + } + } +- else if (!this.field_70170_p.func_184143_b(axisalignedbb1.func_72317_d(0.0D, 1.0D, 0.0D)) && this.field_70170_p.func_180495_p(new BlockPos(d11, this.field_70163_u + 1.0D, d12)).func_185896_q()) ++ else if (!this.field_70170_p.func_184143_b(axisalignedbb1.func_72317_d(0.0D, 1.0D, 0.0D)) && this.field_70170_p.func_180495_p(new BlockPos(d11, this.field_70163_u + 1.0D, d12)).isSideSolid(field_70170_p, new BlockPos(d11, this.field_70163_u + 1.0D, d12), EnumFacing.UP)) + { + d1 = d11; + d13 = this.field_70163_u + 2.0D; +@@ -1586,6 +1617,7 @@ } this.field_70160_al = true; @@ -162,45 +182,35 @@ } protected void func_70629_bd() -@@ -1530,6 +1560,7 @@ +@@ -1845,6 +1877,7 @@ public void func_70071_h_() { + if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return; super.func_70071_h_(); + this.func_184608_ct(); - if (!this.field_70170_p.field_72995_K) -@@ -1817,6 +1848,7 @@ - - public void func_70078_a(Entity p_70078_1_) - { -+ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_70078_1_, true)){ return; } - if (this.field_70154_o != null && p_70078_1_ == null) - { - if (!this.field_70170_p.field_72995_K) -@@ -1998,4 +2030,39 @@ - { +@@ -2351,6 +2384,40 @@ this.field_70752_e = true; } -+ + + /*** + * Removes all potion effects that have curativeItem as a curative item for its effect + * @param curativeItem The itemstack we are using to cure potion effects + */ + public void curePotionEffects(ItemStack curativeItem) + { -+ Iterator potionKey = field_70713_bf.keySet().iterator(); + if (field_70170_p.field_72995_K) return; ++ Iterator iterator = this.field_70713_bf.values().iterator(); + -+ while (potionKey.hasNext()) ++ while (iterator.hasNext()) + { -+ Integer key = potionKey.next(); -+ PotionEffect effect = (PotionEffect)field_70713_bf.get(key); ++ PotionEffect effect = iterator.next(); + + if (effect.isCurativeItem(curativeItem)) + { -+ potionKey.remove(); + func_70688_c(effect); ++ iterator.remove(); + this.field_70752_e = true; + } + } @@ -217,4 +227,60 @@ + { + return this instanceof net.minecraft.entity.passive.EntityPig; + } - } ++ + public abstract EnumHandSide func_184591_cq(); + + public boolean func_184587_cr() +@@ -2371,6 +2438,14 @@ + + if (itemstack == this.field_184627_bm) + { ++ field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn); ++ if (field_184628_bn <= 0) ++ { ++ this.func_71036_o(); ++ } ++ else ++ { // Forge Keep unindented to lower patch ++ field_184627_bm.func_77973_b().onUsingTick(field_184627_bm, this, field_184628_bn); //Forge Added + if (this.func_184605_cv() <= 25 && this.func_184605_cv() % 4 == 0) + { + this.func_184584_a(this.field_184627_bm, 5); +@@ -2380,6 +2455,7 @@ + { + this.func_71036_o(); + } ++ } + } + else + { +@@ -2394,8 +2470,10 @@ + + if (itemstack != null && !this.func_184587_cr()) + { ++ int duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, itemstack, itemstack.func_77988_m()); ++ if (duration <= 0) return; + this.field_184627_bm = itemstack; +- this.field_184628_bn = itemstack.func_77988_m(); ++ this.field_184628_bn = duration; + + if (!this.field_70170_p.field_72995_K) + { +@@ -2478,6 +2556,8 @@ + this.func_184584_a(this.field_184627_bm, 16); + ItemStack itemstack = this.field_184627_bm.func_77950_b(this.field_70170_p, this); + ++ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, field_184627_bm, func_184605_cv(), itemstack); ++ + if (itemstack != null && itemstack.field_77994_a == 0) + { + itemstack = null; +@@ -2508,6 +2588,8 @@ + if (this.field_184627_bm != null) + { + this.field_184627_bm.func_77974_b(this.field_70170_p, this, this.func_184605_cv()); ++ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_184627_bm, this.func_184605_cv())) ++ this.field_184627_bm.func_77974_b(this.field_70170_p, this, this.func_184605_cv()); + } + + this.func_184602_cy(); diff --git a/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch b/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch deleted file mode 100644 index 9f22ee7e1f..0000000000 --- a/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java -@@ -109,6 +109,7 @@ - - public boolean func_130002_c(EntityPlayer p_130002_1_) - { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; - this.field_145824_a.func_175574_a(p_130002_1_); - return false; - } diff --git a/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch b/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch index ba155b961e..1a78df1c33 100644 --- a/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java +++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java -@@ -56,6 +56,8 @@ +@@ -75,6 +75,8 @@ public void func_72786_a(Entity p_72786_1_) { @@ -9,11 +9,10 @@ if (p_72786_1_ instanceof EntityPlayerMP) { this.func_72791_a(p_72786_1_, 512, 2); -@@ -331,4 +333,23 @@ - } +@@ -329,6 +331,25 @@ } } -+ + + /* ======================================== FORGE START =====================================*/ + + // don't expose the EntityTrackerEntry directly so mods can't mess with the data in there as easily @@ -32,4 +31,7 @@ + } + + /* ======================================== FORGE END =====================================*/ - } ++ + public void func_151248_b(Entity p_151248_1_, Packet p_151248_2_) + { + EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry)this.field_72794_c.func_76041_a(p_151248_1_.func_145782_y()); diff --git a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch index 20e203ef1c..c8af86c881 100644 --- a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java +++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java -@@ -379,6 +379,14 @@ +@@ -398,6 +398,14 @@ this.field_73138_k = this.field_73132_a.field_70181_x; this.field_73135_l = this.field_73132_a.field_70179_y; @@ -12,25 +12,26 @@ + net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.field_73132_a, p_73117_1_, this.field_73128_d, this.field_73129_e, this.field_73126_f); + } + - if (this.field_73143_t && !(packet instanceof S0FPacketSpawnMob)) + if (flag && !(packet instanceof SPacketSpawnMob)) { - p_73117_1_.field_71135_a.func_147359_a(new S12PacketEntityVelocity(this.field_73132_a.func_145782_y(), this.field_73132_a.field_70159_w, this.field_73132_a.field_70181_x, this.field_73132_a.field_70179_y)); -@@ -426,12 +434,14 @@ - p_73117_1_.field_71135_a.func_147359_a(new S1DPacketEntityEffect(this.field_73132_a.func_145782_y(), potioneffect)); - } - } + p_73117_1_.field_71135_a.func_147359_a(new SPacketEntityVelocity(this.field_73132_a.func_145782_y(), this.field_73132_a.field_70159_w, this.field_73132_a.field_70181_x, this.field_73132_a.field_70179_y)); +@@ -438,6 +446,7 @@ + + this.field_73132_a.func_184178_b(p_73117_1_); + p_73117_1_.func_184848_d(this.field_73132_a); + net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(field_73132_a, p_73117_1_); } } else if (this.field_73134_o.contains(p_73117_1_)) - { +@@ -445,6 +454,7 @@ this.field_73134_o.remove(p_73117_1_); + this.field_73132_a.func_184203_c(p_73117_1_); p_73117_1_.func_152339_d(this.field_73132_a); + net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(field_73132_a, p_73117_1_); } } } -@@ -463,6 +473,9 @@ +@@ -477,6 +487,9 @@ field_151262_p.warn("Fetching addPacket for removed entity"); } @@ -39,4 +40,4 @@ + if (this.field_73132_a instanceof EntityItem) { - return new S0EPacketSpawnObject(this.field_73132_a, 2, 1); + return new SPacketSpawnObject(this.field_73132_a, 2, 1); diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch similarity index 88% rename from patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch rename to patches/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch index d869b35476..851c2ecc12 100644 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch @@ -1,15 +1,15 @@ ---- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java -+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java -@@ -20,6 +20,8 @@ - private double field_151497_i; +--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java ++++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java +@@ -21,6 +21,8 @@ private double field_151495_j; private double field_151496_k; + protected final int field_188493_g = 20; + private int failedPathFindingPenalty = 0; + private boolean canPenalize = false; - public EntityAIAttackOnCollide(EntityCreature p_i1635_1_, Class p_i1635_2_, double p_i1635_3_, boolean p_i1635_5_) + public EntityAIAttackMelee(EntityCreature p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_) { -@@ -54,6 +56,19 @@ +@@ -45,6 +47,19 @@ } else { @@ -29,7 +29,7 @@ this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase); return this.field_75438_g != null; } -@@ -91,6 +106,23 @@ +@@ -89,6 +104,23 @@ this.field_151496_k = entitylivingbase.field_70161_v; this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch index 2ccf20bddb..6b9c7e6d51 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch @@ -1,14 +1,18 @@ --- ../src-base/minecraft/net/minecraft/entity/boss/EntityDragon.java +++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java -@@ -479,9 +479,9 @@ - BlockPos blockpos = new BlockPos(k1, l1, i2); - Block block = this.field_70170_p.func_180495_p(blockpos).func_177230_c(); +@@ -474,13 +474,13 @@ + IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); + Block block = iblockstate.func_177230_c(); -- if (block.func_149688_o() != Material.field_151579_a) -+ if (!block.isAir(field_70170_p, new BlockPos(k1, l1, i2))) +- if (iblockstate.func_185904_a() != Material.field_151579_a && iblockstate.func_185904_a() != Material.field_151581_o) ++ if (!block.isAir(iblockstate, this.field_70170_p, blockpos) && iblockstate.func_185904_a() != Material.field_151581_o) { -- if (block != Blocks.field_180401_cv && block != Blocks.field_150343_Z && block != Blocks.field_150377_bs && block != Blocks.field_150357_h && block != Blocks.field_150483_bI && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) -+ if (block.canEntityDestroy(field_70170_p, new BlockPos(k1, l1, i2), this) && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) + if (!this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { - flag1 = this.field_70170_p.func_175698_g(blockpos) || flag1; + flag = true; } +- else if (block != Blocks.field_180401_cv && block != Blocks.field_150343_Z && block != Blocks.field_150377_bs && block != Blocks.field_150357_h && block != Blocks.field_150384_bq && block != Blocks.field_150378_br) ++ else if (block.canEntityDestroy(iblockstate, this.field_70170_p, blockpos, this)) + { + if (block != Blocks.field_150483_bI && block != Blocks.field_185776_dc && block != Blocks.field_185777_dd && block != Blocks.field_150411_aY && block != Blocks.field_185775_db) + { diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch index 38dc16d7ae..a3c0f02035 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/entity/boss/EntityWither.java +++ ../src-work/minecraft/net/minecraft/entity/boss/EntityWither.java -@@ -343,7 +343,7 @@ - BlockPos blockpos = new BlockPos(i3, k, l); - Block block = this.field_70170_p.func_180495_p(blockpos).func_177230_c(); +@@ -365,7 +365,7 @@ + IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); + Block block = iblockstate.func_177230_c(); -- if (block.func_149688_o() != Material.field_151579_a && func_181033_a(block)) -+ if (!block.isAir(field_70170_p,blockpos) && func_181033_a(block) && block.canEntityDestroy(field_70170_p, blockpos, this)) +- if (iblockstate.func_185904_a() != Material.field_151579_a && func_181033_a(block)) ++ if (!block.isAir(iblockstate, this.field_70170_p, blockpos)) { flag = this.field_70170_p.func_175655_b(blockpos, true) || flag; } diff --git a/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch b/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch deleted file mode 100644 index ee9c56e4c4..0000000000 --- a/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/boss/IBossDisplayData.java -+++ ../src-work/minecraft/net/minecraft/entity/boss/IBossDisplayData.java -@@ -4,7 +4,6 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public interface IBossDisplayData - { - float func_110138_aP(); diff --git a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch index 4778abec5d..e609188471 100644 --- a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch +++ b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java +++ ../src-work/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java -@@ -90,7 +90,8 @@ +@@ -104,7 +104,8 @@ for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity)list.get(i); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch index 4a8b020c5b..d3e4db9d7a 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityEnderPearl.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java -@@ -61,6 +61,9 @@ +@@ -84,6 +84,9 @@ if (entityplayermp.field_71135_a.func_147362_b().func_150724_d() && entityplayermp.field_70170_p == this.field_70170_p && !entityplayermp.func_70608_bn()) { @@ -10,8 +10,8 @@ if (this.field_70146_Z.nextFloat() < 0.05F && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning")) { EntityEndermite entityendermite = new EntityEndermite(this.field_70170_p); -@@ -74,9 +77,10 @@ - entitylivingbase.func_70078_a((Entity)null); +@@ -97,9 +100,10 @@ + this.func_184210_p(); } - entitylivingbase.func_70634_a(this.field_70165_t, this.field_70163_u, this.field_70161_v); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch new file mode 100644 index 0000000000..456c02616d --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityFallingBlock.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityFallingBlock.java +@@ -129,6 +129,7 @@ + { + IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos1); + ++ if (this.field_70170_p.func_175623_d(new BlockPos(this.field_70165_t, this.field_70163_u - 0.009999999776482582D, this.field_70161_v))) //Forge: Don't indent below. + if (BlockFalling.func_185759_i(this.field_70170_p.func_180495_p(new BlockPos(this.field_70165_t, this.field_70163_u - 0.009999999776482582D, this.field_70161_v)))) + { + this.field_70122_E = false; diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch index 283be7c908..d375ace01f 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java -@@ -29,6 +29,11 @@ +@@ -37,6 +37,11 @@ private String field_145802_g; public float field_70290_d; @@ -12,7 +12,7 @@ public EntityItem(World p_i1709_1_, double p_i1709_2_, double p_i1709_4_, double p_i1709_6_) { super(p_i1709_1_); -@@ -46,6 +51,7 @@ +@@ -54,6 +59,7 @@ { this(p_i1710_1_, p_i1710_2_, p_i1710_4_, p_i1710_6_); this.func_92058_a(p_i1710_8_); @@ -20,21 +20,21 @@ } protected boolean func_70041_e_() -@@ -69,6 +75,8 @@ +@@ -77,6 +83,8 @@ public void func_70071_h_() { -+ ItemStack stack = this.func_70096_w().func_82710_f(10); ++ ItemStack stack = this.func_184212_Q().func_187225_a(field_184533_c).orNull(); + if (stack != null && stack.func_77973_b() != null && stack.func_77973_b().onEntityItemUpdate(this)) return; if (this.func_92059_d() == null) { this.func_70106_y(); -@@ -129,8 +137,16 @@ +@@ -137,8 +145,16 @@ this.func_70072_I(); - if (!this.field_70170_p.field_72995_K && this.field_70292_b >= 6000) -+ ItemStack item = func_70096_w().func_82710_f(10); ++ ItemStack item = this.func_184212_Q().func_187225_a(field_184533_c).orNull(); + + if (!this.field_70170_p.field_72995_K && this.field_70292_b >= lifespan) { @@ -47,15 +47,15 @@ this.func_70106_y(); } } -@@ -271,6 +287,7 @@ - p_70014_1_.func_74777_a("Health", (short)((byte)this.field_70291_e)); +@@ -279,6 +295,7 @@ + p_70014_1_.func_74777_a("Health", (short)this.field_70291_e); p_70014_1_.func_74777_a("Age", (short)this.field_70292_b); p_70014_1_.func_74777_a("PickupDelay", (short)this.field_145804_b); + p_70014_1_.func_74768_a("Lifespan", lifespan); if (this.func_145800_j() != null) { -@@ -311,20 +328,23 @@ +@@ -319,20 +336,23 @@ NBTTagCompound nbttagcompound = p_70037_1_.func_74775_l("Item"); this.func_92058_a(ItemStack.func_77949_a(nbttagcompound)); @@ -63,7 +63,7 @@ - { - this.func_70106_y(); - } -+ ItemStack item = func_70096_w().func_82710_f(10); ++ ItemStack item = this.func_184212_Q().func_187225_a(field_184533_c).orNull(); + if (item == null || item.field_77994_a <= 0) this.func_70106_y(); + if (p_70037_1_.func_74764_b("Lifespan")) lifespan = p_70037_1_.func_74762_e("Lifespan"); } @@ -84,15 +84,15 @@ { if (itemstack.func_77973_b() == Item.func_150898_a(Blocks.field_150364_r)) { -@@ -361,6 +381,7 @@ +@@ -369,6 +389,7 @@ } } + net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(p_70100_1_, this); if (!this.func_174814_R()) { - this.field_70170_p.func_72956_a(p_70100_1_, "random.pop", 0.2F, ((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.7F + 1.0F) * 2.0F); -@@ -402,11 +423,6 @@ + this.field_70170_p.func_184148_a((EntityPlayer)null, p_70100_1_.field_70165_t, p_70100_1_.field_70163_u, p_70100_1_.field_70161_v, SoundEvents.field_187638_cR, SoundCategory.PLAYERS, 0.2F, ((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.7F + 1.0F) * 2.0F); +@@ -414,11 +435,6 @@ if (itemstack == null) { @@ -104,7 +104,7 @@ return new ItemStack(Blocks.field_150348_b); } else -@@ -480,6 +496,6 @@ +@@ -492,6 +508,6 @@ public void func_174870_v() { this.func_174871_r(); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch index dfb0cf0e5a..122e9e82da 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityItemFrame.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityItemFrame.java -@@ -122,7 +122,7 @@ +@@ -137,7 +137,7 @@ { if (p_110131_1_ != null) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch index da822bd071..8f801c3e93 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecart.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecart.java -@@ -50,6 +50,20 @@ +@@ -54,6 +54,20 @@ @SideOnly(Side.CLIENT) private double field_70506_as; @@ -21,7 +21,7 @@ public EntityMinecart(World p_i1712_1_) { super(p_i1712_1_); -@@ -95,17 +109,19 @@ +@@ -99,17 +113,19 @@ public AxisAlignedBB func_70114_g(Entity p_70114_1_) { @@ -42,7 +42,7 @@ } public EntityMinecart(World p_i1713_1_, double p_i1713_2_, double p_i1713_4_, double p_i1713_6_) -@@ -309,7 +325,7 @@ +@@ -315,7 +331,7 @@ BlockPos blockpos = new BlockPos(k, l, i1); IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); @@ -51,7 +51,7 @@ { this.func_180460_a(blockpos, iblockstate); -@@ -348,7 +364,10 @@ +@@ -354,7 +370,10 @@ this.func_70101_b(this.field_70177_z, this.field_70125_A); @@ -61,9 +61,9 @@ + else box = this.func_174813_aQ().func_72314_b(0.20000000298023224D, 0.0D, 0.20000000298023224D); + for (Entity entity : this.field_70170_p.func_72839_b(this, box)) { - if (entity != this.field_70153_n && entity.func_70104_M() && entity instanceof EntityMinecart) + if (!this.func_184196_w(entity) && entity.func_70104_M() && entity instanceof EntityMinecart) { -@@ -367,6 +386,7 @@ +@@ -363,6 +382,7 @@ } this.func_70072_I(); @@ -71,7 +71,7 @@ } } -@@ -381,10 +401,21 @@ +@@ -377,10 +397,21 @@ protected void func_180459_n() { @@ -94,7 +94,7 @@ if (this.field_70122_E) { this.field_70159_w *= 0.5D; -@@ -392,13 +423,13 @@ +@@ -388,13 +419,13 @@ this.field_70179_y *= 0.5D; } @@ -112,7 +112,7 @@ } } -@@ -418,25 +449,25 @@ +@@ -414,25 +445,25 @@ flag1 = !flag; } @@ -143,7 +143,7 @@ ++this.field_70163_u; } -@@ -481,7 +512,7 @@ +@@ -478,7 +509,7 @@ } } @@ -152,29 +152,15 @@ { double d17 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y); -@@ -527,20 +558,8 @@ - this.field_70165_t = d19 + d1 * d18; - this.field_70161_v = d20 + d2 * d18; +@@ -526,6 +557,7 @@ this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); -- double d22 = this.field_70159_w; -- double d23 = this.field_70179_y; + double d22 = this.field_70159_w; + double d23 = this.field_70179_y; + this.moveMinecartOnRail(p_180460_1_); -- if (this.field_70153_n != null) -- { -- d22 *= 0.75D; -- d23 *= 0.75D; -- } -- -- double d13 = this.func_174898_m(); -- d22 = MathHelper.func_151237_a(d22, -d13, d13); -- d23 = MathHelper.func_151237_a(d23, -d13, d13); -- this.func_70091_d(d22, 0.0D, d23); -- - if (aint[0][1] != 0 && MathHelper.func_76128_c(this.field_70165_t) - p_180460_1_.func_177958_n() == aint[0][0] && MathHelper.func_76128_c(this.field_70161_v) - p_180460_1_.func_177952_p() == aint[0][2]) + if (this.func_184207_aI()) { - this.func_70107_b(this.field_70165_t, this.field_70163_u + (double)aint[0][1], this.field_70161_v); -@@ -577,8 +596,14 @@ +@@ -574,8 +606,14 @@ this.field_70179_y = d5 * (double)(i - p_180460_1_.func_177952_p()); } @@ -190,11 +176,10 @@ double d15 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y); if (d15 > 0.01D) -@@ -817,13 +842,20 @@ +@@ -795,13 +833,19 @@ public void func_70108_f(Entity p_70108_1_) { -+ + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, p_70108_1_)); + if (getCollisionHandler() != null) + { @@ -205,33 +190,33 @@ { if (!p_70108_1_.field_70145_X && !this.field_70145_X) { - if (p_70108_1_ != this.field_70153_n) + if (!this.func_184196_w(p_70108_1_)) { -- if (p_70108_1_ instanceof EntityLivingBase && !(p_70108_1_ instanceof EntityPlayer) && !(p_70108_1_ instanceof EntityIronGolem) && this.func_180456_s() == EntityMinecart.EnumMinecartType.RIDEABLE && this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y > 0.01D && this.field_70153_n == null && p_70108_1_.field_70154_o == null) -+ if (p_70108_1_ instanceof EntityLivingBase && !(p_70108_1_ instanceof EntityPlayer) && !(p_70108_1_ instanceof EntityIronGolem) && canBeRidden() && this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y > 0.01D && this.field_70153_n == null && p_70108_1_.field_70154_o == null) +- if (p_70108_1_ instanceof EntityLivingBase && this.func_184264_v() == EntityMinecart.Type.RIDEABLE && this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y > 0.01D && !(p_70108_1_ instanceof EntityPlayer) && !(p_70108_1_ instanceof EntityIronGolem) && !this.func_184207_aI() && !p_70108_1_.func_184218_aH()) ++ if (p_70108_1_ instanceof EntityLivingBase && canBeRidden() && this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y > 0.01D && !(p_70108_1_ instanceof EntityPlayer) && !(p_70108_1_ instanceof EntityIronGolem) && !this.func_184207_aI() && !p_70108_1_.func_184218_aH()) { - p_70108_1_.func_70078_a(this); + p_70108_1_.func_184220_m(this); } -@@ -869,7 +901,7 @@ +@@ -847,7 +891,7 @@ double d7 = p_70108_1_.field_70159_w + this.field_70159_w; double d8 = p_70108_1_.field_70179_y + this.field_70179_y; -- if (((EntityMinecart)p_70108_1_).func_180456_s() == EntityMinecart.EnumMinecartType.FURNACE && this.func_180456_s() != EntityMinecart.EnumMinecartType.FURNACE) +- if (((EntityMinecart)p_70108_1_).func_184264_v() == EntityMinecart.Type.FURNACE && this.func_184264_v() != EntityMinecart.Type.FURNACE) + if (((EntityMinecart)p_70108_1_).isPoweredCart() && !isPoweredCart()) { this.field_70159_w *= 0.20000000298023224D; this.field_70179_y *= 0.20000000298023224D; -@@ -877,7 +909,7 @@ +@@ -855,7 +899,7 @@ p_70108_1_.field_70159_w *= 0.949999988079071D; p_70108_1_.field_70179_y *= 0.949999988079071D; } -- else if (((EntityMinecart)p_70108_1_).func_180456_s() != EntityMinecart.EnumMinecartType.FURNACE && this.func_180456_s() == EntityMinecart.EnumMinecartType.FURNACE) -+ else if (((EntityMinecart)p_70108_1_).isPoweredCart() && isPoweredCart()) +- else if (((EntityMinecart)p_70108_1_).func_184264_v() != EntityMinecart.Type.FURNACE && this.func_184264_v() == EntityMinecart.Type.FURNACE) ++ else if (!((EntityMinecart)p_70108_1_).isPoweredCart() && isPoweredCart()) { p_70108_1_.field_70159_w *= 0.20000000298023224D; p_70108_1_.field_70179_y *= 0.20000000298023224D; -@@ -1042,6 +1074,221 @@ - } +@@ -982,6 +1026,221 @@ + this.func_184212_Q().func_187227_b(field_184270_f, Boolean.valueOf(p_94096_1_)); } + /* =================================== FORGE START ===========================================*/ @@ -265,7 +250,7 @@ + double mX = this.field_70159_w; + double mZ = this.field_70179_y; + -+ if (this.field_70153_n != null) ++ if (this.func_184187_bx() != null) + { + mX *= 0.75D; + mZ *= 0.75D; @@ -363,7 +348,7 @@ + */ + public boolean isPoweredCart() + { -+ return func_180456_s() == EntityMinecart.EnumMinecartType.FURNACE; ++ return func_184264_v() == EntityMinecart.Type.FURNACE; + } + + /** @@ -372,7 +357,7 @@ + */ + public boolean canBeRidden() + { -+ return this.func_180456_s() == EntityMinecart.EnumMinecartType.RIDEABLE; ++ return this.func_184264_v() == EntityMinecart.Type.RIDEABLE; + } + + /** @@ -449,6 +434,6 @@ + + /* =================================== FORGE END ===========================================*/ + - public static enum EnumMinecartType + public static enum Type { RIDEABLE(0, "MinecartRideable"), diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch new file mode 100644 index 0000000000..bd1a8f256b --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java +@@ -122,6 +122,7 @@ + + public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; + this.field_145824_a.func_175574_a(p_184230_1_); + return false; + } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch index b40c6c37c3..ecc5f6bf95 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch @@ -1,18 +1,17 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java -@@ -180,6 +180,7 @@ +@@ -200,6 +200,7 @@ - public boolean func_130002_c(EntityPlayer p_130002_1_) + public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; if (!this.field_70170_p.field_72995_K) { - p_130002_1_.func_71007_a(this); -@@ -232,4 +233,22 @@ - this.field_94113_a[i] = null; + p_184230_1_.func_71007_a(this); +@@ -279,6 +280,24 @@ } } -+ + + public net.minecraftforge.items.IItemHandler itemHandler = new net.minecraftforge.items.wrapper.InvWrapper(this); + + @Override @@ -30,4 +29,7 @@ + { + return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); + } - } ++ + public void func_174888_l() + { + this.func_184288_f((EntityPlayer)null); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch index 807d5622e3..91c23ee227 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch @@ -1,10 +1,11 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java -@@ -18,6 +18,7 @@ +@@ -19,6 +19,8 @@ - public boolean func_130002_c(EntityPlayer p_130002_1_) + public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; - if (this.field_70153_n != null && this.field_70153_n instanceof EntityPlayer && this.field_70153_n != p_130002_1_) ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; ++ + if (p_184230_1_.func_70093_af()) { - return true; + return false; diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch index a051aba6bc..3e1299398b 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch @@ -1,10 +1,11 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java -@@ -131,6 +131,7 @@ +@@ -136,6 +136,8 @@ - public boolean func_130002_c(EntityPlayer p_130002_1_) + public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; - ItemStack itemstack = p_130002_1_.field_71071_by.func_70448_g(); - - if (itemstack != null && itemstack.func_77973_b() == Items.field_151044_h) ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; ++ + if (p_184230_2_ != null && p_184230_2_.func_77973_b() == Items.field_151044_h && this.field_94110_c + 3600 <= 32000) + { + if (!p_184230_1_.field_71075_bZ.field_75098_d) diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch index 7fc5668b90..c208299213 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java -@@ -54,6 +54,7 @@ +@@ -56,6 +56,7 @@ - public boolean func_130002_c(EntityPlayer p_130002_1_) + public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; if (!this.field_70170_p.field_72995_K) { - p_130002_1_.func_71007_a(this); + p_184230_1_.func_71007_a(this); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch index f0c991f619..dbdf0519de 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityXPOrb.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityXPOrb.java -@@ -199,6 +199,7 @@ +@@ -204,6 +204,7 @@ { if (this.field_70532_c == 0 && p_70100_1_.field_71090_bL == 0) { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerPickupXpEvent(p_70100_1_, this))) return; p_70100_1_.field_71090_bL = 2; - this.field_70170_p.func_72956_a(p_70100_1_, "random.orb", 0.1F, 0.5F * ((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.7F + 1.8F)); + this.field_70170_p.func_184148_a((EntityPlayer)null, p_70100_1_.field_70165_t, p_70100_1_.field_70163_u, p_70100_1_.field_70161_v, SoundEvents.field_187607_bg, SoundCategory.PLAYERS, 0.1F, 0.5F * ((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.7F + 1.8F)); p_70100_1_.func_71001_a(this, 1); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch index 3f5db488ad..c4ef14e35b 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch @@ -1,24 +1,17 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java -@@ -198,12 +198,14 @@ +@@ -259,7 +259,9 @@ - protected boolean func_70825_j(double p_70825_1_, double p_70825_3_, double p_70825_5_) + private boolean func_70825_j(double p_70825_1_, double p_70825_3_, double p_70825_5_) { +- boolean flag = this.func_184595_k(p_70825_1_, p_70825_3_, p_70825_5_); + net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; - double d0 = this.field_70165_t; - double d1 = this.field_70163_u; - double d2 = this.field_70161_v; -- this.field_70165_t = p_70825_1_; -- this.field_70163_u = p_70825_3_; -- this.field_70161_v = p_70825_5_; -+ this.field_70165_t = event.targetX; -+ this.field_70163_u = event.targetY; -+ this.field_70161_v = event.targetZ; - boolean flag = false; - BlockPos blockpos = new BlockPos(this.field_70165_t, this.field_70163_u, this.field_70161_v); ++ boolean flag = this.func_184595_k(event.targetX, event.targetY, event.targetZ); -@@ -364,6 +366,18 @@ + if (flag) + { +@@ -342,6 +344,18 @@ } } @@ -36,4 +29,4 @@ + public boolean func_70823_r() { - return this.field_70180_af.func_75683_a(18) > 0; + return ((Boolean)this.field_70180_af.func_187225_a(field_184719_bw)).booleanValue(); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch index 72690ba3f9..e44b7a1f83 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java -@@ -103,6 +103,7 @@ +@@ -86,6 +86,7 @@ { this.field_70181_x = (double)(0.42F + (float)this.func_70809_q() * 0.1F); this.field_70160_al = true; diff --git a/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch index 8bd8f7dce3..986396cb2b 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java -@@ -111,7 +111,7 @@ +@@ -125,7 +125,7 @@ if (this.field_70122_E && !this.field_175452_bi) { int i = this.func_70809_q(); @@ -8,8 +8,8 @@ + if (spawnCustomParticles()) { i = 0; } // don't spawn particles if it's handled by the implementation itself for (int j = 0; j < i * 8; ++j) { - float f = this.field_70146_Z.nextFloat() * (float)Math.PI * 2.0F; -@@ -271,7 +271,7 @@ + float f = this.field_70146_Z.nextFloat() * ((float)Math.PI * 2F); +@@ -291,7 +291,7 @@ BlockPos blockpos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), 0, MathHelper.func_76128_c(this.field_70161_v)); Chunk chunk = this.field_70170_p.func_175726_f(blockpos); @@ -18,8 +18,8 @@ { return false; } -@@ -336,6 +336,14 @@ - return super.func_180482_a(p_180482_1_, p_180482_2_); +@@ -356,6 +356,14 @@ + return this.func_189101_db() ? SoundEvents.field_189110_fE : SoundEvents.field_187882_fq; } + /* ======================================== FORGE START =====================================*/ diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch index 5e5a32c790..6fe306eb02 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch @@ -1,28 +1,27 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java -@@ -87,7 +87,7 @@ - this.func_110148_a(SharedMonsterAttributes.field_111265_b).func_111128_a(35.0D); +@@ -101,7 +101,7 @@ this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(0.23000000417232513D); this.func_110148_a(SharedMonsterAttributes.field_111264_e).func_111128_a(3.0D); + this.func_110148_a(SharedMonsterAttributes.field_188791_g).func_111128_a(2.0D); - this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * 0.10000000149011612D); + this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance); } protected void func_70088_a() -@@ -229,12 +229,25 @@ +@@ -259,12 +259,24 @@ entitylivingbase = (EntityLivingBase)p_70097_1_.func_76346_g(); } -- if (entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e()) +- if (entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e() && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning")) + int i = MathHelper.func_76128_c(this.field_70165_t); + int j = MathHelper.func_76128_c(this.field_70163_u); + int k = MathHelper.func_76128_c(this.field_70161_v); -+ + net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, field_70170_p, i, j, k, entitylivingbase, this.func_110148_a(field_110186_bp).func_111126_e()); + if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true; + + if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || -+ entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e()) ++ entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e() && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning")) { - int i = MathHelper.func_76128_c(this.field_70165_t); - int j = MathHelper.func_76128_c(this.field_70163_u); @@ -40,8 +39,16 @@ for (int l = 0; l < 50; ++l) { -@@ -249,7 +262,7 @@ - if (!this.field_70170_p.func_175636_b((double)i1, (double)j1, (double)k1, 7.0D) && this.field_70170_p.func_72917_a(entityzombie.func_174813_aQ(), entityzombie) && this.field_70170_p.func_72945_a(entityzombie, entityzombie.func_174813_aQ()).isEmpty() && !this.field_70170_p.func_72953_d(entityzombie.func_174813_aQ())) +@@ -272,14 +284,14 @@ + int j1 = j + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1); + int k1 = k + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1); + +- if (this.field_70170_p.func_180495_p(new BlockPos(i1, j1 - 1, k1)).func_185896_q() && this.field_70170_p.func_175671_l(new BlockPos(i1, j1, k1)) < 10) ++ if (this.field_70170_p.func_180495_p(new BlockPos(i1, j1 - 1, k1)).isSideSolid(this.field_70170_p, new BlockPos(i1, j1 - 1, k1), net.minecraft.util.EnumFacing.UP) && this.field_70170_p.func_175671_l(new BlockPos(i1, j1, k1)) < 10) + { + entityzombie.func_70107_b((double)i1, (double)j1, (double)k1); + + if (!this.field_70170_p.func_175636_b((double)i1, (double)j1, (double)k1, 7.0D) && this.field_70170_p.func_72917_a(entityzombie.func_174813_aQ(), entityzombie) && this.field_70170_p.func_184144_a(entityzombie, entityzombie.func_174813_aQ()).isEmpty() && !this.field_70170_p.func_72953_d(entityzombie.func_174813_aQ())) { this.field_70170_p.func_72838_d(entityzombie); - entityzombie.func_70624_b(entitylivingbase); @@ -49,7 +56,7 @@ entityzombie.func_180482_a(this.field_70170_p.func_175649_E(new BlockPos(entityzombie)), (IEntityLivingData)null); this.func_110148_a(field_110186_bp).func_111121_a(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); entityzombie.func_110148_a(field_110186_bp).func_111121_a(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); -@@ -465,7 +478,7 @@ +@@ -483,7 +495,7 @@ if (p_180482_2_ == null) { diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch index 988e8b5871..fabe725b9e 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityHorse.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityHorse.java -@@ -1247,6 +1247,7 @@ +@@ -1200,6 +1200,7 @@ } this.field_110277_bt = 0.0F; diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch index e996a2886e..3926c9c077 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch @@ -1,39 +1,38 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityMooshroom.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityMooshroom.java -@@ -9,7 +9,7 @@ - import net.minecraft.util.EnumParticleTypes; +@@ -13,7 +13,7 @@ import net.minecraft.world.World; + import net.minecraft.world.storage.loot.LootTableList; -public class EntityMooshroom extends EntityCow +public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable { public EntityMooshroom(World p_i1687_1_) { -@@ -18,6 +18,7 @@ +@@ -22,6 +22,7 @@ this.field_175506_bl = Blocks.field_150391_bh; } + @SuppressWarnings("unused") - public boolean func_70085_c(EntityPlayer p_70085_1_) + public boolean func_184645_a(EntityPlayer p_184645_1_, EnumHand p_184645_2_, ItemStack p_184645_3_) { - ItemStack itemstack = p_70085_1_.field_71071_by.func_70448_g(); + if (p_184645_3_ != null && p_184645_3_.func_77973_b() == Items.field_151054_z && this.func_70874_b() >= 0 && !p_184645_1_.field_71075_bZ.field_75098_d) @@ -37,7 +38,7 @@ - } - } -- if (itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) -+ if (false && itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) //Forge Disable, Moved to onSheared + return true; + } +- else if (p_184645_3_ != null && p_184645_3_.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) ++ else if (false && p_184645_3_ != null && p_184645_3_.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) //Forge Disable, Moved to onSheared { this.func_70106_y(); this.field_70170_p.func_175688_a(EnumParticleTypes.EXPLOSION_LARGE, this.field_70165_t, this.field_70163_u + (double)(this.field_70131_O / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D, new int[0]); -@@ -77,4 +78,33 @@ - { +@@ -78,6 +79,35 @@ return new EntityMooshroom(this.field_70170_p); } -+ -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos){ return func_70874_b() >= 0; } + ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.math.BlockPos pos){ return func_70874_b() >= 0; } + @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos, int fortune) ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.math.BlockPos pos, int fortune) + { + this.func_70106_y(); + this.field_70170_p.func_175688_a(EnumParticleTypes.EXPLOSION_LARGE, this.field_70165_t, this.field_70163_u + (double)(this.field_70131_O / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D, new int[0]); @@ -56,7 +55,10 @@ + ret.add(new ItemStack(Blocks.field_150337_Q)); + } + -+ this.func_85030_a("mob.sheep.shear", 1.0F, 1.0F); ++ this.func_184185_a(SoundEvents.field_187784_dt, 1.0F, 1.0F); + return ret; + } - } ++ + protected ResourceLocation func_184647_J() + { + return LootTableList.field_186400_H; diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch index ec6eaae580..921dfecbad 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java -@@ -279,7 +279,7 @@ +@@ -285,7 +285,7 @@ + IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos.func_177977_b()); + Block block = iblockstate.func_177230_c(); - Block block = this.field_70170_p.func_180495_p(blockpos.func_177977_b()).func_177230_c(); - -- if (block == Blocks.field_150349_c || block.func_149688_o() == Material.field_151584_j) -+ if (block == Blocks.field_150349_c || block.isLeaves(field_70170_p, blockpos.func_177977_b())) +- if (block == Blocks.field_150349_c || iblockstate.func_185904_a() == Material.field_151584_j) ++ if (block == Blocks.field_150349_c || block.isLeaves(iblockstate, this.field_70170_p, blockpos.func_177977_b())) { return true; } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch index 7d9799ce8f..7552ad7052 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch @@ -1,29 +1,27 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntitySheep.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntitySheep.java -@@ -35,7 +35,7 @@ +@@ -42,7 +42,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class EntitySheep extends EntityAnimal +public class EntitySheep extends EntityAnimal implements net.minecraftforge.common.IShearable { + private static final DataParameter field_184774_bv = EntityDataManager.func_187226_a(EntitySheep.class, DataSerializers.field_187191_a); private final InventoryCrafting field_90016_e = new InventoryCrafting(new Container() - { -@@ -140,11 +140,12 @@ +@@ -171,9 +171,10 @@ } } + @SuppressWarnings("unused") - public boolean func_70085_c(EntityPlayer p_70085_1_) + public boolean func_184645_a(EntityPlayer p_184645_1_, EnumHand p_184645_2_, ItemStack p_184645_3_) { - ItemStack itemstack = p_70085_1_.field_71071_by.func_70448_g(); - -- if (itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) -+ if (false && itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) //Forge: Moved to onSheared +- if (p_184645_3_ != null && p_184645_3_.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) ++ if (false && p_184645_3_ != null && p_184645_3_.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) //Forge: Moved to onSheared { if (!this.field_70170_p.field_72995_K) { -@@ -327,4 +328,19 @@ +@@ -356,4 +357,19 @@ field_175514_bm.put(EnumDyeColor.RED, new float[] {0.6F, 0.2F, 0.2F}); field_175514_bm.put(EnumDyeColor.BLACK, new float[] {0.1F, 0.1F, 0.1F}); } @@ -39,7 +37,7 @@ + for (int j = 0; j < i; ++j) + ret.add(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, this.func_175509_cj().func_176765_a())); + -+ this.func_85030_a("mob.sheep.shear", 1.0F, 1.0F); ++ this.func_184185_a(SoundEvents.field_187763_eJ, 1.0F, 1.0F); + return ret; + } } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch index 9648a8f595..d661dc5b20 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -1,23 +1,23 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java -@@ -81,6 +81,7 @@ +@@ -90,6 +90,7 @@ private boolean field_82190_bM; private boolean field_175564_by; private InventoryBasic field_175560_bz; + @Deprecated //Use VillagerRegistry - private static final EntityVillager.ITradeList[][][][] field_175561_bA = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.field_151015_O, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.field_151174_bG, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.field_151172_bF, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.field_151025_P, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150423_aK), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.field_151158_bO, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150440_ba), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.field_151034_e, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.field_151106_aX, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.field_151105_aU, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.field_151007_F, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.field_151115_aP, new EntityVillager.PriceInfo(6, 6), Items.field_179566_aV, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151112_aM, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150325_L), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.field_151097_aZ, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 0), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.field_151007_F, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.field_151032_g, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.field_151031_f, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.func_150898_a(Blocks.field_150351_n), new EntityVillager.PriceInfo(10, 10), Items.field_151145_ak, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151121_aF, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.field_151122_aG, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.field_151111_aL, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150342_X), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.field_151164_bB, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.field_151113_aN, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150359_w), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.field_151057_cb, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151078_bh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.field_151043_k, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.field_151137_ax, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.field_151100_aR, 1, EnumDyeColor.BLUE.func_176767_b()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.field_151061_bv, new EntityVillager.PriceInfo(7, 11)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150426_aN), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.field_151062_by, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151028_Y, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.field_151030_Z, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151163_ad, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.field_151029_X, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.field_151022_W, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.field_151020_U, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.field_151023_V, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151036_c, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151040_l, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151048_u, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151056_x, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151037_a, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151035_b, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151046_w, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151147_al, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.field_151076_bf, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151157_am, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.field_151077_bg, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.field_151116_aA, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.field_151026_S, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151027_R, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.field_151141_av, new EntityVillager.PriceInfo(8, 10))}}}}; + private static final EntityVillager.ITradeList[][][][] field_175561_bA = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.field_151015_O, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.field_151174_bG, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.field_151172_bF, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.field_151025_P, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150423_aK), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.field_151158_bO, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150440_ba), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.field_151034_e, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.field_151106_aX, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.field_151105_aU, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.field_151007_F, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.field_151115_aP, new EntityVillager.PriceInfo(6, 6), Items.field_179566_aV, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151112_aM, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150325_L), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.field_151097_aZ, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L)), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.field_151007_F, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.field_151032_g, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.field_151031_f, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.func_150898_a(Blocks.field_150351_n), new EntityVillager.PriceInfo(10, 10), Items.field_151145_ak, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151121_aF, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.field_151122_aG, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.field_151111_aL, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150342_X), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.field_151164_bB, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.field_151113_aN, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150359_w), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.field_151057_cb, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151078_bh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.field_151043_k, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.field_151137_ax, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.field_151100_aR, 1, EnumDyeColor.BLUE.func_176767_b()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.field_151079_bi, new EntityVillager.PriceInfo(4, 7)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150426_aN), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.field_151062_by, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151028_Y, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.field_151030_Z, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151163_ad, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.field_151029_X, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.field_151022_W, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.field_151020_U, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.field_151023_V, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151036_c, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151040_l, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151048_u, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151056_x, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151037_a, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151035_b, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151046_w, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151147_al, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.field_151076_bf, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151157_am, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.field_151077_bg, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.field_151116_aA, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.field_151026_S, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151027_R, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.field_151141_av, new EntityVillager.PriceInfo(8, 10))}}}}; public EntityVillager(World p_i1747_1_) -@@ -210,7 +211,7 @@ - ItemStack itemstack = p_70085_1_.field_71071_by.func_70448_g(); - boolean flag = itemstack != null && itemstack.func_77973_b() == Items.field_151063_bx; +@@ -221,7 +222,7 @@ + { + boolean flag = p_184645_3_ != null && p_184645_3_.func_77973_b() == Items.field_151063_bx; - if (!flag && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_()) -+ if (!flag && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_() && !p_70085_1_.func_70093_af()) ++ if (!flag && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_() && !p_184645_1_.func_70093_af()) { - if (!this.field_70170_p.field_72995_K && (this.field_70963_i == null || this.field_70963_i.size() > 0)) + if (!this.field_70170_p.field_72995_K && (this.field_70963_i == null || !this.field_70963_i.isEmpty())) { -@@ -522,6 +523,7 @@ +@@ -533,6 +534,7 @@ private void func_175554_cu() { @@ -25,15 +25,15 @@ EntityVillager.ITradeList[][][] aentityvillager$itradelist = field_175561_bA[this.func_70946_n()]; if (this.field_175563_bv != 0 && this.field_175562_bw != 0) -@@ -635,6 +637,7 @@ +@@ -647,6 +649,7 @@ } } + //TODO: Hook into VillagerRegistry to get name if (s1 != null) { - ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("entity.Villager." + s1, new Object[0]); -@@ -697,7 +700,7 @@ + TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("entity.Villager." + s1, new Object[0]); +@@ -708,7 +711,7 @@ public IEntityLivingData func_180482_a(DifficultyInstance p_180482_1_, IEntityLivingData p_180482_2_) { p_180482_2_ = super.func_180482_a(p_180482_1_, p_180482_2_); diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index 20055aad97..b6f1f07826 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java +++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java -@@ -80,6 +80,11 @@ +@@ -93,6 +93,11 @@ @SuppressWarnings("incomplete-switch") public abstract class EntityPlayer extends EntityLivingBase { @@ -9,20 +9,10 @@ + private java.util.HashMap spawnForcedMap = new java.util.HashMap(); + public float eyeHeight = this.getDefaultEyeHeight(); + - public InventoryPlayer field_71071_by = new InventoryPlayer(this); - private InventoryEnderChest field_71078_a = new InventoryEnderChest(); - public Container field_71069_bz; -@@ -175,7 +180,8 @@ - { - if (this.field_71074_e != null) - { -- this.field_71074_e.func_77974_b(this.field_70170_p, this, this.field_71072_f); -+ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_71074_e, this.field_71072_f)) -+ this.field_71074_e.func_77974_b(this.field_70170_p, this, this.field_71072_f); - } - - this.func_71041_bz(); -@@ -199,6 +205,7 @@ + private static final DataParameter field_184829_a = EntityDataManager.func_187226_a(EntityPlayer.class, DataSerializers.field_187193_c); + private static final DataParameter field_184830_b = EntityDataManager.func_187226_a(EntityPlayer.class, DataSerializers.field_187192_b); + protected static final DataParameter field_184827_bp = EntityDataManager.func_187226_a(EntityPlayer.class, DataSerializers.field_187191_a); +@@ -174,6 +179,7 @@ public void func_70071_h_() { @@ -30,30 +20,7 @@ this.field_70145_X = this.func_175149_v(); if (this.func_175149_v()) -@@ -212,6 +219,14 @@ - - if (itemstack == this.field_71074_e) - { -+ field_71072_f = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_71074_e, field_71072_f); -+ if (field_71072_f <= 0) -+ { -+ this.func_71036_o(); -+ } -+ else -+ { // Forge Keep unindented to lower patch -+ field_71074_e.func_77973_b().onUsingTick(field_71074_e, this, field_71072_f); //Forge Added - if (this.field_71072_f <= 25 && this.field_71072_f % 4 == 0) - { - this.func_71010_c(itemstack, 5); -@@ -221,6 +236,7 @@ - { - this.func_71036_o(); - } -+ } - } - else - { -@@ -266,7 +282,7 @@ +@@ -219,7 +225,7 @@ super.func_70071_h_(); @@ -62,43 +29,29 @@ { this.func_71053_j(); this.field_71070_bA = this.field_71069_bz; -@@ -343,6 +359,7 @@ - { - this.func_70107_b(d3, this.field_70163_u, d4); +@@ -360,6 +366,7 @@ + this.func_70105_a(f, f1); + } } + net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPostTick(this); } public int func_82145_z() -@@ -412,11 +429,12 @@ - int i = this.field_71074_e.field_77994_a; - ItemStack itemstack = this.field_71074_e.func_77950_b(this.field_70170_p, this); - -+ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, field_71074_e, field_71072_f, itemstack); - if (itemstack != this.field_71074_e || itemstack != null && itemstack.field_77994_a != i) - { - this.field_71071_by.field_70462_a[this.field_71071_by.field_70461_c] = itemstack; - -- if (itemstack.field_77994_a == 0) -+ if (itemstack != null && itemstack.field_77994_a == 0) - { - this.field_71071_by.field_70462_a[this.field_71071_by.field_70461_c] = null; - } -@@ -476,11 +494,11 @@ +@@ -442,11 +449,11 @@ this.field_71109_bG = 0.0F; this.func_71015_k(this.field_70165_t - d0, this.field_70163_u - d1, this.field_70161_v - d2); -- if (this.field_70154_o instanceof EntityPig) -+ if (this.field_70154_o instanceof EntityLivingBase && ((EntityLivingBase)field_70154_o).shouldRiderFaceForward(this)) +- if (this.func_184187_bx() instanceof EntityPig) ++ if (this.func_184187_bx() instanceof EntityLivingBase && ((EntityLivingBase)this.func_94060_bK()).shouldRiderFaceForward(this)) { this.field_70125_A = f1; this.field_70177_z = f; -- this.field_70761_aq = ((EntityPig)this.field_70154_o).field_70761_aq; -+ this.field_70761_aq = ((EntityLivingBase)this.field_70154_o).field_70761_aq; +- this.field_70761_aq = ((EntityPig)this.func_184187_bx()).field_70761_aq; ++ this.field_70761_aq = ((EntityLivingBase)this.func_184187_bx()).field_70761_aq; } } } -@@ -610,11 +628,15 @@ +@@ -576,11 +583,15 @@ public void func_70645_a(DamageSource p_70645_1_) { @@ -114,7 +67,7 @@ if (this.func_70005_c_().equals("Notch")) { this.func_146097_a(new ItemStack(Items.field_151034_e, 1), true, false); -@@ -625,6 +647,9 @@ +@@ -591,6 +602,9 @@ this.field_71071_by.func_70436_m(); } @@ -123,8 +76,8 @@ + if (p_70645_1_ != null) { - this.field_70159_w = (double)(-MathHelper.func_76134_b((this.field_70739_aP + this.field_70177_z) * (float)Math.PI / 180.0F) * 0.1F); -@@ -707,12 +732,25 @@ + this.field_70159_w = (double)(-MathHelper.func_76134_b((this.field_70739_aP + this.field_70177_z) * 0.017453292F) * 0.1F); +@@ -678,12 +692,25 @@ public EntityItem func_71040_bB(boolean p_71040_1_) { @@ -152,34 +105,31 @@ } public EntityItem func_146097_a(ItemStack p_146097_1_, boolean p_146097_2_, boolean p_146097_3_) -@@ -770,13 +808,25 @@ +@@ -746,15 +773,22 @@ - public void func_71012_a(EntityItem p_71012_1_) + public ItemStack func_184816_a(EntityItem p_184816_1_) { -+ if (captureDrops) -+ { -+ capturedDrops.add(p_71012_1_); -+ return; -+ } -+ - this.field_70170_p.func_72838_d(p_71012_1_); ++ if (captureDrops) capturedDrops.add(p_184816_1_); ++ else // Forge: Don't indent to keep patch smaller. + this.field_70170_p.func_72838_d(p_184816_1_); + ItemStack itemstack = p_184816_1_.func_92059_d(); + return itemstack; } + @Deprecated //Use location sensitive version below - public float func_180471_a(Block p_180471_1_) + public float func_184813_a(IBlockState p_184813_1_) { -- float f = this.field_71071_by.func_146023_a(p_180471_1_); -+ return getBreakSpeed(p_180471_1_.func_176223_P(), new BlockPos(0, -1, 0)); +- float f = this.field_71071_by.func_184438_a(p_184813_1_); ++ return getBreakSpeed(p_184813_1_, new BlockPos(0, -1, 0)); + } + public float getBreakSpeed(IBlockState state, BlockPos pos) + { -+ ItemStack stack = field_71071_by.func_70448_g(); -+ float f = (stack == null ? 1.0F : stack.func_77973_b().getDigSpeed(stack, state)); ++ float f = this.field_71071_by.func_184438_a(state); if (f > 1.0F) { - int i = EnchantmentHelper.func_77509_b(this); -@@ -826,12 +876,13 @@ + int i = EnchantmentHelper.func_185293_e(this); +@@ -804,12 +838,13 @@ f /= 5.0F; } @@ -188,14 +138,14 @@ + return (f < 0 ? 0 : f); } - public boolean func_146099_a(Block p_146099_1_) + public boolean func_184823_b(IBlockState p_184823_1_) { -- return this.field_71071_by.func_146025_b(p_146099_1_); -+ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_146099_1_, this.field_71071_by.func_146025_b(p_146099_1_)); +- return this.field_71071_by.func_184432_b(p_184823_1_); ++ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_184823_1_, this.field_71071_by.func_184432_b(p_184823_1_)); } public void func_70037_a(NBTTagCompound p_70037_1_) -@@ -867,6 +918,16 @@ +@@ -845,6 +880,16 @@ this.field_82248_d = p_70037_1_.func_74767_n("SpawnForced"); } @@ -212,7 +162,7 @@ this.field_71100_bB.func_75112_a(p_70037_1_); this.field_71075_bZ.func_75095_b(p_70037_1_); -@@ -898,6 +959,23 @@ +@@ -877,6 +922,23 @@ p_70014_1_.func_74757_a("SpawnForced", this.field_82248_d); } @@ -236,7 +186,7 @@ this.field_71100_bB.func_75117_b(p_70014_1_); this.field_71075_bZ.func_75091_a(p_70014_1_); p_70014_1_.func_74782_a("EnderItems", this.field_71078_a.func_70487_g()); -@@ -911,6 +989,7 @@ +@@ -884,6 +946,7 @@ public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -244,42 +194,36 @@ if (this.func_180431_b(p_70097_1_)) { return false; -@@ -1007,12 +1086,15 @@ +@@ -966,6 +1029,7 @@ + if (this.field_184627_bm.field_77994_a <= 0) + { + EnumHand enumhand = this.func_184600_cs(); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, this.field_184627_bm, enumhand); + + if (enumhand == EnumHand.MAIN_HAND) + { +@@ -1001,8 +1065,12 @@ { if (!this.func_180431_b(p_70665_1_)) { + p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_); + if (p_70665_2_ <= 0) return; - if (!p_70665_1_.func_76363_c() && this.func_70632_aY() && p_70665_2_ > 0.0F) - { - p_70665_2_ = (1.0F + p_70665_2_) * 0.5F; - } - -- p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); + p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); + p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); + p_70665_2_ = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, field_71071_by.field_70460_b, p_70665_1_, p_70665_2_); + if (p_70665_2_ <= 0) return; - p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); float f = p_70665_2_; p_70665_2_ = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F); -@@ -1074,6 +1156,7 @@ + this.func_110149_m(this.func_110139_bj() - (f - p_70665_2_)); +@@ -1067,6 +1135,7 @@ } else { -+ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, p_70998_1_)) return false; - ItemStack itemstack = this.func_71045_bC(); - ItemStack itemstack1 = itemstack != null ? itemstack.func_77946_l() : null; ++ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, p_184822_1_, p_184822_2_, p_184822_3_)) return EnumActionResult.PASS; + ItemStack itemstack = p_184822_2_ != null ? p_184822_2_.func_77946_l() : null; -@@ -1125,7 +1208,9 @@ - - public void func_71028_bD() - { -+ ItemStack orig = func_71045_bC(); - this.field_71071_by.func_70299_a(this.field_71071_by.field_70461_c, (ItemStack)null); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, orig); - } - - public double func_70033_W() -@@ -1135,6 +1220,7 @@ + if (!p_184822_1_.func_184230_a(this, p_184822_2_, p_184822_3_)) +@@ -1123,6 +1192,7 @@ public void func_71059_n(Entity p_71059_1_) { @@ -287,7 +231,7 @@ if (p_71059_1_.func_70075_an()) { if (!p_71059_1_.func_85031_j(this)) -@@ -1311,6 +1397,8 @@ +@@ -1410,6 +1480,8 @@ public EntityPlayer.EnumStatus func_180469_a(BlockPos p_180469_1_) { @@ -296,19 +240,21 @@ if (!this.field_70170_p.field_72995_K) { if (this.func_70608_bn() || !this.func_70089_S()) -@@ -1350,9 +1438,9 @@ +@@ -1449,9 +1521,10 @@ this.func_70105_a(0.2F, 0.2F); - if (this.field_70170_p.func_175667_e(p_180469_1_)) -+ if (this.field_70170_p.func_175667_e(p_180469_1_) && field_70170_p.func_180495_p(p_180469_1_).func_177230_c().isBed(field_70170_p, p_180469_1_, this)) - { -- EnumFacing enumfacing = (EnumFacing)this.field_70170_p.func_180495_p(p_180469_1_).func_177229_b(BlockDirectional.field_176387_N); -+ EnumFacing enumfacing = this.field_70170_p.func_180495_p(p_180469_1_).func_177230_c().getBedDirection(field_70170_p, p_180469_1_); +- { +- EnumFacing enumfacing = (EnumFacing)this.field_70170_p.func_180495_p(p_180469_1_).func_177229_b(BlockHorizontal.field_185512_D); ++ IBlockState state = null; ++ if (this.field_70170_p.func_175667_e(p_180469_1_)) state = this.field_70170_p.func_180495_p(p_180469_1_); ++ if (state != null && state.func_177230_c().isBed(state, this.field_70170_p, p_180469_1_, this)) { ++ EnumFacing enumfacing = state.func_177230_c().getBedDirection(state, this.field_70170_p, p_180469_1_); float f = 0.5F; float f1 = 0.5F; -@@ -1415,13 +1503,14 @@ +@@ -1514,13 +1587,14 @@ public void func_70999_a(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) { @@ -317,16 +263,16 @@ IBlockState iblockstate = this.field_70170_p.func_180495_p(this.field_71081_bT); - if (this.field_71081_bT != null && iblockstate.func_177230_c() == Blocks.field_150324_C) -+ if (this.field_71081_bT != null && iblockstate.func_177230_c().isBed(field_70170_p, field_71081_bT, this)) ++ if (this.field_71081_bT != null && iblockstate.func_177230_c().isBed(iblockstate, field_70170_p, field_71081_bT, this)) { - this.field_70170_p.func_180501_a(this.field_71081_bT, iblockstate.func_177226_a(BlockBed.field_176471_b, Boolean.valueOf(false)), 4); - BlockPos blockpos = BlockBed.func_176468_a(this.field_70170_p, this.field_71081_bT, 0); + iblockstate.func_177230_c().setBedOccupied(field_70170_p, field_71081_bT, this, false); -+ BlockPos blockpos = iblockstate.func_177230_c().getBedSpawnPosition(field_70170_p, field_71081_bT, this); ++ BlockPos blockpos = iblockstate.func_177230_c().getBedSpawnPosition(iblockstate, field_70170_p, field_71081_bT, this); if (blockpos == null) { -@@ -1430,6 +1519,10 @@ +@@ -1529,6 +1603,10 @@ this.func_70107_b((double)((float)blockpos.func_177958_n() + 0.5F), (double)((float)blockpos.func_177956_o() + 0.1F), (double)((float)blockpos.func_177952_p() + 0.5F)); } @@ -337,7 +283,7 @@ this.field_71083_bS = false; -@@ -1448,14 +1541,14 @@ +@@ -1547,14 +1625,15 @@ private boolean func_175143_p() { @@ -347,19 +293,21 @@ public static BlockPos func_180467_a(World p_180467_0_, BlockPos p_180467_1_, boolean p_180467_2_) { - Block block = p_180467_0_.func_180495_p(p_180467_1_).func_177230_c(); +- Block block = p_180467_0_.func_180495_p(p_180467_1_).func_177230_c(); ++ IBlockState state = p_180467_0_.func_180495_p(p_180467_1_); ++ Block block = state.func_177230_c(); - if (block != Blocks.field_150324_C) -+ if (!block.isBed(p_180467_0_, p_180467_1_, null)) ++ if (!block.isBed(state, p_180467_0_, p_180467_1_, null)) { if (!p_180467_2_) { -@@ -1470,16 +1563,16 @@ +@@ -1569,16 +1648,17 @@ } else { - return BlockBed.func_176468_a(p_180467_0_, p_180467_1_, 0); -+ return p_180467_0_.func_180495_p(p_180467_1_).func_177230_c().getBedSpawnPosition(p_180467_0_, p_180467_1_, null); ++ return block.getBedSpawnPosition(state, p_180467_0_, p_180467_1_, null); } } @@ -367,14 +315,15 @@ public float func_71051_bG() { - if (this.field_71081_bT != null) -+ if (this.field_71081_bT != null && field_70170_p.func_180495_p(field_71081_bT).func_177230_c().isBed(field_70170_p, field_71081_bT, this)) ++ IBlockState state = this.field_71081_bT == null ? null : this.field_70170_p.func_180495_p(field_71081_bT); ++ if (state != null && state.func_177230_c().isBed(state, field_70170_p, field_71081_bT, this)) { -- EnumFacing enumfacing = (EnumFacing)this.field_70170_p.func_180495_p(this.field_71081_bT).func_177229_b(BlockDirectional.field_176387_N); -+ EnumFacing enumfacing = this.field_70170_p.func_180495_p(this.field_71081_bT).func_177230_c().getBedDirection(field_70170_p, field_71081_bT); +- EnumFacing enumfacing = (EnumFacing)this.field_70170_p.func_180495_p(this.field_71081_bT).func_177229_b(BlockHorizontal.field_185512_D); ++ EnumFacing enumfacing = state.func_177230_c().getBedDirection(state, field_70170_p, field_71081_bT); switch (enumfacing) { -@@ -1519,16 +1612,24 @@ +@@ -1618,16 +1698,24 @@ public BlockPos func_180470_cg() { @@ -401,7 +350,7 @@ if (p_180473_1_ != null) { this.field_71077_c = p_180473_1_; -@@ -1712,6 +1813,10 @@ +@@ -1822,6 +1910,10 @@ super.func_180430_e(p_180430_1_, p_180430_2_); } @@ -412,38 +361,10 @@ } protected void func_71061_d_() -@@ -1735,6 +1840,7 @@ - } - - EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.field_75627_a.get(Integer.valueOf(EntityList.func_75619_a(p_70074_1_))); -+ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.func_75621_b(p_70074_1_)); - - if (entitylist$entityegginfo != null) - { -@@ -1847,6 +1953,8 @@ - { - if (p_71008_1_ != this.field_71074_e) - { -+ p_71008_2_ = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, p_71008_1_, p_71008_2_); -+ if (p_71008_2_ <= 0) return; - this.field_71074_e = p_71008_1_; - this.field_71072_f = p_71008_2_; - -@@ -1918,6 +2026,10 @@ - this.field_181016_an = p_71049_1_.field_181016_an; - this.field_181017_ao = p_71049_1_.field_181017_ao; - this.field_181018_ap = p_71049_1_.field_181018_ap; -+ //Copy and re-init ExtendedProperties when switching dimensions. -+ this.extendedProperties = p_71049_1_.extendedProperties; -+ for (net.minecraftforge.common.IExtendedEntityProperties p : this.extendedProperties.values()) -+ p.init(this, this.field_70170_p); - } - else if (this.field_70170_p.func_82736_K().func_82766_b("keepInventory")) - { -@@ -1931,6 +2043,18 @@ +@@ -2022,6 +2114,18 @@ this.field_175152_f = p_71049_1_.field_175152_f; this.field_71078_a = p_71049_1_.field_71078_a; - this.func_70096_w().func_75692_b(10, Byte.valueOf(p_71049_1_.func_70096_w().func_75683_a(10))); + this.func_184212_Q().func_187227_b(field_184827_bp, p_71049_1_.func_184212_Q().func_187225_a(field_184827_bp)); + + this.spawnChunkMap = p_71049_1_.spawnChunkMap; + this.spawnForcedMap = p_71049_1_.spawnForcedMap; @@ -459,35 +380,19 @@ } protected boolean func_70041_e_() -@@ -1968,7 +2092,14 @@ +@@ -2120,7 +2224,10 @@ - public void func_70062_b(int p_70062_1_, ItemStack p_70062_2_) + public ITextComponent func_145748_c_() { -- this.field_71071_by.field_70460_b[p_70062_1_] = p_70062_2_; -+ if (p_70062_1_ == 0) //Forge: Fix issue in Player where it doen't take into account selected item -+ { -+ this.field_71071_by.field_70462_a[this.field_71071_by.field_70461_c] = p_70062_2_; -+ } -+ else -+ { -+ this.field_71071_by.field_70460_b[p_70062_1_ - 1] = p_70062_2_; -+ } - } - - @SideOnly(Side.CLIENT) -@@ -2013,7 +2144,10 @@ - - public IChatComponent func_145748_c_() - { -- IChatComponent ichatcomponent = new ChatComponentText(ScorePlayerTeam.func_96667_a(this.func_96124_cp(), this.func_70005_c_())); -+ IChatComponent ichatcomponent = new ChatComponentText(""); -+ if (!prefixes.isEmpty()) for (net.minecraft.util.IChatComponent prefix : prefixes) ichatcomponent.func_150257_a(prefix); -+ ichatcomponent.func_150257_a(new ChatComponentText(ScorePlayerTeam.func_96667_a(this.func_96124_cp(), this.getDisplayNameString()))); -+ if (!suffixes.isEmpty()) for (net.minecraft.util.IChatComponent suffix : suffixes) ichatcomponent.func_150257_a(suffix); - ichatcomponent.func_150256_b().func_150241_a(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.func_70005_c_() + " ")); - ichatcomponent.func_150256_b().func_150209_a(this.func_174823_aP()); - ichatcomponent.func_150256_b().func_179989_a(this.func_70005_c_()); -@@ -2022,7 +2156,7 @@ +- ITextComponent itextcomponent = new TextComponentString(ScorePlayerTeam.func_96667_a(this.func_96124_cp(), this.func_70005_c_())); ++ ITextComponent itextcomponent = new TextComponentString(""); ++ if (!prefixes.isEmpty()) for (ITextComponent prefix : prefixes) itextcomponent.func_150257_a(prefix); ++ itextcomponent.func_150257_a(new TextComponentString(ScorePlayerTeam.func_96667_a(this.func_96124_cp(), this.func_70005_c_()))); ++ if (!suffixes.isEmpty()) for (ITextComponent suffix : suffixes) itextcomponent.func_150257_a(suffix); + itextcomponent.func_150256_b().func_150241_a(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.func_70005_c_() + " ")); + itextcomponent.func_150256_b().func_150209_a(this.func_174823_aP()); + itextcomponent.func_150256_b().func_179989_a(this.func_70005_c_()); +@@ -2129,7 +2236,7 @@ public float func_70047_e() { @@ -496,8 +401,8 @@ if (this.func_70608_bn()) { -@@ -2155,6 +2289,136 @@ - this.field_175153_bG = p_175150_1_; +@@ -2340,6 +2447,136 @@ + return (float)this.func_110148_a(SharedMonsterAttributes.field_188792_h).func_111126_e(); } + /** @@ -610,23 +515,23 @@ + this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.func_70005_c_()); + } + -+ private final java.util.Collection prefixes = new java.util.LinkedList(); -+ private final java.util.Collection suffixes = new java.util.LinkedList(); ++ private final java.util.Collection prefixes = new java.util.LinkedList(); ++ private final java.util.Collection suffixes = new java.util.LinkedList(); + + /** + * Add a prefix to the player's username in chat + * @param prefix The prefix + */ -+ public void addPrefix(net.minecraft.util.IChatComponent prefix) { prefixes.add(prefix); } ++ public void addPrefix(ITextComponent prefix) { prefixes.add(prefix); } + + /** + * Add a suffix to the player's username in chat + * @param suffix The suffix + */ -+ public void addSuffix(net.minecraft.util.IChatComponent suffix) { suffixes.add(suffix); } ++ public void addSuffix(ITextComponent suffix) { suffixes.add(suffix); } + -+ public java.util.Collection getPrefixes() { return this.prefixes; } -+ public java.util.Collection getSuffixes() { return this.suffixes; } ++ public java.util.Collection getPrefixes() { return this.prefixes; } ++ public java.util.Collection getSuffixes() { return this.suffixes; } + + /* ======================================== FORGE END =====================================*/ + diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch index 0dd5fb674a..e61f8cfbae 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java +++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -@@ -123,14 +123,15 @@ +@@ -134,14 +134,15 @@ public int field_71138_i; public boolean field_71136_j; + @SuppressWarnings("unused") - public EntityPlayerMP(MinecraftServer p_i45285_1_, WorldServer p_i45285_2_, GameProfile p_i45285_3_, ItemInWorldManager p_i45285_4_) + public EntityPlayerMP(MinecraftServer p_i45285_1_, WorldServer p_i45285_2_, GameProfile p_i45285_3_, PlayerInteractionManager p_i45285_4_) { super(p_i45285_2_, p_i45285_3_); p_i45285_4_.field_73090_b = this; @@ -16,9 +16,9 @@ - if (!p_i45285_2_.field_73011_w.func_177495_o() && p_i45285_2_.func_72912_H().func_76077_q() != WorldSettings.GameType.ADVENTURE) + if (false && !p_i45285_2_.field_73011_w.func_177495_o() && p_i45285_2_.func_72912_H().func_76077_q() != WorldSettings.GameType.ADVENTURE) { - int i = Math.max(5, p_i45285_1_.func_82357_ak() - 6); + int i = Math.max(0, p_i45285_1_.func_184108_a(p_i45285_2_)); int j = MathHelper.func_76128_c(p_i45285_2_.func_175723_af().func_177729_b((double)blockpos.func_177958_n(), (double)blockpos.func_177952_p())); -@@ -223,7 +224,7 @@ +@@ -250,7 +251,7 @@ this.field_71070_bA.func_75142_b(); @@ -27,25 +27,17 @@ { this.func_71053_j(); this.field_71070_bA = this.field_71069_bz; -@@ -294,6 +295,7 @@ - for (Chunk chunk1 : list) - { - this.func_71121_q().func_73039_n().func_85172_a(this, chunk1); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(chunk1.func_76632_l(), this)); - } - } - } -@@ -424,6 +426,7 @@ +@@ -433,6 +434,7 @@ public void func_70645_a(DamageSource p_70645_1_) { + if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; - if (this.field_70170_p.func_82736_K().func_82766_b("showDeathMessages")) - { - Team team = this.func_96124_cp(); -@@ -447,7 +450,20 @@ + boolean flag = this.field_70170_p.func_82736_K().func_82766_b("showDeathMessages"); + this.field_71135_a.func_147359_a(new SPacketCombatEvent(this.func_110142_aN(), SPacketCombatEvent.Event.ENTITY_DIED, flag)); - if (!this.field_70170_p.func_82736_K().func_82766_b("keepInventory")) +@@ -459,7 +461,20 @@ + + if (!this.field_70170_p.func_82736_K().func_82766_b("keepInventory") && !this.func_175149_v()) { + captureDrops = true; + capturedDrops.clear(); @@ -58,29 +50,30 @@ + { + for (net.minecraft.entity.item.EntityItem item : capturedDrops) + { -+ func_71012_a(item); ++ this.field_70170_p.func_72838_d(item); + } + } } - for (ScoreObjective scoreobjective : this.field_70170_p.func_96441_U().func_96520_a(IScoreObjectiveCriteria.field_96642_c)) -@@ -461,6 +477,7 @@ - if (entitylivingbase != null) - { - EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.field_75627_a.get(Integer.valueOf(EntityList.func_75619_a(entitylivingbase))); -+ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.func_75621_b(entitylivingbase)); + for (ScoreObjective scoreobjective : this.field_70170_p.func_96441_U().func_96520_a(IScoreCriteria.field_96642_c)) +@@ -540,6 +555,7 @@ - if (entitylist$entityegginfo != null) - { -@@ -528,6 +545,7 @@ - - public void func_71027_c(int p_71027_1_) + public Entity func_184204_a(int p_184204_1_) { -+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_71027_1_)) return; - if (this.field_71093_bK == 1 && p_71027_1_ == 1) ++ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return this; + this.field_184851_cj = true; + + if (this.field_71093_bK == 1 && p_184204_1_ == 1) +@@ -697,7 +713,7 @@ + BlockPos blockpos = new BlockPos(i, j, k); + IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); + +- if (iblockstate.func_185904_a() == Material.field_151579_a) ++ if (iblockstate.func_177230_c().isAir(iblockstate, this.field_70170_p, blockpos)) { - this.func_71029_a(AchievementList.field_76003_C); -@@ -831,6 +849,7 @@ + BlockPos blockpos1 = blockpos.func_177977_b(); + IBlockState iblockstate1 = this.field_70170_p.func_180495_p(blockpos1); +@@ -921,6 +937,7 @@ { if (p_71064_1_ != null) { diff --git a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch index f597943110..879c821bdc 100644 --- a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch @@ -1,22 +1,23 @@ --- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java +++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java -@@ -272,12 +272,8 @@ - { - if (this.field_70462_a[j] == null) +@@ -270,13 +270,8 @@ + + if (itemstack == null) { -- this.field_70462_a[j] = new ItemStack(item, 0, p_70452_1_.func_77960_j()); +- itemstack = new ItemStack(item, 0, p_70452_1_.func_77960_j()); - - if (p_70452_1_.func_77942_o()) - { -- this.field_70462_a[j].func_77982_d((NBTTagCompound)p_70452_1_.func_77978_p().func_74737_b()); +- itemstack.func_77982_d((NBTTagCompound)p_70452_1_.func_77978_p().func_74737_b()); - } -+ this.field_70462_a[j] = p_70452_1_.func_77946_l(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up. -+ this.field_70462_a[j].field_77994_a = 0; +- ++ itemstack = p_70452_1_.func_77946_l(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up. ++ itemstack.field_77994_a = 0; + this.func_70299_a(j, itemstack); } - int k = i; -@@ -315,6 +311,14 @@ - this.field_70462_a[i].func_77945_a(this.field_70458_d.field_70170_p, this.field_70458_d, i, this.field_70461_c == i); +@@ -344,6 +339,14 @@ + } } } + @@ -29,4 +30,4 @@ + } } - public boolean func_146026_a(Item p_146026_1_) + public boolean func_70441_a(final ItemStack p_70441_1_) diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch b/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch deleted file mode 100644 index b859938dab..0000000000 --- a/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/projectile/EntityFishHook.java -+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityFishHook.java -@@ -567,11 +567,19 @@ - } - } - -+ @SuppressWarnings("unused") - private ItemStack func_146033_f() - { - float f = this.field_70170_p.field_73012_v.nextFloat(); - int i = EnchantmentHelper.func_151386_g(this.field_146042_b); - int j = EnchantmentHelper.func_151387_h(this.field_146042_b); -+ -+ if (true) -+ { -+ this.field_146042_b.func_71064_a(net.minecraftforge.common.FishingHooks.getFishableCategory(f, i, j).stat, 1); -+ return net.minecraftforge.common.FishingHooks.getRandomFishable(this.field_70146_Z, f, i, j); -+ } -+ - float f1 = 0.1F - (float)i * 0.025F - (float)j * 0.01F; - float f2 = 0.05F + (float)i * 0.01F - (float)j * 0.01F; - f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); diff --git a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch index 4b2ed93f31..ab15f50df9 100644 --- a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch +++ b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/init/Bootstrap.java +++ ../src-work/minecraft/net/minecraft/init/Bootstrap.java -@@ -65,6 +65,7 @@ +@@ -74,6 +74,7 @@ return field_151355_a; } @@ -8,12 +8,35 @@ static void func_151353_a() { BlockDispenser.field_149943_a.func_82595_a(Items.field_151032_g, new BehaviorProjectileDispense() -@@ -78,23 +79,23 @@ +@@ -87,9 +88,9 @@ + }); + BlockDispenser.field_149943_a.func_82595_a(Items.field_185167_i, new BehaviorProjectileDispense() + { +- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack p_82499_3_) + { +- EntityTippedArrow entitytippedarrow = new EntityTippedArrow(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); ++ EntityTippedArrow entitytippedarrow = new EntityTippedArrow(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); + entitytippedarrow.func_184555_a(p_82499_3_); + entitytippedarrow.field_70251_a = EntityArrow.PickupStatus.ALLOWED; + return entitytippedarrow; +@@ -97,32 +98,32 @@ + }); + BlockDispenser.field_149943_a.func_82595_a(Items.field_185166_h, new BehaviorProjectileDispense() + { +- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack p_82499_3_) + { +- EntityArrow entityarrow = new EntitySpectralArrow(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); ++ EntityArrow entityarrow = new EntitySpectralArrow(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); + entityarrow.field_70251_a = EntityArrow.PickupStatus.ALLOWED; + return entityarrow; + } }); BlockDispenser.field_149943_a.func_82595_a(Items.field_151110_aK, new BehaviorProjectileDispense() { -- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position) +- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack p_82499_3_) { - return new EntityEgg(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); + return new EntityEgg(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); @@ -21,8 +44,8 @@ }); BlockDispenser.field_149943_a.func_82595_a(Items.field_151126_ay, new BehaviorProjectileDispense() { -- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position) +- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack p_82499_3_) { - return new EntitySnowball(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); + return new EntitySnowball(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); @@ -30,85 +53,84 @@ }); BlockDispenser.field_149943_a.func_82595_a(Items.field_151062_by, new BehaviorProjectileDispense() { -- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position) +- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack p_82499_3_) { - return new EntityExpBottle(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); + return new EntityExpBottle(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); } protected float func_82498_a() { -@@ -108,13 +109,13 @@ - BlockDispenser.field_149943_a.func_82595_a(Items.field_151068_bn, new IBehaviorDispenseItem() +@@ -135,13 +136,13 @@ + }); + BlockDispenser.field_149943_a.func_82595_a(Items.field_185155_bH, new IBehaviorDispenseItem() { - private final BehaviorDefaultDispenseItem field_150843_b = new BehaviorDefaultDispenseItem(); - public ItemStack func_82482_a(IBlockSource p_82482_1_, final ItemStack p_82482_2_) + public ItemStack func_82482_a(IBlockSource source, final ItemStack stack) { -- return ItemPotion.func_77831_g(p_82482_2_.func_77960_j()) ? (new BehaviorProjectileDispense() -+ return ItemPotion.func_77831_g(stack.func_77960_j()) ? (new BehaviorProjectileDispense() + return (new BehaviorProjectileDispense() { -- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position) +- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack p_82499_3_) { - return new EntityPotion(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c(), p_82482_2_.func_77946_l()); + return new EntityPotion(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c(), stack.func_77946_l()); } protected float func_82498_a() { -@@ -124,7 +125,7 @@ +@@ -151,18 +152,18 @@ { return super.func_82500_b() * 1.25F; } -- }).func_82482_a(p_82482_1_, p_82482_2_): this.field_150843_b.func_82482_a(p_82482_1_, p_82482_2_); -+ }).func_82482_a(source, stack): this.field_150843_b.func_82482_a(source, stack); +- }).func_82482_a(p_82482_1_, p_82482_2_); ++ }).func_82482_a(source, stack); + } + }); + BlockDispenser.field_149943_a.func_82595_a(Items.field_185156_bI, new IBehaviorDispenseItem() + { +- public ItemStack func_82482_a(IBlockSource p_82482_1_, final ItemStack p_82482_2_) ++ public ItemStack func_82482_a(IBlockSource source, final ItemStack stack) + { + return (new BehaviorProjectileDispense() + { +- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack p_82499_3_) + { +- return new EntityPotion(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c(), p_82482_2_.func_77946_l()); ++ return new EntityPotion(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c(), stack.func_77946_l()); + } + protected float func_82498_a() + { +@@ -172,7 +173,7 @@ + { + return super.func_82500_b() * 1.25F; + } +- }).func_82482_a(p_82482_1_, p_82482_2_); ++ }).func_82482_a(source, stack); } }); BlockDispenser.field_149943_a.func_82595_a(Items.field_151063_bx, new BehaviorDefaultDispenseItem() -@@ -135,7 +136,7 @@ - double d0 = p_82487_1_.func_82615_a() + (double)enumfacing.func_82601_c(); - double d1 = (double)((float)p_82487_1_.func_180699_d().func_177956_o() + 0.2F); - double d2 = p_82487_1_.func_82616_c() + (double)enumfacing.func_82599_e(); -- Entity entity = ItemMonsterPlacer.func_77840_a(p_82487_1_.func_82618_k(), p_82487_2_.func_77960_j(), d0, d1, d2); -+ Entity entity = ItemMonsterPlacer.spawnCreature(p_82487_1_.func_82618_k(), ItemMonsterPlacer.getEntityName(p_82487_2_), d0, d1, d2); - - if (entity instanceof EntityLivingBase && p_82487_2_.func_82837_s()) - { -@@ -190,14 +191,14 @@ - BlockDispenser.field_149943_a.func_82595_a(Items.field_151124_az, new BehaviorDefaultDispenseItem() +@@ -215,25 +216,25 @@ + }); + BlockDispenser.field_149943_a.func_82595_a(Items.field_151059_bz, new BehaviorDefaultDispenseItem() { - private final BehaviorDefaultDispenseItem field_150842_b = new BehaviorDefaultDispenseItem(); - public ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) + public ItemStack func_82487_b(IBlockSource source, ItemStack stack) { - EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.func_82620_h()); -- World world = p_82487_1_.func_82618_k(); -- double d0 = p_82487_1_.func_82615_a() + (double)((float)enumfacing.func_82601_c() * 1.125F); -- double d1 = p_82487_1_.func_82617_b() + (double)((float)enumfacing.func_96559_d() * 1.125F); -- double d2 = p_82487_1_.func_82616_c() + (double)((float)enumfacing.func_82599_e() * 1.125F); -- BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(enumfacing); +- IPosition iposition = BlockDispenser.func_149939_a(p_82487_1_); + EnumFacing enumfacing = BlockDispenser.func_149937_b(source.func_82620_h()); ++ IPosition iposition = BlockDispenser.func_149939_a(source); + double d0 = iposition.func_82615_a() + (double)((float)enumfacing.func_82601_c() * 0.3F); + double d1 = iposition.func_82617_b() + (double)((float)enumfacing.func_96559_d() * 0.3F); + double d2 = iposition.func_82616_c() + (double)((float)enumfacing.func_82599_e() * 0.3F); +- World world = p_82487_1_.func_82618_k(); + World world = source.func_82618_k(); -+ double d0 = source.func_82615_a() + (double)((float)enumfacing.func_82601_c() * 1.125F); -+ double d1 = source.func_82617_b() + (double)((float)enumfacing.func_96559_d() * 1.125F); -+ double d2 = source.func_82616_c() + (double)((float)enumfacing.func_82599_e() * 1.125F); -+ BlockPos blockpos = source.func_180699_d().func_177972_a(enumfacing); - Material material = world.func_180495_p(blockpos).func_177230_c().func_149688_o(); - double d3; - -@@ -209,7 +210,7 @@ - { - if (!Material.field_151579_a.equals(material) || !Material.field_151586_h.equals(world.func_180495_p(blockpos.func_177977_b()).func_177230_c().func_149688_o())) - { -- return this.field_150842_b.func_82482_a(p_82487_1_, p_82487_2_); -+ return this.field_150842_b.func_82482_a(source, stack); - } - - d3 = 0.0D; -@@ -217,31 +218,31 @@ - - EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2); - world.func_72838_d(entityboat); + Random random = world.field_73012_v; + double d3 = random.nextGaussian() * 0.05D + (double)enumfacing.func_82601_c(); + double d4 = random.nextGaussian() * 0.05D + (double)enumfacing.func_96559_d(); + double d5 = random.nextGaussian() * 0.05D + (double)enumfacing.func_82599_e(); + world.func_72838_d(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5)); - p_82487_2_.func_77979_a(1); - return p_82487_2_; + stack.func_77979_a(1); @@ -117,10 +139,12 @@ - protected void func_82485_a(IBlockSource p_82485_1_) + protected void func_82485_a(IBlockSource source) { -- p_82485_1_.func_82618_k().func_175718_b(1000, p_82485_1_.func_180699_d(), 0); -+ source.func_82618_k().func_175718_b(1000, source.func_180699_d(), 0); +- p_82485_1_.func_82618_k().func_175718_b(1018, p_82485_1_.func_180699_d(), 0); ++ source.func_82618_k().func_175718_b(1018, source.func_180699_d(), 0); } }); + BlockDispenser.field_149943_a.func_82595_a(Items.field_151124_az, new Bootstrap.BehaviorDispenseBoat(EntityBoat.Type.OAK)); +@@ -245,20 +246,20 @@ IBehaviorDispenseItem ibehaviordispenseitem = new BehaviorDefaultDispenseItem() { private final BehaviorDefaultDispenseItem field_150841_b = new BehaviorDefaultDispenseItem(); @@ -132,8 +156,8 @@ + ItemBucket itembucket = (ItemBucket)stack.func_77973_b(); + BlockPos blockpos = source.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(source.func_82620_h())); -- if (itembucket.func_180616_a(p_82487_1_.func_82618_k(), blockpos)) -+ if (itembucket.func_180616_a(source.func_82618_k(), blockpos)) +- if (itembucket.func_180616_a((EntityPlayer)null, p_82487_1_.func_82618_k(), blockpos)) ++ if (itembucket.func_180616_a((EntityPlayer)null, source.func_82618_k(), blockpos)) { - p_82487_2_.func_150996_a(Items.field_151133_ar); - p_82487_2_.field_77994_a = 1; @@ -149,7 +173,7 @@ } } }; -@@ -250,10 +251,10 @@ +@@ -267,10 +268,10 @@ BlockDispenser.field_149943_a.func_82595_a(Items.field_151133_ar, new BehaviorDefaultDispenseItem() { private final BehaviorDefaultDispenseItem field_150840_b = new BehaviorDefaultDispenseItem(); @@ -162,8 +186,8 @@ + BlockPos blockpos = source.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(source.func_82620_h())); IBlockState iblockstate = world.func_180495_p(blockpos); Block block = iblockstate.func_177230_c(); - Material material = block.func_149688_o(); -@@ -267,7 +268,7 @@ + Material material = iblockstate.func_185904_a(); +@@ -284,7 +285,7 @@ { if (!Material.field_151587_i.equals(material) || !(block instanceof BlockLiquid) || ((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue() != 0) { @@ -172,7 +196,7 @@ } item = Items.field_151129_at; -@@ -275,34 +276,34 @@ +@@ -292,34 +293,34 @@ world.func_175698_g(blockpos); @@ -218,7 +242,7 @@ } } else if (world.func_180495_p(blockpos).func_177230_c() == Blocks.field_150335_W) -@@ -315,17 +316,17 @@ +@@ -332,31 +333,31 @@ this.field_150839_b = false; } @@ -240,8 +264,36 @@ } } }); -@@ -358,15 +359,15 @@ - return super.func_82487_b(p_82487_1_, p_82487_2_); + BlockDispenser.field_149943_a.func_82595_a(Items.field_151100_aR, new BehaviorDefaultDispenseItem() + { + private boolean field_150838_b = true; +- protected ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) ++ protected ItemStack func_82487_b(IBlockSource source, ItemStack stack) + { +- if (EnumDyeColor.WHITE == EnumDyeColor.func_176766_a(p_82487_2_.func_77960_j())) ++ if (EnumDyeColor.WHITE == EnumDyeColor.func_176766_a(stack.func_77960_j())) + { +- World world = p_82487_1_.func_82618_k(); +- BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(p_82487_1_.func_82620_h())); ++ World world = source.func_82618_k(); ++ BlockPos blockpos = source.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(source.func_82620_h())); + +- if (ItemDye.func_179234_a(p_82487_2_, world, blockpos)) ++ if (ItemDye.func_179234_a(stack, world, blockpos)) + { + if (!world.field_72995_K) + { +@@ -368,49 +369,49 @@ + this.field_150838_b = false; + } + +- return p_82487_2_; ++ return stack; + } + else + { +- return super.func_82487_b(p_82487_1_, p_82487_2_); ++ return super.func_82487_b(source, stack); } } - protected void func_82485_a(IBlockSource p_82485_1_) @@ -255,6 +307,119 @@ else { - p_82485_1_.func_82618_k().func_175718_b(1001, p_82485_1_.func_180699_d(), 0); ++ source.func_82618_k().func_175718_b(1001, source.func_180699_d(), 0); + } + } + }); + BlockDispenser.field_149943_a.func_82595_a(Item.func_150898_a(Blocks.field_150335_W), new BehaviorDefaultDispenseItem() + { +- protected ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) ++ protected ItemStack func_82487_b(IBlockSource source, ItemStack stack) + { +- World world = p_82487_1_.func_82618_k(); +- BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(p_82487_1_.func_82620_h())); ++ World world = source.func_82618_k(); ++ BlockPos blockpos = source.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(source.func_82620_h())); + EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o(), (double)blockpos.func_177952_p() + 0.5D, (EntityLivingBase)null); + world.func_72838_d(entitytntprimed); + world.func_184148_a((EntityPlayer)null, entitytntprimed.field_70165_t, entitytntprimed.field_70163_u, entitytntprimed.field_70161_v, SoundEvents.field_187904_gd, SoundCategory.BLOCKS, 1.0F, 1.0F); +- --p_82487_2_.field_77994_a; +- return p_82487_2_; ++ --stack.field_77994_a; ++ return stack; + } + }); + BlockDispenser.field_149943_a.func_82595_a(Items.field_151144_bL, new BehaviorDefaultDispenseItem() + { + private boolean field_179240_b = true; +- protected ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) ++ protected ItemStack func_82487_b(IBlockSource source, ItemStack stack) + { +- World world = p_82487_1_.func_82618_k(); +- EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.func_82620_h()); +- BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(enumfacing); ++ World world = source.func_82618_k(); ++ EnumFacing enumfacing = BlockDispenser.func_149937_b(source.func_82620_h()); ++ BlockPos blockpos = source.func_180699_d().func_177972_a(enumfacing); + BlockSkull blockskull = Blocks.field_150465_bP; + +- if (world.func_175623_d(blockpos) && blockskull.func_176415_b(world, blockpos, p_82487_2_)) ++ if (world.func_175623_d(blockpos) && blockskull.func_176415_b(world, blockpos, stack)) + { + if (!world.field_72995_K) + { +@@ -419,13 +420,13 @@ + + if (tileentity instanceof TileEntitySkull) + { +- if (p_82487_2_.func_77960_j() == 3) ++ if (stack.func_77960_j() == 3) + { + GameProfile gameprofile = null; + +- if (p_82487_2_.func_77942_o()) ++ if (stack.func_77942_o()) + { +- NBTTagCompound nbttagcompound = p_82487_2_.func_77978_p(); ++ NBTTagCompound nbttagcompound = stack.func_77978_p(); + + if (nbttagcompound.func_150297_b("SkullOwner", 10)) + { +@@ -446,32 +447,32 @@ + } + else + { +- ((TileEntitySkull)tileentity).func_152107_a(p_82487_2_.func_77960_j()); ++ ((TileEntitySkull)tileentity).func_152107_a(stack.func_77960_j()); + } + + ((TileEntitySkull)tileentity).func_145903_a(enumfacing.func_176734_d().func_176736_b() * 4); + Blocks.field_150465_bP.func_180679_a(world, blockpos, (TileEntitySkull)tileentity); + } + +- --p_82487_2_.field_77994_a; ++ --stack.field_77994_a; + } + } +- else if (ItemArmor.func_185082_a(p_82487_1_, p_82487_2_) == null) ++ else if (ItemArmor.func_185082_a(source, stack) == null) + { + this.field_179240_b = false; + } + +- return p_82487_2_; ++ return stack; + } +- protected void func_82485_a(IBlockSource p_82485_1_) ++ protected void func_82485_a(IBlockSource source) + { + if (this.field_179240_b) + { +- p_82485_1_.func_82618_k().func_175718_b(1000, p_82485_1_.func_180699_d(), 0); ++ source.func_82618_k().func_175718_b(1000, source.func_180699_d(), 0); + } + else + { +- p_82485_1_.func_82618_k().func_175718_b(1001, p_82485_1_.func_180699_d(), 0); ++ source.func_82618_k().func_175718_b(1001, source.func_180699_d(), 0); + } + } + }); +@@ -505,15 +506,15 @@ + + return p_82487_2_; + } +- protected void func_82485_a(IBlockSource p_82485_1_) ++ protected void func_82485_a(IBlockSource source) + { + if (this.field_179241_b) + { +- p_82485_1_.func_82618_k().func_175718_b(1000, p_82485_1_.func_180699_d(), 0); ++ source.func_82618_k().func_175718_b(1000, source.func_180699_d(), 0); + } + else + { +- p_82485_1_.func_82618_k().func_175718_b(1001, p_82485_1_.func_180699_d(), 0); + source.func_82618_k().func_175718_b(1001, source.func_180699_d(), 0); } } diff --git a/patches/minecraft/net/minecraft/inventory/Container.java.patch b/patches/minecraft/net/minecraft/inventory/Container.java.patch index 0fdc592c4e..a14906ef94 100644 --- a/patches/minecraft/net/minecraft/inventory/Container.java.patch +++ b/patches/minecraft/net/minecraft/inventory/Container.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/Container.java +++ ../src-work/minecraft/net/minecraft/inventory/Container.java -@@ -608,7 +608,7 @@ +@@ -646,7 +646,7 @@ Slot slot1 = (Slot)this.field_75151_b.get(i); ItemStack itemstack1 = slot1.func_75211_c(); diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch index 4e3f446a32..cf54412a45 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch @@ -1,29 +1,21 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerBrewingStand.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java -@@ -154,7 +154,7 @@ +@@ -196,7 +196,7 @@ - public boolean func_75214_a(ItemStack p_75214_1_) - { -- return p_75214_1_ != null ? p_75214_1_.func_77973_b().func_150892_m(p_75214_1_) : false; -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_75214_1_); - } - - public int func_75219_a() -@@ -185,7 +185,7 @@ - - public void func_82870_a(EntityPlayer p_82870_1_, ItemStack p_82870_2_) + public boolean func_75214_a(ItemStack p_75214_1_) { -- if (p_82870_2_.func_77973_b() == Items.field_151068_bn && p_82870_2_.func_77960_j() > 0) -+ if (p_82870_2_.func_77973_b() instanceof net.minecraft.item.ItemPotion && p_82870_2_.func_77960_j() > 0) - { - this.field_75244_a.func_71029_a(AchievementList.field_76001_A); +- return p_75214_1_ != null && PotionHelper.func_185205_a(p_75214_1_); ++ return p_75214_1_ != null && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_75214_1_); + } + + public int func_75219_a() +@@ -243,8 +243,7 @@ + } + else + { +- Item item = p_75243_0_.func_77973_b(); +- return item == Items.field_151068_bn || item == Items.field_151069_bo || item == Items.field_185155_bH || item == Items.field_185156_bI; ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_75243_0_); } -@@ -195,7 +195,7 @@ - - public static boolean func_75243_a_(ItemStack p_75243_0_) - { -- return p_75243_0_ != null && (p_75243_0_.func_77973_b() == Items.field_151068_bn || p_75243_0_.func_77973_b() == Items.field_151069_bo); -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_75243_0_); } } - } diff --git a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch index 79534c19de..6eb1cab477 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerEnchantment.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerEnchantment.java -@@ -65,9 +65,12 @@ +@@ -68,9 +68,12 @@ }); this.func_75146_a(new Slot(this.field_75168_e, 1, 35, 47) { @@ -14,7 +14,7 @@ } }); -@@ -146,6 +149,7 @@ +@@ -155,6 +158,7 @@ if (!this.field_75172_h.field_72995_K) { int l = 0; @@ -22,7 +22,7 @@ for (int j = -1; j <= 1; ++j) { -@@ -153,37 +157,14 @@ +@@ -162,37 +166,14 @@ { if ((j != 0 || k != 0) && this.field_75172_h.func_175623_d(this.field_178150_j.func_177982_a(k, 0, j)) && this.field_75172_h.func_175623_d(this.field_178150_j.func_177982_a(k, 1, j))) { @@ -66,12 +66,12 @@ } } } -@@ -193,7 +174,7 @@ +@@ -202,7 +183,7 @@ for (int i1 = 0; i1 < 3; ++i1) { - this.field_75167_g[i1] = EnchantmentHelper.func_77514_a(this.field_75169_l, i1, l, itemstack); + this.field_75167_g[i1] = EnchantmentHelper.func_77514_a(this.field_75169_l, i1, (int)power, itemstack); - this.field_178151_h[i1] = -1; + this.field_185001_h[i1] = -1; + this.field_185002_i[i1] = -1; - if (this.field_75167_g[i1] < i1 + 1) diff --git a/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch index b34ce82312..a77e0a042f 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch @@ -1,12 +1,12 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerPlayer.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerPlayer.java -@@ -43,7 +43,8 @@ - } - public boolean func_75214_a(ItemStack p_75214_1_) - { -- return p_75214_1_ == null ? false : (p_75214_1_.func_77973_b() instanceof ItemArmor ? ((ItemArmor)p_75214_1_.func_77973_b()).field_77881_a == k_f : (p_75214_1_.func_77973_b() != Item.func_150898_a(Blocks.field_150423_aK) && p_75214_1_.func_77973_b() != Items.field_151144_bL ? false : k_f == 0)); -+ if (p_75214_1_ == null) return false; -+ return p_75214_1_.func_77973_b().isValidArmor(p_75214_1_, k_f, field_82862_h); +@@ -48,8 +48,7 @@ + } + else + { +- EntityEquipmentSlot entityequipmentslot1 = EntityLiving.func_184640_d(p_75214_1_); +- return entityequipmentslot1 == entityequipmentslot; ++ return p_75214_1_.func_77973_b().isValidArmor(p_75214_1_, entityequipmentslot, field_82862_h); + } } @SideOnly(Side.CLIENT) - public String func_178171_c() diff --git a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch index aad74b86da..78d93064aa 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerRepair.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerRepair.java -@@ -70,6 +70,8 @@ +@@ -69,6 +69,8 @@ p_82870_1_.func_82242_a(-ContainerRepair.this.field_82854_e); } @@ -9,7 +9,7 @@ ContainerRepair.this.field_82853_g.func_70299_a(0, (ItemStack)null); if (ContainerRepair.this.field_82856_l > 0) -@@ -94,7 +96,7 @@ +@@ -93,7 +95,7 @@ ContainerRepair.this.field_82854_e = 0; IBlockState iblockstate = p_i45807_2_.func_180495_p(p_i45807_3_); @@ -18,25 +18,30 @@ { int l = ((Integer)iblockstate.func_177229_b(BlockAnvil.field_176505_b)).intValue(); ++l; -@@ -172,6 +174,7 @@ +@@ -160,10 +162,12 @@ + Map map = EnchantmentHelper.func_82781_a(itemstack1); + j = j + itemstack.func_82838_A() + (itemstack2 == null ? 0 : itemstack2.func_82838_A()); + this.field_82856_l = 0; ++ boolean flag = false; if (itemstack2 != null) { -+ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, field_82852_f, field_82857_m, i2)) return; - flag = itemstack2.func_77973_b() == Items.field_151134_bR && Items.field_151134_bR.func_92110_g(itemstack2).func_74745_c() > 0; +- boolean flag = itemstack2.func_77973_b() == Items.field_151134_bR && !Items.field_151134_bR.func_92110_g(itemstack2).func_82582_d(); ++ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, field_82852_f, field_82857_m, j)) return; ++ flag = itemstack2.func_77973_b() == Items.field_151134_bR && !Items.field_151134_bR.func_92110_g(itemstack2).func_82582_d(); if (itemstack1.func_77984_f() && itemstack1.func_77973_b().func_82789_a(itemstack, itemstack2)) -@@ -264,7 +267,8 @@ - { - int i4 = ((Integer)iterator.next()).intValue(); + { +@@ -235,7 +239,7 @@ -- if (i4 != i5 && !enchantment.func_77326_a(Enchantment.func_180306_c(i4))) -+ Enchantment e2 = Enchantment.func_180306_c(i4); -+ if (i4 != i5 && !(enchantment.func_77326_a(e2) && e2.func_77326_a(enchantment))) //Forge BugFix: Let Both enchantments veto being together + for (Enchantment enchantment : map.keySet()) + { +- if (enchantment != enchantment1 && !enchantment1.func_77326_a(enchantment)) ++ if (enchantment != enchantment1 && !(enchantment1.func_77326_a(enchantment) && enchantment.func_77326_a(enchantment1))) //Forge BugFix: Let Both enchantments veto being together { flag1 = false; - ++l1; -@@ -315,6 +319,8 @@ + ++i; +@@ -279,6 +283,8 @@ } } diff --git a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch index 58adc5a1a1..a35783d0c8 100644 --- a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch +++ b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/SlotCrafting.java +++ ../src-work/minecraft/net/minecraft/inventory/SlotCrafting.java -@@ -112,8 +112,11 @@ +@@ -107,8 +107,11 @@ public void func_82870_a(EntityPlayer p_82870_1_, ItemStack p_82870_2_) { diff --git a/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch b/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch index 33dcc7b7e7..090b18f534 100644 --- a/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch +++ b/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch @@ -8,4 +8,4 @@ + if (p_75208_1_.func_77973_b() == Items.field_151042_j) { - this.field_75229_a.func_71029_a(AchievementList.field_76016_k); + this.field_75229_a.func_71029_a(AchievementList.field_187987_k); diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 9bbc3ff944..46f446cc99 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -1,18 +1,18 @@ --- ../src-base/minecraft/net/minecraft/item/Item.java +++ ../src-work/minecraft/net/minecraft/item/Item.java -@@ -48,8 +48,8 @@ +@@ -58,8 +58,8 @@ public class Item { - public static final RegistryNamespaced field_150901_e = new RegistryNamespaced(); - private static final Map field_179220_a = Maps.newHashMap(); -+ public static final RegistryNamespaced field_150901_e = net.minecraftforge.fml.common.registry.GameData.getItemRegistry(); ++ public static final RegistryNamespaced field_150901_e = net.minecraftforge.fml.common.registry.GameData.getItemRegistry();; + private static final Map field_179220_a = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap(); - protected static final UUID field_111210_e = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); - private CreativeTabs field_77701_a; - protected static Random field_77697_d = new Random(); -@@ -61,6 +61,9 @@ - private String field_77785_bY; + private static final IItemPropertyGetter field_185046_b = new IItemPropertyGetter() + { + @SideOnly(Side.CLIENT) +@@ -104,6 +104,9 @@ + private Item field_77700_c; private String field_77774_bZ; + public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = @@ -21,7 +21,7 @@ public static int func_150891_b(Item p_150891_0_) { return p_150891_0_ == null ? 0 : field_150901_e.func_148757_b(p_150891_0_); -@@ -126,6 +129,7 @@ +@@ -192,6 +195,7 @@ return p_77654_1_; } @@ -29,7 +29,7 @@ public int func_77639_j() { return this.field_77777_bU; -@@ -239,6 +243,7 @@ +@@ -312,6 +316,7 @@ return this.field_77700_c; } @@ -37,7 +37,7 @@ public boolean func_77634_r() { return this.field_77700_c != null; -@@ -316,7 +321,7 @@ +@@ -367,7 +372,7 @@ public boolean func_77616_k(ItemStack p_77616_1_) { @@ -45,8 +45,8 @@ + return this.getItemStackLimit(p_77616_1_) == 1 && this.func_77645_m(); } - protected MovingObjectPosition func_77621_a(World p_77621_1_, EntityPlayer p_77621_2_, boolean p_77621_3_) -@@ -334,6 +339,10 @@ + protected RayTraceResult func_77621_a(World p_77621_1_, EntityPlayer p_77621_2_, boolean p_77621_3_) +@@ -385,6 +390,10 @@ float f6 = f3 * f4; float f7 = f2 * f4; double d3 = 5.0D; @@ -54,15 +54,15 @@ + { + d3 = ((net.minecraft.entity.player.EntityPlayerMP)p_77621_2_).field_71134_c.getBlockReachDistance(); + } - Vec3 vec31 = vec3.func_72441_c((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); - return p_77621_1_.func_147447_a(vec3, vec31, p_77621_3_, !p_77621_3_, false); + Vec3d vec3d1 = vec3d.func_72441_c((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); + return p_77621_1_.func_147447_a(vec3d, vec3d1, p_77621_3_, !p_77621_3_, false); } -@@ -371,11 +380,670 @@ +@@ -422,11 +431,588 @@ return false; } + @Deprecated // Use ItemStack sensitive version below. - public Multimap func_111205_h() + public Multimap func_111205_h(EntityEquipmentSlot p_111205_1_) { return HashMultimap.create(); } @@ -71,9 +71,9 @@ + /** + * ItemStack sensitive version of getItemAttributeModifiers + */ -+ public Multimap getAttributeModifiers(ItemStack stack) ++ public Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) + { -+ return this.func_111205_h(); ++ return this.func_111205_h(slot); + } + + /** @@ -96,7 +96,7 @@ + * by a user in the displayed name, such as a mode of operation. + * + * @param item the ItemStack for the item. -+ * @param the name that will be displayed unless it is changed in this method. ++ * @param displayName the name that will be displayed unless it is changed in this method. + */ + public String getHighlightTip( ItemStack item, String displayName ) + { @@ -110,25 +110,14 @@ + * @param world The Current World + * @param pos Target position + * @param side The side of the target hit -+ * @return Return true to prevent any further processing. ++ * @param hand Which hand the item is being held in. ++ * @return Return PASS to allow vanilla handling, any other to skip normal code. + */ -+ 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) + { -+ return false; ++ return EnumActionResult.PASS; + } + -+ /** -+ * Metadata-sensitive version of getStrVsBlock -+ * @param itemstack The Item Stack -+ * @param state The block state -+ * @return The damage strength -+ */ -+ public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state) -+ { -+ return func_150893_a(itemstack, state.func_177230_c()); -+ } -+ -+ + protected boolean canRepair = true; + /** + * Called by CraftingManager to determine if an item is reparable. @@ -170,7 +159,7 @@ + * @param player The Player using the item + * @param count The amount of time in tick the item has been used for continuously + */ -+ public void onUsingTick(ItemStack stack, EntityPlayer player, int count) ++ public void onUsingTick(ItemStack stack, EntityLivingBase player, int count) + { + } + @@ -190,20 +179,6 @@ + } + + /** -+ * Player, Render pass, and item usage sensitive version of getIconIndex. -+ * -+ * @param stack The item stack to get the icon for. -+ * @param player The player holding the item -+ * @param useRemaining The ticks remaining for the active item. -+ * @return Null to use default model, or a custom ModelResourceLocation for the stage of use. -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.resources.model.ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) -+ { -+ return null; -+ } -+ -+ /** + * ItemStack sensitive version of getContainerItem. + * Returns a full ItemStack instance of the result. + * @@ -308,40 +283,6 @@ + } + + /** -+ * Return the correct icon for rendering based on the supplied ItemStack and render pass. -+ * -+ * Defers to {@link #getIconFromDamageForRenderPass(int, int)} -+ * @param stack to render for -+ * @param pass the multi-render pass -+ * @return the icon -+ * / -+ public IIcon getIcon(ItemStack stack, int pass) -+ { -+ return func_77618_c(stack.getMetadata(), pass); -+ } -+ */ -+ -+ /** -+ * Generates the base Random item for a specific instance of the chest gen, -+ * Enchanted books use this to pick a random enchantment. -+ * -+ * @param chest The chest category to generate for -+ * @param rnd World RNG -+ * @param original Original result registered with the chest gen hooks. -+ * @return New values to use as the random item, typically this will be original -+ */ -+ public net.minecraft.util.WeightedRandomChestContent getChestGenBase(net.minecraftforge.common.ChestGenHooks chest, Random rnd, net.minecraft.util.WeightedRandomChestContent original) -+ { -+ if (this instanceof ItemEnchantedBook) -+ { -+ return ((ItemEnchantedBook)this).func_92112_a(rnd, -+ original.field_76295_d, -+ original.field_76296_e, original.field_76292_a); -+ } -+ return original; -+ } -+ -+ /** + * + * Should this item, when held, allow sneak-clicks to pass through to the underlying block? + * @@ -350,7 +291,7 @@ + * @param player The Player that is wielding the item + * @return + */ -+ public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player) ++ public boolean doesSneakBypassUse(ItemStack stack, net.minecraft.world.IBlockAccess world, BlockPos pos, EntityPlayer player) + { + return false; + } @@ -368,19 +309,9 @@ + * @param entity The entity trying to equip the armor + * @return True if the given ItemStack can be inserted in the slot + */ -+ public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) ++ public boolean isValidArmor(ItemStack stack, EntityEquipmentSlot armorType, Entity entity) + { -+ if (this instanceof ItemArmor) -+ { -+ return ((ItemArmor)this).field_77881_a == armorType; -+ } -+ -+ if (armorType == 0) -+ { -+ return this == Item.func_150898_a(Blocks.field_150423_aK) || this == Items.field_151144_bL; -+ } -+ -+ return false; ++ return net.minecraft.entity.EntityLiving.func_184640_d(stack) == armorType; + } + + /** @@ -408,7 +339,7 @@ + * @param type The subtype, can be null or "overlay" + * @return Path of texture to bind, or null to use default + */ -+ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) ++ public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) + { + return null; + } @@ -427,29 +358,18 @@ + } + + /** -+ * @deprecated Use 4-argument version. -+ */ -+ // remove 1.9 -+ @SideOnly(Side.CLIENT) -+ @Deprecated -+ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) -+ { -+ return null; -+ } -+ -+ /** + * Override this method to have an item handle its own armor rendering. + * + * @param entityLiving The entity wearing the armor + * @param itemStack The itemStack to render the model of -+ * @param armorSlot 0=head, 1=torso, 2=legs, 3=feet ++ * @param armorSlot The slot the armor is in + * @param _default Original armor model. Will have attributes set. + * @return A ModelBiped to render instead of the default + */ + @SideOnly(Side.CLIENT) -+ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot, net.minecraft.client.model.ModelBiped _default) ++ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, net.minecraft.client.model.ModelBiped _default) + { -+ return getArmorModel(entityLiving, itemStack, armorSlot); ++ return null; + } + + /** @@ -559,14 +479,14 @@ + } + + /** -+ * ItemStack sensitive version of {@link #canHarvestBlock(Block)} -+ * @param par1Block The block trying to harvest -+ * @param itemStack The itemstack used to harvest the block ++ * ItemStack sensitive version of {@link #canHarvestBlock(IBlockState)} ++ * @param state The block trying to harvest ++ * @param stack The itemstack used to harvest the block + * @return true if can harvest the block + */ -+ public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) ++ public boolean canHarvestBlock(IBlockState state, ItemStack stack) + { -+ return func_150897_b(par1Block); ++ return func_150897_b(state); + } + + /** @@ -574,7 +494,7 @@ + * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit() + * + * @param stack The ItemStack -+ * @return THe maximum number this item can be stacked to ++ * @return The maximum number this item can be stacked to + */ + public int getItemStackLimit(ItemStack stack) + { @@ -641,7 +561,6 @@ + return this == Items.field_151166_bC || this == Items.field_151045_i || this == Items.field_151043_k || this == Items.field_151042_j; + } + -+ + /** + * Determine if the player switching between these two item stacks + * @param oldStack The old stack that was equipped @@ -656,7 +575,6 @@ + return !ItemStack.func_77989_b(oldStack, newStack); + } + -+ + private ResourceLocation registryName = null; + /** + * Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item. @@ -728,7 +646,7 @@ public static void func_150900_l() { func_179214_a(Blocks.field_150348_b, (new ItemMultiTexture(Blocks.field_150348_b, Blocks.field_150348_b, new Function() -@@ -855,6 +1523,10 @@ +@@ -935,6 +1521,10 @@ private final float field_78011_i; private final int field_78008_j; @@ -739,21 +657,21 @@ private ToolMaterial(int p_i1874_3_, int p_i1874_4_, float p_i1874_5_, float p_i1874_6_, int p_i1874_7_) { this.field_78001_f = p_i1874_3_; -@@ -889,9 +1561,36 @@ +@@ -969,9 +1559,36 @@ return this.field_78008_j; } + @Deprecated // Use getRepairItemStack below public Item func_150995_f() { -- return this == WOOD ? Item.func_150898_a(Blocks.field_150344_f) : (this == STONE ? Item.func_150898_a(Blocks.field_150347_e) : (this == GOLD ? Items.field_151043_k : (this == IRON ? Items.field_151042_j : (this == EMERALD ? Items.field_151045_i : null)))); +- return this == WOOD ? Item.func_150898_a(Blocks.field_150344_f) : (this == STONE ? Item.func_150898_a(Blocks.field_150347_e) : (this == GOLD ? Items.field_151043_k : (this == IRON ? Items.field_151042_j : (this == DIAMOND ? Items.field_151045_i : null)))); + switch (this) + { + case WOOD: return Item.func_150898_a(Blocks.field_150344_f); + case STONE: return Item.func_150898_a(Blocks.field_150347_e); + case GOLD: return Items.field_151043_k; + case IRON: return Items.field_151042_j; -+ case EMERALD: return Items.field_151045_i; ++ case DIAMOND: return Items.field_151045_i; + default: return customCraftingMaterial; + } } @@ -761,7 +679,7 @@ + public ToolMaterial setRepairItem(ItemStack stack) + { + if (this.repairMaterial != null || customCraftingMaterial != null) throw new RuntimeException("Can not change already set repair material"); -+ if (this == WOOD || this == STONE || this == GOLD || this == IRON || this == EMERALD) throw new RuntimeException("Can not change vanilla tool repair materials"); ++ if (this == WOOD || this == STONE || this == GOLD || this == IRON || this == DIAMOND) throw new RuntimeException("Can not change vanilla tool repair materials"); + this.repairMaterial = stack; + this.customCraftingMaterial = stack.func_77973_b(); + return this; diff --git a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch index c81e15e772..8559d5846b 100644 --- a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch @@ -1,34 +1,15 @@ --- ../src-base/minecraft/net/minecraft/item/ItemArmor.java +++ ../src-work/minecraft/net/minecraft/item/ItemArmor.java -@@ -37,7 +37,7 @@ - if (list.size() > 0) - { - EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0); -- int l = entitylivingbase instanceof EntityPlayer ? 1 : 0; -+ int l = 0;// Forge: We fix the indexes. Mojang Stop hard coding this! - int i1 = EntityLiving.func_82159_b(p_82487_2_); - ItemStack itemstack = p_82487_2_.func_77946_l(); - itemstack.field_77994_a = 1; -@@ -190,7 +190,7 @@ - - if (itemstack == null) - { -- p_77659_3_.func_70062_b(i, p_77659_1_.func_77946_l()); -+ p_77659_3_.func_70062_b(i + 1, p_77659_1_.func_77946_l()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. - p_77659_1_.field_77994_a = 0; - } - -@@ -210,6 +210,9 @@ +@@ -235,6 +235,8 @@ private final int[] field_78049_g; private final int field_78055_h; - + private final SoundEvent field_185020_j; + //Added by forge for custom Armor materials. + public Item customCraftingMaterial = null; -+ - private ArmorMaterial(String p_i45789_3_, int p_i45789_4_, int[] p_i45789_5_, int p_i45789_6_) + + private ArmorMaterial(String p_i46796_3_, int p_i46796_4_, int[] p_i46796_5_, int p_i46796_6_, SoundEvent p_i46796_7_) { - this.field_179243_f = p_i45789_3_; -@@ -235,7 +238,15 @@ +@@ -267,7 +269,15 @@ public Item func_151685_b() { diff --git a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch index b87dbda549..845906f7c8 100644 --- a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBlock.java +++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java -@@ -54,16 +54,8 @@ +@@ -50,16 +50,8 @@ int i = this.func_77647_b(p_180614_1_.func_77960_j()); - IBlockState iblockstate1 = this.field_150939_a.func_180642_a(p_180614_3_, p_180614_4_, p_180614_5_, p_180614_6_, p_180614_7_, p_180614_8_, i, p_180614_2_); + IBlockState iblockstate1 = this.field_150939_a.func_180642_a(p_180614_3_, p_180614_4_, p_180614_6_, p_180614_7_, p_180614_8_, p_180614_9_, i, p_180614_2_); -- if (p_180614_3_.func_180501_a(p_180614_4_, iblockstate1, 3)) -+ if (placeBlockAt(p_180614_1_, p_180614_2_, p_180614_3_, p_180614_4_, p_180614_5_, p_180614_6_, p_180614_7_, p_180614_8_, iblockstate1)) +- if (p_180614_3_.func_180501_a(p_180614_4_, iblockstate1, 11)) ++ if (placeBlockAt(p_180614_1_, p_180614_2_, p_180614_3_, p_180614_4_, p_180614_6_, p_180614_7_, p_180614_8_, p_180614_9_, iblockstate1)) { - iblockstate1 = p_180614_3_.func_180495_p(p_180614_4_); - @@ -15,10 +15,10 @@ - this.field_150939_a.func_180633_a(p_180614_3_, p_180614_4_, iblockstate1, p_180614_2_, p_180614_1_); - } - - p_180614_3_.func_72908_a((double)((float)p_180614_4_.func_177958_n() + 0.5F), (double)((float)p_180614_4_.func_177956_o() + 0.5F), (double)((float)p_180614_4_.func_177952_p() + 0.5F), this.field_150939_a.field_149762_H.func_150496_b(), (this.field_150939_a.field_149762_H.func_150497_c() + 1.0F) / 2.0F, this.field_150939_a.field_149762_H.func_150494_d() * 0.8F); + SoundType soundtype = this.field_150939_a.func_185467_w(); + p_180614_3_.func_184133_a(p_180614_2_, p_180614_4_, soundtype.func_185841_e(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F); --p_180614_1_.field_77994_a; - } -@@ -124,7 +116,7 @@ +@@ -121,7 +113,7 @@ { Block block = p_179222_1_.func_180495_p(p_179222_2_).func_177230_c(); @@ -27,7 +27,7 @@ { p_179222_3_ = EnumFacing.UP; } -@@ -162,4 +154,26 @@ +@@ -159,4 +151,26 @@ { return this.field_150939_a; } diff --git a/patches/minecraft/net/minecraft/item/ItemBow.java.patch b/patches/minecraft/net/minecraft/item/ItemBow.java.patch index 098450a80f..d91f85c800 100644 --- a/patches/minecraft/net/minecraft/item/ItemBow.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBow.java.patch @@ -1,22 +1,31 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBow.java +++ ../src-work/minecraft/net/minecraft/item/ItemBow.java -@@ -27,6 +27,9 @@ - if (flag || p_77615_3_.field_71071_by.func_146028_b(Items.field_151032_g)) - { - int i = this.func_77626_a(p_77615_1_) - p_77615_4_; -+ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(p_77615_3_, p_77615_1_, i); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; -+ i = event.charge; - float f = (float)i / 20.0F; - f = (f * f + f * 2.0F) / 3.0F; +@@ -90,6 +90,10 @@ + boolean flag = entityplayer.field_71075_bZ.field_75098_d || EnchantmentHelper.func_77506_a(Enchantments.field_185312_x, p_77615_1_) > 0; + ItemStack itemstack = this.func_185060_a(entityplayer); -@@ -104,6 +107,9 @@ - - public ItemStack func_77659_a(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) - { -+ net.minecraftforge.event.entity.player.ArrowNockEvent event = new net.minecraftforge.event.entity.player.ArrowNockEvent(p_77659_3_, p_77659_1_); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return event.result; ++ int i = this.func_77626_a(p_77615_1_) - p_77615_4_; ++ i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(p_77615_1_, p_77615_2_, (EntityPlayer)p_77615_3_, i, itemstack != null || flag); ++ if (i < 0) return; + - if (p_77659_3_.field_71075_bZ.field_75098_d || p_77659_3_.field_71071_by.func_146028_b(Items.field_151032_g)) + if (itemstack != null || flag) + { + if (itemstack == null) +@@ -97,7 +101,6 @@ + itemstack = new ItemStack(Items.field_151032_g); + } + +- int i = this.func_77626_a(p_77615_1_) - p_77615_4_; + float f = func_185059_b(i); + + if ((double)f >= 0.1D) +@@ -189,6 +192,9 @@ + { + boolean flag = this.func_185060_a(p_77659_3_) != null; + ++ ActionResult ret = net.minecraftforge.event.ForgeEventFactory.onArrowNock(p_77659_1_, p_77659_2_, p_77659_3_, p_77659_4_, flag); ++ if (ret != null) return ret; ++ + if (!p_77659_3_.field_71075_bZ.field_75098_d && !flag) { - p_77659_3_.func_71008_a(p_77659_1_, this.func_77626_a(p_77659_1_)); + return !flag ? new ActionResult(EnumActionResult.FAIL, p_77659_1_) : new ActionResult(EnumActionResult.PASS, p_77659_1_); diff --git a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch index b2f98aa456..344645f977 100644 --- a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch @@ -1,12 +1,11 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBucket.java +++ ../src-work/minecraft/net/minecraft/item/ItemBucket.java -@@ -36,6 +36,9 @@ - } - else +@@ -36,6 +36,8 @@ + { + boolean flag = this.field_77876_a == Blocks.field_150350_a; + RayTraceResult raytraceresult = this.func_77621_a(p_77659_2_, p_77659_3_, flag); ++ ActionResult ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(p_77659_3_, p_77659_2_, p_77659_1_, raytraceresult); ++ if (ret != null) return ret; + + if (raytraceresult == null) { -+ ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(p_77659_3_, p_77659_2_, p_77659_1_, movingobjectposition); -+ if (ret != null) return ret; -+ - if (movingobjectposition.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK) - { - BlockPos blockpos = movingobjectposition.func_178782_a(); diff --git a/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch b/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch index a14a801070..3420e53274 100644 --- a/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBucketMilk.java +++ ../src-work/minecraft/net/minecraft/item/ItemBucketMilk.java -@@ -23,7 +23,7 @@ +@@ -27,7 +27,7 @@ if (!p_77654_2_.field_72995_K) { @@ -8,4 +8,4 @@ + p_77654_3_.curePotionEffects(p_77654_1_); } - p_77654_3_.func_71029_a(StatList.field_75929_E[Item.func_150891_b(this)]); + if (p_77654_3_ instanceof EntityPlayer) diff --git a/patches/minecraft/net/minecraft/item/ItemDye.java.patch b/patches/minecraft/net/minecraft/item/ItemDye.java.patch index a698baa69a..4ed0d3e9fd 100644 --- a/patches/minecraft/net/minecraft/item/ItemDye.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemDye.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemDye.java +++ ../src-work/minecraft/net/minecraft/item/ItemDye.java -@@ -47,7 +47,7 @@ +@@ -50,7 +50,7 @@ if (enumdyecolor == EnumDyeColor.WHITE) { @@ -9,36 +9,47 @@ { if (!p_180614_3_.field_72995_K) { -@@ -97,8 +97,18 @@ +@@ -97,22 +97,32 @@ public static boolean func_179234_a(ItemStack p_179234_0_, World p_179234_1_, BlockPos p_179234_2_) { +- IBlockState iblockstate = p_179234_1_.func_180495_p(p_179234_2_); + if (p_179234_1_ instanceof net.minecraft.world.WorldServer) + return applyBonemeal(p_179234_0_, p_179234_1_, p_179234_2_, net.minecraftforge.common.util.FakePlayerFactory.getMinecraft((net.minecraft.world.WorldServer)p_179234_1_)); + return false; + } -+ -+ public static boolean applyBonemeal(ItemStack p_179234_0_, World p_179234_1_, BlockPos p_179234_2_, EntityPlayer player) -+ { - IBlockState iblockstate = p_179234_1_.func_180495_p(p_179234_2_); -+ int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, p_179234_1_, p_179234_2_, iblockstate, p_179234_0_); ++ public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target, EntityPlayer player) ++ { ++ IBlockState iblockstate = worldIn.func_180495_p(target); ++ ++ int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, worldIn, target, iblockstate, stack); + if (hook != 0) return hook > 0; + if (iblockstate.func_177230_c() instanceof IGrowable) { IGrowable igrowable = (IGrowable)iblockstate.func_177230_c(); -@@ -132,7 +142,7 @@ - Block block = p_180617_0_.func_180495_p(p_180617_1_).func_177230_c(); +- if (igrowable.func_176473_a(p_179234_1_, p_179234_2_, iblockstate, p_179234_1_.field_72995_K)) ++ if (igrowable.func_176473_a(worldIn, target, iblockstate, worldIn.field_72995_K)) + { +- if (!p_179234_1_.field_72995_K) ++ if (!worldIn.field_72995_K) + { +- if (igrowable.func_180670_a(p_179234_1_, p_179234_1_.field_73012_v, p_179234_2_, iblockstate)) ++ if (igrowable.func_180670_a(worldIn, worldIn.field_73012_v, target, iblockstate)) + { +- igrowable.func_176474_b(p_179234_1_, p_179234_1_.field_73012_v, p_179234_2_, iblockstate); ++ igrowable.func_176474_b(worldIn, worldIn.field_73012_v, target, iblockstate); + } -- if (block.func_149688_o() != Material.field_151579_a) -+ if (block.isAir(p_180617_0_, p_180617_1_)) - { - block.func_180654_a(p_180617_0_, p_180617_1_); +- --p_179234_0_.field_77994_a; ++ --stack.field_77994_a; + } -@@ -144,6 +154,16 @@ - p_180617_0_.func_175688_a(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)p_180617_1_.func_177958_n() + field_77697_d.nextFloat()), (double)p_180617_1_.func_177956_o() + (double)field_77697_d.nextFloat() * block.func_149669_A(), (double)((float)p_180617_1_.func_177952_p() + field_77697_d.nextFloat()), d0, d1, d2, new int[0]); + return true; +@@ -142,6 +152,16 @@ + p_180617_0_.func_175688_a(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)p_180617_1_.func_177958_n() + field_77697_d.nextFloat()), (double)p_180617_1_.func_177956_o() + (double)field_77697_d.nextFloat() * iblockstate.func_185900_c(p_180617_0_, p_180617_1_).field_72337_e, (double)((float)p_180617_1_.func_177952_p() + field_77697_d.nextFloat()), d0, d1, d2, new int[0]); } } + else @@ -53,4 +64,4 @@ + } } - public boolean func_111207_a(ItemStack p_111207_1_, EntityPlayer p_111207_2_, EntityLivingBase p_111207_3_) + public boolean func_111207_a(ItemStack p_111207_1_, EntityPlayer p_111207_2_, EntityLivingBase p_111207_3_, EnumHand p_111207_4_) diff --git a/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch b/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch index aaf05d09de..c38e2ed9f7 100644 --- a/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/item/ItemEmptyMap.java +++ ../src-work/minecraft/net/minecraft/item/ItemEmptyMap.java -@@ -22,7 +22,7 @@ +@@ -25,7 +25,7 @@ p_77659_2_.func_72823_a(s, mapdata); mapdata.field_76197_d = 0; mapdata.func_176054_a(p_77659_3_.field_70165_t, p_77659_3_.field_70161_v, mapdata.field_76197_d); -- mapdata.field_76200_c = (byte)p_77659_2_.field_73011_w.func_177502_q(); -+ mapdata.field_76200_c = p_77659_2_.field_73011_w.func_177502_q(); +- mapdata.field_76200_c = (byte)p_77659_2_.field_73011_w.func_186058_p().func_186068_a(); ++ mapdata.field_76200_c = p_77659_2_.field_73011_w.func_186058_p().func_186068_a(); + mapdata.field_186210_e = true; mapdata.func_76185_a(); --p_77659_1_.field_77994_a; - diff --git a/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch b/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch index 624bf5ffcf..9e1f53a17e 100644 --- a/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/item/ItemFlintAndSteel.java +++ ../src-work/minecraft/net/minecraft/item/ItemFlintAndSteel.java -@@ -27,7 +27,7 @@ +@@ -31,7 +31,7 @@ } else { -- if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().func_149688_o() == Material.field_151579_a) +- if (p_180614_3_.func_180495_p(p_180614_4_).func_185904_a() == Material.field_151579_a) + if (p_180614_3_.func_175623_d(p_180614_4_)) { - p_180614_3_.func_72908_a((double)p_180614_4_.func_177958_n() + 0.5D, (double)p_180614_4_.func_177956_o() + 0.5D, (double)p_180614_4_.func_177952_p() + 0.5D, "fire.ignite", 1.0F, field_77697_d.nextFloat() * 0.4F + 0.8F); - p_180614_3_.func_175656_a(p_180614_4_, Blocks.field_150480_ab.func_176223_P()); + p_180614_3_.func_184133_a(p_180614_2_, p_180614_4_, SoundEvents.field_187649_bu, SoundCategory.BLOCKS, 1.0F, field_77697_d.nextFloat() * 0.4F + 0.8F); + p_180614_3_.func_180501_a(p_180614_4_, Blocks.field_150480_ab.func_176223_P(), 11); diff --git a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch index 3d3e201efe..98f3a2028d 100644 --- a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch @@ -1,17 +1,17 @@ --- ../src-base/minecraft/net/minecraft/item/ItemHoe.java +++ ../src-work/minecraft/net/minecraft/item/ItemHoe.java -@@ -34,10 +34,13 @@ +@@ -45,10 +45,13 @@ } else { + int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(p_180614_1_, p_180614_2_, p_180614_3_, p_180614_4_); -+ if (hook != 0) return hook > 0; ++ if (hook != 0) return hook > 0 ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; + IBlockState iblockstate = p_180614_3_.func_180495_p(p_180614_4_); Block block = iblockstate.func_177230_c(); -- if (p_180614_5_ != EnumFacing.DOWN && p_180614_3_.func_180495_p(p_180614_4_.func_177984_a()).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180614_5_ != EnumFacing.DOWN && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) +- if (p_180614_6_ != EnumFacing.DOWN && p_180614_3_.func_180495_p(p_180614_4_.func_177984_a()).func_185904_a() == Material.field_151579_a) ++ if (p_180614_6_ != EnumFacing.DOWN && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) { - if (block == Blocks.field_150349_c) + if (block == Blocks.field_150349_c || block == Blocks.field_185774_da) { diff --git a/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch b/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch index e0bd7c80cd..784e8a2963 100644 --- a/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch @@ -1,17 +1,18 @@ --- ../src-base/minecraft/net/minecraft/item/ItemLilyPad.java +++ ../src-work/minecraft/net/minecraft/item/ItemLilyPad.java -@@ -49,7 +49,14 @@ +@@ -47,6 +47,15 @@ - if (iblockstate.func_177230_c().func_149688_o() == Material.field_151586_h && ((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue() == 0 && p_77659_2_.func_175623_d(blockpos1)) + if (iblockstate.func_185904_a() == Material.field_151586_h && ((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue() == 0 && p_77659_2_.func_175623_d(blockpos1)) { + // special case for handling block placement with water lilies + net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(p_77659_2_, blockpos1); - p_77659_2_.func_175656_a(blockpos1, Blocks.field_150392_bi.func_176223_P()); ++ p_77659_2_.func_175656_a(blockpos1, Blocks.field_150392_bi.func_176223_P()); + if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(p_77659_3_, blocksnapshot, net.minecraft.util.EnumFacing.UP).isCanceled()) + { + blocksnapshot.restore(true, false); -+ return p_77659_1_; ++ return new ActionResult(EnumActionResult.FAIL, p_77659_1_); + } ++ + p_77659_2_.func_180501_a(blockpos1, Blocks.field_150392_bi.func_176223_P(), 11); if (!p_77659_3_.field_71075_bZ.field_75098_d) - { diff --git a/patches/minecraft/net/minecraft/item/ItemMap.java.patch b/patches/minecraft/net/minecraft/item/ItemMap.java.patch index c8f63dba2a..ed071b6b54 100644 --- a/patches/minecraft/net/minecraft/item/ItemMap.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemMap.java.patch @@ -4,8 +4,8 @@ mapdata = new MapData(s); mapdata.field_76197_d = 3; mapdata.func_176054_a((double)p_77873_2_.func_72912_H().func_76079_c(), (double)p_77873_2_.func_72912_H().func_76074_e(), mapdata.field_76197_d); -- mapdata.field_76200_c = (byte)p_77873_2_.field_73011_w.func_177502_q(); -+ mapdata.field_76200_c = p_77873_2_.field_73011_w.func_177502_q(); +- mapdata.field_76200_c = (byte)p_77873_2_.field_73011_w.func_186058_p().func_186068_a(); ++ mapdata.field_76200_c = p_77873_2_.field_73011_w.func_186058_p().func_186068_a(); mapdata.func_76185_a(); p_77873_2_.func_72823_a(s, mapdata); } diff --git a/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch b/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch index 589f687762..04e7c10df2 100644 --- a/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch @@ -1,113 +1,30 @@ --- ../src-base/minecraft/net/minecraft/item/ItemMonsterPlacer.java +++ ../src-work/minecraft/net/minecraft/item/ItemMonsterPlacer.java -@@ -36,7 +36,7 @@ - public String func_77653_i(ItemStack p_77653_1_) - { - String s = ("" + StatCollector.func_74838_a(this.func_77658_a() + ".name")).trim(); -- String s1 = EntityList.func_75617_a(p_77653_1_.func_77960_j()); -+ String s1 = ItemMonsterPlacer.getEntityName(p_77653_1_); - - if (s1 != null) - { -@@ -49,7 +49,7 @@ - @SideOnly(Side.CLIENT) - public int func_82790_a(ItemStack p_82790_1_, int p_82790_2_) - { -- EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.field_75627_a.get(Integer.valueOf(p_82790_1_.func_77960_j())); -+ EntityList.EntityEggInfo entitylist$entityegginfo = ItemMonsterPlacer.getEggInfo(p_82790_1_); - return entitylist$entityegginfo != null ? (p_82790_2_ == 0 ? entitylist$entityegginfo.field_75611_b : entitylist$entityegginfo.field_75612_c) : 16777215; - } - -@@ -74,7 +74,7 @@ - if (tileentity instanceof TileEntityMobSpawner) - { - MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).func_145881_a(); -- mobspawnerbaselogic.func_98272_a(EntityList.func_75617_a(p_180614_1_.func_77960_j())); -+ mobspawnerbaselogic.func_98272_a(ItemMonsterPlacer.getEntityName(p_180614_1_)); - tileentity.func_70296_d(); - p_180614_3_.func_175689_h(p_180614_4_); - -@@ -90,12 +90,12 @@ - p_180614_4_ = p_180614_4_.func_177972_a(p_180614_5_); +@@ -88,7 +88,7 @@ + p_180614_4_ = p_180614_4_.func_177972_a(p_180614_6_); double d0 = 0.0D; -- if (p_180614_5_ == EnumFacing.UP && iblockstate instanceof BlockFence) -+ if (p_180614_5_ == EnumFacing.UP && iblockstate.func_177230_c() instanceof BlockFence) //Forge: Fix Vanilla bug comparing state instead of block +- if (p_180614_6_ == EnumFacing.UP && iblockstate instanceof BlockFence) ++ if (p_180614_6_ == EnumFacing.UP && iblockstate.func_177230_c() instanceof BlockFence) //Forge: Fix Vanilla bug comparing state instead of block { d0 = 0.5D; } - -- Entity entity = func_77840_a(p_180614_3_, p_180614_1_.func_77960_j(), (double)p_180614_4_.func_177958_n() + 0.5D, (double)p_180614_4_.func_177956_o() + d0, (double)p_180614_4_.func_177952_p() + 0.5D); -+ Entity entity = spawnCreature(p_180614_3_, ItemMonsterPlacer.getEntityName(p_180614_1_), (double)p_180614_4_.func_177958_n() + 0.5D, (double)p_180614_4_.func_177956_o() + d0, (double)p_180614_4_.func_177952_p() + 0.5D); - - if (entity != null) - { -@@ -146,7 +146,7 @@ - - if (p_77659_2_.func_180495_p(blockpos).func_177230_c() instanceof BlockLiquid) - { -- Entity entity = func_77840_a(p_77659_2_, p_77659_1_.func_77960_j(), (double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D); -+ Entity entity = spawnCreature(p_77659_2_, ItemMonsterPlacer.getEntityName(p_77659_1_), (double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D); - - if (entity != null) - { -@@ -170,19 +170,29 @@ +@@ -195,15 +195,15 @@ } } -+ @Deprecated // Use string version below. - public static Entity func_77840_a(World p_77840_0_, int p_77840_1_, double p_77840_2_, double p_77840_4_, double p_77840_6_) +- public static Entity func_77840_a(World p_77840_0_, String p_77840_1_, double p_77840_2_, double p_77840_4_, double p_77840_6_) ++ public static Entity func_77840_a(World p_77840_0_, String name, double p_77840_2_, double p_77840_4_, double p_77840_6_) { - if (!EntityList.field_75627_a.containsKey(Integer.valueOf(p_77840_1_))) - { - return null; - } -+ return spawnCreature(p_77840_0_, EntityList.func_75617_a(p_77840_1_), p_77840_2_, p_77840_4_, p_77840_6_); -+ } -+ -+ public static Entity spawnCreature(World p_77840_0_, String name, double p_77840_2_, double p_77840_4_, double p_77840_6_) -+ { -+ if (!EntityList.field_75625_b.containsKey(name)) -+ { -+ return null; -+ } - else +- if (p_77840_1_ != null && EntityList.field_75627_a.containsKey(p_77840_1_)) ++ if (name != null && EntityList.field_75627_a.containsKey(name)) { Entity entity = null; for (int i = 0; i < 1; ++i) { -- entity = EntityList.func_75616_a(p_77840_1_, p_77840_0_); -+ entity = EntityList.func_75620_a(name, p_77840_0_); +- entity = EntityList.func_188429_b(p_77840_1_, p_77840_0_); ++ entity = EntityList.func_188429_b(name, p_77840_0_); if (entity instanceof EntityLivingBase) { -@@ -207,5 +217,28 @@ - { - p_150895_3_.add(new ItemStack(p_150895_1_, 1, entitylist$entityegginfo.field_75613_a)); - } -+ -+ for (String name : net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().keySet()) -+ { -+ ItemStack stack = new ItemStack(p_150895_1_); -+ net.minecraft.nbt.NBTTagCompound nbt = new net.minecraft.nbt.NBTTagCompound(); -+ nbt.func_74778_a("entity_name", name); -+ stack.func_77982_d(nbt); -+ p_150895_3_.add(stack); -+ } - } -+ -+ public static String getEntityName(ItemStack stack) -+ { -+ if (stack.func_77942_o() && stack.func_77978_p().func_150297_b("entity_name", 8)) -+ return stack.func_77978_p().func_74779_i("entity_name"); -+ return EntityList.func_75617_a(stack.func_77960_j()); -+ } -+ -+ private static EntityList.EntityEggInfo getEggInfo(ItemStack stack) -+ { -+ if (stack.func_77942_o() && stack.func_77978_p().func_150297_b("entity_name", 8)) -+ return net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(stack.func_77978_p().func_74779_i("entity_name")); -+ return (EntityList.EntityEggInfo)EntityList.field_75627_a.get(stack.func_77960_j()); -+ } - } diff --git a/patches/minecraft/net/minecraft/item/ItemRecord.java.patch b/patches/minecraft/net/minecraft/item/ItemRecord.java.patch index dcafa7df78..16e050b5be 100644 --- a/patches/minecraft/net/minecraft/item/ItemRecord.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemRecord.java.patch @@ -1,10 +1,9 @@ --- ../src-base/minecraft/net/minecraft/item/ItemRecord.java +++ ../src-work/minecraft/net/minecraft/item/ItemRecord.java -@@ -76,4 +76,15 @@ - { - return (ItemRecord)field_150928_b.get(p_150926_0_); +@@ -73,6 +73,17 @@ + return EnumRarity.RARE; } -+ + + /** + * Retrieves the resource location of the sound to play for this record. + * @@ -15,4 +14,7 @@ + { + return new net.minecraft.util.ResourceLocation(name); + } - } ++ + @SideOnly(Side.CLIENT) + public static ItemRecord func_185074_a(SoundEvent p_185074_0_) + { diff --git a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch index 1d41825289..4625623628 100644 --- a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSeedFood.java +++ ../src-work/minecraft/net/minecraft/item/ItemSeedFood.java -@@ -6,7 +6,7 @@ - import net.minecraft.util.EnumFacing; +@@ -8,7 +8,7 @@ + import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -public class ItemSeedFood extends ItemFood @@ -9,17 +9,18 @@ { private Block field_150908_b; private Block field_82809_c; -@@ -28,7 +28,7 @@ +@@ -22,7 +22,8 @@ + + public EnumActionResult func_180614_a(ItemStack p_180614_1_, EntityPlayer p_180614_2_, World p_180614_3_, BlockPos p_180614_4_, EnumHand p_180614_5_, EnumFacing p_180614_6_, float p_180614_7_, float p_180614_8_, float p_180614_9_) + { +- if (p_180614_6_ == EnumFacing.UP && p_180614_2_.func_175151_a(p_180614_4_.func_177972_a(p_180614_6_), p_180614_6_, p_180614_1_) && p_180614_3_.func_180495_p(p_180614_4_).func_177230_c() == this.field_82809_c && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) ++ net.minecraft.block.state.IBlockState state = p_180614_3_.func_180495_p(p_180614_4_); ++ if (p_180614_6_ == EnumFacing.UP && p_180614_2_.func_175151_a(p_180614_4_.func_177972_a(p_180614_6_), p_180614_6_, p_180614_1_) && state.func_177230_c().canSustainPlant(state, p_180614_3_, p_180614_4_, EnumFacing.UP, this) && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) { - return false; - } -- else if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c() == this.field_82809_c && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) -+ else if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().canSustainPlant(p_180614_3_, p_180614_4_, EnumFacing.UP, this) && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) - { - p_180614_3_.func_175656_a(p_180614_4_.func_177984_a(), this.field_150908_b.func_176223_P()); + p_180614_3_.func_180501_a(p_180614_4_.func_177984_a(), this.field_150908_b.func_176223_P(), 11); --p_180614_1_.field_77994_a; -@@ -39,4 +39,16 @@ - return false; +@@ -33,4 +34,16 @@ + return EnumActionResult.FAIL; } } + diff --git a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch index 08fd7261b1..c433dc17c9 100644 --- a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSeeds.java +++ ../src-work/minecraft/net/minecraft/item/ItemSeeds.java -@@ -7,7 +7,7 @@ - import net.minecraft.util.EnumFacing; +@@ -9,7 +9,7 @@ + import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -public class ItemSeeds extends Item @@ -9,17 +9,18 @@ { private Block field_150925_a; private Block field_77838_b; -@@ -29,7 +29,7 @@ - { - return false; - } -- else if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c() == this.field_77838_b && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) -+ else if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().canSustainPlant(p_180614_3_, p_180614_4_, EnumFacing.UP, this) && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) +@@ -23,7 +23,8 @@ + + public EnumActionResult func_180614_a(ItemStack p_180614_1_, EntityPlayer p_180614_2_, World p_180614_3_, BlockPos p_180614_4_, EnumHand p_180614_5_, EnumFacing p_180614_6_, float p_180614_7_, float p_180614_8_, float p_180614_9_) + { +- if (p_180614_6_ == EnumFacing.UP && p_180614_2_.func_175151_a(p_180614_4_.func_177972_a(p_180614_6_), p_180614_6_, p_180614_1_) && p_180614_3_.func_180495_p(p_180614_4_).func_177230_c() == this.field_77838_b && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) ++ net.minecraft.block.state.IBlockState state = p_180614_3_.func_180495_p(p_180614_4_); ++ if (p_180614_6_ == EnumFacing.UP && p_180614_2_.func_175151_a(p_180614_4_.func_177972_a(p_180614_6_), p_180614_6_, p_180614_1_) && state.func_177230_c().canSustainPlant(state, p_180614_3_, p_180614_4_, EnumFacing.UP, this) && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) { p_180614_3_.func_175656_a(p_180614_4_.func_177984_a(), this.field_150925_a.func_176223_P()); --p_180614_1_.field_77994_a; -@@ -40,4 +40,16 @@ - return false; +@@ -34,4 +35,16 @@ + return EnumActionResult.FAIL; } } + diff --git a/patches/minecraft/net/minecraft/item/ItemShears.java.patch b/patches/minecraft/net/minecraft/item/ItemShears.java.patch index 3f6119ca84..700dd18bd4 100644 --- a/patches/minecraft/net/minecraft/item/ItemShears.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemShears.java.patch @@ -1,28 +1,30 @@ --- ../src-base/minecraft/net/minecraft/item/ItemShears.java +++ ../src-work/minecraft/net/minecraft/item/ItemShears.java -@@ -19,13 +19,12 @@ +@@ -6,6 +6,7 @@ + import net.minecraft.creativetab.CreativeTabs; + import net.minecraft.entity.EntityLivingBase; + import net.minecraft.init.Blocks; ++import net.minecraft.util.EnumHand; + import net.minecraft.util.math.BlockPos; + import net.minecraft.world.World; - public boolean func_179218_a(ItemStack p_179218_1_, World p_179218_2_, Block p_179218_3_, BlockPos p_179218_4_, EntityLivingBase p_179218_5_) +@@ -22,7 +23,7 @@ { -- if (p_179218_3_.func_149688_o() != Material.field_151584_j && p_179218_3_ != Blocks.field_150321_G && p_179218_3_ != Blocks.field_150329_H && p_179218_3_ != Blocks.field_150395_bd && p_179218_3_ != Blocks.field_150473_bD && p_179218_3_ != Blocks.field_150325_L) -+ if (p_179218_3_.func_149688_o() != Material.field_151584_j && p_179218_3_ != Blocks.field_150321_G && p_179218_3_ != Blocks.field_150329_H && p_179218_3_ != Blocks.field_150395_bd && p_179218_3_ != Blocks.field_150473_bD && p_179218_3_ != Blocks.field_150325_L && !(p_179218_3_ instanceof net.minecraftforge.common.IShearable)) - { - return super.func_179218_a(p_179218_1_, p_179218_2_, p_179218_3_, p_179218_4_, p_179218_5_); - } - else - { -- p_179218_1_.func_77972_a(1, p_179218_5_); - return true; - } + p_179218_1_.func_77972_a(1, p_179218_5_); + Block block = p_179218_3_.func_177230_c(); +- return p_179218_3_.func_185904_a() != Material.field_151584_j && block != Blocks.field_150321_G && block != Blocks.field_150329_H && block != Blocks.field_150395_bd && block != Blocks.field_150473_bD && block != Blocks.field_150325_L ? super.func_179218_a(p_179218_1_, p_179218_2_, p_179218_3_, p_179218_4_, p_179218_5_) : true; ++ return p_179218_3_.func_185904_a() != Material.field_151584_j && block != Blocks.field_150321_G && block != Blocks.field_150329_H && block != Blocks.field_150395_bd && block != Blocks.field_150473_bD && block != Blocks.field_150325_L && !(p_179218_3_ instanceof net.minecraftforge.common.IShearable) ? super.func_179218_a(p_179218_1_, p_179218_2_, p_179218_3_, p_179218_4_, p_179218_5_) : true; } -@@ -39,4 +38,71 @@ - { - return p_150893_2_ != Blocks.field_150321_G && p_150893_2_.func_149688_o() != Material.field_151584_j ? (p_150893_2_ == Blocks.field_150325_L ? 5.0F : super.func_150893_a(p_150893_1_, p_150893_2_)) : 15.0F; + + public boolean func_150897_b(IBlockState p_150897_1_) +@@ -36,4 +37,71 @@ + Block block = p_150893_2_.func_177230_c(); + return block != Blocks.field_150321_G && p_150893_2_.func_185904_a() != Material.field_151584_j ? (block == Blocks.field_150325_L ? 5.0F : super.func_150893_a(p_150893_1_, p_150893_2_)) : 15.0F; } + + + @Override -+ public boolean func_111207_a(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity) ++ public boolean func_111207_a(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity, EnumHand hand) + { + if (entity.field_70170_p.field_72995_K) + { @@ -35,7 +37,7 @@ + if (target.isShearable(itemstack, entity.field_70170_p, pos)) + { + java.util.List drops = target.onSheared(itemstack, entity.field_70170_p, pos, -+ net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.enchantment.Enchantment.field_77346_s.field_77352_x, itemstack)); ++ net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.init.Enchantments.field_185308_t, itemstack)); + + java.util.Random rand = new java.util.Random(); + for(ItemStack stack : drops) @@ -66,7 +68,7 @@ + if (target.isShearable(itemstack, player.field_70170_p, pos)) + { + java.util.List drops = target.onSheared(itemstack, player.field_70170_p, pos, -+ net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.enchantment.Enchantment.field_77346_s.field_77352_x, itemstack)); ++ net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.init.Enchantments.field_185308_t, itemstack)); + java.util.Random rand = new java.util.Random(); + + for(ItemStack stack : drops) @@ -81,7 +83,7 @@ + } + + itemstack.func_77972_a(1, player); -+ player.func_71064_a(net.minecraft.stats.StatList.field_75934_C[Block.func_149682_b(block)], 1); ++ player.func_71029_a(net.minecraft.stats.StatList.func_188055_a(block)); + } + } + return false; diff --git a/patches/minecraft/net/minecraft/item/ItemSkull.java.patch b/patches/minecraft/net/minecraft/item/ItemSkull.java.patch index 0e97068ef6..ac5e803293 100644 --- a/patches/minecraft/net/minecraft/item/ItemSkull.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSkull.java.patch @@ -1,31 +1,22 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSkull.java +++ ../src-work/minecraft/net/minecraft/item/ItemSkull.java -@@ -34,6 +34,11 @@ - - public boolean func_180614_a(ItemStack p_180614_1_, EntityPlayer p_180614_2_, World p_180614_3_, BlockPos p_180614_4_, EnumFacing p_180614_5_, float p_180614_6_, float p_180614_7_, float p_180614_8_) - { -+ if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().func_176200_f(p_180614_3_, p_180614_4_) && p_180614_5_ != EnumFacing.DOWN) -+ { -+ p_180614_5_ = EnumFacing.UP; -+ p_180614_4_ = p_180614_4_.func_177977_b(); -+ } - if (p_180614_5_ == EnumFacing.DOWN) +@@ -42,13 +42,18 @@ + } + else { - return false; -@@ -46,7 +51,7 @@ ++ if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().func_176200_f(p_180614_3_, p_180614_4_)) ++ { ++ p_180614_6_ = EnumFacing.UP; ++ p_180614_4_ = p_180614_4_.func_177977_b(); ++ } + IBlockState iblockstate = p_180614_3_.func_180495_p(p_180614_4_); + Block block = iblockstate.func_177230_c(); + boolean flag = block.func_176200_f(p_180614_3_, p_180614_4_); if (!flag) { -- if (!p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().func_149688_o().func_76220_a()) -+ if (!p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().func_149688_o().func_76220_a() && !p_180614_3_.isSideSolid(p_180614_4_, p_180614_5_, true)) +- if (!p_180614_3_.func_180495_p(p_180614_4_).func_185904_a().func_76220_a()) ++ if (!p_180614_3_.func_180495_p(p_180614_4_).func_185904_a().func_76220_a() && !p_180614_3_.isSideSolid(p_180614_4_, p_180614_6_, true)) { - return false; + return EnumActionResult.FAIL; } -@@ -66,6 +71,7 @@ - { - if (!p_180614_3_.field_72995_K) - { -+ if (!Blocks.field_150465_bP.func_176198_a(p_180614_3_, p_180614_4_, p_180614_5_)) return false; - p_180614_3_.func_180501_a(p_180614_4_, Blocks.field_150465_bP.func_176223_P().func_177226_a(BlockSkull.field_176418_a, p_180614_5_), 3); - int i = 0; - diff --git a/patches/minecraft/net/minecraft/item/ItemSnow.java.patch b/patches/minecraft/net/minecraft/item/ItemSnow.java.patch index 984fba4edb..3f3cea17a4 100644 --- a/patches/minecraft/net/minecraft/item/ItemSnow.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSnow.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSnow.java +++ ../src-work/minecraft/net/minecraft/item/ItemSnow.java -@@ -67,4 +67,10 @@ +@@ -68,4 +68,10 @@ { return p_77647_1_; } diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index 7d0836f32b..f7f888960b 100644 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/item/ItemStack.java +++ ../src-work/minecraft/net/minecraft/item/ItemStack.java -@@ -35,7 +35,7 @@ +@@ -41,7 +41,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public final class ItemStack +public final class ItemStack implements net.minecraftforge.common.capabilities.ICapabilitySerializable { - public static final DecimalFormat field_111284_a = new DecimalFormat("#.###"); + public static final DecimalFormat field_111284_a = new DecimalFormat("#.##"); public int field_77994_a; -@@ -49,6 +49,10 @@ +@@ -55,6 +55,10 @@ private Block field_179550_j; private boolean field_179551_k; @@ -20,7 +20,7 @@ public ItemStack(Block p_i1876_1_) { this((Block)p_i1876_1_, 1); -@@ -74,13 +78,15 @@ +@@ -80,13 +84,15 @@ this((Item)p_i1880_1_, p_i1880_2_, 0); } @@ -38,16 +38,16 @@ this.field_77994_a = p_i1881_2_; this.field_77991_e = p_i1881_3_; -@@ -107,7 +113,7 @@ - +@@ -114,7 +120,7 @@ public ItemStack func_77979_a(int p_77979_1_) { + p_77979_1_ = Math.min(p_77979_1_, this.field_77994_a); - ItemStack itemstack = new ItemStack(this.field_151002_e, p_77979_1_, this.field_77991_e); + ItemStack itemstack = new ItemStack(this.field_151002_e, p_77979_1_, this.field_77991_e, this.capabilities != null ? this.capabilities.serializeNBT() : null); if (this.field_77990_d != null) { -@@ -120,11 +126,12 @@ +@@ -127,11 +133,12 @@ public Item func_77973_b() { @@ -55,13 +55,13 @@ + return this.delegate != null ? this.delegate.get() : null; } - public boolean func_179546_a(EntityPlayer p_179546_1_, World p_179546_2_, BlockPos p_179546_3_, EnumFacing p_179546_4_, float p_179546_5_, float p_179546_6_, float p_179546_7_) + public EnumActionResult func_179546_a(EntityPlayer p_179546_1_, World p_179546_2_, BlockPos p_179546_3_, EnumHand p_179546_4_, EnumFacing p_179546_5_, float p_179546_6_, float p_179546_7_, float p_179546_8_) { -+ if (!p_179546_2_.field_72995_K) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, p_179546_1_, p_179546_2_, p_179546_3_, p_179546_4_, p_179546_5_, p_179546_6_, p_179546_7_); - boolean flag = this.func_77973_b().func_180614_a(this, p_179546_1_, p_179546_2_, p_179546_3_, p_179546_4_, p_179546_5_, p_179546_6_, p_179546_7_); ++ if (!p_179546_2_.field_72995_K) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, p_179546_1_, p_179546_2_, p_179546_3_, p_179546_5_, p_179546_6_, p_179546_7_, p_179546_8_, p_179546_4_); + EnumActionResult enumactionresult = this.func_77973_b().func_180614_a(this, p_179546_1_, p_179546_2_, p_179546_3_, p_179546_4_, p_179546_5_, p_179546_6_, p_179546_7_, p_179546_8_); - if (flag) -@@ -162,19 +169,23 @@ + if (enumactionresult == EnumActionResult.SUCCESS) +@@ -169,12 +176,16 @@ p_77955_1_.func_74782_a("tag", this.field_77990_d); } @@ -72,22 +72,14 @@ public void func_77963_c(NBTTagCompound p_77963_1_) { +- this.field_151002_e = Item.func_111206_d(p_77963_1_.func_74779_i("id")); + this.capNBT = p_77963_1_.func_74764_b("ForgeCaps") ? p_77963_1_.func_74775_l("ForgeCaps") : null; - if (p_77963_1_.func_150297_b("id", 8)) - { -- this.field_151002_e = Item.func_111206_d(p_77963_1_.func_74779_i("id")); -+ this.func_150996_a(Item.func_111206_d(p_77963_1_.func_74779_i("id"))); - } - else - { -- this.field_151002_e = Item.func_150899_d(p_77963_1_.func_74765_d("id")); -+ this.func_150996_a(Item.func_150899_d(p_77963_1_.func_74765_d("id"))); - } ++ this.func_150996_a(Item.func_111206_d(p_77963_1_.func_74779_i("id"))); + this.capNBT = null; - this.field_77994_a = p_77963_1_.func_74771_c("Count"); this.field_77991_e = p_77963_1_.func_74765_d("Damage"); -@@ -197,7 +208,7 @@ + +@@ -196,7 +207,7 @@ public int func_77976_d() { @@ -96,7 +88,7 @@ } public boolean func_77985_e() -@@ -207,7 +218,7 @@ +@@ -206,7 +217,7 @@ public boolean func_77984_f() { @@ -105,7 +97,7 @@ } public boolean func_77981_g() -@@ -217,32 +228,27 @@ +@@ -216,32 +227,27 @@ public boolean func_77951_h() { @@ -138,12 +130,12 @@ public int func_77958_k() { -- return this.field_151002_e.func_77612_l(); -+ return this.field_151002_e.getMaxDamage(this); +- return this.field_151002_e == null ? 0 : this.field_151002_e.func_77612_l(); ++ return this.field_151002_e == null ? 0 : this.field_151002_e.getMaxDamage(this); } public boolean func_96631_a(int p_96631_1_, Random p_96631_2_) -@@ -274,8 +280,8 @@ +@@ -273,8 +279,8 @@ } } @@ -154,16 +146,16 @@ } } -@@ -334,7 +340,7 @@ +@@ -328,7 +334,7 @@ - public boolean func_150998_b(Block p_150998_1_) + public boolean func_150998_b(IBlockState p_150998_1_) { - return this.field_151002_e.func_150897_b(p_150998_1_); + return func_77973_b().canHarvestBlock(p_150998_1_, this); } - public boolean func_111282_a(EntityPlayer p_111282_1_, EntityLivingBase p_111282_2_) -@@ -344,7 +350,7 @@ + public boolean func_111282_a(EntityPlayer p_111282_1_, EntityLivingBase p_111282_2_, EnumHand p_111282_3_) +@@ -338,7 +344,7 @@ public ItemStack func_77946_l() { @@ -172,7 +164,7 @@ if (this.field_77990_d != null) { -@@ -742,6 +748,7 @@ +@@ -759,6 +765,7 @@ } } @@ -180,16 +172,16 @@ return list; } -@@ -852,7 +859,7 @@ +@@ -869,7 +876,7 @@ } else { -- multimap = this.func_77973_b().func_111205_h(); -+ multimap = this.func_77973_b().getAttributeModifiers(this); +- multimap = this.func_77973_b().func_111205_h(p_111283_1_); ++ multimap = this.func_77973_b().getAttributeModifiers(p_111283_1_, this); } return multimap; -@@ -860,6 +867,18 @@ +@@ -901,6 +908,18 @@ public void func_150996_a(Item p_150996_1_) { @@ -208,7 +200,7 @@ this.field_151002_e = p_150996_1_; } -@@ -946,4 +965,26 @@ +@@ -987,4 +1006,26 @@ return false; } } diff --git a/patches/minecraft/net/minecraft/item/ItemSword.java.patch b/patches/minecraft/net/minecraft/item/ItemSword.java.patch index 2b99d22f15..cd88c33771 100644 --- a/patches/minecraft/net/minecraft/item/ItemSword.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSword.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSword.java +++ ../src-work/minecraft/net/minecraft/item/ItemSword.java -@@ -101,7 +101,9 @@ +@@ -88,7 +88,9 @@ public boolean func_82789_a(ItemStack p_82789_1_, ItemStack p_82789_2_) { @@ -10,4 +10,4 @@ + return super.func_82789_a(p_82789_1_, p_82789_2_); } - public Multimap func_111205_h() + public Multimap func_111205_h(EntityEquipmentSlot p_111205_1_) diff --git a/patches/minecraft/net/minecraft/item/ItemTool.java.patch b/patches/minecraft/net/minecraft/item/ItemTool.java.patch index 2a0e7450b2..efb12b0b58 100644 --- a/patches/minecraft/net/minecraft/item/ItemTool.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemTool.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/item/ItemTool.java +++ ../src-work/minecraft/net/minecraft/item/ItemTool.java -@@ -28,6 +28,18 @@ - this.field_77864_a = p_i45333_2_.func_77998_b(); - this.field_77865_bY = p_i45333_1_ + p_i45333_2_.func_78000_c(); +@@ -33,6 +33,18 @@ + this.field_77865_bY = p_i46745_1_ + p_i46745_3_.func_78000_c(); + this.field_185065_c = p_i46745_2_; this.func_77637_a(CreativeTabs.field_78040_i); + if (this instanceof ItemPickaxe) + { @@ -18,8 +18,20 @@ + } } - public float func_150893_a(ItemStack p_150893_1_, Block p_150893_2_) -@@ -74,7 +86,9 @@ + protected ItemTool(Item.ToolMaterial p_i46746_1_, Set p_i46746_2_) +@@ -42,6 +54,11 @@ + + public float func_150893_a(ItemStack p_150893_1_, IBlockState p_150893_2_) + { ++ for (String type : getToolClasses(p_150893_1_)) ++ { ++ if (p_150893_2_.func_177230_c().isToolEffective(type, p_150893_2_)) ++ return field_77864_a; ++ } + return this.field_150914_c.contains(p_150893_2_.func_177230_c()) ? this.field_77864_a : 1.0F; + } + +@@ -84,7 +101,9 @@ public boolean func_82789_a(ItemStack p_82789_1_, ItemStack p_82789_2_) { @@ -29,9 +41,9 @@ + return super.func_82789_a(p_82789_1_, p_82789_2_); } - public Multimap func_111205_h() -@@ -83,4 +97,38 @@ - multimap.put(SharedMonsterAttributes.field_111264_e.func_111108_a(), new AttributeModifier(field_111210_e, "Tool modifier", (double)this.field_77865_bY, 0)); + public Multimap func_111205_h(EntityEquipmentSlot p_111205_1_) +@@ -99,4 +118,27 @@ + return multimap; } + @@ -56,16 +68,5 @@ + { + return toolClass != null ? com.google.common.collect.ImmutableSet.of(toolClass) : super.getToolClasses(stack); + } -+ -+ @Override -+ public float getDigSpeed(ItemStack stack, net.minecraft.block.state.IBlockState state) -+ { -+ for (String type : getToolClasses(stack)) -+ { -+ if (state.func_177230_c().isToolEffective(type, state)) -+ return field_77864_a; -+ } -+ return super.getDigSpeed(stack, state); -+ } + /*===================================== FORGE END =================================*/ } diff --git a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch index cd73ea934e..0d6a291aab 100644 --- a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java +++ ../src-work/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java -@@ -72,6 +72,7 @@ +@@ -73,6 +73,7 @@ public void func_151394_a(ItemStack p_151394_1_, ItemStack p_151394_2_, float p_151394_3_) { @@ -8,7 +8,7 @@ this.field_77604_b.put(p_151394_1_, p_151394_2_); this.field_77605_c.put(p_151394_2_, Float.valueOf(p_151394_3_)); } -@@ -101,6 +102,9 @@ +@@ -102,6 +103,9 @@ public float func_151398_b(ItemStack p_151398_1_) { diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch index 8a494fdfb5..c626278f8a 100644 --- a/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch +++ b/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/nbt/NBTTagCompound.java +++ ../src-work/minecraft/net/minecraft/nbt/NBTTagCompound.java -@@ -395,6 +395,7 @@ +@@ -454,6 +454,7 @@ private static byte func_152447_a(DataInput p_152447_0_, NBTSizeTracker p_152447_1_) throws IOException { @@ -8,7 +8,7 @@ return p_152447_0_.readByte(); } -@@ -405,6 +406,7 @@ +@@ -464,6 +465,7 @@ static NBTBase func_152449_a(byte p_152449_0_, String p_152449_1_, DataInput p_152449_2_, int p_152449_3_, NBTSizeTracker p_152449_4_) throws IOException { diff --git a/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch index dfe8c66c5d..657125557f 100644 --- a/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch +++ b/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -1,51 +1,6 @@ --- ../src-base/minecraft/net/minecraft/network/NetHandlerPlayServer.java +++ ../src-work/minecraft/net/minecraft/network/NetHandlerPlayServer.java -@@ -254,6 +254,8 @@ - this.field_147369_b.field_70154_o.func_70043_V(); - } - -+ if (!this.field_147380_r) return; //Fixes teleportation kick while riding entities -+ - this.field_147367_d.func_71203_ab().func_72358_d(this.field_147369_b); - - if (this.field_147369_b.field_70154_o != null) -@@ -350,6 +352,8 @@ - this.field_147369_b.func_70664_aZ(); - } - -+ if (!this.field_147380_r) return; //Fixes "Moved Too Fast" kick when being teleported while moving -+ - this.field_147369_b.func_70091_d(d11, d12, d13); - this.field_147369_b.field_70122_E = p_147347_1_.func_149465_i(); - d11 = d8 - this.field_147369_b.field_70165_t; -@@ -370,6 +374,8 @@ - field_147370_c.warn(this.field_147369_b.func_70005_c_() + " moved wrongly!"); - } - -+ if (!this.field_147380_r) return; //Fixes "Moved Too Fast" kick when being teleported while moving -+ - this.field_147369_b.func_70080_a(d8, d9, d10, f1, f2); - this.field_147369_b.func_71000_j(this.field_147369_b.field_70165_t - d0, this.field_147369_b.field_70163_u - d1, this.field_147369_b.field_70161_v - d2); - -@@ -377,7 +383,7 @@ - { - boolean flag2 = worldserver.func_72945_a(this.field_147369_b, this.field_147369_b.func_174813_aQ().func_72331_e((double)f3, (double)f3, (double)f3)).isEmpty(); - -- if (flag && (flag1 || !flag2) && !this.field_147369_b.func_70608_bn()) -+ if (flag && (flag1 || !flag2) && !this.field_147369_b.func_70608_bn() && !this.field_147369_b.field_70145_X) - { - this.func_147364_a(this.field_147373_o, this.field_147382_p, this.field_147381_q, f1, f2); - return; -@@ -405,6 +411,8 @@ - this.field_147365_f = 0; - } - -+ if (!this.field_147380_r) return; //Fixes "Moved Too Fast" kick when being teleported while moving -+ - this.field_147369_b.field_70122_E = p_147347_1_.func_149465_i(); - this.field_147367_d.func_71203_ab().func_72358_d(this.field_147369_b); - this.field_147369_b.func_71122_b(this.field_147369_b.field_70163_u - d7, p_147347_1_.func_149465_i()); -@@ -497,7 +505,10 @@ +@@ -612,7 +612,10 @@ double d2 = this.field_147369_b.field_70161_v - ((double)blockpos.func_177952_p() + 0.5D); double d3 = d0 * d0 + d1 * d1 + d2 * d2; @@ -57,77 +12,57 @@ { return; } -@@ -549,6 +560,7 @@ - WorldServer worldserver = this.field_147367_d.func_71218_a(this.field_147369_b.field_71093_bK); - ItemStack itemstack = this.field_147369_b.field_71071_by.func_70448_g(); - boolean flag = false; -+ boolean placeResult = true; - BlockPos blockpos = p_147346_1_.func_179724_a(); - EnumFacing enumfacing = EnumFacing.func_82600_a(p_147346_1_.func_149568_f()); - this.field_147369_b.func_143004_u(); -@@ -560,13 +572,20 @@ - return; - } +@@ -670,7 +673,9 @@ -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_147369_b, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, worldserver, new BlockPos(0, 0, 0), null, new net.minecraft.util.Vec3(p_147346_1_.func_149573_h(), p_147346_1_.func_149569_i(), p_147346_1_.func_149575_j())); -+ if (event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { - this.field_147369_b.field_71134_c.func_73085_a(this.field_147369_b, worldserver, itemstack); -+ } - } - else if (blockpos.func_177956_o() < this.field_147367_d.func_71207_Z() - 1 || enumfacing != EnumFacing.UP && blockpos.func_177956_o() < this.field_147367_d.func_71207_Z()) + if (blockpos.func_177956_o() < this.field_147367_d.func_71207_Z() - 1 || enumfacing != EnumFacing.UP && blockpos.func_177956_o() < this.field_147367_d.func_71207_Z()) { -- if (this.field_147380_r && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < 64.0D && !this.field_147367_d.func_175579_a(worldserver, blockpos, this.field_147369_b) && worldserver.func_175723_af().func_177746_a(blockpos)) +- if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < 64.0D && !this.field_147367_d.func_175579_a(worldserver, blockpos, this.field_147369_b) && worldserver.func_175723_af().func_177746_a(blockpos)) + double dist = field_147369_b.field_71134_c.getBlockReachDistance() + 3; + dist *= dist; -+ if (this.field_147380_r && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < dist && !this.field_147367_d.func_175579_a(worldserver, blockpos, this.field_147369_b) && worldserver.func_175723_af().func_177746_a(blockpos)) ++ if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < dist && !this.field_147367_d.func_175579_a(worldserver, blockpos, this.field_147369_b) && worldserver.func_175723_af().func_177746_a(blockpos)) { -- this.field_147369_b.field_71134_c.func_180236_a(this.field_147369_b, worldserver, itemstack, blockpos, enumfacing, p_147346_1_.func_149573_h(), p_147346_1_.func_149569_i(), p_147346_1_.func_149575_j()); -+ // record block place result so we can update client itemstack size if place event was cancelled. -+ placeResult = this.field_147369_b.field_71134_c.func_180236_a(this.field_147369_b, worldserver, itemstack, blockpos, enumfacing, p_147346_1_.func_149573_h(), p_147346_1_.func_149569_i(), p_147346_1_.func_149575_j()); - } - - flag = true; -@@ -598,12 +617,18 @@ - this.field_147369_b.field_71137_h = true; - this.field_147369_b.field_71071_by.field_70462_a[this.field_147369_b.field_71071_by.field_70461_c] = ItemStack.func_77944_b(this.field_147369_b.field_71071_by.field_70462_a[this.field_147369_b.field_71071_by.field_70461_c]); - Slot slot = this.field_147369_b.field_71070_bA.func_75147_a(this.field_147369_b.field_71071_by, this.field_147369_b.field_71071_by.field_70461_c); -+ int windowId = this.field_147369_b.field_71070_bA.field_75152_c; -+ if (slot == null) // Forge: Fix 'slotless' inventories not selecting a valid slot to update -+ { -+ slot = this.field_147369_b.field_71069_bz.func_75147_a(this.field_147369_b.field_71071_by, this.field_147369_b.field_71071_by.field_70461_c); -+ windowId = this.field_147369_b.field_71069_bz.field_75152_c; -+ } - this.field_147369_b.field_71070_bA.func_75142_b(); - this.field_147369_b.field_71137_h = false; - -- if (!ItemStack.func_77989_b(this.field_147369_b.field_71071_by.func_70448_g(), p_147346_1_.func_149574_g())) -+ if (!ItemStack.func_77989_b(this.field_147369_b.field_71071_by.func_70448_g(), p_147346_1_.func_149574_g()) || !placeResult) // force client itemstack update if place event was cancelled - { -- this.func_147359_a(new S2FPacketSetSlot(this.field_147369_b.field_71070_bA.field_75152_c, slot.field_75222_d, this.field_147369_b.field_71071_by.func_70448_g())); -+ this.func_147359_a(new S2FPacketSetSlot(windowId, slot.field_75222_d, this.field_147369_b.field_71071_by.func_70448_g())); + this.field_147369_b.field_71134_c.func_187251_a(this.field_147369_b, worldserver, itemstack, enumhand, blockpos, enumfacing, p_184337_1_.func_187026_d(), p_184337_1_.func_187025_e(), p_184337_1_.func_187020_f()); } +@@ -689,6 +694,7 @@ + if (itemstack != null && itemstack.field_77994_a == 0) + { + this.field_147369_b.func_184611_a(enumhand, (ItemStack)null); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_147369_b, itemstack, enumhand); + itemstack = null; } } -@@ -770,8 +795,10 @@ +@@ -703,12 +709,14 @@ + + if (itemstack != null) + { ++ //TODO: Hook interact event here... we don't know the type of itneration tho... + this.field_147369_b.field_71134_c.func_187250_a(this.field_147369_b, worldserver, itemstack, enumhand); + itemstack = this.field_147369_b.func_184586_b(enumhand); + + if (itemstack != null && itemstack.field_77994_a == 0) + { + this.field_147369_b.func_184611_a(enumhand, (ItemStack)null); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_147369_b, itemstack, enumhand); + itemstack = null; + } + } +@@ -888,7 +896,9 @@ } else { -- IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.text", new Object[] {this.field_147369_b.func_145748_c_(), s}); -- this.field_147367_d.func_71203_ab().func_148544_a(ichatcomponent, false); -+ ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", this.field_147369_b.func_145748_c_(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s)); -+ IChatComponent chat = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, chatcomponenttranslation1); -+ if (chat == null) return; -+ this.field_147367_d.func_71203_ab().func_148544_a(chat, false); +- ITextComponent itextcomponent = new TextComponentTranslation("chat.type.text", new Object[] {this.field_147369_b.func_145748_c_(), s}); ++ ITextComponent itextcomponent = new TextComponentTranslation("chat.type.text", this.field_147369_b.func_145748_c_(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s)); ++ itextcomponent = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, itextcomponent); ++ if (itextcomponent == null) return; + this.field_147367_d.func_184103_al().func_148544_a(itextcomponent, false); } - this.field_147374_l += 20; -@@ -916,7 +943,7 @@ +@@ -1057,7 +1067,7 @@ return; } -- this.field_147369_b = this.field_147367_d.func_71203_ab().func_72368_a(this.field_147369_b, 0, false); -+ this.field_147369_b = this.field_147367_d.func_71203_ab().func_72368_a(this.field_147369_b, field_147369_b.field_71093_bK, false); - } +- this.field_147369_b = this.field_147367_d.func_184103_al().func_72368_a(this.field_147369_b, 0, false); ++ this.field_147369_b = this.field_147367_d.func_184103_al().func_72368_a(this.field_147369_b, field_147369_b.field_71093_bK, false); - break; + if (this.field_147367_d.func_71199_h()) + { diff --git a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch index d865286089..e2a7a2c035 100644 --- a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch +++ b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/network/NetworkManager.java +++ ../src-work/minecraft/net/minecraft/network/NetworkManager.java -@@ -93,6 +93,11 @@ +@@ -89,6 +89,11 @@ this.field_179294_g = p_i46004_1_; } @@ -12,7 +12,7 @@ public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception { super.channelActive(p_channelActive_1_); -@@ -208,7 +213,7 @@ +@@ -205,7 +210,7 @@ final EnumConnectionState enumconnectionstate = EnumConnectionState.func_150752_a(p_150732_1_); final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.field_150746_k.attr(field_150739_c).get(); @@ -21,7 +21,7 @@ { field_150735_g.debug("Disabled auto read"); this.field_150746_k.config().setAutoRead(false); -@@ -216,7 +221,7 @@ +@@ -213,7 +218,7 @@ if (this.field_150746_k.eventLoop().inEventLoop()) { @@ -30,7 +30,7 @@ { this.func_150723_a(enumconnectionstate); } -@@ -236,7 +241,7 @@ +@@ -233,7 +238,7 @@ { public void run() { @@ -39,7 +39,7 @@ { NetworkManager.this.func_150723_a(enumconnectionstate); } -@@ -455,6 +460,11 @@ +@@ -452,6 +457,11 @@ } } @@ -50,4 +50,4 @@ + static class InboundHandlerTuplePacketListener { - private final Packet field_150774_a; + private final Packet field_150774_a; diff --git a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch index e31f320e9b..76ca4cff80 100644 --- a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch +++ b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/network/NetworkSystem.java +++ ../src-work/minecraft/net/minecraft/network/NetworkSystem.java -@@ -115,7 +115,7 @@ +@@ -111,7 +111,7 @@ ; } -- p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND))); -+ p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND))); +- p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"legacy_query", (ChannelHandler)(new LegacyPingHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new NettyVarint21FrameDecoder())).addLast((String)"decoder", (ChannelHandler)(new NettyPacketDecoder(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new NettyVarint21FrameEncoder())).addLast((String)"encoder", (ChannelHandler)(new NettyPacketEncoder(EnumPacketDirection.CLIENTBOUND))); ++ p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT))).addLast((String)"legacy_query", (ChannelHandler)(new LegacyPingHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new NettyVarint21FrameDecoder())).addLast((String)"decoder", (ChannelHandler)(new NettyPacketDecoder(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new NettyVarint21FrameEncoder())).addLast((String)"encoder", (ChannelHandler)(new NettyPacketEncoder(EnumPacketDirection.CLIENTBOUND))); NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); NetworkSystem.this.field_151272_f.add(networkmanager); p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager); diff --git a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch index 856c5c869f..388c5ef4b9 100644 --- a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch +++ b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch @@ -1,23 +1,23 @@ --- ../src-base/minecraft/net/minecraft/network/ServerStatusResponse.java +++ ../src-work/minecraft/net/minecraft/network/ServerStatusResponse.java @@ -29,6 +29,7 @@ - public void func_151315_a(IChatComponent p_151315_1_) + public void func_151315_a(ITextComponent p_151315_1_) { this.field_151326_a = p_151315_1_; + invalidateJson(); } - public ServerStatusResponse.PlayerCountData func_151318_b() + public ServerStatusResponse.Players func_151318_b() @@ -39,6 +40,7 @@ - public void func_151319_a(ServerStatusResponse.PlayerCountData p_151319_1_) + public void func_151319_a(ServerStatusResponse.Players p_151319_1_) { this.field_151324_b = p_151319_1_; + invalidateJson(); } - public ServerStatusResponse.MinecraftProtocolVersionIdentifier func_151322_c() + public ServerStatusResponse.Version func_151322_c() @@ -49,11 +51,13 @@ - public void func_151321_a(ServerStatusResponse.MinecraftProtocolVersionIdentifier p_151321_1_) + public void func_151321_a(ServerStatusResponse.Version p_151321_1_) { this.field_151325_c = p_151321_1_; + invalidateJson(); @@ -30,7 +30,7 @@ } public String func_151316_d() -@@ -215,6 +219,7 @@ +@@ -176,6 +180,7 @@ serverstatusresponse.func_151320_a(JsonUtils.func_151200_h(jsonobject, "favicon")); } @@ -38,7 +38,7 @@ return serverstatusresponse; } -@@ -242,7 +247,47 @@ +@@ -203,10 +208,50 @@ jsonobject.addProperty("favicon", p_serialize_1_.func_151316_d()); } @@ -46,7 +46,7 @@ return jsonobject; } } -+ + + private java.util.concurrent.Semaphore mutex = new java.util.concurrent.Semaphore(1); + private String json = null; + /** @@ -69,7 +69,7 @@ + ret = this.json; + if (ret == null) + { -+ ret = net.minecraft.network.status.server.S00PacketServerInfo.field_149297_a.toJson(this); ++ ret = net.minecraft.network.status.server.SPacketServerInfo.field_149297_a.toJson(this); + this.json = ret; + } + mutex.release(); @@ -85,4 +85,7 @@ + { + this.json = null; + } - } ++ + public static class Version + { + private final String field_151306_a; diff --git a/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch b/patches/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java.patch similarity index 74% rename from patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch rename to patches/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java.patch index 1345ee1259..b0ba904952 100644 --- a/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch +++ b/patches/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java.patch @@ -1,5 +1,5 @@ ---- ../src-base/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java -+++ ../src-work/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java +--- ../src-base/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java ++++ ../src-work/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java @@ -47,7 +47,11 @@ public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { diff --git a/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch b/patches/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java.patch similarity index 74% rename from patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch rename to patches/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java.patch index 9604b555aa..01ef581c1f 100644 --- a/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch +++ b/patches/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java.patch @@ -1,5 +1,5 @@ ---- ../src-base/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java -+++ ../src-work/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java +--- ../src-base/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java ++++ ../src-work/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java @@ -46,7 +46,11 @@ public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { diff --git a/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch b/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch deleted file mode 100644 index 6e9d12a151..0000000000 --- a/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java -+++ ../src-work/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java -@@ -34,7 +34,7 @@ - - public void func_148840_b(PacketBuffer p_148840_1_) throws IOException - { -- p_148840_1_.func_180714_a(field_149297_a.toJson((Object)this.field_149296_b)); -+ p_148840_1_.func_180714_a(this.field_149296_b.getJson()); - } - - public void func_148833_a(INetHandlerStatusClient p_148833_1_) diff --git a/patches/minecraft/net/minecraft/potion/Potion.java.patch b/patches/minecraft/net/minecraft/potion/Potion.java.patch index 1ee629dcc2..d8ed60afcf 100644 --- a/patches/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches/minecraft/net/minecraft/potion/Potion.java.patch @@ -1,49 +1,15 @@ --- ../src-base/minecraft/net/minecraft/potion/Potion.java +++ ../src-work/minecraft/net/minecraft/potion/Potion.java -@@ -21,7 +21,7 @@ +@@ -23,7 +23,7 @@ public class Potion { -- public static final Potion[] field_76425_a = new Potion[32]; -+ public static final Potion[] field_76425_a = new Potion[256]; - private static final Map field_180150_I = Maps.newHashMap(); - public static final Potion field_180151_b = null; - public static final Potion field_76424_c = (new Potion(1, new ResourceLocation("speed"), false, 8171462)).func_76390_b("potion.moveSpeed").func_76399_b(0, 0).func_111184_a(SharedMonsterAttributes.field_111263_d, "91AEAA56-376B-4498-935B-2F7F68070635", 0.20000000298023224D, 2); -@@ -64,10 +64,10 @@ - private double field_76412_L; - private boolean field_76413_M; - -+ @Deprecated // use the Constructor without potion ID or everything will explode. - protected Potion(int p_i45897_1_, ResourceLocation p_i45897_2_, boolean p_i45897_3_, int p_i45897_4_) - { -- this.field_76415_H = p_i45897_1_; -- field_76425_a[p_i45897_1_] = this; -+ net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().func_177775_a(p_i45897_1_, p_i45897_2_, this); - field_180150_I.put(p_i45897_2_, this); - this.field_76418_K = p_i45897_3_; - -@@ -83,14 +83,18 @@ - this.field_76414_N = p_i45897_4_; - } - -+ protected Potion(ResourceLocation location, boolean badEffect, int potionColor) { -+ this(-1, location, badEffect, potionColor); -+ } -+ - public static Potion func_180142_b(String p_180142_0_) - { -- return (Potion)field_180150_I.get(new ResourceLocation(p_180142_0_)); -+ return net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().func_82594_a(new ResourceLocation(p_180142_0_)); - } - - public static Set func_181168_c() - { -- return field_180150_I.keySet(); -+ return net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().func_148742_b(); - } - - protected Potion func_76399_b(int p_76399_1_, int p_76399_2_) -@@ -230,7 +234,6 @@ +- public static final RegistryNamespaced field_188414_b = new RegistryNamespaced(); ++ public static final RegistryNamespaced field_188414_b = net.minecraftforge.fml.common.registry.GameData.getPotionRegistry(); + private final Map field_111188_I = Maps.newHashMap(); + private final boolean field_76418_K; + private final int field_76414_N; +@@ -195,7 +195,6 @@ return this.field_76417_J; } @@ -51,11 +17,10 @@ public boolean func_76398_f() { return this.field_76418_K; -@@ -310,4 +313,34 @@ - { +@@ -266,7 +265,37 @@ return p_111183_2_.func_111164_d() * (double)(p_111183_1_ + 1); } -+ + + /* ======================================== FORGE START =====================================*/ + + /** @@ -83,6 +48,10 @@ + * @param effect the active PotionEffect + * @param mc the Minecraft instance, for convenience + */ -+ @SideOnly(Side.CLIENT) + @SideOnly(Side.CLIENT) + public void renderInventoryEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc) { } - } ++ ++ @SideOnly(Side.CLIENT) + public boolean func_188408_i() + { + return this.field_188415_h; diff --git a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch index 8b588f66a6..b68c6378c2 100644 --- a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch @@ -1,41 +1,32 @@ --- ../src-base/minecraft/net/minecraft/potion/PotionEffect.java +++ ../src-work/minecraft/net/minecraft/potion/PotionEffect.java -@@ -18,6 +18,8 @@ +@@ -19,6 +19,8 @@ @SideOnly(Side.CLIENT) private boolean field_100013_f; - private boolean field_180156_h; + private boolean field_188421_h; + /** List of ItemStack that can cure the potion effect **/ + private java.util.List curativeItems; - public PotionEffect(int p_i1574_1_, int p_i1574_2_) + public PotionEffect(Potion p_i46811_1_) { -@@ -36,6 +38,8 @@ - this.field_76461_c = p_i45896_3_; - this.field_82724_e = p_i45896_4_; - this.field_180156_h = p_i45896_5_; -+ this.curativeItems = new java.util.ArrayList(); -+ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.field_151117_aB)); - } - - public PotionEffect(PotionEffect p_i1577_1_) -@@ -45,6 +49,7 @@ +@@ -51,6 +53,7 @@ this.field_76461_c = p_i1577_1_.field_76461_c; this.field_82724_e = p_i1577_1_.field_82724_e; - this.field_180156_h = p_i1577_1_.field_180156_h; + this.field_188421_h = p_i1577_1_.field_188421_h; + this.curativeItems = p_i1577_1_.curativeItems; } public void func_76452_a(PotionEffect p_76452_1_) -@@ -190,7 +195,7 @@ +@@ -200,7 +203,7 @@ public static PotionEffect func_82722_b(NBTTagCompound p_82722_0_) { - int i = p_82722_0_.func_74771_c("Id"); -+ int i = p_82722_0_.func_74771_c("Id") & 0xff; ++ int i = p_82722_0_.func_74771_c("Id") & 0xFF; + Potion potion = Potion.func_188412_a(i); - if (i >= 0 && i < Potion.field_76425_a.length && Potion.field_76425_a[i] != null) - { -@@ -223,4 +228,53 @@ + if (potion == null) +@@ -240,4 +243,58 @@ { return this.field_100013_f; } @@ -47,6 +38,11 @@ + */ + public java.util.List getCurativeItems() + { ++ if (this.curativeItems == null) //Lazy load this so that we don't create a circular dep on Items. ++ { ++ this.curativeItems = new java.util.ArrayList(); ++ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.field_151117_aB)); ++ } + return this.curativeItems; + } + @@ -57,7 +53,7 @@ + */ + public boolean isCurativeItem(net.minecraft.item.ItemStack stack) + { -+ for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) ++ for (net.minecraft.item.ItemStack curativeItem : this.getCurativeItems()) + { + if (curativeItem.func_77969_a(stack)) + { @@ -85,7 +81,7 @@ + { + if (!this.isCurativeItem(stack)) + { -+ this.curativeItems.add(stack); ++ this.getCurativeItems().add(stack); + } + } } diff --git a/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch b/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch index 485a416d0c..cc68754548 100644 --- a/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch +++ b/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch @@ -12,8 +12,8 @@ return; } -- RealmsConnect.this.connection.func_179290_a(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); -+ RealmsConnect.this.connection.func_179290_a(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true)); +- RealmsConnect.this.connection.func_179290_a(new C00Handshake(107, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); ++ RealmsConnect.this.connection.func_179290_a(new C00Handshake(107, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true)); if (RealmsConnect.this.aborted) { diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index c8298d70a1..a104654274 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java +++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java -@@ -98,7 +98,7 @@ +@@ -100,7 +100,7 @@ @SideOnly(Side.SERVER) private String field_71320_r; private int field_71319_s = -1; - public WorldServer[] field_71305_c; + public WorldServer[] field_71305_c = new WorldServer[0]; - private ServerConfigurationManager field_71318_t; + private PlayerList field_71318_t; private boolean field_71317_u = true; private boolean field_71316_v; -@@ -115,7 +115,8 @@ +@@ -117,7 +117,8 @@ private int field_71280_D; private int field_143008_E = 0; public final long[] field_71311_j = new long[100]; @@ -19,7 +19,7 @@ private KeyPair field_71292_I; private String field_71293_J; private String field_71294_K; -@@ -227,8 +228,6 @@ +@@ -215,8 +216,6 @@ { this.func_71237_c(p_71247_1_); this.func_71192_d("menu.loadingLevel"); @@ -28,7 +28,7 @@ ISaveHandler isavehandler = this.field_71310_m.func_75804_a(p_71247_1_, true); this.func_175584_a(this.func_71270_I(), isavehandler); WorldInfo worldinfo = isavehandler.func_75757_d(); -@@ -259,47 +258,21 @@ +@@ -247,47 +246,21 @@ worldsettings = new WorldSettings(worldinfo); } @@ -84,7 +84,7 @@ this.func_147139_a(this.func_147135_j()); this.func_71222_d(); } -@@ -314,7 +287,7 @@ +@@ -302,7 +275,7 @@ this.func_71192_d("menu.generatingTerrain"); int j1 = 0; field_147145_h.info("Preparing start region for level " + j1); @@ -93,40 +93,32 @@ BlockPos blockpos = worldserver.func_175694_M(); long k1 = func_130071_aq(); -@@ -403,7 +376,7 @@ - - public void func_71260_j() - { -- if (!this.field_71290_O) -+ if (!this.field_71290_O && net.minecraftforge.fml.common.Loader.instance().hasReachedState(net.minecraftforge.fml.common.LoaderState.SERVER_STARTED) && !field_71316_v) // make sure the save is valid and we don't save twice - { - field_147145_h.info("Stopping server"); - -@@ -427,8 +400,15 @@ - for (int i = 0; i < this.field_71305_c.length; ++i) +@@ -420,9 +393,15 @@ + { + if (this.field_71305_c[j] != null) { - WorldServer worldserver = this.field_71305_c[i]; -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); - worldserver.func_73041_k(); - } -+ -+ WorldServer[] tmp = field_71305_c; -+ for (WorldServer world : tmp) -+ { -+ net.minecraftforge.common.DimensionManager.setWorld(world.field_73011_w.func_177502_q(), null); -+ } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(this.field_71305_c[j])); } + this.field_71305_c[j].func_73041_k(); +- } } ++ ++ WorldServer[] tmp = field_71305_c; ++ for (WorldServer world : tmp) ++ { ++ net.minecraftforge.common.DimensionManager.setWorld(world.field_73011_w.getDimension(), null, this); ++ } + } - if (this.field_71307_n.func_76468_d()) -@@ -460,6 +440,7 @@ + if (this.field_71307_n.func_76468_d()) +@@ -447,6 +426,7 @@ { if (this.func_71197_b()) { + net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarted(); this.field_175591_ab = func_130071_aq(); long i = 0L; - this.field_147147_p.func_151315_a(new ChatComponentText(this.field_71286_C)); -@@ -504,12 +485,20 @@ + this.field_147147_p.func_151315_a(new TextComponentString(this.field_71286_C)); +@@ -491,12 +471,20 @@ Thread.sleep(Math.max(1L, 50L - i)); this.field_71296_Q = true; } @@ -147,7 +139,7 @@ catch (Throwable throwable1) { field_147145_h.error("Encountered an unexpected exception", throwable1); -@@ -535,14 +524,15 @@ +@@ -522,14 +510,15 @@ field_147145_h.error("We were unable to save this crash report to disk."); } @@ -164,7 +156,7 @@ } catch (Throwable throwable) { -@@ -550,6 +540,8 @@ +@@ -537,6 +526,8 @@ } finally { @@ -173,7 +165,7 @@ this.func_71240_o(); } } -@@ -599,6 +591,7 @@ +@@ -604,6 +595,7 @@ public void func_71217_p() { long i = System.nanoTime(); @@ -181,7 +173,7 @@ ++this.field_71315_w; if (this.field_71295_T) -@@ -625,6 +618,7 @@ +@@ -630,6 +622,7 @@ Collections.shuffle(Arrays.asList(agameprofile)); this.field_147147_p.func_151318_b().func_151330_a(agameprofile); @@ -189,7 +181,7 @@ } if (this.field_71315_w % 900 == 0) -@@ -652,6 +646,7 @@ +@@ -657,6 +650,7 @@ this.field_71304_b.func_76319_b(); this.field_71304_b.func_76319_b(); @@ -197,7 +189,7 @@ } public void func_71190_q() -@@ -667,14 +662,17 @@ +@@ -672,14 +666,17 @@ } this.field_71304_b.func_76318_c("levels"); @@ -218,7 +210,7 @@ this.field_71304_b.func_76320_a(worldserver.func_72912_H().func_76065_j()); if (this.field_71315_w % 20 == 0) -@@ -685,6 +683,7 @@ +@@ -690,6 +687,7 @@ } this.field_71304_b.func_76320_a("tick"); @@ -226,7 +218,7 @@ try { -@@ -708,6 +707,7 @@ +@@ -713,6 +711,7 @@ throw new ReportedException(crashreport1); } @@ -234,7 +226,7 @@ this.field_71304_b.func_76319_b(); this.field_71304_b.func_76320_a("tracker"); worldserver.func_73039_n().func_72788_a(); -@@ -715,9 +715,11 @@ +@@ -720,9 +719,11 @@ this.field_71304_b.func_76319_b(); } @@ -247,7 +239,7 @@ this.field_71304_b.func_76318_c("connection"); this.func_147137_ag().func_151269_c(); this.field_71304_b.func_76318_c("players"); -@@ -739,6 +741,7 @@ +@@ -744,6 +745,7 @@ public void func_71256_s() { @@ -255,7 +247,7 @@ this.field_175590_aa = new Thread(this, "Server thread"); this.field_175590_aa.start(); } -@@ -755,7 +758,13 @@ +@@ -760,7 +762,13 @@ public WorldServer func_71218_a(int p_71218_1_) { @@ -270,7 +262,7 @@ } public String func_71249_w() -@@ -785,7 +794,7 @@ +@@ -790,7 +798,7 @@ public String getServerModName() { @@ -279,11 +271,3 @@ } public CrashReport func_71230_b(CrashReport p_71230_1_) -@@ -996,6 +1005,7 @@ - - if (worldserver != null) - { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); - worldserver.func_73041_k(); - } - } diff --git a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index c0eff5da96..d750cdb466 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java +++ ../src-work/minecraft/net/minecraft/server/dedicated/DedicatedServer.java -@@ -49,6 +49,7 @@ +@@ -56,6 +56,7 @@ private boolean field_71338_p; private WorldSettings.GameType field_71337_q; private boolean field_71335_s; + public static boolean allowPlayerLogins = false; - public DedicatedServer(File p_i1508_1_) + public DedicatedServer(File p_i47086_1_, DataFixer p_i47086_2_, YggdrasilAuthenticationService p_i47086_3_, MinecraftSessionService p_i47086_4_, GameProfileRepository p_i47086_5_, PlayerProfileCache p_i47086_6_) { -@@ -82,6 +83,7 @@ +@@ -89,6 +90,7 @@ { public void run() { @@ -16,7 +16,7 @@ BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in)); String s4; -@@ -107,6 +109,8 @@ +@@ -114,6 +116,8 @@ field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } @@ -25,23 +25,23 @@ field_155771_h.info("Loading properties"); this.field_71340_o = new PropertyManager(new File("server.properties")); this.field_154332_n = new ServerEula(new File("eula.txt")); -@@ -198,6 +202,7 @@ +@@ -205,6 +209,7 @@ } else { + net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStarted(); - this.func_152361_a(new DedicatedPlayerList(this)); + this.func_184105_a(new DedicatedPlayerList(this)); long j = System.nanoTime(); -@@ -244,6 +249,7 @@ - this.func_71191_d((this.func_71207_Z() + 8) / 16 * 16); - this.func_71191_d(MathHelper.func_76125_a(this.func_71207_Z(), 64, 256)); - this.field_71340_o.func_73667_a("max-build-height", Integer.valueOf(this.func_71207_Z())); +@@ -254,6 +259,7 @@ + TileEntitySkull.func_184293_a(this.func_152358_ax()); + TileEntitySkull.func_184294_a(this.func_147130_as()); + PlayerProfileCache.func_187320_a(this.func_71266_T()); + if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; field_155771_h.info("Preparing level \"" + this.func_71270_I() + "\""); this.func_71247_a(this.func_71270_I(), this.func_71270_I(), k, worldtype, s2); long i1 = System.nanoTime() - j; -@@ -272,7 +278,7 @@ +@@ -282,7 +288,7 @@ thread1.start(); } @@ -50,11 +50,13 @@ } } } -@@ -621,4 +627,7 @@ - this.field_71321_q.func_71556_a(RConConsoleSource.func_175570_h(), p_71252_1_); - return RConConsoleSource.func_175570_h().func_70008_c(); +@@ -580,6 +586,9 @@ + return this.field_71340_o.func_73669_a("network-compression-threshold", super.func_175577_aI()); } -+ + + //Forge: Enable formated text for colors in console. -+ @Override public void func_145747_a(net.minecraft.util.IChatComponent message) { field_155771_h.info(message.func_150254_d()); } - } ++ @Override public void func_145747_a(net.minecraft.util.text.ITextComponent message) { field_155771_h.info(message.func_150254_d()); } ++ + protected boolean func_152368_aE() throws IOException + { + boolean flag = false; diff --git a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch index 06a26df6ee..8b9416cb1f 100644 --- a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch +++ b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/server/gui/MinecraftServerGui.java +++ ../src-work/minecraft/net/minecraft/server/gui/MinecraftServerGui.java -@@ -78,6 +78,7 @@ +@@ -77,6 +77,7 @@ System.exit(0); } }); @@ -8,7 +8,7 @@ } public MinecraftServerGui(DedicatedServer p_i2362_1_) -@@ -162,8 +163,13 @@ +@@ -161,8 +162,13 @@ return jpanel; } diff --git a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch index 7962cb7aca..473fa124d4 100644 --- a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java +++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java -@@ -71,8 +71,6 @@ +@@ -68,8 +68,6 @@ protected void func_71247_a(String p_71247_1_, String p_71247_2_, long p_71247_3_, WorldType p_71247_5_, String p_71247_6_) { this.func_71237_c(p_71247_1_); @@ -9,20 +9,19 @@ ISaveHandler isavehandler = this.func_71254_M().func_75804_a(p_71247_1_, true); this.func_175584_a(this.func_71270_I(), isavehandler); WorldInfo worldinfo = isavehandler.func_75757_d(); -@@ -86,44 +84,24 @@ +@@ -83,44 +81,23 @@ worldinfo.func_76062_a(p_71247_2_); } - for (int i = 0; i < this.field_71305_c.length; ++i) -- { -- int j = 0; + WorldServer overWorld = (func_71242_L() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.field_71304_b)).func_175643_b() : + (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.field_71304_b)).func_175643_b()); + overWorld.func_72963_a(this.field_71350_m); - -- if (i == 1) + for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) -+ { + { +- int j = 0; +- +- if (i == 1) + WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.field_71304_b)).func_175643_b()); + world.func_72954_a(new WorldManager(this, world)); + if (!this.func_71264_H()) @@ -58,15 +57,15 @@ + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); } -- this.func_71203_ab().func_72364_a(this.field_71305_c); -+ this.func_71203_ab().func_72364_a(new WorldServer[]{ overWorld }); +- this.func_184103_al().func_72364_a(this.field_71305_c); ++ this.func_184103_al().func_72364_a(new WorldServer[]{ overWorld }); - if (this.field_71305_c[0].func_72912_H().func_176130_y() == null) + if (overWorld.func_72912_H().func_176130_y() == null) { this.func_147139_a(this.field_71349_l.field_71474_y.field_74318_M); } -@@ -141,9 +119,10 @@ +@@ -138,9 +115,10 @@ this.func_71245_h(true); field_147148_h.info("Generating keypair"); this.func_71253_a(CryptManager.func_75891_b()); @@ -78,7 +77,7 @@ } public void func_71217_p() -@@ -216,6 +195,7 @@ +@@ -213,6 +191,7 @@ public EnumDifficulty func_147135_j() { diff --git a/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch deleted file mode 100644 index 3114e1a6a9..0000000000 --- a/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch +++ /dev/null @@ -1,266 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/ItemInWorldManager.java -+++ ../src-work/minecraft/net/minecraft/server/management/ItemInWorldManager.java -@@ -22,6 +22,8 @@ - - public class ItemInWorldManager - { -+ /** Forge reach distance */ -+ private double blockReachDistance = 5.0d; - public World field_73092_a; - public EntityPlayerMP field_73090_b; - private WorldSettings.GameType field_73091_c = WorldSettings.GameType.NOT_SET; -@@ -116,7 +118,7 @@ - else - { - int k = this.field_73100_i - this.field_73089_e; -- float f1 = block1.func_180647_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180241_i) * (float)(k + 1); -+ float f1 = block1.func_180647_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180240_f) * (float)(k + 1); //Forge: Fix network break progress using wrong position - int l = (int)(f1 * 10.0F); - - if (l != this.field_73094_o) -@@ -130,6 +132,14 @@ - - public void func_180784_a(BlockPos p_180784_1_, EnumFacing p_180784_2_) - { -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_73090_b, -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, field_73092_a, p_180784_1_, p_180784_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(field_73090_b, getBlockReachDistance() + 1)); -+ if (event.isCanceled()) -+ { -+ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180784_1_)); -+ return; -+ } -+ - if (this.func_73083_d()) - { - if (!this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_)) -@@ -164,18 +174,35 @@ - } - } - -- this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); -+ // - this.field_73089_e = this.field_73100_i; - float f = 1.0F; - -- if (block.func_149688_o() != Material.field_151579_a) -+ if (!block.isAir(field_73092_a, p_180784_1_)) - { -- block.func_180649_a(this.field_73092_a, p_180784_1_, this.field_73090_b); -+ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ block.func_180649_a(this.field_73092_a, p_180784_1_, this.field_73090_b); -+ this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); -+ } -+ else -+ { -+ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180784_1_)); -+ } - f = block.func_180647_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180784_1_); - } - -- if (block.func_149688_o() != Material.field_151579_a && f >= 1.0F) -+ if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) - { -+ if (f >= 1.0F) -+ { -+ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180784_1_)); -+ } -+ return; -+ } -+ -+ if (!block.isAir(field_73092_a, p_180784_1_) && f >= 1.0F) -+ { - this.func_180237_b(p_180784_1_); - } - else -@@ -196,7 +223,7 @@ - int i = this.field_73100_i - this.field_73089_e; - Block block = this.field_73092_a.func_180495_p(p_180785_1_).func_177230_c(); - -- if (block.func_149688_o() != Material.field_151579_a) -+ if (!block.isAir(field_73092_a, p_180785_1_)) - { - float f = block.func_180647_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180785_1_) * (float)(i + 1); - -@@ -225,9 +252,13 @@ - - private boolean func_180235_c(BlockPos p_180235_1_) - { -+ return removeBlock(p_180235_1_, false); -+ } -+ private boolean removeBlock(BlockPos p_180235_1_, boolean canHarvest) -+ { - IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180235_1_); - iblockstate.func_177230_c().func_176208_a(this.field_73092_a, p_180235_1_, iblockstate, this.field_73090_b); -- boolean flag = this.field_73092_a.func_175698_g(p_180235_1_); -+ boolean flag = iblockstate.func_177230_c().removedByPlayer(field_73092_a, p_180235_1_, field_73090_b, canHarvest); - - if (flag) - { -@@ -239,7 +270,8 @@ - - public boolean func_180237_b(BlockPos p_180237_1_) - { -- if (this.field_73091_c.func_77145_d() && this.field_73090_b.func_70694_bm() != null && this.field_73090_b.func_70694_bm().func_77973_b() instanceof ItemSword) -+ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(field_73092_a, field_73091_c, field_73090_b, p_180237_1_); -+ if (exp == -1) - { - return false; - } -@@ -248,40 +280,21 @@ - IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180237_1_); - TileEntity tileentity = this.field_73092_a.func_175625_s(p_180237_1_); - -- if (this.field_73091_c.func_82752_c()) -- { -- if (this.field_73091_c == WorldSettings.GameType.SPECTATOR) -- { -- return false; -- } -+ ItemStack stack = field_73090_b.func_71045_bC(); -+ if (stack != null && stack.func_77973_b().onBlockStartBreak(stack, p_180237_1_, field_73090_b)) return false; - -- if (!this.field_73090_b.func_175142_cm()) -- { -- ItemStack itemstack = this.field_73090_b.func_71045_bC(); -- -- if (itemstack == null) -- { -- return false; -- } -- -- if (!itemstack.func_179544_c(iblockstate.func_177230_c())) -- { -- return false; -- } -- } -- } -- - this.field_73092_a.func_180498_a(this.field_73090_b, 2001, p_180237_1_, Block.func_176210_f(iblockstate)); -- boolean flag1 = this.func_180235_c(p_180237_1_); -+ boolean flag1 = false; - - if (this.func_73083_d()) - { -+ flag1 = this.func_180235_c(p_180237_1_); - this.field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(this.field_73092_a, p_180237_1_)); - } - else - { - ItemStack itemstack1 = this.field_73090_b.func_71045_bC(); -- boolean flag = this.field_73090_b.func_146099_a(iblockstate.func_177230_c()); -+ boolean flag = iblockstate.func_177230_c().canHarvestBlock(field_73092_a, p_180237_1_, field_73090_b); - - if (itemstack1 != null) - { -@@ -293,12 +306,18 @@ - } - } - -+ flag1 = this.removeBlock(p_180237_1_, flag); - if (flag1 && flag) - { - iblockstate.func_177230_c().func_180657_a(this.field_73092_a, this.field_73090_b, p_180237_1_, iblockstate, tileentity); - } - } - -+ // Drop experiance -+ if (!this.func_73083_d() && flag1 && exp > 0) -+ { -+ iblockstate.func_177230_c().func_180637_b(field_73092_a, p_180237_1_, exp); -+ } - return flag1; - } - } -@@ -332,6 +351,7 @@ - if (itemstack.field_77994_a == 0) - { - p_73085_1_.field_71071_by.field_70462_a[p_73085_1_.field_71071_by.field_70461_c] = null; -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_73085_1_, itemstack); - } - - if (!p_73085_1_.func_71039_bw()) -@@ -380,33 +400,51 @@ - } - else - { -- if (!p_180236_1_.func_70093_af() || p_180236_1_.func_70694_bm() == null) -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(p_180236_1_, -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, p_180236_2_, p_180236_4_, p_180236_5_, new net.minecraft.util.Vec3(p_180236_6_, p_180236_7_, p_180236_8_)); -+ if (event.isCanceled()) - { -- IBlockState iblockstate = p_180236_2_.func_180495_p(p_180236_4_); -- -- if (iblockstate.func_177230_c().func_180639_a(p_180236_2_, p_180236_4_, iblockstate, p_180236_1_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_)) -- { -- return true; -- } -+ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180236_4_)); -+ return false; - } - -- if (p_180236_3_ == null) -+ if (p_180236_3_ != null && p_180236_3_.func_77973_b().onItemUseFirst(p_180236_3_, p_180236_1_, p_180236_2_, p_180236_4_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_)) - { -- return false; -+ if (p_180236_3_.field_77994_a <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(field_73090_b, p_180236_3_); -+ return true; - } -- else if (this.func_73083_d()) -+ -+ IBlockState iblockstate = p_180236_2_.func_180495_p(p_180236_4_); -+ boolean isAir = p_180236_2_.func_175623_d(p_180236_4_); -+ boolean useBlock = !p_180236_1_.func_70093_af() || p_180236_1_.func_70694_bm() == null; -+ if (!useBlock) useBlock = p_180236_1_.func_70694_bm().func_77973_b().doesSneakBypassUse(p_180236_2_, p_180236_4_, p_180236_1_); -+ boolean result = false; -+ -+ if (useBlock) - { -- int j = p_180236_3_.func_77960_j(); -- int i = p_180236_3_.field_77994_a; -- boolean flag = p_180236_3_.func_179546_a(p_180236_1_, p_180236_2_, p_180236_4_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_); -- p_180236_3_.func_77964_b(j); -- p_180236_3_.field_77994_a = i; -- return flag; -+ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ result = iblockstate.func_177230_c().func_180639_a(p_180236_2_, p_180236_4_, iblockstate, p_180236_1_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_); -+ } -+ else -+ { -+ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180236_4_)); -+ result = event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW; -+ } - } -- else -+ if (p_180236_3_ != null && !result && event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) - { -- return p_180236_3_.func_179546_a(p_180236_1_, p_180236_2_, p_180236_4_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_); -+ int meta = p_180236_3_.func_77960_j(); -+ int size = p_180236_3_.field_77994_a; -+ result = p_180236_3_.func_179546_a(p_180236_1_, p_180236_2_, p_180236_4_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_); -+ if (func_73083_d()) -+ { -+ p_180236_3_.func_77964_b(meta); -+ p_180236_3_.field_77994_a = size; -+ } -+ if (p_180236_3_.field_77994_a <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(field_73090_b, p_180236_3_); - } -+ return result; - } - } - -@@ -414,4 +452,13 @@ - { - this.field_73092_a = p_73080_1_; - } -+ -+ public double getBlockReachDistance() -+ { -+ return blockReachDistance; -+ } -+ public void setBlockReachDistance(double distance) -+ { -+ blockReachDistance = distance; -+ } - } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch new file mode 100644 index 0000000000..021fd24ea3 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch @@ -0,0 +1,220 @@ +--- ../src-base/minecraft/net/minecraft/server/management/PlayerInteractionManager.java ++++ ../src-work/minecraft/net/minecraft/server/management/PlayerInteractionManager.java +@@ -27,6 +27,8 @@ + + public class PlayerInteractionManager + { ++ /** Forge reach distance */ ++ private double blockReachDistance = 5.0d; + public World field_73092_a; + public EntityPlayerMP field_73090_b; + private WorldSettings.GameType field_73091_c = WorldSettings.GameType.NOT_SET; +@@ -88,7 +90,7 @@ + IBlockState iblockstate = this.field_73092_a.func_180495_p(this.field_180241_i); + Block block = iblockstate.func_177230_c(); + +- if (iblockstate.func_185904_a() == Material.field_151579_a) ++ if (block.isAir(iblockstate, field_73092_a, field_180241_i)) + { + this.field_73097_j = false; + } +@@ -115,7 +117,7 @@ + IBlockState iblockstate1 = this.field_73092_a.func_180495_p(this.field_180240_f); + Block block1 = iblockstate1.func_177230_c(); + +- if (iblockstate1.func_185904_a() == Material.field_151579_a) ++ if (block1.isAir(iblockstate1, field_73092_a, field_180240_f)) + { + this.field_73092_a.func_175715_c(this.field_73090_b.func_145782_y(), this.field_180240_f, -1); + this.field_73094_o = -1; +@@ -124,7 +126,7 @@ + else + { + int k = this.field_73100_i - this.field_73089_e; +- float f1 = iblockstate1.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180241_i) * (float)(k + 1); ++ float f1 = iblockstate1.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180240_f) * (float)(k + 1); // Forge: Fix network break progress using wrong position + int l = (int)(f1 * 10.0F); + + if (l != this.field_73094_o) +@@ -138,6 +140,14 @@ + + public void func_180784_a(BlockPos p_180784_1_, EnumFacing p_180784_2_) + { ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_73090_b, ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, field_73092_a, p_180784_1_, p_180784_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(field_73090_b, getBlockReachDistance() + 1)); ++ if (event.isCanceled()) ++ { ++ field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(field_73092_a, p_180784_1_)); ++ return; ++ } ++ + if (this.func_73083_d()) + { + if (!this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_)) +@@ -173,17 +183,32 @@ + } + } + +- this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); + this.field_73089_e = this.field_73100_i; + float f = 1.0F; + +- if (iblockstate.func_185904_a() != Material.field_151579_a) ++ if (!iblockstate.func_177230_c().isAir(iblockstate, field_73092_a, p_180784_1_)) + { +- block.func_180649_a(this.field_73092_a, p_180784_1_, this.field_73090_b); ++ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ block.func_180649_a(this.field_73092_a, p_180784_1_, this.field_73090_b); ++ this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); ++ } ++ else ++ { ++ field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(field_73092_a, p_180784_1_)); ++ } + f = iblockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180784_1_); + } ++ if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ if (f >= 1.0F) ++ { ++ field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(field_73092_a, p_180784_1_)); ++ } ++ return; ++ } + +- if (iblockstate.func_185904_a() != Material.field_151579_a && f >= 1.0F) ++ if (iblockstate.func_177230_c().isAir(iblockstate, field_73092_a, p_180784_1_) && f >= 1.0F) + { + this.func_180237_b(p_180784_1_); + } +@@ -205,7 +230,7 @@ + int i = this.field_73100_i - this.field_73089_e; + IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180785_1_); + +- if (iblockstate.func_185904_a() != Material.field_151579_a) ++ if (iblockstate.func_177230_c().isAir(iblockstate, field_73092_a, p_180785_1_)) + { + float f = iblockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180785_1_) * (float)(i + 1); + +@@ -234,13 +259,18 @@ + + private boolean func_180235_c(BlockPos p_180235_1_) + { +- IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180235_1_); +- iblockstate.func_177230_c().func_176208_a(this.field_73092_a, p_180235_1_, iblockstate, this.field_73090_b); +- boolean flag = this.field_73092_a.func_175698_g(p_180235_1_); ++ return removeBlock(p_180235_1_, false); ++ } + ++ private boolean removeBlock(BlockPos pos, boolean canHarvest) ++ { ++ IBlockState iblockstate = this.field_73092_a.func_180495_p(pos); ++ iblockstate.func_177230_c().func_176208_a(this.field_73092_a, pos, iblockstate, this.field_73090_b); ++ boolean flag = iblockstate.func_177230_c().removedByPlayer(iblockstate, field_73092_a, pos, field_73090_b, canHarvest); ++ + if (flag) + { +- iblockstate.func_177230_c().func_176206_d(this.field_73092_a, p_180235_1_, iblockstate); ++ iblockstate.func_177230_c().func_176206_d(this.field_73092_a, pos, iblockstate); + } + + return flag; +@@ -248,7 +278,8 @@ + + public boolean func_180237_b(BlockPos p_180237_1_) + { +- if (this.field_73091_c.func_77145_d() && this.field_73090_b.func_184614_ca() != null && this.field_73090_b.func_184614_ca().func_77973_b() instanceof ItemSword) ++ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(field_73092_a, field_73091_c, field_73090_b, p_180237_1_); ++ if (exp == -1) + { + return false; + } +@@ -264,41 +295,22 @@ + } + else + { +- if (this.field_73091_c.func_82752_c()) +- { +- if (this.field_73091_c == WorldSettings.GameType.SPECTATOR) +- { +- return false; +- } ++ ItemStack stack = field_73090_b.func_184614_ca(); ++ if (stack != null && stack.func_77973_b().onBlockStartBreak(stack, p_180237_1_, field_73090_b)) return false; + +- if (!this.field_73090_b.func_175142_cm()) +- { +- ItemStack itemstack = this.field_73090_b.func_184614_ca(); +- +- if (itemstack == null) +- { +- return false; +- } +- +- if (!itemstack.func_179544_c(iblockstate.func_177230_c())) +- { +- return false; +- } +- } +- } +- + this.field_73092_a.func_180498_a(this.field_73090_b, 2001, p_180237_1_, Block.func_176210_f(iblockstate)); +- boolean flag1 = this.func_180235_c(p_180237_1_); ++ boolean flag1 = false; + + if (this.func_73083_d()) + { ++ flag1 = this.func_180235_c(p_180237_1_); + this.field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(this.field_73092_a, p_180237_1_)); + } + else + { + ItemStack itemstack1 = this.field_73090_b.func_184614_ca(); + ItemStack itemstack2 = itemstack1 == null ? null : itemstack1.func_77946_l(); +- boolean flag = this.field_73090_b.func_184823_b(iblockstate); ++ boolean flag = iblockstate.func_177230_c().canHarvestBlock(field_73092_a, p_180237_1_, field_73090_b); + + if (itemstack1 != null) + { +@@ -310,12 +322,18 @@ + } + } + ++ flag1 = this.removeBlock(p_180237_1_, flag); + if (flag1 && flag) + { + iblockstate.func_177230_c().func_180657_a(this.field_73092_a, this.field_73090_b, p_180237_1_, iblockstate, tileentity, itemstack2); + } + } + ++ // Drop experience ++ if (!this.func_73083_d() && flag1 && exp > 0) ++ { ++ iblockstate.func_177230_c().func_180637_b(field_73092_a, p_180237_1_, exp); ++ } + return flag1; + } + } +@@ -359,6 +377,7 @@ + if (itemstack.field_77994_a == 0) + { + p_187250_1_.func_184611_a(p_187250_4_, (ItemStack)null); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187250_1_, itemstack, p_187250_4_); + } + + if (!p_187250_1_.func_184587_cr()) +@@ -445,4 +464,13 @@ + { + this.field_73092_a = p_73080_1_; + } ++ ++ public double getBlockReachDistance() ++ { ++ return blockReachDistance; ++ } ++ public void setBlockReachDistance(double distance) ++ { ++ blockReachDistance = distance; ++ } + } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch new file mode 100644 index 0000000000..8e24f9923a --- /dev/null +++ b/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch @@ -0,0 +1,377 @@ +--- ../src-base/minecraft/net/minecraft/server/management/PlayerList.java ++++ ../src-work/minecraft/net/minecraft/server/management/PlayerList.java +@@ -101,65 +101,76 @@ + this.field_72405_c = 8; + } + +- public void func_72355_a(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_) ++ public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn, NetHandlerPlayServer nethandlerplayserver) + { +- GameProfile gameprofile = p_72355_2_.func_146103_bH(); ++ GameProfile gameprofile = playerIn.func_146103_bH(); + PlayerProfileCache playerprofilecache = this.field_72400_f.func_152358_ax(); + GameProfile gameprofile1 = playerprofilecache.func_152652_a(gameprofile.getId()); + String s = gameprofile1 == null ? gameprofile.getName() : gameprofile1.getName(); + playerprofilecache.func_152649_a(gameprofile); +- NBTTagCompound nbttagcompound = this.func_72380_a(p_72355_2_); +- p_72355_2_.func_70029_a(this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK)); +- p_72355_2_.field_71134_c.func_73080_a((WorldServer)p_72355_2_.field_70170_p); ++ NBTTagCompound nbttagcompound = this.func_72380_a(playerIn); ++ playerIn.func_70029_a(this.field_72400_f.func_71218_a(playerIn.field_71093_bK)); ++ ++ World playerWorld = this.field_72400_f.func_71218_a(playerIn.field_71093_bK); ++ if (playerWorld == null) ++ { ++ playerIn.field_71093_bK = 0; ++ playerWorld = this.field_72400_f.func_71218_a(0); ++ BlockPos spawnPoint = playerWorld.field_73011_w.getRandomizedSpawnPoint(); ++ playerIn.func_70107_b(spawnPoint.func_177958_n(), spawnPoint.func_177956_o(), spawnPoint.func_177952_p()); ++ } ++ ++ playerIn.func_70029_a(playerWorld); ++ playerIn.field_71134_c.func_73080_a((WorldServer)playerIn.field_70170_p); + String s1 = "local"; + +- if (p_72355_1_.func_74430_c() != null) ++ if (netManager.func_74430_c() != null) + { +- s1 = p_72355_1_.func_74430_c().toString(); ++ s1 = netManager.func_74430_c().toString(); + } + +- field_148546_d.info(p_72355_2_.func_70005_c_() + "[" + s1 + "] logged in with entity id " + p_72355_2_.func_145782_y() + " at (" + p_72355_2_.field_70165_t + ", " + p_72355_2_.field_70163_u + ", " + p_72355_2_.field_70161_v + ")"); +- WorldServer worldserver = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); ++ field_148546_d.info(playerIn.func_70005_c_() + "[" + s1 + "] logged in with entity id " + playerIn.func_145782_y() + " at (" + playerIn.field_70165_t + ", " + playerIn.field_70163_u + ", " + playerIn.field_70161_v + ")"); ++ WorldServer worldserver = this.field_72400_f.func_71218_a(playerIn.field_71093_bK); + WorldInfo worldinfo = worldserver.func_72912_H(); + BlockPos blockpos = worldserver.func_175694_M(); +- this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver); +- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.field_72400_f, p_72355_1_, p_72355_2_); +- nethandlerplayserver.func_147359_a(new SPacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.func_186058_p().func_186068_a(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo"))); ++ this.func_72381_a(playerIn, (EntityPlayerMP)null, worldserver); ++ playerIn.field_71135_a = nethandlerplayserver; ++ nethandlerplayserver.func_147359_a(new SPacketJoinGame(playerIn.func_145782_y(), playerIn.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.func_186058_p().func_186068_a(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo"))); + nethandlerplayserver.func_147359_a(new SPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).func_180714_a(this.func_72365_p().getServerModName()))); + nethandlerplayserver.func_147359_a(new SPacketServerDifficulty(worldinfo.func_176130_y(), worldinfo.func_176123_z())); + nethandlerplayserver.func_147359_a(new SPacketSpawnPosition(blockpos)); +- nethandlerplayserver.func_147359_a(new SPacketPlayerAbilities(p_72355_2_.field_71075_bZ)); +- nethandlerplayserver.func_147359_a(new SPacketHeldItemChange(p_72355_2_.field_71071_by.field_70461_c)); +- this.func_187243_f(p_72355_2_); +- p_72355_2_.func_147099_x().func_150877_d(); +- p_72355_2_.func_147099_x().func_150884_b(p_72355_2_); +- this.func_96456_a((ServerScoreboard)worldserver.func_96441_U(), p_72355_2_); ++ nethandlerplayserver.func_147359_a(new SPacketPlayerAbilities(playerIn.field_71075_bZ)); ++ nethandlerplayserver.func_147359_a(new SPacketHeldItemChange(playerIn.field_71071_by.field_70461_c)); ++ this.func_187243_f(playerIn); ++ playerIn.func_147099_x().func_150877_d(); ++ playerIn.func_147099_x().func_150884_b(playerIn); ++ this.func_96456_a((ServerScoreboard)worldserver.func_96441_U(), playerIn); + this.field_72400_f.func_147132_au(); + TextComponentTranslation textcomponenttranslation; + +- if (!p_72355_2_.func_70005_c_().equalsIgnoreCase(s)) ++ if (!playerIn.func_70005_c_().equalsIgnoreCase(s)) + { +- textcomponenttranslation = new TextComponentTranslation("multiplayer.player.joined.renamed", new Object[] {p_72355_2_.func_145748_c_(), s}); ++ textcomponenttranslation = new TextComponentTranslation("multiplayer.player.joined.renamed", new Object[] {playerIn.func_145748_c_(), s}); + } + else + { +- textcomponenttranslation = new TextComponentTranslation("multiplayer.player.joined", new Object[] {p_72355_2_.func_145748_c_()}); ++ textcomponenttranslation = new TextComponentTranslation("multiplayer.player.joined", new Object[] {playerIn.func_145748_c_()}); + } + + textcomponenttranslation.func_150256_b().func_150238_a(TextFormatting.YELLOW); + this.func_148539_a(textcomponenttranslation); +- this.func_72377_c(p_72355_2_); +- nethandlerplayserver.func_147364_a(p_72355_2_.field_70165_t, p_72355_2_.field_70163_u, p_72355_2_.field_70161_v, p_72355_2_.field_70177_z, p_72355_2_.field_70125_A); +- this.func_72354_b(p_72355_2_, worldserver); ++ this.func_72377_c(playerIn); ++ nethandlerplayserver.func_147364_a(playerIn.field_70165_t, playerIn.field_70163_u, playerIn.field_70161_v, playerIn.field_70177_z, playerIn.field_70125_A); ++ this.func_72354_b(playerIn, worldserver); + + if (!this.field_72400_f.func_147133_T().isEmpty()) + { +- p_72355_2_.func_175397_a(this.field_72400_f.func_147133_T(), this.field_72400_f.func_175581_ab()); ++ playerIn.func_175397_a(this.field_72400_f.func_147133_T(), this.field_72400_f.func_175581_ab()); + } + +- for (PotionEffect potioneffect : p_72355_2_.func_70651_bq()) ++ for (PotionEffect potioneffect : playerIn.func_70651_bq()) + { +- nethandlerplayserver.func_147359_a(new SPacketEntityEffect(p_72355_2_.func_145782_y(), potioneffect)); ++ nethandlerplayserver.func_147359_a(new SPacketEntityEffect(playerIn.func_145782_y(), potioneffect)); + } + + if (nbttagcompound != null) +@@ -175,7 +186,7 @@ + + if (entity2.func_110124_au().equals(uuid)) + { +- p_72355_2_.func_184205_a(entity2, true); ++ playerIn.func_184205_a(entity2, true); + } + else + { +@@ -183,13 +194,13 @@ + { + if (entity.func_110124_au().equals(uuid)) + { +- p_72355_2_.func_184205_a(entity, true); ++ playerIn.func_184205_a(entity, true); + break; + } + } + } + +- if (!p_72355_2_.func_184218_aH()) ++ if (!playerIn.func_184218_aH()) + { + field_148546_d.warn("Couldn\'t reattach entity to player"); + worldserver.func_72973_f(entity2); +@@ -207,12 +218,13 @@ + + if (entity1 != null) + { +- p_72355_2_.func_184205_a(entity1, true); ++ playerIn.func_184205_a(entity1, true); + } + } + } + +- p_72355_2_.func_71116_b(); ++ playerIn.func_71116_b(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(playerIn); + } + + protected void func_96456_a(ServerScoreboard p_96456_1_, EntityPlayerMP p_96456_2_) +@@ -302,6 +314,7 @@ + nbttagcompound1 = this.field_72400_f.func_184110_aI().func_188257_a(FixTypes.PLAYER, nbttagcompound); + p_72380_1_.func_70020_e(nbttagcompound1); + field_148546_d.debug("loading single player"); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_72380_1_, this.field_72412_k, p_72380_1_.func_110124_au().toString()); + } + else + { +@@ -311,8 +324,24 @@ + return nbttagcompound1; + } + ++ public NBTTagCompound getPlayerNBT(EntityPlayerMP player) ++ { ++ // Hacky method to allow loading the NBT for a player prior to login ++ NBTTagCompound nbttagcompound = this.field_72400_f.field_71305_c[0].func_72912_H().func_76072_h(); ++ if (player.func_70005_c_().equals(this.field_72400_f.func_71214_G()) && nbttagcompound != null) ++ { ++ return nbttagcompound; ++ } ++ else ++ { ++ return ((net.minecraft.world.storage.SaveHandler)this.field_72412_k).getPlayerNBT(player); ++ } ++ } ++ + protected void func_72391_b(EntityPlayerMP p_72391_1_) + { ++ if (p_72391_1_.field_71135_a == null) return; ++ + this.field_72412_k.func_75753_a(p_72391_1_); + StatisticsFile statisticsfile = (StatisticsFile)this.field_148547_k.get(p_72391_1_.func_110124_au()); + +@@ -334,6 +363,7 @@ + p_72377_1_.field_71135_a.func_147359_a(new SPacketPlayerListItem(SPacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {(EntityPlayerMP)this.field_72404_b.get(i)})); + } + ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k()); + worldserver.func_72838_d(p_72377_1_); + this.func_72375_a(p_72377_1_, (WorldServer)null); + } +@@ -345,6 +375,7 @@ + + public void func_72367_e(EntityPlayerMP p_72367_1_) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(p_72367_1_); + WorldServer worldserver = p_72367_1_.func_71121_q(); + p_72367_1_.func_71029_a(StatList.field_75947_j); + this.func_72391_b(p_72367_1_); +@@ -379,6 +410,7 @@ + this.field_177454_f.remove(uuid); + this.field_148547_k.remove(uuid); + } ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k()); + + this.func_148540_a(new SPacketPlayerListItem(SPacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {p_72367_1_})); + } +@@ -462,13 +494,23 @@ + + public EntityPlayerMP func_72368_a(EntityPlayerMP p_72368_1_, int p_72368_2_, boolean p_72368_3_) + { ++ World world = field_72400_f.func_71218_a(p_72368_2_); ++ if (world == null) ++ { ++ p_72368_2_ = 0; ++ } ++ else if (!world.field_73011_w.func_76567_e()) ++ { ++ p_72368_2_ = world.field_73011_w.getRespawnDimension(p_72368_1_); ++ } ++ + p_72368_1_.func_71121_q().func_73039_n().func_72787_a(p_72368_1_); + p_72368_1_.func_71121_q().func_73039_n().func_72790_b(p_72368_1_); + p_72368_1_.func_71121_q().func_184164_w().func_72695_c(p_72368_1_); + this.field_72404_b.remove(p_72368_1_); + this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK).func_72973_f(p_72368_1_); +- BlockPos blockpos = p_72368_1_.func_180470_cg(); +- boolean flag = p_72368_1_.func_82245_bX(); ++ BlockPos blockpos = p_72368_1_.getBedLocation(p_72368_2_); ++ boolean flag = p_72368_1_.isSpawnForced(p_72368_2_); + p_72368_1_.field_71093_bK = p_72368_2_; + PlayerInteractionManager playerinteractionmanager; + +@@ -484,7 +526,8 @@ + EntityPlayerMP entityplayermp = new EntityPlayerMP(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), playerinteractionmanager); + entityplayermp.field_71135_a = p_72368_1_.field_71135_a; + entityplayermp.func_71049_a(p_72368_1_, p_72368_3_); +- entityplayermp.func_145769_d(p_72368_1_.func_145782_y()); ++ entityplayermp.field_71093_bK = p_72368_2_; ++ entityplayermp.func_145769_d(p_72368_1_.func_145782_y()); + entityplayermp.func_174817_o(p_72368_1_); + entityplayermp.func_184819_a(p_72368_1_.func_184591_cq()); + +@@ -531,6 +574,7 @@ + this.field_177454_f.put(entityplayermp.func_110124_au(), entityplayermp); + entityplayermp.func_71116_b(); + entityplayermp.func_70606_j(entityplayermp.func_110143_aJ()); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp); + return entityplayermp; + } + +@@ -545,15 +589,20 @@ + + public void func_187242_a(EntityPlayerMP p_187242_1_, int p_187242_2_) + { ++ transferPlayerToDimension(p_187242_1_, p_187242_2_, field_72400_f.func_71218_a(p_187242_2_).func_85176_s()); ++ } ++ ++ public void transferPlayerToDimension(EntityPlayerMP p_187242_1_, int p_187242_2_, net.minecraft.world.Teleporter teleporter) ++ { + int i = p_187242_1_.field_71093_bK; + WorldServer worldserver = this.field_72400_f.func_71218_a(p_187242_1_.field_71093_bK); + p_187242_1_.field_71093_bK = p_187242_2_; + WorldServer worldserver1 = this.field_72400_f.func_71218_a(p_187242_1_.field_71093_bK); +- p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, p_187242_1_.field_70170_p.func_175659_aa(), p_187242_1_.field_70170_p.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b())); ++ p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, worldserver1.func_175659_aa(), worldserver1.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b())); + this.func_187243_f(p_187242_1_); + worldserver.func_72973_f(p_187242_1_); + p_187242_1_.field_70128_L = false; +- this.func_82448_a(p_187242_1_, i, worldserver, worldserver1); ++ this.transferEntityToWorld(p_187242_1_, i, worldserver, worldserver1, teleporter); + this.func_72375_a(p_187242_1_, worldserver); + p_187242_1_.field_71135_a.func_147364_a(p_187242_1_.field_70165_t, p_187242_1_.field_70163_u, p_187242_1_.field_70161_v, p_187242_1_.field_70177_z, p_187242_1_.field_70125_A); + p_187242_1_.field_71134_c.func_73080_a(worldserver1); +@@ -565,39 +614,50 @@ + { + p_187242_1_.field_71135_a.func_147359_a(new SPacketEntityEffect(p_187242_1_.func_145782_y(), potioneffect)); + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_187242_1_, i, p_187242_2_); + } + + public void func_82448_a(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) + { +- double d0 = p_82448_1_.field_70165_t; +- double d1 = p_82448_1_.field_70161_v; ++ transferEntityToWorld(p_82448_1_, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.func_85176_s()); ++ } ++ ++ @SuppressWarnings("unused") ++ public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter) ++ { ++ net.minecraft.world.WorldProvider pOld = p_82448_3_.field_73011_w; ++ net.minecraft.world.WorldProvider pNew = p_82448_4_.field_73011_w; ++ double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor(); ++ double d0 = entityIn.field_70165_t * moveFactor; ++ double d1 = entityIn.field_70161_v * moveFactor; + double d2 = 8.0D; +- float f = p_82448_1_.field_70177_z; ++ float f = entityIn.field_70177_z; + p_82448_3_.field_72984_F.func_76320_a("moving"); + +- if (p_82448_1_.field_71093_bK == -1) ++ if (false && entityIn.field_71093_bK == -1) + { + d0 = MathHelper.func_151237_a(d0 / d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); + d1 = MathHelper.func_151237_a(d1 / d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); +- p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); ++ entityIn.func_70012_b(d0, entityIn.field_70163_u, d1, entityIn.field_70177_z, entityIn.field_70125_A); + +- if (p_82448_1_.func_70089_S()) ++ if (entityIn.func_70089_S()) + { +- p_82448_3_.func_72866_a(p_82448_1_, false); ++ p_82448_3_.func_72866_a(entityIn, false); + } + } +- else if (p_82448_1_.field_71093_bK == 0) ++ else if (false && entityIn.field_71093_bK == 0) + { + d0 = MathHelper.func_151237_a(d0 * d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); + d1 = MathHelper.func_151237_a(d1 * d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); +- p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); ++ entityIn.func_70012_b(d0, entityIn.field_70163_u, d1, entityIn.field_70177_z, entityIn.field_70125_A); + +- if (p_82448_1_.func_70089_S()) ++ if (entityIn.func_70089_S()) + { +- p_82448_3_.func_72866_a(p_82448_1_, false); ++ p_82448_3_.func_72866_a(entityIn, false); + } + } +- else ++ ++ if (entityIn.field_71093_bK == 1) + { + BlockPos blockpos; + +@@ -611,13 +671,13 @@ + } + + d0 = (double)blockpos.func_177958_n(); +- p_82448_1_.field_70163_u = (double)blockpos.func_177956_o(); ++ entityIn.field_70163_u = (double)blockpos.func_177956_o(); + d1 = (double)blockpos.func_177952_p(); +- p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, 90.0F, 0.0F); ++ entityIn.func_70012_b(d0, entityIn.field_70163_u, d1, 90.0F, 0.0F); + +- if (p_82448_1_.func_70089_S()) ++ if (entityIn.func_70089_S()) + { +- p_82448_3_.func_72866_a(p_82448_1_, false); ++ p_82448_3_.func_72866_a(entityIn, false); + } + } + +@@ -629,18 +689,18 @@ + d0 = (double)MathHelper.func_76125_a((int)d0, -29999872, 29999872); + d1 = (double)MathHelper.func_76125_a((int)d1, -29999872, 29999872); + +- if (p_82448_1_.func_70089_S()) ++ if (entityIn.func_70089_S()) + { +- p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); +- p_82448_4_.func_85176_s().func_180266_a(p_82448_1_, f); +- p_82448_4_.func_72838_d(p_82448_1_); +- p_82448_4_.func_72866_a(p_82448_1_, false); ++ entityIn.func_70012_b(d0, entityIn.field_70163_u, d1, entityIn.field_70177_z, entityIn.field_70125_A); ++ teleporter.func_180266_a(entityIn, f); ++ p_82448_4_.func_72838_d(entityIn); ++ p_82448_4_.func_72866_a(entityIn, false); + } + + p_82448_3_.field_72984_F.func_76319_b(); + } + +- p_82448_1_.func_70029_a(p_82448_4_); ++ entityIn.func_70029_a(p_82448_4_); + } + + public void func_72374_b() diff --git a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch index e0c026df7d..7bb6f7e6d5 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch @@ -1,32 +1,6 @@ --- ../src-base/minecraft/net/minecraft/server/management/PlayerManager.java +++ ../src-work/minecraft/net/minecraft/server/management/PlayerManager.java -@@ -117,15 +117,24 @@ - int j = (int)p_72683_1_.field_70161_v >> 4; - p_72683_1_.field_71131_d = p_72683_1_.field_70165_t; - p_72683_1_.field_71132_e = p_72683_1_.field_70161_v; -+ // Load nearby chunks first -+ List chunkList = Lists.newArrayList(); - - for (int k = i - this.field_72698_e; k <= i + this.field_72698_e; ++k) - { - for (int l = j - this.field_72698_e; l <= j + this.field_72698_e; ++l) - { -- this.func_72690_a(k, l, true).func_73255_a(p_72683_1_); -+ chunkList.add(new ChunkCoordIntPair(k, l)); - } - } - -+ java.util.Collections.sort(chunkList, new net.minecraftforge.common.util.ChunkCoordComparator(p_72683_1_)); -+ -+ for (ChunkCoordIntPair pair : chunkList) -+ { -+ this.func_72690_a(pair.field_77276_a, pair.field_77275_b, true).func_73255_a(p_72683_1_); -+ } -+ - this.field_72699_b.add(p_72683_1_); - this.func_72691_b(p_72683_1_); - } -@@ -225,6 +234,7 @@ +@@ -338,6 +338,7 @@ int i1 = this.field_72698_e; int j1 = i - k; int k1 = j - l; @@ -34,187 +8,3 @@ if (j1 != 0 || k1 != 0) { -@@ -234,7 +244,7 @@ - { - if (!this.func_72684_a(l1, i2, k, l, i1)) - { -- this.func_72690_a(l1, i2, true).func_73255_a(p_72685_1_); -+ chunksToLoad.add(new ChunkCoordIntPair(l1, i2)); - } - - if (!this.func_72684_a(l1 - j1, i2 - k1, i, j, i1)) -@@ -252,6 +262,18 @@ - this.func_72691_b(p_72685_1_); - p_72685_1_.field_71131_d = p_72685_1_.field_70165_t; - p_72685_1_.field_71132_e = p_72685_1_.field_70161_v; -+ // send nearest chunks first -+ java.util.Collections.sort(chunksToLoad, new net.minecraftforge.common.util.ChunkCoordComparator(p_72685_1_)); -+ -+ for (ChunkCoordIntPair pair : chunksToLoad) -+ { -+ this.func_72690_a(pair.field_77276_a, pair.field_77275_b, true).func_73255_a(p_72685_1_); -+ } -+ -+ if (i1 > 1 || i1 < -1 || j1 > 1 || j1 < -1) -+ { -+ java.util.Collections.sort(p_72685_1_.field_71129_f, new net.minecraftforge.common.util.ChunkCoordComparator(p_72685_1_)); -+ } - } - } - } -@@ -322,11 +344,20 @@ - private int field_73262_e; - private int field_73260_f; - private long field_111198_g; -+ private final java.util.HashMap players = new java.util.HashMap(); -+ private boolean loaded = false; -+ private Runnable loadedRunnable = new Runnable() -+ { -+ public void run() -+ { -+ PlayerInstance.this.loaded = true; -+ } -+ }; - - public PlayerInstance(int p_i1518_2_, int p_i1518_3_) - { - this.field_73264_c = new ChunkCoordIntPair(p_i1518_2_, p_i1518_3_); -- PlayerManager.this.func_72688_a().field_73059_b.func_73158_c(p_i1518_2_, p_i1518_3_); -+ PlayerManager.this.func_72688_a().field_73059_b.loadChunk(p_i1518_2_, p_i1518_3_, this.loadedRunnable); - } - - public void func_73255_a(EntityPlayerMP p_73255_1_) -@@ -343,7 +374,24 @@ - } - - this.field_73263_b.add(p_73255_1_); -+ Runnable playerRunnable = null; -+ if (this.loaded) -+ { - p_73255_1_.field_71129_f.add(this.field_73264_c); -+ } -+ else -+ { -+ final EntityPlayerMP tmp = p_73255_1_; -+ playerRunnable = new Runnable() -+ { -+ public void run() -+ { -+ tmp.field_71129_f.add(PlayerInstance.this.field_73264_c); -+ } -+ }; -+ PlayerManager.this.func_72688_a().field_73059_b.loadChunk(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b, playerRunnable); -+ } -+ this.players.put(p_73255_1_, playerRunnable); - } - } - -@@ -351,6 +399,24 @@ - { - if (this.field_73263_b.contains(p_73252_1_)) - { -+ // If we haven't loaded yet don't load the chunk just so we can clean it up -+ if (!this.loaded) -+ { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.func_72688_a(), this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b, this.players.get(p_73252_1_)); -+ this.field_73263_b.remove(p_73252_1_); -+ this.players.remove(p_73252_1_); -+ -+ if (this.field_73263_b.isEmpty()) -+ { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.func_72688_a(), this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b, this.loadedRunnable); -+ long i = (long) this.field_73264_c.field_77276_a + 2147483647L | (long) this.field_73264_c.field_77275_b + 2147483647L << 32; -+ PlayerManager.this.field_72700_c.func_76159_d(i); -+ PlayerManager.this.field_111193_e.remove(this); -+ } -+ -+ return; -+ } -+ - Chunk chunk = PlayerManager.this.field_72701_a.func_72964_e(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b); - - if (chunk.func_150802_k()) -@@ -358,9 +424,12 @@ - p_73252_1_.field_71135_a.func_147359_a(new S21PacketChunkData(chunk, true, 0)); - } - -+ this.players.remove(p_73252_1_); - this.field_73263_b.remove(p_73252_1_); - p_73252_1_.field_71129_f.remove(this.field_73264_c); - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.UnWatch(field_73264_c, p_73252_1_)); -+ - if (this.field_73263_b.isEmpty()) - { - long i = (long)this.field_73264_c.field_77276_a + 2147483647L | (long)this.field_73264_c.field_77275_b + 2147483647L << 32; -@@ -398,7 +467,7 @@ - - this.field_73260_f |= 1 << (p_151253_2_ >> 4); - -- if (this.field_73262_e < 64) -+ //Forge; Cache everything, so always run - { - short short1 = (short)(p_151253_1_ << 12 | p_151253_3_ << 8 | p_151253_2_); - -@@ -410,6 +479,10 @@ - } - } - -+ if (field_73262_e == field_151254_d.length) -+ { -+ field_151254_d = java.util.Arrays.copyOf(field_151254_d, field_151254_d.length << 1); -+ } - this.field_151254_d[this.field_73262_e++] = short1; - } - } -@@ -427,6 +500,7 @@ - } - } - -+ @SuppressWarnings("unused") - public void func_73254_a() - { - if (this.field_73262_e != 0) -@@ -439,18 +513,19 @@ - BlockPos blockpos = new BlockPos(i, j, k); - this.func_151251_a(new S23PacketBlockChange(PlayerManager.this.field_72701_a, blockpos)); - -- if (PlayerManager.this.field_72701_a.func_180495_p(blockpos).func_177230_c().func_149716_u()) -+ if (PlayerManager.this.field_72701_a.func_180495_p(blockpos).func_177230_c().hasTileEntity(PlayerManager.this.field_72701_a.func_180495_p(blockpos))) - { - this.func_151252_a(PlayerManager.this.field_72701_a.func_175625_s(blockpos)); - } - } -- else if (this.field_73262_e == 64) -+ else if (this.field_73262_e >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) - { - int i1 = this.field_73264_c.field_77276_a * 16; - int k1 = this.field_73264_c.field_77275_b * 16; - this.func_151251_a(new S21PacketChunkData(PlayerManager.this.field_72701_a.func_72964_e(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b), false, this.field_73260_f)); - -- for (int i2 = 0; i2 < 16; ++i2) -+ // Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones -+ for (int i2 = 0; false && i2 < 16; ++i2) - { - if ((this.field_73260_f & 1 << i2) != 0) - { -@@ -467,7 +542,9 @@ - else - { - this.func_151251_a(new S22PacketMultiBlockChange(this.field_73262_e, this.field_151254_d, PlayerManager.this.field_72701_a.func_72964_e(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b))); -- -+ } -+ { // Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small -+ WorldServer world = PlayerManager.this.field_72701_a; - for (int j1 = 0; j1 < this.field_73262_e; ++j1) - { - int l1 = (this.field_151254_d[j1] >> 12 & 15) + this.field_73264_c.field_77276_a * 16; -@@ -475,7 +552,7 @@ - int l2 = (this.field_151254_d[j1] >> 8 & 15) + this.field_73264_c.field_77275_b * 16; - BlockPos blockpos1 = new BlockPos(l1, j2, l2); - -- if (PlayerManager.this.field_72701_a.func_180495_p(blockpos1).func_177230_c().func_149716_u()) -+ if (world.func_180495_p(blockpos1).func_177230_c().hasTileEntity(world.func_180495_p(blockpos1))) - { - this.func_151252_a(PlayerManager.this.field_72701_a.func_175625_s(blockpos1)); - } diff --git a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch deleted file mode 100644 index 2f7ace96d3..0000000000 --- a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ /dev/null @@ -1,223 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java -+++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java -@@ -99,7 +99,7 @@ - this.field_72405_c = 8; - } - -- public void func_72355_a(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_) -+ public void func_72355_a(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_, NetHandlerPlayServer nethandlerplayserver) - { - GameProfile gameprofile = p_72355_2_.func_146103_bH(); - PlayerProfileCache playerprofilecache = this.field_72400_f.func_152358_ax(); -@@ -108,6 +108,17 @@ - playerprofilecache.func_152649_a(gameprofile); - NBTTagCompound nbttagcompound = this.func_72380_a(p_72355_2_); - p_72355_2_.func_70029_a(this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK)); -+ -+ World playerWorld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); -+ if (playerWorld == null) -+ { -+ p_72355_2_.field_71093_bK=0; -+ playerWorld=this.field_72400_f.func_71218_a(0); -+ BlockPos spawnPoint = playerWorld.field_73011_w.getRandomizedSpawnPoint(); -+ p_72355_2_.func_70107_b(spawnPoint.func_177958_n(), spawnPoint.func_177956_o(), spawnPoint.func_177952_p()); -+ } -+ -+ p_72355_2_.func_70029_a(playerWorld); - p_72355_2_.field_71134_c.func_73080_a((WorldServer)p_72355_2_.field_70170_p); - String s1 = "local"; - -@@ -121,7 +132,7 @@ - WorldInfo worldinfo = worldserver.func_72912_H(); - BlockPos blockpos = worldserver.func_175694_M(); - this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver); -- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.field_72400_f, p_72355_1_, p_72355_2_); -+ p_72355_2_.field_71135_a = nethandlerplayserver; - nethandlerplayserver.func_147359_a(new S01PacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.func_177502_q(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo"))); - nethandlerplayserver.func_147359_a(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).func_180714_a(this.func_72365_p().getServerModName()))); - nethandlerplayserver.func_147359_a(new S41PacketServerDifficulty(worldinfo.func_176130_y(), worldinfo.func_176123_z())); -@@ -161,6 +172,7 @@ - - p_72355_2_.func_71116_b(); - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(p_72355_2_); - if (nbttagcompound != null && nbttagcompound.func_150297_b("Riding", 10)) - { - Entity entity = EntityList.func_75615_a(nbttagcompound.func_74775_l("Riding"), worldserver); -@@ -262,6 +274,7 @@ - p_72380_1_.func_70020_e(nbttagcompound); - nbttagcompound1 = nbttagcompound; - field_148546_d.debug("loading single player"); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_72380_1_, this.field_72412_k, p_72380_1_.func_110124_au().toString()); - } - else - { -@@ -271,8 +284,23 @@ - return nbttagcompound1; - } - -+ public NBTTagCompound getPlayerNBT(EntityPlayerMP player) -+ { -+ // Hacky method to allow loading the NBT for a player prior to login -+ NBTTagCompound nbttagcompound = this.field_72400_f.field_71305_c[0].func_72912_H().func_76072_h(); -+ if (player.func_70005_c_().equals(this.field_72400_f.func_71214_G()) && nbttagcompound != null) -+ { -+ return nbttagcompound; -+ } -+ else -+ { -+ return ((net.minecraft.world.storage.SaveHandler)this.field_72412_k).getPlayerNBT(player); -+ } -+ } - protected void func_72391_b(EntityPlayerMP p_72391_1_) - { -+ if (p_72391_1_.field_71135_a == null) return; -+ - this.field_72412_k.func_75753_a(p_72391_1_); - StatisticsFile statisticsfile = (StatisticsFile)this.field_148547_k.get(p_72391_1_.func_110124_au()); - -@@ -288,6 +316,7 @@ - this.field_177454_f.put(p_72377_1_.func_110124_au(), p_72377_1_); - this.func_148540_a(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {p_72377_1_})); - WorldServer worldserver = this.field_72400_f.func_71218_a(p_72377_1_.field_71093_bK); -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k()); - worldserver.func_72838_d(p_72377_1_); - this.func_72375_a(p_72377_1_, (WorldServer)null); - -@@ -305,6 +334,7 @@ - - public void func_72367_e(EntityPlayerMP p_72367_1_) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(p_72367_1_); - p_72367_1_.func_71029_a(StatList.field_75947_j); - this.func_72391_b(p_72367_1_); - WorldServer worldserver = p_72367_1_.func_71121_q(); -@@ -326,6 +356,7 @@ - this.field_177454_f.remove(uuid); - this.field_148547_k.remove(uuid); - } -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k()); - - this.func_148540_a(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {p_72367_1_})); - } -@@ -409,13 +440,23 @@ - - public EntityPlayerMP func_72368_a(EntityPlayerMP p_72368_1_, int p_72368_2_, boolean p_72368_3_) - { -+ World world = field_72400_f.func_71218_a(p_72368_2_); -+ if (world == null) -+ { -+ p_72368_2_ = 0; -+ } -+ else if (!world.field_73011_w.func_76567_e()) -+ { -+ p_72368_2_ = world.field_73011_w.getRespawnDimension(p_72368_1_); -+ } -+ - p_72368_1_.func_71121_q().func_73039_n().func_72787_a(p_72368_1_); - p_72368_1_.func_71121_q().func_73039_n().func_72790_b(p_72368_1_); - p_72368_1_.func_71121_q().func_73040_p().func_72695_c(p_72368_1_); - this.field_72404_b.remove(p_72368_1_); - this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK).func_72973_f(p_72368_1_); -- BlockPos blockpos = p_72368_1_.func_180470_cg(); -- boolean flag = p_72368_1_.func_82245_bX(); -+ BlockPos blockpos = p_72368_1_.getBedLocation(p_72368_2_); -+ boolean flag = p_72368_1_.isSpawnForced(p_72368_2_); - p_72368_1_.field_71093_bK = p_72368_2_; - ItemInWorldManager iteminworldmanager; - -@@ -431,6 +472,7 @@ - EntityPlayerMP entityplayermp = new EntityPlayerMP(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), iteminworldmanager); - entityplayermp.field_71135_a = p_72368_1_.field_71135_a; - entityplayermp.func_71049_a(p_72368_1_, p_72368_3_); -+ entityplayermp.field_71093_bK = p_72368_2_; - entityplayermp.func_145769_d(p_72368_1_.func_145782_y()); - entityplayermp.func_174817_o(p_72368_1_); - WorldServer worldserver = this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK); -@@ -470,19 +512,25 @@ - this.field_177454_f.put(entityplayermp.func_110124_au(), entityplayermp); - entityplayermp.func_71116_b(); - entityplayermp.func_70606_j(entityplayermp.func_110143_aJ()); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp); - return entityplayermp; - } - - public void func_72356_a(EntityPlayerMP p_72356_1_, int p_72356_2_) - { -+ transferPlayerToDimension(p_72356_1_, p_72356_2_, field_72400_f.func_71218_a(p_72356_2_).func_85176_s()); -+ } -+ -+ public void transferPlayerToDimension(EntityPlayerMP p_72356_1_, int p_72356_2_, net.minecraft.world.Teleporter teleporter) -+ { - int i = p_72356_1_.field_71093_bK; - WorldServer worldserver = this.field_72400_f.func_71218_a(p_72356_1_.field_71093_bK); - p_72356_1_.field_71093_bK = p_72356_2_; - WorldServer worldserver1 = this.field_72400_f.func_71218_a(p_72356_1_.field_71093_bK); -- p_72356_1_.field_71135_a.func_147359_a(new S07PacketRespawn(p_72356_1_.field_71093_bK, p_72356_1_.field_70170_p.func_175659_aa(), p_72356_1_.field_70170_p.func_72912_H().func_76067_t(), p_72356_1_.field_71134_c.func_73081_b())); -+ p_72356_1_.field_71135_a.func_147359_a(new S07PacketRespawn(p_72356_1_.field_71093_bK, worldserver1.func_175659_aa(), worldserver1.func_72912_H().func_76067_t(), p_72356_1_.field_71134_c.func_73081_b())); - worldserver.func_72973_f(p_72356_1_); - p_72356_1_.field_70128_L = false; -- this.func_82448_a(p_72356_1_, i, worldserver, worldserver1); -+ this.transferEntityToWorld(p_72356_1_, i, worldserver, worldserver1, teleporter); - this.func_72375_a(p_72356_1_, worldserver); - p_72356_1_.field_71135_a.func_147364_a(p_72356_1_.field_70165_t, p_72356_1_.field_70163_u, p_72356_1_.field_70161_v, p_72356_1_.field_70177_z, p_72356_1_.field_70125_A); - p_72356_1_.field_71134_c.func_73080_a(worldserver1); -@@ -493,17 +541,27 @@ - { - p_72356_1_.field_71135_a.func_147359_a(new S1DPacketEntityEffect(p_72356_1_.func_145782_y(), potioneffect)); - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_72356_1_, i, p_72356_2_); - } - - public void func_82448_a(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) - { -- double d0 = p_82448_1_.field_70165_t; -- double d1 = p_82448_1_.field_70161_v; -+ transferEntityToWorld(p_82448_1_, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.func_85176_s()); -+ } -+ -+ @SuppressWarnings("unused") -+ public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter) -+ { -+ net.minecraft.world.WorldProvider pOld = p_82448_3_.field_73011_w; -+ net.minecraft.world.WorldProvider pNew = p_82448_4_.field_73011_w; -+ double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor(); -+ double d0 = p_82448_1_.field_70165_t * moveFactor; -+ double d1 = p_82448_1_.field_70161_v * moveFactor; - double d2 = 8.0D; - float f = p_82448_1_.field_70177_z; - p_82448_3_.field_72984_F.func_76320_a("moving"); - -- if (p_82448_1_.field_71093_bK == -1) -+ if (false && p_82448_1_.field_71093_bK == -1) //Forge Kill it but dont comment out so we can rename it. - { - d0 = MathHelper.func_151237_a(d0 / d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); - d1 = MathHelper.func_151237_a(d1 / d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); -@@ -514,7 +572,7 @@ - p_82448_3_.func_72866_a(p_82448_1_, false); - } - } -- else if (p_82448_1_.field_71093_bK == 0) -+ else if (false && p_82448_1_.field_71093_bK == 0) //Forge Kill it but dont comment out so we can rename it. - { - d0 = MathHelper.func_151237_a(d0 * d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); - d1 = MathHelper.func_151237_a(d1 * d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); -@@ -525,7 +583,8 @@ - p_82448_3_.func_72866_a(p_82448_1_, false); - } - } -- else -+ -+ if (p_82448_1_.field_71093_bK == 1) - { - BlockPos blockpos; - -@@ -560,7 +619,7 @@ - if (p_82448_1_.func_70089_S()) - { - p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); -- p_82448_4_.func_85176_s().func_180266_a(p_82448_1_, f); -+ teleporter.func_180266_a(p_82448_1_, f); - p_82448_4_.func_72838_d(p_82448_1_); - p_82448_4_.func_72866_a(p_82448_1_, false); - } diff --git a/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch b/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch index ad1cf30059..624eebff65 100644 --- a/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch +++ b/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch @@ -1,26 +1,20 @@ --- ../src-base/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java +++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java -@@ -66,12 +66,12 @@ +@@ -66,7 +66,7 @@ if (entityplayermp == null) { this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; -- this.field_147327_f.func_71203_ab().func_72355_a(this.field_147333_a, this.field_181025_l); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.field_147327_f.func_71203_ab(), this.field_147333_a, this.field_181025_l); +- this.field_147327_f.func_184103_al().func_72355_a(this.field_147333_a, this.field_181025_l); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.field_147327_f.func_184103_al(), this.field_147333_a, this.field_181025_l); this.field_181025_l = null; } } - -- if (this.field_147336_h++ == 600) -+ if (this.field_147336_h++ == net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.LOGIN_TIMEOUT) - { - this.func_147322_a("Took too long to log in"); - } @@ -130,7 +130,7 @@ } else { -- this.field_147327_f.func_71203_ab().func_72355_a(this.field_147333_a, this.field_147327_f.func_71203_ab().func_148545_a(this.field_147337_i)); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.field_147327_f.func_71203_ab(), this.field_147333_a, this.field_147327_f.func_71203_ab().func_148545_a(this.field_147337_i)); +- this.field_147327_f.func_184103_al().func_72355_a(this.field_147333_a, this.field_147327_f.func_184103_al().func_148545_a(this.field_147337_i)); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.field_147327_f.func_184103_al(), this.field_147333_a, this.field_147327_f.func_184103_al().func_148545_a(this.field_147337_i)); } } } diff --git a/patches/minecraft/net/minecraft/stats/StatList.java.patch b/patches/minecraft/net/minecraft/stats/StatList.java.patch index 61bd2d01fa..8eca044945 100644 --- a/patches/minecraft/net/minecraft/stats/StatList.java.patch +++ b/patches/minecraft/net/minecraft/stats/StatList.java.patch @@ -1,24 +1,24 @@ --- ../src-base/minecraft/net/minecraft/stats/StatList.java +++ ../src-work/minecraft/net/minecraft/stats/StatList.java -@@ -119,7 +119,7 @@ +@@ -155,7 +155,7 @@ } } -- func_75924_a(field_75928_D); -+ replaceAllSimilarBlocks(field_75928_D, true); +- func_75924_a(field_188066_af); ++ replaceAllSimilarBlocks(field_188066_af, true); } private static void func_151181_c() -@@ -141,7 +141,7 @@ +@@ -177,7 +177,7 @@ } } -- func_75924_a(field_75934_C); -+ replaceAllSimilarBlocks(field_75934_C, false); +- func_75924_a(field_188065_ae); ++ replaceAllSimilarBlocks(field_188065_ae, false); } private static void func_75925_c() -@@ -165,7 +165,7 @@ +@@ -201,7 +201,7 @@ } } @@ -27,7 +27,16 @@ } private static void func_151179_e() -@@ -184,7 +184,7 @@ +@@ -220,7 +220,7 @@ + } + } + +- func_75924_a(field_75930_F); ++ replaceAllSimilarBlocks(field_75930_F, true); + } + + private static void func_188054_f() +@@ -240,7 +240,7 @@ } } @@ -36,7 +45,7 @@ } private static String func_180204_a(Item p_180204_0_) -@@ -193,28 +193,35 @@ +@@ -249,28 +249,35 @@ return resourcelocation != null ? resourcelocation.toString().replace(':', '.') : null; } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index d9070581c7..05673acff1 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java -@@ -17,7 +17,7 @@ +@@ -18,7 +18,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,7 +9,7 @@ { private static final Logger field_145852_a = LogManager.getLogger(); private static Map < String, Class > field_145855_i = Maps. < String, Class > newHashMap(); -@@ -59,6 +59,8 @@ +@@ -60,6 +60,8 @@ public void func_145839_a(NBTTagCompound p_145839_1_) { this.field_174879_c = new BlockPos(p_145839_1_.func_74762_e("x"), p_145839_1_.func_74762_e("y"), p_145839_1_.func_74762_e("z")); @@ -18,7 +18,7 @@ } public void func_145841_b(NBTTagCompound p_145841_1_) -@@ -75,6 +77,8 @@ +@@ -76,6 +78,8 @@ p_145841_1_.func_74768_a("x", this.field_174879_c.func_177958_n()); p_145841_1_.func_74768_a("y", this.field_174879_c.func_177956_o()); p_145841_1_.func_74768_a("z", this.field_174879_c.func_177952_p()); @@ -27,37 +27,40 @@ } } -@@ -82,9 +86,10 @@ +@@ -83,10 +87,11 @@ { TileEntity tileentity = null; - + String s = p_184246_1_.func_74779_i("id"); + Class oclass = null; + try { -- Class oclass = (Class)field_145855_i.get(p_145827_0_.func_74779_i("id")); -+ oclass = (Class)field_145855_i.get(p_145827_0_.func_74779_i("id")); +- Class oclass = (Class)field_145855_i.get(s); ++ oclass = (Class)field_145855_i.get(s); if (oclass != null) { -@@ -102,7 +107,17 @@ - } - else +@@ -96,6 +101,9 @@ + catch (Throwable throwable1) { -+ try -+ { - field_145852_a.warn("Skipping BlockEntity with id " + p_145827_0_.func_74779_i("id")); -+ } -+ catch (Exception ex) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex, -+ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ p_145827_0_.func_74779_i("id"), oclass.getName()); -+ tileentity = null; -+ } + field_145852_a.error("Failed to create block entity " + s, throwable1); ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, throwable1, ++ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", ++ s, oclass.getName()); } - return tileentity; -@@ -134,7 +149,6 @@ + if (tileentity != null) +@@ -107,6 +115,9 @@ + catch (Throwable throwable) + { + field_145852_a.error("Failed to load data for block entity " + s, throwable); ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, throwable, ++ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", ++ s, oclass.getName()); + tileentity = null; + } + } +@@ -144,7 +155,6 @@ } } @@ -65,11 +68,10 @@ public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_) { double d0 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_; -@@ -279,4 +293,183 @@ - func_145826_a(TileEntityFlowerPot.class, "FlowerPot"); - func_145826_a(TileEntityBanner.class, "Banner"); +@@ -271,6 +281,185 @@ + return false; } -+ + + // -- BEGIN FORGE PATCHES -- + /** + * Called when you receive a TileEntityData packet for the location this @@ -80,7 +82,7 @@ + * @param net The NetworkManager the packet originated from + * @param pkt The data packet + */ -+ public void onDataPacket(net.minecraft.network.NetworkManager net, net.minecraft.network.play.server.S35PacketUpdateTileEntity pkt) ++ public void onDataPacket(net.minecraft.network.NetworkManager net, net.minecraft.network.play.server.SPacketUpdateTileEntity pkt) + { + } + @@ -115,7 +117,7 @@ + /** + * Sometimes default render bounding box: infinite in scope. Used to control rendering on {@link TileEntitySpecialRenderer}. + */ -+ public static final net.minecraft.util.AxisAlignedBB INFINITE_EXTENT_AABB = new net.minecraft.util.AxisAlignedBB(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); ++ public static final net.minecraft.util.math.AxisAlignedBB INFINITE_EXTENT_AABB = new net.minecraft.util.math.AxisAlignedBB(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); + /** + * Return an {@link AxisAlignedBB} that controls the visible scope of a {@link TileEntitySpecialRenderer} associated with this {@link TileEntity} + * Defaults to the collision bounding box {@link Block#getCollisionBoundingBoxFromPool(World, int, int, int)} associated with the block @@ -124,24 +126,24 @@ + * @return an appropriately size {@link AxisAlignedBB} for the {@link TileEntity} + */ + @SideOnly(Side.CLIENT) -+ public net.minecraft.util.AxisAlignedBB getRenderBoundingBox() ++ public net.minecraft.util.math.AxisAlignedBB getRenderBoundingBox() + { -+ net.minecraft.util.AxisAlignedBB bb = INFINITE_EXTENT_AABB; ++ net.minecraft.util.math.AxisAlignedBB bb = INFINITE_EXTENT_AABB; + Block type = func_145838_q(); + if (type == Blocks.field_150381_bn) + { -+ bb = new net.minecraft.util.AxisAlignedBB(func_174877_v(), func_174877_v().func_177982_a(1, 1, 1)); ++ bb = new net.minecraft.util.math.AxisAlignedBB(func_174877_v(), func_174877_v().func_177982_a(1, 1, 1)); + } + else if (type == Blocks.field_150486_ae || type == Blocks.field_150447_bR) + { -+ bb = new net.minecraft.util.AxisAlignedBB(func_174877_v().func_177982_a(-1, 0, -1), func_174877_v().func_177982_a(2, 2, 2)); ++ bb = new net.minecraft.util.math.AxisAlignedBB(func_174877_v().func_177982_a(-1, 0, -1), func_174877_v().func_177982_a(2, 2, 2)); + } + else if (type != null && type != Blocks.field_150461_bJ) + { -+ net.minecraft.util.AxisAlignedBB cbb = null; ++ net.minecraft.util.math.AxisAlignedBB cbb = null; + try + { -+ cbb = type.func_180640_a(field_145850_b, func_174877_v(), field_145850_b.func_180495_p(func_174877_v())); ++ cbb = field_145850_b.func_180495_p(func_174877_v()).func_185890_d(field_145850_b, func_174877_v()); + } + catch (Exception e) + { @@ -151,7 +153,7 @@ + // So, once again in the long line of US having to accommodate BUKKIT breaking things, + // here it is, assume that the TE is only 1 cubic block. Problem with this is that it may + // cause the TileEntity renderer to error further down the line! But alas, nothing we can do. -+ cbb = new net.minecraft.util.AxisAlignedBB(func_174877_v().func_177982_a(-1, 0, -1), func_174877_v().func_177982_a(1, 1, 1)); ++ cbb = new net.minecraft.util.math.AxisAlignedBB(func_174877_v().func_177982_a(-1, 0, -1), func_174877_v().func_177982_a(1, 1, 1)); + } + if (cbb != null) bb = cbb; + } @@ -248,4 +250,7 @@ + this.func_145841_b(ret); + return ret; + } - } ++ + static + { + func_145826_a(TileEntityFurnace.class, "Furnace"); diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch index acb9425af2..6ba50bb6ff 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -@@ -169,7 +169,7 @@ +@@ -179,7 +179,7 @@ { Block block = this.field_145850_b.func_180495_p(new BlockPos(j1, i2, k1)).func_177230_c(); @@ -9,7 +9,7 @@ { flag1 = false; break; -@@ -368,7 +368,7 @@ +@@ -371,7 +371,7 @@ public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch index b061d4b423..0350d0b0b3 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java -@@ -104,7 +104,7 @@ +@@ -140,7 +140,7 @@ private boolean func_145934_k() { @@ -9,16 +9,7 @@ { ItemStack itemstack = this.field_145945_j[3]; -@@ -118,7 +118,7 @@ - - for (int i = 0; i < 3; ++i) - { -- if (this.field_145945_j[i] != null && this.field_145945_j[i].func_77973_b() == Items.field_151068_bn) -+ if (this.field_145945_j[i] != null && this.field_145945_j[i].func_77973_b() instanceof ItemPotion) - { - int j = this.field_145945_j[i].func_77960_j(); - int k = this.func_145936_c(j, itemstack); -@@ -145,19 +145,22 @@ +@@ -165,25 +165,23 @@ } else { @@ -30,57 +21,52 @@ private void func_145940_l() { + if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBreaw(field_145945_j)) return; - if (this.func_145934_k()) + ItemStack itemstack = this.field_145945_j[3]; + +- for (int i = 0; i < 3; ++i) +- { +- this.field_145945_j[i] = PotionHelper.func_185212_d(itemstack, this.field_145945_j[i]); +- } ++ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(field_145945_j, field_145945_j[3], field_145947_i); + + --itemstack.field_77994_a; + BlockPos blockpos = this.func_174877_v(); + +- if (itemstack.func_77973_b().func_77634_r()) ++ if (itemstack.func_77973_b().hasContainerItem(itemstack)) { -+ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(field_145945_j, field_145945_j[3], field_145947_i); - ItemStack itemstack = this.field_145945_j[3]; +- ItemStack itemstack1 = new ItemStack(itemstack.func_77973_b().func_77668_q()); ++ ItemStack itemstack1 = itemstack.func_77973_b().getContainerItem(itemstack); -+ if (false) { // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe - for (int i = 0; i < 3; ++i) + if (itemstack.field_77994_a <= 0) { -- if (this.field_145945_j[i] != null && this.field_145945_j[i].func_77973_b() == Items.field_151068_bn) -+ if (this.field_145945_j[i] != null && this.field_145945_j[i].func_77973_b() instanceof ItemPotion) - { - int j = this.field_145945_j[i].func_77960_j(); - int k = this.func_145936_c(j, itemstack); -@@ -177,10 +180,11 @@ - } - } - } -+ } +@@ -202,6 +200,7 @@ -- if (itemstack.func_77973_b().func_77634_r()) -+ if (itemstack.func_77973_b().hasContainerItem(itemstack)) - { -- this.field_145945_j[3] = new ItemStack(itemstack.func_77973_b().func_77668_q()); -+ this.field_145945_j[3] = itemstack.func_77973_b().getContainerItem(itemstack); - } - else - { -@@ -191,6 +195,7 @@ - this.field_145945_j[3] = null; - } - } -+ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(field_145945_j); - } + this.field_145945_j[3] = itemstack; + this.field_145850_b.func_175718_b(1035, blockpos, 0); ++ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(field_145945_j); } -@@ -310,7 +315,9 @@ - - public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) + public void func_145839_a(NBTTagCompound p_145839_1_) +@@ -303,12 +302,12 @@ { -- return p_94041_1_ == 3 ? p_94041_2_.func_77973_b().func_150892_m(p_94041_2_) : p_94041_2_.func_77973_b() == Items.field_151068_bn || p_94041_2_.func_77973_b() == Items.field_151069_bo; -+ if (p_94041_1_ == 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_94041_2_)) return true; -+ else if (p_94041_1_ != 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_94041_2_)) return true; -+ return false; - } - - public boolean[] func_174902_m() -@@ -386,4 +393,18 @@ - this.field_145945_j[i] = null; + if (p_94041_1_ == 3) + { +- return PotionHelper.func_185205_a(p_94041_2_); ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_94041_2_); + } + else + { + Item item = p_94041_2_.func_77973_b(); +- return p_94041_1_ == 4 ? item == Items.field_151065_br : item == Items.field_151068_bn || item == Items.field_185155_bH || item == Items.field_185156_bI || item == Items.field_151069_bo; ++ return p_94041_1_ == 4 ? item == Items.field_151065_br : net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_94041_2_); } } -+ + +@@ -362,6 +361,20 @@ + } + } + + net.minecraftforge.items.IItemHandler handlerInput = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.UP); + net.minecraftforge.items.IItemHandler handlerOutput = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.DOWN); + @@ -94,4 +80,7 @@ + return (T) handlerOutput; + return super.getCapability(capability, facing); + } - } ++ + public int func_174890_g() + { + return 2; diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch index 1c77e9b787..41197c4dc5 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityChest.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityChest.java -@@ -186,6 +186,7 @@ +@@ -171,6 +171,7 @@ { super.func_145836_u(); this.field_145984_a = false; @@ -8,11 +8,10 @@ } @SuppressWarnings("incomplete-switch") -@@ -468,4 +469,24 @@ - this.field_145985_p[i] = null; +@@ -457,6 +458,26 @@ } } -+ + + public net.minecraftforge.items.VanillaDoubleChestItemHandler doubleChestHandler; + + @Override @@ -32,4 +31,7 @@ + { + return super.getCapability(net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); + } - } ++ + public void func_184287_a(ResourceLocation p_184287_1_, long p_184287_2_) + { + this.field_184284_m = p_184287_1_; diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch index 44e66c1e42..abef4b007f 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java -@@ -141,9 +141,9 @@ +@@ -110,9 +110,9 @@ } } @@ -13,7 +13,7 @@ this.field_145963_i = func_145952_a(this.field_145957_n[1]); if (p_145839_1_.func_150297_b("CustomName", 8)) -@@ -155,9 +155,9 @@ +@@ -124,9 +124,9 @@ public void func_145841_b(NBTTagCompound p_145841_1_) { super.func_145841_b(p_145841_1_); @@ -26,7 +26,7 @@ NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.field_145957_n.length; ++i) -@@ -223,8 +223,7 @@ +@@ -192,8 +192,7 @@ if (this.field_145957_n[1].field_77994_a == 0) { @@ -36,7 +36,7 @@ } } } -@@ -279,7 +278,11 @@ +@@ -248,7 +247,11 @@ else { ItemStack itemstack = FurnaceRecipes.func_77602_a().func_151395_a(this.field_145957_n[0]); @@ -49,7 +49,7 @@ } } -@@ -295,7 +298,7 @@ +@@ -264,7 +267,7 @@ } else if (this.field_145957_n[2].func_77973_b() == itemstack.func_77973_b()) { @@ -58,7 +58,7 @@ } if (this.field_145957_n[0].func_77973_b() == Item.func_150898_a(Blocks.field_150360_v) && this.field_145957_n[0].func_77960_j() == 1 && this.field_145957_n[1] != null && this.field_145957_n[1].func_77973_b() == Items.field_151133_ar) -@@ -342,7 +345,15 @@ +@@ -311,7 +314,15 @@ } } @@ -75,7 +75,7 @@ } } -@@ -451,4 +462,21 @@ +@@ -432,4 +443,21 @@ this.field_145957_n[i] = null; } } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch index a03e41ceb3..d55f5e0a4a 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java -@@ -260,6 +260,7 @@ +@@ -237,6 +237,7 @@ private boolean func_145883_k() { @@ -8,7 +8,7 @@ IInventory iinventory = this.func_145895_l(); if (iinventory == null) -@@ -366,6 +367,7 @@ +@@ -343,6 +344,7 @@ public static boolean func_145891_a(IHopper p_145891_0_) { @@ -16,7 +16,7 @@ IInventory iinventory = func_145884_b(p_145891_0_); if (iinventory != null) -@@ -515,17 +517,31 @@ +@@ -492,17 +494,31 @@ if (itemstack == null) { @@ -49,7 +49,7 @@ } if (flag) -@@ -668,4 +684,10 @@ +@@ -648,4 +664,10 @@ this.field_145900_a[i] = null; } } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch index 5059fc2d06..116d03a6be 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch @@ -2,7 +2,7 @@ +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityLockable.java @@ -47,4 +47,25 @@ { - return (IChatComponent)(this.func_145818_k_() ? new ChatComponentText(this.func_70005_c_()) : new ChatComponentTranslation(this.func_70005_c_(), new Object[0])); + return (ITextComponent)(this.func_145818_k_() ? new TextComponentString(this.func_70005_c_()) : new TextComponentTranslation(this.func_70005_c_(), new Object[0])); } + + private net.minecraftforge.items.IItemHandler itemHandler; diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch index e3fef4d685..a47e343929 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityNote.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityNote.java -@@ -27,7 +27,9 @@ +@@ -29,7 +29,9 @@ public void func_145877_a() { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch index a1d1cc237c..9a9ead7609 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityPiston.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityPiston.java -@@ -148,7 +148,8 @@ +@@ -201,7 +201,8 @@ if (this.field_145850_b.func_180495_p(this.field_174879_c).func_177230_c() == Blocks.field_180384_M) { this.field_145850_b.func_180501_a(this.field_174879_c, this.field_174932_a, 3); @@ -10,7 +10,7 @@ } } } -@@ -166,7 +167,8 @@ +@@ -219,7 +220,8 @@ if (this.field_145850_b.func_180495_p(this.field_174879_c).func_177230_c() == Blocks.field_180384_M) { this.field_145850_b.func_180501_a(this.field_174879_c, this.field_174932_a, 3); diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch index 6b66af8ce5..0919e78045 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntitySign.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntitySign.java -@@ -61,7 +61,7 @@ +@@ -60,7 +60,7 @@ } public boolean func_70003_b(int p_70003_1_, String p_70003_2_) { diff --git a/patches/minecraft/net/minecraft/util/ActionResult.java.patch b/patches/minecraft/net/minecraft/util/ActionResult.java.patch new file mode 100644 index 0000000000..28c5a82cff --- /dev/null +++ b/patches/minecraft/net/minecraft/util/ActionResult.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/util/ActionResult.java ++++ ../src-work/minecraft/net/minecraft/util/ActionResult.java +@@ -20,4 +20,10 @@ + { + return this.field_188400_b; + } ++ ++ //Just a generic helper function to make typecasing easier... ++ public static ActionResult newResult(EnumActionResult result, T value) ++ { ++ return new ActionResult(result, value); ++ } + } diff --git a/patches/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch b/patches/minecraft/net/minecraft/util/BlockRenderLayer.java.patch similarity index 53% rename from patches/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch rename to patches/minecraft/net/minecraft/util/BlockRenderLayer.java.patch index 7bb192c6d1..80055839ac 100644 --- a/patches/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch +++ b/patches/minecraft/net/minecraft/util/BlockRenderLayer.java.patch @@ -1,5 +1,5 @@ ---- ../src-base/minecraft/net/minecraft/util/EnumWorldBlockLayer.java -+++ ../src-work/minecraft/net/minecraft/util/EnumWorldBlockLayer.java +--- ../src-base/minecraft/net/minecraft/util/BlockRenderLayer.java ++++ ../src-work/minecraft/net/minecraft/util/BlockRenderLayer.java @@ -1,9 +1,5 @@ package net.minecraft.util; @@ -7,6 +7,6 @@ -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) - public enum EnumWorldBlockLayer + public enum BlockRenderLayer { SOLID("Solid"), diff --git a/patches/minecraft/net/minecraft/util/EnumFacing.java.patch b/patches/minecraft/net/minecraft/util/EnumFacing.java.patch index a0fbc640d1..241b4620f5 100644 --- a/patches/minecraft/net/minecraft/util/EnumFacing.java.patch +++ b/patches/minecraft/net/minecraft/util/EnumFacing.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/util/EnumFacing.java +++ ../src-work/minecraft/net/minecraft/util/EnumFacing.java -@@ -6,8 +6,6 @@ - import java.util.Iterator; - import java.util.Map; +@@ -8,8 +8,6 @@ import java.util.Random; + import net.minecraft.util.math.MathHelper; + import net.minecraft.util.math.Vec3i; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; public enum EnumFacing implements IStringSerializable { -@@ -60,7 +58,6 @@ +@@ -62,7 +60,6 @@ return func_82600_a(this.field_176759_h); } @@ -17,7 +17,7 @@ public EnumFacing func_176732_a(EnumFacing.Axis p_176732_1_) { switch (p_176732_1_) -@@ -111,7 +108,6 @@ +@@ -113,7 +110,6 @@ } } @@ -25,7 +25,7 @@ private EnumFacing func_176744_n() { switch (this) -@@ -131,7 +127,6 @@ +@@ -133,7 +129,6 @@ } } @@ -33,7 +33,7 @@ private EnumFacing func_176738_p() { switch (this) -@@ -192,7 +187,6 @@ +@@ -194,7 +189,6 @@ return this.field_176758_k; } @@ -41,7 +41,7 @@ public static EnumFacing func_176739_a(String p_176739_0_) { return p_176739_0_ == null ? null : (EnumFacing)field_176761_p.get(p_176739_0_.toLowerCase()); -@@ -218,7 +212,6 @@ +@@ -225,7 +219,6 @@ return values()[p_176741_0_.nextInt(values().length)]; } @@ -49,7 +49,7 @@ public static EnumFacing func_176737_a(float p_176737_0_, float p_176737_1_, float p_176737_2_) { EnumFacing enumfacing = NORTH; -@@ -261,7 +254,6 @@ +@@ -268,7 +261,6 @@ throw new IllegalArgumentException("No such direction: " + p_181076_0_ + " " + p_181076_1_); } @@ -57,7 +57,7 @@ public Vec3i func_176730_m() { return this.field_176756_m; -@@ -297,7 +289,6 @@ +@@ -304,7 +296,6 @@ this.field_176723_f = p_i46015_4_; } diff --git a/patches/minecraft/net/minecraft/util/IChatComponent.java.patch b/patches/minecraft/net/minecraft/util/IChatComponent.java.patch deleted file mode 100644 index 2f0530ce4c..0000000000 --- a/patches/minecraft/net/minecraft/util/IChatComponent.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/IChatComponent.java -+++ ../src-work/minecraft/net/minecraft/util/IChatComponent.java -@@ -31,7 +31,6 @@ - - String func_150260_c(); - -- @SideOnly(Side.CLIENT) - String func_150254_d(); - - List func_150253_a(); diff --git a/patches/minecraft/net/minecraft/util/IntIdentityHashBiMap.java.patch b/patches/minecraft/net/minecraft/util/IntIdentityHashBiMap.java.patch new file mode 100644 index 0000000000..2b9932be97 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/IntIdentityHashBiMap.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/util/IntIdentityHashBiMap.java ++++ ../src-work/minecraft/net/minecraft/util/IntIdentityHashBiMap.java +@@ -166,7 +166,6 @@ + return Iterators.filter(Iterators.forArray(this.field_186820_d), Predicates.notNull()); + } + +- @SideOnly(Side.CLIENT) + public void func_186812_a() + { + Arrays.fill(this.field_186818_b, (Object)null); diff --git a/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch b/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch deleted file mode 100644 index f717cac15c..0000000000 --- a/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/MovingObjectPosition.java -+++ ../src-work/minecraft/net/minecraft/util/MovingObjectPosition.java -@@ -10,6 +10,12 @@ - public Vec3 field_72307_f; - public Entity field_72308_g; - -+ /** Used to determine what sub-segment is hit */ -+ public int subHit = -1; -+ -+ /** Used to add extra hit info */ -+ public Object hitInfo = null; -+ - public MovingObjectPosition(Vec3 p_i45551_1_, EnumFacing p_i45551_2_, BlockPos p_i45551_3_) - { - this(MovingObjectPosition.MovingObjectType.BLOCK, p_i45551_1_, p_i45551_2_, p_i45551_3_); diff --git a/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch b/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch deleted file mode 100644 index bef0586ad9..0000000000 --- a/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/ResourceLocation.java -+++ ../src-work/minecraft/net/minecraft/util/ResourceLocation.java -@@ -1,7 +1,5 @@ - package net.minecraft.util; - --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - import org.apache.commons.lang3.Validate; - - public class ResourceLocation -@@ -21,7 +19,6 @@ - this(0, func_177516_a(p_i1293_1_)); - } - -- @SideOnly(Side.CLIENT) - public ResourceLocation(String p_i1292_1_, String p_i1292_2_) - { - this(0, new String[] {p_i1292_1_, p_i1292_2_}); -@@ -50,7 +47,6 @@ - return this.field_110625_b; - } - -- @SideOnly(Side.CLIENT) - public String func_110624_b() - { - return this.field_110626_a; diff --git a/patches/minecraft/net/minecraft/util/Session.java.patch b/patches/minecraft/net/minecraft/util/Session.java.patch index 19d55db7eb..6ac3242785 100644 --- a/patches/minecraft/net/minecraft/util/Session.java.patch +++ b/patches/minecraft/net/minecraft/util/Session.java.patch @@ -34,7 +34,7 @@ this.field_74286_b = p_i1098_1_; this.field_148257_b = p_i1098_2_; this.field_148258_c = p_i1098_3_; -@@ -49,11 +66,13 @@ +@@ -49,14 +66,29 @@ try { UUID uuid = UUIDTypeAdapter.fromString(this.func_148255_b()); @@ -50,10 +50,6 @@ } } -@@ -62,6 +81,19 @@ - return this.field_152429_d; - } - + /* ======================================== FORGE START ===================================== */ + //For internal use only. Modders should never need to use this. + public void setProperties(com.mojang.authlib.properties.PropertyMap properties) diff --git a/patches/minecraft/net/minecraft/util/TabCompleter.java.patch b/patches/minecraft/net/minecraft/util/TabCompleter.java.patch new file mode 100644 index 0000000000..5fe77be006 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/TabCompleter.java.patch @@ -0,0 +1,39 @@ +--- ../src-base/minecraft/net/minecraft/util/TabCompleter.java ++++ ../src-work/minecraft/net/minecraft/util/TabCompleter.java +@@ -53,13 +53,14 @@ + this.field_186844_a.func_146175_b(i - this.field_186844_a.func_146198_h()); + } + +- this.field_186844_a.func_146191_b((String)this.field_186849_f.get(this.field_186848_e++)); ++ this.field_186844_a.func_146191_b(net.minecraft.util.text.TextFormatting.func_110646_a(this.field_186849_f.get(this.field_186848_e++))); + } + + private void func_186838_a(String p_186838_1_) + { + if (p_186838_1_.length() >= 1) + { ++ net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_186838_1_); + Minecraft.func_71410_x().field_71439_g.field_71174_a.func_147297_a(new CPacketTabComplete(p_186838_1_, this.func_186839_b(), this.field_186845_b)); + this.field_186847_d = true; + } +@@ -74,6 +75,12 @@ + this.field_186846_c = false; + this.field_186849_f.clear(); + ++ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete; ++ if (complete != null) ++ { ++ p_186840_1_ = com.google.common.collect.ObjectArrays.concat(complete, p_186840_1_, String.class); ++ } ++ + for (String s : p_186840_1_) + { + if (!s.isEmpty()) +@@ -84,6 +91,7 @@ + + String s1 = this.field_186844_a.func_146179_b().substring(this.field_186844_a.func_146197_a(-1, this.field_186844_a.func_146198_h(), false)); + String s2 = org.apache.commons.lang3.StringUtils.getCommonPrefix(p_186840_1_); ++ s2 = net.minecraft.util.text.TextFormatting.func_110646_a(s2); + + if (!s2.isEmpty() && !s1.equalsIgnoreCase(s2)) + { diff --git a/patches/minecraft/net/minecraft/util/Vec3.java.patch b/patches/minecraft/net/minecraft/util/Vec3.java.patch deleted file mode 100644 index 2cc1ac5181..0000000000 --- a/patches/minecraft/net/minecraft/util/Vec3.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/Vec3.java -+++ ../src-work/minecraft/net/minecraft/util/Vec3.java -@@ -1,8 +1,5 @@ - package net.minecraft.util; - --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; -- - public class Vec3 - { - public final double field_72450_a; -@@ -36,7 +33,6 @@ - this((double)p_i46377_1_.func_177958_n(), (double)p_i46377_1_.func_177956_o(), (double)p_i46377_1_.func_177952_p()); - } - -- @SideOnly(Side.CLIENT) - public Vec3 func_72444_a(Vec3 p_72444_1_) - { - return new Vec3(p_72444_1_.field_72450_a - this.field_72450_a, p_72444_1_.field_72448_b - this.field_72448_b, p_72444_1_.field_72449_c - this.field_72449_c); -@@ -53,7 +49,6 @@ - return this.field_72450_a * p_72430_1_.field_72450_a + this.field_72448_b * p_72430_1_.field_72448_b + this.field_72449_c * p_72430_1_.field_72449_c; - } - -- @SideOnly(Side.CLIENT) - public Vec3 func_72431_c(Vec3 p_72431_1_) - { - return new Vec3(this.field_72448_b * p_72431_1_.field_72449_c - this.field_72449_c * p_72431_1_.field_72448_b, this.field_72449_c * p_72431_1_.field_72450_a - this.field_72450_a * p_72431_1_.field_72449_c, this.field_72450_a * p_72431_1_.field_72448_b - this.field_72448_b * p_72431_1_.field_72450_a); -@@ -79,7 +74,6 @@ - return new Vec3(this.field_72450_a + p_72441_1_, this.field_72448_b + p_72441_3_, this.field_72449_c + p_72441_5_); - } - -- @SideOnly(Side.CLIENT) - public double func_72438_d(Vec3 p_72438_1_) - { - double d0 = p_72438_1_.field_72450_a - this.field_72450_a; diff --git a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch deleted file mode 100644 index b8f7e3aa4e..0000000000 --- a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/WeightedRandomChestContent.java -+++ ../src-work/minecraft/net/minecraft/util/WeightedRandomChestContent.java -@@ -36,48 +36,39 @@ - for (int i = 0; i < p_177630_3_; ++i) - { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.func_76271_a(p_177630_0_, p_177630_1_); -- int j = weightedrandomchestcontent.field_76295_d + p_177630_0_.nextInt(weightedrandomchestcontent.field_76296_e - weightedrandomchestcontent.field_76295_d + 1); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(p_177630_0_, p_177630_2_); - -- if (weightedrandomchestcontent.field_76297_b.func_77976_d() >= j) -+ for (ItemStack itemstack1 : stacks) - { -- ItemStack itemstack1 = weightedrandomchestcontent.field_76297_b.func_77946_l(); -- itemstack1.field_77994_a = j; - p_177630_2_.func_70299_a(p_177630_0_.nextInt(p_177630_2_.func_70302_i_()), itemstack1); - } -- else -- { -- for (int k = 0; k < j; ++k) -- { -- ItemStack itemstack = weightedrandomchestcontent.field_76297_b.func_77946_l(); -- itemstack.field_77994_a = 1; -- p_177630_2_.func_70299_a(p_177630_0_.nextInt(p_177630_2_.func_70302_i_()), itemstack); -- } -- } - } - } - -+ // -- Forge hooks -+ /** -+ * Allow a mod to submit a custom implementation that can delegate item stack generation beyond simple stack lookup -+ * -+ * @param random The current random for generation -+ * @param newInventory The inventory being generated (do not populate it, but you can refer to it) -+ * @return An array of {@link ItemStack} to put into the chest -+ */ -+ protected ItemStack[] generateChestContent(Random random, IInventory newInventory) -+ { -+ return net.minecraftforge.common.ChestGenHooks.generateStacks(random, field_76297_b, field_76295_d, field_76296_e); -+ } -+ - public static void func_177631_a(Random p_177631_0_, List p_177631_1_, TileEntityDispenser p_177631_2_, int p_177631_3_) - { - for (int i = 0; i < p_177631_3_; ++i) - { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.func_76271_a(p_177631_0_, p_177631_1_); -- int j = weightedrandomchestcontent.field_76295_d + p_177631_0_.nextInt(weightedrandomchestcontent.field_76296_e - weightedrandomchestcontent.field_76295_d + 1); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(p_177631_0_, p_177631_2_); - -- if (weightedrandomchestcontent.field_76297_b.func_77976_d() >= j) -+ for (ItemStack itemstack1 : stacks) - { -- ItemStack itemstack1 = weightedrandomchestcontent.field_76297_b.func_77946_l(); -- itemstack1.field_77994_a = j; - p_177631_2_.func_70299_a(p_177631_0_.nextInt(p_177631_2_.func_70302_i_()), itemstack1); - } -- else -- { -- for (int k = 0; k < j; ++k) -- { -- ItemStack itemstack = weightedrandomchestcontent.field_76297_b.func_77946_l(); -- itemstack.field_77994_a = 1; -- p_177631_2_.func_70299_a(p_177631_0_.nextInt(p_177631_2_.func_70302_i_()), itemstack); -- } -- } - } - } - diff --git a/patches/minecraft/net/minecraft/util/BlockPos.java.patch b/patches/minecraft/net/minecraft/util/math/BlockPos.java.patch similarity index 55% rename from patches/minecraft/net/minecraft/util/BlockPos.java.patch rename to patches/minecraft/net/minecraft/util/math/BlockPos.java.patch index bb5ccf3d65..70319c0787 100644 --- a/patches/minecraft/net/minecraft/util/BlockPos.java.patch +++ b/patches/minecraft/net/minecraft/util/math/BlockPos.java.patch @@ -1,6 +1,6 @@ ---- ../src-base/minecraft/net/minecraft/util/BlockPos.java -+++ ../src-work/minecraft/net/minecraft/util/BlockPos.java -@@ -257,6 +257,21 @@ +--- ../src-base/minecraft/net/minecraft/util/math/BlockPos.java ++++ ../src-work/minecraft/net/minecraft/util/math/BlockPos.java +@@ -270,6 +270,21 @@ }; } @@ -22,9 +22,18 @@ public static final class MutableBlockPos extends BlockPos { private int field_177997_b; -@@ -298,5 +313,7 @@ - this.field_177996_d = p_181079_3_; - return this; +@@ -333,6 +348,8 @@ + { + return new BlockPos(this); + } ++ ++ @Override public BlockPos getImmutable() { return new BlockPos(this); } + } + + public static final class PooledMutableBlockPos extends BlockPos +@@ -443,5 +460,7 @@ + { + return this.func_185343_d(this.field_185347_c + p_185341_1_.func_82601_c(), this.field_185348_d + p_185341_1_.func_96559_d(), this.field_185349_e + p_185341_1_.func_82599_e()); } + + @Override public BlockPos getImmutable() { return new BlockPos(this); } diff --git a/patches/minecraft/net/minecraft/util/math/RayTraceResult.java.patch b/patches/minecraft/net/minecraft/util/math/RayTraceResult.java.patch new file mode 100644 index 0000000000..9072515469 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/math/RayTraceResult.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/util/math/RayTraceResult.java ++++ ../src-work/minecraft/net/minecraft/util/math/RayTraceResult.java +@@ -5,6 +5,12 @@ + + public class RayTraceResult + { ++ /** Used to determine what sub-segment is hit */ ++ public int subHit = -1; ++ ++ /** Used to add extra hit info */ ++ public Object hitInfo = null; ++ + private BlockPos field_178783_e; + public RayTraceResult.Type field_72313_a; + public EnumFacing field_178784_b; diff --git a/patches/minecraft/net/minecraft/util/math/Vec3d.java.patch b/patches/minecraft/net/minecraft/util/math/Vec3d.java.patch new file mode 100644 index 0000000000..662335a594 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/math/Vec3d.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/util/math/Vec3d.java ++++ ../src-work/minecraft/net/minecraft/util/math/Vec3d.java +@@ -1,8 +1,5 @@ + package net.minecraft.util.math; + +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; +- + public class Vec3d + { + public static final Vec3d field_186680_a = new Vec3d(0.0D, 0.0D, 0.0D); +@@ -53,7 +50,6 @@ + return this.field_72450_a * p_72430_1_.field_72450_a + this.field_72448_b * p_72430_1_.field_72448_b + this.field_72449_c * p_72430_1_.field_72449_c; + } + +- @SideOnly(Side.CLIENT) + public Vec3d func_72431_c(Vec3d p_72431_1_) + { + return new Vec3d(this.field_72448_b * p_72431_1_.field_72449_c - this.field_72449_c * p_72431_1_.field_72448_b, this.field_72449_c * p_72431_1_.field_72450_a - this.field_72450_a * p_72431_1_.field_72449_c, this.field_72450_a * p_72431_1_.field_72448_b - this.field_72448_b * p_72431_1_.field_72450_a); diff --git a/patches/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java.patch b/patches/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java.patch new file mode 100644 index 0000000000..ae4a01c842 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java ++++ ../src-work/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java +@@ -57,4 +57,11 @@ + V v = super.func_186801_a(p_186801_1_); + return (V)(v == null ? this.field_148761_e : v); + } ++ ++ //Bypass functions to allow querying this registry WITHOUT getting the defaulted value. ++ // MODDERS DO NOT USE THIS IS FOR FORGE INTERNAL CHECKS ++ public int getIDForObjectBypass(V bypass) { return super.func_148757_b(bypass); } ++ public K getNameForObjectBypass(V value) { return super.func_177774_c(value); } ++ public V getObjectBypass(K name) { return super.func_82594_a(name); } ++ public V getObjectByIdBypass(int id){ return super.func_148754_a(id); } + } diff --git a/patches/minecraft/net/minecraft/util/text/ITextComponent.java.patch b/patches/minecraft/net/minecraft/util/text/ITextComponent.java.patch new file mode 100644 index 0000000000..d7c43cfc4c --- /dev/null +++ b/patches/minecraft/net/minecraft/util/text/ITextComponent.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/util/text/ITextComponent.java ++++ ../src-work/minecraft/net/minecraft/util/text/ITextComponent.java +@@ -33,7 +33,6 @@ + + String func_150260_c(); + +- @SideOnly(Side.CLIENT) + String func_150254_d(); + + List func_150253_a(); diff --git a/patches/minecraft/net/minecraft/util/ChatStyle.java.patch b/patches/minecraft/net/minecraft/util/text/Style.java.patch similarity index 56% rename from patches/minecraft/net/minecraft/util/ChatStyle.java.patch rename to patches/minecraft/net/minecraft/util/text/Style.java.patch index 55efa51da1..93a20c90a4 100644 --- a/patches/minecraft/net/minecraft/util/ChatStyle.java.patch +++ b/patches/minecraft/net/minecraft/util/text/Style.java.patch @@ -1,5 +1,5 @@ ---- ../src-base/minecraft/net/minecraft/util/ChatStyle.java -+++ ../src-work/minecraft/net/minecraft/util/ChatStyle.java +--- ../src-base/minecraft/net/minecraft/util/text/Style.java ++++ ../src-work/minecraft/net/minecraft/util/text/Style.java @@ -229,7 +229,6 @@ return this; } diff --git a/patches/minecraft/net/minecraft/util/ChatComponentStyle.java.patch b/patches/minecraft/net/minecraft/util/text/TextComponentBase.java.patch similarity index 58% rename from patches/minecraft/net/minecraft/util/ChatComponentStyle.java.patch rename to patches/minecraft/net/minecraft/util/text/TextComponentBase.java.patch index fd4f0534d1..4307987cc3 100644 --- a/patches/minecraft/net/minecraft/util/ChatComponentStyle.java.patch +++ b/patches/minecraft/net/minecraft/util/text/TextComponentBase.java.patch @@ -1,5 +1,5 @@ ---- ../src-base/minecraft/net/minecraft/util/ChatComponentStyle.java -+++ ../src-work/minecraft/net/minecraft/util/ChatComponentStyle.java +--- ../src-base/minecraft/net/minecraft/util/text/TextComponentBase.java ++++ ../src-work/minecraft/net/minecraft/util/text/TextComponentBase.java @@ -74,7 +74,6 @@ return stringbuilder.toString(); } diff --git a/patches/minecraft/net/minecraft/util/StringTranslate.java.patch b/patches/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch similarity index 58% rename from patches/minecraft/net/minecraft/util/StringTranslate.java.patch rename to patches/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch index be6f428274..b6e9a122fb 100644 --- a/patches/minecraft/net/minecraft/util/StringTranslate.java.patch +++ b/patches/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch @@ -1,10 +1,10 @@ ---- ../src-base/minecraft/net/minecraft/util/StringTranslate.java -+++ ../src-work/minecraft/net/minecraft/util/StringTranslate.java +--- ../src-base/minecraft/net/minecraft/util/text/translation/LanguageMap.java ++++ ../src-work/minecraft/net/minecraft/util/text/translation/LanguageMap.java @@ -23,9 +23,29 @@ - public StringTranslate() + public LanguageMap() { -+ InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); ++ InputStream inputstream = LanguageMap.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); + inject(this, inputstream); + } + @@ -13,25 +13,25 @@ + inject(field_74817_a, inputstream); + } + -+ private static void inject(StringTranslate inst, InputStream inputstream) ++ private static void inject(LanguageMap inst, InputStream inputstream) + { -+ java.util.HashMap map = parseLangFile(inputstream); ++ Map map = parseLangFile(inputstream); + inst.field_74816_c.putAll(map); + inst.field_150511_e = System.currentTimeMillis(); + } + -+ public static java.util.HashMap parseLangFile(InputStream inputstream) ++ public static Map parseLangFile(InputStream inputstream) + { -+ java.util.HashMap table = Maps.newHashMap(); ++ Map table = Maps.newHashMap(); try { -- InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); +- InputStream inputstream = LanguageMap.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); + inputstream = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(table, inputstream); + if (inputstream == null) return table; for (String s : IOUtils.readLines(inputstream, Charsets.UTF_8)) { -@@ -37,17 +57,17 @@ +@@ -37,17 +57,18 @@ { String s1 = astring[0]; String s2 = field_111053_a.matcher(astring[1]).replaceAll("%$1s"); @@ -43,12 +43,12 @@ - this.field_150511_e = System.currentTimeMillis(); } -- catch (IOException var7) -+ catch (Exception var7) + catch (IOException var7) { ; } ++ catch (Exception ex) {} + return table; } - static StringTranslate func_74808_a() + static LanguageMap func_74808_a() diff --git a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch index 4bb2bf0d9d..7c90984810 100644 --- a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch @@ -18,16 +18,17 @@ return this.field_72817_c[i][j].func_177413_a(p_175629_1_, p_175629_2_); } } -@@ -150,7 +154,7 @@ +@@ -150,7 +154,8 @@ public boolean func_175623_d(BlockPos p_175623_1_) { -- return this.func_180495_p(p_175623_1_).func_177230_c().func_149688_o() == Material.field_151579_a; -+ return this.func_180495_p(p_175623_1_).func_177230_c().isAir(this, p_175623_1_); +- return this.func_180495_p(p_175623_1_).func_185904_a() == Material.field_151579_a; ++ IBlockState state = this.func_180495_p(p_175623_1_); ++ return state.func_177230_c().isAir(state, this, p_175623_1_); } @SideOnly(Side.CLIENT) -@@ -160,6 +164,7 @@ +@@ -160,6 +165,7 @@ { int i = (p_175628_2_.func_177958_n() >> 4) - this.field_72818_a; int j = (p_175628_2_.func_177952_p() >> 4) - this.field_72816_b; @@ -35,7 +36,7 @@ return this.field_72817_c[i][j].func_177413_a(p_175628_1_, p_175628_2_); } else -@@ -179,4 +184,16 @@ +@@ -178,4 +184,17 @@ { return this.field_72815_e.func_175624_G(); } @@ -49,6 +50,7 @@ + if (x < 0 || x >= field_72817_c.length || z < 0 || z >= field_72817_c[x].length) return _default; + if (field_72817_c[x][z] == null) return _default; + -+ return func_180495_p(pos).func_177230_c().isSideSolid(this, pos, side); ++ IBlockState state = func_180495_p(pos); ++ return state.func_177230_c().isSideSolid(state, this, pos, side); + } } diff --git a/patches/minecraft/net/minecraft/world/Explosion.java.patch b/patches/minecraft/net/minecraft/world/Explosion.java.patch index a7cbd02cf7..73813f3694 100644 --- a/patches/minecraft/net/minecraft/world/Explosion.java.patch +++ b/patches/minecraft/net/minecraft/world/Explosion.java.patch @@ -1,39 +1,39 @@ --- ../src-base/minecraft/net/minecraft/world/Explosion.java +++ ../src-work/minecraft/net/minecraft/world/Explosion.java -@@ -38,6 +38,7 @@ +@@ -40,6 +40,7 @@ private final float field_77280_f; private final List field_77281_g; - private final Map field_77288_k; -+ private final Vec3 position; + private final Map field_77288_k; ++ private final Vec3d position; @SideOnly(Side.CLIENT) public Explosion(World p_i45752_1_, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) -@@ -65,6 +66,7 @@ +@@ -67,6 +68,7 @@ this.field_77282_d = p_i45754_7_; this.field_77286_a = p_i45754_10_; this.field_82755_b = p_i45754_11_; -+ this.position = new Vec3(field_77284_b, field_77285_c, field_77282_d); ++ this.position = new Vec3d(field_77284_b, field_77285_c, field_77282_d); } public void func_77278_a() -@@ -99,7 +101,7 @@ +@@ -101,7 +103,7 @@ - if (iblockstate.func_177230_c().func_149688_o() != Material.field_151579_a) + if (iblockstate.func_185904_a() != Material.field_151579_a) { - float f2 = this.field_77283_e != null ? this.field_77283_e.func_180428_a(this, this.field_77287_j, blockpos, iblockstate) : iblockstate.func_177230_c().func_149638_a((Entity)null); + float f2 = this.field_77283_e != null ? this.field_77283_e.func_180428_a(this, this.field_77287_j, blockpos, iblockstate) : iblockstate.func_177230_c().getExplosionResistance(field_77287_j, blockpos, (Entity)null, this); f -= (f2 + 0.3F) * 0.3F; } -@@ -126,6 +128,7 @@ +@@ -128,6 +130,7 @@ int j2 = MathHelper.func_76128_c(this.field_77282_d - (double)f3 - 1.0D); int j1 = MathHelper.func_76128_c(this.field_77282_d + (double)f3 + 1.0D); List list = this.field_77287_j.func_72839_b(this.field_77283_e, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); + net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.field_77287_j, this, list, f3); - Vec3 vec3 = new Vec3(this.field_77284_b, this.field_77285_c, this.field_77282_d); + Vec3d vec3d = new Vec3d(this.field_77284_b, this.field_77285_c, this.field_77282_d); for (int k2 = 0; k2 < list.size(); ++k2) -@@ -213,8 +216,7 @@ +@@ -227,8 +230,7 @@ block.func_180653_a(this.field_77287_j, blockpos, this.field_77287_j.func_180495_p(blockpos), 1.0F / this.field_77280_f, 0); } @@ -43,10 +43,10 @@ } } } -@@ -250,4 +252,6 @@ +@@ -264,4 +266,6 @@ { return this.field_77281_g; } + -+ public Vec3 getPosition(){ return this.position; } ++ public Vec3d getPosition(){ return this.position; } } diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index f27243c084..9164dab330 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/World.java +++ ../src-work/minecraft/net/minecraft/world/World.java -@@ -57,6 +57,13 @@ +@@ -60,6 +60,13 @@ public abstract class World implements IBlockAccess { @@ -14,7 +14,7 @@ private int field_181546_a = 63; protected boolean field_72999_e; public final List field_72996_f = Lists.newArrayList(); -@@ -98,6 +105,10 @@ +@@ -101,6 +108,10 @@ private final WorldBorder field_175728_M; int[] field_72994_J; @@ -24,8 +24,8 @@ + protected World(ISaveHandler p_i45749_1_, WorldInfo p_i45749_2_, WorldProvider p_i45749_3_, Profiler p_i45749_4_, boolean p_i45749_5_) { - this.field_72990_M = this.field_73012_v.nextInt(12000); -@@ -110,6 +121,7 @@ + this.field_73021_x = Lists.newArrayList(new IWorldEventListener[] {this.field_184152_t}); +@@ -115,6 +126,7 @@ this.field_73011_w = p_i45749_3_; this.field_72995_K = p_i45749_5_; this.field_175728_M = p_i45749_3_.func_177501_r(); @@ -33,7 +33,7 @@ } public World func_175643_b() -@@ -119,13 +131,18 @@ +@@ -124,13 +136,18 @@ public BiomeGenBase func_180494_b(final BlockPos p_180494_1_) { @@ -55,7 +55,7 @@ } catch (Throwable throwable) { -@@ -135,7 +152,7 @@ +@@ -140,7 +157,7 @@ { public String call() throws Exception { @@ -64,25 +64,25 @@ } }); throw new ReportedException(crashreport); -@@ -143,7 +160,7 @@ +@@ -148,7 +165,7 @@ } else { -- return this.field_73011_w.func_177499_m().func_180300_a(p_180494_1_, BiomeGenBase.field_76772_c); -+ return this.field_73011_w.func_177499_m().func_180300_a(pos, BiomeGenBase.field_76772_c); +- return this.field_73011_w.func_177499_m().func_180300_a(p_180494_1_, Biomes.field_76772_c); ++ return this.field_73011_w.func_177499_m().func_180300_a(pos, Biomes.field_76772_c); } } -@@ -184,7 +201,7 @@ +@@ -194,7 +211,7 @@ public boolean func_175623_d(BlockPos p_175623_1_) { -- return this.func_180495_p(p_175623_1_).func_177230_c().func_149688_o() == Material.field_151579_a; -+ return this.func_180495_p(p_175623_1_).func_177230_c().isAir(this, p_175623_1_); +- return this.func_180495_p(p_175623_1_).func_185904_a() == Material.field_151579_a; ++ return this.func_180495_p(p_175623_1_).func_177230_c().isAir(this.func_180495_p(p_175623_1_), this, p_175623_1_); } public boolean func_175667_e(BlockPos p_175667_1_) -@@ -284,39 +301,63 @@ +@@ -291,37 +308,61 @@ { Chunk chunk = this.func_175726_f(p_180501_1_); Block block = p_180501_2_.func_177230_c(); @@ -93,9 +93,9 @@ + blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, p_180501_1_, p_180501_3_); + this.capturedBlockSnapshots.add(blockSnapshot); + } -+ Block oldBlock = func_180495_p(p_180501_1_).func_177230_c(); -+ int oldLight = oldBlock.getLightValue(this, p_180501_1_); -+ int oldOpacity = oldBlock.getLightOpacity(this, p_180501_1_); ++ IBlockState oldState = func_180495_p(p_180501_1_); ++ int oldLight = oldState.getLightValue(this, p_180501_1_); ++ int oldOpacity = oldState.getLightOpacity(this, p_180501_1_); + IBlockState iblockstate = chunk.func_177436_a(p_180501_1_, p_180501_2_); @@ -106,10 +106,8 @@ } else { - Block block1 = iblockstate.func_177230_c(); - -- if (block.func_149717_k() != block1.func_149717_k() || block.func_149750_m() != block1.func_149750_m()) -+ if (block.getLightOpacity(this, p_180501_1_) != oldOpacity || block.getLightValue(this, p_180501_1_) != oldLight) +- if (p_180501_2_.func_185891_c() != iblockstate.func_185891_c() || p_180501_2_.func_185906_d() != iblockstate.func_185906_d()) ++ if (p_180501_2_.getLightOpacity(this, p_180501_1_) != oldOpacity || p_180501_2_.getLightValue(this, p_180501_1_) != oldLight) { this.field_72984_F.func_76320_a("checkLight"); this.func_175664_x(p_180501_1_); @@ -119,35 +117,35 @@ - if ((p_180501_3_ & 2) != 0 && (!this.field_72995_K || (p_180501_3_ & 4) == 0) && chunk.func_150802_k()) + if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates { -- this.func_175689_h(p_180501_1_); -+ this.markAndNotifyBlock(p_180501_1_, chunk, iblockstate, p_180501_2_, p_180501_3_); // Modularize client and physic updates +- this.func_184138_a(p_180501_1_, iblockstate, p_180501_2_, p_180501_3_); ++ this.markAndNotifyBlock(p_180501_1_, chunk, iblockstate, p_180501_2_, p_180501_3_); } - -- if (!this.field_72995_K && (p_180501_3_ & 1) != 0) + return true; + } + } + } -+ -+ // Split off from original setBlockState(BlockPos, IBlockState Block p_147465_4_, int) method in order to directly send client and physic updates -+ public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState old, IBlockState new_, int flags) + +- if (!this.field_72995_K && (p_180501_3_ & 1) != 0) ++ // Split off from original setBlockState(BlockPos, IBlockState, int) method in order to directly send client and physic updates ++ public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState iblockstate, IBlockState newState, int flags) + { -+ if ((flags & 2) != 0 && (!this.field_72995_K || (flags & 4) == 0) && (chunk == null || chunk.func_150802_k())) -+ { -+ this.func_175689_h(pos); -+ } + { + { -+ if (!this.field_72995_K && (flags & 1) != 0) ++ if ((flags & 2) != 0 && (!this.field_72995_K || (flags & 4) == 0) && (chunk == null || chunk.func_150802_k())) { - this.func_175722_b(p_180501_1_, iblockstate.func_177230_c()); -+ this.func_175722_b(pos, new_.func_177230_c()); ++ this.func_184138_a(pos, iblockstate, newState, flags); ++ } -- if (block.func_149740_M()) -+ if (new_.func_177230_c().func_149740_M()) +- if (p_180501_2_.func_185912_n()) ++ if (!this.field_72995_K && (flags & 1) != 0) ++ { ++ this.func_175722_b(pos, iblockstate.func_177230_c()); ++ ++ if (newState.func_185912_n()) { - this.func_175666_e(p_180501_1_, block); -+ this.func_175666_e(pos, new_.func_177230_c()); ++ this.func_175666_e(pos, newState.func_177230_c()); } } - @@ -155,7 +153,16 @@ } } } -@@ -404,6 +445,9 @@ +@@ -336,7 +377,7 @@ + IBlockState iblockstate = this.func_180495_p(p_175655_1_); + Block block = iblockstate.func_177230_c(); + +- if (iblockstate.func_185904_a() == Material.field_151579_a) ++ if (block.isAir(iblockstate, this, p_175655_1_)) + { + return false; + } +@@ -409,6 +450,9 @@ public void func_175685_c(BlockPos p_175685_1_, Block p_175685_2_) { @@ -165,7 +172,7 @@ this.func_180496_d(p_175685_1_.func_177976_e(), p_175685_2_); this.func_180496_d(p_175685_1_.func_177974_f(), p_175685_2_); this.func_180496_d(p_175685_1_.func_177977_b(), p_175685_2_); -@@ -414,6 +458,11 @@ +@@ -419,6 +463,11 @@ public void func_175695_a(BlockPos p_175695_1_, Block p_175695_2_, EnumFacing p_175695_3_) { @@ -177,7 +184,16 @@ if (p_175695_3_ != EnumFacing.WEST) { this.func_180496_d(p_175695_1_.func_177976_e(), p_175695_2_); -@@ -777,7 +826,7 @@ +@@ -514,7 +563,7 @@ + { + IBlockState iblockstate = this.func_180495_p(blockpos); + +- if (iblockstate.func_185891_c() > 0 && !iblockstate.func_185904_a().func_76224_d()) ++ if (iblockstate.func_177230_c().getLightOpacity(iblockstate, this, blockpos) > 0 && !iblockstate.func_185904_a().func_76224_d()) + { + return false; + } +@@ -782,7 +831,7 @@ public boolean func_72935_r() { @@ -185,34 +201,22 @@ + return this.field_73011_w.isDaytime(); } - public MovingObjectPosition func_72933_a(Vec3 p_72933_1_, Vec3 p_72933_2_) -@@ -972,6 +1021,12 @@ + public RayTraceResult func_72933_a(Vec3d p_72933_1_, Vec3d p_72933_2_) +@@ -982,6 +1031,13 @@ - public void func_72956_a(Entity p_72956_1_, String p_72956_2_, float p_72956_3_, float p_72956_4_) + public void func_184148_a(EntityPlayer p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_72956_1_, p_72956_2_, p_72956_3_, p_72956_4_); -+ if (event.isCanceled() || event.name == null) return; -+ p_72956_2_ = event.name; -+ p_72956_3_ = event.newVolume; -+ p_72956_4_ = event.newPitch; ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_10_, p_184148_11_); ++ if (event.isCanceled() || event.getSound() == null) return; ++ p_184148_8_ = event.getSound(); ++ p_184148_9_ = event.getCategory(); ++ p_184148_10_ = event.getVolume(); ++ p_184148_11_ = event.getPitch(); + for (int i = 0; i < this.field_73021_x.size(); ++i) { - ((IWorldAccess)this.field_73021_x.get(i)).func_72704_a(p_72956_2_, p_72956_1_.field_70165_t, p_72956_1_.field_70163_u, p_72956_1_.field_70161_v, p_72956_3_, p_72956_4_); -@@ -980,6 +1035,12 @@ - - public void func_85173_a(EntityPlayer p_85173_1_, String p_85173_2_, float p_85173_3_, float p_85173_4_) - { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_85173_1_, p_85173_2_, p_85173_3_, p_85173_4_); -+ if (event.isCanceled() || event.name == null) return; -+ p_85173_2_ = event.name; -+ p_85173_3_ = event.newVolume; -+ p_85173_4_ = event.newPitch; -+ - for (int i = 0; i < this.field_73021_x.size(); ++i) - { - ((IWorldAccess)this.field_73021_x.get(i)).func_85102_a(p_85173_1_, p_85173_2_, p_85173_1_.field_70165_t, p_85173_1_.field_70163_u, p_85173_1_.field_70161_v, p_85173_3_, p_85173_4_); -@@ -1033,6 +1094,9 @@ + ((IWorldEventListener)this.field_73021_x.get(i)).func_184375_a(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_, p_184148_11_); +@@ -1027,6 +1083,9 @@ public boolean func_72838_d(Entity p_72838_1_) { @@ -222,7 +226,7 @@ int i = MathHelper.func_76128_c(p_72838_1_.field_70165_t / 16.0D); int j = MathHelper.func_76128_c(p_72838_1_.field_70161_v / 16.0D); boolean flag = p_72838_1_.field_98038_p; -@@ -1055,6 +1119,8 @@ +@@ -1049,6 +1108,8 @@ this.func_72854_c(); } @@ -231,7 +235,15 @@ this.func_72964_e(i, j).func_76612_a(p_72838_1_); this.field_72996_f.add(p_72838_1_); this.func_72923_a(p_72838_1_); -@@ -1267,17 +1333,29 @@ +@@ -1285,7 +1346,6 @@ + return list; + } + +- @SideOnly(Side.CLIENT) + public void func_72848_b(IWorldEventListener p_72848_1_) + { + this.field_73021_x.remove(p_72848_1_); +@@ -1348,19 +1408,38 @@ public int func_72967_a(float p_72967_1_) { @@ -250,7 +262,7 @@ + public float getSunBrightnessFactor(float p_72967_1_) + { float f = this.func_72826_c(p_72967_1_); - float f1 = 1.0F - (MathHelper.func_76134_b(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F); + float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F); f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); f1 = 1.0F - f1; f1 = (float)((double)f1 * (1.0D - (double)(this.func_72867_j(p_72967_1_) * 5.0F) / 16.0D)); @@ -260,11 +272,6 @@ + return f1; } -- @SideOnly(Side.CLIENT) - public void func_72848_b(IWorldAccess p_72848_1_) - { - this.field_73021_x.remove(p_72848_1_); -@@ -1286,6 +1364,12 @@ @SideOnly(Side.CLIENT) public float func_72971_b(float p_72971_1_) { @@ -275,24 +282,28 @@ + public float getSunBrightnessBody(float p_72971_1_) + { float f = this.func_72826_c(p_72971_1_); - float f1 = 1.0F - (MathHelper.func_76134_b(f * (float)Math.PI * 2.0F) * 2.0F + 0.2F); + float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.2F); f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); -@@ -1298,6 +1382,12 @@ +@@ -1373,23 +1452,27 @@ @SideOnly(Side.CLIENT) - public Vec3 func_72833_a(Entity p_72833_1_, float p_72833_2_) + public Vec3d func_72833_a(Entity p_72833_1_, float p_72833_2_) { +- float f = this.func_72826_c(p_72833_2_); + return this.field_73011_w.getSkyColor(p_72833_1_, p_72833_2_); + } + + @SideOnly(Side.CLIENT) -+ public Vec3 getSkyColorBody(Entity p_72833_1_, float p_72833_2_) ++ public Vec3d getSkyColorBody(Entity entityIn, float partialTicks) + { - float f = this.func_72826_c(p_72833_2_); - float f1 = MathHelper.func_76134_b(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; ++ float f = this.func_72826_c(partialTicks); + float f1 = MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F; f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); -@@ -1305,9 +1395,7 @@ - int j = MathHelper.func_76128_c(p_72833_1_.field_70163_u); - int k = MathHelper.func_76128_c(p_72833_1_.field_70161_v); +- int i = MathHelper.func_76128_c(p_72833_1_.field_70165_t); +- int j = MathHelper.func_76128_c(p_72833_1_.field_70163_u); +- int k = MathHelper.func_76128_c(p_72833_1_.field_70161_v); ++ int i = MathHelper.func_76128_c(entityIn.field_70165_t); ++ int j = MathHelper.func_76128_c(entityIn.field_70163_u); ++ int k = MathHelper.func_76128_c(entityIn.field_70161_v); BlockPos blockpos = new BlockPos(i, j, k); - BiomeGenBase biomegenbase = this.func_180494_b(blockpos); - float f2 = biomegenbase.func_180626_a(blockpos); @@ -301,7 +312,33 @@ float f3 = (float)(l >> 16 & 255) / 255.0F; float f4 = (float)(l >> 8 & 255) / 255.0F; float f5 = (float)(l & 255) / 255.0F; -@@ -1367,6 +1455,11 @@ + f3 = f3 * f1; + f4 = f4 * f1; + f5 = f5 * f1; +- float f6 = this.func_72867_j(p_72833_2_); ++ float f6 = this.func_72867_j(partialTicks); + + if (f6 > 0.0F) + { +@@ -1400,7 +1483,7 @@ + f5 = f5 * f8 + f7 * (1.0F - f8); + } + +- float f10 = this.func_72819_i(p_72833_2_); ++ float f10 = this.func_72819_i(partialTicks); + + if (f10 > 0.0F) + { +@@ -1413,7 +1496,7 @@ + + if (this.field_73016_r > 0) + { +- float f12 = (float)this.field_73016_r - p_72833_2_; ++ float f12 = (float)this.field_73016_r - partialTicks; + + if (f12 > 1.0F) + { +@@ -1442,6 +1525,11 @@ public float func_130001_d() { @@ -313,32 +350,50 @@ return WorldProvider.field_111203_a[this.field_73011_w.func_76559_b(this.field_72986_A.func_76073_f())]; } -@@ -1379,6 +1472,12 @@ +@@ -1454,13 +1542,19 @@ @SideOnly(Side.CLIENT) - public Vec3 func_72824_f(float p_72824_1_) + public Vec3d func_72824_f(float p_72824_1_) { -+ return this.field_73011_w.drawClouds(p_72824_1_); +- float f = this.func_72826_c(p_72824_1_); ++ return this.field_73011_w.getCloudColor(p_72824_1_); + } + + @SideOnly(Side.CLIENT) -+ public Vec3 drawCloudsBody(float p_72824_1_) ++ public Vec3d getCloudColorBody(float partialTicks) + { - float f = this.func_72826_c(p_72824_1_); - float f1 = MathHelper.func_76134_b(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; ++ float f = this.func_72826_c(partialTicks); + float f1 = MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F; f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); -@@ -1434,9 +1533,9 @@ + float f2 = (float)(this.field_73001_c >> 16 & 255L) / 255.0F; + float f3 = (float)(this.field_73001_c >> 8 & 255L) / 255.0F; + float f4 = (float)(this.field_73001_c & 255L) / 255.0F; +- float f5 = this.func_72867_j(p_72824_1_); ++ float f5 = this.func_72867_j(partialTicks); + + if (f5 > 0.0F) + { +@@ -1474,7 +1568,7 @@ + f2 = f2 * (f1 * 0.9F + 0.1F); + f3 = f3 * (f1 * 0.9F + 0.1F); + f4 = f4 * (f1 * 0.85F + 0.15F); +- float f9 = this.func_72819_i(p_72824_1_); ++ float f9 = this.func_72819_i(partialTicks); + + if (f9 > 0.0F) + { +@@ -1509,9 +1603,9 @@ for (blockpos = new BlockPos(p_175672_1_.func_177958_n(), chunk.func_76625_h() + 16, p_175672_1_.func_177952_p()); blockpos.func_177956_o() >= 0; blockpos = blockpos1) { blockpos1 = blockpos.func_177977_b(); -- Material material = chunk.func_177428_a(blockpos1).func_149688_o(); -+ Block block = chunk.func_177428_a(blockpos1); +- Material material = chunk.func_177435_g(blockpos1).func_185904_a(); ++ IBlockState state = chunk.func_177435_g(blockpos1); - if (material.func_76230_c() && material != Material.field_151584_j) -+ if (block.func_149688_o().func_76230_c() && !block.isLeaves(this, blockpos1) && !block.isFoliage(this, blockpos1)) ++ if (state.func_185904_a().func_76230_c() && !state.func_177230_c().isLeaves(state, this, blockpos1) && !state.func_177230_c().isFoliage(this, blockpos1)) { break; } -@@ -1448,6 +1547,12 @@ +@@ -1523,6 +1617,12 @@ @SideOnly(Side.CLIENT) public float func_72880_h(float p_72880_1_) { @@ -349,47 +404,38 @@ + public float getStarBrightnessBody(float p_72880_1_) + { float f = this.func_72826_c(p_72880_1_); - float f1 = 1.0F - (MathHelper.func_76134_b(f * (float)Math.PI * 2.0F) * 2.0F + 0.25F); + float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.25F); f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); -@@ -1494,7 +1599,15 @@ +@@ -1574,6 +1674,12 @@ entity.func_85029_a(crashreportcategory); } -- throw new ReportedException(crashreport); + if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) + { + net.minecraftforge.fml.common.FMLLog.severe(crashreport.func_71502_e()); + func_72900_e(entity); + } + else -+ { -+ throw new ReportedException(crashreport); -+ } + throw new ReportedException(crashreport); } - if (entity.field_70128_L) -@@ -1554,7 +1667,15 @@ +@@ -1635,6 +1741,12 @@ CrashReport crashreport1 = CrashReport.func_85055_a(throwable1, "Ticking entity"); - CrashReportCategory crashreportcategory2 = crashreport1.func_85058_a("Entity being ticked"); - entity2.func_85029_a(crashreportcategory2); -- throw new ReportedException(crashreport1); + CrashReportCategory crashreportcategory1 = crashreport1.func_85058_a("Entity being ticked"); + entity2.func_85029_a(crashreportcategory1); + if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) + { + net.minecraftforge.fml.common.FMLLog.severe(crashreport1.func_71502_e()); + func_72900_e(entity2); + } + else -+ { -+ throw new ReportedException(crashreport1); -+ } + throw new ReportedException(crashreport1); } } - -@@ -1601,7 +1722,16 @@ +@@ -1684,6 +1796,13 @@ CrashReport crashreport2 = CrashReport.func_85055_a(throwable, "Ticking block entity"); - CrashReportCategory crashreportcategory1 = crashreport2.func_85058_a("Block entity being ticked"); - tileentity.func_145828_a(crashreportcategory1); -- throw new ReportedException(crashreport2); + CrashReportCategory crashreportcategory2 = crashreport2.func_85058_a("Block entity being ticked"); + tileentity.func_145828_a(crashreportcategory2); + if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities) + { + net.minecraftforge.fml.common.FMLLog.severe(crashreport2.func_71502_e()); @@ -397,13 +443,10 @@ + this.func_175713_t(tileentity.func_174877_v()); + } + else -+ { -+ throw new ReportedException(crashreport2); -+ } + throw new ReportedException(crashreport2); } } - } -@@ -1618,15 +1748,20 @@ +@@ -1701,15 +1820,20 @@ } } @@ -426,7 +469,7 @@ this.field_72984_F.func_76318_c("pendingBlockEntities"); if (!this.field_147484_a.isEmpty()) -@@ -1660,7 +1795,8 @@ +@@ -1748,7 +1872,8 @@ public boolean func_175700_a(TileEntity p_175700_1_) { @@ -436,7 +479,7 @@ if (flag && p_175700_1_ instanceof ITickable) { -@@ -1699,9 +1835,13 @@ +@@ -1782,9 +1907,13 @@ { int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t); int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v); @@ -452,17 +495,17 @@ { p_72866_1_.field_70142_S = p_72866_1_.field_70165_t; p_72866_1_.field_70137_T = p_72866_1_.field_70163_u; -@@ -1829,7 +1969,7 @@ +@@ -1913,7 +2042,7 @@ { - Block block = this.func_180495_p(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).func_177230_c(); + IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos.func_185343_d(k1, l1, i2)); -- if (block.func_149688_o() != Material.field_151579_a) -+ if (!block.isAir(this, new BlockPos(k1, l1, i2))) +- if (iblockstate.func_185904_a() != Material.field_151579_a) ++ if (iblockstate.func_177230_c().isAir(iblockstate, this, new BlockPos(k1, l1, i2))) { + blockpos$pooledmutableblockpos.func_185344_t(); return true; - } -@@ -1894,6 +2034,10 @@ - { +@@ -1983,6 +2112,10 @@ + blockpos$pooledmutableblockpos.func_185344_t(); return true; } + else if (block.isBurning(this, new BlockPos(k1, l1, i2))) @@ -472,34 +515,34 @@ } } } -@@ -1930,6 +2074,16 @@ - blockpos$mutableblockpos.func_181079_c(k1, l1, i2); - IBlockState iblockstate = this.func_180495_p(blockpos$mutableblockpos); +@@ -2022,6 +2155,16 @@ + IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos); Block block = iblockstate.func_177230_c(); -+ -+ Boolean result = block.isEntityInsideMaterial(this, blockpos$mutableblockpos, iblockstate, p_72918_3_, (double)l, p_72918_2_, false); + ++ Boolean result = block.isEntityInsideMaterial(this, blockpos$pooledmutableblockpos, iblockstate, p_72918_3_, (double)l, p_72918_2_, false); + if (result != null && result == true) + { + // Forge: When requested call blocks modifyAcceleration method, and more importantly cause this method to return true, which results in an entity being "inWater" + flag = true; -+ vec3 = block.func_176197_a(this, blockpos$mutableblockpos, p_72918_3_, vec3); ++ vec3d = block.func_176197_a(this, blockpos$pooledmutableblockpos, p_72918_3_, vec3d); + continue; + } + else if (result != null && result == false) continue; - - if (block.func_149688_o() == p_72918_2_) ++ + if (iblockstate.func_185904_a() == p_72918_2_) { -@@ -2004,6 +2158,9 @@ - IBlockState iblockstate = this.func_180495_p(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)); - Block block = iblockstate.func_177230_c(); + double d0 = (double)((float)(l1 + 1) - BlockLiquid.func_149801_b(((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue())); +@@ -2098,6 +2241,9 @@ + { + IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos.func_185343_d(k1, l1, i2)); -+ Boolean result = block.isAABBInsideMaterial(this, blockpos$mutableblockpos, p_72830_1_, p_72830_2_); ++ Boolean result = iblockstate.func_177230_c().isAABBInsideMaterial(this, blockpos$pooledmutableblockpos, p_72830_1_, p_72830_2_); + if (result != null) return result; + - if (block.func_149688_o() == p_72830_2_) + if (iblockstate.func_185904_a() == p_72830_2_) { int j2 = ((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue(); -@@ -2034,6 +2191,7 @@ +@@ -2130,6 +2276,7 @@ public Explosion func_72885_a(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) { Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); @@ -507,7 +550,7 @@ explosion.func_77278_a(); explosion.func_77279_a(true); return explosion; -@@ -2180,19 +2338,27 @@ +@@ -2276,19 +2423,27 @@ else { this.func_175700_a(p_175690_2_); @@ -536,7 +579,7 @@ } else { -@@ -2205,6 +2371,7 @@ +@@ -2301,6 +2456,7 @@ this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_); } @@ -544,25 +587,16 @@ } public void func_147457_a(TileEntity p_147457_1_) -@@ -2223,7 +2390,7 @@ - { - IBlockState iblockstate = p_175683_0_.func_180495_p(p_175683_1_); - Block block = iblockstate.func_177230_c(); -- return block.func_149688_o().func_76218_k() && block.func_149686_d() ? true : (block instanceof BlockStairs ? iblockstate.func_177229_b(BlockStairs.field_176308_b) == BlockStairs.EnumHalf.TOP : (block instanceof BlockSlab ? iblockstate.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? ((Integer)iblockstate.func_177229_b(BlockSnow.field_176315_a)).intValue() == 7 : false)))); -+ return block.isSideSolid(p_175683_0_, p_175683_1_, EnumFacing.UP); - } - - public boolean func_175677_d(BlockPos p_175677_1_, boolean p_175677_2_) -@@ -2243,7 +2410,7 @@ +@@ -2327,7 +2483,7 @@ + if (chunk != null && !chunk.func_76621_g()) + { + IBlockState iblockstate = this.func_180495_p(p_175677_1_); +- return iblockstate.func_185904_a().func_76218_k() && iblockstate.func_185917_h(); ++ return iblockstate.func_177230_c().isNormalCube(iblockstate, this, p_175677_1_); + } else { - Block block = this.func_180495_p(p_175677_1_).func_177230_c(); -- return block.func_149688_o().func_76218_k() && block.func_149686_d(); -+ return block.isNormalCube(this, p_175677_1_); - } - } - } -@@ -2262,6 +2429,7 @@ +@@ -2350,6 +2506,7 @@ { this.field_72985_G = p_72891_1_; this.field_72992_H = p_72891_2_; @@ -570,7 +604,7 @@ } public void func_72835_b() -@@ -2271,6 +2439,11 @@ +@@ -2359,6 +2516,11 @@ protected void func_72947_a() { @@ -582,7 +616,7 @@ if (this.field_72986_A.func_76059_o()) { this.field_73004_o = 1.0F; -@@ -2284,6 +2457,11 @@ +@@ -2372,6 +2534,11 @@ protected void func_72979_l() { @@ -594,74 +628,107 @@ if (!this.field_73011_w.func_177495_o()) { if (!this.field_72995_K) -@@ -2378,6 +2556,7 @@ - { - this.field_72993_I.clear(); - this.field_72984_F.func_76320_a("buildList"); -+ this.field_72993_I.addAll(getPersistentChunks().keySet()); - - for (int i = 0; i < this.field_73010_i.size(); ++i) - { -@@ -2434,8 +2613,9 @@ - Block block = p_147467_3_.func_177428_a(blockpos); - j = j + p_147467_1_; - k = k + p_147467_2_; -+ BlockPos worldpos = blockpos.func_177982_a(p_147467_1_, 0, p_147467_2_); - -- if (block.func_149688_o() == Material.field_151579_a && this.func_175699_k(blockpos) <= this.field_73012_v.nextInt(8) && this.func_175642_b(EnumSkyBlock.SKY, blockpos) <= 0) -+ if (block.isAir(this, worldpos) && this.func_175699_k(worldpos) <= this.field_73012_v.nextInt(8) && this.func_175642_b(EnumSkyBlock.SKY, worldpos) <= 0) //Forge: isAir, and fix arguments to world positions instead of chunk position - { - EntityPlayer entityplayer = this.func_72977_a((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, 8.0D); - -@@ -2475,6 +2655,11 @@ +@@ -2491,28 +2658,33 @@ public boolean func_175670_e(BlockPos p_175670_1_, boolean p_175670_2_) { +- BiomeGenBase biomegenbase = this.func_180494_b(p_175670_1_); +- float f = biomegenbase.func_180626_a(p_175670_1_); + return this.field_73011_w.canBlockFreeze(p_175670_1_, p_175670_2_); + } -+ -+ public boolean canBlockFreezeBody(BlockPos p_175670_1_, boolean p_175670_2_) -+ { - BiomeGenBase biomegenbase = this.func_180494_b(p_175670_1_); - float f = biomegenbase.func_180626_a(p_175670_1_); -@@ -2516,6 +2701,11 @@ ++ public boolean canBlockFreezeBody(BlockPos pos, boolean noWaterAdj) ++ { ++ BiomeGenBase biomegenbase = this.func_180494_b(pos); ++ float f = biomegenbase.func_180626_a(pos); ++ + if (f > 0.15F) + { + return false; + } + else + { +- if (p_175670_1_.func_177956_o() >= 0 && p_175670_1_.func_177956_o() < 256 && this.func_175642_b(EnumSkyBlock.BLOCK, p_175670_1_) < 10) ++ if (pos.func_177956_o() >= 0 && pos.func_177956_o() < 256 && this.func_175642_b(EnumSkyBlock.BLOCK, pos) < 10) + { +- IBlockState iblockstate = this.func_180495_p(p_175670_1_); ++ IBlockState iblockstate = this.func_180495_p(pos); + Block block = iblockstate.func_177230_c(); + + if ((block == Blocks.field_150355_j || block == Blocks.field_150358_i) && ((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue() == 0) + { +- if (!p_175670_2_) ++ if (!noWaterAdj) + { + return true; + } + +- boolean flag = this.func_175696_F(p_175670_1_.func_177976_e()) && this.func_175696_F(p_175670_1_.func_177974_f()) && this.func_175696_F(p_175670_1_.func_177978_c()) && this.func_175696_F(p_175670_1_.func_177968_d()); ++ boolean flag = this.func_175696_F(pos.func_177976_e()) && this.func_175696_F(pos.func_177974_f()) && this.func_175696_F(pos.func_177978_c()) && this.func_175696_F(pos.func_177968_d()); + + if (!flag) + { +@@ -2532,24 +2704,29 @@ public boolean func_175708_f(BlockPos p_175708_1_, boolean p_175708_2_) { +- BiomeGenBase biomegenbase = this.func_180494_b(p_175708_1_); +- float f = biomegenbase.func_180626_a(p_175708_1_); + return this.field_73011_w.canSnowAt(p_175708_1_, p_175708_2_); + } -+ -+ public boolean canSnowAtBody(BlockPos p_175708_1_, boolean p_175708_2_) + ++ public boolean canSnowAtBody(BlockPos pos, boolean checkLight) + { - BiomeGenBase biomegenbase = this.func_180494_b(p_175708_1_); - float f = biomegenbase.func_180626_a(p_175708_1_); - -@@ -2533,7 +2723,7 @@ ++ BiomeGenBase biomegenbase = this.func_180494_b(pos); ++ float f = biomegenbase.func_180626_a(pos); ++ + if (f > 0.15F) + { + return false; + } +- else if (!p_175708_2_) ++ else if (!checkLight) + { + return true; + } + else + { +- if (p_175708_1_.func_177956_o() >= 0 && p_175708_1_.func_177956_o() < 256 && this.func_175642_b(EnumSkyBlock.BLOCK, p_175708_1_) < 10) ++ if (pos.func_177956_o() >= 0 && pos.func_177956_o() < 256 && this.func_175642_b(EnumSkyBlock.BLOCK, pos) < 10) { - Block block = this.func_180495_p(p_175708_1_).func_177230_c(); +- IBlockState iblockstate = this.func_180495_p(p_175708_1_); ++ IBlockState iblockstate = this.func_180495_p(pos); -- if (block.func_149688_o() == Material.field_151579_a && Blocks.field_150431_aC.func_176196_c(this, p_175708_1_)) -+ if (block.isAir(this, p_175708_1_) && Blocks.field_150431_aC.func_176196_c(this, p_175708_1_)) +- if (iblockstate.func_185904_a() == Material.field_151579_a && Blocks.field_150431_aC.func_176196_c(this, p_175708_1_)) ++ if (iblockstate.func_177230_c().isAir(iblockstate, this, pos) && Blocks.field_150431_aC.func_176196_c(this, pos)) { return true; } -@@ -2565,10 +2755,11 @@ +@@ -2581,10 +2758,11 @@ else { - Block block = this.func_180495_p(p_175638_1_).func_177230_c(); -- int i = p_175638_2_ == EnumSkyBlock.SKY ? 0 : block.func_149750_m(); -- int j = block.func_149717_k(); -+ int blockLight = block.getLightValue(this, p_175638_1_); + IBlockState iblockstate = this.func_180495_p(p_175638_1_); +- int i = p_175638_2_ == EnumSkyBlock.SKY ? 0 : iblockstate.func_185906_d(); +- int j = iblockstate.func_185891_c(); ++ int blockLight = iblockstate.func_177230_c().getLightValue(iblockstate, this, p_175638_1_); + int i = p_175638_2_ == EnumSkyBlock.SKY ? 0 : blockLight; -+ int j = block.getLightOpacity(this, p_175638_1_); ++ int j = iblockstate.func_177230_c().getLightOpacity(iblockstate, this, p_175638_1_); -- if (j >= 15 && block.func_149750_m() > 0) +- if (j >= 15 && iblockstate.func_185906_d() > 0) + if (j >= 15 && blockLight > 0) { j = 1; } -@@ -2768,10 +2959,10 @@ +@@ -2683,7 +2861,7 @@ + int j4 = j2 + enumfacing.func_96559_d(); + int k4 = k2 + enumfacing.func_82599_e(); + blockpos$pooledmutableblockpos.func_185343_d(i4, j4, k4); +- int l4 = Math.max(1, this.func_180495_p(blockpos$pooledmutableblockpos).func_185891_c()); ++ int l4 = Math.max(1, this.func_180495_p(blockpos$pooledmutableblockpos).func_177230_c().getLightOpacity(this.func_180495_p(blockpos$pooledmutableblockpos), this, blockpos$pooledmutableblockpos)); + i3 = this.func_175642_b(p_180500_1_, blockpos$pooledmutableblockpos); + + if (i3 == l2 - l4 && j < this.field_72994_J.length) +@@ -2789,10 +2967,10 @@ public List func_175674_a(Entity p_175674_1_, AxisAlignedBB p_175674_2_, Predicate p_175674_3_) { List list = Lists.newArrayList(); @@ -676,22 +743,22 @@ for (int i1 = i; i1 <= j; ++i1) { -@@ -2824,10 +3015,10 @@ +@@ -2845,10 +3023,10 @@ public List func_175647_a(Class p_175647_1_, AxisAlignedBB p_175647_2_, Predicate p_175647_3_) { - int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - 2.0D) / 16.0D); -- int j = MathHelper.func_76128_c((p_175647_2_.field_72336_d + 2.0D) / 16.0D); +- int j = MathHelper.func_76143_f((p_175647_2_.field_72336_d + 2.0D) / 16.0D); - int k = MathHelper.func_76128_c((p_175647_2_.field_72339_c - 2.0D) / 16.0D); -- int l = MathHelper.func_76128_c((p_175647_2_.field_72334_f + 2.0D) / 16.0D); +- int l = MathHelper.func_76143_f((p_175647_2_.field_72334_f + 2.0D) / 16.0D); + int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.func_76128_c((p_175647_2_.field_72336_d + MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.func_76143_f((p_175647_2_.field_72336_d + MAX_ENTITY_RADIUS) / 16.0D); + int k = MathHelper.func_76128_c((p_175647_2_.field_72339_c - MAX_ENTITY_RADIUS) / 16.0D); -+ int l = MathHelper.func_76128_c((p_175647_2_.field_72334_f + MAX_ENTITY_RADIUS) / 16.0D); ++ int l = MathHelper.func_76143_f((p_175647_2_.field_72334_f + MAX_ENTITY_RADIUS) / 16.0D); List list = Lists.newArrayList(); - for (int i1 = i; i1 <= j; ++i1) -@@ -2905,11 +3096,13 @@ + for (int i1 = i; i1 < j; ++i1) +@@ -2926,11 +3104,13 @@ public void func_175650_b(Collection p_175650_1_) { @@ -708,27 +775,25 @@ } } -@@ -2922,7 +3115,9 @@ +@@ -2943,7 +3123,7 @@ { - Block block = this.func_180495_p(p_175716_2_).func_177230_c(); - AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.func_180640_a(this, p_175716_2_, p_175716_1_.func_176223_P()); -- return axisalignedbb != null && !this.func_72917_a(axisalignedbb, p_175716_5_) ? false : (block.func_149688_o() == Material.field_151594_q && p_175716_1_ == Blocks.field_150467_bQ ? true : block.func_149688_o().func_76222_j() && p_175716_1_.func_176193_a(this, p_175716_2_, p_175716_4_, p_175716_6_)); -+ if (axisalignedbb != null && !this.func_72917_a(axisalignedbb, p_175716_5_)) return false; -+ if (block.func_149688_o() == Material.field_151594_q && p_175716_1_ == Blocks.field_150467_bQ) return true; -+ return block.func_176200_f(this, p_175716_2_) && p_175716_1_.func_176193_a(this, p_175716_2_, p_175716_4_, p_175716_6_); + IBlockState iblockstate = this.func_180495_p(p_175716_2_); + AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.func_176223_P().func_185890_d(this, p_175716_2_); +- return axisalignedbb != Block.field_185506_k && !this.func_72917_a(axisalignedbb.func_186670_a(p_175716_2_), p_175716_5_) ? false : (iblockstate.func_185904_a() == Material.field_151594_q && p_175716_1_ == Blocks.field_150467_bQ ? true : iblockstate.func_185904_a().func_76222_j() && p_175716_1_.func_176193_a(this, p_175716_2_, p_175716_4_, p_175716_6_)); ++ return axisalignedbb != Block.field_185506_k && !this.func_72917_a(axisalignedbb.func_186670_a(p_175716_2_), p_175716_5_) ? false : (iblockstate.func_185904_a() == Material.field_151594_q && p_175716_1_ == Blocks.field_150467_bQ ? true : iblockstate.func_177230_c().func_176200_f(this, p_175716_2_) && p_175716_1_.func_176193_a(this, p_175716_2_, p_175716_4_, p_175716_6_)); } public int func_181545_F() -@@ -3007,7 +3202,7 @@ +@@ -3026,7 +3206,7 @@ + public int func_175651_c(BlockPos p_175651_1_, EnumFacing p_175651_2_) { IBlockState iblockstate = this.func_180495_p(p_175651_1_); - Block block = iblockstate.func_177230_c(); -- return block.func_149721_r() ? this.func_175676_y(p_175651_1_) : block.func_180656_a(this, p_175651_1_, iblockstate, p_175651_2_); -+ return block.shouldCheckWeakPower(this, p_175651_1_, p_175651_2_) ? this.func_175676_y(p_175651_1_) : block.func_180656_a(this, p_175651_1_, iblockstate, p_175651_2_); +- return iblockstate.func_185915_l() ? this.func_175676_y(p_175651_1_) : iblockstate.func_185911_a(this, p_175651_1_, p_175651_2_); ++ return iblockstate.func_177230_c().shouldCheckWeakPower(iblockstate, this, p_175651_1_, p_175651_2_) ? this.func_175676_y(p_175651_1_) : iblockstate.func_185911_a(this, p_175651_1_, p_175651_2_); } public boolean func_175640_z(BlockPos p_175640_1_) -@@ -3134,7 +3329,7 @@ +@@ -3215,7 +3395,7 @@ public long func_72905_C() { @@ -737,7 +802,7 @@ } public long func_82737_E() -@@ -3144,17 +3339,17 @@ +@@ -3225,17 +3405,17 @@ public long func_72820_D() { @@ -758,7 +823,7 @@ if (!this.func_175723_af().func_177746_a(blockpos)) { -@@ -3166,7 +3361,7 @@ +@@ -3247,7 +3427,7 @@ public void func_175652_B(BlockPos p_175652_1_) { @@ -767,7 +832,7 @@ } @SideOnly(Side.CLIENT) -@@ -3186,12 +3381,18 @@ +@@ -3267,12 +3447,18 @@ if (!this.field_72996_f.contains(p_72897_1_)) { @@ -781,12 +846,12 @@ + return this.field_73011_w.canMineBlock(p_175660_1_, p_175660_2_); + } + -+ public boolean canMineBlockBody(EntityPlayer p_175660_1_, BlockPos p_175660_2_) ++ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) + { return true; } -@@ -3285,8 +3486,7 @@ +@@ -3366,8 +3552,7 @@ public boolean func_180502_D(BlockPos p_180502_1_) { @@ -796,7 +861,7 @@ } public MapStorage func_175693_T() -@@ -3345,12 +3545,12 @@ +@@ -3426,12 +3611,12 @@ public int func_72800_K() { @@ -811,7 +876,7 @@ } public Random func_72843_D(int p_72843_1_, int p_72843_2_, int p_72843_3_) -@@ -3405,7 +3605,7 @@ +@@ -3481,7 +3666,7 @@ @SideOnly(Side.CLIENT) public double func_72919_O() { @@ -820,7 +885,7 @@ } public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_) -@@ -3439,7 +3639,7 @@ +@@ -3515,7 +3700,7 @@ public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) { @@ -829,36 +894,33 @@ { BlockPos blockpos = p_175666_1_.func_177972_a(enumfacing); -@@ -3447,18 +3647,14 @@ +@@ -3523,18 +3708,14 @@ { IBlockState iblockstate = this.func_180495_p(blockpos); -- if (Blocks.field_150441_bU.func_149907_e(iblockstate.func_177230_c())) +- if (Blocks.field_150441_bU.func_185547_C(iblockstate)) + iblockstate.func_177230_c().onNeighborChange(this, blockpos, p_175666_1_); -+ if (iblockstate.func_177230_c().isNormalCube(this, blockpos)) ++ if (iblockstate.func_177230_c().isNormalCube(iblockstate, this, blockpos)) { - iblockstate.func_177230_c().func_176204_a(this, blockpos, iblockstate, p_175666_2_); - } -- else if (iblockstate.func_177230_c().func_149721_r()) +- else if (iblockstate.func_185915_l()) - { -- blockpos = blockpos.func_177972_a(enumfacing); -- iblockstate = this.func_180495_p(blockpos); + blockpos = blockpos.func_177972_a(enumfacing); + iblockstate = this.func_180495_p(blockpos); - -- if (Blocks.field_150441_bU.func_149907_e(iblockstate.func_177230_c())) -+ BlockPos posOther = blockpos.func_177972_a(enumfacing); -+ Block other = func_180495_p(posOther).func_177230_c(); -+ if (other.getWeakChanges(this, posOther)) +- if (Blocks.field_150441_bU.func_185547_C(iblockstate)) ++ if (iblockstate.func_177230_c().getWeakChanges(this, blockpos)) { - iblockstate.func_177230_c().func_176204_a(this, blockpos, iblockstate, p_175666_2_); -+ other.onNeighborChange(this, posOther, p_175666_1_); ++ iblockstate.func_177230_c().onNeighborChange(this, blockpos, p_175666_1_); } } } -@@ -3528,4 +3724,81 @@ - int k = 128; +@@ -3600,6 +3781,87 @@ return i >= -k && i <= k && j >= -k && j <= k; } -+ + + /* ======================================== FORGE START =====================================*/ + /** + * Determine if the given block is considered solid on the @@ -889,7 +951,7 @@ + + Chunk chunk = func_175726_f(pos); + if (chunk == null || chunk.func_76621_g()) return _default; -+ return func_180495_p(pos).func_177230_c().isSideSolid(this, pos, side); ++ return func_180495_p(pos).isSideSolid(this, pos, side); + } + + /** @@ -902,6 +964,10 @@ + return net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this); + } + ++ public Iterator getPersistentChunkIterable(Iterator chunkIterator) ++ { ++ return net.minecraftforge.common.ForgeChunkManager.getPersistentChunksIterableFor(this, chunkIterator); ++ } + /** + * Readded as it was removed, very useful helper function + * @@ -935,4 +1001,7 @@ + { + return perWorldStorage; + } - } ++ + public void func_184135_a(Packet p_184135_1_) + { + throw new UnsupportedOperationException("Can\'t send packets to server unless you\'re on the client."); diff --git a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch b/patches/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch similarity index 74% rename from patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch rename to patches/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch index 6a68367cca..b8d9d1052a 100644 --- a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch @@ -1,25 +1,26 @@ ---- ../src-base/minecraft/net/minecraft/world/SpawnerAnimals.java -+++ ../src-work/minecraft/net/minecraft/world/SpawnerAnimals.java -@@ -69,14 +69,15 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldEntitySpawner.java ++++ ../src-work/minecraft/net/minecraft/world/WorldEntitySpawner.java +@@ -77,15 +77,17 @@ { if ((!enumcreaturetype.func_75599_d() || p_77192_3_) && (enumcreaturetype.func_75599_d() || p_77192_2_) && (!enumcreaturetype.func_82705_e() || p_77192_4_)) { -- int j4 = p_77192_1_.func_72907_a(enumcreaturetype.func_75598_a()); -+ int j4 = p_77192_1_.countEntities(enumcreaturetype, true); - int k4 = enumcreaturetype.func_75601_b() * i / field_180268_a; +- int k4 = p_77192_1_.func_72907_a(enumcreaturetype.func_75598_a()); ++ int k4 = p_77192_1_.countEntities(enumcreaturetype, true); + int l4 = enumcreaturetype.func_75601_b() * i / field_180268_a; - if (j4 <= k4) + if (k4 <= l4) { + java.util.ArrayList shuffled = com.google.common.collect.Lists.newArrayList(this.field_77193_b); + java.util.Collections.shuffle(shuffled); - label374: -- + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + label415: + - for (ChunkCoordIntPair chunkcoordintpair1 : this.field_77193_b) + for (ChunkCoordIntPair chunkcoordintpair1 : shuffled) { BlockPos blockpos = func_180621_a(p_77192_1_, chunkcoordintpair1.field_77276_a, chunkcoordintpair1.field_77275_b); int k1 = blockpos.func_177958_n(); -@@ -134,8 +135,10 @@ +@@ -144,8 +146,10 @@ entityliving.func_70012_b((double)f, (double)i3, (double)f1, p_77192_1_.field_73012_v.nextFloat() * 360.0F, 0.0F); @@ -31,21 +32,23 @@ ientitylivingdata = entityliving.func_180482_a(p_77192_1_.func_175649_E(new BlockPos(entityliving)), ientitylivingdata); if (entityliving.func_70058_J()) -@@ -144,7 +147,7 @@ - p_77192_1_.func_72838_d(entityliving); +@@ -158,7 +162,7 @@ + entityliving.func_70106_y(); } - if (j2 >= entityliving.func_70641_bl()) + if (i2 >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(entityliving)) { - continue label374; + continue label415; } -@@ -193,7 +196,7 @@ +@@ -211,8 +215,9 @@ + else { BlockPos blockpos = p_180267_2_.func_177977_b(); ++ IBlockState state = p_180267_1_.func_180495_p(blockpos); -- if (!World.func_175683_a(p_180267_1_, blockpos)) -+ if (!p_180267_1_.func_180495_p(blockpos).func_177230_c().canCreatureSpawn(p_180267_1_, blockpos, p_180267_0_)) +- if (!p_180267_1_.func_180495_p(blockpos).func_185896_q()) ++ if (!state.func_177230_c().canCreatureSpawn(state, p_180267_1_, blockpos, p_180267_0_)) { return false; } diff --git a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch index 1bfabc7e51..f67afd1b35 100644 --- a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/WorldProvider.java +++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java -@@ -51,26 +51,12 @@ +@@ -52,26 +52,12 @@ protected void func_76572_b() { @@ -9,34 +9,27 @@ - if (worldtype == WorldType.field_77138_c) - { - FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.func_82651_a(this.field_76579_a.func_72912_H().func_82571_y()); -- this.field_76578_c = new WorldChunkManagerHell(BiomeGenBase.func_180276_a(flatgeneratorinfo.func_82648_a(), BiomeGenBase.field_180279_ad), 0.5F); +- this.field_76578_c = new BiomeProviderSingle(BiomeGenBase.func_180276_a(flatgeneratorinfo.func_82648_a(), Biomes.field_180279_ad)); - } - else if (worldtype == WorldType.field_180272_g) - { -- this.field_76578_c = new WorldChunkManagerHell(BiomeGenBase.field_76772_c, 0.0F); +- this.field_76578_c = new BiomeProviderSingle(Biomes.field_76772_c); - } - else - { -- this.field_76578_c = new WorldChunkManager(this.field_76579_a); +- this.field_76578_c = new BiomeProvider(this.field_76579_a.func_72912_H()); - } -+ this.field_76578_c = field_76577_b.getChunkManager(field_76579_a); ++ this.field_76578_c = field_76577_b.getBiomeProvider(field_76579_a); } - public IChunkProvider func_76555_c() + public IChunkGenerator func_186060_c() { -- return (IChunkProvider)(this.field_76577_b == WorldType.field_77138_c ? new ChunkProviderFlat(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c) : (this.field_76577_b == WorldType.field_180272_g ? new ChunkProviderDebug(this.field_76579_a) : (this.field_76577_b == WorldType.field_180271_f ? new ChunkProviderGenerate(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c) : new ChunkProviderGenerate(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c)))); +- return (IChunkGenerator)(this.field_76577_b == WorldType.field_77138_c ? new ChunkProviderFlat(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c) : (this.field_76577_b == WorldType.field_180272_g ? new ChunkProviderDebug(this.field_76579_a) : (this.field_76577_b == WorldType.field_180271_f ? new ChunkProviderOverworld(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c) : new ChunkProviderOverworld(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c)))); + return field_76577_b.getChunkGenerator(field_76579_a, field_82913_c); } public boolean func_76566_a(int p_76566_1_, int p_76566_2_) -@@ -153,13 +139,13 @@ - - public static WorldProvider func_76570_a(int p_76570_0_) - { -- return (WorldProvider)(p_76570_0_ == -1 ? new WorldProviderHell() : (p_76570_0_ == 0 ? new WorldProviderSurface() : (p_76570_0_ == 1 ? new WorldProviderEnd() : null))); -+ return net.minecraftforge.common.DimensionManager.createProviderFor(p_76570_0_); - } - +@@ -156,7 +142,7 @@ @SideOnly(Side.CLIENT) public float func_76571_f() { @@ -45,7 +38,7 @@ } @SideOnly(Side.CLIENT) -@@ -175,13 +161,13 @@ +@@ -172,13 +158,13 @@ public int func_76557_i() { @@ -61,25 +54,30 @@ } @SideOnly(Side.CLIENT) -@@ -223,4 +209,319 @@ - { +@@ -212,6 +198,327 @@ return new WorldBorder(); } -+ + + /*======================================= Forge Start =========================================*/ + private net.minecraftforge.client.IRenderHandler skyRenderer = null; + private net.minecraftforge.client.IRenderHandler cloudRenderer = null; + private net.minecraftforge.client.IRenderHandler weatherRenderer = null; ++ private int dimensionId; + + /** + * Sets the providers current dimension ID, used in default getSaveFolder() + * Added to allow default providers to be registered for multiple dimensions. ++ * This is to denote the exact dimension ID opposed to the 'type' in WorldType + * + * @param dim Dimension ID + */ + public void setDimension(int dim) + { -+ this.field_76574_g = dim; ++ this.dimensionId = dim; ++ } ++ public int getDimension() ++ { ++ return this.dimensionId; + } + + /** @@ -89,7 +87,7 @@ + */ + public String getSaveFolder() + { -+ return (field_76574_g == 0 ? null : "DIM" + field_76574_g); ++ return (dimensionId == 0 ? null : "DIM" + dimensionId); + } + + /** @@ -184,7 +182,7 @@ + BlockPos ret = this.field_76579_a.func_175694_M(); + + boolean isAdventure = field_76579_a.func_72912_H().func_76077_q() == WorldSettings.GameType.ADVENTURE; -+ int spawnFuzz = field_76577_b.getSpawnFuzz(); ++ int spawnFuzz = this.field_76579_a instanceof WorldServer ? field_76577_b.getSpawnFuzz((WorldServer)this.field_76579_a, this.field_76579_a.func_73046_m()) : 1; + int border = MathHelper.func_76128_c(field_76579_a.func_175723_af().func_177729_b(ret.func_177958_n(), ret.func_177952_p())); + if (border < spawnFuzz) spawnFuzz = border; + if (spawnFuzz < 1) spawnFuzz = 1; @@ -208,7 +206,7 @@ + */ + public boolean shouldMapSpin(String entity, double x, double y, double z) + { -+ return field_76574_g < 0; ++ return dimensionId < 0; + } + + /** @@ -258,15 +256,15 @@ + } + + @SideOnly(Side.CLIENT) -+ public Vec3 getSkyColor(net.minecraft.entity.Entity cameraEntity, float partialTicks) ++ public Vec3d getSkyColor(net.minecraft.entity.Entity cameraEntity, float partialTicks) + { + return field_76579_a.getSkyColorBody(cameraEntity, partialTicks); + } + + @SideOnly(Side.CLIENT) -+ public Vec3 drawClouds(float partialTicks) ++ public Vec3d getCloudColor(float partialTicks) + { -+ return field_76579_a.drawCloudsBody(partialTicks); ++ return field_76579_a.getCloudColorBody(partialTicks); + } + + /** @@ -380,4 +378,7 @@ + { + return true; + } - } ++ + public void func_186061_a(EntityPlayerMP p_186061_1_) + { + } diff --git a/patches/minecraft/net/minecraft/world/WorldProviderSurface.java.patch b/patches/minecraft/net/minecraft/world/WorldProviderSurface.java.patch new file mode 100644 index 0000000000..97526ec7e0 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/WorldProviderSurface.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldProviderSurface.java ++++ ../src-work/minecraft/net/minecraft/world/WorldProviderSurface.java +@@ -9,6 +9,6 @@ + + public boolean func_186056_c(int p_186056_1_, int p_186056_2_) + { +- return !this.field_76579_a.func_72916_c(p_186056_1_, p_186056_2_); ++ return !this.field_76579_a.func_72916_c(p_186056_1_, p_186056_2_) || !net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.field_76579_a.field_73011_w.getDimension()); + } + } diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch index 08b38c2ab5..e18196b2ec 100644 --- a/patches/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServer.java.patch @@ -1,37 +1,30 @@ --- ../src-base/minecraft/net/minecraft/world/WorldServer.java +++ ../src-work/minecraft/net/minecraft/world/WorldServer.java -@@ -94,30 +94,46 @@ - private static final List field_73069_S = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.field_151055_y, 0, 1, 3, 10), new WeightedRandomChestContent(Item.func_150898_a(Blocks.field_150344_f), 0, 1, 3, 10), new WeightedRandomChestContent(Item.func_150898_a(Blocks.field_150364_r), 0, 1, 3, 10), new WeightedRandomChestContent(Items.field_151049_t, 0, 1, 1, 3), new WeightedRandomChestContent(Items.field_151053_p, 0, 1, 1, 5), new WeightedRandomChestContent(Items.field_151050_s, 0, 1, 1, 3), new WeightedRandomChestContent(Items.field_151039_o, 0, 1, 1, 5), new WeightedRandomChestContent(Items.field_151034_e, 0, 2, 3, 5), new WeightedRandomChestContent(Items.field_151025_P, 0, 2, 3, 3), new WeightedRandomChestContent(Item.func_150898_a(Blocks.field_150363_s), 0, 1, 3, 10)}); +@@ -97,30 +97,39 @@ + private int field_147489_T; private List field_94579_S = Lists.newArrayList(); + /** Stores the recently processed (lighting) chunks */ + protected Set doneChunks = new java.util.HashSet(); + public List customTeleporters = new ArrayList(); -+ private static boolean initChest = false; -+ public static void fillChestHook() -+ { -+ if (!initChest) -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.BONUS_CHEST, field_73069_S, 10, 10); -+ initChest = true; -+ } + public WorldServer(MinecraftServer p_i45921_1_, ISaveHandler p_i45921_2_, WorldInfo p_i45921_3_, int p_i45921_4_, Profiler p_i45921_5_) { - super(p_i45921_2_, p_i45921_3_, WorldProvider.func_76570_a(p_i45921_4_), p_i45921_5_, false); + super(p_i45921_2_, p_i45921_3_, DimensionType.func_186069_a(p_i45921_4_).func_186070_d(), p_i45921_5_, false); this.field_73061_a = p_i45921_1_; this.field_73062_L = new EntityTracker(this); this.field_73063_M = new PlayerManager(this); + // Guarantee the dimension ID was not reset by the provider -+ int providerDim = this.field_73011_w.field_76574_g; ++ int providerDim = this.field_73011_w.getDimension(); this.field_73011_w.func_76558_a(this); -+ this.field_73011_w.field_76574_g = providerDim; ++ this.field_73011_w.setDimension(providerDim); this.field_73020_y = this.func_72970_h(); + perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, p_i45921_2_)); this.field_85177_Q = new Teleporter(this); this.func_72966_v(); this.func_72947_a(); this.func_175723_af().func_177725_a(p_i45921_1_.func_175580_aG()); -+ net.minecraftforge.common.DimensionManager.setWorld(p_i45921_4_, this); ++ net.minecraftforge.common.DimensionManager.setWorld(p_i45921_4_, this, field_73061_a); } public World func_175643_b() @@ -49,7 +42,7 @@ } else { -@@ -210,6 +226,10 @@ +@@ -214,6 +223,10 @@ this.field_175740_d.func_75528_a(); this.field_72984_F.func_76318_c("portalForcer"); this.field_85177_Q.func_85189_a(this.func_82737_E()); @@ -60,7 +53,7 @@ this.field_72984_F.func_76319_b(); this.func_147488_Z(); } -@@ -217,12 +237,14 @@ +@@ -221,12 +234,14 @@ public BiomeGenBase.SpawnListEntry func_175734_a(EnumCreatureType p_175734_1_, BlockPos p_175734_2_) { List list = this.func_72863_F().func_177458_a(p_175734_1_, p_175734_2_); @@ -75,7 +68,7 @@ return list != null && !list.isEmpty() ? list.contains(p_175732_2_) : false; } -@@ -268,10 +290,7 @@ +@@ -272,10 +287,7 @@ private void func_73051_P() { @@ -87,16 +80,25 @@ } public boolean func_73056_e() -@@ -349,7 +367,7 @@ +@@ -368,7 +380,7 @@ + boolean flag1 = this.func_72911_I(); + this.field_72984_F.func_76320_a("pollingChunks"); + +- for (Iterator iterator = this.field_73063_M.func_187300_b(); iterator.hasNext(); this.field_72984_F.func_76319_b()) ++ for (Iterator iterator = getPersistentChunkIterable(this.field_73063_M.func_187300_b()); iterator.hasNext(); this.field_72984_F.func_76319_b()) + { + this.field_72984_F.func_76320_a("getChunk"); + Chunk chunk = (Chunk)iterator.next(); +@@ -380,7 +392,7 @@ chunk.func_150804_b(false); this.field_72984_F.func_76318_c("thunder"); -- if (this.field_73012_v.nextInt(100000) == 0 && this.func_72896_J() && this.func_72911_I()) -+ if (this.field_73011_w.canDoLightning(chunk) && this.field_73012_v.nextInt(100000) == 0 && this.func_72896_J() && this.func_72911_I()) +- if (flag && flag1 && this.field_73012_v.nextInt(100000) == 0) ++ if (this.field_73011_w.canDoLightning(chunk) && flag && flag1 && this.field_73012_v.nextInt(100000) == 0) { this.field_73005_l = this.field_73005_l * 3 + 1013904223; - int i1 = this.field_73005_l >> 2; -@@ -363,7 +381,7 @@ + int l = this.field_73005_l >> 2; +@@ -409,7 +421,7 @@ this.field_72984_F.func_76318_c("iceandsnow"); @@ -104,27 +106,27 @@ + if (this.field_73011_w.canDoRainSnowIce(chunk) && this.field_73012_v.nextInt(16) == 0) { this.field_73005_l = this.field_73005_l * 3 + 1013904223; - int k2 = this.field_73005_l >> 2; -@@ -456,6 +474,9 @@ + int j2 = this.field_73005_l >> 2; +@@ -527,6 +539,9 @@ if (p_175654_2_.func_149698_L()) { i = 8; + //Keeping here as a note for future when it may be restored. -+ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.field_180282_a.func_177958_n() >> 4, nextticklistentry.field_180282_a.func_177952_p() >> 4)); ++ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(p_175654_1_.func_177958_n() >> 4, p_175654_1_.func_177952_p() >> 4)); + i = isForced ? 0 : 8; - if (this.func_175707_a(nextticklistentry.field_180282_a.func_177982_a(-i, -i, -i), nextticklistentry.field_180282_a.func_177982_a(i, i, i))) + if (this.func_175707_a(p_175654_1_.func_177982_a(-i, -i, -i), p_175654_1_.func_177982_a(i, i, i))) { -@@ -508,7 +529,7 @@ +@@ -588,7 +603,7 @@ public void func_72939_s() { - if (this.field_73010_i.isEmpty()) + if (this.field_73010_i.isEmpty() && getPersistentChunks().isEmpty()) { - if (this.field_80004_Q++ >= 1200) + if (this.field_80004_Q++ >= 300) { -@@ -573,6 +594,9 @@ +@@ -712,6 +727,9 @@ { NextTickListEntry nextticklistentry1 = (NextTickListEntry)iterator.next(); iterator.remove(); @@ -134,7 +136,7 @@ int k = 0; if (this.func_175707_a(nextticklistentry1.field_180282_a.func_177982_a(-k, -k, -k), nextticklistentry1.field_180282_a.func_177982_a(k, k, k))) -@@ -696,22 +720,40 @@ +@@ -838,24 +856,42 @@ { List list = Lists.newArrayList(); @@ -175,47 +177,41 @@ public boolean func_175660_a(EntityPlayer p_175660_1_, BlockPos p_175660_2_) { +- return !this.field_73061_a.func_175579_a(this, p_175660_2_, p_175660_1_) && this.func_175723_af().func_177746_a(p_175660_2_); + return super.func_175660_a(p_175660_1_, p_175660_2_); -+ } -+ public boolean canMineBlockBody(EntityPlayer p_175660_1_, BlockPos p_175660_2_) -+ { - return !this.field_73061_a.func_175579_a(this, p_175660_2_, p_175660_1_) && this.func_175723_af().func_177746_a(p_175660_2_); } ++ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) ++ { ++ return !this.field_73061_a.func_175579_a(this, pos, player) && this.func_175723_af().func_177746_a(pos); ++ } -@@ -777,6 +819,7 @@ + public void func_72963_a(WorldSettings p_72963_1_) + { +@@ -919,6 +955,7 @@ } else { + if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; this.field_72987_B = true; - WorldChunkManager worldchunkmanager = this.field_73011_w.func_177499_m(); - List list = worldchunkmanager.func_76932_a(); -@@ -822,7 +865,7 @@ - - protected void func_73047_i() - { -- WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(field_73069_S, 10); -+ WorldGeneratorBonusChest worldgeneratorbonuschest = net.minecraftforge.common.ForgeHooks.getBonusChest(field_73012_v); - - for (int i = 0; i < 10; ++i) - { -@@ -859,6 +902,7 @@ + BiomeProvider biomeprovider = this.field_73011_w.func_177499_m(); + List list = biomeprovider.func_76932_a(); +@@ -1003,6 +1040,7 @@ } - this.field_73020_y.func_73151_a(p_73044_1_, p_73044_2_); + chunkproviderserver.func_186027_a(p_73044_1_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); - for (Chunk chunk : Lists.newArrayList(this.field_73059_b.func_152380_a())) + for (Chunk chunk : Lists.newArrayList(chunkproviderserver.func_152380_a())) { -@@ -892,6 +936,7 @@ +@@ -1047,6 +1085,7 @@ this.field_72986_A.func_176135_e(this.func_175723_af().func_177732_i()); - this.field_73019_z.func_75755_a(this.field_72986_A, this.field_73061_a.func_71203_ab().func_72378_q()); + this.field_73019_z.func_75755_a(this.field_72986_A, this.field_73061_a.func_184103_al().func_72378_q()); this.field_72988_C.func_75744_a(); + this.perWorldStorage.func_75744_a(); } - public void func_72923_a(Entity p_72923_1_) -@@ -947,6 +992,7 @@ + public boolean func_72838_d(Entity p_72838_1_) +@@ -1161,6 +1200,7 @@ public Explosion func_72885_a(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) { Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); @@ -223,8 +219,8 @@ explosion.func_77278_a(); explosion.func_77279_a(false); -@@ -1026,19 +1072,23 @@ - this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.func_177502_q()); +@@ -1240,19 +1280,23 @@ + this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.func_186058_p().func_186068_a()); } + /* The function in use here has been replaced in order to only send the weather info to players in the correct dimension, @@ -235,29 +231,29 @@ { if (flag) { -- this.field_73061_a.func_71203_ab().func_148540_a(new S2BPacketChangeGameState(2, 0.0F)); -+ this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(2, 0.0F), this.field_73011_w.field_76574_g); +- this.field_73061_a.func_184103_al().func_148540_a(new SPacketChangeGameState(2, 0.0F)); ++ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(2, 0.0F), this.field_73011_w.getDimension()); } else { -- this.field_73061_a.func_71203_ab().func_148540_a(new S2BPacketChangeGameState(1, 0.0F)); -+ this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(1, 0.0F), this.field_73011_w.field_76574_g); +- this.field_73061_a.func_184103_al().func_148540_a(new SPacketChangeGameState(1, 0.0F)); ++ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(1, 0.0F), this.field_73011_w.getDimension()); } -- this.field_73061_a.func_71203_ab().func_148540_a(new S2BPacketChangeGameState(7, this.field_73004_o)); -- this.field_73061_a.func_71203_ab().func_148540_a(new S2BPacketChangeGameState(8, this.field_73017_q)); -+ this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(7, this.field_73004_o), this.field_73011_w.field_76574_g); -+ this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.field_76574_g); +- this.field_73061_a.func_184103_al().func_148540_a(new SPacketChangeGameState(7, this.field_73004_o)); +- this.field_73061_a.func_184103_al().func_148540_a(new SPacketChangeGameState(8, this.field_73017_q)); ++ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(7, this.field_73004_o), this.field_73011_w.getDimension()); ++ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.getDimension()); } } -@@ -1104,6 +1154,11 @@ +@@ -1329,6 +1373,11 @@ return this.field_73061_a.func_152345_ab(); } + public java.io.File getChunkSaveLocation() + { -+ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)field_73059_b.field_73247_e).field_75825_d; ++ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)func_72863_F().field_73247_e).field_75825_d; + } + static class ServerBlockEventList extends ArrayList diff --git a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch index dc61a1c4df..915671b990 100644 --- a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch @@ -30,9 +30,9 @@ } public World func_175643_b() -@@ -58,12 +61,12 @@ - this.field_72988_C = this.field_175743_a.func_175693_T(); +@@ -59,12 +62,12 @@ this.field_96442_D = this.field_175743_a.func_96441_U(); + this.field_184151_B = this.field_175743_a.func_184146_ak(); String s = VillageCollection.func_176062_a(this.field_73011_w); - VillageCollection villagecollection = (VillageCollection)this.field_72988_C.func_75742_a(VillageCollection.class, s); + VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.func_75742_a(VillageCollection.class, s); @@ -45,11 +45,10 @@ } else { -@@ -73,4 +76,12 @@ - +@@ -75,6 +78,14 @@ return this; } -+ + + + @Override + public void func_73041_k() @@ -57,4 +56,7 @@ + super.func_73041_k(); + this.field_175743_a.func_175723_af().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak. + } - } ++ + public void func_184166_c() + { + this.field_73011_w.func_186057_q(); diff --git a/patches/minecraft/net/minecraft/world/WorldType.java.patch b/patches/minecraft/net/minecraft/world/WorldType.java.patch index 1f7e26efaa..55e06c22c2 100644 --- a/patches/minecraft/net/minecraft/world/WorldType.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldType.java.patch @@ -1,6 +1,16 @@ --- ../src-base/minecraft/net/minecraft/world/WorldType.java +++ ../src-work/minecraft/net/minecraft/world/WorldType.java -@@ -27,6 +27,7 @@ +@@ -1,5 +1,9 @@ + package net.minecraft.world; + ++import net.minecraft.world.chunk.IChunkGenerator; ++import net.minecraft.world.gen.ChunkProviderDebug; ++import net.minecraft.world.gen.ChunkProviderFlat; ++import net.minecraft.world.gen.ChunkProviderOverworld; + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +@@ -27,6 +31,7 @@ private WorldType(int p_i1960_1_, String p_i1960_2_, int p_i1960_3_) { @@ -8,33 +18,34 @@ this.field_77133_f = p_i1960_2_; this.field_77134_g = p_i1960_3_; this.field_77140_h = true; -@@ -113,4 +114,144 @@ +@@ -113,4 +118,145 @@ this.field_151361_l = true; return this; } + -+ public net.minecraft.world.biome.WorldChunkManager getChunkManager(World world) ++ public net.minecraft.world.biome.BiomeProvider getBiomeProvider(World world) + { + if (this == field_77138_c) + { + net.minecraft.world.gen.FlatGeneratorInfo flatgeneratorinfo = net.minecraft.world.gen.FlatGeneratorInfo.func_82651_a(world.func_72912_H().func_82571_y()); -+ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.func_180276_a(flatgeneratorinfo.func_82648_a(), net.minecraft.world.biome.BiomeGenBase.field_180279_ad), 0.5F); ++ return new net.minecraft.world.biome.BiomeProviderSingle(net.minecraft.world.biome.BiomeGenBase.func_180276_a(flatgeneratorinfo.func_82648_a(), net.minecraft.init.Biomes.field_180279_ad)); + } + else if (this == field_180272_g) + { -+ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.field_76772_c, 0.0F); ++ return new net.minecraft.world.biome.BiomeProviderSingle(net.minecraft.init.Biomes.field_76772_c); + } + else + { -+ return new net.minecraft.world.biome.WorldChunkManager(world); ++ return new net.minecraft.world.biome.BiomeProvider(world.func_72912_H()); + } + } + -+ public net.minecraft.world.chunk.IChunkProvider getChunkGenerator(World world, String generatorOptions) ++ public net.minecraft.world.chunk.IChunkGenerator getChunkGenerator(World world, String generatorOptions) + { + if (this == field_77138_c) return new net.minecraft.world.gen.ChunkProviderFlat(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions); + if (this == field_180272_g) return new net.minecraft.world.gen.ChunkProviderDebug(world); -+ return new net.minecraft.world.gen.ChunkProviderGenerate(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions); ++ if (this == field_180271_f) return new net.minecraft.world.gen.ChunkProviderOverworld(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions); ++ return new net.minecraft.world.gen.ChunkProviderOverworld(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions); + } + + public int getMinimumSpawnHeight(World world) @@ -93,9 +104,9 @@ + * Useful for void world types. + * @return Fuzz for entity initial spawn in blocks. + */ -+ public int getSpawnFuzz() ++ public int getSpawnFuzz(WorldServer world, net.minecraft.server.MinecraftServer server) + { -+ return Math.max(5, net.minecraft.server.MinecraftServer.func_71276_C().func_82357_ak() - 6); ++ return Math.max(0, server.func_184108_a(world)); + } + + /** diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch deleted file mode 100644 index 4c72cae179..0000000000 --- a/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeColorHelper.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeColorHelper.java -@@ -26,7 +26,7 @@ - { - public int func_180283_a(BiomeGenBase p_180283_1_, BlockPos p_180283_2_) - { -- return p_180283_1_.field_76759_H; -+ return p_180283_1_.getWaterColorMultiplier(); - } - }; - diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch index c18d05315e..584c76ae86 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch @@ -1,169 +1,167 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeDecorator.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeDecorator.java -@@ -105,8 +105,10 @@ +@@ -91,8 +91,10 @@ - protected void func_150513_a(BiomeGenBase p_150513_1_) + protected void func_150513_a(BiomeGenBase p_150513_1_, World p_150513_2_, Random p_150513_3_) { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(field_76815_a, field_76813_b, field_180294_c)); - this.func_76797_b(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(p_150513_2_, p_150513_3_, field_180294_c)); + this.func_76797_b(p_150513_2_, p_150513_3_); -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND)) for (int i = 0; i < this.field_76805_H; ++i) { - int j = this.field_76813_b.nextInt(16) + 8; -@@ -114,6 +116,7 @@ - this.field_76810_g.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_76815_a.func_175672_r(this.field_180294_c.func_177982_a(j, 0, k))); + int j = p_150513_3_.nextInt(16) + 8; +@@ -100,6 +102,7 @@ + this.field_76810_g.func_180709_b(p_150513_2_, p_150513_3_, p_150513_2_.func_175672_r(this.field_180294_c.func_177982_a(j, 0, k))); } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CLAY)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CLAY)) for (int i1 = 0; i1 < this.field_76806_I; ++i1) { - int l1 = this.field_76813_b.nextInt(16) + 8; -@@ -121,6 +124,7 @@ - this.field_76809_f.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_76815_a.func_175672_r(this.field_180294_c.func_177982_a(l1, 0, i6))); + int l1 = p_150513_3_.nextInt(16) + 8; +@@ -107,6 +110,7 @@ + this.field_76809_f.func_180709_b(p_150513_2_, p_150513_3_, p_150513_2_.func_175672_r(this.field_180294_c.func_177982_a(l1, 0, i6))); } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND_PASS2)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND_PASS2)) for (int j1 = 0; j1 < this.field_76801_G; ++j1) { - int i2 = this.field_76813_b.nextInt(16) + 8; -@@ -135,6 +139,7 @@ + int i2 = p_150513_3_.nextInt(16) + 8; +@@ -121,6 +125,7 @@ ++k1; } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE)) for (int j2 = 0; j2 < k1; ++j2) { - int k6 = this.field_76813_b.nextInt(16) + 8; -@@ -149,6 +154,7 @@ + int k6 = p_150513_3_.nextInt(16) + 8; +@@ -135,6 +140,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.BIG_SHROOM)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.BIG_SHROOM)) for (int k2 = 0; k2 < this.field_76807_J; ++k2) { - int l6 = this.field_76813_b.nextInt(16) + 8; -@@ -156,6 +162,7 @@ - this.field_76826_u.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(l6, 0, k10))); + int l6 = p_150513_3_.nextInt(16) + 8; +@@ -142,6 +148,7 @@ + this.field_76826_u.func_180709_b(p_150513_2_, p_150513_3_, p_150513_2_.func_175645_m(this.field_180294_c.func_177982_a(l6, 0, k10))); } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS)) for (int l2 = 0; l2 < this.field_76802_A; ++l2) { - int i7 = this.field_76813_b.nextInt(16) + 8; -@@ -177,6 +184,7 @@ + int i7 = p_150513_3_.nextInt(16) + 8; +@@ -163,6 +170,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) for (int i3 = 0; i3 < this.field_76803_B; ++i3) { - int j7 = this.field_76813_b.nextInt(16) + 8; -@@ -190,6 +198,7 @@ + int j7 = p_150513_3_.nextInt(16) + 8; +@@ -176,6 +184,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.DEAD_BUSH)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.DEAD_BUSH)) for (int j3 = 0; j3 < this.field_76804_C; ++j3) { - int k7 = this.field_76813_b.nextInt(16) + 8; -@@ -203,6 +212,7 @@ + int k7 = p_150513_3_.nextInt(16) + 8; +@@ -189,6 +198,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LILYPAD)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LILYPAD)) for (int k3 = 0; k3 < this.field_76833_y; ++k3) { - int l7 = this.field_76813_b.nextInt(16) + 8; -@@ -229,6 +239,8 @@ + int l7 = p_150513_3_.nextInt(16) + 8; +@@ -215,6 +225,8 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM)) + { for (int l3 = 0; l3 < this.field_76798_D; ++l3) { - if (this.field_76813_b.nextInt(4) == 0) -@@ -279,7 +291,9 @@ - this.field_76827_t.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(j4, l15, l8)); + if (p_150513_3_.nextInt(4) == 0) +@@ -265,7 +277,9 @@ + this.field_76827_t.func_180709_b(p_150513_2_, p_150513_3_, this.field_180294_c.func_177982_a(j4, l15, l8)); } } - + } // End of Mushroom generation -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.REED)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.REED)) + { for (int k4 = 0; k4 < this.field_76799_E; ++k4) { - int i9 = this.field_76813_b.nextInt(16) + 8; -@@ -305,7 +319,8 @@ - this.field_76825_v.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(j9, i19, i13)); + int i9 = p_150513_3_.nextInt(16) + 8; +@@ -291,7 +305,8 @@ + this.field_76825_v.func_180709_b(p_150513_2_, p_150513_3_, this.field_180294_c.func_177982_a(j9, i19, i13)); } } - + } // End of Reed generation -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.PUMPKIN)) - if (this.field_76813_b.nextInt(32) == 0) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.PUMPKIN)) + if (p_150513_3_.nextInt(32) == 0) { - int i5 = this.field_76813_b.nextInt(16) + 8; -@@ -319,6 +334,7 @@ + int i5 = p_150513_3_.nextInt(16) + 8; +@@ -305,6 +320,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CACTUS)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CACTUS)) for (int j5 = 0; j5 < this.field_76800_F; ++j5) { - int l9 = this.field_76813_b.nextInt(16) + 8; -@@ -334,6 +350,7 @@ + int l9 = p_150513_3_.nextInt(16) + 8; +@@ -320,6 +336,7 @@ if (this.field_76808_K) { -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_WATER)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_WATER)) for (int k5 = 0; k5 < 50; ++k5) { - int i10 = this.field_76813_b.nextInt(16) + 8; -@@ -348,6 +365,7 @@ + int i10 = p_150513_3_.nextInt(16) + 8; +@@ -334,6 +351,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_LAVA)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_LAVA)) for (int l5 = 0; l5 < 20; ++l5) { - int j10 = this.field_76813_b.nextInt(16) + 8; -@@ -357,6 +375,7 @@ - (new WorldGenLiquids(Blocks.field_150356_k)).func_180709_b(this.field_76815_a, this.field_76813_b, blockpos3); + int j10 = p_150513_3_.nextInt(16) + 8; +@@ -343,21 +361,35 @@ + (new WorldGenLiquids(Blocks.field_150356_k)).func_180709_b(p_150513_2_, p_150513_3_, blockpos3); } } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post(field_76815_a, field_76813_b, field_180294_c)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post(p_150513_2_, p_150513_3_, field_180294_c)); } - protected void func_76795_a(int p_76795_1_, WorldGenerator p_76795_2_, int p_76795_3_, int p_76795_4_) -@@ -397,16 +416,29 @@ - - protected void func_76797_b() + protected void func_76797_b(World p_76797_1_, Random p_76797_2_) { -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(field_76815_a, field_76813_b, field_180294_c)); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_76823_i, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIRT)) - this.func_76795_a(this.field_180293_d.field_177790_J, this.field_76823_i, this.field_180293_d.field_177791_K, this.field_180293_d.field_177784_L); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_76820_j, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRAVEL)) - this.func_76795_a(this.field_180293_d.field_177786_N, this.field_76820_j, this.field_180293_d.field_177787_O, this.field_180293_d.field_177797_P); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_180297_k, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIORITE)) - this.func_76795_a(this.field_180293_d.field_177795_V, this.field_180297_k, this.field_180293_d.field_177794_W, this.field_180293_d.field_177801_X); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_180296_j, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRANITE)) - this.func_76795_a(this.field_180293_d.field_177799_R, this.field_180296_j, this.field_180293_d.field_177798_S, this.field_180293_d.field_177793_T); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_180295_l, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.ANDESITE)) - this.func_76795_a(this.field_180293_d.field_177802_Z, this.field_180295_l, this.field_180293_d.field_177846_aa, this.field_180293_d.field_177847_ab); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_76821_k, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.COAL)) - this.func_76795_a(this.field_180293_d.field_177845_ad, this.field_76821_k, this.field_180293_d.field_177851_ae, this.field_180293_d.field_177853_af); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_76818_l, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.IRON)) - this.func_76795_a(this.field_180293_d.field_177849_ah, this.field_76818_l, this.field_180293_d.field_177832_ai, this.field_180293_d.field_177834_aj); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_76819_m, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GOLD)) - this.func_76795_a(this.field_180293_d.field_177830_al, this.field_76819_m, this.field_180293_d.field_177840_am, this.field_180293_d.field_177842_an); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_180299_p, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.REDSTONE)) - this.func_76795_a(this.field_180293_d.field_177838_ap, this.field_180299_p, this.field_180293_d.field_177818_aq, this.field_180293_d.field_177816_ar); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_180298_q, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIAMOND)) - this.func_76795_a(this.field_180293_d.field_177812_at, this.field_180298_q, this.field_180293_d.field_177826_au, this.field_180293_d.field_177824_av); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_76831_p, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.LAPIS)) - this.func_76793_b(this.field_180293_d.field_177820_ax, this.field_76831_p, this.field_180293_d.field_177807_ay, this.field_180293_d.field_177805_az); -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(field_76815_a, field_76813_b, field_180294_c)); ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(p_76797_1_, p_76797_2_, field_180294_c)); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_76823_i, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIRT)) + this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177790_J, this.field_76823_i, this.field_180293_d.field_177791_K, this.field_180293_d.field_177784_L); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_76820_j, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRAVEL)) + this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177786_N, this.field_76820_j, this.field_180293_d.field_177787_O, this.field_180293_d.field_177797_P); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_180297_k, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIORITE)) + this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177795_V, this.field_180297_k, this.field_180293_d.field_177794_W, this.field_180293_d.field_177801_X); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_180296_j, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRANITE)) + this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177799_R, this.field_180296_j, this.field_180293_d.field_177798_S, this.field_180293_d.field_177793_T); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_180295_l, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.ANDESITE)) + this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177802_Z, this.field_180295_l, this.field_180293_d.field_177846_aa, this.field_180293_d.field_177847_ab); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_76821_k, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.COAL)) + this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177845_ad, this.field_76821_k, this.field_180293_d.field_177851_ae, this.field_180293_d.field_177853_af); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_76818_l, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.IRON)) + this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177849_ah, this.field_76818_l, this.field_180293_d.field_177832_ai, this.field_180293_d.field_177834_aj); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_76819_m, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GOLD)) + this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177830_al, this.field_76819_m, this.field_180293_d.field_177840_am, this.field_180293_d.field_177842_an); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_180299_p, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.REDSTONE)) + this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177838_ap, this.field_180299_p, this.field_180293_d.field_177818_aq, this.field_180293_d.field_177816_ar); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_180298_q, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIAMOND)) + this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177812_at, this.field_180298_q, this.field_180293_d.field_177826_au, this.field_180293_d.field_177824_av); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_76831_p, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.LAPIS)) + this.func_76793_b(p_76797_1_, p_76797_2_, this.field_180293_d.field_177820_ax, this.field_76831_p, this.field_180293_d.field_177807_ay, this.field_180293_d.field_177805_az); ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(p_76797_1_, p_76797_2_, field_180294_c)); } - } + + protected void func_76795_a(World p_76795_1_, Random p_76795_2_, int p_76795_3_, WorldGenerator p_76795_4_, int p_76795_5_, int p_76795_6_) diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch index 032589894a..62e355ccee 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch @@ -1,25 +1,15 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenBase.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenBase.java -@@ -138,6 +138,10 @@ - - public BiomeGenBase(int p_i1971_1_) - { -+ this(p_i1971_1_, true); -+ } -+ public BiomeGenBase(int p_i1971_1_, boolean register) -+ { - this.field_76748_D = field_150596_a.field_150777_a; - this.field_76749_E = field_150596_a.field_150776_b; - this.field_76750_F = 0.5F; -@@ -152,6 +156,7 @@ - this.field_76758_O = new WorldGenBigTree(false); - this.field_76763_Q = new WorldGenSwamp(); - this.field_76756_M = p_i1971_1_; -+ if (register) - field_76773_a[p_i1971_1_] = this; - this.field_76760_I = this.func_76729_a(); - this.field_76762_K.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); -@@ -168,11 +173,12 @@ +@@ -70,7 +70,7 @@ + protected static final WorldGenTrees field_76757_N = new WorldGenTrees(false); + protected static final WorldGenBigTree field_76758_O = new WorldGenBigTree(false); + protected static final WorldGenSwamp field_76763_Q = new WorldGenSwamp(); +- public static final RegistryNamespaced field_185377_q = new RegistryNamespaced(); ++ public static final RegistryNamespaced field_185377_q = net.minecraftforge.fml.common.registry.GameData.getBiomeRegistry(); + private final String field_76791_y; + private final float field_76748_D; + private final float field_76749_E; +@@ -128,11 +128,12 @@ this.field_76761_J.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1)); this.field_76755_L.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); this.field_82914_M.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); @@ -32,8 +22,8 @@ + return getModdedBiomeDecorator(new BiomeDecorator()); } - public BiomeGenBase func_76732_a(float p_76732_1_, float p_76732_2_) -@@ -342,7 +348,7 @@ + public boolean func_185363_b() +@@ -228,7 +229,7 @@ { double d0 = (double)MathHelper.func_76131_a(this.func_180626_a(p_180627_1_), 0.0F, 1.0F); double d1 = (double)MathHelper.func_76131_a(this.func_76727_i(), 0.0F, 1.0F); @@ -41,8 +31,8 @@ + return getModdedBiomeGrassColor(ColorizerGrass.func_77480_a(d0, d1)); } - @SideOnly(Side.CLIENT) -@@ -350,7 +356,7 @@ + public final void func_180628_b(World p_180628_1_, Random p_180628_2_, ChunkPrimer p_180628_3_, int p_180628_4_, int p_180628_5_, double p_180628_6_) +@@ -321,7 +322,7 @@ { double d0 = (double)MathHelper.func_76131_a(this.func_180626_a(p_180625_1_), 0.0F, 1.0F); double d1 = (double)MathHelper.func_76131_a(this.func_76727_i(), 0.0F, 1.0F); @@ -50,9 +40,9 @@ + return getModdedBiomeFoliageColor(ColorizerFoliage.func_77470_a(d0, d1)); } - public boolean func_150559_j() -@@ -497,6 +503,84 @@ - } + public Class func_150562_l() +@@ -386,6 +387,83 @@ + return this.field_76766_R; } + /* ========================================= FORGE START ======================================*/ @@ -130,9 +120,8 @@ + world.func_180501_a(pos, flower.state, 3); + } + -+ + /* ========================================= FORGE END ======================================*/ + - static + public static void func_185358_q() { - field_76772_c.func_150566_k(); + func_185354_a(0, "ocean", new BiomeGenOcean((new BiomeGenBase.BiomeProperties("Ocean")).func_185398_c(-1.0F).func_185400_d(0.1F))); diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch index 95b4694190..24cfe16201 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch @@ -1,14 +1,13 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenForest.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenForest.java -@@ -201,4 +201,20 @@ - }; +@@ -147,6 +147,22 @@ } } -+ + + @Override + public void addDefaultFlowers() + { -+ if (field_150632_aF != 1) ++ if (field_150632_aF != BiomeGenForest.Type.FLOWER) + { + super.addDefaultFlowers(); + return; @@ -20,4 +19,7 @@ + addFlower(net.minecraft.init.Blocks.field_150328_O.func_176223_P().func_177226_a(net.minecraft.init.Blocks.field_150328_O.func_176494_l(), type), 10); + } + } - } ++ + public Class func_150562_l() + { + return BiomeGenForest.class; diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch index 129a16dfc2..7354b7b779 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenHills.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java -@@ -40,28 +40,20 @@ +@@ -37,28 +37,20 @@ public void func_180624_a(World p_180624_1_, Random p_180624_2_, BlockPos p_180624_3_) { super.func_180624_a(p_180624_1_, p_180624_2_, p_180624_3_); @@ -36,9 +36,9 @@ } public void func_180622_a(World p_180622_1_, Random p_180622_2_, ChunkPrimer p_180622_3_, int p_180622_4_, int p_180622_5_, double p_180622_6_) -@@ -97,4 +89,23 @@ - { - return (new BiomeGenHills(p_180277_1_, false)).func_150633_b(this); +@@ -86,4 +78,24 @@ + EXTRA_TREES, + MUTATED; } + + private static class EmeraldGenerator extends WorldGenerator @@ -51,7 +51,8 @@ + { + BlockPos blockpos = pos.func_177982_a(rand.nextInt(16), rand.nextInt(28) + 4, rand.nextInt(16)); + -+ if (worldIn.func_180495_p(blockpos).func_177230_c().isReplaceableOreGen(worldIn, blockpos, net.minecraft.block.state.pattern.BlockHelper.func_177642_a(Blocks.field_150348_b))) ++ net.minecraft.block.state.IBlockState state = worldIn.func_180495_p(blockpos); ++ if (state.func_177230_c().isReplaceableOreGen(state, worldIn, blockpos, net.minecraft.block.state.pattern.BlockMatcher.func_177642_a(Blocks.field_150348_b))) + { + worldIn.func_180501_a(blockpos, Blocks.field_150412_bA.func_176223_P(), 2); + } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch index 275d4491a9..a15220f7f6 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenPlains.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenPlains.java -@@ -103,4 +103,19 @@ - biomegenplains.field_150609_ah = 14273354; - return biomegenplains; +@@ -92,4 +92,19 @@ + + super.func_180624_a(p_180624_1_, p_180624_2_, p_180624_3_); } + + @Override diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch index 2df3583475..d3c19e2702 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java -@@ -84,4 +84,10 @@ +@@ -86,4 +86,10 @@ { return 6975545; } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch new file mode 100644 index 0000000000..f66ae2e413 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch @@ -0,0 +1,38 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeProvider.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeProvider.java +@@ -15,6 +15,7 @@ + + public class BiomeProvider + { ++ public static List allowedBiomes = Lists.newArrayList(Biomes.field_76767_f, Biomes.field_76772_c, Biomes.field_76768_g, Biomes.field_76784_u, Biomes.field_76785_t, Biomes.field_76782_w, Biomes.field_76792_x); + private GenLayer field_76944_d; + private GenLayer field_76945_e; + private final BiomeCache field_76942_f; +@@ -23,13 +24,14 @@ + protected BiomeProvider() + { + this.field_76942_f = new BiomeCache(this); +- this.field_76943_g = Lists.newArrayList(new BiomeGenBase[] {Biomes.field_76767_f, Biomes.field_76772_c, Biomes.field_76768_g, Biomes.field_76784_u, Biomes.field_76785_t, Biomes.field_76782_w, Biomes.field_76792_x}); ++ this.field_76943_g = Lists.newArrayList(allowedBiomes); + } + + private BiomeProvider(long p_i45744_1_, WorldType p_i45744_3_, String p_i45744_4_) + { + this(); + GenLayer[] agenlayer = GenLayer.func_180781_a(p_i45744_1_, p_i45744_3_, p_i45744_4_); ++ agenlayer = getModdedBiomeGenerators(p_i45744_3_, p_i45744_1_, agenlayer); + this.field_76944_d = agenlayer[0]; + this.field_76945_e = agenlayer[1]; + } +@@ -196,4 +198,11 @@ + { + this.field_76942_f.func_76838_a(); + } ++ ++ public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original) ++ { ++ net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens event = new net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens(worldType, seed, original); ++ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); ++ return event.newBiomeGens; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch b/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch deleted file mode 100644 index 5378a0e201..0000000000 --- a/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/WorldChunkManager.java -+++ ../src-work/minecraft/net/minecraft/world/biome/WorldChunkManager.java -@@ -16,6 +16,7 @@ - - public class WorldChunkManager - { -+ public static List allowedBiomes = Lists.newArrayList(BiomeGenBase.field_76767_f, BiomeGenBase.field_76772_c, BiomeGenBase.field_76768_g, BiomeGenBase.field_76784_u, BiomeGenBase.field_76785_t, BiomeGenBase.field_76782_w, BiomeGenBase.field_76792_x); - private GenLayer field_76944_d; - private GenLayer field_76945_e; - private BiomeCache field_76942_f; -@@ -27,13 +28,7 @@ - this.field_76942_f = new BiomeCache(this); - this.field_180301_f = ""; - this.field_76943_g = Lists.newArrayList(); -- this.field_76943_g.add(BiomeGenBase.field_76767_f); -- this.field_76943_g.add(BiomeGenBase.field_76772_c); -- this.field_76943_g.add(BiomeGenBase.field_76768_g); -- this.field_76943_g.add(BiomeGenBase.field_76784_u); -- this.field_76943_g.add(BiomeGenBase.field_76785_t); -- this.field_76943_g.add(BiomeGenBase.field_76782_w); -- this.field_76943_g.add(BiomeGenBase.field_76792_x); -+ this.field_76943_g.addAll(allowedBiomes); - } - - public WorldChunkManager(long p_i45744_1_, WorldType p_i45744_3_, String p_i45744_4_) -@@ -41,6 +36,7 @@ - this(); - this.field_180301_f = p_i45744_4_; - GenLayer[] agenlayer = GenLayer.func_180781_a(p_i45744_1_, p_i45744_3_, p_i45744_4_); -+ agenlayer = getModdedBiomeGenerators(p_i45744_3_, p_i45744_1_, agenlayer); - this.field_76944_d = agenlayer[0]; - this.field_76945_e = agenlayer[1]; - } -@@ -249,4 +245,11 @@ - { - this.field_76942_f.func_76838_a(); - } -+ -+ public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original) -+ { -+ net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens event = new net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens(worldType, seed, original); -+ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ return event.newBiomeGens; -+ } - } diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index 9f9c2fefc4..7db81e41cd 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -1,38 +1,38 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java +++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java -@@ -167,7 +167,7 @@ +@@ -175,7 +175,7 @@ { - Block block = this.func_150810_a(j, l - 1, k); + IBlockState iblockstate = this.func_186032_a(j, l - 1, k); -- if (block.func_149717_k() != 0) -+ if (func_150808_b(j, l - 1, k) != 0) +- if (iblockstate.func_185891_c() != 0) ++ if (iblockstate.getLightOpacity(this.field_76637_e, new BlockPos(j, l - 1, k)) != 0) { this.field_76634_f[k << 4 | j] = l; -@@ -440,12 +440,12 @@ +@@ -448,12 +448,12 @@ public int func_177437_b(BlockPos p_177437_1_) { -- return this.func_177428_a(p_177437_1_).func_149717_k(); -+ return this.func_177428_a(p_177437_1_).getLightOpacity(field_76637_e, p_177437_1_); +- return this.func_177435_g(p_177437_1_).func_185891_c(); ++ return this.func_177435_g(p_177437_1_).getLightOpacity(this.field_76637_e, p_177437_1_); } private int func_150808_b(int p_150808_1_, int p_150808_2_, int p_150808_3_) { -- return this.func_150810_a(p_150808_1_, p_150808_2_, p_150808_3_).func_149717_k(); -+ return func_177437_b(new BlockPos((field_76635_g << 4) + p_150808_1_, p_150808_2_, (field_76647_h << 4) + p_150808_3_)); +- return this.func_186032_a(p_150808_1_, p_150808_2_, p_150808_3_).func_185891_c(); ++ return this.func_186032_a(p_150808_1_, p_150808_2_, p_150808_3_).getLightOpacity(this.field_76637_e, new BlockPos(p_150808_1_, p_150808_2_, p_150808_3_)); } - private Block func_150810_a(int p_150810_1_, int p_150810_2_, int p_150810_3_) -@@ -607,6 +607,7 @@ + public IBlockState func_177435_g(BlockPos p_177435_1_) +@@ -534,6 +534,7 @@ { Block block = p_177436_2_.func_177230_c(); Block block1 = iblockstate.func_177230_c(); -+ int k1 = block1.getLightOpacity(this.field_76637_e, p_177436_1_); // Relocate old light value lookup here, so that it is called before TE is removed. ++ int k1 = iblockstate.getLightOpacity(this.field_76637_e, p_177436_1_); // Relocate old light value lookup here, so that it is called before TE is removed. ExtendedBlockStorage extendedblockstorage = this.field_76652_q[j >> 4]; boolean flag = false; -@@ -623,14 +624,19 @@ +@@ -550,14 +551,19 @@ extendedblockstorage.func_177484_a(i, j & 15, k, p_177436_2_); @@ -54,17 +54,17 @@ this.field_76637_e.func_175713_t(p_177436_1_); } } -@@ -647,8 +653,7 @@ +@@ -574,8 +580,7 @@ } else { -- int j1 = block.func_149717_k(); -- int k1 = block1.func_149717_k(); -+ int j1 = block.getLightOpacity(this.field_76637_e, p_177436_1_); +- int j1 = p_177436_2_.func_185891_c(); +- int k1 = iblockstate.func_185891_c(); ++ int j1 = p_177436_2_.getLightOpacity(this.field_76637_e, p_177436_1_); if (j1 > 0) { -@@ -668,28 +673,18 @@ +@@ -595,28 +600,18 @@ } } @@ -95,7 +95,7 @@ this.field_76637_e.func_175690_a(p_177436_1_, tileentity1); } -@@ -792,6 +787,7 @@ +@@ -719,6 +714,7 @@ k = this.field_76645_j.length - 1; } @@ -103,13 +103,12 @@ p_76612_1_.field_70175_ag = true; p_76612_1_.field_70176_ah = this.field_76635_g; p_76612_1_.field_70162_ai = k; -@@ -830,13 +826,20 @@ - private TileEntity func_177422_i(BlockPos p_177422_1_) +@@ -758,13 +754,19 @@ { - Block block = this.func_177428_a(p_177422_1_); -- return !block.func_149716_u() ? null : ((ITileEntityProvider)block).func_149915_a(this.field_76637_e, this.func_177418_c(p_177422_1_)); -+ IBlockState state = block.func_176203_a(this.func_177418_c(p_177422_1_)); -+ return !block.hasTileEntity(state) ? null : block.createTileEntity(this.field_76637_e, state); + IBlockState iblockstate = this.func_177435_g(p_177422_1_); + Block block = iblockstate.func_177230_c(); +- return !block.func_149716_u() ? null : ((ITileEntityProvider)block).func_149915_a(this.field_76637_e, iblockstate.func_177230_c().func_176201_c(iblockstate)); ++ return !block.hasTileEntity(iblockstate) ? null : block.createTileEntity(this.field_76637_e, iblockstate); } public TileEntity func_177424_a(BlockPos p_177424_1_, Chunk.EnumCreateEntityType p_177424_2_) @@ -125,7 +124,7 @@ if (tileentity == null) { if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) -@@ -846,14 +849,9 @@ +@@ -774,14 +776,9 @@ } else if (p_177424_2_ == Chunk.EnumCreateEntityType.QUEUED) { @@ -141,16 +140,16 @@ return tileentity; } -@@ -873,7 +871,7 @@ +@@ -801,7 +798,7 @@ p_177426_2_.func_145834_a(this.field_76637_e); p_177426_2_.func_174878_a(p_177426_1_); -- if (this.func_177428_a(p_177426_1_) instanceof ITileEntityProvider) -+ if (this.func_177428_a(p_177426_1_).hasTileEntity(func_177428_a(p_177426_1_).func_176203_a(this.func_177418_c(p_177426_1_)))) +- if (this.func_177435_g(p_177426_1_).func_177230_c() instanceof ITileEntityProvider) ++ if (this.func_177435_g(p_177426_1_).func_177230_c().hasTileEntity(this.func_177435_g(p_177426_1_))) { if (this.field_150816_i.containsKey(p_177426_1_)) { -@@ -882,6 +880,7 @@ +@@ -810,6 +807,7 @@ p_177426_2_.func_145829_t(); this.field_150816_i.put(p_177426_1_, p_177426_2_); @@ -158,7 +157,7 @@ } } -@@ -910,8 +909,9 @@ +@@ -838,8 +836,9 @@ entity.func_110123_P(); } @@ -169,7 +168,7 @@ } public void func_76623_d() -@@ -927,6 +927,7 @@ +@@ -855,6 +854,7 @@ { this.field_76637_e.func_175681_c(this.field_76645_j[i]); } @@ -177,7 +176,7 @@ } public void func_76630_e() -@@ -936,8 +937,8 @@ +@@ -864,8 +864,8 @@ public void func_177414_a(Entity p_177414_1_, AxisAlignedBB p_177414_2_, List p_177414_3_, Predicate p_177414_4_) { @@ -188,7 +187,7 @@ i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1); j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1); -@@ -976,8 +977,8 @@ +@@ -904,8 +904,8 @@ public void func_177430_a(Class p_177430_1_, AxisAlignedBB p_177430_2_, List p_177430_3_, Predicate p_177430_4_) { @@ -199,21 +198,26 @@ i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1); j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1); -@@ -1137,8 +1138,10 @@ - while (!this.field_177447_w.isEmpty()) +@@ -994,6 +994,7 @@ + { + this.func_150809_p(); + p_186034_1_.func_185931_b(this.field_76635_g, this.field_76647_h); ++ net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(this.field_76635_g, this.field_76647_h, this.field_76637_e, p_186034_1_, this.field_76637_e.func_72863_F()); + this.func_76630_e(); + } + } +@@ -1050,7 +1051,7 @@ { BlockPos blockpos = (BlockPos)this.field_177447_w.poll(); -+ Block block = this.func_177428_a(blockpos); -+ IBlockState state = block.func_176203_a(this.func_177418_c(blockpos)); -- if (this.func_177424_a(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.func_177428_a(blockpos).func_149716_u()) -+ if (this.func_177424_a(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && block.hasTileEntity(state)) +- if (this.func_177424_a(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.func_177435_g(blockpos).func_177230_c().func_149716_u()) ++ if (this.func_177424_a(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.func_177435_g(blockpos).func_177230_c().hasTileEntity(this.func_177435_g(blockpos))) { TileEntity tileentity = this.func_177422_i(blockpos); this.field_76637_e.func_175690_a(blockpos, tileentity); -@@ -1200,6 +1203,13 @@ +@@ -1114,6 +1115,13 @@ @SideOnly(Side.CLIENT) - public void func_177439_a(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_) + public void func_186033_a(PacketBuffer p_186033_1_, int p_186033_2_, boolean p_186033_3_) { + for(TileEntity tileEntity : field_150816_i.values()) + { @@ -222,10 +226,10 @@ + tileEntity.func_145838_q(); + } + - int i = 0; boolean flag = !this.field_76637_e.field_73011_w.func_177495_o(); -@@ -1267,10 +1277,16 @@ + for (int i = 0; i < this.field_76652_q.length; ++i) +@@ -1162,10 +1170,16 @@ this.field_76646_k = true; this.func_76590_a(); @@ -241,8 +245,33 @@ + for (TileEntity te : invalidList) te.func_145843_s(); } - public BiomeGenBase func_177411_a(BlockPos p_177411_1_, WorldChunkManager p_177411_2_) -@@ -1583,4 +1599,20 @@ + public BiomeGenBase func_177411_a(BlockPos p_177411_1_, BiomeProvider p_177411_2_) +@@ -1233,13 +1247,13 @@ + BlockPos blockpos1 = blockpos.func_177982_a(k, (j << 4) + i1, l); + boolean flag = i1 == 0 || i1 == 15 || k == 0 || k == 15 || l == 0 || l == 15; + +- if (this.field_76652_q[j] == field_186036_a && flag || this.field_76652_q[j] != field_186036_a && this.field_76652_q[j].func_177485_a(k, i1, l).func_185904_a() == Material.field_151579_a) ++ if (this.field_76652_q[j] == field_186036_a && flag || this.field_76652_q[j] != field_186036_a && this.field_76652_q[j].func_177485_a(k, i1, l).func_177230_c().isAir(this.field_76652_q[j].func_177485_a(k, i1, l), this.field_76637_e, blockpos1)) + { + for (EnumFacing enumfacing : EnumFacing.values()) + { + BlockPos blockpos2 = blockpos1.func_177972_a(enumfacing); + +- if (this.field_76637_e.func_180495_p(blockpos2).func_185906_d() > 0) ++ if (this.field_76637_e.func_180495_p(blockpos2).getLightValue(this.field_76637_e, blockpos2) > 0) + { + this.field_76637_e.func_175664_x(blockpos2); + } +@@ -1370,7 +1384,7 @@ + { + blockpos$mutableblockpos.func_181079_c(blockpos$mutableblockpos.func_177958_n(), l, blockpos$mutableblockpos.func_177952_p()); + +- if (this.func_177435_g(blockpos$mutableblockpos).func_185906_d() > 0) ++ if (this.func_177435_g(blockpos$mutableblockpos).getLightValue(this.field_76637_e, blockpos$mutableblockpos) > 0) + { + this.field_76637_e.func_175664_x(blockpos$mutableblockpos); + } +@@ -1481,4 +1495,20 @@ QUEUED, CHECK; } diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch index cd92eee576..50331158f2 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java -@@ -42,8 +42,41 @@ - this.field_75825_d = p_i2003_1_; +@@ -46,8 +46,41 @@ + this.field_186055_e = p_i46673_2_; } + public boolean chunkExists(World world, int x, int z) @@ -42,8 +42,8 @@ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_75815_2_, p_75815_3_); NBTTagCompound nbttagcompound = (NBTTagCompound)this.field_75828_a.get(chunkcoordintpair); -@@ -59,11 +92,17 @@ - nbttagcompound = CompressedStreamTools.func_74794_a(datainputstream); +@@ -63,11 +96,17 @@ + nbttagcompound = this.field_186055_e.func_188257_a(FixTypes.CHUNK, CompressedStreamTools.func_74794_a(datainputstream)); } - return this.func_75822_a(p_75815_1_, p_75815_2_, p_75815_3_, nbttagcompound); @@ -61,11 +61,11 @@ if (!p_75822_4_.func_150297_b("Level", 10)) { field_151505_a.error("Chunk file at " + p_75822_2_ + "," + p_75822_3_ + " is missing level data, skipping"); -@@ -87,10 +126,29 @@ +@@ -91,10 +130,29 @@ field_151505_a.error("Chunk file at " + p_75822_2_ + "," + p_75822_3_ + " is in the wrong location; relocating. (Expected " + p_75822_2_ + ", " + p_75822_3_ + ", got " + chunk.field_76635_g + ", " + chunk.field_76647_h + ")"); nbttagcompound.func_74768_a("xPos", p_75822_2_); nbttagcompound.func_74768_a("zPos", p_75822_3_); -+ ++ + // Have to move tile entities since we don't load them at this stage + NBTTagList _tileEntities = nbttagcompound.func_150295_c("TileEntities", 10); + @@ -92,43 +92,41 @@ } } } -@@ -105,6 +163,7 @@ - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); +@@ -110,6 +168,7 @@ nbttagcompound.func_74782_a("Level", nbttagcompound1); + nbttagcompound.func_74768_a("DataVersion", 169); this.func_75820_a(p_75816_2_, p_75816_1_, nbttagcompound1); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(p_75816_2_, nbttagcompound)); this.func_75824_a(p_75816_2_.func_76632_l(), nbttagcompound); } catch (Exception exception) -@@ -281,11 +340,20 @@ - { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); +@@ -265,8 +324,17 @@ -+ try -+ { - if (entity.func_70039_c(nbttagcompound1)) + if (entity.func_70039_c(nbttagcompound2)) { ++ try ++ { p_75820_1_.func_177409_g(true); - nbttaglist1.func_74742_a(nbttagcompound1); + nbttaglist1.func_74742_a(nbttagcompound2); ++ } ++ catch (Exception e) ++ { ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, ++ "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author", ++ entity.getClass().getName()); ++ } } -+ } -+ catch (Exception e) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, -+ "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author", -+ entity.getClass().getName()); -+ } } } +@@ -276,9 +344,18 @@ -@@ -295,8 +363,17 @@ for (TileEntity tileentity : p_75820_1_.func_177434_r().values()) { - NBTTagCompound nbttagcompound2 = new NBTTagCompound(); + try + { - tileentity.func_145841_b(nbttagcompound2); - nbttaglist2.func_74742_a(nbttagcompound2); + NBTTagCompound nbttagcompound3 = new NBTTagCompound(); + tileentity.func_145841_b(nbttagcompound3); + nbttaglist2.func_74742_a(nbttagcompound3); + } + catch (Exception e) + { @@ -139,7 +137,7 @@ } p_75820_3_.func_74782_a("TileEntities", nbttaglist2); -@@ -376,6 +453,12 @@ +@@ -347,6 +424,12 @@ chunk.func_76616_a(p_75823_2_.func_74770_j("Biomes")); } @@ -152,11 +150,12 @@ NBTTagList nbttaglist1 = p_75823_2_.func_150295_c("Entities", 10); if (nbttaglist1 != null) -@@ -447,7 +530,5 @@ +@@ -399,8 +482,6 @@ } } } - - return chunk; } - } + + public static Entity func_186050_a(NBTTagCompound p_186050_0_, World p_186050_1_, Chunk p_186050_2_) diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch index 9e563a70be..82936874a8 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java -@@ -20,18 +20,12 @@ +@@ -21,18 +21,12 @@ { File file1 = this.func_75765_b(); @@ -10,14 +10,14 @@ - File file3 = new File(file1, "DIM-1"); + File file3 = new File(file1, p_75763_1_.getSaveFolder()); file3.mkdirs(); - return new AnvilChunkLoader(file3); + return new AnvilChunkLoader(file3, this.field_186341_a); } - else if (p_75763_1_ instanceof WorldProviderEnd) - { - File file2 = new File(file1, "DIM1"); - file2.mkdirs(); -- return new AnvilChunkLoader(file2); +- return new AnvilChunkLoader(file2, this.field_186341_a); - } else { - return new AnvilChunkLoader(file1); + return new AnvilChunkLoader(file1, this.field_186341_a); diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch index 1992d6dad4..4f7ea64497 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/storage/RegionFile.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/RegionFile.java -@@ -101,6 +101,39 @@ +@@ -94,6 +94,39 @@ } } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch index f4cec46a70..370b21be01 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch @@ -1,67 +1,72 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java -@@ -32,6 +32,9 @@ - double[] field_73193_e; - double[] field_73190_f; - double[] field_73191_g; +@@ -39,6 +39,9 @@ + double[] field_185967_f; + double[] field_185968_g; + private final WorldGenEndIsland field_185975_r = new WorldGenEndIsland(); + // temporary variables used during event handling + private int chunkX = 0; + private int chunkZ = 0; - public ChunkProviderEnd(World p_i2007_1_, long p_i2007_2_) + public ChunkProviderEnd(World p_i46667_1_, boolean p_i46667_2_, long p_i46667_3_) { -@@ -42,6 +45,14 @@ - this.field_73199_l = new NoiseGeneratorOctaves(this.field_73204_i, 8); - this.field_73196_a = new NoiseGeneratorOctaves(this.field_73204_i, 10); - this.field_73194_b = new NoiseGeneratorOctaves(this.field_73204_i, 16); +@@ -51,6 +54,16 @@ + this.field_73214_a = new NoiseGeneratorOctaves(this.field_73220_k, 10); + this.field_73212_b = new NoiseGeneratorOctaves(this.field_73220_k, 16); + this.field_185973_o = new NoiseGeneratorSimplex(this.field_73220_k); + -+ NoiseGenerator[] noiseGens = {field_73201_j, field_73202_k, field_73199_l, field_73196_a, field_73194_b}; -+ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i2007_1_, this.field_73204_i, noiseGens); -+ this.field_73201_j = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.field_73202_k = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.field_73199_l = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.field_73196_a = (NoiseGeneratorOctaves)noiseGens[3]; -+ this.field_73194_b = (NoiseGeneratorOctaves)noiseGens[4]; ++ net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextEnd ctx = ++ new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextEnd(field_185969_i, field_185970_j, field_185971_k, field_73214_a, field_73212_b, field_185973_o); ++ ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i46667_1_, this.field_73220_k, ctx); ++ this.field_185969_i = ctx.getLPerlin1(); ++ this.field_185970_j = ctx.getLPerlin2(); ++ this.field_185971_k = ctx.getPerlin(); ++ this.field_73214_a = ctx.getDepth(); ++ this.field_73212_b = ctx.getScale(); ++ this.field_185973_o = ctx.getIsland(); } - public void func_180520_a(int p_180520_1_, int p_180520_2_, ChunkPrimer p_180520_3_) -@@ -114,6 +125,9 @@ + public void func_180518_a(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) +@@ -123,6 +136,7 @@ - public void func_180519_a(ChunkPrimer p_180519_1_) + public void func_185962_a(ChunkPrimer p_185962_1_) { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, p_180519_1_, this.field_73200_m); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; ++ if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, this.chunkX, this.chunkZ, p_185962_1_, this.field_73230_p)) return; for (int i = 0; i < 16; ++i) { for (int j = 0; j < 16; ++j) -@@ -165,6 +179,7 @@ +@@ -174,6 +188,7 @@ - public Chunk func_73154_d(int p_73154_1_, int p_73154_2_) + public Chunk func_185932_a(int p_185932_1_, int p_185932_2_) { -+ chunkX = p_73154_1_; chunkZ = p_73154_2_; - this.field_73204_i.setSeed((long)p_73154_1_ * 341873128712L + (long)p_73154_2_ * 132897987541L); ++ this.chunkX = p_185932_1_; this.chunkZ = p_185932_2_; + this.field_73220_k.setSeed((long)p_185932_1_ * 341873128712L + (long)p_185932_2_ * 132897987541L); ChunkPrimer chunkprimer = new ChunkPrimer(); - this.field_73198_o = this.field_73200_m.func_72959_q().func_76933_b(this.field_73198_o, p_73154_1_ * 16, p_73154_2_ * 16, 16, 16); -@@ -184,6 +199,10 @@ + this.field_73231_z = this.field_73230_p.func_72959_q().func_76933_b(this.field_73231_z, p_185932_1_ * 16, p_185932_2_ * 16, 16, 16); +@@ -255,6 +270,10 @@ - private double[] func_73187_a(double[] p_73187_1_, int p_73187_2_, int p_73187_3_, int p_73187_4_, int p_73187_5_, int p_73187_6_, int p_73187_7_) + private double[] func_185963_a(double[] p_185963_1_, int p_185963_2_, int p_185963_3_, int p_185963_4_, int p_185963_5_, int p_185963_6_, int p_185963_7_) { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField(this, p_73187_1_, p_73187_2_, p_73187_3_, p_73187_4_, p_73187_5_, p_73187_6_, p_73187_7_); ++ net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField(this, p_185963_1_, p_185963_2_, p_185963_3_, p_185963_4_, p_185963_5_, p_185963_6_, p_185963_7_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; + - if (p_73187_1_ == null) + if (p_185963_1_ == null) { - p_73187_1_ = new double[p_73187_5_ * p_73187_6_ * p_73187_7_]; -@@ -273,8 +292,10 @@ - public void func_73153_a(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + p_185963_1_ = new double[p_185963_5_ * p_185963_6_ * p_185963_7_]; +@@ -327,6 +346,7 @@ + public void func_185931_b(int p_185931_1_, int p_185931_2_) { BlockFalling.field_149832_M = true; -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, field_73200_m, field_73200_m.field_73012_v, p_73153_2_, p_73153_3_, false)); - BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); - this.field_73200_m.func_180494_b(blockpos.func_177982_a(16, 0, 16)).func_180624_a(this.field_73200_m, this.field_73200_m.field_73012_v, blockpos); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, field_73200_m, field_73200_m.field_73012_v, p_73153_2_, p_73153_3_, false)); ++ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.field_73230_p, p_185931_1_, p_185931_2_, false); + BlockPos blockpos = new BlockPos(p_185931_1_ * 16, 0, p_185931_2_ * 16); + + if (this.field_73229_q) +@@ -374,6 +394,7 @@ + } + } + ++ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.field_73230_p, p_185931_1_, p_185931_2_, false); BlockFalling.field_149832_M = false; } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch deleted file mode 100644 index d8d3ed7df8..0000000000 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch +++ /dev/null @@ -1,110 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java -@@ -58,6 +58,15 @@ - - public ChunkProviderGenerate(World p_i45636_1_, long p_i45636_2_, boolean p_i45636_4_, String p_i45636_5_) - { -+ { -+ field_73226_t = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_73226_t, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE); -+ field_73225_u = (MapGenStronghold)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_73225_u, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD); -+ field_73224_v = (MapGenVillage)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_73224_v, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE); -+ field_73223_w = (MapGenMineshaft)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_73223_w, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT); -+ field_73233_x = (MapGenScatteredFeature)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_73233_x, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE); -+ field_73232_y = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_73232_y, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE); -+ field_177474_A = (StructureOceanMonument)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_177474_A, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.OCEAN_MONUMENT); -+ } - this.field_73230_p = p_i45636_1_; - this.field_73229_q = p_i45636_4_; - this.field_177475_o = p_i45636_1_.func_72912_H().func_76067_t(); -@@ -87,6 +96,16 @@ - this.field_177476_s = this.field_177477_r.field_177778_E ? Blocks.field_150353_l : Blocks.field_150355_j; - p_i45636_1_.func_181544_b(this.field_177477_r.field_177841_q); - } -+ -+ NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, field_73214_a, field_73212_b, field_73213_c}; -+ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i45636_1_, this.field_73220_k, noiseGens); -+ this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.field_147430_m = (NoiseGeneratorPerlin)noiseGens[3]; -+ this.field_73214_a = (NoiseGeneratorOctaves)noiseGens[4]; -+ this.field_73212_b = (NoiseGeneratorOctaves)noiseGens[5]; -+ this.field_73213_c = (NoiseGeneratorOctaves)noiseGens[6]; - } - - public void func_180518_a(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) -@@ -160,6 +179,10 @@ - - public void func_180517_a(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) - { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.field_73230_p); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; -+ - double d0 = 0.03125D; - this.field_73227_s = this.field_147430_m.func_151599_a(this.field_73227_s, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); - -@@ -366,6 +389,8 @@ - boolean flag = false; - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag)); -+ - if (this.field_177477_r.field_177829_w && this.field_73229_q) - { - this.field_73223_w.func_175794_a(this.field_73230_p, this.field_73220_k, chunkcoordintpair); -@@ -391,7 +416,8 @@ - this.field_177474_A.func_175794_a(this.field_73230_p, this.field_73220_k, chunkcoordintpair); - } - -- if (biomegenbase != BiomeGenBase.field_76769_d && biomegenbase != BiomeGenBase.field_76786_s && this.field_177477_r.field_177781_A && !flag && this.field_73220_k.nextInt(this.field_177477_r.field_177782_B) == 0) -+ if (biomegenbase != BiomeGenBase.field_76769_d && biomegenbase != BiomeGenBase.field_76786_s && this.field_177477_r.field_177781_A && !flag && this.field_73220_k.nextInt(this.field_177477_r.field_177782_B) == 0 -+ && net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) - { - int i1 = this.field_73220_k.nextInt(16) + 8; - int j1 = this.field_73220_k.nextInt(256); -@@ -399,7 +425,8 @@ - (new WorldGenLakes(Blocks.field_150355_j)).func_180709_b(this.field_73230_p, this.field_73220_k, blockpos.func_177982_a(i1, j1, k1)); - } - -- if (!flag && this.field_73220_k.nextInt(this.field_177477_r.field_177777_D / 10) == 0 && this.field_177477_r.field_177783_C) -+ if (!flag && this.field_73220_k.nextInt(this.field_177477_r.field_177777_D / 10) == 0 && this.field_177477_r.field_177783_C && -+ net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA)) - { - int i2 = this.field_73220_k.nextInt(16) + 8; - int l2 = this.field_73220_k.nextInt(this.field_73220_k.nextInt(248) + 8); -@@ -413,7 +440,8 @@ - - if (this.field_177477_r.field_177837_s) - { -- for (int j2 = 0; j2 < this.field_177477_r.field_177835_t; ++j2) -+ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON); -+ for (int j2 = 0; doGen && j2 < this.field_177477_r.field_177835_t; ++j2) - { - int i3 = this.field_73220_k.nextInt(16) + 8; - int l3 = this.field_73220_k.nextInt(256); -@@ -423,10 +451,14 @@ - } - - biomegenbase.func_180624_a(this.field_73230_p, this.field_73220_k, new BlockPos(i, 0, j)); -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS)) -+ { - SpawnerAnimals.func_77191_a(this.field_73230_p, biomegenbase, i + 8, j + 8, 16, 16, this.field_73220_k); -+ } - blockpos = blockpos.func_177982_a(8, 0, 8); - -- for (int k2 = 0; k2 < 16; ++k2) -+ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE); -+ for (int k2 = 0; doGen && k2 < 16; ++k2) - { - for (int j3 = 0; j3 < 16; ++j3) - { -@@ -445,6 +477,8 @@ - } - } - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag)); -+ - BlockFalling.field_149832_M = false; - } - diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch index 216df82678..f54b2aa4a0 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch @@ -1,141 +1,104 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderHell.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderHell.java -@@ -49,8 +49,8 @@ - private final WorldGenHellLava field_177472_y = new WorldGenHellLava(Blocks.field_150356_k, false); - private final GeneratorBushFeature field_177471_z = new GeneratorBushFeature(Blocks.field_150338_P); - private final GeneratorBushFeature field_177465_A = new GeneratorBushFeature(Blocks.field_150337_Q); -- private final MapGenNetherBridge field_73172_c = new MapGenNetherBridge(); -- private final MapGenBase field_73182_t = new MapGenCavesHell(); -+ private final MapGenNetherBridge field_73172_c; -+ private final MapGenBase field_73182_t; - double[] field_73169_d; - double[] field_73170_e; - double[] field_73167_f; -@@ -59,16 +59,29 @@ - - public ChunkProviderHell(World p_i45637_1_, boolean p_i45637_2_, long p_i45637_3_) - { -+ this.field_73172_c = (MapGenNetherBridge) net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(new MapGenNetherBridge(), net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_BRIDGE); -+ this.field_73182_t = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(new MapGenCavesHell(), net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_CAVE); - this.field_73175_o = p_i45637_1_; - this.field_177466_i = p_i45637_2_; - this.field_73181_i = new Random(p_i45637_3_); -- this.field_73178_j = new NoiseGeneratorOctaves(this.field_73181_i, 16); -- this.field_73179_k = new NoiseGeneratorOctaves(this.field_73181_i, 16); -- this.field_73176_l = new NoiseGeneratorOctaves(this.field_73181_i, 8); -- this.field_73177_m = new NoiseGeneratorOctaves(this.field_73181_i, 4); -- this.field_73174_n = new NoiseGeneratorOctaves(this.field_73181_i, 4); -- this.field_73173_a = new NoiseGeneratorOctaves(this.field_73181_i, 10); -- this.field_73171_b = new NoiseGeneratorOctaves(this.field_73181_i, 16); -+ NoiseGeneratorOctaves netherNoiseGen1 = new NoiseGeneratorOctaves(this.field_73181_i, 16); -+ NoiseGeneratorOctaves netherNoiseGen2 = new NoiseGeneratorOctaves(this.field_73181_i, 16); -+ NoiseGeneratorOctaves netherNoiseGen3 = new NoiseGeneratorOctaves(this.field_73181_i, 8); -+ NoiseGeneratorOctaves slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.field_73181_i, 4); -+ NoiseGeneratorOctaves netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.field_73181_i, 4); -+ NoiseGeneratorOctaves netherNoiseGen6 = new NoiseGeneratorOctaves(this.field_73181_i, 10); -+ NoiseGeneratorOctaves netherNoiseGen7 = new NoiseGeneratorOctaves(this.field_73181_i, 16); -+ NoiseGenerator[] noiseGens = new NoiseGenerator[] { -+ netherNoiseGen1, netherNoiseGen2, netherNoiseGen3, slowsandGravelNoiseGen, netherrackExculsivityNoiseGen, netherNoiseGen6, netherNoiseGen7 -+ }; -+ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i45637_1_, this.field_73181_i, noiseGens); -+ this.field_73178_j = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.field_73179_k = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.field_73176_l = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.field_73177_m = (NoiseGeneratorOctaves)noiseGens[3]; -+ this.field_73174_n = (NoiseGeneratorOctaves)noiseGens[4]; -+ this.field_73173_a = (NoiseGeneratorOctaves)noiseGens[5]; -+ this.field_73171_b = (NoiseGeneratorOctaves)noiseGens[6]; +@@ -76,6 +76,19 @@ + this.field_185946_g = new NoiseGeneratorOctaves(this.field_185954_p, 10); + this.field_185947_h = new NoiseGeneratorOctaves(this.field_185954_p, 16); p_i45637_1_.func_181544_b(63); ++ ++ net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextHell ctx = ++ new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextHell(field_185957_u, field_185958_v, field_185959_w, field_73177_m, field_73174_n, field_185946_g, field_185947_h); ++ ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i45637_1_, this.field_185954_p, ctx); ++ this.field_185957_u = ctx.getLPerlin1(); ++ this.field_185958_v = ctx.getLPerlin2(); ++ this.field_185959_w = ctx.getPerlin(); ++ this.field_73177_m = ctx.getPerlin2(); ++ this.field_73174_n = ctx.getPerlin3(); ++ this.field_185946_g = ctx.getScale(); ++ this.field_185947_h = ctx.getDepth(); ++ this.field_73172_c = (MapGenNetherBridge)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_73172_c, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_BRIDGE); ++ this.field_185939_I = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_185939_I, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_CAVE); } -@@ -148,6 +161,10 @@ + public void func_185936_a(int p_185936_1_, int p_185936_2_, ChunkPrimer p_185936_3_) +@@ -154,6 +167,7 @@ - public void func_180516_b(int p_180516_1_, int p_180516_2_, ChunkPrimer p_180516_3_) + public void func_185937_b(int p_185937_1_, int p_185937_2_, ChunkPrimer p_185937_3_) { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180516_1_, p_180516_2_, p_180516_3_, this.field_73175_o); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; -+ - int i = this.field_73175_o.func_181545_F() + 1; ++ if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, p_185937_1_, p_185937_2_, p_185937_3_, this.field_185952_n)) return; + int i = this.field_185952_n.func_181545_F() + 1; double d0 = 0.03125D; - this.field_73185_q = this.field_73177_m.func_76304_a(this.field_73185_q, p_180516_1_ * 16, p_180516_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); -@@ -265,6 +282,10 @@ + this.field_73185_q = this.field_73177_m.func_76304_a(this.field_73185_q, p_185937_1_ * 16, p_185937_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); +@@ -276,6 +290,10 @@ + p_185938_1_ = new double[p_185938_5_ * p_185938_6_ * p_185938_7_]; + } - private double[] func_73164_a(double[] p_73164_1_, int p_73164_2_, int p_73164_3_, int p_73164_4_, int p_73164_5_, int p_73164_6_, int p_73164_7_) - { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField(this, p_73164_1_, p_73164_2_, p_73164_3_, p_73164_4_, p_73164_5_, p_73164_6_, p_73164_7_); ++ net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField(this, p_185938_1_, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, p_185938_6_, p_185938_7_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; + - if (p_73164_1_ == null) - { - p_73164_1_ = new double[p_73164_5_ * p_73164_6_ * p_73164_7_]; -@@ -356,50 +377,60 @@ - public void func_73153_a(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + double d0 = 684.412D; + double d1 = 2053.236D; + this.field_73168_g = this.field_185946_g.func_76304_a(this.field_73168_g, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, 1, p_185938_7_, 1.0D, 0.0D, 1.0D); +@@ -357,20 +375,25 @@ + public void func_185931_b(int p_185931_1_, int p_185931_2_) { BlockFalling.field_149832_M = true; -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false)); - BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); - this.field_73172_c.func_175794_a(this.field_73175_o, this.field_73181_i, chunkcoordintpair); ++ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.field_185952_n, p_185931_1_, p_185931_2_, false); + BlockPos blockpos = new BlockPos(p_185931_1_ * 16, 0, p_185931_2_ * 16); + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_185931_1_, p_185931_2_); + this.field_73172_c.func_175794_a(this.field_185952_n, this.field_185954_p, chunkcoordintpair); -- for (int i = 0; i < 8; ++i) -+ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA); -+ for (int i = 0; doGen && i < 8; ++i) ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA)) + for (int i = 0; i < 8; ++i) { - this.field_177472_y.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(120) + 4, this.field_73181_i.nextInt(16) + 8)); + this.field_177472_y.func_180709_b(this.field_185952_n, this.field_185954_p, blockpos.func_177982_a(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(120) + 4, this.field_185954_p.nextInt(16) + 8)); } -- for (int j = 0; j < this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1) + 1; ++j) -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.FIRE); -+ for (int j = 0; doGen && j < this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1) + 1; ++j) ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.FIRE)) + for (int j = 0; j < this.field_185954_p.nextInt(this.field_185954_p.nextInt(10) + 1) + 1; ++j) { - this.field_177470_t.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(120) + 4, this.field_73181_i.nextInt(16) + 8)); + this.field_177470_t.func_180709_b(this.field_185952_n, this.field_185954_p, blockpos.func_177982_a(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(120) + 4, this.field_185954_p.nextInt(16) + 8)); } -- for (int k = 0; k < this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1); ++k) -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.GLOWSTONE); -+ for (int k = 0; doGen && k < this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1); ++k) ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.GLOWSTONE)) ++ { + for (int k = 0; k < this.field_185954_p.nextInt(this.field_185954_p.nextInt(10) + 1); ++k) { - this.field_177469_u.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(120) + 4, this.field_73181_i.nextInt(16) + 8)); - } - -- for (int l = 0; l < 10; ++l) -+ for (int l = 0; doGen && l < 10; ++l) + this.field_177469_u.func_180709_b(this.field_185952_n, this.field_185954_p, blockpos.func_177982_a(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(120) + 4, this.field_185954_p.nextInt(16) + 8)); +@@ -380,7 +403,13 @@ { - this.field_177468_v.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(128), this.field_73181_i.nextInt(16) + 8)); + this.field_177468_v.func_180709_b(this.field_185952_n, this.field_185954_p, blockpos.func_177982_a(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(128), this.field_185954_p.nextInt(16) + 8)); } ++ }//Forge: End doGLowstone -- if (this.field_73181_i.nextBoolean()) -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(field_73175_o, field_73181_i, blockpos)); ++ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.field_185952_n, p_185931_1_, p_185931_2_, false); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(this.field_185952_n, this.field_185954_p, blockpos)); + -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.decorate(field_73175_o, field_73181_i, blockpos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM); -+ if (doGen && this.field_73181_i.nextBoolean()) ++ if (net.minecraftforge.event.terraingen.TerrainGen.decorate(this.field_185952_n, this.field_185954_p, blockpos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM)) ++ { + if (this.field_185954_p.nextBoolean()) { - this.field_177471_z.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(128), this.field_73181_i.nextInt(16) + 8)); + this.field_177471_z.func_180709_b(this.field_185952_n, this.field_185954_p, blockpos.func_177982_a(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(128), this.field_185954_p.nextInt(16) + 8)); +@@ -390,17 +419,22 @@ + { + this.field_177465_A.func_180709_b(this.field_185952_n, this.field_185954_p, blockpos.func_177982_a(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(128), this.field_185954_p.nextInt(16) + 8)); + } ++ } + ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(this.field_185952_n, this.field_185954_p, field_177467_w, blockpos, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.QUARTZ)) + for (int i1 = 0; i1 < 16; ++i1) + { + this.field_177467_w.func_180709_b(this.field_185952_n, this.field_185954_p, blockpos.func_177982_a(this.field_185954_p.nextInt(16), this.field_185954_p.nextInt(108) + 10, this.field_185954_p.nextInt(16))); } -- if (this.field_73181_i.nextBoolean()) -+ if (doGen && this.field_73181_i.nextBoolean()) ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA2)) + for (int j1 = 0; j1 < 16; ++j1) { - this.field_177465_A.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(128), this.field_73181_i.nextInt(16) + 8)); + this.field_177473_x.func_180709_b(this.field_185952_n, this.field_185954_p, blockpos.func_177982_a(this.field_185954_p.nextInt(16), this.field_185954_p.nextInt(108) + 10, this.field_185954_p.nextInt(16))); } -- for (int i1 = 0; i1 < 16; ++i1) -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_73175_o, field_73181_i, field_177467_w, blockpos, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.QUARTZ); -+ for (int i1 = 0; doGen && i1 < 16; ++i1) - { - this.field_177467_w.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16), this.field_73181_i.nextInt(108) + 10, this.field_73181_i.nextInt(16))); - } - -- for (int j1 = 0; j1 < 16; ++j1) -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA2); -+ for (int j1 = 0; doGen && j1 < 16; ++j1) - { - this.field_177473_x.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16), this.field_73181_i.nextInt(108) + 10, this.field_73181_i.nextInt(16))); - } - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post(this.field_185952_n, this.field_185954_p, blockpos)); ++ BlockFalling.field_149832_M = false; } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java.patch new file mode 100644 index 0000000000..61da97cbd0 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java.patch @@ -0,0 +1,101 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java ++++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java +@@ -59,6 +59,15 @@ + + public ChunkProviderOverworld(World p_i46668_1_, long p_i46668_2_, boolean p_i46668_4_, String p_i46668_5_) + { ++ { ++ field_186003_v = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186003_v, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE); ++ field_186004_w = (MapGenStronghold)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186004_w, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD); ++ field_186005_x = (MapGenVillage)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186005_x, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE); ++ field_186006_y = (MapGenMineshaft)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186006_y, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT); ++ field_186007_z = (MapGenScatteredFeature)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186007_z, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE); ++ field_185979_A = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_185979_A, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE); ++ field_185980_B = (StructureOceanMonument)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_185980_B, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.OCEAN_MONUMENT); ++ } + this.field_185995_n = p_i46668_1_; + this.field_185996_o = p_i46668_4_; + this.field_185997_p = p_i46668_1_.func_72912_H().func_76067_t(); +@@ -88,6 +97,17 @@ + this.field_186001_t = this.field_186000_s.field_177778_E ? Blocks.field_150353_l.func_176223_P() : Blocks.field_150355_j.func_176223_P(); + p_i46668_1_.func_181544_b(this.field_186000_s.field_177841_q); + } ++ ++ net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextOverworld ctx = ++ new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextOverworld(field_185991_j, field_185992_k, field_185993_l, field_185994_m, field_185983_b, field_185984_c, field_185985_d); ++ ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i46668_1_, this.field_185990_i, ctx); ++ this.field_185991_j = ctx.getLPerlin1(); ++ this.field_185992_k = ctx.getLPerlin2(); ++ this.field_185993_l = ctx.getPerlin(); ++ this.field_185994_m = ctx.getHeight(); ++ this.field_185983_b = ctx.getScale(); ++ this.field_185984_c = ctx.getDepth(); ++ this.field_185985_d = ctx.getForest(); + } + + public void func_185976_a(int p_185976_1_, int p_185976_2_, ChunkPrimer p_185976_3_) +@@ -161,6 +181,7 @@ + + public void func_185977_a(int p_185977_1_, int p_185977_2_, ChunkPrimer p_185977_3_, BiomeGenBase[] p_185977_4_) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, p_185977_1_, p_185977_2_, p_185977_3_, this.field_185995_n)) return; + double d0 = 0.03125D; + this.field_186002_u = this.field_185994_m.func_151599_a(this.field_186002_u, (double)(p_185977_1_ * 16), (double)(p_185977_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); + +@@ -365,6 +386,8 @@ + boolean flag = false; + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_185931_1_, p_185931_2_); + ++ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.field_185995_n, p_185931_1_, p_185931_2_, flag); ++ + if (this.field_185996_o) + { + if (this.field_186000_s.field_177829_w) +@@ -394,6 +417,7 @@ + } + + if (biomegenbase != Biomes.field_76769_d && biomegenbase != Biomes.field_76786_s && this.field_186000_s.field_177781_A && !flag && this.field_185990_i.nextInt(this.field_186000_s.field_177782_B) == 0) ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) + { + int i1 = this.field_185990_i.nextInt(16) + 8; + int j1 = this.field_185990_i.nextInt(256); +@@ -402,6 +426,7 @@ + } + + if (!flag && this.field_185990_i.nextInt(this.field_186000_s.field_177777_D / 10) == 0 && this.field_186000_s.field_177783_C) ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA)) + { + int i2 = this.field_185990_i.nextInt(16) + 8; + int l2 = this.field_185990_i.nextInt(this.field_185990_i.nextInt(248) + 8); +@@ -414,6 +439,7 @@ + } + + if (this.field_186000_s.field_177837_s) ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON)) + { + for (int j2 = 0; j2 < this.field_186000_s.field_177835_t; ++j2) + { +@@ -425,9 +451,12 @@ + } + + biomegenbase.func_180624_a(this.field_185995_n, this.field_185990_i, new BlockPos(i, 0, j)); ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS)) + WorldEntitySpawner.func_77191_a(this.field_185995_n, biomegenbase, i + 8, j + 8, 16, 16, this.field_185990_i); + blockpos = blockpos.func_177982_a(8, 0, 8); + ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE)) ++ { + for (int k2 = 0; k2 < 16; ++k2) + { + for (int j3 = 0; j3 < 16; ++j3) +@@ -446,7 +475,10 @@ + } + } + } ++ }//Forge: End ICE + ++ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.field_185995_n, p_185931_1_, p_185931_2_, flag); ++ + BlockFalling.field_149832_M = false; + } + diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch index cd28c7ec7d..0b75b82690 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch @@ -1,34 +1,25 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderServer.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderServer.java -@@ -36,6 +36,7 @@ - public LongHashMap field_73244_f = new LongHashMap(); - public List field_73245_g = Lists.newArrayList(); - public WorldServer field_73251_h; +@@ -33,6 +33,7 @@ + public final LongHashMap field_73244_f = new LongHashMap(); + public final List field_73245_g = Lists.newArrayList(); + public final WorldServer field_73251_h; + private Set loadingChunks = com.google.common.collect.Sets.newHashSet(); - public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) + public ChunkProviderServer(WorldServer p_i46838_1_, IChunkLoader p_i46838_2_, IChunkGenerator p_i46838_3_) { -@@ -57,7 +58,7 @@ +@@ -92,14 +93,65 @@ - public void func_73241_b(int p_73241_1_, int p_73241_2_) + public Chunk func_186025_d(int p_186025_1_, int p_186025_2_) { -- if (this.field_73251_h.field_73011_w.func_76567_e()) -+ if (this.field_73251_h.field_73011_w.func_76567_e() && net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.field_73251_h.field_73011_w.func_177502_q())) - { - if (!this.field_73251_h.func_72916_c(p_73241_1_, p_73241_2_)) - { -@@ -80,12 +81,64 @@ - - public Chunk func_73158_c(int p_73158_1_, int p_73158_2_) - { -+ return loadChunk(p_73158_1_, p_73158_2_, null); ++ return loadChunk(p_186025_1_, p_186025_2_, null); + } + -+ public Chunk loadChunk(int par1, int par2, Runnable runnable) ++ public Chunk loadChunk(int X, int Z, Runnable runnable) + { -+ long k = ChunkCoordIntPair.func_77272_a(par1, par2); -+ this.field_73248_b.remove(Long.valueOf(k)); -+ Chunk chunk = (Chunk)this.field_73244_f.func_76164_a(k); ++ long pos = ChunkCoordIntPair.func_77272_a(X, Z); ++ this.field_73248_b.remove(Long.valueOf(pos)); ++ Chunk chunk = this.field_73244_f.func_76164_a(pos); + net.minecraft.world.chunk.storage.AnvilChunkLoader loader = null; + + if (this.field_73247_e instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader) @@ -37,21 +28,21 @@ + } + + // We can only use the queue for already generated chunks -+ if (chunk == null && loader != null && loader.chunkExists(this.field_73251_h, par1, par2)) ++ if (chunk == null && loader != null && loader.chunkExists(this.field_73251_h, X, Z)) + { + if (runnable != null) + { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.queueChunkLoad(this.field_73251_h, loader, this, par1, par2, runnable); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.queueChunkLoad(this.field_73251_h, loader, this, X, Z, runnable); + return null; + } + else + { -+ chunk = net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(this.field_73251_h, loader, this, par1, par2); ++ chunk = net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(this.field_73251_h, loader, this, X, Z); + } + } + else if (chunk == null) + { -+ chunk = this.originalLoadChunk(par1, par2); ++ chunk = this.originalLoadChunk(X, Z); + } + + // If we didn't load the chunk async and have a callback run it now @@ -63,42 +54,36 @@ + return chunk; + } + -+ public Chunk originalLoadChunk(int p_73158_1_, int p_73158_2_) ++ public Chunk originalLoadChunk(int p_186025_1_, int p_186025_2_) + { - long i = ChunkCoordIntPair.func_77272_a(p_73158_1_, p_73158_2_); - this.field_73248_b.remove(Long.valueOf(i)); - Chunk chunk = (Chunk)this.field_73244_f.func_76164_a(i); + Chunk chunk = this.func_186028_c(p_186025_1_, p_186025_2_); if (chunk == null) { -+ boolean added = loadingChunks.add(i); -+ if (!added) + long i = ChunkCoordIntPair.func_77272_a(p_186025_1_, p_186025_2_); +- chunk = this.func_73239_e(p_186025_1_, p_186025_2_); ++ if (!loadingChunks.add(i)) + { -+ net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in di >mension %d that is already being loaded. This will cause weird chunk breakages.", p_73158_1_, p_73158_2_, field_73251_h.field_73011_w.func_177502_q()); ++ net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in di >mension %d that is already being loaded. This will cause weird chunk breakages.", p_186025_1_, p_186025_2_, field_73251_h.field_73011_w.getDimension()); + } + chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(i, this.field_73251_h); -+ -+ if (chunk == null) - chunk = this.func_73239_e(p_73158_1_, p_73158_2_); if (chunk == null) -@@ -114,6 +167,7 @@ ++ chunk = this.func_73239_e(p_186025_1_, p_186025_2_); ++ ++ if (chunk == null) + { + try + { +@@ -118,6 +170,7 @@ this.field_73244_f.func_76163_a(i, chunk); this.field_73245_g.add(chunk); + loadingChunks.remove(i); chunk.func_76631_c(); - chunk.func_76624_a(this, this, p_73158_1_, p_73158_2_); + chunk.func_186030_a(this, this.field_186029_c); } -@@ -205,6 +259,7 @@ - if (this.field_73246_d != null) - { - this.field_73246_d.func_73153_a(p_73153_1_, p_73153_2_, p_73153_3_); -+ net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(p_73153_2_, p_73153_3_, field_73251_h, field_73246_d, p_73153_1_); - chunk.func_76630_e(); - } - } -@@ -266,6 +321,11 @@ +@@ -214,6 +267,11 @@ { if (!this.field_73251_h.field_73058_d) { @@ -110,14 +95,14 @@ for (int i = 0; i < 100; ++i) { if (!this.field_73248_b.isEmpty()) -@@ -280,6 +340,12 @@ +@@ -228,6 +286,12 @@ this.func_73243_a(chunk); this.field_73244_f.func_76159_d(olong.longValue()); this.field_73245_g.remove(chunk); + net.minecraftforge.common.ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.func_77272_a(chunk.field_76635_g, chunk.field_76647_h), chunk); -+ if(field_73245_g.size() == 0 && net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this.field_73251_h).size() == 0 && !net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.field_73251_h.field_73011_w.func_177502_q())){ -+ net.minecraftforge.common.DimensionManager.unloadWorld(this.field_73251_h.field_73011_w.func_177502_q()); -+ return field_73246_d.func_73156_b(); ++ if(field_73245_g.size() == 0 && net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this.field_73251_h).size() == 0 && !net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.field_73251_h.field_73011_w.getDimension())){ ++ net.minecraftforge.common.DimensionManager.unloadWorld(this.field_73251_h.field_73011_w.getDimension()); ++ return false; + } + } diff --git a/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch b/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch index 63fe3a7bb3..887ba3bfd0 100644 --- a/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch @@ -1,17 +1,19 @@ --- ../src-base/minecraft/net/minecraft/world/gen/MapGenCaves.java +++ ../src-work/minecraft/net/minecraft/world/gen/MapGenCaves.java -@@ -138,7 +138,7 @@ +@@ -141,9 +141,7 @@ + { + if (l1 >= 0 && l1 < 256) { - IBlockState iblockstate = p_180702_5_.func_177856_a(j1, l1, k1); - +- IBlockState iblockstate = p_180702_5_.func_177856_a(j1, l1, k1); +- - if (iblockstate.func_177230_c() == Blocks.field_150358_i || iblockstate.func_177230_c() == Blocks.field_150355_j) + if (isOceanBlock(p_180702_5_, j1, l1, k1, p_180702_3_, p_180702_4_)) { flag3 = true; } -@@ -176,33 +176,12 @@ +@@ -181,33 +179,12 @@ IBlockState iblockstate1 = p_180702_5_.func_177856_a(j3, j2, i2); - IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.func_177856_a(j3, j2 + 1, i2), Blocks.field_150350_a.func_176223_P()); + IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.func_177856_a(j3, j2 + 1, i2), field_186127_b); - if (iblockstate1.func_177230_c() == Blocks.field_150349_c || iblockstate1.func_177230_c() == Blocks.field_150391_bh) + if (isTopBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_)) @@ -23,15 +25,15 @@ - { - if (j2 - 1 < 10) - { -- p_180702_5_.func_177855_a(j3, j2, i2, Blocks.field_150353_l.func_176223_P()); +- p_180702_5_.func_177855_a(j3, j2, i2, field_186126_a); - } - else - { -- p_180702_5_.func_177855_a(j3, j2, i2, Blocks.field_150350_a.func_176223_P()); +- p_180702_5_.func_177855_a(j3, j2, i2, field_186127_b); - - if (iblockstate2.func_177230_c() == Blocks.field_150354_m) - { -- p_180702_5_.func_177855_a(j3, j2 + 1, i2, iblockstate2.func_177229_b(BlockSand.field_176504_a) == BlockSand.EnumType.RED_SAND ? Blocks.field_180395_cM.func_176223_P() : Blocks.field_150322_A.func_176223_P()); +- p_180702_5_.func_177855_a(j3, j2 + 1, i2, iblockstate2.func_177229_b(BlockSand.field_176504_a) == BlockSand.EnumType.RED_SAND ? field_186129_d : field_186128_c); - } - - if (flag1 && p_180702_5_.func_177856_a(j3, j2 - 1, i2).func_177230_c() == Blocks.field_150346_d) @@ -45,7 +47,7 @@ } } } -@@ -261,4 +240,71 @@ +@@ -266,4 +243,71 @@ } } } @@ -59,8 +61,8 @@ + //Exception biomes to make sure we generate like vanilla + private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) + { -+ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76787_r) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76769_d) return true; ++ if (biome == net.minecraft.init.Biomes.field_76787_r) return true; ++ if (biome == net.minecraft.init.Biomes.field_76769_d) return true; + return false; + } + @@ -96,17 +98,17 @@ + + if (this.func_175793_a(state, up) || state.func_177230_c() == top.func_177230_c() || state.func_177230_c() == filler.func_177230_c()) + { -+ if (y < 10) ++ if (y - 1 < 10) + { -+ data.func_177855_a(x, y, z, Blocks.field_150353_l.func_176223_P()); ++ data.func_177855_a(x, y, z, field_186126_a); + } + else + { -+ data.func_177855_a(x, y, z, Blocks.field_150350_a.func_176223_P()); ++ data.func_177855_a(x, y, z, field_186127_b); + + if (up.func_177230_c() == Blocks.field_150354_m) + { -+ data.func_177855_a(x, y + 1, z, up.func_177229_b(BlockSand.field_176504_a) == BlockSand.EnumType.RED_SAND ? Blocks.field_180395_cM.func_176223_P() : Blocks.field_150322_A.func_176223_P()); ++ data.func_177855_a(x, y + 1, z, up.func_177229_b(BlockSand.field_176504_a) == BlockSand.EnumType.RED_SAND ? field_186129_d : field_186128_c); + } + + if (foundTop && data.func_177856_a(x, y - 1, z).func_177230_c() == filler.func_177230_c()) diff --git a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch index b5fc50da70..616b17a9a1 100644 --- a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch @@ -1,18 +1,31 @@ --- ../src-base/minecraft/net/minecraft/world/gen/MapGenRavine.java +++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java -@@ -128,7 +128,7 @@ +@@ -128,9 +128,7 @@ + { + if (l1 >= 0 && l1 < 256) { - IBlockState iblockstate = p_180707_5_.func_177856_a(j1, l1, k1); - +- IBlockState iblockstate = p_180707_5_.func_177856_a(j1, l1, k1); +- - if (iblockstate.func_177230_c() == Blocks.field_150358_i || iblockstate.func_177230_c() == Blocks.field_150355_j) + if (isOceanBlock(p_180707_5_, j1, l1, k1, p_180707_3_, p_180707_4_)) { flag2 = true; } -@@ -165,28 +165,12 @@ - { - IBlockState iblockstate1 = p_180707_5_.func_177856_a(j3, j2, i2); +@@ -146,8 +144,6 @@ + if (!flag2) + { +- BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); +- + for (int j3 = k2; j3 < k; ++j3) + { + double d10 = ((double)(j3 + p_180707_3_ * 16) + 0.5D - p_180707_6_) / d9; +@@ -165,30 +161,12 @@ + + if ((d10 * d10 + d7 * d7) * (double)this.field_75046_d[j2 - 1] + d8 * d8 / 6.0D < 1.0D) + { +- IBlockState iblockstate1 = p_180707_5_.func_177856_a(j3, j2, i2); +- - if (iblockstate1.func_177230_c() == Blocks.field_150349_c) + if (isTopBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_)) { @@ -23,11 +36,11 @@ - { - if (j2 - 1 < 10) - { -- p_180707_5_.func_177855_a(j3, j2, i2, Blocks.field_150356_k.func_176223_P()); +- p_180707_5_.func_177855_a(j3, j2, i2, field_186135_a); - } - else - { -- p_180707_5_.func_177855_a(j3, j2, i2, Blocks.field_150350_a.func_176223_P()); +- p_180707_5_.func_177855_a(j3, j2, i2, field_186136_b); - - if (flag && p_180707_5_.func_177856_a(j3, j2 - 1, i2).func_177230_c() == Blocks.field_150346_d) - { @@ -40,7 +53,7 @@ } } } -@@ -221,4 +205,68 @@ +@@ -223,4 +201,68 @@ } } } @@ -53,10 +66,10 @@ + //Exception biomes to make sure we generate like vanilla + private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) + { -+ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76787_r) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76769_d) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76789_p) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76788_q) return true; ++ if (biome == net.minecraft.init.Biomes.field_76787_r) return true; ++ if (biome == net.minecraft.init.Biomes.field_76769_d) return true; ++ if (biome == net.minecraft.init.Biomes.field_76789_p) return true; ++ if (biome == net.minecraft.init.Biomes.field_76788_q) return true; + return false; + } + @@ -93,13 +106,13 @@ + + if (state.func_177230_c() == Blocks.field_150348_b || state.func_177230_c() == top.func_177230_c() || state.func_177230_c() == filler.func_177230_c()) + { -+ if (y < 10) ++ if (y - 1 < 10) + { -+ data.func_177855_a(x, y, z, Blocks.field_150353_l.func_176223_P()); ++ data.func_177855_a(x, y, z, field_186135_a); + } + else + { -+ data.func_177855_a(x, y, z, Blocks.field_150350_a.func_176223_P()); ++ data.func_177855_a(x, y, z, field_186136_b); + + if (foundTop && data.func_177856_a(x, y - 1, z).func_177230_c() == filler.func_177230_c()) + { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch index f23e6f3182..773fd43edc 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch @@ -8,6 +8,6 @@ + public boolean isReplaceable(World world, BlockPos pos) + { + net.minecraft.block.state.IBlockState state = world.func_180495_p(pos); -+ return state.func_177230_c().isAir(world, pos) || state.func_177230_c().isLeaves(world, pos) || state.func_177230_c().isWood(world, pos) || func_150523_a(state.func_177230_c()); ++ return state.func_177230_c().isAir(state, world, pos) || state.func_177230_c().isLeaves(state, world, pos) || state.func_177230_c().isWood(world, pos) || func_150523_a(state.func_177230_c()); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch index 2a98d8c833..2ee32167e7 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch @@ -1,33 +1,34 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java -@@ -54,7 +54,7 @@ +@@ -56,9 +56,9 @@ + { + if (j >= 0 && j < 256) { - Block block = p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)).func_177230_c(); +- Material material = p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)).func_185904_a(); ++ IBlockState state = p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)); -- if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j) -+ if (!block.isAir(p_180709_1_, blockpos$mutableblockpos) && !block.isLeaves(p_180709_1_, blockpos$mutableblockpos)) +- if (material != Material.field_151579_a && material != Material.field_151584_j) ++ if (!state.func_177230_c().isAir(state, p_180709_1_, blockpos$mutableblockpos) && !state.func_177230_c().isLeaves(state, p_180709_1_, blockpos$mutableblockpos)) { flag = false; } -@@ -190,7 +190,7 @@ +@@ -193,8 +193,9 @@ + if (p_180709_3_.func_177956_o() >= p_180709_3_.func_177956_o() + i - 1 || blockhugemushroom$enumtype != BlockHugeMushroom.EnumType.ALL_INSIDE) { BlockPos blockpos = new BlockPos(l1, l2, i2); ++ IBlockState state = p_180709_1_.func_180495_p(blockpos); -- if (!p_180709_1_.func_180495_p(blockpos).func_177230_c().func_149730_j()) -+ if (p_180709_1_.func_180495_p(blockpos).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos)) +- if (!p_180709_1_.func_180495_p(blockpos).func_185913_b()) ++ if (state.func_177230_c().canBeReplacedByLeaves(state, p_180709_1_, blockpos)) { - this.func_175903_a(p_180709_1_, blockpos, this.field_76523_a.func_176223_P().func_177226_a(BlockHugeMushroom.field_176380_a, blockhugemushroom$enumtype)); + this.func_175903_a(p_180709_1_, blockpos, block.func_176223_P().func_177226_a(BlockHugeMushroom.field_176380_a, blockhugemushroom$enumtype)); } -@@ -201,9 +201,10 @@ - - for (int i3 = 0; i3 < i; ++i3) +@@ -207,7 +208,7 @@ { -- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(i3)).func_177230_c(); -+ BlockPos upN = p_180709_3_.func_177981_b(i3); -+ net.minecraft.block.state.IBlockState state = p_180709_1_.func_180495_p(upN); + IBlockState iblockstate = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(i3)); -- if (!block2.func_149730_j()) -+ if (state.func_177230_c().canBeReplacedByLeaves(p_180709_1_, upN)) +- if (!iblockstate.func_185913_b()) ++ if (iblockstate.func_177230_c().canBeReplacedByLeaves(iblockstate, p_180709_1_, p_180709_3_.func_177981_b(i3))) { - this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(i3), this.field_76523_a.func_176223_P().func_177226_a(BlockHugeMushroom.field_176380_a, BlockHugeMushroom.EnumType.STEM)); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(i3), block.func_176223_P().func_177226_a(BlockHugeMushroom.field_176380_a, BlockHugeMushroom.EnumType.STEM)); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch index 7fb88e1b7a..9b5ed8239b 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch @@ -4,11 +4,11 @@ if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_181631_2_ * p_181631_2_)) { BlockPos blockpos = p_181631_1_.func_177982_a(j, 0, k); -- Material material = this.field_175946_l.func_180495_p(blockpos).func_177230_c().func_149688_o(); -+ net.minecraft.block.state.IBlockState state = this.field_175946_l.func_180495_p(blockpos); +- Material material = this.field_175946_l.func_180495_p(blockpos).func_185904_a(); ++ IBlockState state = this.field_175946_l.func_180495_p(blockpos); - if (material == Material.field_151579_a || material == Material.field_151584_j) -+ if (state.func_177230_c().isAir(this.field_175946_l, blockpos) || state.func_177230_c().isLeaves(this.field_175946_l, blockpos)) ++ if (state.func_177230_c().isAir(state, field_175946_l, blockpos) || state.func_177230_c().isLeaves(state, field_175946_l, blockpos)) { this.func_175903_a(this.field_175946_l, blockpos, p_181631_3_); } @@ -43,7 +43,7 @@ - Block block = this.field_175946_l.func_180495_p(this.field_175947_m.func_177977_b()).func_177230_c(); + BlockPos down = this.field_175947_m.func_177977_b(); + net.minecraft.block.state.IBlockState state = this.field_175946_l.func_180495_p(down); -+ boolean isSoil = state.func_177230_c().canSustainPlant(this.field_175946_l, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); ++ boolean isSoil = state.func_177230_c().canSustainPlant(state, this.field_175946_l, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); - if (block != Blocks.field_150346_d && block != Blocks.field_150349_c && block != Blocks.field_150458_ak) + if (!isSoil) diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch new file mode 100644 index 0000000000..0dde48dc2d --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch @@ -0,0 +1,64 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java +@@ -8,6 +8,7 @@ + import net.minecraft.block.material.Material; + import net.minecraft.block.state.IBlockState; + import net.minecraft.init.Blocks; ++import net.minecraft.util.EnumFacing; + import net.minecraft.util.math.BlockPos; + import net.minecraft.world.World; + +@@ -56,9 +57,9 @@ + { + for (int i1 = p_180709_3_.func_177952_p() - k; i1 <= p_180709_3_.func_177952_p() + k && flag; ++i1) + { +- if (j >= 0 && j < 256) ++ if (j >= 0 && j < p_180709_1_.func_72800_K()) + { +- if (!this.func_150523_a(p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)).func_177230_c())) ++ if (!this.isReplaceable(p_180709_1_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) + { + flag = false; + } +@@ -77,11 +78,13 @@ + } + else + { +- Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); ++ BlockPos down = p_180709_3_.func_177977_b(); ++ IBlockState state = p_180709_1_.func_180495_p(down); ++ boolean isSoil = state.func_177230_c().canSustainPlant(state, p_180709_1_, down, EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g); + +- if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d || block == Blocks.field_150458_ak) && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (isSoil && p_180709_3_.func_177956_o() < p_180709_1_.func_72800_K() - i - 1) + { +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); ++ state.func_177230_c().onPlantGrow(state, p_180709_1_, down, p_180709_3_); + + for (int i2 = p_180709_3_.func_177956_o() - 3 + i; i2 <= p_180709_3_.func_177956_o() + i; ++i2) + { +@@ -99,9 +102,9 @@ + if (Math.abs(j1) != l2 || Math.abs(l1) != l2 || p_180709_2_.nextInt(2) != 0 && k2 != 0) + { + BlockPos blockpos = new BlockPos(i3, i2, k1); +- Material material = p_180709_1_.func_180495_p(blockpos).func_185904_a(); ++ IBlockState state2 = p_180709_1_.func_180495_p(blockpos); + +- if (material == Material.field_151579_a || material == Material.field_151584_j) ++ if (state2.func_177230_c().isAir(state2, p_180709_1_, blockpos) || state2.func_177230_c().isAir(state2, p_180709_1_, blockpos)) + { + this.func_175903_a(p_180709_1_, blockpos, field_181630_b); + } +@@ -112,9 +115,10 @@ + + for (int j2 = 0; j2 < i; ++j2) + { +- Material material1 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(j2)).func_185904_a(); ++ BlockPos upN = p_180709_3_.func_177981_b(j2); ++ IBlockState state2 = p_180709_1_.func_180495_p(upN); + +- if (material1 == Material.field_151579_a || material1 == Material.field_151584_j) ++ if (state2.func_177230_c().isAir(state2, p_180709_1_, upN) || state2.func_177230_c().isLeaves(state2, p_180709_1_, upN)) + { + this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(j2), field_181629_a); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java.patch new file mode 100644 index 0000000000..ed54b4718f --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java +@@ -20,7 +20,7 @@ + { + BlockPos blockpos = p_180709_3_.func_177982_a(p_180709_2_.nextInt(8) - p_180709_2_.nextInt(8), p_180709_2_.nextInt(4) - p_180709_2_.nextInt(4), p_180709_2_.nextInt(8) - p_180709_2_.nextInt(8)); + +- if (p_180709_1_.func_175623_d(blockpos) && (!p_180709_1_.field_73011_w.func_177495_o() || blockpos.func_177956_o() < 255) && this.field_175908_a.func_180671_f(p_180709_1_, blockpos, this.field_175908_a.func_176223_P())) ++ if (p_180709_1_.func_175623_d(blockpos) && (!p_180709_1_.field_73011_w.func_177495_o() || blockpos.func_177956_o() < p_180709_1_.func_72800_K() - 1) && this.field_175908_a.func_180671_f(p_180709_1_, blockpos, this.field_175908_a.func_176223_P())) + { + p_180709_1_.func_180501_a(blockpos, this.field_175908_a.func_176223_P(), 2); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch index 6bc3eb8140..61ebf130cf 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch @@ -5,11 +5,11 @@ { BlockPos blockpos = p_180709_3_.func_177977_b(); - Block block = p_180709_1_.func_180495_p(blockpos).func_177230_c(); -+ net.minecraft.block.state.IBlockState state = p_180709_1_.func_180495_p(blockpos); -+ boolean isSoil = state.func_177230_c().canSustainPlant(p_180709_1_, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); ++ IBlockState state = p_180709_1_.func_180495_p(blockpos); ++ boolean isSoil = state.func_177230_c().canSustainPlant(state, p_180709_1_, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); - if (block != Blocks.field_150349_c && block != Blocks.field_150346_d) -+ if (!(isSoil && p_180709_3_.func_177956_o() < 256 - i - 1)) ++ if (!(isSoil && p_180709_3_.func_177956_o() < p_180709_1_.func_72800_K() - i - 1)) { return false; } @@ -32,11 +32,11 @@ int k2 = k + j2; BlockPos blockpos1 = new BlockPos(k1, k2, l1); -- Material material = p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o(); +- Material material = p_180709_1_.func_180495_p(blockpos1).func_185904_a(); + state = p_180709_1_.func_180495_p(blockpos1); - if (material == Material.field_151579_a || material == Material.field_151584_j) -+ if (state.func_177230_c().isAir(p_180709_1_, blockpos1) || state.func_177230_c().isLeaves(p_180709_1_, blockpos1)) ++ if (state.func_177230_c().isAir(state, p_180709_1_, blockpos1) || state.func_177230_c().isLeaves(state, p_180709_1_, blockpos1)) { this.func_181639_b(p_180709_1_, blockpos1); this.func_181639_b(p_180709_1_, blockpos1.func_177974_f()); @@ -49,15 +49,15 @@ { return false; } -@@ -209,11 +210,17 @@ +@@ -209,11 +210,18 @@ private void func_150526_a(World p_150526_1_, int p_150526_2_, int p_150526_3_, int p_150526_4_) { BlockPos blockpos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); -- Block block = p_150526_1_.func_180495_p(blockpos).func_177230_c(); -+ net.minecraft.block.state.IBlockState state = p_150526_1_.func_180495_p(blockpos); +- Material material = p_150526_1_.func_180495_p(blockpos).func_185904_a(); ++ IBlockState state = p_150526_1_.func_180495_p(blockpos); -- if (block.func_149688_o() == Material.field_151579_a) -+ if (state.func_177230_c().isAir(p_150526_1_, blockpos)) +- if (material == Material.field_151579_a) ++ if (state.func_177230_c().isAir(state, p_150526_1_, blockpos)) { this.func_175903_a(p_150526_1_, blockpos, field_181641_b); } @@ -66,6 +66,7 @@ + //Just a helper macro + private void onPlantGrow(World world, BlockPos pos, BlockPos source) + { -+ world.func_180495_p(pos).func_177230_c().onPlantGrow(world, pos, source); ++ IBlockState state = world.func_180495_p(pos); ++ state.func_177230_c().onPlantGrow(state, world, pos, source); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch index 61253bc645..6f023be26d 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch @@ -1,14 +1,16 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java -@@ -13,10 +13,12 @@ +@@ -11,12 +11,12 @@ + { + public boolean func_180709_b(World p_180709_1_, Random p_180709_2_, BlockPos p_180709_3_) { - Block block; - -- while (((block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c()).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 0) +- IBlockState iblockstate; +- +- while (((iblockstate = p_180709_1_.func_180495_p(p_180709_3_)).func_185904_a() == Material.field_151579_a || iblockstate.func_185904_a() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 0) + do { -+ block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); -+ if (!block.isLeaves(p_180709_1_, p_180709_3_) && !block.isLeaves(p_180709_1_, p_180709_3_)) break; ++ IBlockState state = p_180709_1_.func_180495_p(p_180709_3_); ++ if (!state.func_177230_c().isAir(state, p_180709_1_, p_180709_3_) && !state.func_177230_c().isLeaves(state, p_180709_1_, p_180709_3_)) break; p_180709_3_ = p_180709_3_.func_177977_b(); - } + } while (p_180709_3_.func_177956_o() > 0); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch index dd91af3365..098f8b475f 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch @@ -1,30 +1,10 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java -@@ -123,12 +123,11 @@ - if (j3 == 1) - { - p_180709_1_.func_180501_a(blockpos2, Blocks.field_150486_ae.func_176458_f(p_180709_1_, blockpos2, Blocks.field_150486_ae.func_176223_P()), 2); -- List list = WeightedRandomChestContent.func_177629_a(field_175917_c, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_180709_2_)}); - TileEntity tileentity1 = p_180709_1_.func_175625_s(blockpos2); - - if (tileentity1 instanceof TileEntityChest) - { -- WeightedRandomChestContent.func_177630_a(p_180709_2_, list, (TileEntityChest)tileentity1, 8); -+ WeightedRandomChestContent.func_177630_a(p_180709_2_, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, p_180709_2_), (TileEntityChest)tileentity1, 8); - } - - break; -@@ -159,6 +158,12 @@ +@@ -154,6 +154,6 @@ private String func_76543_b(Random p_76543_1_) { - return field_175916_b[p_76543_1_.nextInt(field_175916_b.length)]; + return net.minecraftforge.common.DungeonHooks.getRandomDungeonMob(p_76543_1_); } -+ -+ static -+ { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, field_175917_c, 8, 8); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); -+ } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch deleted file mode 100644 index 9eca24df4e..0000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java -@@ -58,7 +58,7 @@ - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)).func_177230_c())) -+ if (!this.isReplaceable(p_180709_1_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) - { - flag = false; - } -@@ -77,11 +77,13 @@ - } - else - { -- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); -+ BlockPos down = p_180709_3_.func_177977_b(); -+ Block block1 = p_180709_1_.func_180495_p(down).func_177230_c(); -+ boolean isSoil = block1.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); - -- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d || block1 == Blocks.field_150458_ak) && p_180709_3_.func_177956_o() < 256 - i - 1) -+ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) - { -- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); -+ block1.onPlantGrow(p_180709_1_, down, p_180709_3_); - - for (int i2 = p_180709_3_.func_177956_o() - 3 + i; i2 <= p_180709_3_.func_177956_o() + i; ++i2) - { -@@ -101,7 +103,7 @@ - BlockPos blockpos = new BlockPos(i3, i2, k1); - Block block = p_180709_1_.func_180495_p(blockpos).func_177230_c(); - -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (block.isAir(p_180709_1_, blockpos) || block.isLeaves(p_180709_1_, blockpos)) - { - this.func_175903_a(p_180709_1_, blockpos, field_181630_b); - } -@@ -112,9 +114,9 @@ - - for (int j2 = 0; j2 < i; ++j2) - { -- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(j2)).func_177230_c(); -- -- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j) -+ BlockPos upN = p_180709_3_.func_177981_b(j2); -+ Block block2 = p_180709_1_.func_180495_p(upN).func_177230_c(); -+ if (block2.isAir(p_180709_1_, upN) || block2.isLeaves(p_180709_1_, upN)) - { - this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(j2), field_181629_a); - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java.patch new file mode 100644 index 0000000000..45ec439504 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java +@@ -27,7 +27,7 @@ + { + BlockPos blockpos = p_180709_3_.func_177982_a(p_180709_2_.nextInt(8) - p_180709_2_.nextInt(8), -p_180709_2_.nextInt(12), p_180709_2_.nextInt(8) - p_180709_2_.nextInt(8)); + +- if (p_180709_1_.func_180495_p(blockpos).func_185904_a() == Material.field_151579_a) ++ if (p_180709_1_.func_175623_d(blockpos)) + { + int j = 0; + diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java.patch new file mode 100644 index 0000000000..cec562cded --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java +@@ -27,7 +27,7 @@ + { + BlockPos blockpos = p_180709_3_.func_177982_a(p_180709_2_.nextInt(8) - p_180709_2_.nextInt(8), -p_180709_2_.nextInt(12), p_180709_2_.nextInt(8) - p_180709_2_.nextInt(8)); + +- if (p_180709_1_.func_180495_p(blockpos).func_185904_a() == Material.field_151579_a) ++ if (p_180709_1_.func_175623_d(blockpos)) + { + int j = 0; + diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java.patch new file mode 100644 index 0000000000..b8ef8082e1 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java +@@ -24,7 +24,7 @@ + { + return false; + } +- else if (p_180709_1_.func_180495_p(p_180709_3_).func_185904_a() != Material.field_151579_a && p_180709_1_.func_180495_p(p_180709_3_).func_177230_c() != Blocks.field_150424_aL) ++ else if (!p_180709_1_.func_175623_d(p_180709_3_) && p_180709_1_.func_180495_p(p_180709_3_).func_177230_c() != Blocks.field_150424_aL) + { + return false; + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch index 16ea524eba..c0785697b7 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch @@ -9,11 +9,13 @@ { flag = false; } -@@ -79,13 +79,14 @@ +@@ -78,14 +78,15 @@ + private boolean func_175927_a(BlockPos p_175927_1_, World p_175927_2_) { BlockPos blockpos = p_175927_1_.func_177977_b(); - Block block = p_175927_2_.func_180495_p(blockpos).func_177230_c(); -+ boolean isSoil = block.canSustainPlant(p_175927_2_, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); +- Block block = p_175927_2_.func_180495_p(blockpos).func_177230_c(); ++ IBlockState state = p_175927_2_.func_180495_p(blockpos); ++ boolean isSoil = state.func_177230_c().canSustainPlant(state, p_175927_2_, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); - if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d) && p_175927_1_.func_177956_o() >= 2) + if (isSoil && p_175927_1_.func_177956_o() >= 2) @@ -33,11 +35,11 @@ if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) { BlockPos blockpos = p_175925_2_.func_177982_a(j, 0, k); -- Material material = p_175925_1_.func_180495_p(blockpos).func_177230_c().func_149688_o(); -+ net.minecraft.block.state.IBlockState state = p_175925_1_.func_180495_p(blockpos); +- Material material = p_175925_1_.func_180495_p(blockpos).func_185904_a(); ++ IBlockState state = p_175925_1_.func_180495_p(blockpos); - if (material == Material.field_151579_a || material == Material.field_151584_j) -+ if (state.func_177230_c().isAir(p_175925_1_, blockpos) || state.func_177230_c().isLeaves(p_175925_1_, blockpos)) ++ if (state.func_177230_c().isAir(state, p_175925_1_, blockpos) || state.func_177230_c().isLeaves(state, p_175925_1_, blockpos)) { this.func_175903_a(p_175925_1_, blockpos, this.field_76521_c); } @@ -45,15 +47,15 @@ if (j * j + k * k <= i) { BlockPos blockpos = p_175928_2_.func_177982_a(j, 0, k); -- Material material = p_175928_1_.func_180495_p(blockpos).func_177230_c().func_149688_o(); -+ Block block = p_175928_1_.func_180495_p(blockpos).func_177230_c(); +- Material material = p_175928_1_.func_180495_p(blockpos).func_185904_a(); ++ IBlockState state = p_175928_1_.func_180495_p(blockpos); - if (material == Material.field_151579_a || material == Material.field_151584_j) -+ if (block.isAir(p_175928_1_, blockpos) || block.isLeaves(p_175928_1_, blockpos)) ++ if (state.func_177230_c().isAir(state, p_175928_1_, blockpos) || state.func_177230_c().isLeaves(state, p_175928_1_, blockpos)) { this.func_175903_a(p_175928_1_, blockpos, this.field_76521_c); } -@@ -145,4 +146,10 @@ +@@ -145,4 +146,11 @@ } } } @@ -61,6 +63,7 @@ + //Just a helper macro + private void onPlantGrow(World world, BlockPos pos, BlockPos source) + { -+ world.func_180495_p(pos).func_177230_c().onPlantGrow(world, pos, source); ++ IBlockState state = world.func_180495_p(pos); ++ state.func_177230_c().onPlantGrow(state, world, pos, source); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java.patch new file mode 100644 index 0000000000..1ac2953b8e --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java +@@ -51,7 +51,7 @@ + IBlockState iblockstate = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(i1, k, j1)); + Block block = iblockstate.func_177230_c(); + +- if (iblockstate.func_185904_a() == Material.field_151579_a || block == Blocks.field_150346_d || block == Blocks.field_150433_aE || block == Blocks.field_150432_aD) ++ if (iblockstate.func_177230_c().isAir(iblockstate, p_180709_1_, p_180709_3_.func_177982_a(i1, k, j1)) || block == Blocks.field_150346_d || block == Blocks.field_150433_aE || block == Blocks.field_150432_aD) + { + this.func_175903_a(p_180709_1_, p_180709_3_.func_177982_a(i1, k, j1), Blocks.field_150403_cj.func_176223_P()); + } +@@ -61,7 +61,7 @@ + iblockstate = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(i1, -k, j1)); + block = iblockstate.func_177230_c(); + +- if (iblockstate.func_185904_a() == Material.field_151579_a || block == Blocks.field_150346_d || block == Blocks.field_150433_aE || block == Blocks.field_150432_aD) ++ if (iblockstate.func_177230_c().isAir(iblockstate, p_180709_1_, p_180709_3_.func_177982_a(i1, -k, j1)) || block == Blocks.field_150346_d || block == Blocks.field_150433_aE || block == Blocks.field_150432_aD) + { + this.func_175903_a(p_180709_1_, p_180709_3_.func_177982_a(i1, -k, j1), Blocks.field_150403_cj.func_176223_P()); + } +@@ -99,7 +99,7 @@ + IBlockState iblockstate1 = p_180709_1_.func_180495_p(blockpos); + Block block1 = iblockstate1.func_177230_c(); + +- if (iblockstate1.func_185904_a() != Material.field_151579_a && block1 != Blocks.field_150346_d && block1 != Blocks.field_150433_aE && block1 != Blocks.field_150432_aD && block1 != Blocks.field_150403_cj) ++ if (!iblockstate1.func_177230_c().isAir(iblockstate1, p_180709_1_, blockpos) && block1 != Blocks.field_150346_d && block1 != Blocks.field_150433_aE && block1 != Blocks.field_150432_aD && block1 != Blocks.field_150403_cj) + { + break; + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java.patch new file mode 100644 index 0000000000..223fdde145 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java +@@ -26,7 +26,7 @@ + { + return false; + } +- else if (p_180709_1_.func_180495_p(p_180709_3_).func_185904_a() != Material.field_151579_a && p_180709_1_.func_180495_p(p_180709_3_).func_177230_c() != Blocks.field_150348_b) ++ else if (!p_180709_1_.func_175623_d(p_180709_3_) && p_180709_1_.func_180495_p(p_180709_3_).func_177230_c() != Blocks.field_150348_b) + { + return false; + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch index 6856a6cfc2..8964b67b1e 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch @@ -44,7 +44,7 @@ + //Helper macro + private boolean isAirLeaves(World world, BlockPos pos) + { -+ net.minecraft.block.Block block = world.func_180495_p(pos).func_177230_c(); -+ return block.isAir(world, pos) || block.isLeaves(world, pos); ++ IBlockState state = world.func_180495_p(pos); ++ return state.func_177230_c().isAir(state, world, pos) || state.func_177230_c().isLeaves(state, world, pos); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch index f658ebfe60..70ea1b4468 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch @@ -1,55 +1,52 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java -@@ -43,30 +43,24 @@ - { - Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(j)).func_177230_c(); +@@ -41,32 +41,25 @@ -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (isAirLeaves(p_180709_1_,p_180709_3_.func_177981_b(j))) + for (int j = 0; j < i; ++j) + { +- IBlockState iblockstate = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(j)); +- +- if (iblockstate.func_185904_a() == Material.field_151579_a || iblockstate.func_185904_a() == Material.field_151584_j) ++ if (isAirLeaves(p_180709_1_, p_180709_3_.func_177981_b(j))) { this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(j), this.field_76520_b); } if (j < i - 1) { -- block = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(1, j, 0)).func_177230_c(); +- iblockstate = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(1, j, 0)); - -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (isAirLeaves(p_180709_1_,p_180709_3_.func_177982_a(1, j, 0))) +- if (iblockstate.func_185904_a() == Material.field_151579_a || iblockstate.func_185904_a() == Material.field_151584_j) ++ if (isAirLeaves(p_180709_1_, p_180709_3_.func_177982_a(1, j, 0))) { this.func_175903_a(p_180709_1_, p_180709_3_.func_177982_a(1, j, 0), this.field_76520_b); } -- block = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(1, j, 1)).func_177230_c(); +- iblockstate = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(1, j, 1)); - -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (isAirLeaves(p_180709_1_,p_180709_3_.func_177982_a(1, j, 1))) +- if (iblockstate.func_185904_a() == Material.field_151579_a || iblockstate.func_185904_a() == Material.field_151584_j) ++ if (isAirLeaves(p_180709_1_, p_180709_3_.func_177982_a(1, j, 1))) { this.func_175903_a(p_180709_1_, p_180709_3_.func_177982_a(1, j, 1), this.field_76520_b); } -- block = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(0, j, 1)).func_177230_c(); -- -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (isAirLeaves(p_180709_1_,p_180709_3_.func_177982_a(0, j, 1))) +- iblockstate = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(0, j, 1)); + +- if (iblockstate.func_185904_a() == Material.field_151579_a || iblockstate.func_185904_a() == Material.field_151584_j) ++ if (isAirLeaves(p_180709_1_, p_180709_3_.func_177982_a(0, j, 1))) { this.func_175903_a(p_180709_1_, p_180709_3_.func_177982_a(0, j, 1), this.field_76520_b); } -@@ -132,16 +126,23 @@ - BlockPos blockpos = p_175934_2_.func_177981_b(i); - Block block = p_175934_1_.func_180495_p(blockpos).func_177230_c(); +@@ -133,7 +126,7 @@ + IBlockState iblockstate = p_175934_1_.func_180495_p(blockpos); + Block block = iblockstate.func_177230_c(); - if (block == Blocks.field_150349_c || block == Blocks.field_150346_d) -+ if (block.canSustainPlant(p_175934_1_, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g))) ++ if (block.canSustainPlant(iblockstate, p_175934_1_, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g))) { this.func_175903_a(p_175934_1_, blockpos, field_181635_g); break; - } - -- if (block.func_149688_o() != Material.field_151579_a && i < 0) -+ if (!block.isAir(p_175934_1_, blockpos) && i < 0) - { - break; +@@ -145,4 +138,11 @@ } } } @@ -57,7 +54,7 @@ + //Helper macro + private boolean isAirLeaves(World world, BlockPos pos) + { -+ net.minecraft.block.Block block = world.func_180495_p(pos).func_177230_c(); -+ return block.isAir(world, pos) || block.isLeaves(world, pos); ++ IBlockState state = world.func_180495_p(pos); ++ return state.func_177230_c().isAir(state, world, pos) || state.func_177230_c().isLeaves(state, world, pos); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch index b3aef2aae5..d7cc9310a8 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch @@ -1,11 +1,12 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java -@@ -73,7 +73,7 @@ +@@ -73,7 +73,8 @@ { BlockPos blockpos = new BlockPos(l1, i2, j2); - if (this.field_175919_c.apply(p_180709_1_.func_180495_p(blockpos))) -+ if (p_180709_1_.func_180495_p(blockpos).func_177230_c().isReplaceableOreGen(p_180709_1_, blockpos, this.field_175919_c)) ++ IBlockState state = p_180709_1_.func_180495_p(blockpos); ++ if (state.func_177230_c().isReplaceableOreGen(state, p_180709_1_, blockpos, this.field_175919_c)) { p_180709_1_.func_180501_a(blockpos, this.field_175920_a, 2); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch index 105b15ca4d..3a17a2173c 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch @@ -15,14 +15,14 @@ { - Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); + BlockPos down = p_180709_3_.func_177977_b(); -+ Block block = p_180709_1_.func_180495_p(down).func_177230_c(); -+ boolean isSoil = block.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); ++ IBlockState state = p_180709_1_.func_180495_p(down); ++ boolean isSoil = state.func_177230_c().canSustainPlant(state, p_180709_1_, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); - if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d) && p_180709_3_.func_177956_o() < 256 - i - 1) -+ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (isSoil && p_180709_3_.func_177956_o() < p_180709_1_.func_72800_K() - i - 1) { - this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); -+ block.onPlantGrow(p_180709_1_, down, p_180709_3_); ++ state.func_177230_c().onPlantGrow(state, p_180709_1_, down, p_180709_3_); EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.func_179518_a(p_180709_2_); int k2 = i - p_180709_2_.nextInt(4) - 1; int l2 = 3 - p_180709_2_.nextInt(3); @@ -30,11 +30,11 @@ } BlockPos blockpos = new BlockPos(i3, i2, j1); -- Material material = p_180709_1_.func_180495_p(blockpos).func_177230_c().func_149688_o(); -+ block = p_180709_1_.func_180495_p(blockpos).func_177230_c(); +- Material material = p_180709_1_.func_180495_p(blockpos).func_185904_a(); ++ state = p_180709_1_.func_180495_p(blockpos); - if (material == Material.field_151579_a || material == Material.field_151584_j) -+ if (block.isAir(p_180709_1_, blockpos) || block.isLeaves(p_180709_1_, blockpos)) ++ if (state.func_177230_c().isAir(state, p_180709_1_, blockpos) || state.func_177230_c().isLeaves(state, p_180709_1_, blockpos)) { this.func_181642_b(p_180709_1_, blockpos); k1 = i2; @@ -42,11 +42,11 @@ i3 += enumfacing1.func_82601_c(); j1 += enumfacing1.func_82599_e(); BlockPos blockpos1 = new BlockPos(i3, j2, j1); -- Material material1 = p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o(); -+ block = p_180709_1_.func_180495_p(blockpos1).func_177230_c(); +- Material material1 = p_180709_1_.func_180495_p(blockpos1).func_185904_a(); ++ state = p_180709_1_.func_180495_p(blockpos1); - if (material1 == Material.field_151579_a || material1 == Material.field_151584_j) -+ if (block.isAir(p_180709_1_, blockpos2) || block.isLeaves(p_180709_1_, blockpos2)) ++ if (state.func_177230_c().isAir(state, p_180709_1_, blockpos1) || state.func_177230_c().isLeaves(state, p_180709_1_, blockpos1)) { this.func_181642_b(p_180709_1_, blockpos1); k1 = j2; @@ -54,11 +54,11 @@ private void func_175924_b(World p_175924_1_, BlockPos p_175924_2_) { -- Material material = p_175924_1_.func_180495_p(p_175924_2_).func_177230_c().func_149688_o(); -+ Block block = p_175924_1_.func_180495_p(p_175924_2_).func_177230_c(); +- Material material = p_175924_1_.func_180495_p(p_175924_2_).func_185904_a(); ++ IBlockState state = p_175924_1_.func_180495_p(p_175924_2_); - if (material == Material.field_151579_a || material == Material.field_151584_j) -+ if (block.isAir(p_175924_1_, p_175924_2_) || block.isLeaves(p_175924_1_, p_175924_2_)) ++ if (state.func_177230_c().isAir(state, p_175924_1_, p_175924_2_) || state.func_177230_c().isLeaves(state, p_175924_1_, p_175924_2_)) { this.func_175903_a(p_175924_1_, p_175924_2_, field_181644_b); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch index 70f640f5f8..399a3c4477 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch @@ -1,31 +1,37 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java -@@ -24,14 +24,16 @@ - { - Block block; +@@ -22,16 +22,16 @@ -- while (((block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c()).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 0) + public boolean func_180709_b(World p_180709_1_, Random p_180709_2_, BlockPos p_180709_3_) + { +- IBlockState iblockstate; +- +- while (((iblockstate = p_180709_1_.func_180495_p(p_180709_3_)).func_185904_a() == Material.field_151579_a || iblockstate.func_185904_a() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 0) + do { -+ block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); -+ if (!block.isAir(p_180709_1_, p_180709_3_) && !block.isLeaves(p_180709_1_, p_180709_3_)) break; ++ IBlockState state = p_180709_1_.func_180495_p(p_180709_3_); ++ if (!state.func_177230_c().isLeaves(state, p_180709_1_, p_180709_3_) && !state.func_177230_c().isLeaves(state, p_180709_1_, p_180709_3_)) break; p_180709_3_ = p_180709_3_.func_177977_b(); - } + } while (p_180709_3_.func_177956_o() > 0); - Block block1 = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); +- Block block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); ++ IBlockState state = p_180709_1_.func_180495_p(p_180709_3_); -- if (block1 == Blocks.field_150346_d || block1 == Blocks.field_150349_c) -+ if (block1.canSustainPlant(p_180709_1_, p_180709_3_, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g))) +- if (block == Blocks.field_150346_d || block == Blocks.field_150349_c) ++ if (state.func_177230_c().canSustainPlant(state, p_180709_1_, p_180709_3_, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g))) { p_180709_3_ = p_180709_3_.func_177984_a(); this.func_175903_a(p_180709_1_, p_180709_3_, this.field_150527_b); -@@ -53,7 +55,7 @@ +@@ -52,9 +52,9 @@ + if (Math.abs(i1) != k || Math.abs(k1) != k || p_180709_2_.nextInt(2) != 0) { BlockPos blockpos = new BlockPos(l, i, j1); +- Material material = p_180709_1_.func_180495_p(blockpos).func_185904_a(); ++ state = p_180709_1_.func_180495_p(blockpos); -- if (!p_180709_1_.func_180495_p(blockpos).func_177230_c().func_149730_j()) -+ if (p_180709_1_.func_180495_p(blockpos).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos)) +- if (material == Material.field_151579_a || material == Material.field_151584_j) ++ if (state.func_177230_c().canBeReplacedByLeaves(state, p_180709_1_, blockpos)) { this.func_175903_a(p_180709_1_, blockpos, this.field_150528_a); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch index 03b98a6c05..e24b762237 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch @@ -1,94 +1,98 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java -@@ -60,7 +60,7 @@ - { - Block block = p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)).func_177230_c(); +@@ -61,7 +61,7 @@ + IBlockState iblockstate = p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)); + Block block = iblockstate.func_177230_c(); -- if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j) -+ if (!block.isAir(p_180709_1_, blockpos$mutableblockpos.func_181079_c(l, j, i1)) && !block.isLeaves(p_180709_1_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) +- if (iblockstate.func_185904_a() != Material.field_151579_a && iblockstate.func_185904_a() != Material.field_151584_j) ++ if (!iblockstate.func_177230_c().isAir(iblockstate, p_180709_1_, blockpos$mutableblockpos.func_181079_c(l, j, i1)) && !iblockstate.func_177230_c().isLeaves(iblockstate, p_180709_1_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) { if (block != Blocks.field_150355_j && block != Blocks.field_150358_i) { -@@ -86,11 +86,13 @@ +@@ -87,11 +87,13 @@ } else { - Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); + BlockPos down = p_180709_3_.func_177977_b(); -+ Block block1 = p_180709_1_.func_180495_p(down).func_177230_c(); -+ boolean isSoil = block1.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); ++ IBlockState state = p_180709_1_.func_180495_p(down); ++ boolean isSoil = state.func_177230_c().canSustainPlant(state, p_180709_1_, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); - if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d) && p_180709_3_.func_177956_o() < 256 - i - 1) -+ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (isSoil && p_180709_3_.func_177956_o() < p_180709_1_.func_72800_K() - i - 1) { - this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); -+ block1.onPlantGrow(p_180709_1_, p_180709_3_.func_177977_b(),p_180709_3_); ++ state.func_177230_c().onPlantGrow(state, p_180709_1_, p_180709_3_.func_177977_b(),p_180709_3_); - for (int l1 = p_180709_3_.func_177956_o() - 3 + i; l1 <= p_180709_3_.func_177956_o() + i; ++l1) + for (int k1 = p_180709_3_.func_177956_o() - 3 + i; k1 <= p_180709_3_.func_177956_o() + i; ++k1) { -@@ -109,7 +111,7 @@ +@@ -109,8 +111,9 @@ + if (Math.abs(k3) != l2 || Math.abs(j1) != l2 || p_180709_2_.nextInt(2) != 0 && j2 != 0) { - BlockPos blockpos = new BlockPos(k3, l1, j1); + BlockPos blockpos = new BlockPos(j3, k1, i4); ++ state = p_180709_1_.func_180495_p(blockpos); -- if (!p_180709_1_.func_180495_p(blockpos).func_177230_c().func_149730_j()) -+ if (p_180709_1_.func_180495_p(blockpos).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos)) +- if (!p_180709_1_.func_180495_p(blockpos).func_185913_b()) ++ if (state.func_177230_c().canBeReplacedByLeaves(state, p_180709_1_, blockpos)) { this.func_175903_a(p_180709_1_, blockpos, field_181649_b); } -@@ -120,9 +122,10 @@ +@@ -121,10 +124,11 @@ - for (int i2 = 0; i2 < i; ++i2) + for (int l1 = 0; l1 < i; ++l1) { -- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(i2)).func_177230_c(); -+ BlockPos upN = p_180709_3_.func_177981_b(i2); -+ Block block2 = p_180709_1_.func_180495_p(upN).func_177230_c(); +- IBlockState iblockstate1 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(l1)); ++ BlockPos upN = p_180709_3_.func_177981_b(l1); ++ IBlockState iblockstate1 = p_180709_1_.func_180495_p(upN); + Block block2 = iblockstate1.func_177230_c(); -- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j || block2 == Blocks.field_150358_i || block2 == Blocks.field_150355_j) -+ if (block2.isAir(p_180709_1_, upN) || block2.isLeaves(p_180709_1_, upN) || block2 == Blocks.field_150358_i || block2 == Blocks.field_150355_j) +- if (iblockstate1.func_185904_a() == Material.field_151579_a || iblockstate1.func_185904_a() == Material.field_151584_j || block2 == Blocks.field_150358_i || block2 == Blocks.field_150355_j) ++ if (block2.isAir(iblockstate1, p_180709_1_, upN) || block2.isLeaves(iblockstate1, p_180709_1_, upN) || block2 == Blocks.field_150358_i || block2 == Blocks.field_150355_j) { - this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(i2), field_181648_a); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(l1), field_181648_a); } -@@ -140,29 +143,29 @@ - { - blockpos$mutableblockpos1.func_181079_c(i4, j2, j4); - -- if (p_180709_1_.func_180495_p(blockpos$mutableblockpos1).func_177230_c().func_149688_o() == Material.field_151584_j) -+ if (p_180709_1_.func_180495_p(blockpos$mutableblockpos1).func_177230_c().isLeaves(p_180709_1_, blockpos$mutableblockpos1)) - { - BlockPos blockpos3 = blockpos$mutableblockpos1.func_177976_e(); - BlockPos blockpos4 = blockpos$mutableblockpos1.func_177974_f(); +@@ -149,22 +153,22 @@ BlockPos blockpos1 = blockpos$mutableblockpos1.func_177978_c(); BlockPos blockpos2 = blockpos$mutableblockpos1.func_177968_d(); -- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos3).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos3).func_177230_c().isAir(p_180709_1_,blockpos3)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos3).func_185904_a() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && isAir(p_180709_1_, blockpos3)) { this.func_181647_a(p_180709_1_, blockpos3, BlockVine.field_176278_M); } -- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos4).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos4).func_177230_c().isAir(p_180709_1_,blockpos4)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos4).func_185904_a() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && isAir(p_180709_1_, blockpos4)) { this.func_181647_a(p_180709_1_, blockpos4, BlockVine.field_176280_O); } -- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_177230_c().isAir(p_180709_1_,blockpos1)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_185904_a() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && isAir(p_180709_1_, blockpos1)) { this.func_181647_a(p_180709_1_, blockpos1, BlockVine.field_176279_N); } -- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_177230_c().isAir(p_180709_1_,blockpos2)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_185904_a() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && isAir(p_180709_1_, blockpos2)) { this.func_181647_a(p_180709_1_, blockpos2, BlockVine.field_176273_b); } -@@ -191,7 +194,7 @@ +@@ -193,10 +197,16 @@ this.func_175903_a(p_181647_1_, p_181647_2_, iblockstate); int i = 4; -- for (p_181647_2_ = p_181647_2_.func_177977_b(); p_181647_1_.func_180495_p(p_181647_2_).func_177230_c().func_149688_o() == Material.field_151579_a && i > 0; --i) -+ for (p_181647_2_ = p_181647_2_.func_177977_b(); p_181647_1_.func_180495_p(p_181647_2_).func_177230_c().isAir(p_181647_1_,p_181647_2_) && i > 0; --i) +- for (p_181647_2_ = p_181647_2_.func_177977_b(); p_181647_1_.func_180495_p(p_181647_2_).func_185904_a() == Material.field_151579_a && i > 0; --i) ++ for (p_181647_2_ = p_181647_2_.func_177977_b(); isAir(p_181647_1_, p_181647_2_) && i > 0; --i) { this.func_175903_a(p_181647_1_, p_181647_2_, iblockstate); p_181647_2_ = p_181647_2_.func_177977_b(); + } + } ++ ++ private boolean isAir(World world, BlockPos pos) ++ { ++ IBlockState state = world.func_180495_p(pos); ++ return state.func_177230_c().isAir(state, world, pos); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch index a8ca161885..c2f74f7472 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch @@ -15,36 +15,38 @@ { - Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); + BlockPos down = p_180709_3_.func_177977_b(); -+ Block block = p_180709_1_.func_180495_p(down).func_177230_c(); -+ boolean isSoil = block.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g); ++ IBlockState state = p_180709_1_.func_180495_p(down); ++ boolean isSoil = state.func_177230_c().canSustainPlant(state, p_180709_1_, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g); - if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d) && p_180709_3_.func_177956_o() < 256 - i - 1) + if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) { - this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); -+ block.onPlantGrow(p_180709_1_, down, p_180709_3_); ++ state.func_177230_c().onPlantGrow(state, p_180709_1_, down, p_180709_3_); int k2 = 0; for (int l2 = p_180709_3_.func_177956_o() + i; l2 >= p_180709_3_.func_177956_o() + j; --l2) -@@ -93,7 +95,7 @@ +@@ -92,8 +94,9 @@ + if (Math.abs(k3) != k2 || Math.abs(j2) != k2 || k2 <= 0) { BlockPos blockpos = new BlockPos(j3, l2, i2); ++ state = p_180709_1_.func_180495_p(blockpos); -- if (!p_180709_1_.func_180495_p(blockpos).func_177230_c().func_149730_j()) -+ if (p_180709_1_.func_180495_p(blockpos).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos)) +- if (!p_180709_1_.func_180495_p(blockpos).func_185913_b()) ++ if (state.func_177230_c().canBeReplacedByLeaves(state, p_180709_1_, blockpos)) { this.func_175903_a(p_180709_1_, blockpos, field_181637_b); } -@@ -113,9 +115,10 @@ +@@ -113,9 +116,10 @@ for (int i3 = 0; i3 < i - 1; ++i3) { -- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(i3)).func_177230_c(); +- Material material = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(i3)).func_185904_a(); + BlockPos upN = p_180709_3_.func_177981_b(i3); -+ Block block1 = p_180709_1_.func_180495_p(upN).func_177230_c(); ++ state = p_180709_1_.func_180495_p(upN); -- if (block1.func_149688_o() == Material.field_151579_a || block1.func_149688_o() == Material.field_151584_j) -+ if (block1.isAir(p_180709_1_, upN) || block1.isLeaves(p_180709_1_, upN)) +- if (material == Material.field_151579_a || material == Material.field_151584_j) ++ if (state.func_177230_c().isAir(state, p_180709_1_, upN) || state.func_177230_c().isLeaves(state, p_180709_1_, upN)) { this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(i3), field_181636_a); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch index 8f79b84623..611141161b 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch @@ -1,37 +1,53 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java -@@ -55,7 +55,7 @@ - { - Block block = p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)).func_177230_c(); +@@ -30,7 +30,7 @@ + int l = 2 + p_180709_2_.nextInt(2); + boolean flag = true; -- if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j) -+ if (!block.isAir(p_180709_1_, blockpos$mutableblockpos) && !block.isLeaves(p_180709_1_, blockpos$mutableblockpos)) +- if (p_180709_3_.func_177956_o() >= 1 && p_180709_3_.func_177956_o() + i + 1 <= 256) ++ if (p_180709_3_.func_177956_o() >= 1 && p_180709_3_.func_177956_o() + i + 1 <= p_180709_1_.func_72800_K()) + { + for (int i1 = p_180709_3_.func_177956_o(); i1 <= p_180709_3_.func_177956_o() + 1 + i && flag; ++i1) + { +@@ -51,11 +51,11 @@ + { + for (int l1 = p_180709_3_.func_177952_p() - j1; l1 <= p_180709_3_.func_177952_p() + j1 && flag; ++l1) + { +- if (i1 >= 0 && i1 < 256) ++ if (i1 >= 0 && i1 < p_180709_1_.func_72800_K()) + { +- Material material = p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)).func_185904_a(); ++ IBlockState state = p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)); + +- if (material != Material.field_151579_a && material != Material.field_151584_j) ++ if (!state.func_177230_c().isAir(state, p_180709_1_, blockpos$mutableblockpos.func_181079_c(k1, i1, l1)) && !state.func_177230_c().isLeaves(state, p_180709_1_, blockpos$mutableblockpos.func_181079_c(k1, i1, l1))) { flag = false; } -@@ -74,11 +74,13 @@ +@@ -74,11 +74,12 @@ } else { -- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); +- Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); + BlockPos down = p_180709_3_.func_177977_b(); -+ Block block1 = p_180709_1_.func_180495_p(down).func_177230_c(); -+ boolean isSoil = block1.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g); ++ IBlockState state = p_180709_1_.func_180495_p(down); -- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d || block1 == Blocks.field_150458_ak) && p_180709_3_.func_177956_o() < 256 - i - 1) -+ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) +- if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d || block == Blocks.field_150458_ak) && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (state.func_177230_c().canSustainPlant(state, p_180709_1_, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g) && p_180709_3_.func_177956_o() < p_180709_1_.func_72800_K() - i - 1) { - this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); -+ block1.onPlantGrow(p_180709_1_, down, p_180709_3_); ++ state.func_177230_c().onPlantGrow(state, p_180709_1_, down, p_180709_3_); int i3 = p_180709_2_.nextInt(2); int j3 = 1; int k3 = 0; -@@ -99,7 +101,7 @@ +@@ -98,8 +99,9 @@ + if (Math.abs(j2) != i3 || Math.abs(l2) != i3 || i3 <= 0) { BlockPos blockpos = new BlockPos(i2, j4, k2); ++ state = p_180709_1_.func_180495_p(blockpos); -- if (!p_180709_1_.func_180495_p(blockpos).func_177230_c().func_149730_j()) -+ if (p_180709_1_.func_180495_p(blockpos).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos)) +- if (!p_180709_1_.func_180495_p(blockpos).func_185913_b()) ++ if (state.func_177230_c().canBeReplacedByLeaves(state, p_180709_1_, blockpos)) { this.func_175903_a(p_180709_1_, blockpos, field_181646_b); } @@ -39,12 +55,12 @@ for (int k4 = 0; k4 < i - i4; ++k4) { -- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(k4)).func_177230_c(); +- Material material1 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(k4)).func_185904_a(); + BlockPos upN = p_180709_3_.func_177981_b(k4); -+ Block block2 = p_180709_1_.func_180495_p(upN).func_177230_c(); ++ state = p_180709_1_.func_180495_p(upN); -- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j) -+ if (block2.isAir(p_180709_1_, upN) || block2.isLeaves(p_180709_1_, upN)) +- if (material1 == Material.field_151579_a || material1 == Material.field_151584_j) ++ if (state.func_177230_c().isAir(state, p_180709_1_, upN) || state.func_177230_c().isLeaves(state, p_180709_1_, upN)) { this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(k4), field_181645_a); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch index 40233c4b20..c100cd6a24 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch @@ -1,14 +1,16 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java -@@ -22,10 +22,12 @@ - { - Block block; +@@ -19,12 +19,12 @@ -- while (((block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c()).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 0) + public boolean func_180709_b(World p_180709_1_, Random p_180709_2_, BlockPos p_180709_3_) + { +- IBlockState iblockstate; +- +- while (((iblockstate = p_180709_1_.func_180495_p(p_180709_3_)).func_185904_a() == Material.field_151579_a || iblockstate.func_185904_a() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 0) + do { -+ block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); -+ if (!block.isAir(p_180709_1_, p_180709_3_) && !block.isLeaves(p_180709_1_, p_180709_3_)) break; ++ IBlockState state = p_180709_1_.func_180495_p(p_180709_3_); ++ if (!state.func_177230_c().isAir(state, p_180709_1_, p_180709_3_) && !state.func_177230_c().isLeaves(state, p_180709_1_, p_180709_3_)) break; p_180709_3_ = p_180709_3_.func_177977_b(); - } + } while (p_180709_3_.func_177956_o() > 0); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch index 74c9c14455..61034e3d19 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch @@ -1,94 +1,105 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java -@@ -68,7 +68,7 @@ +@@ -44,7 +44,7 @@ + int i = p_180709_2_.nextInt(3) + this.field_76533_a; + boolean flag = true; + +- if (p_180709_3_.func_177956_o() >= 1 && p_180709_3_.func_177956_o() + i + 1 <= 256) ++ if (p_180709_3_.func_177956_o() >= 1 && p_180709_3_.func_177956_o() + i + 1 <= p_180709_1_.func_72800_K()) + { + for (int j = p_180709_3_.func_177956_o(); j <= p_180709_3_.func_177956_o() + 1 + i; ++j) + { +@@ -66,9 +66,9 @@ + { + for (int i1 = p_180709_3_.func_177952_p() - k; i1 <= p_180709_3_.func_177952_p() + k && flag; ++i1) { - if (j >= 0 && j < 256) +- if (j >= 0 && j < 256) ++ if (j >= 0 && j < p_180709_1_.func_72800_K()) { - if (!this.func_150523_a(p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)).func_177230_c())) + if (!this.isReplaceable(p_180709_1_,blockpos$mutableblockpos.func_181079_c(l, j, i1))) { flag = false; } -@@ -87,11 +87,13 @@ +@@ -87,9 +87,9 @@ } else { -- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); -+ BlockPos down = p_180709_3_.func_177977_b(); -+ Block block1 = p_180709_1_.func_180495_p(down).func_177230_c(); -+ boolean isSoil = block1.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g); +- Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); ++ IBlockState state = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()); -- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d || block1 == Blocks.field_150458_ak) && p_180709_3_.func_177956_o() < 256 - i - 1) -+ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) +- if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d || block == Blocks.field_150458_ak) && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (state.func_177230_c().canSustainPlant(state, p_180709_1_, p_180709_3_.func_177977_b(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g) && p_180709_3_.func_177956_o() < p_180709_1_.func_72800_K() - i - 1) { -- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); -+ block1.onPlantGrow(p_180709_1_, down, p_180709_3_); + this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); int k2 = 3; - int l2 = 0; - -@@ -113,7 +115,7 @@ +@@ -111,9 +111,9 @@ + if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || p_180709_2_.nextInt(2) != 0 && i4 != 0) + { BlockPos blockpos = new BlockPos(k1, i3, i2); - Block block = p_180709_1_.func_180495_p(blockpos).func_177230_c(); +- Material material = p_180709_1_.func_180495_p(blockpos).func_185904_a(); ++ state = p_180709_1_.func_180495_p(blockpos); -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j || block.func_149688_o() == Material.field_151582_l) -+ if (block.isAir(p_180709_1_, blockpos) || block.isLeaves(p_180709_1_, blockpos) || block.func_149688_o() == Material.field_151582_l) +- if (material == Material.field_151579_a || material == Material.field_151584_j || material == Material.field_151582_l) ++ if (state.func_177230_c().isAir(state, p_180709_1_, blockpos) || state.func_177230_c().isLeaves(state, p_180709_1_, blockpos) || state.func_185904_a() == Material.field_151582_l) { this.func_175903_a(p_180709_1_, blockpos, this.field_76530_d); } -@@ -124,9 +126,10 @@ +@@ -124,9 +124,10 @@ for (int j3 = 0; j3 < i; ++j3) { -- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(j3)).func_177230_c(); +- Material material1 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(j3)).func_185904_a(); + BlockPos upN = p_180709_3_.func_177981_b(j3); -+ Block block2 = p_180709_1_.func_180495_p(upN).func_177230_c(); ++ state = p_180709_1_.func_180495_p(upN); -- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j || block2.func_149688_o() == Material.field_151582_l) -+ if (block2.isAir(p_180709_1_, upN) || block2.isLeaves(p_180709_1_, upN) || block2.func_149688_o() == Material.field_151582_l) +- if (material1 == Material.field_151579_a || material1 == Material.field_151584_j || material1 == Material.field_151582_l) ++ if (state.func_177230_c().isAir(state, p_180709_1_, upN) || state.func_177230_c().isLeaves(state, p_180709_1_, upN) || state.func_185904_a() == Material.field_151582_l) { this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(j3), this.field_76532_c); -@@ -169,29 +172,29 @@ +@@ -169,29 +170,30 @@ { blockpos$mutableblockpos1.func_181079_c(l4, k3, i5); -- if (p_180709_1_.func_180495_p(blockpos$mutableblockpos1).func_177230_c().func_149688_o() == Material.field_151584_j) -+ if (p_180709_1_.func_180495_p(blockpos$mutableblockpos1).func_177230_c().isLeaves(p_180709_1_,blockpos$mutableblockpos1)) +- if (p_180709_1_.func_180495_p(blockpos$mutableblockpos1).func_185904_a() == Material.field_151584_j) ++ state = p_180709_1_.func_180495_p(blockpos$mutableblockpos1); ++ if (state.func_177230_c().isLeaves(state, p_180709_1_, blockpos$mutableblockpos1)) { BlockPos blockpos2 = blockpos$mutableblockpos1.func_177976_e(); BlockPos blockpos3 = blockpos$mutableblockpos1.func_177974_f(); BlockPos blockpos4 = blockpos$mutableblockpos1.func_177978_c(); BlockPos blockpos1 = blockpos$mutableblockpos1.func_177968_d(); -- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_177230_c().isAir(p_180709_1_,blockpos2)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_185904_a() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_175623_d(blockpos2)) { this.func_181650_b(p_180709_1_, blockpos2, BlockVine.field_176278_M); } -- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos3).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos3).func_177230_c().isAir(p_180709_1_,blockpos3)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos3).func_185904_a() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_175623_d(blockpos3)) { this.func_181650_b(p_180709_1_, blockpos3, BlockVine.field_176280_O); } -- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos4).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos4).func_177230_c().isAir(p_180709_1_,blockpos4)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos4).func_185904_a() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_175623_d(blockpos4)) { this.func_181650_b(p_180709_1_, blockpos4, BlockVine.field_176279_N); } -- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_177230_c().isAir(p_180709_1_,blockpos1)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_185904_a() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_175623_d(blockpos1)) { this.func_181650_b(p_180709_1_, blockpos1, BlockVine.field_176273_b); } -@@ -245,7 +248,7 @@ +@@ -245,7 +247,7 @@ this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); int i = 4; -- for (p_181650_2_ = p_181650_2_.func_177977_b(); p_181650_1_.func_180495_p(p_181650_2_).func_177230_c().func_149688_o() == Material.field_151579_a && i > 0; --i) -+ for (p_181650_2_ = p_181650_2_.func_177977_b(); p_181650_1_.func_180495_p(p_181650_2_).func_177230_c().isAir(p_181650_1_,p_181650_2_) && i > 0; --i) +- for (p_181650_2_ = p_181650_2_.func_177977_b(); p_181650_1_.func_180495_p(p_181650_2_).func_185904_a() == Material.field_151579_a && i > 0; --i) ++ for (p_181650_2_ = p_181650_2_.func_177977_b(); p_181650_1_.func_175623_d(p_181650_2_) && i > 0; --i) { this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); p_181650_2_ = p_181650_2_.func_177977_b(); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch index 79027d1db9..3a95d326f3 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch @@ -1,17 +1,55 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java -@@ -26,10 +26,12 @@ +@@ -14,12 +14,12 @@ + { + public boolean func_180709_b(World p_180709_1_, Random p_180709_2_, BlockPos p_180709_3_) { - Block block; - -- while (((block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c()).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 1) +- IBlockState iblockstate; +- +- while (((iblockstate = p_180709_1_.func_180495_p(p_180709_3_)).func_185904_a() == Material.field_151579_a || iblockstate.func_185904_a() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 1) + do { -+ block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); -+ if (!block.isAir(p_180709_1_, p_180709_3_) && !block.isLeaves(p_180709_1_, p_180709_3_)) break; ++ IBlockState state = p_180709_1_.func_180495_p(p_180709_3_); ++ if (!state.func_177230_c().isAir(state, p_180709_1_, p_180709_3_) && !state.func_177230_c().isLeaves(state, p_180709_1_, p_180709_3_)) break; p_180709_3_ = p_180709_3_.func_177977_b(); - } + } while (p_180709_3_.func_177956_o() > 0); if (p_180709_3_.func_177956_o() < 1) { +@@ -33,7 +33,7 @@ + { + BlockPos blockpos = p_180709_3_.func_177982_a(p_180709_2_.nextInt(4) - p_180709_2_.nextInt(4), p_180709_2_.nextInt(3) - p_180709_2_.nextInt(3), p_180709_2_.nextInt(4) - p_180709_2_.nextInt(4)); + +- if (p_180709_1_.func_175623_d(blockpos) && p_180709_1_.func_180495_p(blockpos.func_177977_b()).func_185896_q()) ++ if (p_180709_1_.func_175623_d(blockpos) && p_180709_1_.func_180495_p(blockpos.func_177977_b()).isSideSolid(p_180709_1_, blockpos.func_177977_b(), net.minecraft.util.EnumFacing.UP)) + { + p_180709_1_.func_180501_a(blockpos, Blocks.field_150486_ae.func_176223_P(), 2); + TileEntity tileentity = p_180709_1_.func_175625_s(blockpos); +@@ -48,22 +48,22 @@ + BlockPos blockpos3 = blockpos.func_177978_c(); + BlockPos blockpos4 = blockpos.func_177968_d(); + +- if (p_180709_1_.func_175623_d(blockpos2) && p_180709_1_.func_180495_p(blockpos2.func_177977_b()).func_185896_q()) ++ if (p_180709_1_.func_175623_d(blockpos2) && p_180709_1_.func_180495_p(blockpos2.func_177977_b()).isSideSolid(p_180709_1_, blockpos2.func_177977_b(), net.minecraft.util.EnumFacing.UP)) + { + p_180709_1_.func_180501_a(blockpos2, Blocks.field_150478_aa.func_176223_P(), 2); + } + +- if (p_180709_1_.func_175623_d(blockpos1) && p_180709_1_.func_180495_p(blockpos1.func_177977_b()).func_185896_q()) ++ if (p_180709_1_.func_175623_d(blockpos1) && p_180709_1_.func_180495_p(blockpos1.func_177977_b()).isSideSolid(p_180709_1_, blockpos1.func_177977_b(), net.minecraft.util.EnumFacing.UP)) + { + p_180709_1_.func_180501_a(blockpos1, Blocks.field_150478_aa.func_176223_P(), 2); + } + +- if (p_180709_1_.func_175623_d(blockpos3) && p_180709_1_.func_180495_p(blockpos3.func_177977_b()).func_185896_q()) ++ if (p_180709_1_.func_175623_d(blockpos3) && p_180709_1_.func_180495_p(blockpos3.func_177977_b()).isSideSolid(p_180709_1_, blockpos3.func_177977_b(), net.minecraft.util.EnumFacing.UP)) + { + p_180709_1_.func_180501_a(blockpos3, Blocks.field_150478_aa.func_176223_P(), 2); + } + +- if (p_180709_1_.func_175623_d(blockpos4) && p_180709_1_.func_180495_p(blockpos4.func_177977_b()).func_185896_q()) ++ if (p_180709_1_.func_175623_d(blockpos4) && p_180709_1_.func_180495_p(blockpos4.func_177977_b()).isSideSolid(p_180709_1_, blockpos4.func_177977_b(), net.minecraft.util.EnumFacing.UP)) + { + p_180709_1_.func_180501_a(blockpos4, Blocks.field_150478_aa.func_176223_P(), 2); + } diff --git a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch index f1a5cfe3c0..e48365a9f5 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayer.java +++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayer.java -@@ -52,12 +52,12 @@ +@@ -49,12 +49,12 @@ i = 6; } @@ -16,16 +16,17 @@ GenLayer genlayerhills = new GenLayerHills(1000L, genlayerbiomeedge, lvt_10_1_); GenLayer genlayer5 = GenLayerZoom.func_75915_a(1000L, genlayerriverinit, 2); genlayer5 = GenLayerZoom.func_75915_a(1000L, genlayer5, j); -@@ -191,7 +191,7 @@ +@@ -158,8 +158,7 @@ protected static boolean func_151618_b(int p_151618_0_) { -- return p_151618_0_ == BiomeGenBase.field_76771_b.field_76756_M || p_151618_0_ == BiomeGenBase.field_150575_M.field_76756_M || p_151618_0_ == BiomeGenBase.field_76776_l.field_76756_M; +- BiomeGenBase biomegenbase = BiomeGenBase.func_150568_d(p_151618_0_); +- return biomegenbase == Biomes.field_76771_b || biomegenbase == Biomes.field_150575_M || biomegenbase == Biomes.field_76776_l; + return net.minecraftforge.common.BiomeManager.oceanBiomes.contains(BiomeGenBase.func_150568_d(p_151618_0_)); } protected int func_151619_a(int... p_151619_1_) -@@ -203,4 +203,27 @@ +@@ -171,4 +170,27 @@ { 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.func_151619_a(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_})))))))))); } diff --git a/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch index 5e2daee960..e0009992d4 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch @@ -1,20 +1,19 @@ --- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java +++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java -@@ -6,10 +6,9 @@ +@@ -7,10 +7,8 @@ public class GenLayerBiome extends GenLayer { -- private BiomeGenBase[] field_151623_c = new BiomeGenBase[] {BiomeGenBase.field_76769_d, BiomeGenBase.field_76769_d, BiomeGenBase.field_76769_d, BiomeGenBase.field_150588_X, BiomeGenBase.field_150588_X, BiomeGenBase.field_76772_c}; -- private BiomeGenBase[] field_151621_d = new BiomeGenBase[] {BiomeGenBase.field_76767_f, BiomeGenBase.field_150585_R, BiomeGenBase.field_76770_e, BiomeGenBase.field_76772_c, BiomeGenBase.field_150583_P, BiomeGenBase.field_76780_h}; -- private BiomeGenBase[] field_151622_e = new BiomeGenBase[] {BiomeGenBase.field_76767_f, BiomeGenBase.field_76770_e, BiomeGenBase.field_76768_g, BiomeGenBase.field_76772_c}; -- private BiomeGenBase[] field_151620_f = new BiomeGenBase[] {BiomeGenBase.field_76774_n, BiomeGenBase.field_76774_n, BiomeGenBase.field_76774_n, BiomeGenBase.field_150584_S}; +- private BiomeGenBase[] field_151623_c = new BiomeGenBase[] {Biomes.field_76769_d, Biomes.field_76769_d, Biomes.field_76769_d, Biomes.field_150588_X, Biomes.field_150588_X, Biomes.field_76772_c}; +- private BiomeGenBase[] field_151621_d = new BiomeGenBase[] {Biomes.field_76767_f, Biomes.field_150585_R, Biomes.field_76770_e, Biomes.field_76772_c, Biomes.field_150583_P, Biomes.field_76780_h}; +- private BiomeGenBase[] field_151622_e = new BiomeGenBase[] {Biomes.field_76767_f, Biomes.field_76770_e, Biomes.field_76768_g, Biomes.field_76772_c}; +- private BiomeGenBase[] field_151620_f = new BiomeGenBase[] {Biomes.field_76774_n, Biomes.field_76774_n, Biomes.field_76774_n, Biomes.field_150584_S}; + @SuppressWarnings("unchecked") + private java.util.List[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length]; -+ private final ChunkProviderSettings field_175973_g; public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_) -@@ -17,9 +16,30 @@ +@@ -18,9 +16,30 @@ super(p_i45560_1_); this.field_75909_a = p_i45560_3_; @@ -29,57 +28,57 @@ + + int desertIdx = net.minecraftforge.common.BiomeManager.BiomeType.DESERT.ordinal(); + -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_76769_d, 30)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_150588_X, 20)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_76772_c, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76769_d, 30)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_150588_X, 20)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76772_c, 10)); + if (p_i45560_4_ == WorldType.field_77136_e) { -- this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.field_76769_d, BiomeGenBase.field_76767_f, BiomeGenBase.field_76770_e, BiomeGenBase.field_76780_h, BiomeGenBase.field_76772_c, BiomeGenBase.field_76768_g}; +- this.field_151623_c = new BiomeGenBase[] {Biomes.field_76769_d, Biomes.field_76767_f, Biomes.field_76770_e, Biomes.field_76780_h, Biomes.field_76772_c, Biomes.field_76768_g}; + biomes[desertIdx].clear(); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_76769_d, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_76767_f, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_76770_e, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_76780_h, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_76772_c, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_76768_g, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76769_d, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76767_f, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76770_e, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76780_h, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76772_c, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76768_g, 10)); this.field_175973_g = null; } else if (p_i45560_4_ == WorldType.field_180271_f) -@@ -73,7 +93,7 @@ +@@ -74,7 +93,7 @@ } else { -- aint1[j + i * p_75904_3_] = this.field_151623_c[this.func_75902_a(this.field_151623_c.length)].field_76756_M; -+ aint1[j + i * p_75904_3_] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome.field_76756_M; +- aint1[j + i * p_75904_3_] = BiomeGenBase.func_185362_a(this.field_151623_c[this.func_75902_a(this.field_151623_c.length)]); ++ aint1[k + i * p_75904_3_] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome); } } else if (k == 2) -@@ -84,7 +104,7 @@ +@@ -85,7 +104,7 @@ } else { -- aint1[j + i * p_75904_3_] = this.field_151621_d[this.func_75902_a(this.field_151621_d.length)].field_76756_M; -+ aint1[j + i * p_75904_3_] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM).biome.field_76756_M; +- aint1[j + i * p_75904_3_] = BiomeGenBase.func_185362_a(this.field_151621_d[this.func_75902_a(this.field_151621_d.length)]); ++ aint1[j + i * p_75904_3_] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM).biome); } } else if (k == 3) -@@ -95,12 +115,12 @@ +@@ -96,12 +115,12 @@ } else { -- aint1[j + i * p_75904_3_] = this.field_151622_e[this.func_75902_a(this.field_151622_e.length)].field_76756_M; -+ aint1[j + i * p_75904_3_] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL).biome.field_76756_M; +- aint1[j + i * p_75904_3_] = BiomeGenBase.func_185362_a(this.field_151622_e[this.func_75902_a(this.field_151622_e.length)]); ++ aint1[j + i * p_75904_3_] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL).biome); } } else if (k == 4) { -- aint1[j + i * p_75904_3_] = this.field_151620_f[this.func_75902_a(this.field_151620_f.length)].field_76756_M; -+ aint1[j + i * p_75904_3_] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY).biome.field_76756_M; +- aint1[j + i * p_75904_3_] = BiomeGenBase.func_185362_a(this.field_151620_f[this.func_75902_a(this.field_151620_f.length)]); ++ aint1[j + i * p_75904_3_] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY).biome); } else { -@@ -111,4 +131,12 @@ +@@ -112,4 +131,12 @@ return aint1; } diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch deleted file mode 100644 index a1ba802896..0000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch +++ /dev/null @@ -1,79 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java -@@ -40,6 +40,12 @@ - { - } - -+ static -+ { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, field_74941_i, 2, 7); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); -+ } -+ - public DesertPyramid(Random p_i2062_1_, int p_i2062_2_, int p_i2062_3_) - { - super(p_i2062_1_, p_i2062_2_, 64, p_i2062_3_, 21, 15, 21); -@@ -258,7 +264,7 @@ - { - int l1 = enumfacing.func_82601_c() * 2; - int i2 = enumfacing.func_82599_e() * 2; -- this.field_74940_h[enumfacing.func_176736_b()] = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 10 + l1, -11, 10 + i2, WeightedRandomChestContent.func_177629_a(field_74941_i, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); -+ this.field_74940_h[enumfacing.func_176736_b()] = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 10 + l1, -11, 10 + i2, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, p_74875_2_)); - } - } - -@@ -362,6 +368,13 @@ - private static final List field_175815_j = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.field_151032_g, 0, 2, 7, 30)}); - private static ComponentScatteredFeaturePieces.JunglePyramid.Stones field_74942_n = new ComponentScatteredFeaturePieces.JunglePyramid.Stones(); - -+ static -+ { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_DISPENSER, field_175815_j, 2, 2); -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST, field_175816_i, 2, 7); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); -+ } -+ - public JunglePyramid() - { - } -@@ -518,9 +531,12 @@ - this.func_175811_a(p_74875_1_, Blocks.field_150488_af.func_176223_P(), 4, -3, 1, p_74875_3_); - this.func_175811_a(p_74875_1_, Blocks.field_150341_Y.func_176223_P(), 3, -3, 1, p_74875_3_); - -+ net.minecraftforge.common.ChestGenHooks dispenser = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_DISPENSER); -+ net.minecraftforge.common.ChestGenHooks chest = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST); -+ - if (!this.field_74945_j) - { -- this.field_74945_j = this.func_175806_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, -2, 1, EnumFacing.NORTH.func_176745_a(), field_175815_j, 2); -+ this.field_74945_j = this.func_175806_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, -2, 1, EnumFacing.NORTH.func_176745_a(), dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); - } - - this.func_175811_a(p_74875_1_, Blocks.field_150395_bd.func_176203_a(15), 3, -2, 2, p_74875_3_); -@@ -537,7 +553,7 @@ - - if (!this.field_74946_k) - { -- this.field_74946_k = this.func_175806_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -2, 3, EnumFacing.WEST.func_176745_a(), field_175815_j, 2); -+ this.field_74946_k = this.func_175806_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -2, 3, EnumFacing.WEST.func_176745_a(), dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); - } - - this.func_175811_a(p_74875_1_, Blocks.field_150395_bd.func_176203_a(15), 8, -1, 3, p_74875_3_); -@@ -545,7 +561,7 @@ - - if (!this.field_74947_h) - { -- this.field_74947_h = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 8, -3, 3, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); -+ this.field_74947_h = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 8, -3, 3, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); - } - - this.func_175811_a(p_74875_1_, Blocks.field_150341_Y.func_176223_P(), 9, -3, 2, p_74875_3_); -@@ -578,7 +594,7 @@ - - if (!this.field_74948_i) - { -- this.field_74948_i = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -3, 10, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); -+ this.field_74948_i = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -3, 10, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); - } - - return true; diff --git a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch index a296c5436d..81289f9368 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch @@ -1,15 +1,16 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java -@@ -28,11 +28,18 @@ +@@ -28,11 +28,19 @@ - for (BiomeGenBase biomegenbase : BiomeGenBase.func_150565_n()) + for (BiomeGenBase biomegenbase : BiomeGenBase.field_185377_q) { -- if (biomegenbase != null && biomegenbase.field_76748_D > 0.0F) -+ if (biomegenbase != null && biomegenbase.field_76748_D > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) +- if (biomegenbase != null && biomegenbase.func_185355_j() > 0.0F) ++ if (biomegenbase != null && biomegenbase.func_185355_j() > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) { this.field_151546_e.add(biomegenbase); } } ++ + for (BiomeGenBase biome : net.minecraftforge.common.BiomeManager.strongHoldBiomes) + { + if (!this.field_151546_e.contains(biome)) diff --git a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch index f97b0ccc36..628727ecee 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java -@@ -217,12 +217,12 @@ +@@ -221,12 +221,12 @@ { if (this.field_143029_e == null) { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch index 8c525a6128..0d04563b48 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureComponent.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureComponent.java -@@ -35,6 +35,10 @@ +@@ -38,6 +38,10 @@ - public NBTTagCompound func_143010_b() + public final NBTTagCompound func_143010_b() { + if (MapGenStructureIO.func_143036_a(this) == null) // Friendlier error then the Null String error below. + { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch deleted file mode 100644 index 3a37d8b4c6..0000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java -@@ -32,6 +32,12 @@ - MapGenStructureIO.func_143031_a(StructureMineshaftPieces.Stairs.class, "MSStairs"); - } - -+ static -+ { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR, field_175893_a, 8, 8); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); -+ } -+ - private static StructureComponent func_175892_a(List p_175892_0_, Random p_175892_1_, int p_175892_2_, int p_175892_3_, int p_175892_4_, EnumFacing p_175892_5_, int p_175892_6_) - { - int i = p_175892_1_.nextInt(100); -@@ -351,14 +357,15 @@ - this.func_175809_a(p_74875_1_, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k1 - 1, Blocks.field_150478_aa.func_176203_a(EnumFacing.UP.func_176745_a())); - this.func_175809_a(p_74875_1_, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k1 + 1, Blocks.field_150478_aa.func_176203_a(EnumFacing.UP.func_176745_a())); - -+ net.minecraftforge.common.ChestGenHooks info = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR); - if (p_74875_2_.nextInt(100) == 0) - { -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 2, 0, k1 - 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.field_175893_a, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 2, 0, k1 - 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); - } - - if (p_74875_2_.nextInt(100) == 0) - { -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 0, 0, k1 + 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.field_175893_a, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 0, 0, k1 + 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); - } - - if (this.field_74956_b && !this.field_74957_c) diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch deleted file mode 100644 index 8d9ab3d849..0000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java -@@ -154,7 +154,7 @@ - if (this.field_111021_b && p_74875_3_.func_175898_b(new BlockPos(this.func_74865_a(3, 3), this.func_74862_a(2), this.func_74873_b(3, 3)))) - { - this.field_111021_b = false; -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_)); - } - - this.func_175804_a(p_74875_1_, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.field_150385_bj.func_176223_P(), Blocks.field_150385_bj.func_176223_P(), false); -@@ -225,7 +225,7 @@ - if (this.field_111020_b && p_74875_3_.func_175898_b(new BlockPos(this.func_74865_a(1, 3), this.func_74862_a(2), this.func_74873_b(1, 3)))) - { - this.field_111020_b = false; -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 1, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 1, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_)); - } - - this.func_175804_a(p_74875_1_, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.field_150385_bj.func_176223_P(), Blocks.field_150385_bj.func_176223_P(), false); -@@ -943,6 +943,7 @@ - abstract static class Piece extends StructureComponent - { - protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.field_151045_i, 0, 1, 3, 5), new WeightedRandomChestContent(Items.field_151042_j, 0, 1, 5, 5), new WeightedRandomChestContent(Items.field_151043_k, 0, 1, 3, 15), new WeightedRandomChestContent(Items.field_151010_B, 0, 1, 1, 5), new WeightedRandomChestContent(Items.field_151171_ah, 0, 1, 1, 5), new WeightedRandomChestContent(Items.field_151033_d, 0, 1, 1, 5), new WeightedRandomChestContent(Items.field_151075_bm, 0, 3, 7, 5), new WeightedRandomChestContent(Items.field_151141_av, 0, 1, 1, 10), new WeightedRandomChestContent(Items.field_151136_bY, 0, 1, 1, 8), new WeightedRandomChestContent(Items.field_151138_bX, 0, 1, 1, 5), new WeightedRandomChestContent(Items.field_151125_bZ, 0, 1, 1, 3), new WeightedRandomChestContent(Item.func_150898_a(Blocks.field_150343_Z), 0, 2, 4, 2)}); -+ static { net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, field_111019_a, 2, 5); } - - public Piece() - { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch index 7ff46ea189..c8db28dbbd 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStart.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStart.java -@@ -62,6 +62,10 @@ +@@ -63,6 +63,10 @@ public NBTTagCompound func_143021_a(int p_143021_1_, int p_143021_2_) { @@ -11,7 +11,7 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); nbttagcompound.func_74778_a("id", MapGenStructureIO.func_143033_a(this)); nbttagcompound.func_74768_a("ChunkX", p_143021_1_); -@@ -97,7 +101,8 @@ +@@ -98,7 +102,8 @@ for (int i = 0; i < nbttaglist.func_74745_c(); ++i) { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch deleted file mode 100644 index 0d5ebc0bbd..0000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch +++ /dev/null @@ -1,75 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java -@@ -240,6 +240,12 @@ - { - } - -+ static -+ { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, field_75003_a, 2, 4); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); -+ } -+ - public ChestCorridor(int p_i45582_1_, Random p_i45582_2_, StructureBoundingBox p_i45582_3_, EnumFacing p_i45582_4_) - { - super(p_i45582_1_); -@@ -296,7 +302,7 @@ - if (!this.field_75002_c && p_74875_3_.func_175898_b(new BlockPos(this.func_74865_a(3, 3), this.func_74862_a(2), this.func_74873_b(3, 3)))) - { - this.field_75002_c = true; -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 2, 3, WeightedRandomChestContent.func_177629_a(field_75003_a, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(2)); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, p_74875_2_)); - } - - return true; -@@ -592,6 +598,12 @@ - private static final List field_75007_b = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.field_151122_aG, 0, 1, 3, 20), new WeightedRandomChestContent(Items.field_151121_aF, 0, 2, 7, 20), new WeightedRandomChestContent(Items.field_151148_bJ, 0, 1, 1, 1), new WeightedRandomChestContent(Items.field_151111_aL, 0, 1, 1, 1)}); - private boolean field_75008_c; - -+ static -+ { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY, field_75007_b, 1, 5); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 5, 2)); -+ } -+ - public Library() - { - } -@@ -736,12 +748,13 @@ - this.func_175811_a(p_74875_1_, Blocks.field_150478_aa.func_176223_P(), i1, 8, j1 + 1, p_74875_3_); - } - -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 3, 5, WeightedRandomChestContent.func_177629_a(field_75007_b, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92112_a(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); -+ net.minecraftforge.common.ChestGenHooks info = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 3, 5, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); - - if (this.field_75008_c) - { - this.func_175811_a(p_74875_1_, Blocks.field_150350_a.func_176223_P(), 12, 9, 1, p_74875_3_); -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 12, 8, 1, WeightedRandomChestContent.func_177629_a(field_75007_b, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92112_a(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 12, 8, 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); - } - - return true; -@@ -1013,6 +1026,12 @@ - private static final List field_75014_c = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.field_151042_j, 0, 1, 5, 10), new WeightedRandomChestContent(Items.field_151043_k, 0, 1, 3, 5), new WeightedRandomChestContent(Items.field_151137_ax, 0, 4, 9, 5), new WeightedRandomChestContent(Items.field_151044_h, 0, 3, 8, 10), new WeightedRandomChestContent(Items.field_151025_P, 0, 1, 3, 15), new WeightedRandomChestContent(Items.field_151034_e, 0, 1, 3, 15), new WeightedRandomChestContent(Items.field_151035_b, 0, 1, 1, 1)}); - protected int field_75013_b; - -+ static -+ { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, field_75014_c, 1, 5); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); -+ } -+ - public RoomCrossing() - { - } -@@ -1151,7 +1170,7 @@ - this.func_175811_a(p_74875_1_, Blocks.field_150468_ap.func_176203_a(this.func_151555_a(Blocks.field_150468_ap, EnumFacing.WEST.func_176745_a())), 9, 1, 3, p_74875_3_); - this.func_175811_a(p_74875_1_, Blocks.field_150468_ap.func_176203_a(this.func_151555_a(Blocks.field_150468_ap, EnumFacing.WEST.func_176745_a())), 9, 2, 3, p_74875_3_); - this.func_175811_a(p_74875_1_, Blocks.field_150468_ap.func_176203_a(this.func_151555_a(Blocks.field_150468_ap, EnumFacing.WEST.func_176745_a())), 9, 3, 3, p_74875_3_); -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 4, 8, WeightedRandomChestContent.func_177629_a(field_75014_c, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 1 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 4, 8, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, p_74875_2_)); - } - - return true; diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch index 43cc68cb17..4af3d40bf4 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java -@@ -57,6 +57,7 @@ +@@ -58,6 +58,7 @@ list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field2.class, 3, MathHelper.func_76136_a(p_75084_0_, 2 + p_75084_1_, 4 + p_75084_1_ * 2))); list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House2.class, 15, MathHelper.func_76136_a(p_75084_0_, 0, 1 + p_75084_1_))); list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House3.class, 8, MathHelper.func_76136_a(p_75084_0_, 0 + p_75084_1_, 3 + p_75084_1_ * 2))); @@ -8,7 +8,7 @@ Iterator iterator = list.iterator(); while (iterator.hasNext()) -@@ -129,6 +130,10 @@ +@@ -130,6 +131,10 @@ { structurevillagepieces$village = StructureVillagePieces.House3.func_175849_a(p_176065_0_, p_176065_2_, p_176065_3_, p_176065_4_, p_176065_5_, p_176065_6_, p_176065_7_, p_176065_8_); } @@ -19,28 +19,7 @@ return structurevillagepieces$village; } -@@ -833,6 +838,11 @@ - { - } - -+ static -+ { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, field_74918_a, 3, 8); -+ } -+ - public House2(StructureVillagePieces.Start p_i45563_1_, int p_i45563_2_, Random p_i45563_3_, StructureBoundingBox p_i45563_4_, EnumFacing p_i45563_5_) - { - super(p_i45563_1_, p_i45563_2_); -@@ -911,7 +921,7 @@ - if (!this.field_74917_c && p_74875_3_.func_175898_b(new BlockPos(this.func_74865_a(5, 5), this.func_74862_a(1), this.func_74873_b(5, 5)))) - { - this.field_74917_c = true; -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 5, 1, 5, field_74918_a, 3 + p_74875_2_.nextInt(6)); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 5, 1, 5, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, p_74875_2_)); - } - - for (int i = 6; i <= 8; ++i) -@@ -1403,6 +1413,7 @@ +@@ -1447,6 +1452,7 @@ public List field_74931_h; public List field_74932_i = Lists.newArrayList(); public List field_74930_j = Lists.newArrayList(); @@ -48,15 +27,15 @@ public Start() { -@@ -1416,6 +1427,7 @@ +@@ -1460,6 +1466,7 @@ this.field_74928_c = p_i2104_7_; - BiomeGenBase biomegenbase = p_i2104_1_.func_180300_a(new BlockPos(p_i2104_4_, 0, p_i2104_5_), BiomeGenBase.field_180279_ad); - this.field_74927_b = biomegenbase == BiomeGenBase.field_76769_d || biomegenbase == BiomeGenBase.field_76786_s; + BiomeGenBase biomegenbase = p_i2104_1_.func_180300_a(new BlockPos(p_i2104_4_, 0, p_i2104_5_), Biomes.field_180279_ad); + this.field_74927_b = biomegenbase == Biomes.field_76769_d || biomegenbase == Biomes.field_76786_s; + this.biome = biomegenbase; this.func_175846_a(this.field_74927_b); } -@@ -1477,6 +1489,7 @@ +@@ -1520,6 +1527,7 @@ protected int field_143015_k = -1; private int field_74896_a; private boolean field_143014_b; @@ -64,7 +43,7 @@ public Village() { -@@ -1489,6 +1502,7 @@ +@@ -1532,6 +1540,7 @@ if (p_i2107_1_ != null) { this.field_143014_b = p_i2107_1_.field_74927_b; @@ -72,7 +51,7 @@ } } -@@ -1613,6 +1627,9 @@ +@@ -1660,6 +1669,9 @@ protected IBlockState func_175847_a(IBlockState p_175847_1_) { diff --git a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch index 4bddcf6dab..4f6cfb7141 100644 --- a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch @@ -6,10 +6,10 @@ public int field_76199_b; - public byte field_76200_c; + public int field_76200_c; //FML byte -> int + public boolean field_186210_e; public byte field_76197_d; public byte[] field_76198_e = new byte[16384]; - public List field_76196_g = Lists.newArrayList(); -@@ -44,7 +44,17 @@ +@@ -45,7 +45,17 @@ public void func_76184_a(NBTTagCompound p_76184_1_) { @@ -28,7 +28,7 @@ this.field_76201_a = p_76184_1_.func_74762_e("xCenter"); this.field_76199_b = p_76184_1_.func_74762_e("zCenter"); this.field_76197_d = p_76184_1_.func_74771_c("scale"); -@@ -85,7 +95,7 @@ +@@ -96,7 +106,7 @@ public void func_76187_b(NBTTagCompound p_76187_1_) { @@ -37,7 +37,7 @@ p_76187_1_.func_74768_a("xCenter", this.field_76201_a); p_76187_1_.func_74768_a("zCenter", this.field_76199_b); p_76187_1_.func_74774_a("scale", this.field_76197_d); -@@ -164,7 +174,7 @@ +@@ -176,7 +186,7 @@ p_82567_8_ = p_82567_8_ + (p_82567_8_ < 0.0D ? -8.0D : 8.0D); b2 = (byte)((int)(p_82567_8_ * 16.0D / 360.0D)); diff --git a/patches/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch new file mode 100644 index 0000000000..5d70251ab4 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/world/storage/SaveFormatOld.java ++++ ../src-work/minecraft/net/minecraft/world/storage/SaveFormatOld.java +@@ -106,6 +106,24 @@ + } + } + ++ //Forge: Special version of the above that runs during actual world loading and not metadata gathering. ++ public static WorldInfo loadAndFix(File file, DataFixer fixer, SaveHandler save) ++ { ++ try ++ { ++ NBTTagCompound nbt = CompressedStreamTools.func_74796_a(new FileInputStream(file)); ++ WorldInfo info = new WorldInfo(fixer.func_188257_a(FixTypes.LEVEL, nbt.func_74775_l("Data"))); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(save, info, nbt); ++ return info; ++ } ++ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) { throw e; } ++ catch (Exception exception) ++ { ++ field_151479_b.error((String)("Exception reading " + file), (Throwable)exception); ++ return null; ++ } ++ } ++ + @SideOnly(Side.CLIENT) + public void func_75806_a(String p_75806_1_, String p_75806_2_) + { diff --git a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch index 6f920a6405..3cce351d0b 100644 --- a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch @@ -1,52 +1,26 @@ --- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java +++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java -@@ -104,20 +104,29 @@ - { - File file1 = new File(this.field_75770_b, "level.dat"); +@@ -117,7 +117,7 @@ -+ WorldInfo worldInfo = null; -+ if (file1.exists()) { - try +- WorldInfo worldinfo = SaveFormatOld.func_186353_a(file1, this.field_186341_a); ++ WorldInfo worldinfo = SaveFormatOld.loadAndFix(file1, this.field_186341_a, this); + + if (worldinfo != null) { - NBTTagCompound nbttagcompound2 = CompressedStreamTools.func_74796_a(new FileInputStream(file1)); - NBTTagCompound nbttagcompound3 = nbttagcompound2.func_74775_l("Data"); -- return new WorldInfo(nbttagcompound3); -+ worldInfo = new WorldInfo(nbttagcompound3); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound2); -+ return worldInfo; - } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) -+ { -+ throw e; -+ } - catch (Exception exception1) - { - exception1.printStackTrace(); +@@ -125,8 +125,9 @@ } } + net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); file1 = new File(this.field_75770_b, "level.dat_old"); +- return file1.exists() ? SaveFormatOld.func_186353_a(file1, this.field_186341_a) : null; ++ return file1.exists() ? SaveFormatOld.loadAndFix(file1, this.field_186341_a, this) : null; + } - if (file1.exists()) -@@ -126,7 +135,13 @@ - { - NBTTagCompound nbttagcompound = CompressedStreamTools.func_74796_a(new FileInputStream(file1)); - NBTTagCompound nbttagcompound1 = nbttagcompound.func_74775_l("Data"); -- return new WorldInfo(nbttagcompound1); -+ worldInfo = new WorldInfo(nbttagcompound1); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); -+ return worldInfo; -+ } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) -+ { -+ throw e; - } - catch (Exception exception) - { -@@ -143,6 +158,8 @@ + public void func_75755_a(WorldInfo p_75755_1_, NBTTagCompound p_75755_2_) +@@ -135,6 +136,8 @@ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.func_74782_a("Data", nbttagcompound); @@ -55,16 +29,7 @@ try { File file1 = new File(this.field_75770_b, "level.dat_new"); -@@ -181,6 +198,8 @@ - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.func_74782_a("Data", nbttagcompound); - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, p_75761_1_, nbttagcompound1); -+ - try - { - File file1 = new File(this.field_75770_b, "level.dat_new"); -@@ -229,6 +248,7 @@ +@@ -188,6 +191,7 @@ } file1.renameTo(file2); @@ -72,17 +37,17 @@ } catch (Exception var5) { -@@ -259,6 +279,7 @@ - p_75752_1_.func_70020_e(nbttagcompound); +@@ -218,6 +222,7 @@ + p_75752_1_.func_70020_e(this.field_186341_a.func_188257_a(FixTypes.PLAYER, nbttagcompound)); } + net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_75752_1_, field_75771_c, p_75752_1_.func_110124_au().toString()); return nbttagcompound; } -@@ -300,4 +321,22 @@ +@@ -259,4 +264,22 @@ { - return this.field_75767_f; + return this.field_186342_h; } + + public NBTTagCompound getPlayerNBT(net.minecraft.entity.player.EntityPlayerMP player) diff --git a/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch index 8085364515..5ffd902c3a 100644 --- a/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch @@ -1,18 +1,17 @@ --- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java +++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java -@@ -51,6 +51,7 @@ - private int field_176154_I = 5; +@@ -60,6 +60,7 @@ private int field_176155_J = 15; + private final Map field_186348_N = Maps.newEnumMap(DimensionType.class); private GameRules field_82577_x = new GameRules(); + private java.util.Map additionalProperties; protected WorldInfo() { -@@ -745,4 +746,24 @@ - } +@@ -785,6 +786,26 @@ }); } -+ + + /** + * Allow access to additional mod specific world based properties + * Used by FML to store mod list associated with a world, and maybe an id map @@ -32,4 +31,7 @@ + { + return this.additionalProperties!=null? this.additionalProperties.get(additionalProperty) : null; + } - } ++ + public NBTTagCompound func_186347_a(DimensionType p_186347_1_) + { + NBTTagCompound nbttagcompound = (NBTTagCompound)this.field_186348_N.get(p_186347_1_); From 4650ee2789642cd21f30da89623e9b63af39d8ab Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sun, 13 Mar 2016 04:40:03 +0300 Subject: [PATCH 077/243] Updated to latest mappings. Exc is broken, some anonymous classes didn't map to srg names. --- build.gradle | 2 +- .../net/minecraft/block/Block.java.patch | 4 +- .../renderer/block/model/BakedQuad.java.patch | 24 ++-- .../block/model/FaceBakery.java.patch | 6 +- .../renderer/texture/TextureMap.java.patch | 9 +- .../net/minecraft/init/Bootstrap.java.patch | 37 +++--- .../net/minecraft/item/Item.java.patch | 32 +++++ .../server/management/PlayerList.java.patch | 115 ++++++++++++------ .../client/ClientCommandHandler.java | 4 +- .../client/ForgeHooksClient.java | 5 +- .../minecraftforge/client/GuiIngameForge.java | 50 ++++---- .../client/model/BlockStateLoader.java | 4 +- .../client/model/IPerspectiveAwareModel.java | 6 +- .../client/model/ItemLayerModel.java | 6 +- .../client/model/ModelDynBucket.java | 8 +- .../client/model/ModelFluid.java | 8 +- .../client/model/ModelLoader.java | 24 ++-- .../client/model/MultiLayerModel.java | 14 +-- .../client/model/MultiModel.java | 16 +-- .../model/animation/AnimationModelBase.java | 6 +- .../client/model/animation/FastTESR.java | 2 +- .../client/model/b3d/B3DLoader.java | 8 +- .../client/model/obj/OBJModel.java | 8 +- .../client/model/pipeline/BlockInfo.java | 10 +- .../pipeline/ForgeBlockModelRenderer.java | 14 +-- .../client/model/pipeline/LightUtil.java | 8 +- .../model/pipeline/VertexLighterFlat.java | 4 +- .../common/BiomeDictionary.java | 40 +++--- .../common/DimensionManager.java | 2 +- .../net/minecraftforge/common/ForgeHooks.java | 28 ++--- .../common/WorldSpecificSaveHandler.java | 4 +- .../common/brewing/VanillaBrewingRecipe.java | 6 +- .../common/chunkio/ChunkIOProvider.java | 6 +- .../common/util/BlockSnapshot.java | 6 +- .../common/util/FakePlayer.java | 2 +- .../event/ForgeEventFactory.java | 2 +- .../event/entity/player/PlayerDropsEvent.java | 2 +- .../event/world/BlockEvent.java | 6 +- .../minecraftforge/fluids/BlockFluidBase.java | 16 +-- .../fluids/BlockFluidClassic.java | 2 +- .../net/minecraftforge/fluids/FluidUtil.java | 2 +- .../fluids/UniversalBucket.java | 6 +- .../minecraftforge/fml/client/GuiModList.java | 12 +- .../fml/client/GuiScrollingList.java | 52 ++++---- .../fml/client/SplashProgress.java | 4 +- .../fml/client/config/GuiUtils.java | 10 +- .../common/network/FMLOutboundHandler.java | 6 +- .../network/internal/EntitySpawnHandler.java | 2 +- .../common/network/internal/FMLMessage.java | 4 +- .../FMLControlledNamespacedRegistry.java | 4 +- .../items/ItemHandlerHelper.java | 4 +- .../items/wrapper/PlayerArmorInvWrapper.java | 2 +- .../server/command/ForgeCommand.java | 4 +- .../console/ConsoleCommandCompleter.java | 2 +- src/main/resources/forge.exc | 5 +- .../minecraftforge/debug/DynBucketTest.java | 4 +- .../debug/ModelAnimationDebug.java | 6 +- .../debug/ModelBakeEventDebug.java | 6 +- .../debug/PotionRegistryDebug.java | 12 +- .../test/ClientCommandTest.java | 6 +- .../minecraftforge/test/FOVModifierTest.java | 2 +- 61 files changed, 400 insertions(+), 311 deletions(-) diff --git a/build.gradle b/build.gradle index fc806e733c..814d3c3d56 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ apply plugin: "net.minecraftforge.gradle.launch4j" minecraft { version = "1.9" - mappings = 'stable_20' + mappings = 'snapshot_nodoc_20160312' //mappings = "snapshot_nodoc_20151122" workspaceDir = "projects" versionJson = "jsons/1.9-dev.json" diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index c7da6fc340..71acb3f7ca 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -166,9 +166,9 @@ } + + net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_4_, 0, 1.0f, true, p_180657_2_); -+ for (ItemStack stack : items) ++ for (ItemStack item : items) + { -+ func_180635_a(p_180657_1_, p_180657_3_, stack); ++ func_180635_a(p_180657_1_, p_180657_3_, item); + } } else diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch index 8a1013f885..e2758488c7 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java -@@ -6,15 +6,25 @@ +@@ -6,21 +6,31 @@ import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) @@ -18,15 +18,25 @@ + @Deprecated public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_) { +- this.field_178215_a = p_i46574_1_; +- this.field_178213_b = p_i46574_2_; +- this.field_178214_c = p_i46574_3_; +- this.field_187509_d = p_i46574_4_; + this(p_i46574_1_, p_i46574_2_, p_i46574_3_, p_i46574_4_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); -+ } -+ -+ public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_, net.minecraft.client.renderer.vertex.VertexFormat format) + } + ++ public BakedQuad(int[] vertexDataIn, int tintIndexIn, EnumFacing faceIn, TextureAtlasSprite spriteIn, net.minecraft.client.renderer.vertex.VertexFormat format) + { + this.format = format; - this.field_178215_a = p_i46574_1_; - this.field_178213_b = p_i46574_2_; - this.field_178214_c = p_i46574_3_; ++ this.field_178215_a = vertexDataIn; ++ this.field_178213_b = tintIndexIn; ++ this.field_178214_c = faceIn; ++ this.field_187509_d = spriteIn; ++ } ++ + public TextureAtlasSprite func_187508_a() + { + return this.field_187509_d; @@ -45,4 +55,17 @@ { return this.field_178214_c; diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch index 4380612607..2d771db866 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -15,7 +15,7 @@ { - blockfaceuv = this.func_188010_a(p_178414_3_.field_178243_e, p_178414_5_, p_178414_6_); + // TODO fix uvlock for custom rotations -+ //blockfaceuv = this.func_188010_a(face.blockFaceUV, facing, modelRotationIn); ++ //blockfaceuv = this.applyUVLock(face.blockFaceUV, facing, modelRotationIn); } - int[] aint = this.func_188012_a(blockfaceuv, p_178414_4_, p_178414_5_, this.func_178403_a(p_178414_1_, p_178414_2_), p_178414_6_, p_178414_7_, p_178414_9_); @@ -38,14 +38,14 @@ + return makeQuadVertexData(p_188012_1_, p_188012_2_, p_188012_3_, p_188012_4_, (net.minecraftforge.client.model.ITransformation)p_188012_5_, p_188012_6_, p_188012_7_); + } + -+ private int[] makeQuadVertexData(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, net.minecraftforge.client.model.ITransformation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) ++ private int[] makeQuadVertexData(BlockFaceUV uvs, TextureAtlasSprite sprite, EnumFacing orientation, float[] p_188012_4_, net.minecraftforge.client.model.ITransformation rotationIn, BlockPartRotation partRotation, boolean shade) + { int[] aint = new int[28]; for (int i = 0; i < 4; ++i) { - this.func_188015_a(aint, i, p_188012_3_, p_188012_1_, p_188012_4_, p_188012_2_, p_188012_5_, p_188012_6_, p_188012_7_); -+ this.fillVertexData(aint, i, p_188012_3_, p_188012_1_, p_188012_4_, p_188012_2_, p_188012_5_, p_188012_6_, p_188012_7_); ++ this.fillVertexData(aint, i, orientation, uvs, p_188012_4_, sprite, rotationIn, partRotation, shade); } return aint; diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 4a37adc65d..59156dd0f4 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -23,19 +23,20 @@ + this(p_i46100_1_, p_i46100_2_, false); + } + -+ public TextureMap(String p_i46100_1_, boolean skipFirst) ++ public TextureMap(String basePathIn, boolean skipFirst) + { -+ this(p_i46100_1_, null, skipFirst); ++ this(basePathIn, null, skipFirst); + } + -+ public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn, boolean skipFirst) ++ public TextureMap(String basePathIn, IIconCreator iconCreatorIn, boolean skipFirst) + { this.field_94258_i = Lists.newArrayList(); this.field_110574_e = Maps.newHashMap(); this.field_94252_e = Maps.newHashMap(); this.field_94249_f = new TextureAtlasSprite("missingno"); - this.field_94254_c = p_i46100_1_; +- this.field_94254_c = p_i46100_1_; - this.field_174946_m = p_i46100_2_; ++ this.field_94254_c = basePathIn; + this.field_174946_m = iconCreatorIn; + this.skipFirst = skipFirst && ENABLE_SKIP; } diff --git a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch index ab15f50df9..f57b0908c6 100644 --- a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch +++ b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch @@ -8,24 +8,25 @@ static void func_151353_a() { BlockDispenser.field_149943_a.func_82595_a(Items.field_151032_g, new BehaviorProjectileDispense() -@@ -87,9 +88,9 @@ +@@ -87,42 +88,42 @@ }); BlockDispenser.field_149943_a.func_82595_a(Items.field_185167_i, new BehaviorProjectileDispense() { - protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack p_82499_3_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack stack) { - EntityTippedArrow entitytippedarrow = new EntityTippedArrow(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); +- entitytippedarrow.func_184555_a(p_82499_3_); + EntityTippedArrow entitytippedarrow = new EntityTippedArrow(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); - entitytippedarrow.func_184555_a(p_82499_3_); ++ entitytippedarrow.func_184555_a(stack); entitytippedarrow.field_70251_a = EntityArrow.PickupStatus.ALLOWED; return entitytippedarrow; -@@ -97,32 +98,32 @@ + } }); BlockDispenser.field_149943_a.func_82595_a(Items.field_185166_h, new BehaviorProjectileDispense() { - protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack p_82499_3_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack stack) { - EntityArrow entityarrow = new EntitySpectralArrow(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); + EntityArrow entityarrow = new EntitySpectralArrow(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); @@ -36,7 +37,7 @@ BlockDispenser.field_149943_a.func_82595_a(Items.field_151110_aK, new BehaviorProjectileDispense() { - protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack p_82499_3_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack stack) { - return new EntityEgg(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); + return new EntityEgg(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); @@ -45,7 +46,7 @@ BlockDispenser.field_149943_a.func_82595_a(Items.field_151126_ay, new BehaviorProjectileDispense() { - protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack p_82499_3_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack stack) { - return new EntitySnowball(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); + return new EntitySnowball(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); @@ -54,7 +55,7 @@ BlockDispenser.field_149943_a.func_82595_a(Items.field_151062_by, new BehaviorProjectileDispense() { - protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack p_82499_3_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack stack) { - return new EntityExpBottle(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); + return new EntityExpBottle(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); @@ -71,7 +72,7 @@ return (new BehaviorProjectileDispense() { - protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack p_82499_3_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack stack) { - return new EntityPotion(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c(), p_82482_2_.func_77946_l()); + return new EntityPotion(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c(), stack.func_77946_l()); @@ -94,7 +95,7 @@ return (new BehaviorProjectileDispense() { - protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack p_82499_3_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack stack) { - return new EntityPotion(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c(), p_82482_2_.func_77946_l()); + return new EntityPotion(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c(), stack.func_77946_l()); @@ -144,11 +145,13 @@ } }); BlockDispenser.field_149943_a.func_82595_a(Items.field_151124_az, new Bootstrap.BehaviorDispenseBoat(EntityBoat.Type.OAK)); -@@ -245,20 +246,20 @@ +@@ -244,21 +245,21 @@ + BlockDispenser.field_149943_a.func_82595_a(Items.field_185153_aK, new Bootstrap.BehaviorDispenseBoat(EntityBoat.Type.ACACIA)); IBehaviorDispenseItem ibehaviordispenseitem = new BehaviorDefaultDispenseItem() { - private final BehaviorDefaultDispenseItem field_150841_b = new BehaviorDefaultDispenseItem(); +- private final BehaviorDefaultDispenseItem field_150841_b = new BehaviorDefaultDispenseItem(); - public ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) ++ private final BehaviorDefaultDispenseItem dispenseBehavior = new BehaviorDefaultDispenseItem(); + public ItemStack func_82487_b(IBlockSource source, ItemStack stack) { - ItemBucket itembucket = (ItemBucket)p_82487_2_.func_77973_b(); @@ -169,15 +172,17 @@ else { - return this.field_150841_b.func_82482_a(p_82487_1_, p_82487_2_); -+ return this.field_150841_b.func_82482_a(source, stack); ++ return this.dispenseBehavior.func_82482_a(source, stack); } } }; -@@ -267,10 +268,10 @@ +@@ -266,11 +267,11 @@ + BlockDispenser.field_149943_a.func_82595_a(Items.field_151131_as, ibehaviordispenseitem); BlockDispenser.field_149943_a.func_82595_a(Items.field_151133_ar, new BehaviorDefaultDispenseItem() { - private final BehaviorDefaultDispenseItem field_150840_b = new BehaviorDefaultDispenseItem(); +- private final BehaviorDefaultDispenseItem field_150840_b = new BehaviorDefaultDispenseItem(); - public ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) ++ private final BehaviorDefaultDispenseItem dispenseBehavior = new BehaviorDefaultDispenseItem(); + public ItemStack func_82487_b(IBlockSource source, ItemStack stack) { - World world = p_82487_1_.func_82618_k(); @@ -212,7 +217,7 @@ + else if (((TileEntityDispenser)source.func_150835_j()).func_146019_a(new ItemStack(item)) < 0) { - this.field_150840_b.func_82482_a(p_82487_1_, new ItemStack(item)); -+ this.field_150840_b.func_82482_a(source, new ItemStack(item)); ++ this.dispenseBehavior.func_82482_a(source, new ItemStack(item)); } - return p_82487_2_; diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 46f446cc99..2ac6bf28a4 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -11,6 +11,38 @@ private static final IItemPropertyGetter field_185046_b = new IItemPropertyGetter() { @SideOnly(Side.CLIENT) +@@ -71,25 +71,25 @@ + private static final IItemPropertyGetter field_185047_c = new IItemPropertyGetter() + { + @SideOnly(Side.CLIENT) +- public float func_185085_a(ItemStack p_185085_1_, World p_185085_2_, EntityLivingBase p_185085_3_) ++ public float func_185085_a(ItemStack stack, World worldIn, EntityLivingBase entityIn) + { +- return MathHelper.func_76131_a((float)p_185085_1_.func_77952_i() / (float)p_185085_1_.func_77958_k(), 0.0F, 1.0F); ++ return MathHelper.func_76131_a((float)stack.func_77952_i() / (float)stack.func_77958_k(), 0.0F, 1.0F); + } + }; + private static final IItemPropertyGetter field_185048_d = new IItemPropertyGetter() + { + @SideOnly(Side.CLIENT) +- public float func_185085_a(ItemStack p_185085_1_, World p_185085_2_, EntityLivingBase p_185085_3_) ++ public float func_185085_a(ItemStack stack, World worldIn, EntityLivingBase entityIn) + { +- return p_185085_3_ != null && p_185085_3_.func_184591_cq() != EnumHandSide.RIGHT ? 1.0F : 0.0F; ++ return entityIn != null && entityIn.func_184591_cq() != EnumHandSide.RIGHT ? 1.0F : 0.0F; + } + }; + private static final IItemPropertyGetter field_185049_e = new IItemPropertyGetter() + { + @SideOnly(Side.CLIENT) +- public float func_185085_a(ItemStack p_185085_1_, World p_185085_2_, EntityLivingBase p_185085_3_) ++ public float func_185085_a(ItemStack stack, World worldIn, EntityLivingBase entityIn) + { +- return p_185085_3_ instanceof EntityPlayer ? ((EntityPlayer)p_185085_3_).func_184811_cZ().func_185143_a(p_185085_1_.func_77973_b(), 0.0F) : 0.0F; ++ return entityIn instanceof EntityPlayer ? ((EntityPlayer)entityIn).func_184811_cZ().func_185143_a(stack.func_77973_b(), 0.0F) : 0.0F; + } + }; + private final IRegistry field_185051_m = new RegistrySimple(); @@ -104,6 +104,9 @@ private Item field_77700_c; private String field_77774_bZ; diff --git a/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch index 8e24f9923a..89f16a9e86 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch @@ -246,34 +246,53 @@ return entityplayermp; } -@@ -545,15 +589,20 @@ +@@ -545,102 +589,118 @@ public void func_187242_a(EntityPlayerMP p_187242_1_, int p_187242_2_) { +- int i = p_187242_1_.field_71093_bK; +- WorldServer worldserver = this.field_72400_f.func_71218_a(p_187242_1_.field_71093_bK); +- p_187242_1_.field_71093_bK = p_187242_2_; +- WorldServer worldserver1 = this.field_72400_f.func_71218_a(p_187242_1_.field_71093_bK); +- p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, p_187242_1_.field_70170_p.func_175659_aa(), p_187242_1_.field_70170_p.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b())); +- this.func_187243_f(p_187242_1_); +- worldserver.func_72973_f(p_187242_1_); +- p_187242_1_.field_70128_L = false; +- this.func_82448_a(p_187242_1_, i, worldserver, worldserver1); +- this.func_72375_a(p_187242_1_, worldserver); +- p_187242_1_.field_71135_a.func_147364_a(p_187242_1_.field_70165_t, p_187242_1_.field_70163_u, p_187242_1_.field_70161_v, p_187242_1_.field_70177_z, p_187242_1_.field_70125_A); +- p_187242_1_.field_71134_c.func_73080_a(worldserver1); +- p_187242_1_.field_71135_a.func_147359_a(new SPacketPlayerAbilities(p_187242_1_.field_71075_bZ)); +- this.func_72354_b(p_187242_1_, worldserver1); +- this.func_72385_f(p_187242_1_); + transferPlayerToDimension(p_187242_1_, p_187242_2_, field_72400_f.func_71218_a(p_187242_2_).func_85176_s()); + } -+ -+ public void transferPlayerToDimension(EntityPlayerMP p_187242_1_, int p_187242_2_, net.minecraft.world.Teleporter teleporter) + +- for (PotionEffect potioneffect : p_187242_1_.func_70651_bq()) ++ public void transferPlayerToDimension(EntityPlayerMP player, int dimensionIn, net.minecraft.world.Teleporter teleporter) + { - int i = p_187242_1_.field_71093_bK; - WorldServer worldserver = this.field_72400_f.func_71218_a(p_187242_1_.field_71093_bK); - p_187242_1_.field_71093_bK = p_187242_2_; - WorldServer worldserver1 = this.field_72400_f.func_71218_a(p_187242_1_.field_71093_bK); -- p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, p_187242_1_.field_70170_p.func_175659_aa(), p_187242_1_.field_70170_p.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b())); -+ p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, worldserver1.func_175659_aa(), worldserver1.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b())); - this.func_187243_f(p_187242_1_); - worldserver.func_72973_f(p_187242_1_); - p_187242_1_.field_70128_L = false; -- this.func_82448_a(p_187242_1_, i, worldserver, worldserver1); -+ this.transferEntityToWorld(p_187242_1_, i, worldserver, worldserver1, teleporter); - this.func_72375_a(p_187242_1_, worldserver); - p_187242_1_.field_71135_a.func_147364_a(p_187242_1_.field_70165_t, p_187242_1_.field_70163_u, p_187242_1_.field_70161_v, p_187242_1_.field_70177_z, p_187242_1_.field_70125_A); - p_187242_1_.field_71134_c.func_73080_a(worldserver1); -@@ -565,39 +614,50 @@ ++ int i = player.field_71093_bK; ++ WorldServer worldserver = this.field_72400_f.func_71218_a(player.field_71093_bK); ++ player.field_71093_bK = dimensionIn; ++ WorldServer worldserver1 = this.field_72400_f.func_71218_a(player.field_71093_bK); ++ player.field_71135_a.func_147359_a(new SPacketRespawn(player.field_71093_bK, worldserver1.func_175659_aa(), worldserver1.func_72912_H().func_76067_t(), player.field_71134_c.func_73081_b())); ++ this.func_187243_f(player); ++ worldserver.func_72973_f(player); ++ player.field_70128_L = false; ++ this.transferEntityToWorld(player, i, worldserver, worldserver1, teleporter); ++ this.func_72375_a(player, worldserver); ++ player.field_71135_a.func_147364_a(player.field_70165_t, player.field_70163_u, player.field_70161_v, player.field_70177_z, player.field_70125_A); ++ player.field_71134_c.func_73080_a(worldserver1); ++ player.field_71135_a.func_147359_a(new SPacketPlayerAbilities(player.field_71075_bZ)); ++ this.func_72354_b(player, worldserver1); ++ this.func_72385_f(player); ++ ++ for (PotionEffect potioneffect : player.func_70651_bq()) { - p_187242_1_.field_71135_a.func_147359_a(new SPacketEntityEffect(p_187242_1_.func_145782_y(), potioneffect)); +- p_187242_1_.field_71135_a.func_147359_a(new SPacketEntityEffect(p_187242_1_.func_145782_y(), potioneffect)); ++ player.field_71135_a.func_147359_a(new SPacketEntityEffect(player.func_145782_y(), potioneffect)); } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_187242_1_, i, p_187242_2_); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, i, dimensionIn); } public void func_82448_a(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) @@ -284,46 +303,51 @@ + } + + @SuppressWarnings("unused") -+ public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter) ++ public void transferEntityToWorld(Entity entityIn, int lastDimension, WorldServer oldWorldIn, WorldServer toWorldIn, net.minecraft.world.Teleporter teleporter) + { -+ net.minecraft.world.WorldProvider pOld = p_82448_3_.field_73011_w; -+ net.minecraft.world.WorldProvider pNew = p_82448_4_.field_73011_w; ++ net.minecraft.world.WorldProvider pOld = oldWorldIn.field_73011_w; ++ net.minecraft.world.WorldProvider pNew = toWorldIn.field_73011_w; + double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor(); + double d0 = entityIn.field_70165_t * moveFactor; + double d1 = entityIn.field_70161_v * moveFactor; double d2 = 8.0D; - float f = p_82448_1_.field_70177_z; +- p_82448_3_.field_72984_F.func_76320_a("moving"); + float f = entityIn.field_70177_z; - p_82448_3_.field_72984_F.func_76320_a("moving"); ++ oldWorldIn.field_72984_F.func_76320_a("moving"); - if (p_82448_1_.field_71093_bK == -1) + if (false && entityIn.field_71093_bK == -1) { - d0 = MathHelper.func_151237_a(d0 / d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); - d1 = MathHelper.func_151237_a(d1 / d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); +- d0 = MathHelper.func_151237_a(d0 / d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); +- d1 = MathHelper.func_151237_a(d1 / d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); - p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); ++ d0 = MathHelper.func_151237_a(d0 / d2, toWorldIn.func_175723_af().func_177726_b() + 16.0D, toWorldIn.func_175723_af().func_177728_d() - 16.0D); ++ d1 = MathHelper.func_151237_a(d1 / d2, toWorldIn.func_175723_af().func_177736_c() + 16.0D, toWorldIn.func_175723_af().func_177733_e() - 16.0D); + entityIn.func_70012_b(d0, entityIn.field_70163_u, d1, entityIn.field_70177_z, entityIn.field_70125_A); - if (p_82448_1_.func_70089_S()) + if (entityIn.func_70089_S()) { - p_82448_3_.func_72866_a(p_82448_1_, false); -+ p_82448_3_.func_72866_a(entityIn, false); ++ oldWorldIn.func_72866_a(entityIn, false); } } - else if (p_82448_1_.field_71093_bK == 0) + else if (false && entityIn.field_71093_bK == 0) { - d0 = MathHelper.func_151237_a(d0 * d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); - d1 = MathHelper.func_151237_a(d1 * d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); +- d0 = MathHelper.func_151237_a(d0 * d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); +- d1 = MathHelper.func_151237_a(d1 * d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); - p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); ++ d0 = MathHelper.func_151237_a(d0 * d2, toWorldIn.func_175723_af().func_177726_b() + 16.0D, toWorldIn.func_175723_af().func_177728_d() - 16.0D); ++ d1 = MathHelper.func_151237_a(d1 * d2, toWorldIn.func_175723_af().func_177736_c() + 16.0D, toWorldIn.func_175723_af().func_177733_e() - 16.0D); + entityIn.func_70012_b(d0, entityIn.field_70163_u, d1, entityIn.field_70177_z, entityIn.field_70125_A); - if (p_82448_1_.func_70089_S()) + if (entityIn.func_70089_S()) { - p_82448_3_.func_72866_a(p_82448_1_, false); -+ p_82448_3_.func_72866_a(entityIn, false); ++ oldWorldIn.func_72866_a(entityIn, false); } } - else @@ -332,7 +356,16 @@ { BlockPos blockpos; -@@ -611,13 +671,13 @@ +- if (p_82448_2_ == 1) ++ if (lastDimension == 1) + { +- blockpos = p_82448_4_.func_175694_M(); ++ blockpos = toWorldIn.func_175694_M(); + } + else + { +- blockpos = p_82448_4_.func_180504_m(); ++ blockpos = toWorldIn.func_180504_m(); } d0 = (double)blockpos.func_177958_n(); @@ -346,11 +379,18 @@ + if (entityIn.func_70089_S()) { - p_82448_3_.func_72866_a(p_82448_1_, false); -+ p_82448_3_.func_72866_a(entityIn, false); ++ oldWorldIn.func_72866_a(entityIn, false); } } -@@ -629,18 +689,18 @@ +- p_82448_3_.field_72984_F.func_76319_b(); ++ oldWorldIn.field_72984_F.func_76319_b(); + +- if (p_82448_2_ != 1) ++ if (lastDimension != 1) + { +- p_82448_3_.field_72984_F.func_76320_a("placing"); ++ oldWorldIn.field_72984_F.func_76320_a("placing"); d0 = (double)MathHelper.func_76125_a((int)d0, -29999872, 29999872); d1 = (double)MathHelper.func_76125_a((int)d1, -29999872, 29999872); @@ -363,15 +403,16 @@ - p_82448_4_.func_72866_a(p_82448_1_, false); + entityIn.func_70012_b(d0, entityIn.field_70163_u, d1, entityIn.field_70177_z, entityIn.field_70125_A); + teleporter.func_180266_a(entityIn, f); -+ p_82448_4_.func_72838_d(entityIn); -+ p_82448_4_.func_72866_a(entityIn, false); ++ toWorldIn.func_72838_d(entityIn); ++ toWorldIn.func_72866_a(entityIn, false); } - p_82448_3_.field_72984_F.func_76319_b(); +- p_82448_3_.field_72984_F.func_76319_b(); ++ oldWorldIn.field_72984_F.func_76319_b(); } - p_82448_1_.func_70029_a(p_82448_4_); -+ entityIn.func_70029_a(p_82448_4_); ++ entityIn.func_70029_a(toWorldIn); } public void func_72374_b() diff --git a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java index 968b944829..be724ebfe5 100644 --- a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java +++ b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java @@ -58,7 +58,7 @@ public class ClientCommandHandler extends CommandHandler return 0; } - if (icommand.func_184882_a(this.func_184879_a(), sender)) + if (icommand.checkPermission(this.getServer(), sender)) { CommandEvent event = new CommandEvent(icommand, sender, args); if (MinecraftForge.EVENT_BUS.post(event)) @@ -139,7 +139,7 @@ public class ClientCommandHandler extends CommandHandler } @Override - protected MinecraftServer func_184879_a() { + protected MinecraftServer getServer() { return Minecraft.getMinecraft().getIntegratedServer(); } } diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 55fa5373c1..45f830adef 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -31,7 +31,6 @@ 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.ItemTransformVec3f; -import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelManager; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.model.ModelRotation; @@ -408,7 +407,7 @@ public class ForgeHooksClient else { //if(leftHandHackery) GlStateManager.scale(-1, 1, 1); - ItemCameraTransforms.func_188034_a(model.getItemCameraTransforms().getTransform(cameraTransformType), leftHandHackery); + ItemCameraTransforms.applyTransformSide(model.getItemCameraTransforms().getTransform(cameraTransformType), leftHandHackery); //if(leftHandHackery) GlStateManager.scale(-1, 1, 1); } return model; @@ -436,7 +435,7 @@ public class ForgeHooksClient VertexFormatElement attr = format.getElement(element); int count = attr.getElementCount(); int constant = attr.getType().getGlConstant(); - buffer.position(format.func_181720_d(element)); + buffer.position(format.getOffset(element)); switch(attrType) { case POSITION: diff --git a/src/main/java/net/minecraftforge/client/GuiIngameForge.java b/src/main/java/net/minecraftforge/client/GuiIngameForge.java index 9e607658fd..267356b943 100644 --- a/src/main/java/net/minecraftforge/client/GuiIngameForge.java +++ b/src/main/java/net/minecraftforge/client/GuiIngameForge.java @@ -88,8 +88,8 @@ public class GuiIngameForge extends GuiIngame eventParent = new RenderGameOverlayEvent(partialTicks, res); int width = res.getScaledWidth(); int height = res.getScaledHeight(); - renderHealthMount = mc.thePlayer.func_184187_bx() instanceof EntityLivingBase; - renderFood = mc.thePlayer.func_184187_bx() == null; + renderHealthMount = mc.thePlayer.getRidingEntity() instanceof EntityLivingBase; + renderFood = mc.thePlayer.getRidingEntity() == null; renderJumpBar = mc.thePlayer.isRidingHorse(); right_height = 39; @@ -108,7 +108,7 @@ public class GuiIngameForge extends GuiIngame else { GlStateManager.enableDepth(); - GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); } if (renderHelmet) renderHelmet(res, partialTicks); @@ -118,7 +118,7 @@ public class GuiIngameForge extends GuiIngame renderPortal(res, partialTicks); } - if (renderHotbar) renderTooltip(res, partialTicks); + if (renderHotbar) renderHotbar(res, partialTicks); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); zLevel = -90.0F; @@ -194,21 +194,21 @@ public class GuiIngameForge extends GuiIngame { if (pre(CROSSHAIRS)) return; bind(Gui.icons); - super.func_184045_a(partialTicks, res); + super.renderAttackIndicator(partialTicks, res); post(CROSSHAIRS); } protected void renderPotionIcons(ScaledResolution resolution) { if (pre(POTION_ICONS)) return; - super.func_184048_a(resolution); + super.renderPotionEffects(resolution); post(POTION_ICONS); } protected void renderSubtitles(ScaledResolution resolution) { if (pre(SUBTITLES)) return; - this.field_184049_t.func_184068_a(res); + this.overlaySubtitle.renderSubtitles(res); post(SUBTITLES); } @@ -217,10 +217,10 @@ public class GuiIngameForge extends GuiIngame { if (pre(BOSSHEALTH)) return; bind(Gui.icons); - GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); mc.mcProfiler.startSection("bossHealth"); GlStateManager.enableBlend(); - this.field_184050_w.func_184051_a(); + this.overlayBoss.renderBossHealth(); GlStateManager.disableBlend(); mc.mcProfiler.endSection(); post(BOSSHEALTH); @@ -295,7 +295,7 @@ public class GuiIngameForge extends GuiIngame } @Override - protected void renderTooltip(ScaledResolution res, float partialTicks) + protected void renderHotbar(ScaledResolution res, float partialTicks) { if (pre(HOTBAR)) return; @@ -305,7 +305,7 @@ public class GuiIngameForge extends GuiIngame } else { - super.renderTooltip(res, partialTicks); + super.renderHotbar(res, partialTicks); } post(HOTBAR); @@ -370,7 +370,7 @@ public class GuiIngameForge extends GuiIngame this.playerHealth = health; int healthLast = this.lastPlayerHealth; - IAttributeInstance attrMaxHealth = player.getEntityAttribute(SharedMonsterAttributes.maxHealth); + IAttributeInstance attrMaxHealth = player.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH); float healthMax = (float)attrMaxHealth.getAttributeValue(); float absorb = MathHelper.ceiling_float_int(player.getAbsorptionAmount()); @@ -626,7 +626,7 @@ public class GuiIngameForge extends GuiIngame GlStateManager.pushMatrix(); GlStateManager.enableBlend(); - GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); FontRenderer font = highlightingItemStack.getItem().getFontRenderer(highlightingItemStack); if (font != null) { @@ -647,7 +647,7 @@ public class GuiIngameForge extends GuiIngame } else if (this.mc.thePlayer.isSpectator()) { - this.spectatorGui.func_175263_a(res); + this.spectatorGui.renderSelectedItem(res); } } @@ -720,7 +720,7 @@ public class GuiIngameForge extends GuiIngame GlStateManager.pushMatrix(); GlStateManager.translate((float)(width / 2), (float)(height - 68), 0.0F); GlStateManager.enableBlend(); - GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); int color = (recordIsPlaying ? Color.HSBtoRGB(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE); fontrenderer.drawString(recordPlaying, -fontrenderer.getStringWidth(recordPlaying) / 2, -4, color | (opacity << 24)); GlStateManager.disableBlend(); @@ -733,18 +733,18 @@ public class GuiIngameForge extends GuiIngame protected void renderTitle(int width, int height, float partialTicks) { - if (field_175195_w > 0) + if (titlesTimer > 0) { mc.mcProfiler.startSection("titleAndSubtitle"); - float age = (float)this.field_175195_w - partialTicks; + float age = (float)this.titlesTimer - partialTicks; int opacity = 255; - if (field_175195_w > field_175193_B + field_175192_A) + if (titlesTimer > titleFadeOut + titleDisplayTime) { - float f3 = (float)(field_175199_z + field_175192_A + field_175193_B) - age; - opacity = (int)(f3 * 255.0F / (float)field_175199_z); + float f3 = (float)(titleFadeIn + titleDisplayTime + titleFadeOut) - age; + opacity = (int)(f3 * 255.0F / (float)titleFadeIn); } - if (field_175195_w <= field_175193_B) opacity = (int)(age * 255.0F / (float)this.field_175193_B); + if (titlesTimer <= titleFadeOut) opacity = (int)(age * 255.0F / (float)this.titleFadeOut); opacity = MathHelper.clamp_int(opacity, 0, 255); @@ -753,15 +753,15 @@ public class GuiIngameForge extends GuiIngame GlStateManager.pushMatrix(); GlStateManager.translate((float)(width / 2), (float)(height / 2), 0.0F); GlStateManager.enableBlend(); - GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.pushMatrix(); GlStateManager.scale(4.0F, 4.0F, 4.0F); int l = opacity << 24 & -16777216; - this.getFontRenderer().drawString(this.field_175201_x, (float)(-this.getFontRenderer().getStringWidth(this.field_175201_x) / 2), -10.0F, 16777215 | l, true); + this.getFontRenderer().drawString(this.displayedTitle, (float)(-this.getFontRenderer().getStringWidth(this.displayedTitle) / 2), -10.0F, 16777215 | l, true); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); GlStateManager.scale(2.0F, 2.0F, 2.0F); - this.getFontRenderer().drawString(this.field_175200_y, (float)(-this.getFontRenderer().getStringWidth(this.field_175200_y) / 2), 5.0F, 16777215 | l, true); + this.getFontRenderer().drawString(this.displayedSubTitle, (float)(-this.getFontRenderer().getStringWidth(this.displayedSubTitle) / 2), 5.0F, 16777215 | l, true); GlStateManager.popMatrix(); GlStateManager.disableBlend(); GlStateManager.popMatrix(); @@ -809,7 +809,7 @@ public class GuiIngameForge extends GuiIngame protected void renderHealthMount(int width, int height) { EntityPlayer player = (EntityPlayer)mc.getRenderViewEntity(); - Entity tmp = player.func_184187_bx(); + Entity tmp = player.getRidingEntity(); if (!(tmp instanceof EntityLivingBase)) return; bind(icons); diff --git a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java index 4e70d85a4f..9ee47e39f8 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java +++ b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java @@ -167,7 +167,7 @@ public class BlockStateLoader if (hasBase) { - base = runModelHooks(base, smooth, gui3d, this.func_188049_c(), textures, customData); + base = runModelHooks(base, smooth, gui3d, this.isUvLock(), textures, customData); if (size <= 0) return base; @@ -198,7 +198,7 @@ public class BlockStateLoader models.put(entry.getKey(), Pair.of(runModelHooks(model, part.smooth, part.gui3d, part.uvLock, part.getTextures(), part.getCustomData()), partState)); } - return new MultiModel(func_188046_a(), hasBase ? base : null, baseTr, models.build()); + return new MultiModel(getModelLocation(), hasBase ? base : null, baseTr, models.build()); } @Override diff --git a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java index 8db0df2509..4d3f155cea 100644 --- a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java +++ b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java @@ -91,12 +91,12 @@ public interface IPerspectiveAwareModel extends IBakedModel public boolean isAmbientOcclusion() { return parent.isAmbientOcclusion(); } public boolean isGui3d() { return parent.isGui3d(); } - public boolean func_188618_c() { return parent.func_188618_c(); } + public boolean isBuiltInRenderer() { return parent.isBuiltInRenderer(); } public TextureAtlasSprite getParticleTexture() { return parent.getParticleTexture(); } @SuppressWarnings("deprecation") public ItemCameraTransforms getItemCameraTransforms() { return parent.getItemCameraTransforms(); } - public List func_188616_a(IBlockState state, EnumFacing side, long rand) { return parent.func_188616_a(state, side, rand); } - public ItemOverrideList func_188617_f() { return parent.func_188617_f(); } + public List getQuads(IBlockState state, EnumFacing side, long rand) { return parent.getQuads(state, side, rand); } + public ItemOverrideList getOverrides() { return parent.getOverrides(); } @Override public Pair handlePerspective(TransformType cameraTransformType) diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index 4bc494ba13..df577e336e 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -136,11 +136,11 @@ public class ItemLayerModel implements IRetexturableModel public boolean isAmbientOcclusion() { return true; } public boolean isGui3d() { return false; } - public boolean func_188618_c() { return false; } + public boolean isBuiltInRenderer() { return false; } public TextureAtlasSprite getParticleTexture() { return particle; } public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; } - public ItemOverrideList func_188617_f() { return ItemOverrideList.field_188022_a; } - public List func_188616_a(IBlockState state, EnumFacing side, long rand) + public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; } + public List getQuads(IBlockState state, EnumFacing side, long rand) { if(side == null) return quads; return ImmutableList.of(); diff --git a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java index e0faedf6bb..c0cf212ef9 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java +++ b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java @@ -118,7 +118,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableMo { // build base (insidest) IBakedModel model = (new ItemLayerModel(ImmutableList.of(baseLocation))).bake(state, format, bakedTextureGetter); - builder.addAll(model.func_188616_a(null, null, 0)); + builder.addAll(model.getQuads(null, null, 0)); } if (liquidLocation != null && fluidSprite != null) { @@ -302,7 +302,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableMo } @Override - public ItemOverrideList func_188617_f() + public ItemOverrideList getOverrides() { return BakedDynBucketOverrideHandler.INSTANCE; } @@ -314,7 +314,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableMo } @Override - public List func_188616_a(IBlockState state, EnumFacing side, long rand) + public List getQuads(IBlockState state, EnumFacing side, long rand) { if(side == null) return quads; return ImmutableList.of(); @@ -322,7 +322,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableMo public boolean isAmbientOcclusion() { return true; } public boolean isGui3d() { return false; } - public boolean func_188618_c() { return false; } + public boolean isBuiltInRenderer() { return false; } public TextureAtlasSprite getParticleTexture() { return particle; } public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; } } diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index 67a73e8a2b..2543037a57 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -341,7 +341,7 @@ public class ModelFluid implements IModelCustomData return false; } - public boolean func_188618_c() + public boolean isBuiltInRenderer() { return false; } @@ -356,7 +356,7 @@ public class ModelFluid implements IModelCustomData return ItemCameraTransforms.DEFAULT; } - public List func_188616_a(IBlockState state, EnumFacing side, long rand) + public List getQuads(IBlockState state, EnumFacing side, long rand) { BakedFluid model = this; if(state instanceof IExtendedBlockState) @@ -378,9 +378,9 @@ public class ModelFluid implements IModelCustomData return model.faceQuads.get(side); } - public ItemOverrideList func_188617_f() + public ItemOverrideList getOverrides() { - return ItemOverrideList.field_188022_a; + return ItemOverrideList.NONE; } @Override diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 0c3ea9f1e3..6d2253e076 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -546,7 +546,7 @@ public class ModelLoader extends ModelBakery newTransforms.add(animation.getPartTransform(state, part, i)); } - ItemCameraTransforms transforms = model.func_181682_g(); + ItemCameraTransforms transforms = model.getAllTransforms(); Map tMap = Maps.newHashMap(); tMap.putAll(IPerspectiveAwareModel.MapWrapper.getTransforms(transforms)); tMap.putAll(IPerspectiveAwareModel.MapWrapper.getTransforms(state)); @@ -556,14 +556,14 @@ public class ModelLoader extends ModelBakery { return new ItemLayerModel(model).bake(perState, format, bakedTextureGetter); } - if(isCustomRenderer(model)) return new BuiltInModel(transforms, model.func_187967_g()); + if(isCustomRenderer(model)) return new BuiltInModel(transforms, model.createOverrides()); return bakeNormal(model, perState, state.apply(Optional.absent()).or(TRSRTransformation.identity()), newTransforms, format, bakedTextureGetter, uvlock); } private IBakedModel bakeNormal(ModelBlock model, IModelState perState, final TRSRTransformation modelState, List newTransforms, final VertexFormat format, final Function bakedTextureGetter, boolean uvLocked) { TextureAtlasSprite particle = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName("particle"))); - SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(model, model.func_187967_g())).setTexture(particle); + SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(model, model.createOverrides())).setTexture(particle); for(int i = 0; i < model.getElements().size(); i++) { BlockPart part = model.getElements().get(i); @@ -593,7 +593,7 @@ public class ModelLoader extends ModelBakery return new IPerspectiveAwareModel.MapWrapper(builder.makeBakedModel(), perState) { @Override - public List func_188616_a(IBlockState state, EnumFacing side, long rand) + public List getQuads(IBlockState state, EnumFacing side, long rand) { if(state instanceof IExtendedBlockState) { @@ -604,11 +604,11 @@ public class ModelLoader extends ModelBakery IExtendedBlockState newExState = exState.withProperty(Properties.AnimationProperty, null); if(newState != null) { - return VanillaModelWrapper.this.bake(new ModelStateComposition(modelState, newState), format, bakedTextureGetter).func_188616_a(newExState, side, rand); + return VanillaModelWrapper.this.bake(new ModelStateComposition(modelState, newState), format, bakedTextureGetter).getQuads(newExState, side, rand); } } } - return super.func_188616_a(state, side, rand); + return super.getQuads(state, side, rand); }; }; } @@ -627,7 +627,7 @@ public class ModelLoader extends ModelBakery ModelBlock newModel = new ModelBlock(this.model.getParentLocation(), elements, Maps.newHashMap(this.model.textures), this.model.isAmbientOcclusion(), this.model.isGui3d(), //New Textures man VERY IMPORTANT - model.func_181682_g(), Lists.newArrayList(model.func_187966_f())); + model.getAllTransforms(), Lists.newArrayList(model.getOverrides())); newModel.name = this.model.name; newModel.parent = this.model.parent; @@ -696,7 +696,7 @@ public class ModelLoader extends ModelBakery { return this; } - ModelBlock newModel = new ModelBlock(model.getParentLocation(), model.getElements(), model.textures, value, model.isGui3d(), model.func_181682_g(), Lists.newArrayList(model.func_187966_f())); + ModelBlock newModel = new ModelBlock(model.getParentLocation(), model.getElements(), model.textures, value, model.isGui3d(), model.getAllTransforms(), Lists.newArrayList(model.getOverrides())); newModel.parent = model.parent; newModel.name = model.name; return new VanillaModelWrapper(location, newModel, uvlock, animation); @@ -709,7 +709,7 @@ public class ModelLoader extends ModelBakery { return this; } - ModelBlock newModel = new ModelBlock(model.getParentLocation(), model.getElements(), model.textures, model.ambientOcclusion, value, model.func_181682_g(), Lists.newArrayList(model.func_187966_f())); + ModelBlock newModel = new ModelBlock(model.getParentLocation(), model.getElements(), model.textures, model.ambientOcclusion, value, model.getAllTransforms(), Lists.newArrayList(model.getOverrides())); newModel.parent = model.parent; newModel.name = model.name; return new VanillaModelWrapper(location, newModel, uvlock, animation); @@ -735,11 +735,11 @@ public class ModelLoader extends ModelBakery public WeightedRandomModel(ModelResourceLocation parent, VariantList variants) { - this.variants = variants.func_188114_a(); + this.variants = variants.getVariantList(); ImmutableList.Builder> builder = ImmutableList.builder(); for (Variant v : this.variants) { - ResourceLocation loc = v.func_188046_a(); + ResourceLocation loc = v.getModelLocation(); locations.add(loc); IModel model = null; @@ -813,7 +813,7 @@ public class ModelLoader extends ModelBakery { IModel model = models.get(i); Variant v = variants.get(i); - builder.add(model.bake(MultiModelState.getPartState(state, model, i), format, bakedTextureGetter), variants.get(i).func_188047_d()); + builder.add(model.bake(MultiModelState.getPartState(state, model, i), format, bakedTextureGetter), variants.get(i).getWeight()); } return builder.build(); } diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index c63e5c35b4..8f16b6765c 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -161,13 +161,13 @@ public class MultiLayerModel implements IModelCustomData ImmutableList.Builder builder = ImmutableList.builder(); for(IBakedModel model : models.values()) { - builder.addAll(model.func_188616_a(null, side.orNull(), 0)); + builder.addAll(model.getQuads(null, side.orNull(), 0)); } return builder.build(); } @Override - public List func_188616_a(IBlockState state, EnumFacing side, long rand) + public List getQuads(IBlockState state, EnumFacing side, long rand) { IBakedModel model; BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer(); @@ -183,7 +183,7 @@ public class MultiLayerModel implements IModelCustomData { model = models.get(Optional.of(layer)); } - return model.func_188616_a(state, side, rand); + return model.getQuads(state, side, rand); } @Override @@ -199,9 +199,9 @@ public class MultiLayerModel implements IModelCustomData } @Override - public boolean func_188618_c() + public boolean isBuiltInRenderer() { - return base.func_188618_c(); + return base.isBuiltInRenderer(); } @Override @@ -223,9 +223,9 @@ public class MultiLayerModel implements IModelCustomData } @Override - public ItemOverrideList func_188617_f() + public ItemOverrideList getOverrides() { - return ItemOverrideList.field_188022_a; + return ItemOverrideList.NONE; } } diff --git a/src/main/java/net/minecraftforge/client/model/MultiModel.java b/src/main/java/net/minecraftforge/client/model/MultiModel.java index 28b3884876..1e6ba7b1b6 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiModel.java @@ -96,9 +96,9 @@ public class MultiModel implements IModel } @Override - public boolean func_188618_c() + public boolean isBuiltInRenderer() { - return internalBase.func_188618_c(); + return internalBase.isBuiltInRenderer(); } @Override @@ -114,7 +114,7 @@ public class MultiModel implements IModel } @Override - public List func_188616_a(IBlockState state, EnumFacing side, long rand) + public List getQuads(IBlockState state, EnumFacing side, long rand) { if(quads == null) { @@ -125,22 +125,22 @@ public class MultiModel implements IModel ImmutableList.Builder quads = ImmutableList.builder(); if (base != null) { - quads.addAll(base.func_188616_a(null, face, 0)); + quads.addAll(base.getQuads(null, face, 0)); } for (IBakedModel bakedPart : parts.values()) { - quads.addAll(bakedPart.func_188616_a(null, face, 0)); + quads.addAll(bakedPart.getQuads(null, face, 0)); } builder.put(Optional.of(face), quads.build()); } ImmutableList.Builder quads = ImmutableList.builder(); if (base != null) { - quads.addAll(base.func_188616_a(null, null, 0)); + quads.addAll(base.getQuads(null, null, 0)); } for (IBakedModel bakedPart : parts.values()) { - quads.addAll(bakedPart.func_188616_a(null, null, 0)); + quads.addAll(bakedPart.getQuads(null, null, 0)); } builder.put(Optional.absent(), quads.build()); this.quads = builder.build(); @@ -167,7 +167,7 @@ public class MultiModel implements IModel } @Override - public ItemOverrideList func_188617_f() + public ItemOverrideList getOverrides() { // TODO Auto-generated method stub return null; diff --git a/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java b/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java index 766242af82..6174ee335c 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java +++ b/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java @@ -58,7 +58,7 @@ public class AnimationModelBase extends M GlStateManager.pushMatrix(); GlStateManager.rotate(180, 0, 0, 1); Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer VertexBuffer = tessellator.getWorldRenderer(); + VertexBuffer VertexBuffer = tessellator.getBuffer(); VertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); VertexBuffer.setTranslation(-0.5, -1.5, -0.5); @@ -67,7 +67,7 @@ public class AnimationModelBase extends M lighter.setState(Blocks.air.getDefaultState()); lighter.setBlockPos(pos); boolean empty = true; - List quads = bakedModel.func_188616_a(null, null, 0); + List quads = bakedModel.getQuads(null, null, 0); if(!quads.isEmpty()) { lighter.updateBlockInfo(); @@ -79,7 +79,7 @@ public class AnimationModelBase extends M } for(EnumFacing side : EnumFacing.values()) { - quads = bakedModel.func_188616_a(null, side, 0); + quads = bakedModel.getQuads(null, side, 0); if(!quads.isEmpty()) { if(empty) lighter.updateBlockInfo(); diff --git a/src/main/java/net/minecraftforge/client/model/animation/FastTESR.java b/src/main/java/net/minecraftforge/client/model/animation/FastTESR.java index 80a238eb4b..33b59da334 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/FastTESR.java +++ b/src/main/java/net/minecraftforge/client/model/animation/FastTESR.java @@ -18,7 +18,7 @@ public abstract class FastTESR extends TileEntitySpecialRe public final void renderTileEntityAt(T te, double x, double y, double z, float partialTicks, int destroyStage) { Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer VertexBuffer = tessellator.getWorldRenderer(); + VertexBuffer VertexBuffer = tessellator.getBuffer(); this.bindTexture(TextureMap.locationBlocksTexture); RenderHelper.disableStandardItemLighting(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 5b8ee3628b..c3e52742b3 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -638,7 +638,7 @@ public class B3DLoader implements ICustomModelLoader } @Override - public List func_188616_a(IBlockState state, EnumFacing side, long rand) + public List getQuads(IBlockState state, EnumFacing side, long rand) { if(side != null) return ImmutableList.of(); IModelState modelState = this.state; @@ -807,7 +807,7 @@ public class B3DLoader implements ICustomModelLoader return gui3d; } - public boolean func_188618_c() + public boolean isBuiltInRenderer() { return false; } @@ -829,10 +829,10 @@ public class B3DLoader implements ICustomModelLoader } @Override - public ItemOverrideList func_188617_f() + public ItemOverrideList getOverrides() { // TODO handle items - return ItemOverrideList.field_188022_a; + return ItemOverrideList.NONE; } } } diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index 7d6879ca3b..5c9df533cc 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -1325,7 +1325,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData // FIXME: merge with getQuads @Override - public List func_188616_a(IBlockState blockState, EnumFacing side, long rand) + public List getQuads(IBlockState blockState, EnumFacing side, long rand) { if(side != null) return ImmutableList.of(); if (quads == null) @@ -1475,7 +1475,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData } @Override - public boolean func_188618_c() + public boolean isBuiltInRenderer() { return false; } @@ -1588,9 +1588,9 @@ public class OBJModel implements IRetexturableModel, IModelCustomData } @Override - public ItemOverrideList func_188617_f() + public ItemOverrideList getOverrides() { - return ItemOverrideList.field_188022_a; + return ItemOverrideList.NONE; } } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java b/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java index 0198580e9e..fa78ce40be 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java @@ -36,7 +36,7 @@ public class BlockInfo { if(cachedTint == tint) return cachedMultiplier; cachedTint = tint; - cachedMultiplier = colors.func_186724_a(state, world, blockPos, tint); + cachedMultiplier = colors.colorMultiplier(state, world, blockPos, tint); return cachedMultiplier; } @@ -102,15 +102,15 @@ public class BlockInfo { BlockPos pos = blockPos.add(x - 1, y - 1, z - 1); IBlockState state = world.getBlockState(pos); - translucent[x][y][z] = state.func_185895_e(); + translucent[x][y][z] = state.isTranslucent(); //translucent[x][y][z] = world.getBlockState(pos).getBlock().getLightOpacity(world, pos) == 0; - int brightness = state.func_185889_a(world, pos); + int brightness = state.getPackedLightmapCoords(world, pos); s[x][y][z] = (brightness >> 0x14) & 0xF; b[x][y][z] = (brightness >> 0x04) & 0xF; - ao[x][y][z] = state.func_185892_j(); + ao[x][y][z] = state.getAmbientOcclusionLightValue(); if(x == 1 && y == 1 && z == 1) { - full = state.func_185917_h(); + full = state.isFullCube(); } } } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java b/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java index f7a79cd299..b460661899 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java @@ -48,7 +48,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer } @Override - public boolean func_187497_c(IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, VertexBuffer buffer, boolean checkSides, long rand) + public boolean renderModelFlat(IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, VertexBuffer buffer, boolean checkSides, long rand) { if(ForgeModContainer.forgeLightPipelineEnabled) { @@ -64,12 +64,12 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer } else { - return super.func_187497_c(world, model, state, pos, buffer, checkSides, rand); + return super.renderModelFlat(world, model, state, pos, buffer, checkSides, rand); } } @Override - public boolean func_187498_b(IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, VertexBuffer buffer, boolean checkSides, long rand) + public boolean renderModelSmooth(IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, VertexBuffer buffer, boolean checkSides, long rand) { if(ForgeModContainer.forgeLightPipelineEnabled) { @@ -85,7 +85,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer } else { - return super.func_187498_b(world, model, state, pos, buffer, checkSides, rand); + return super.renderModelSmooth(world, model, state, pos, buffer, checkSides, rand); } } @@ -95,7 +95,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer lighter.setState(state); lighter.setBlockPos(pos); boolean empty = true; - List quads = model.func_188616_a(state, null, rand); + List quads = model.getQuads(state, null, rand); if(!quads.isEmpty()) { lighter.updateBlockInfo(); @@ -107,10 +107,10 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer } for(EnumFacing side : EnumFacing.values()) { - quads = model.func_188616_a(state, side, rand); + quads = model.getQuads(state, side, rand); if(!quads.isEmpty()) { - if(!checkSides || state.func_185894_c(world, pos, side)) + if(!checkSides || state.shouldSideBeRendered(world, pos, side)) { if(empty) lighter.updateBlockInfo(); empty = false; diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java index b30431b493..de273c2f41 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java @@ -144,7 +144,7 @@ public class LightUtil { int length = 4 < to.length ? 4 : to.length; VertexFormatElement element = formatFrom.getElement(e); - int vertexStart = v * formatFrom.getNextOffset() + formatFrom.func_181720_d(e); + int vertexStart = v * formatFrom.getNextOffset() + formatFrom.getOffset(e); int count = element.getElementCount(); VertexFormatElement.EnumType type = element.getType(); int size = type.getSize(); @@ -198,7 +198,7 @@ public class LightUtil public static void pack(float[] from, int[] to, VertexFormat formatTo, int v, int e) { VertexFormatElement element = formatTo.getElement(e); - int vertexStart = v * formatTo.getNextOffset() + formatTo.func_181720_d(e); + int vertexStart = v * formatTo.getNextOffset() + formatTo.getOffset(e); int count = element.getElementCount(); VertexFormatElement.EnumType type = element.getType(); int size = type.getSize(); @@ -241,7 +241,7 @@ public class LightUtil if(tessellator == null) { Tessellator tes = Tessellator.getInstance(); - VertexBuffer wr = tes.getWorldRenderer(); + VertexBuffer wr = tes.getBuffer(); tessellator = new VertexBufferConsumer(wr); } return tessellator; @@ -261,7 +261,7 @@ public class LightUtil public static void renderQuadColorSlow(VertexBuffer wr, BakedQuad quad, int auxColor) { ItemConsumer cons; - if(wr == Tessellator.getInstance().getWorldRenderer()) + if(wr == Tessellator.getInstance().getBuffer()) { cons = getItemConsumer(); } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java index 32cb394e58..5ffd67f67b 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java @@ -203,7 +203,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer float e2 = 0.95f; BlockPos pos = blockInfo.getBlockPos(); - boolean full = blockInfo.getState().func_185917_h(); + boolean full = blockInfo.getState().isFullCube(); if((full || y < -e1) && normal[1] < -e2) pos = pos.down(); if((full || y > e1) && normal[1] > e2) pos = pos.up(); @@ -212,7 +212,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer if((full || x < -e1) && normal[0] < -e2) pos = pos.west(); if((full || x > e1) && normal[0] > e2) pos = pos.east(); - int brightness = blockInfo.getState().func_185889_a(blockInfo.getWorld(), pos); + int brightness = blockInfo.getState().getPackedLightmapCoords(blockInfo.getWorld(), pos); lightmap[0] = ((float)((brightness >> 0x04) & 0xF) * 0x20) / 0xFFFF; lightmap[1] = ((float)((brightness >> 0x14) & 0xF) * 0x20) / 0xFFFF; diff --git a/src/main/java/net/minecraftforge/common/BiomeDictionary.java b/src/main/java/net/minecraftforge/common/BiomeDictionary.java index 704137a531..2d430055b6 100644 --- a/src/main/java/net/minecraftforge/common/BiomeDictionary.java +++ b/src/main/java/net/minecraftforge/common/BiomeDictionary.java @@ -146,7 +146,7 @@ public class BiomeDictionary { types = listSubTags(types); - if(BiomeGenBase.field_185377_q.getNameForObject(biome) != null) + if(BiomeGenBase.biomeRegistry.getNameForObject(biome) != null) { for(Type type : types) { @@ -160,7 +160,7 @@ public class BiomeDictionary if(!isBiomeRegistered(biome)) { - ResourceLocation location = BiomeGenBase.field_185377_q.getNameForObject(biome); + ResourceLocation location = BiomeGenBase.biomeRegistry.getNameForObject(biome); biomeInfoMap.put(location, new BiomeInfo(types)); } else @@ -248,7 +248,7 @@ public class BiomeDictionary */ public static boolean isBiomeRegistered(BiomeGenBase biome) { - return biomeInfoMap.containsKey(BiomeGenBase.field_185377_q.getNameForObject(biome)); + return biomeInfoMap.containsKey(BiomeGenBase.biomeRegistry.getNameForObject(biome)); } public static void registerAllBiomes() @@ -264,9 +264,9 @@ public class BiomeDictionary */ public static void registerAllBiomesAndGenerateEvents() { - for (ResourceLocation biomeResource : BiomeGenBase.field_185377_q.getKeys()) + for (ResourceLocation biomeResource : BiomeGenBase.biomeRegistry.getKeys()) { - BiomeGenBase biome = BiomeGenBase.field_185377_q.getObject(biomeResource); + BiomeGenBase biome = BiomeGenBase.biomeRegistry.getObject(biomeResource); if (biome.theBiomeDecorator instanceof DeferredBiomeDecorator) { @@ -289,7 +289,7 @@ public class BiomeDictionary { if (biome.theBiomeDecorator.treesPerChunk >= 3) { - if (biome.isHighHumidity() && biome.func_185353_n() >= 0.9F) + if (biome.isHighHumidity() && biome.getTemperature() >= 0.9F) { BiomeDictionary.registerBiomeType(biome, JUNGLE); } @@ -297,36 +297,36 @@ public class BiomeDictionary { BiomeDictionary.registerBiomeType(biome, FOREST); - if (biome.func_185353_n() <= 0.2f) + if (biome.getTemperature() <= 0.2f) { BiomeDictionary.registerBiomeType(biome, CONIFEROUS); } } } - else if(biome.func_185360_m() <= 0.3F && biome.func_185360_m() >= 0.0F) + else if(biome.getHeightVariation() <= 0.3F && biome.getHeightVariation() >= 0.0F) { - if(!biome.isHighHumidity() || biome.func_185355_j() >= 0.0F) + if(!biome.isHighHumidity() || biome.getBaseHeight() >= 0.0F) { BiomeDictionary.registerBiomeType(biome, PLAINS); } } - if (biome.getFloatRainfall() > 0.85f) + if (biome.getRainfall() > 0.85f) { BiomeDictionary.registerBiomeType(biome, WET); } - if (biome.getFloatRainfall() < 0.15f) + if (biome.getRainfall() < 0.15f) { BiomeDictionary.registerBiomeType(biome, DRY); } - if (biome.func_185353_n() > 0.85f) + if (biome.getTemperature() > 0.85f) { BiomeDictionary.registerBiomeType(biome, HOT); } - if (biome.func_185353_n() < 0.15f) + if (biome.getTemperature() < 0.15f) { BiomeDictionary.registerBiomeType(biome, COLD); } @@ -340,14 +340,14 @@ public class BiomeDictionary BiomeDictionary.registerBiomeType(biome, DENSE); } - if (biome.isHighHumidity() && biome.func_185355_j() < 0.0F && (biome.func_185360_m() <= 0.3F && biome.func_185360_m() >= 0.0F)) + if (biome.isHighHumidity() && biome.getBaseHeight() < 0.0F && (biome.getHeightVariation() <= 0.3F && biome.getHeightVariation() >= 0.0F)) { BiomeDictionary.registerBiomeType(biome, SWAMP); } - if (biome.func_185355_j() <= -0.5F) + if (biome.getBaseHeight() <= -0.5F) { - if (biome.func_185360_m() == 0.0F) + if (biome.getHeightVariation() == 0.0F) { BiomeDictionary.registerBiomeType(biome, RIVER); } @@ -357,12 +357,12 @@ public class BiomeDictionary } } - if (biome.func_185360_m() >= 0.4F && biome.func_185360_m() < 1.5F) + if (biome.getHeightVariation() >= 0.4F && biome.getHeightVariation() < 1.5F) { BiomeDictionary.registerBiomeType(biome, HILLS); } - if (biome.func_185360_m() >= 1.5F) + if (biome.getHeightVariation() >= 1.5F) { BiomeDictionary.registerBiomeType(biome, MOUNTAIN); } @@ -372,7 +372,7 @@ public class BiomeDictionary BiomeDictionary.registerBiomeType(biome, SNOWY); } - if (biome.topBlock != Blocks.sand && biome.func_185353_n() >= 1.0f && biome.getFloatRainfall() < 0.2f) + if (biome.topBlock != Blocks.sand && biome.getTemperature() >= 1.0f && biome.getRainfall() < 0.2f) { BiomeDictionary.registerBiomeType(biome, SAVANNA); } @@ -394,7 +394,7 @@ public class BiomeDictionary //Internal implementation private static BiomeInfo getBiomeInfo(BiomeGenBase biome) { - return biomeInfoMap.get(BiomeGenBase.field_185377_q.getNameForObject(biome)); + return biomeInfoMap.get(BiomeGenBase.biomeRegistry.getNameForObject(biome)); } private static void checkRegistration(BiomeGenBase biome) diff --git a/src/main/java/net/minecraftforge/common/DimensionManager.java b/src/main/java/net/minecraftforge/common/DimensionManager.java index 246ce6c9a6..4cfb66638c 100644 --- a/src/main/java/net/minecraftforge/common/DimensionManager.java +++ b/src/main/java/net/minecraftforge/common/DimensionManager.java @@ -244,7 +244,7 @@ public class DimensionManager //WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo()); WorldServer world = (dim == 0 ? overworld : (WorldServer)(new WorldServerMulti(mcServer, savehandler, dim, overworld, mcServer.theProfiler).init())); - world.addWorldAccess(new WorldManager(mcServer, world)); + world.addEventListener(new WorldManager(mcServer, world)); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); if (!mcServer.isSinglePlayer()) { diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index cecc177a68..025dd885de 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -139,7 +139,7 @@ public class ForgeHooks { IBlockState state = world.getBlockState(pos); state = state.getBlock().getActualState(state, world, pos); - if (state.func_185904_a().isToolNotRequired()) + if (state.getMaterial().isToolNotRequired()) { return true; } @@ -148,13 +148,13 @@ public class ForgeHooks String tool = block.getHarvestTool(state); if (stack == null || tool == null) { - return player.func_184823_b(state); + return player.canHarvestBlock(state); } int toolLevel = stack.getItem().getHarvestLevel(stack, tool); if (toolLevel < 0) { - return player.func_184823_b(state); + return player.canHarvestBlock(state); } return toolLevel >= block.getHarvestLevel(state); @@ -171,7 +171,7 @@ public class ForgeHooks public static float blockStrength(IBlockState state, EntityPlayer player, World world, BlockPos pos) { - float hardness = state.func_185887_b(world, pos); + float hardness = state.getBlockHardness(world, pos); if (hardness < 0.0F) { return 0.0F; @@ -276,7 +276,7 @@ public class ForgeHooks IBlockState iblockstate = this.theWorld.getBlockState(blockpos); Block block = iblockstate.getBlock(); - if (iblockstate.func_185904_a() == Material.air) + if (iblockstate.getMaterial() == Material.air) { return; } @@ -428,22 +428,22 @@ public class ForgeHooks if (te != null) { - Minecraft.getMinecraft().func_184119_a(result, te); + Minecraft.getMinecraft().storeTEInStack(result, te); } if (isCreative) { player.inventory.func_184434_a(result); - Minecraft.getMinecraft().playerController.sendSlotPacket(player.func_184586_b(EnumHand.MAIN_HAND), 36 + player.inventory.currentItem); + Minecraft.getMinecraft().playerController.sendSlotPacket(player.getHeldItem(EnumHand.MAIN_HAND), 36 + player.inventory.currentItem); return true; } - int slot = player.inventory.func_184429_b(result); + int slot = player.inventory.getSlotFor(result); if (slot != -1) { - if (InventoryPlayer.func_184435_e(slot)) + if (InventoryPlayer.isHotbar(slot)) player.inventory.currentItem = slot; else - Minecraft.getMinecraft().playerController.func_187100_a(slot); + Minecraft.getMinecraft().playerController.pickItem(slot); return true; } return false; @@ -656,7 +656,7 @@ public class ForgeHooks { // Logic from tryHarvestBlock for pre-canceling the event boolean preCancelEvent = false; - if (gameType.isCreative() && entityPlayer.func_184614_ca() != null && entityPlayer.func_184614_ca().getItem() instanceof ItemSword) + if (gameType.isCreative() && entityPlayer.getHeldItemMainhand() != null && entityPlayer.getHeldItemMainhand().getItem() instanceof ItemSword) preCancelEvent = true; if (gameType.isAdventure()) @@ -666,7 +666,7 @@ public class ForgeHooks if (!entityPlayer.isAllowEdit()) { - ItemStack itemstack = entityPlayer.func_184614_ca(); + ItemStack itemstack = entityPlayer.getHeldItemMainhand(); if (itemstack == null || !itemstack.canDestroy(world.getBlockState(pos).getBlock())) preCancelEvent = true; } @@ -789,7 +789,7 @@ public class ForgeHooks world.markAndNotifyBlock(snap.pos, null, oldBlock, newBlock, updateFlag); } - player.triggerAchievement(StatList.func_188060_a(itemstack.getItem())); + player.addStat(StatList.func_188060_a(itemstack.getItem())); } } world.capturedBlockSnapshots.clear(); @@ -904,7 +904,7 @@ public class ForgeHooks public static boolean onPlayerAttackTarget(EntityPlayer player, Entity target) { if (MinecraftForge.EVENT_BUS.post(new AttackEntityEvent(player, target))) return false; - ItemStack stack = player.func_184614_ca(); + ItemStack stack = player.getHeldItemMainhand(); if (stack != null && stack.getItem().onLeftClickEntity(stack, player, target)) return false; return true; } diff --git a/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java b/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java index 8d649ae011..579853bec6 100644 --- a/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java +++ b/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java @@ -69,9 +69,9 @@ public class WorldSpecificSaveHandler implements ISaveHandler } @Override - public TemplateManager func_186340_h() + public TemplateManager getStructureTemplateManager() { - return parent.func_186340_h(); + return parent.getStructureTemplateManager(); } } diff --git a/src/main/java/net/minecraftforge/common/brewing/VanillaBrewingRecipe.java b/src/main/java/net/minecraftforge/common/brewing/VanillaBrewingRecipe.java index 16dc3b9603..f11f4584fa 100644 --- a/src/main/java/net/minecraftforge/common/brewing/VanillaBrewingRecipe.java +++ b/src/main/java/net/minecraftforge/common/brewing/VanillaBrewingRecipe.java @@ -19,7 +19,7 @@ public class VanillaBrewingRecipe implements IBrewingRecipe { public boolean isInput(ItemStack stack) { Item item = stack.getItem(); - return item == Items.potionitem || item == Items.field_185155_bH || item == Items.field_185156_bI || item == Items.glass_bottle; + return item == Items.potionitem || item == Items.splash_potion || item == Items.lingering_potion || item == Items.glass_bottle; } /** @@ -28,7 +28,7 @@ public class VanillaBrewingRecipe implements IBrewingRecipe { @Override public boolean isIngredient(ItemStack stack) { - return PotionHelper.func_185205_a(stack); + return PotionHelper.isReagent(stack); } /** @@ -41,7 +41,7 @@ public class VanillaBrewingRecipe implements IBrewingRecipe { { if (ingredient != null && input != null && isIngredient(ingredient)) { - ItemStack result = PotionHelper.func_185212_d(ingredient, input); + ItemStack result = PotionHelper.doReaction(ingredient, input); if (result != input) { return result; diff --git a/src/main/java/net/minecraftforge/common/chunkio/ChunkIOProvider.java b/src/main/java/net/minecraftforge/common/chunkio/ChunkIOProvider.java index b7534633c9..4b38198227 100644 --- a/src/main/java/net/minecraftforge/common/chunkio/ChunkIOProvider.java +++ b/src/main/java/net/minecraftforge/common/chunkio/ChunkIOProvider.java @@ -45,11 +45,11 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider 0)) // If the block is being silk harvested, the exp dropped is 0 + (state.getBlock().canSilkHarvest(world, pos, world.getBlockState(pos), player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.silkTouch, player.getHeldItemMainhand()) > 0)) // If the block is being silk harvested, the exp dropped is 0 { this.exp = 0; } else { - int bonusLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185308_t, player.func_184614_ca()); + int bonusLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.fortune, player.getHeldItemMainhand()); this.exp = state.getBlock().getExpDrop(state, world, pos, bonusLevel); } } @@ -134,7 +134,7 @@ public class BlockEvent extends Event { super(blockSnapshot.world, blockSnapshot.pos, blockSnapshot.getCurrentBlock()); this.player = player; - this.itemInHand = player.func_184614_ca(); + this.itemInHand = player.getHeldItemMainhand(); this.blockSnapshot = blockSnapshot; this.placedBlock = blockSnapshot.getCurrentBlock(); this.placedAgainst = placedAgainst; diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java b/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java index 9f1cd6ff29..018b872e35 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java @@ -212,7 +212,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return displacements.get(state.getBlock()); } - Material material = state.func_185904_a(); + Material material = state.getMaterial(); if (material.blocksMovement() || material == Material.portal) { return false; @@ -261,7 +261,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return false; } - Material material = state.func_185904_a(); + Material material = state.getMaterial(); if (material.blocksMovement() || material == Material.portal) { return false; @@ -380,7 +380,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock */ @Override - public int func_185484_c(IBlockState state, IBlockAccess world, BlockPos pos) + public int getPackedLightmapCoords(IBlockState state, IBlockAccess world, BlockPos pos) { int lightThis = world.getCombinedLight(pos, 0); int lightUp = world.getCombinedLight(pos.up(), 0); @@ -403,7 +403,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { IBlockState neighbor = world.getBlockState(pos.offset(side)); - if (neighbor.func_185904_a() == state.func_185904_a()) + if (neighbor.getMaterial() == state.getMaterial()) { return false; } @@ -487,7 +487,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock public static double getFlowDirection(IBlockAccess world, BlockPos pos) { IBlockState state = world.getBlockState(pos); - if (!state.func_185904_a().isLiquid()) + if (!state.getMaterial().isLiquid()) { return -1000.0; } @@ -554,7 +554,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock IBlockState up = world.getBlockState(pos.down(densityDir)); if (here.getBlock() == this) { - if (up.func_185904_a().isLiquid() || up.getBlock() instanceof IFluidBlock) + if (up.getMaterial().isLiquid() || up.getBlock() instanceof IFluidBlock) { return 1; } @@ -564,7 +564,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return 0.875F; } } - return !here.func_185904_a().isSolid() && up.getBlock() == this ? 1 : this.getQuantaPercentage(world, pos) * 0.875F; + return !here.getMaterial().isSolid() && up.getBlock() == this ? 1 : this.getQuantaPercentage(world, pos) * 0.875F; } public Vec3d getFlowVector(IBlockAccess world, BlockPos pos) @@ -589,7 +589,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock int otherDecay = quantaPerBlock - getQuantaValue(world, pos2); if (otherDecay >= quantaPerBlock) { - if (!world.getBlockState(pos2).func_185904_a().blocksMovement()) + if (!world.getBlockState(pos2).getMaterial().blocksMovement()) { otherDecay = quantaPerBlock - getQuantaValue(world, pos2.down()); if (otherDecay >= 0) diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java b/src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java index f3d60cc372..449a9c0342 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java @@ -289,7 +289,7 @@ public class BlockFluidClassic extends BlockFluidBase return displacements.get(state.getBlock()); } - Material material = state.func_185904_a(); + Material material = state.getMaterial(); if (material.blocksMovement() || material == Material.water || material == Material.lava || diff --git a/src/main/java/net/minecraftforge/fluids/FluidUtil.java b/src/main/java/net/minecraftforge/fluids/FluidUtil.java index 2ea86794ff..9b7f6bc540 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidUtil.java +++ b/src/main/java/net/minecraftforge/fluids/FluidUtil.java @@ -404,7 +404,7 @@ public class FluidUtil { if (world != null && pos != null) { - world.func_184148_a(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.field_187638_cR, SoundCategory.PLAYERS, 0.2F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.entity_item_pickup, SoundCategory.PLAYERS, 0.2F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); } return true; } diff --git a/src/main/java/net/minecraftforge/fluids/UniversalBucket.java b/src/main/java/net/minecraftforge/fluids/UniversalBucket.java index 03ceb7797d..0c612204ca 100644 --- a/src/main/java/net/minecraftforge/fluids/UniversalBucket.java +++ b/src/main/java/net/minecraftforge/fluids/UniversalBucket.java @@ -129,7 +129,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem && !player.capabilities.isCreativeMode) { // success! - player.triggerAchievement(StatList.func_188057_b(this)); + player.addStat(StatList.func_188057_b(this)); itemstack.stackSize--; ItemStack emptyStack = empty != null ? empty.copy() : new ItemStack(this); @@ -162,7 +162,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem return false; } - Material material = worldIn.getBlockState(pos).func_185904_a(); + Material material = worldIn.getBlockState(pos).getMaterial(); boolean isSolid = material.isSolid(); // can only place in air or non-solid blocks @@ -177,7 +177,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem int i = pos.getX(); int j = pos.getY(); int k = pos.getZ(); - worldIn.func_184133_a(null, pos, SoundEvents.field_187646_bt, SoundCategory.BLOCKS, 0.5F, + worldIn.playSound(null, pos, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F); for (int l = 0; l < 8; ++l) diff --git a/src/main/java/net/minecraftforge/fml/client/GuiModList.java b/src/main/java/net/minecraftforge/fml/client/GuiModList.java index ddc45a8fb7..0f67480e66 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiModList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiModList.java @@ -487,7 +487,7 @@ public class GuiModList extends GuiScreen } ITextComponent chat = ForgeHooks.newChatWithLinks(line, false); - ret.addAll(GuiUtilRenderComponents.func_178908_a(chat, this.listWidth-8, GuiModList.this.fontRendererObj, false, true)); + ret.addAll(GuiUtilRenderComponents.splitText(chat, this.listWidth-8, GuiModList.this.fontRendererObj, false, true)); } return ret; } @@ -524,13 +524,13 @@ public class GuiModList extends GuiScreen { GlStateManager.enableBlend(); GuiModList.this.mc.renderEngine.bindTexture(logoPath); - VertexBuffer wr = tess.getWorldRenderer(); + VertexBuffer wr = tess.getBuffer(); int offset = (this.left + this.listWidth/2) - (logoDims.width / 2); wr.begin(7, DefaultVertexFormats.POSITION_TEX); - wr.pos(offset, top + logoDims.height, zLevel).func_187315_a(0, 1).endVertex(); - wr.pos(offset + logoDims.width, top + logoDims.height, zLevel).func_187315_a(1, 1).endVertex(); - wr.pos(offset + logoDims.width, top, zLevel).func_187315_a(1, 0).endVertex(); - wr.pos(offset, top, zLevel).func_187315_a(0, 0).endVertex(); + wr.pos(offset, top + logoDims.height, zLevel).tex(0, 1).endVertex(); + wr.pos(offset + logoDims.width, top + logoDims.height, zLevel).tex(1, 1).endVertex(); + wr.pos(offset + logoDims.width, top, zLevel).tex(1, 0).endVertex(); + wr.pos(offset, top, zLevel).tex(0, 0).endVertex(); tess.draw(); GlStateManager.disableBlend(); top += logoDims.height + 10; diff --git a/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java b/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java index 4c82db1815..2d3a2650a5 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java @@ -263,7 +263,7 @@ public abstract class GuiScrollingList this.applyScrollLimits(); Tessellator tess = Tessellator.getInstance(); - VertexBuffer worldr = tess.getWorldRenderer(); + VertexBuffer worldr = tess.getBuffer(); ScaledResolution res = new ScaledResolution(client); double scaleW = client.displayWidth / res.getScaledWidth_double(); @@ -284,10 +284,10 @@ public abstract class GuiScrollingList GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); float scale = 32.0F; worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - worldr.pos(this.left, this.bottom, 0.0D).func_187315_a(this.left / scale, (this.bottom + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - worldr.pos(this.right, this.bottom, 0.0D).func_187315_a(this.right / scale, (this.bottom + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - worldr.pos(this.right, this.top, 0.0D).func_187315_a(this.right / scale, (this.top + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - worldr.pos(this.left, this.top, 0.0D).func_187315_a(this.left / scale, (this.top + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); + worldr.pos(this.left, this.bottom, 0.0D).tex(this.left / scale, (this.bottom + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); + worldr.pos(this.right, this.bottom, 0.0D).tex(this.right / scale, (this.bottom + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); + worldr.pos(this.right, this.top, 0.0D).tex(this.right / scale, (this.top + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); + worldr.pos(this.left, this.top, 0.0D).tex(this.left / scale, (this.top + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); tess.draw(); } @@ -311,14 +311,14 @@ public abstract class GuiScrollingList GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableTexture2D(); worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - worldr.pos(min, slotTop + slotBuffer + 2, 0).func_187315_a(0, 1).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(max, slotTop + slotBuffer + 2, 0).func_187315_a(1, 1).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(max, slotTop - 2, 0).func_187315_a(1, 0).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(min, slotTop - 2, 0).func_187315_a(0, 0).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(min + 1, slotTop + slotBuffer + 1, 0).func_187315_a(0, 1).color(0x00, 0x00, 0x00, 0xFF).endVertex(); - worldr.pos(max - 1, slotTop + slotBuffer + 1, 0).func_187315_a(1, 1).color(0x00, 0x00, 0x00, 0xFF).endVertex(); - worldr.pos(max - 1, slotTop - 1, 0).func_187315_a(1, 0).color(0x00, 0x00, 0x00, 0xFF).endVertex(); - worldr.pos(min + 1, slotTop - 1, 0).func_187315_a(0, 0).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.pos(min, slotTop + slotBuffer + 2, 0).tex(0, 1).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.pos(max, slotTop + slotBuffer + 2, 0).tex(1, 1).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.pos(max, slotTop - 2, 0).tex(1, 0).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.pos(min, slotTop - 2, 0).tex(0, 0).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.pos(min + 1, slotTop + slotBuffer + 1, 0).tex(0, 1).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.pos(max - 1, slotTop + slotBuffer + 1, 0).tex(1, 1).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.pos(max - 1, slotTop - 1, 0).tex(1, 0).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.pos(min + 1, slotTop - 1, 0).tex(0, 0).color(0x00, 0x00, 0x00, 0xFF).endVertex(); tess.draw(); GlStateManager.enableTexture2D(); } @@ -347,22 +347,22 @@ public abstract class GuiScrollingList GlStateManager.disableTexture2D(); worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - worldr.pos(scrollBarLeft, this.bottom, 0.0D).func_187315_a(0.0D, 1.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); - worldr.pos(scrollBarRight, this.bottom, 0.0D).func_187315_a(1.0D, 1.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); - worldr.pos(scrollBarRight, this.top, 0.0D).func_187315_a(1.0D, 0.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); - worldr.pos(scrollBarLeft, this.top, 0.0D).func_187315_a(0.0D, 0.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.pos(scrollBarLeft, this.bottom, 0.0D).tex(0.0D, 1.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.pos(scrollBarRight, this.bottom, 0.0D).tex(1.0D, 1.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.pos(scrollBarRight, this.top, 0.0D).tex(1.0D, 0.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.pos(scrollBarLeft, this.top, 0.0D).tex(0.0D, 0.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); tess.draw(); worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - worldr.pos(scrollBarLeft, barTop + height, 0.0D).func_187315_a(0.0D, 1.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(scrollBarRight, barTop + height, 0.0D).func_187315_a(1.0D, 1.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(scrollBarRight, barTop, 0.0D).func_187315_a(1.0D, 0.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(scrollBarLeft, barTop, 0.0D).func_187315_a(0.0D, 0.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.pos(scrollBarLeft, barTop + height, 0.0D).tex(0.0D, 1.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.pos(scrollBarRight, barTop + height, 0.0D).tex(1.0D, 1.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.pos(scrollBarRight, barTop, 0.0D).tex(1.0D, 0.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.pos(scrollBarLeft, barTop, 0.0D).tex(0.0D, 0.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); tess.draw(); worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - worldr.pos(scrollBarLeft, barTop + height - 1, 0.0D).func_187315_a(0.0D, 1.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); - worldr.pos(scrollBarRight - 1, barTop + height - 1, 0.0D).func_187315_a(1.0D, 1.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); - worldr.pos(scrollBarRight - 1, barTop, 0.0D).func_187315_a(1.0D, 0.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); - worldr.pos(scrollBarLeft, barTop, 0.0D).func_187315_a(0.0D, 0.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); + worldr.pos(scrollBarLeft, barTop + height - 1, 0.0D).tex(0.0D, 1.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); + worldr.pos(scrollBarRight - 1, barTop + height - 1, 0.0D).tex(1.0D, 1.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); + worldr.pos(scrollBarRight - 1, barTop, 0.0D).tex(1.0D, 0.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); + worldr.pos(scrollBarLeft, barTop, 0.0D).tex(0.0D, 0.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); tess.draw(); } @@ -390,7 +390,7 @@ public abstract class GuiScrollingList GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer VertexBuffer = tessellator.getWorldRenderer(); + VertexBuffer VertexBuffer = tessellator.getBuffer(); VertexBuffer.begin(7, DefaultVertexFormats.POSITION_COLOR); VertexBuffer.pos(right, top, 0.0D).color(r1, g1, b1, a1).endVertex(); VertexBuffer.pos(left, top, 0.0D).color(r1, g1, b1, a1).endVertex(); diff --git a/src/main/java/net/minecraftforge/fml/client/SplashProgress.java b/src/main/java/net/minecraftforge/fml/client/SplashProgress.java index 3ba49489fb..3f8fb469fd 100644 --- a/src/main/java/net/minecraftforge/fml/client/SplashProgress.java +++ b/src/main/java/net/minecraftforge/fml/client/SplashProgress.java @@ -503,8 +503,8 @@ public class SplashProgress if (max_texture_size != -1) return max_texture_size; for (int i = 0x4000; i > 0; i >>= 1) { - GlStateManager.func_187419_a(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (IntBuffer)null); - if (GlStateManager.func_187411_c(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH) != 0) + GlStateManager.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (IntBuffer)null); + if (GlStateManager.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH) != 0) { max_texture_size = i; return i; diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java b/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java index 6502112441..b76587a143 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java @@ -184,12 +184,12 @@ public class GuiUtils float uScale = 1f / 0x100; float vScale = 1f / 0x100; Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer wr = tessellator.getWorldRenderer(); + VertexBuffer wr = tessellator.getBuffer(); wr.begin(7, DefaultVertexFormats.POSITION_TEX); - wr.pos(x , y + height, zLevel).func_187315_a( u * uScale, ((v + height) * vScale)).endVertex(); - wr.pos(x + width, y + height, zLevel).func_187315_a((u + width) * uScale, ((v + height) * vScale)).endVertex(); - wr.pos(x + width, y , zLevel).func_187315_a((u + width) * uScale, ( v * vScale)).endVertex(); - wr.pos(x , y , zLevel).func_187315_a( u * uScale, ( v * vScale)).endVertex(); + wr.pos(x , y + height, zLevel).tex( u * uScale, ((v + height) * vScale)).endVertex(); + wr.pos(x + width, y + height, zLevel).tex((u + width) * uScale, ((v + height) * vScale)).endVertex(); + wr.pos(x + width, y , zLevel).tex((u + width) * uScale, ( v * vScale)).endVertex(); + wr.pos(x , y , zLevel).tex( u * uScale, ( v * vScale)).endVertex(); tessellator.draw(); } diff --git a/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java b/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java index 5db838deaa..4153af858a 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java @@ -128,7 +128,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter { public List selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet) { ImmutableList.Builder builder = ImmutableList.builder(); - for (EntityPlayerMP player : (List)FMLCommonHandler.instance().getMinecraftServerInstance().func_184103_al().getPlayerList()) + for (EntityPlayerMP player : (List)FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList()) { NetworkDispatcher dispatcher = player.playerNetServerHandler.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get(); if (dispatcher != null) builder.add(dispatcher); @@ -156,7 +156,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter { { int dimension = (Integer)args; ImmutableList.Builder builder = ImmutableList.builder(); - for (EntityPlayerMP player : (List)FMLCommonHandler.instance().getMinecraftServerInstance().func_184103_al().getPlayerList()) + for (EntityPlayerMP player : (List)FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList()) { if (dimension == player.dimension) { @@ -190,7 +190,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter { { TargetPoint tp = (TargetPoint)args; ImmutableList.Builder builder = ImmutableList.builder(); - for (EntityPlayerMP player : (List)FMLCommonHandler.instance().getMinecraftServerInstance().func_184103_al().getPlayerList()) + for (EntityPlayerMP player : (List)FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList()) { if (player.dimension == tp.dimension) { diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java b/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java index be45fec147..4d6675d4ee 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java @@ -126,7 +126,7 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler 0) diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java index 2a70bbea5f..7f6a89a949 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java @@ -193,7 +193,7 @@ public abstract class FMLMessage { PacketBuffer pb = new PacketBuffer(tmpBuf); try { - entity.func_184212_Q().func_187216_a(pb); + entity.getDataManager().writeEntries(pb); } catch (IOException e) { FMLLog.log(Level.FATAL,e,"Encountered fatal exception trying to send entity spawn data watchers"); @@ -247,7 +247,7 @@ public abstract class FMLMessage { scaledHeadYaw = dat.readByte() * 360F / 256F; try { - dataWatcherList = EntityDataManager.func_187215_b(new PacketBuffer(dat)); + dataWatcherList = EntityDataManager.readEntries(new PacketBuffer(dat)); } catch (IOException e) { FMLLog.log(Level.FATAL, e, "There was a critical error decoding the datawatcher stream for a mod entity."); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index 95145a0fd4..21b942a659 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -557,7 +557,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul throw new IllegalArgumentException("The object to be added to the registry is not of the right type. Reflection/ASM hackery? Registry bug?"); } - underlyingIntegerMap.func_186814_a(thing, id); // obj <-> id + underlyingIntegerMap.put(thing, id); // obj <-> id super.putObject(name, thing); // name <-> obj availabilityMap.set(id); if (addCallback != null) @@ -759,7 +759,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul for (I i : this.underlyingIntegerMap) { - addCallback.onAdd(i, this.underlyingIntegerMap.func_186808_c(i)); + addCallback.onAdd(i, this.underlyingIntegerMap.add(i)); } } diff --git a/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java b/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java index a373a1c163..b2caf4717f 100644 --- a/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java +++ b/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java @@ -157,8 +157,8 @@ public class ItemHandlerHelper // play sound if something got picked up if (remainder == null || remainder.stackSize != stack.stackSize) { - world.func_184148_a(player, player.posX, player.posY, player.posZ, - SoundEvents.field_187638_cR, SoundCategory.PLAYERS, 0.2F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + world.playSound(player, player.posX, player.posY, player.posZ, + SoundEvents.entity_item_pickup, SoundCategory.PLAYERS, 0.2F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); } // drop remaining itemstack into the world diff --git a/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java index c0df1e3055..9da886216d 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java @@ -35,7 +35,7 @@ public class PlayerArmorInvWrapper extends InvWrapper EntityEquipmentSlot equ = null; for (EntityEquipmentSlot s : EntityEquipmentSlot.values()) { - if (s.func_188453_a() == EntityEquipmentSlot.Type.ARMOR && s.func_188454_b() == slot) + if (s.getSlotType() == EntityEquipmentSlot.Type.ARMOR && s.getIndex() == slot) { equ = s; break; diff --git a/src/main/java/net/minecraftforge/server/command/ForgeCommand.java b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java index 1f133aa68f..89c9949c93 100644 --- a/src/main/java/net/minecraftforge/server/command/ForgeCommand.java +++ b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java @@ -36,7 +36,7 @@ public class ForgeCommand extends CommandBase { return 2; } @Override - public void func_184881_a(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException + public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (args.length == 0) { @@ -65,7 +65,7 @@ public class ForgeCommand extends CommandBase { } @Override - public List func_184883_a(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) + public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { diff --git a/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java b/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java index 9b46bc670f..3469bbd085 100644 --- a/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java +++ b/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java @@ -47,7 +47,7 @@ public final class ConsoleCommandCompleter implements Completer @Override public List call() throws Exception { - return ConsoleCommandCompleter.this.server.func_184104_a(ConsoleCommandCompleter.this.server, input, + return ConsoleCommandCompleter.this.server.getTabCompletions(ConsoleCommandCompleter.this.server, input, ConsoleCommandCompleter.this.server.getPosition(), false/* we're not a command block */); } }); diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index d59cf947d3..3acac0b2d2 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -3,7 +3,7 @@ net/minecraft/client/renderer/ItemRenderer.renderItem(Lnet/minecraft/entity/Enti net/minecraft/client/renderer/RenderGlobal.drawBlockDamageTexture(Lnet/minecraft/client/renderer/Tessellator;Lnet/minecraft/entity/EntityLivingBase;F)V=|p_72717_1_,p_72717_2_,p_72717_3_ net/minecraft/client/renderer/entity/RenderItem.renderDroppedItem(Lnet/minecraft/entity/item/EntityItem;Lnet/minecraft/util/IIcon;IFFFFI)V=|p_77020_1_,p_77020_2_,p_77020_3_,p_77020_4_,p_77020_5_,p_77020_6_,p_77020_7_,pass net/minecraft/client/renderer/entity/RenderItem.renderItemIntoGUI(Lnet/minecraft/client/gui/FontRenderer;Lnet/minecraft/client/renderer/texture/TextureManager;Lnet/minecraft/item/ItemStack;IIZ)V=|p_77015_1_,p_77015_2_,p_77015_3_,p_77015_4_,p_77015_5_,renderEffect -net/minecraft/server/management/ServerConfigurationManager.transferPlayerToDimension(Lnet/minecraft/entity/player/EntityPlayerMP;ILnet/minecraft/world/Teleporter;)V=|p_72356_1_,p_72356_2_,teleporter +net/minecraft/server/management/PlayerList.transferPlayerToDimension(Lnet/minecraft/entity/player/EntityPlayerMP;ILnet/minecraft/world/Teleporter;)V=|p_187242_1_,p_187242_2_,teleporter net/minecraft/server/management/ServerConfigurationManager.transferEntityToWorld(Lnet/minecraft/entity/Entity;ILnet/minecraft/world/WorldServer;Lnet/minecraft/world/WorldServer;Lnet/minecraft/world/Teleporter;)V=|p_82448_1_,p_82448_2_,p_82448_3_,p_82448_4_,teleporter net/minecraft/world/World.getBiomeGenForCoordsBody(II)Lnet/minecraft/world/biome/BiomeGenBase;=|p_72807_1_,p_72807_2_ net/minecraft/world/World.getSunBrightnessFactor(F)F=|p_72967_1_ @@ -45,4 +45,5 @@ net/minecraft/stats/StatList.mergeStatBases([Lnet/minecraft/stats/StatBase;Lnet/ net/minecraft/item/ItemStack.(Lnet/minecraft/item/Item;IILnet/minecraft/nbt/NBTTagCompound;)V=|p_i1881_1_,p_i1881_2_,p_i1881_3_,capNBT net/minecraft/block/BlockRedstoneWire.canConnectTo(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/EnumFacing;Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;)Z=p_176343_0_,p_176343_1_,world,pos -net/minecraft/client/renderer/block/model/BakedQuad.([IILnet/minecraft/util/EnumFacing;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/client/renderer/vertex/VertexFormat)V=|p_i46574_1_,p_i46574_2_,p_i46574_3_,p_i46574_4_,format +net/minecraft/client/renderer/block/model/BakedQuad.([IILnet/minecraft/util/EnumFacing;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/client/renderer/vertex/VertexFormat;)V=|p_i46574_1_,p_i46574_2_,p_i46574_3_,p_i46574_4_,format +net/minecraft/client/renderer/texture/TextureMap.(Ljava/lang/String;Lnet/minecraft/client/renderer/texture/IIconCreator;Z)V=|p_i46100_1_,p_i46100_2_,skipFirst diff --git a/src/test/java/net/minecraftforge/debug/DynBucketTest.java b/src/test/java/net/minecraftforge/debug/DynBucketTest.java index 90208cdc88..a303f048ac 100644 --- a/src/test/java/net/minecraftforge/debug/DynBucketTest.java +++ b/src/test/java/net/minecraftforge/debug/DynBucketTest.java @@ -263,7 +263,7 @@ public class DynBucketTest int filled = tank.fill(resource, doFill); if(doFill && filled > 0) { IBlockState state = worldObj.getBlockState(pos); - worldObj.func_184138_a(pos, state, state, 8); // TODO check flag + worldObj.notifyBlockUpdate(pos, state, state, 8); // TODO check flag } return filled; } @@ -281,7 +281,7 @@ public class DynBucketTest FluidStack drained = tank.drain(maxDrain, doDrain); if(doDrain && drained != null) { IBlockState state = worldObj.getBlockState(pos); - worldObj.func_184138_a(pos, state, state, 8); // TODO check flag + worldObj.notifyBlockUpdate(pos, state, state, 8); // TODO check flag } return drained; } diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index d1b1ecaf3a..8001c0edd0 100644 --- a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -105,7 +105,7 @@ public class ModelAnimationDebug @Override public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { - return this.getDefaultState().withProperty(FACING, BlockPistonBase.func_185647_a(pos, placer)); + return this.getDefaultState().withProperty(FACING, BlockPistonBase.getFacingFromEntity(pos, placer)); } @Override @@ -223,7 +223,7 @@ public class ModelAnimationDebug "base", Pair.of(base, TRSRTransformation.identity()) ) ); - return new RenderLiving(manager, new AnimationModelBase(model, new VertexLighterSmoothAo(Minecraft.getMinecraft().func_184125_al())) + return new RenderLiving(manager, new AnimationModelBase(model, new VertexLighterSmoothAo(Minecraft.getMinecraft().getBlockColors())) { @Override public void handleEvents(EntityChest chest, float time, Iterable pastEvents) @@ -379,7 +379,7 @@ public class ModelAnimationDebug protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(60); + this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(60); } } } diff --git a/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java b/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java index 654f7731a2..cb829bec5c 100644 --- a/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java @@ -249,7 +249,7 @@ public class ModelBakeEventDebug } @Override - public List func_188616_a(IBlockState state, EnumFacing side, long rand) + public List getQuads(IBlockState state, EnumFacing side, long rand) { if(side != null || !(state instanceof IExtendedBlockState)) return ImmutableList.of(); IExtendedBlockState exState = (IExtendedBlockState)state; @@ -280,7 +280,7 @@ public class ModelBakeEventDebug public boolean isAmbientOcclusion() { return true; } @Override - public boolean func_188618_c() { return false; } + public boolean isBuiltInRenderer() { return false; } @Override public TextureAtlasSprite getParticleTexture() { return this.base; } @@ -289,7 +289,7 @@ public class ModelBakeEventDebug public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; } @Override - public ItemOverrideList func_188617_f() { return ItemOverrideList.field_188022_a; } + public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; } } private static Vec3d rotate(Vec3d vec, EnumFacing side) diff --git a/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java b/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java index bcd958d877..da9cfb182f 100644 --- a/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java +++ b/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java @@ -58,7 +58,7 @@ public class PotionRegistryDebug { @Override public void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc) { - Potion potion = effect.func_188419_a(); + Potion potion = effect.getPotion(); mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite("minecraft:blocks/fire_layer_0"); @@ -75,13 +75,13 @@ public class PotionRegistryDebug { float a = (float)(potion.getLiquidColor() & 255) / 255.0F; Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer buf = tessellator.getWorldRenderer(); + VertexBuffer buf = tessellator.getBuffer(); buf.begin(7, DefaultVertexFormats.POSITION_TEX); GlStateManager.color(r, g, b, a); - buf.pos((double) x, (double)(y + height), 0.0D).func_187315_a(sprite.getMinU(), sprite.getMaxV()).endVertex(); - buf.pos((double)(x + width), (double)(y + height), 0.0D).func_187315_a(sprite.getMaxU(), sprite.getMaxV()).endVertex(); - buf.pos((double)(x + width), (double) y, 0.0D).func_187315_a(sprite.getMaxU(), sprite.getMinV()).endVertex(); - buf.pos((double) x, (double) y, 0.0D).func_187315_a(sprite.getMinU(), sprite.getMinV()).endVertex(); + buf.pos((double) x, (double)(y + height), 0.0D).tex(sprite.getMinU(), sprite.getMaxV()).endVertex(); + buf.pos((double)(x + width), (double)(y + height), 0.0D).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex(); + buf.pos((double)(x + width), (double) y, 0.0D).tex(sprite.getMaxU(), sprite.getMinV()).endVertex(); + buf.pos((double) x, (double) y, 0.0D).tex(sprite.getMinU(), sprite.getMinV()).endVertex(); tessellator.draw(); } } diff --git a/src/test/java/net/minecraftforge/test/ClientCommandTest.java b/src/test/java/net/minecraftforge/test/ClientCommandTest.java index 6e4a1d2e34..e302f47488 100644 --- a/src/test/java/net/minecraftforge/test/ClientCommandTest.java +++ b/src/test/java/net/minecraftforge/test/ClientCommandTest.java @@ -37,13 +37,13 @@ public class ClientCommandTest { } @Override - public boolean func_184882_a(MinecraftServer server, ICommandSender sender) + public boolean checkPermission(MinecraftServer server, ICommandSender sender) { return true; } @Override - public List func_184883_a(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) + public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { if (args.length > 0) { @@ -54,7 +54,7 @@ public class ClientCommandTest { } @Override - public void func_184881_a( MinecraftServer server, ICommandSender sender, String[] args) throws CommandException + public void execute( MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (args.length > 0) { diff --git a/src/test/java/net/minecraftforge/test/FOVModifierTest.java b/src/test/java/net/minecraftforge/test/FOVModifierTest.java index 53f6869c75..2bd053877f 100644 --- a/src/test/java/net/minecraftforge/test/FOVModifierTest.java +++ b/src/test/java/net/minecraftforge/test/FOVModifierTest.java @@ -20,7 +20,7 @@ public class FOVModifierTest { @SubscribeEvent public void getFOVModifier(EntityViewRenderEvent.FOVModifier event) { - if(event.getState().func_185904_a() == Material.water) + if(event.getState().getMaterial() == Material.water) event.setFOV(event.getFOV() / 60.0f * 50.0f); } } From bda688b9b54b9135e1ccbc367d778c9a6dd4496d Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sun, 13 Mar 2016 09:59:30 +0300 Subject: [PATCH 078/243] Fixed some errors in forge.exc --- .../renderer/block/model/BakedQuad.java.patch | 24 +- .../renderer/texture/TextureMap.java.patch | 8 +- .../server/management/PlayerList.java.patch | 313 ++++-------------- src/main/resources/forge.exc | 4 +- 4 files changed, 74 insertions(+), 275 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch index e2758488c7..8a1013f885 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java -@@ -6,21 +6,31 @@ +@@ -6,15 +6,25 @@ import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) @@ -18,25 +18,15 @@ + @Deprecated public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_) { -- this.field_178215_a = p_i46574_1_; -- this.field_178213_b = p_i46574_2_; -- this.field_178214_c = p_i46574_3_; -- this.field_187509_d = p_i46574_4_; + this(p_i46574_1_, p_i46574_2_, p_i46574_3_, p_i46574_4_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); - } - -+ public BakedQuad(int[] vertexDataIn, int tintIndexIn, EnumFacing faceIn, TextureAtlasSprite spriteIn, net.minecraft.client.renderer.vertex.VertexFormat format) -+ { -+ this.format = format; -+ this.field_178215_a = vertexDataIn; -+ this.field_178213_b = tintIndexIn; -+ this.field_178214_c = faceIn; -+ this.field_187509_d = spriteIn; + } + - public TextureAtlasSprite func_187508_a() - { - return this.field_187509_d; ++ public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_, net.minecraft.client.renderer.vertex.VertexFormat format) ++ { ++ this.format = format; + this.field_178215_a = p_i46574_1_; + this.field_178213_b = p_i46574_2_; + this.field_178214_c = p_i46574_3_; @@ -45,4 +55,17 @@ { return this.field_178214_c; diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 59156dd0f4..15086362c3 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -28,16 +28,14 @@ + this(basePathIn, null, skipFirst); + } + -+ public TextureMap(String basePathIn, IIconCreator iconCreatorIn, boolean skipFirst) ++ public TextureMap(String p_i46100_1_, IIconCreator p_i46100_2_, boolean skipFirst) + { this.field_94258_i = Lists.newArrayList(); this.field_110574_e = Maps.newHashMap(); this.field_94252_e = Maps.newHashMap(); this.field_94249_f = new TextureAtlasSprite("missingno"); -- this.field_94254_c = p_i46100_1_; -- this.field_174946_m = p_i46100_2_; -+ this.field_94254_c = basePathIn; -+ this.field_174946_m = iconCreatorIn; + this.field_94254_c = p_i46100_1_; + this.field_174946_m = p_i46100_2_; + this.skipFirst = skipFirst && ENABLE_SKIP; } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch index 89f16a9e86..467fe98f6d 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch @@ -1,147 +1,46 @@ --- ../src-base/minecraft/net/minecraft/server/management/PlayerList.java +++ ../src-work/minecraft/net/minecraft/server/management/PlayerList.java -@@ -101,65 +101,76 @@ +@@ -101,7 +101,7 @@ this.field_72405_c = 8; } - public void func_72355_a(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_) -+ public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn, NetHandlerPlayServer nethandlerplayserver) ++ public void initializeConnectionToPlayer(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_, NetHandlerPlayServer nethandlerplayserver) { -- GameProfile gameprofile = p_72355_2_.func_146103_bH(); -+ GameProfile gameprofile = playerIn.func_146103_bH(); + GameProfile gameprofile = p_72355_2_.func_146103_bH(); PlayerProfileCache playerprofilecache = this.field_72400_f.func_152358_ax(); - GameProfile gameprofile1 = playerprofilecache.func_152652_a(gameprofile.getId()); - String s = gameprofile1 == null ? gameprofile.getName() : gameprofile1.getName(); +@@ -110,6 +110,17 @@ playerprofilecache.func_152649_a(gameprofile); -- NBTTagCompound nbttagcompound = this.func_72380_a(p_72355_2_); -- p_72355_2_.func_70029_a(this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK)); -- p_72355_2_.field_71134_c.func_73080_a((WorldServer)p_72355_2_.field_70170_p); -+ NBTTagCompound nbttagcompound = this.func_72380_a(playerIn); -+ playerIn.func_70029_a(this.field_72400_f.func_71218_a(playerIn.field_71093_bK)); + NBTTagCompound nbttagcompound = this.func_72380_a(p_72355_2_); + p_72355_2_.func_70029_a(this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK)); + -+ World playerWorld = this.field_72400_f.func_71218_a(playerIn.field_71093_bK); ++ World playerWorld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); + if (playerWorld == null) + { -+ playerIn.field_71093_bK = 0; ++ p_72355_2_.field_71093_bK = 0; + playerWorld = this.field_72400_f.func_71218_a(0); + BlockPos spawnPoint = playerWorld.field_73011_w.getRandomizedSpawnPoint(); -+ playerIn.func_70107_b(spawnPoint.func_177958_n(), spawnPoint.func_177956_o(), spawnPoint.func_177952_p()); ++ p_72355_2_.func_70107_b(spawnPoint.func_177958_n(), spawnPoint.func_177956_o(), spawnPoint.func_177952_p()); + } + -+ playerIn.func_70029_a(playerWorld); -+ playerIn.field_71134_c.func_73080_a((WorldServer)playerIn.field_70170_p); ++ p_72355_2_.func_70029_a(playerWorld); + p_72355_2_.field_71134_c.func_73080_a((WorldServer)p_72355_2_.field_70170_p); String s1 = "local"; -- if (p_72355_1_.func_74430_c() != null) -+ if (netManager.func_74430_c() != null) - { -- s1 = p_72355_1_.func_74430_c().toString(); -+ s1 = netManager.func_74430_c().toString(); - } - -- field_148546_d.info(p_72355_2_.func_70005_c_() + "[" + s1 + "] logged in with entity id " + p_72355_2_.func_145782_y() + " at (" + p_72355_2_.field_70165_t + ", " + p_72355_2_.field_70163_u + ", " + p_72355_2_.field_70161_v + ")"); -- WorldServer worldserver = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); -+ field_148546_d.info(playerIn.func_70005_c_() + "[" + s1 + "] logged in with entity id " + playerIn.func_145782_y() + " at (" + playerIn.field_70165_t + ", " + playerIn.field_70163_u + ", " + playerIn.field_70161_v + ")"); -+ WorldServer worldserver = this.field_72400_f.func_71218_a(playerIn.field_71093_bK); +@@ -123,7 +134,7 @@ WorldInfo worldinfo = worldserver.func_72912_H(); BlockPos blockpos = worldserver.func_175694_M(); -- this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver); + this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver); - NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.field_72400_f, p_72355_1_, p_72355_2_); -- nethandlerplayserver.func_147359_a(new SPacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.func_186058_p().func_186068_a(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo"))); -+ this.func_72381_a(playerIn, (EntityPlayerMP)null, worldserver); -+ playerIn.field_71135_a = nethandlerplayserver; -+ nethandlerplayserver.func_147359_a(new SPacketJoinGame(playerIn.func_145782_y(), playerIn.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.func_186058_p().func_186068_a(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo"))); ++ p_72355_2_.field_71135_a = nethandlerplayserver; + nethandlerplayserver.func_147359_a(new SPacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.func_186058_p().func_186068_a(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo"))); nethandlerplayserver.func_147359_a(new SPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).func_180714_a(this.func_72365_p().getServerModName()))); nethandlerplayserver.func_147359_a(new SPacketServerDifficulty(worldinfo.func_176130_y(), worldinfo.func_176123_z())); - nethandlerplayserver.func_147359_a(new SPacketSpawnPosition(blockpos)); -- nethandlerplayserver.func_147359_a(new SPacketPlayerAbilities(p_72355_2_.field_71075_bZ)); -- nethandlerplayserver.func_147359_a(new SPacketHeldItemChange(p_72355_2_.field_71071_by.field_70461_c)); -- this.func_187243_f(p_72355_2_); -- p_72355_2_.func_147099_x().func_150877_d(); -- p_72355_2_.func_147099_x().func_150884_b(p_72355_2_); -- this.func_96456_a((ServerScoreboard)worldserver.func_96441_U(), p_72355_2_); -+ nethandlerplayserver.func_147359_a(new SPacketPlayerAbilities(playerIn.field_71075_bZ)); -+ nethandlerplayserver.func_147359_a(new SPacketHeldItemChange(playerIn.field_71071_by.field_70461_c)); -+ this.func_187243_f(playerIn); -+ playerIn.func_147099_x().func_150877_d(); -+ playerIn.func_147099_x().func_150884_b(playerIn); -+ this.func_96456_a((ServerScoreboard)worldserver.func_96441_U(), playerIn); - this.field_72400_f.func_147132_au(); - TextComponentTranslation textcomponenttranslation; - -- if (!p_72355_2_.func_70005_c_().equalsIgnoreCase(s)) -+ if (!playerIn.func_70005_c_().equalsIgnoreCase(s)) - { -- textcomponenttranslation = new TextComponentTranslation("multiplayer.player.joined.renamed", new Object[] {p_72355_2_.func_145748_c_(), s}); -+ textcomponenttranslation = new TextComponentTranslation("multiplayer.player.joined.renamed", new Object[] {playerIn.func_145748_c_(), s}); - } - else - { -- textcomponenttranslation = new TextComponentTranslation("multiplayer.player.joined", new Object[] {p_72355_2_.func_145748_c_()}); -+ textcomponenttranslation = new TextComponentTranslation("multiplayer.player.joined", new Object[] {playerIn.func_145748_c_()}); +@@ -213,6 +224,7 @@ } - textcomponenttranslation.func_150256_b().func_150238_a(TextFormatting.YELLOW); - this.func_148539_a(textcomponenttranslation); -- this.func_72377_c(p_72355_2_); -- nethandlerplayserver.func_147364_a(p_72355_2_.field_70165_t, p_72355_2_.field_70163_u, p_72355_2_.field_70161_v, p_72355_2_.field_70177_z, p_72355_2_.field_70125_A); -- this.func_72354_b(p_72355_2_, worldserver); -+ this.func_72377_c(playerIn); -+ nethandlerplayserver.func_147364_a(playerIn.field_70165_t, playerIn.field_70163_u, playerIn.field_70161_v, playerIn.field_70177_z, playerIn.field_70125_A); -+ this.func_72354_b(playerIn, worldserver); - - if (!this.field_72400_f.func_147133_T().isEmpty()) - { -- p_72355_2_.func_175397_a(this.field_72400_f.func_147133_T(), this.field_72400_f.func_175581_ab()); -+ playerIn.func_175397_a(this.field_72400_f.func_147133_T(), this.field_72400_f.func_175581_ab()); - } - -- for (PotionEffect potioneffect : p_72355_2_.func_70651_bq()) -+ for (PotionEffect potioneffect : playerIn.func_70651_bq()) - { -- nethandlerplayserver.func_147359_a(new SPacketEntityEffect(p_72355_2_.func_145782_y(), potioneffect)); -+ nethandlerplayserver.func_147359_a(new SPacketEntityEffect(playerIn.func_145782_y(), potioneffect)); - } - - if (nbttagcompound != null) -@@ -175,7 +186,7 @@ - - if (entity2.func_110124_au().equals(uuid)) - { -- p_72355_2_.func_184205_a(entity2, true); -+ playerIn.func_184205_a(entity2, true); - } - else - { -@@ -183,13 +194,13 @@ - { - if (entity.func_110124_au().equals(uuid)) - { -- p_72355_2_.func_184205_a(entity, true); -+ playerIn.func_184205_a(entity, true); - break; - } - } - } - -- if (!p_72355_2_.func_184218_aH()) -+ if (!playerIn.func_184218_aH()) - { - field_148546_d.warn("Couldn\'t reattach entity to player"); - worldserver.func_72973_f(entity2); -@@ -207,12 +218,13 @@ - - if (entity1 != null) - { -- p_72355_2_.func_184205_a(entity1, true); -+ playerIn.func_184205_a(entity1, true); - } - } - } - -- p_72355_2_.func_71116_b(); -+ playerIn.func_71116_b(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(playerIn); + p_72355_2_.func_71116_b(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(p_72355_2_); } protected void func_96456_a(ServerScoreboard p_96456_1_, EntityPlayerMP p_96456_2_) @@ -246,53 +145,34 @@ return entityplayermp; } -@@ -545,102 +589,118 @@ +@@ -545,15 +589,20 @@ public void func_187242_a(EntityPlayerMP p_187242_1_, int p_187242_2_) { -- int i = p_187242_1_.field_71093_bK; -- WorldServer worldserver = this.field_72400_f.func_71218_a(p_187242_1_.field_71093_bK); -- p_187242_1_.field_71093_bK = p_187242_2_; -- WorldServer worldserver1 = this.field_72400_f.func_71218_a(p_187242_1_.field_71093_bK); -- p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, p_187242_1_.field_70170_p.func_175659_aa(), p_187242_1_.field_70170_p.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b())); -- this.func_187243_f(p_187242_1_); -- worldserver.func_72973_f(p_187242_1_); -- p_187242_1_.field_70128_L = false; -- this.func_82448_a(p_187242_1_, i, worldserver, worldserver1); -- this.func_72375_a(p_187242_1_, worldserver); -- p_187242_1_.field_71135_a.func_147364_a(p_187242_1_.field_70165_t, p_187242_1_.field_70163_u, p_187242_1_.field_70161_v, p_187242_1_.field_70177_z, p_187242_1_.field_70125_A); -- p_187242_1_.field_71134_c.func_73080_a(worldserver1); -- p_187242_1_.field_71135_a.func_147359_a(new SPacketPlayerAbilities(p_187242_1_.field_71075_bZ)); -- this.func_72354_b(p_187242_1_, worldserver1); -- this.func_72385_f(p_187242_1_); + transferPlayerToDimension(p_187242_1_, p_187242_2_, field_72400_f.func_71218_a(p_187242_2_).func_85176_s()); + } - -- for (PotionEffect potioneffect : p_187242_1_.func_70651_bq()) -+ public void transferPlayerToDimension(EntityPlayerMP player, int dimensionIn, net.minecraft.world.Teleporter teleporter) -+ { -+ int i = player.field_71093_bK; -+ WorldServer worldserver = this.field_72400_f.func_71218_a(player.field_71093_bK); -+ player.field_71093_bK = dimensionIn; -+ WorldServer worldserver1 = this.field_72400_f.func_71218_a(player.field_71093_bK); -+ player.field_71135_a.func_147359_a(new SPacketRespawn(player.field_71093_bK, worldserver1.func_175659_aa(), worldserver1.func_72912_H().func_76067_t(), player.field_71134_c.func_73081_b())); -+ this.func_187243_f(player); -+ worldserver.func_72973_f(player); -+ player.field_70128_L = false; -+ this.transferEntityToWorld(player, i, worldserver, worldserver1, teleporter); -+ this.func_72375_a(player, worldserver); -+ player.field_71135_a.func_147364_a(player.field_70165_t, player.field_70163_u, player.field_70161_v, player.field_70177_z, player.field_70125_A); -+ player.field_71134_c.func_73080_a(worldserver1); -+ player.field_71135_a.func_147359_a(new SPacketPlayerAbilities(player.field_71075_bZ)); -+ this.func_72354_b(player, worldserver1); -+ this.func_72385_f(player); + -+ for (PotionEffect potioneffect : player.func_70651_bq()) ++ public void transferPlayerToDimension(EntityPlayerMP p_187242_1_, int p_187242_2_, net.minecraft.world.Teleporter teleporter) ++ { + int i = p_187242_1_.field_71093_bK; + WorldServer worldserver = this.field_72400_f.func_71218_a(p_187242_1_.field_71093_bK); + p_187242_1_.field_71093_bK = p_187242_2_; + WorldServer worldserver1 = this.field_72400_f.func_71218_a(p_187242_1_.field_71093_bK); +- p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, p_187242_1_.field_70170_p.func_175659_aa(), p_187242_1_.field_70170_p.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b())); ++ p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, worldserver1.func_175659_aa(), worldserver1.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b())); + this.func_187243_f(p_187242_1_); + worldserver.func_72973_f(p_187242_1_); + p_187242_1_.field_70128_L = false; +- this.func_82448_a(p_187242_1_, i, worldserver, worldserver1); ++ this.transferEntityToWorld(p_187242_1_, i, worldserver, worldserver1, teleporter); + this.func_72375_a(p_187242_1_, worldserver); + p_187242_1_.field_71135_a.func_147364_a(p_187242_1_.field_70165_t, p_187242_1_.field_70163_u, p_187242_1_.field_70161_v, p_187242_1_.field_70177_z, p_187242_1_.field_70125_A); + p_187242_1_.field_71134_c.func_73080_a(worldserver1); +@@ -565,17 +614,27 @@ { -- p_187242_1_.field_71135_a.func_147359_a(new SPacketEntityEffect(p_187242_1_.func_145782_y(), potioneffect)); -+ player.field_71135_a.func_147359_a(new SPacketEntityEffect(player.func_145782_y(), potioneffect)); + p_187242_1_.field_71135_a.func_147359_a(new SPacketEntityEffect(p_187242_1_.func_145782_y(), potioneffect)); } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, i, dimensionIn); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_187242_1_, i, p_187242_2_); } public void func_82448_a(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) @@ -303,116 +183,47 @@ + } + + @SuppressWarnings("unused") -+ public void transferEntityToWorld(Entity entityIn, int lastDimension, WorldServer oldWorldIn, WorldServer toWorldIn, net.minecraft.world.Teleporter teleporter) ++ public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter) + { -+ net.minecraft.world.WorldProvider pOld = oldWorldIn.field_73011_w; -+ net.minecraft.world.WorldProvider pNew = toWorldIn.field_73011_w; ++ net.minecraft.world.WorldProvider pOld = p_82448_3_.field_73011_w; ++ net.minecraft.world.WorldProvider pNew = p_82448_4_.field_73011_w; + double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor(); -+ double d0 = entityIn.field_70165_t * moveFactor; -+ double d1 = entityIn.field_70161_v * moveFactor; ++ double d0 = p_82448_1_.field_70165_t * moveFactor; ++ double d1 = p_82448_1_.field_70161_v * moveFactor; double d2 = 8.0D; -- float f = p_82448_1_.field_70177_z; -- p_82448_3_.field_72984_F.func_76320_a("moving"); -+ float f = entityIn.field_70177_z; -+ oldWorldIn.field_72984_F.func_76320_a("moving"); + float f = p_82448_1_.field_70177_z; + p_82448_3_.field_72984_F.func_76320_a("moving"); - if (p_82448_1_.field_71093_bK == -1) -+ if (false && entityIn.field_71093_bK == -1) ++ if (false && p_82448_1_.field_71093_bK == -1) { -- d0 = MathHelper.func_151237_a(d0 / d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); -- d1 = MathHelper.func_151237_a(d1 / d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); -- p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); -+ d0 = MathHelper.func_151237_a(d0 / d2, toWorldIn.func_175723_af().func_177726_b() + 16.0D, toWorldIn.func_175723_af().func_177728_d() - 16.0D); -+ d1 = MathHelper.func_151237_a(d1 / d2, toWorldIn.func_175723_af().func_177736_c() + 16.0D, toWorldIn.func_175723_af().func_177733_e() - 16.0D); -+ entityIn.func_70012_b(d0, entityIn.field_70163_u, d1, entityIn.field_70177_z, entityIn.field_70125_A); - -- if (p_82448_1_.func_70089_S()) -+ if (entityIn.func_70089_S()) - { -- p_82448_3_.func_72866_a(p_82448_1_, false); -+ oldWorldIn.func_72866_a(entityIn, false); + d0 = MathHelper.func_151237_a(d0 / d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); + d1 = MathHelper.func_151237_a(d1 / d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); +@@ -586,7 +645,7 @@ + p_82448_3_.func_72866_a(p_82448_1_, false); } } - else if (p_82448_1_.field_71093_bK == 0) -+ else if (false && entityIn.field_71093_bK == 0) ++ else if (false && p_82448_1_.field_71093_bK == 0) { -- d0 = MathHelper.func_151237_a(d0 * d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); -- d1 = MathHelper.func_151237_a(d1 * d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); -- p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); -+ d0 = MathHelper.func_151237_a(d0 * d2, toWorldIn.func_175723_af().func_177726_b() + 16.0D, toWorldIn.func_175723_af().func_177728_d() - 16.0D); -+ d1 = MathHelper.func_151237_a(d1 * d2, toWorldIn.func_175723_af().func_177736_c() + 16.0D, toWorldIn.func_175723_af().func_177733_e() - 16.0D); -+ entityIn.func_70012_b(d0, entityIn.field_70163_u, d1, entityIn.field_70177_z, entityIn.field_70125_A); - -- if (p_82448_1_.func_70089_S()) -+ if (entityIn.func_70089_S()) - { -- p_82448_3_.func_72866_a(p_82448_1_, false); -+ oldWorldIn.func_72866_a(entityIn, false); + d0 = MathHelper.func_151237_a(d0 * d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); + d1 = MathHelper.func_151237_a(d1 * d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); +@@ -597,7 +656,8 @@ + p_82448_3_.func_72866_a(p_82448_1_, false); } } - else + -+ if (entityIn.field_71093_bK == 1) ++ if (p_82448_1_.field_71093_bK == 1) { BlockPos blockpos; -- if (p_82448_2_ == 1) -+ if (lastDimension == 1) +@@ -632,7 +692,7 @@ + if (p_82448_1_.func_70089_S()) { -- blockpos = p_82448_4_.func_175694_M(); -+ blockpos = toWorldIn.func_175694_M(); - } - else - { -- blockpos = p_82448_4_.func_180504_m(); -+ blockpos = toWorldIn.func_180504_m(); - } - - d0 = (double)blockpos.func_177958_n(); -- p_82448_1_.field_70163_u = (double)blockpos.func_177956_o(); -+ entityIn.field_70163_u = (double)blockpos.func_177956_o(); - d1 = (double)blockpos.func_177952_p(); -- p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, 90.0F, 0.0F); -+ entityIn.func_70012_b(d0, entityIn.field_70163_u, d1, 90.0F, 0.0F); - -- if (p_82448_1_.func_70089_S()) -+ if (entityIn.func_70089_S()) - { -- p_82448_3_.func_72866_a(p_82448_1_, false); -+ oldWorldIn.func_72866_a(entityIn, false); - } - } - -- p_82448_3_.field_72984_F.func_76319_b(); -+ oldWorldIn.field_72984_F.func_76319_b(); - -- if (p_82448_2_ != 1) -+ if (lastDimension != 1) - { -- p_82448_3_.field_72984_F.func_76320_a("placing"); -+ oldWorldIn.field_72984_F.func_76320_a("placing"); - d0 = (double)MathHelper.func_76125_a((int)d0, -29999872, 29999872); - d1 = (double)MathHelper.func_76125_a((int)d1, -29999872, 29999872); - -- if (p_82448_1_.func_70089_S()) -+ if (entityIn.func_70089_S()) - { -- p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); + p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); - p_82448_4_.func_85176_s().func_180266_a(p_82448_1_, f); -- p_82448_4_.func_72838_d(p_82448_1_); -- p_82448_4_.func_72866_a(p_82448_1_, false); -+ entityIn.func_70012_b(d0, entityIn.field_70163_u, d1, entityIn.field_70177_z, entityIn.field_70125_A); -+ teleporter.func_180266_a(entityIn, f); -+ toWorldIn.func_72838_d(entityIn); -+ toWorldIn.func_72866_a(entityIn, false); ++ teleporter.func_180266_a(p_82448_1_, f); + p_82448_4_.func_72838_d(p_82448_1_); + p_82448_4_.func_72866_a(p_82448_1_, false); } - -- p_82448_3_.field_72984_F.func_76319_b(); -+ oldWorldIn.field_72984_F.func_76319_b(); - } - -- p_82448_1_.func_70029_a(p_82448_4_); -+ entityIn.func_70029_a(toWorldIn); - } - - public void func_72374_b() diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 3acac0b2d2..9b6ed04ffb 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -4,7 +4,7 @@ net/minecraft/client/renderer/RenderGlobal.drawBlockDamageTexture(Lnet/minecraft net/minecraft/client/renderer/entity/RenderItem.renderDroppedItem(Lnet/minecraft/entity/item/EntityItem;Lnet/minecraft/util/IIcon;IFFFFI)V=|p_77020_1_,p_77020_2_,p_77020_3_,p_77020_4_,p_77020_5_,p_77020_6_,p_77020_7_,pass net/minecraft/client/renderer/entity/RenderItem.renderItemIntoGUI(Lnet/minecraft/client/gui/FontRenderer;Lnet/minecraft/client/renderer/texture/TextureManager;Lnet/minecraft/item/ItemStack;IIZ)V=|p_77015_1_,p_77015_2_,p_77015_3_,p_77015_4_,p_77015_5_,renderEffect net/minecraft/server/management/PlayerList.transferPlayerToDimension(Lnet/minecraft/entity/player/EntityPlayerMP;ILnet/minecraft/world/Teleporter;)V=|p_187242_1_,p_187242_2_,teleporter -net/minecraft/server/management/ServerConfigurationManager.transferEntityToWorld(Lnet/minecraft/entity/Entity;ILnet/minecraft/world/WorldServer;Lnet/minecraft/world/WorldServer;Lnet/minecraft/world/Teleporter;)V=|p_82448_1_,p_82448_2_,p_82448_3_,p_82448_4_,teleporter +net/minecraft/server/management/PlayerList.transferEntityToWorld(Lnet/minecraft/entity/Entity;ILnet/minecraft/world/WorldServer;Lnet/minecraft/world/WorldServer;Lnet/minecraft/world/Teleporter;)V=|p_82448_1_,p_82448_2_,p_82448_3_,p_82448_4_,teleporter net/minecraft/world/World.getBiomeGenForCoordsBody(II)Lnet/minecraft/world/biome/BiomeGenBase;=|p_72807_1_,p_72807_2_ net/minecraft/world/World.getSunBrightnessFactor(F)F=|p_72967_1_ net/minecraft/world/World.getSunBrightnessBody(F)F=|p_72971_1_ @@ -38,7 +38,7 @@ net/minecraft/client/renderer/block/model/FaceBakery.rotateVertex(Lorg/lwjgl/uti net/minecraft/item/ItemBlock.setTileEntityNBT(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/EntityPlayer;)Z=|p_179224_0_,p_179224_1_,p_179224_2_,player -net/minecraft/server/management/ServerConfigurationManager.initializeConnectionToPlayer(Lnet/minecraft/network/NetworkManager;Lnet/minecraft/entity/player/EntityPlayerMP;Lnet/minecraft/network/NetHandlerPlayServer;)V=|p_72355_1_,p_72355_2_,nethandlerplayserver +net/minecraft/server/management/PlayerList.initializeConnectionToPlayer(Lnet/minecraft/network/NetworkManager;Lnet/minecraft/entity/player/EntityPlayerMP;Lnet/minecraft/network/NetHandlerPlayServer;)V=|p_72355_1_,p_72355_2_,nethandlerplayserver net/minecraft/item/ItemMonsterPlacer.spawnCreature(Lnet/minecraft/world/World;Ljava/lang/String;DDD)Lnet/minecraft/entity/Entity;=|p_77840_0_,name,p_77840_2_,p_77840_4_,p_77840_6_ net/minecraft/stats/StatList.mergeStatBases([Lnet/minecraft/stats/StatBase;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Z)V=|p_151180_0_,p_151180_1_,p_151180_2_,useItemIds From a799bbad2d2073400c5c9f327b4a07fe8dbe13da Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sun, 13 Mar 2016 12:10:50 +0300 Subject: [PATCH 079/243] First version of updated of ModelLoader, mostly works. --- .../block/model/ModelBakery.java.patch | 9 ++- .../block/model/ModelManager.java.patch | 7 +- .../client/ForgeHooksClient.java | 13 ++-- .../client/model/ForgeBlockStateV1.java | 63 ++++++++------- .../client/model/ModelLoader.java | 41 ++++++---- .../client/model/MultiModel.java | 3 +- .../client/model/TRSRTransformation.java | 78 +++++++++++++++---- src/main/resources/forge_at.cfg | 6 ++ .../debug/ModelAnimationDebug.java | 2 +- 9 files changed, 147 insertions(+), 75 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch index 58f3083416..bdacc607fe 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch @@ -1,6 +1,13 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java -@@ -132,7 +132,7 @@ +@@ -126,13 +126,13 @@ + { + try + { +- this.field_177612_i.put(modelresourcelocation, modelblockdefinition.func_188004_c(modelresourcelocation.func_177518_c())); ++ this.func_177569_a(modelblockdefinition, modelresourcelocation); + } + catch (RuntimeException var12) { if (!modelblockdefinition.func_188002_b()) { diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch index c64c3804fb..b05f5c139c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch @@ -1,15 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java -@@ -24,9 +24,11 @@ +@@ -24,9 +24,10 @@ public void func_110549_a(IResourceManager p_110549_1_) { - ModelBakery modelbakery = new ModelBakery(p_110549_1_, this.field_174956_b, this.field_174957_c); -+ // FIXME: reenable after ModelLoader is fixed -+ ModelBakery modelbakery = new ModelBakery(p_110549_1_, this.field_174956_b, this.field_174957_c); //new net.minecraftforge.client.model.ModelLoader(resourceManager, this.texMap, this.modelProvider); ++ net.minecraftforge.client.model.ModelLoader modelbakery = new net.minecraftforge.client.model.ModelLoader(p_110549_1_, this.field_174956_b, this.field_174957_c); this.field_174958_a = modelbakery.func_177570_a(); this.field_174955_d = (IBakedModel)this.field_174958_a.func_82594_a(ModelBakery.field_177604_a); -+ //net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelRegistry, modelbakery); ++ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.field_174958_a, modelbakery); this.field_174957_c.func_178124_c(); } diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 45f830adef..3b6096a8a7 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -395,13 +395,16 @@ public class ForgeHooksClient { Pair pair = ((IPerspectiveAwareModel)model).handlePerspective(cameraTransformType); - Matrix4f matrix = new Matrix4f(pair.getRight()); - if(leftHandHackery) + if(pair.getRight() != null) { - matrix.mul(flipX, matrix); - matrix.mul(matrix, flipX); + Matrix4f matrix = new Matrix4f(pair.getRight()); + if(leftHandHackery) + { + matrix.mul(flipX, matrix); + matrix.mul(matrix, flipX); + } + if(pair.getRight() != null) multiplyCurrentGlMatrix(pair.getRight()); } - if(pair.getRight() != null) multiplyCurrentGlMatrix(pair.getRight()); return pair.getLeft(); } else diff --git a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java index 95d871d17e..e178bc33aa 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java @@ -435,6 +435,15 @@ public class ForgeBlockStateV1 extends Marker throw new UnsupportedOperationException("Forge BlockStateLoader V1 does not support nested submodels."); } + private TRSRTransformation get(float tx, float ty, float tz, float ax, float ay, float az, float s) + { + return TRSRTransformation.blockCenterToCorner(new TRSRTransformation( + new Vector3f(tx / 16, ty / 16, tz / 16), + TRSRTransformation.quatFromXYZDegrees(new Vector3f(ax, ay, az)), + new Vector3f(s, s, s), + null)); + } + @Override public ForgeBlockStateV1.Variant deserialize(JsonElement element, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { @@ -476,47 +485,41 @@ public class ForgeBlockStateV1 extends Marker { String transform = json.get("transform").getAsString(); // Note: these strings might change to a full-blown resource locations in the future, and move from here to some json somewhere + // TODO: vanilla now includes from parent, deprecate? if (transform.equals("identity")) { ret.state = Optional.of(TRSRTransformation.identity()); } - /*else if (transform.equals("forge:default-block")) + // block/block + else if (transform.equals("forge:default-block")) { - TRSRTransformation thirdperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( - new Vector3f(0, 1.5f / 16, -2.75f / 16), - TRSRTransformation.quatFromYXZDegrees(new Vector3f(10, -45, 170)), - new Vector3f(0.375f, 0.375f, 0.375f), - null)); - ret.state = Optional.of(new SimpleModelState(ImmutableMap.of(TransformType.THIRD_PERSON, thirdperson))); + ImmutableMap.Builder builder = ImmutableMap.builder(); + builder.put(TransformType.GUI, get(0, 0, 0, 30, 225, 0, 0.625f)); + builder.put( TransformType.GROUND, get(0, 3, 0, 0, 0, 0, 0.25f)); + builder.put(TransformType.FIXED, get(0, 0, 0, 0, 0, 0, 0.5f)); + builder.put(TransformType.THIRD_PERSON_RIGHT_HAND, get(0, 2.5f, 0, 75, 45, 0, 0.375f)); + builder.put( TransformType.FIRST_PERSON_RIGHT_HAND, get(0, 0, 0, 0, 45, 0, 0.4f)); + builder.put(TransformType.FIRST_PERSON_LEFT_HAND, get(0, 0, 0, 0, 255, 0, 0.4f)); + ret.state = Optional.of(new SimpleModelState(builder.build())); } + // item/generated else if (transform.equals("forge:default-item")) { - TRSRTransformation thirdperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( - new Vector3f(0, 1f / 16, -3f / 16), - TRSRTransformation.quatFromYXZDegrees(new Vector3f(-90, 0, 0)), - new Vector3f(0.55f, 0.55f, 0.55f), - null)); - TRSRTransformation firstperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( - new Vector3f(0, 4f / 16, 2f / 16), - TRSRTransformation.quatFromYXZDegrees(new Vector3f(0, -135, 25)), - new Vector3f(1.7f, 1.7f, 1.7f), - null)); - ret.state = Optional.of(new SimpleModelState(ImmutableMap.of(TransformType.THIRD_PERSON, thirdperson, TransformType.FIRST_PERSON, firstperson))); + ret.state = Optional.of(new SimpleModelState(ImmutableMap.of( + TransformType.GROUND, get(0, 2, 0, 0, 0, 0, 0.5f), + TransformType.HEAD, get(0, 13, 7, 0, 180, 0, 1), + TransformType.THIRD_PERSON_RIGHT_HAND, get(0, 3, 1, 0, 0, 0, 0.55f), + TransformType.FIRST_PERSON_RIGHT_HAND, get(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f)))); } + // item/handheld else if (transform.equals("forge:default-tool")) { - TRSRTransformation thirdperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( - new Vector3f(0, 1.25f / 16, -3.5f / 16), - TRSRTransformation.quatFromYXZDegrees(new Vector3f(0, 90, -35)), - new Vector3f(0.85f, 0.85f, 0.85f), - null)); - TRSRTransformation firstperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( - new Vector3f(0, 4f / 16, 2f / 16), - TRSRTransformation.quatFromYXZDegrees(new Vector3f(0, -135, 25)), - new Vector3f(1.7f, 1.7f, 1.7f), - null)); - ret.state = Optional.of(new SimpleModelState(ImmutableMap.of(TransformType.THIRD_PERSON, thirdperson, TransformType.FIRST_PERSON, firstperson))); - }*/ // FIXME + ret.state = Optional.of(new SimpleModelState(ImmutableMap.of( + TransformType.THIRD_PERSON_RIGHT_HAND, get(0, 4, 0.5f, 0, -90, 55, 0.85f), + TransformType.THIRD_PERSON_LEFT_HAND, get(0, 4, 0.5f, 0, 90, -55, 0.85f), + TransformType.FIRST_PERSON_RIGHT_HAND, get(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f), + TransformType.FIRST_PERSON_LEFT_HAND, get(1.13f, 3.2f, 1.13f, 0, 90, -25, 0.68f)))); + } else { throw new JsonParseException("transform: unknown default string: " + transform); diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 6d2253e076..7607f133eb 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -8,7 +8,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -110,7 +109,7 @@ public class ModelLoader extends ModelBakery { isLoading = true; loadBlocks(); - loadItems(); + loadVariantItemModels(); try { missingModel = getModel(new ResourceLocation(MODEL_MISSING.getResourceDomain(), MODEL_MISSING.getResourcePath())); @@ -148,7 +147,15 @@ public class ModelLoader extends ModelBakery return bakedRegistry; } - private void loadBlocks() + // NOOP, replaced by dependency resolution + @Override + protected void loadVariantModels() {} + + // NOOP, replaced by dependency resolution + @Override + protected void loadMultipartVariantModels() {} + + /*private void loadBlocks() { Map stateMap = blockModelShapes.getBlockStateMapper().putAllStateModelLocations(); List variants = Lists.newArrayList(stateMap.values()); @@ -168,9 +175,10 @@ public class ModelLoader extends ModelBakery blockBar.step(variant.toString()); } ProgressManager.pop(blockBar); - } + }*/ // FIXME: all the new shiny multipart things + @Deprecated private void loadVariant(ModelResourceLocation variant) { try @@ -192,23 +200,20 @@ public class ModelLoader extends ModelBakery } } - // FIXME: this is probably not the hook point anymore @Override protected void registerVariant(ModelBlockDefinition definition, ModelResourceLocation location) { - // for now - super.registerVariant(definition, location); - - /*VariantList variants = null; + // TODO loader? + VariantList variants = null; try { - variants = definition.getVariants(location.getVariant()); + variants = definition.getVariant(location.getVariant()); } catch(MissingVariantException e) { missingVariants.add(location); } - if (variants != null && !variants.getVariants().isEmpty()) + if (variants != null && !variants.getVariantList().isEmpty()) { try { @@ -218,7 +223,7 @@ public class ModelLoader extends ModelBakery { throw new RuntimeException(e); } - }*/ + } } private void storeException(ResourceLocation location, Exception exception) @@ -240,7 +245,8 @@ public class ModelLoader extends ModelBakery return new ModelBlockDefinition(new ArrayList()); } - private void loadItems() + @Override + protected void loadItemModels() { // register model for the universal bucket, if it exists if(FluidRegistry.isUniversalBucketEnabled()) @@ -454,8 +460,13 @@ public class ModelLoader extends ModelBakery public Collection getDependencies() { - if(model.getParentLocation() == null || model.getParentLocation().getResourcePath().startsWith("builtin/")) return Collections.emptyList(); - return Collections.singletonList(model.getParentLocation()); + Set set = Sets.newHashSet(); + set.addAll(model.getOverrideLocations()); + if(model.getParentLocation() != null && !model.getParentLocation().getResourcePath().startsWith("builtin/")) + { + set.add(model.getParentLocation()); + } + return ImmutableSet.copyOf(set); } public Collection getTextures() diff --git a/src/main/java/net/minecraftforge/client/model/MultiModel.java b/src/main/java/net/minecraftforge/client/model/MultiModel.java index 1e6ba7b1b6..c35004f7a6 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiModel.java @@ -169,8 +169,7 @@ public class MultiModel implements IModel @Override public ItemOverrideList getOverrides() { - // TODO Auto-generated method stub - return null; + return ItemOverrideList.NONE; } } diff --git a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java index 2cd3bef15f..06d05167b2 100644 --- a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java +++ b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java @@ -8,7 +8,6 @@ import javax.vecmath.Tuple4f; import javax.vecmath.Vector3f; import javax.vecmath.Vector4f; -import net.minecraft.client.renderer.block.model.ItemTransformVec3f; import net.minecraft.client.renderer.block.model.ModelRotation; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.Vec3i; @@ -31,7 +30,6 @@ import com.google.common.base.Optional; * should be comparable to using Matrix4f directly. * Immutable. */ -@SuppressWarnings("deprecation") public class TRSRTransformation implements IModelState, ITransformation { private final Matrix4f matrix; @@ -64,14 +62,16 @@ public class TRSRTransformation implements IModelState, ITransformation full = true; } - public TRSRTransformation(ItemTransformVec3f transform) + @Deprecated + public TRSRTransformation(net.minecraft.client.renderer.block.model.ItemTransformVec3f transform) { this(getMatrix(transform)); } - public static Matrix4f getMatrix(ItemTransformVec3f transform) + @Deprecated + public static Matrix4f getMatrix(net.minecraft.client.renderer.block.model.ItemTransformVec3f transform) { - TRSRTransformation ret = new TRSRTransformation(toVecmath(transform.translation), quatFromYXZDegrees(toVecmath(transform.rotation)), toVecmath(transform.scale), null); + TRSRTransformation ret = new TRSRTransformation(toVecmath(transform.translation), quatFromXYZDegrees(toVecmath(transform.rotation)), toVecmath(transform.scale), null); return blockCenterToCorner(ret).getMatrix(); } @@ -135,16 +135,6 @@ public class TRSRTransformation implements IModelState, ITransformation } } - public static Quat4f quatFromYXZDegrees(Vector3f yxz) - { - return quatFromYXZ((float)Math.toRadians(yxz.y), (float)Math.toRadians(yxz.x), (float)Math.toRadians(yxz.z)); - } - - public static Quat4f quatFromYXZ(Vector3f yxz) - { - return quatFromYXZ(yxz.y, yxz.x, yxz.z); - } - public static Quat4f quatFromYXZ(float y, float x, float z) { Quat4f ret = new Quat4f(0, 0, 0, 1), t = new Quat4f(); @@ -157,6 +147,28 @@ public class TRSRTransformation implements IModelState, ITransformation return ret; } + public static Quat4f quatFromXYZDegrees(Vector3f xyz) + { + return quatFromXYZ((float)Math.toRadians(xyz.x), (float)Math.toRadians(xyz.y), (float)Math.toRadians(xyz.z)); + } + + public static Quat4f quatFromXYZ(Vector3f xyz) + { + return quatFromXYZ(xyz.x, xyz.y, xyz.z); + } + + public static Quat4f quatFromXYZ(float x, float y, float z) + { + Quat4f ret = new Quat4f(0, 0, 0, 1), t = new Quat4f(); + t.set((float)Math.sin(x/2), 0, 0, (float)Math.cos(x/2)); + ret.mul(t); + t.set(0, (float)Math.sin(y/2), 0, (float)Math.cos(y/2)); + ret.mul(t); + t.set(0, 0, (float)Math.sin(z/2), (float)Math.cos(z/2)); + ret.mul(t); + return ret; + } + public static Vector3f toYXZDegrees(Quat4f q) { Vector3f yxz = toYXZ(q); @@ -187,6 +199,37 @@ public class TRSRTransformation implements IModelState, ITransformation ); } + public static Vector3f toXYZDegrees(Quat4f q) + { + Vector3f xyz = toXYZ(q); + return new Vector3f((float)Math.toDegrees(xyz.x), (float)Math.toDegrees(xyz.y), (float)Math.toDegrees(xyz.z)); + } + + // TODO check if correct + public static Vector3f toXYZ(Quat4f q) + { + float w2 = q.w * q.w; + float x2 = q.x * q.x; + float y2 = q.y * q.y; + float z2 = q.z * q.z; + float l = w2 + x2 + y2 + z2; + float sy = 2 * q.w * q.x - 2 * q.y * q.z; + float y = (float)Math.asin(sy / l); + if(Math.abs(sy) > .999f * l) + { + return new Vector3f( + 2 * (float)Math.atan2(q.x, q.w), + y, + 0 + ); + } + return new Vector3f( + (float)Math.atan2(2 * q.y * q.z + 2 * q.x * q.w, w2 - x2 - y2 + z2), + y, + (float)Math.atan2(2 * q.x * q.y + 2 * q.w * q.z, w2 + x2 - y2 - z2) + ); + } + public static Matrix4f mul(Vector3f translation, Quat4f leftRot, Vector3f scale, Quat4f rightRot) { Matrix4f res = new Matrix4f(), t = new Matrix4f(); @@ -447,9 +490,10 @@ public class TRSRTransformation implements IModelState, ITransformation /* * Don't use this if you don't need to, conversion is lossy (second rotation component is lost). */ - public ItemTransformVec3f toItemTransform() + @Deprecated + public net.minecraft.client.renderer.block.model.ItemTransformVec3f toItemTransform() { - return new ItemTransformVec3f(toLwjgl(toYXZDegrees(getLeftRot())), toLwjgl(getTranslation()), toLwjgl(getScale())); + return new net.minecraft.client.renderer.block.model.ItemTransformVec3f(toLwjgl(toXYZDegrees(getLeftRot())), toLwjgl(getTranslation()), toLwjgl(getScale())); } public Matrix4f getMatrix() diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index 534b145cd4..4281d02692 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -141,6 +141,12 @@ protected net.minecraft.client.renderer.block.model.ModelBakery func_177581_b(Ln protected net.minecraft.client.renderer.block.model.ModelBakery func_177587_c(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Z # isCustomRenderer protected net.minecraft.client.renderer.block.model.ModelBakery func_177582_d(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Lnet/minecraft/client/renderer/block/model/ModelBlock; # makeItemModel protected net.minecraft.client.renderer.block.model.ModelBakery func_177580_d(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/util/ResourceLocation; # getModelLocation +protected net.minecraft.client.renderer.block.model.ModelBakery func_188640_b()V # loadBlocks +protected net.minecraft.client.renderer.block.model.ModelBakery func_177577_b()V # loadVariantItemModels +protected net.minecraft.client.renderer.block.model.ModelBakery func_177590_d()V # loadItemModels +protected net.minecraft.client.renderer.block.model.ModelBakery func_177595_c()V # loadVariantModels +protected net.minecraft.client.renderer.block.model.ModelBakery func_188637_e()V # loadMultipartVariantModels +protected net.minecraft.client.renderer.block.model.ModelBakery func_188638_a(Lnet/minecraft/client/renderer/block/model/ModelResourceLocation;Lnet/minecraft/client/renderer/block/model/VariantList;)V # loadVariantList #public net.minecraft.client.renderer.block.model.WeightedBakedModel field_177565_b # models # EnumFacing public net.minecraft.util.EnumFacing field_82609_l # VALUES diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index 8001c0edd0..1951cfbc03 100644 --- a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -64,7 +64,7 @@ import org.apache.commons.lang3.tuple.Pair; import com.google.common.collect.ImmutableMap; -//@Mod(modid = ModelAnimationDebug.MODID, version = ModelAnimationDebug.VERSION) +@Mod(modid = ModelAnimationDebug.MODID, version = ModelAnimationDebug.VERSION) public class ModelAnimationDebug { public static final String MODID = "forgedebugmodelanimation"; From 5d352bda6c159dadaddb9d046037dfd7e908c856 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sun, 13 Mar 2016 16:16:25 +0300 Subject: [PATCH 080/243] Big model loader refactoring: simplified a lot of things, broke some error reporting. Still generally works. --- .../block/model/ItemOverrideList.java.patch | 17 +- .../block/model/ModelBakery.java.patch | 16 +- .../client/model/BlockStateLoader.java | 15 +- .../client/model/ICustomModelLoader.java | 4 +- .../client/model/ISmartVariant.java | 2 +- .../client/model/ItemLayerModel.java | 21 +- .../client/model/ModelDynBucket.java | 3 +- .../client/model/ModelLoader.java | 401 +++++++++--------- .../client/model/ModelLoaderRegistry.java | 78 +++- .../client/model/MultiLayerModel.java | 13 +- .../client/model/animation/Clips.java | 20 +- .../client/model/b3d/B3DLoader.java | 6 +- .../client/model/obj/OBJLoader.java | 5 +- .../debug/ModelAnimationDebug.java | 79 ++-- .../debug/ModelLoaderRegistryDebug.java | 10 +- .../models/block/engine.json | 2 - 16 files changed, 346 insertions(+), 346 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch index 6f23a6d7b4..c6a455d288 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch @@ -1,17 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java -@@ -1,7 +1,10 @@ - package net.minecraft.client.renderer.block.model; - - import com.google.common.collect.Lists; -+ - import java.util.List; -+ -+import net.minecraft.client.Minecraft; - import net.minecraft.entity.EntityLivingBase; - import net.minecraft.item.ItemStack; - import net.minecraft.util.ResourceLocation; -@@ -27,6 +30,7 @@ +@@ -27,6 +27,7 @@ } } @@ -19,7 +8,7 @@ public ResourceLocation func_188021_a(ItemStack p_188021_1_, World p_188021_2_, EntityLivingBase p_188021_3_) { if (!this.field_188023_b.isEmpty()) -@@ -42,4 +46,18 @@ +@@ -42,4 +43,18 @@ return null; } @@ -32,7 +21,7 @@ + ResourceLocation location = func_188021_a(stack, world, entity); + if (location != null) + { -+ return Minecraft.func_71410_x().func_175599_af().func_175037_a().func_178083_a().func_174953_a(new ModelResourceLocation(location, "inventory")); ++ return net.minecraft.client.Minecraft.func_71410_x().func_175599_af().func_175037_a().func_178083_a().func_174953_a(net.minecraftforge.client.model.ModelLoader.getInventoryVariant(location.toString())); + } + } + return originalModel; diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch index bdacc607fe..f3b09c438e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch @@ -1,5 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java +@@ -109,7 +109,7 @@ + { + Collection collection = Sets.newHashSet(map.values()); + modelblockdefinition.func_188001_c().func_188138_a(block.func_176194_O()); +- this.field_188642_k.put(modelblockdefinition, Lists.newArrayList(Iterables.filter(collection, new Predicate() ++ registerMultipartVariant(modelblockdefinition, Lists.newArrayList(Iterables.filter(collection, new Predicate() + { + public boolean apply(ModelResourceLocation p_apply_1_) + { @@ -126,13 +126,13 @@ { try @@ -98,11 +107,16 @@ private void func_177597_h() { this.func_177574_i(); -@@ -878,4 +893,18 @@ +@@ -878,4 +893,23 @@ field_177606_o.field_178317_b = "generation marker"; field_177616_r.field_178317_b = "block entity marker"; } + ++ protected void registerMultipartVariant(ModelBlockDefinition definition, Collection locations) ++ { ++ this.field_188642_k.put(definition, locations); ++ } ++ + private static Map, Set> customVariantNames = Maps.newHashMap(); + + public static void registerItemVariants(Item item, ResourceLocation... names) diff --git a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java index 9ee47e39f8..4700d20337 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java +++ b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java @@ -160,10 +160,10 @@ public class BlockStateLoader * Used to replace the base model with a retextured model containing submodels. */ @Override - public IModel process(IModel base, ModelLoader loader) + public IModel process(IModel base) { int size = parts.size(); - boolean hasBase = base != loader.getMissingModel(); + boolean hasBase = base != ModelLoaderRegistry.getMissingModel(); if (hasBase) { @@ -182,16 +182,7 @@ public class BlockStateLoader { SubModel part = entry.getValue(); - IModel model = null; - try - { - model = loader.getModel(part.getModelLocation()); - } - catch (IOException e) - { - FMLLog.warning("Unable to load block sub-model: \'" + part.getModelLocation() /*+ "\' for variant: \'" + parent*/ + "\': " + e.toString()); - model = loader.getMissingModel(); // Will make it look weird, but that is good. - } + IModel model = ModelLoaderRegistry.getModel(part.getModelLocation()); IModelState partState = new ModelStateComposition(baseTr, part.getState()); diff --git a/src/main/java/net/minecraftforge/client/model/ICustomModelLoader.java b/src/main/java/net/minecraftforge/client/model/ICustomModelLoader.java index beeaecbaae..6dd74668f9 100644 --- a/src/main/java/net/minecraftforge/client/model/ICustomModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ICustomModelLoader.java @@ -1,7 +1,5 @@ package net.minecraftforge.client.model; -import java.io.IOException; - import net.minecraft.client.resources.IResourceManagerReloadListener; import net.minecraft.util.ResourceLocation; @@ -16,5 +14,5 @@ public interface ICustomModelLoader extends IResourceManagerReloadListener /* * loads (or reloads) specified model */ - public IModel loadModel(ResourceLocation modelLocation) throws IOException; + public IModel loadModel(ResourceLocation modelLocation); } diff --git a/src/main/java/net/minecraftforge/client/model/ISmartVariant.java b/src/main/java/net/minecraftforge/client/model/ISmartVariant.java index 8a03b4a3f8..5a1a9185d8 100644 --- a/src/main/java/net/minecraftforge/client/model/ISmartVariant.java +++ b/src/main/java/net/minecraftforge/client/model/ISmartVariant.java @@ -3,5 +3,5 @@ package net.minecraftforge.client.model; public interface ISmartVariant { - IModel process(IModel base, ModelLoader loader); + IModel process(IModel base); } diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index df577e336e..b8946e1003 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -34,15 +34,22 @@ public class ItemLayerModel implements IRetexturableModel public static final ItemLayerModel instance = new ItemLayerModel(ImmutableList.of()); private final ImmutableList textures; + private final ItemOverrideList overrides; public ItemLayerModel(ImmutableList textures) + { + this(textures, ItemOverrideList.NONE); + } + + public ItemLayerModel(ImmutableList textures, ItemOverrideList overrides) { this.textures = textures; + this.overrides = overrides; } public ItemLayerModel(ModelBlock model) { - this(getTextures(model)); + this(getTextures(model), model.createOverrides()); } private static ImmutableList getTextures(ModelBlock model) @@ -84,7 +91,7 @@ public class ItemLayerModel implements IRetexturableModel builder.add(this.textures.get(i)); } } - return new ItemLayerModel(builder.build()); + return new ItemLayerModel(builder.build(), overrides); } public IBakedModel bake(IModelState state, final VertexFormat format, Function bakedTextureGetter) @@ -98,7 +105,7 @@ public class ItemLayerModel implements IRetexturableModel } TextureAtlasSprite particle = bakedTextureGetter.apply(textures.isEmpty() ? new ResourceLocation("missingno") : textures.get(0)); ImmutableMap map = IPerspectiveAwareModel.MapWrapper.getTransforms(state); - return new BakedItemModel(builder.build(), particle, map, null); + return new BakedItemModel(builder.build(), particle, map, overrides, null); } private static class BakedItemModel implements IPerspectiveAwareModel @@ -108,12 +115,14 @@ public class ItemLayerModel implements IRetexturableModel private final ImmutableMap transforms; private final IBakedModel otherModel; private final boolean isCulled; + private final ItemOverrideList overrides; - public BakedItemModel(ImmutableList quads, TextureAtlasSprite particle, ImmutableMap transforms, IBakedModel otherModel) + public BakedItemModel(ImmutableList quads, TextureAtlasSprite particle, ImmutableMap transforms, ItemOverrideList overrides, IBakedModel otherModel) { this.quads = quads; this.particle = particle; this.transforms = transforms; + this.overrides = overrides; if(otherModel != null) { this.otherModel = otherModel; @@ -129,7 +138,7 @@ public class ItemLayerModel implements IRetexturableModel builder.add(quad); } } - this.otherModel = new BakedItemModel(builder.build(), particle, transforms, this); + this.otherModel = new BakedItemModel(builder.build(), particle, transforms, overrides, this); isCulled = false; } } @@ -139,7 +148,7 @@ public class ItemLayerModel implements IRetexturableModel public boolean isBuiltInRenderer() { return false; } public TextureAtlasSprite getParticleTexture() { return particle; } public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; } - public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; } + public ItemOverrideList getOverrides() { return overrides; } public List getQuads(IBlockState state, EnumFacing side, long rand) { if(side == null) return quads; diff --git a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java index c0cf212ef9..6b4303126c 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java +++ b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java @@ -1,6 +1,5 @@ package net.minecraftforge.client.model; -import java.io.IOException; import java.util.Collection; import java.util.List; import java.util.Map; @@ -212,7 +211,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableMo } @Override - public IModel loadModel(ResourceLocation modelLocation) throws IOException + public IModel loadModel(ResourceLocation modelLocation) { return MODEL; } diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 7607f133eb..781bafbe2b 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -3,8 +3,6 @@ package net.minecraftforge.client.model; import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferedImage; -import java.io.FileNotFoundException; -import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -12,6 +10,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Queue; import java.util.Set; import com.google.common.base.Joiner; @@ -33,6 +32,7 @@ import net.minecraft.client.renderer.block.model.ItemModelGenerator; import net.minecraft.client.renderer.block.model.ModelBlock; import net.minecraft.client.renderer.block.model.ModelBlockDefinition; import net.minecraft.client.renderer.block.model.ModelBlockDefinition.MissingVariantException; +import net.minecraft.client.renderer.block.model.MultipartBakedModel; import net.minecraft.client.renderer.block.model.Variant; import net.minecraft.client.renderer.block.model.VariantList; import net.minecraft.client.renderer.block.statemap.IStateMapper; @@ -49,6 +49,8 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.model.ModelRotation; import net.minecraft.client.renderer.block.model.SimpleBakedModel; import net.minecraft.client.renderer.block.model.WeightedBakedModel; +import net.minecraft.client.renderer.block.model.multipart.Multipart; +import net.minecraft.client.renderer.block.model.multipart.Selector; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -77,13 +79,10 @@ import org.apache.commons.lang3.tuple.Pair; import com.google.common.base.Function; import com.google.common.base.Optional; -import com.google.common.base.Throwables; public class ModelLoader extends ModelBakery { private final Map stateModels = Maps.newHashMap(); - private final Set textures = Sets.newHashSet(); - private final Set loadingModels = Sets.newHashSet(); private final Set missingVariants = Sets.newHashSet(); private final Map loadingExceptions = Maps.newHashMap(); private IModel missingModel = null; @@ -101,6 +100,7 @@ public class ModelLoader extends ModelBakery { super(manager, map, shapes); VanillaLoader.instance.setLoader(this); + VariantLoader.instance.setLoader(this); ModelLoaderRegistry.clearModelCache(); } @@ -110,18 +110,13 @@ public class ModelLoader extends ModelBakery isLoading = true; loadBlocks(); loadVariantItemModels(); - try - { - missingModel = getModel(new ResourceLocation(MODEL_MISSING.getResourceDomain(), MODEL_MISSING.getResourcePath())); - } - catch (IOException e) - { - // If this ever happens things are bad. Should never NOT be able to load the missing model. - Throwables.propagate(e); - } + missingModel = ModelLoaderRegistry.getModel(new ResourceLocation(MODEL_MISSING.getResourceDomain(), MODEL_MISSING.getResourcePath())); stateModels.put(MODEL_MISSING, missingModel); + + final Set textures = Sets.newHashSet(ModelLoaderRegistry.getTextures()); textures.remove(TextureMap.LOCATION_MISSING_TEXTURE); textures.addAll(LOCATIONS_BUILTIN_TEXTURES); + textureMap.loadSprites(resourceManager, new IIconCreator() { public void registerSprites(TextureMap map) @@ -132,18 +127,24 @@ public class ModelLoader extends ModelBakery } } }); + IBakedModel missingBaked = missingModel.bake(missingModel.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.instance); - for (Entry e : stateModels.entrySet()) + Map bakedModels = Maps.newHashMap(); + for(IModel model : stateModels.values()) { - if(e.getValue() == getMissingModel()) + if(model == getMissingModel()) { - bakedRegistry.putObject(e.getKey(), missingBaked); + bakedModels.put(model, missingBaked); } else { - bakedRegistry.putObject(e.getKey(), e.getValue().bake(e.getValue().getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.instance)); + bakedModels.put(model, model.bake(model.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.instance)); } } + for (Entry e : stateModels.entrySet()) + { + bakedRegistry.putObject(e.getKey(), bakedModels.get(e.getValue())); + } return bakedRegistry; } @@ -177,52 +178,18 @@ public class ModelLoader extends ModelBakery ProgressManager.pop(blockBar); }*/ - // FIXME: all the new shiny multipart things - @Deprecated - private void loadVariant(ModelResourceLocation variant) - { - try - { - ModelBlockDefinition modelblockdefinition = this.getModelBlockDefinition(variant); - - try - { - this.registerVariant(modelblockdefinition, variant); - } - catch (Exception ex) - { - FMLLog.getLogger().warn("Unable to load variant: " + variant.getVariant() + " from " + variant, ex); - } - } - catch (Exception ex) - { - FMLLog.getLogger().warn("Unable to load definition " + variant, ex); - } - } - @Override protected void registerVariant(ModelBlockDefinition definition, ModelResourceLocation location) { - // TODO loader? - VariantList variants = null; - try + stateModels.put(location, ModelLoaderRegistry.getModel(location)); + } + + @Override + protected void registerMultipartVariant(ModelBlockDefinition definition, Collection locations) + { + for (ModelResourceLocation location : locations) { - variants = definition.getVariant(location.getVariant()); - } - catch(MissingVariantException e) - { - missingVariants.add(location); - } - if (variants != null && !variants.getVariantList().isEmpty()) - { - try - { - stateModels.put(location, new WeightedRandomModel(location, variants)); - } - catch(Throwable e) - { - throw new RuntimeException(e); - } + stateModels.put(location, ModelLoaderRegistry.getModel(location)); } } @@ -268,30 +235,24 @@ public class ModelLoader extends ModelBakery ResourceLocation file = getItemLocation(s); ModelResourceLocation memory = getInventoryVariant(s); itemBar.step(memory.toString()); - IModel model = null; try { - // default loading - model = getModel(file); - if (model == null) + IModel model = ModelLoaderRegistry.getModel(file); + if(model == getMissingModel()) { - model = getMissingModel(); + // try blockstate json if the item model is missing + FMLLog.fine("Item json isn't found for '" + memory + "', trying to load the variant from the blockstate json"); + try + { + model = ModelLoaderRegistry.getModel(memory); + } + catch (Exception exception) + { + storeException(memory, new Exception("Could not load item model either from the normal location " + file + " or from the blockstate", exception)); + } } stateModels.put(memory, model); } - catch (FileNotFoundException e) - { - // try blockstate json if the item model is missing - FMLLog.fine("Item json isn't found for '" + memory + "', trying to load the variant from the blockstate json"); - try - { - registerVariant(getModelBlockDefinition(memory), memory); - } - catch (Exception exception) - { - storeException(memory, new Exception("Could not load item model either from the normal location " + file + " or from the blockstate", exception)); - } - } catch (Exception exception) { storeException(memory, exception); @@ -321,16 +282,12 @@ public class ModelLoader extends ModelBakery for(String s : getVariantNames(Items.bucket)) { ModelResourceLocation memory = getInventoryVariant(s); - try + IModel model = ModelLoaderRegistry.getModel(new ResourceLocation("forge", "item/bucket")); + // only on successful load, otherwise continue using the old model + if(model != getMissingModel()) { - IModel model = getModel(new ResourceLocation("forge", "item/bucket")); - // only on successful load, otherwise continue using the old model stateModels.put(memory, model); } - catch(IOException e) - { - // use the original vanilla model - } } setBucketModel(Items.water_bucket); @@ -352,16 +309,12 @@ public class ModelLoader extends ModelBakery for(String s : getVariantNames(Items.milk_bucket)) { ModelResourceLocation memory = getInventoryVariant(s); - try + IModel model = ModelLoaderRegistry.getModel(new ResourceLocation("forge", "item/bucket_milk")); + // only on successful load, otherwise continue using the old model + if(model != getMissingModel()) { - IModel model = getModel(new ResourceLocation("forge", "item/bucket_milk")); - // only on successful load, otherwise continue using the old model stateModels.put(memory, model); } - catch(IOException e) - { - // use the original vanilla model - } } } } @@ -389,60 +342,12 @@ public class ModelLoader extends ModelBakery return new ModelResourceLocation(s, "inventory"); } - public IModel getModel(ResourceLocation location) throws IOException - { - if(!ModelLoaderRegistry.loaded(location)) loadAnyModel(location); - return ModelLoaderRegistry.getModel(location); - } - @Override protected ResourceLocation getModelLocation(ResourceLocation model) { return new ResourceLocation(model.getResourceDomain(), model.getResourcePath() + ".json"); } - private void loadAnyModel(ResourceLocation location) throws IOException - { - if(loadingModels.contains(location)) - { - throw new IllegalStateException("circular model dependencies involving model " + location); - } - loadingModels.add(location); - try - { - IModel model = ModelLoaderRegistry.getModel(location); - resolveDependencies(model); - } - finally - { - loadingModels.remove(location); - } - } - - IModel getVariantModel(ModelResourceLocation location) - { - loadVariant(location); - IModel model = stateModels.get(location); - if(model == null) model = getMissingModel(); - return model; - } - - private void resolveDependencies(IModel model) throws IOException - { - for (ResourceLocation dep : model.getDependencies()) - { - if(dep instanceof ModelResourceLocation) - { - getVariantModel((ModelResourceLocation)dep); - } - else - { - getModel(dep); - } - } - textures.addAll(model.getTextures()); - } - private class VanillaModelWrapper implements IRetexturableModel, IModelSimpleProperties, IModelUVLock, IAnimatedModel { private final ResourceLocation location; @@ -461,7 +366,15 @@ public class ModelLoader extends ModelBakery public Collection getDependencies() { Set set = Sets.newHashSet(); - set.addAll(model.getOverrideLocations()); + for(ResourceLocation dep : model.getOverrideLocations()) + { + if(!location.equals(dep)) + { + set.add(dep); + // TODO: check if this can go somewhere else, random access to global things is bad + stateModels.put(getInventoryVariant(dep.toString()), ModelLoaderRegistry.getModel(dep)); + } + } if(model.getParentLocation() != null && !model.getParentLocation().getResourcePath().startsWith("builtin/")) { set.add(model.getParentLocation()); @@ -480,30 +393,18 @@ public class ModelLoader extends ModelBakery } else { - try + IModel parent = ModelLoaderRegistry.getModel(model.getParentLocation()); + if(parent == getMissingModel()) { - IModel parent = getModel(model.getParentLocation()); - if(parent instanceof VanillaModelWrapper) - { - model.parent = ((VanillaModelWrapper) parent).model; - } - else - { - throw new IllegalStateException("vanilla model '" + model + "' can't have non-vanilla parent"); - } + FMLLog.warning("Could not load vanilla model parent '" + model.getParentLocation() + "' for '" + model); } - catch (IOException e) + if(parent instanceof VanillaModelWrapper) { - FMLLog.warning("Could not load vanilla model parent '" + model.getParentLocation() + "' for '" + model + "': " + e.toString()); - IModel missing = ModelLoader.this.getMissingModel(); - if (missing instanceof VanillaModelWrapper) - { - model.parent = ((VanillaModelWrapper)missing).model; - } - else - { - throw new IllegalStateException("vanilla model '" + model + "' has missing parent, and missing model is not a vanilla model"); - } + model.parent = ((VanillaModelWrapper) parent).model; + } + else + { + throw new IllegalStateException("vanilla model '" + model + "' can't have non-vanilla parent"); } } } @@ -520,15 +421,6 @@ public class ModelLoader extends ModelBakery { builder.add(loc); } - /*// mojang hardcode - if(model.getRootModel() == MODEL_COMPASS && !loc.equals(TextureMap.LOCATION_MISSING_TEXTURE)) - { - TextureAtlasSprite.setLocationNameCompass(loc.toString()); - } - else if(model.getRootModel() == MODEL_CLOCK && !loc.equals(TextureMap.LOCATION_MISSING_TEXTURE)) - { - TextureAtlasSprite.setLocationNameClock(loc.toString()); - }*/ } } for(String s : model.textures.values()) @@ -737,14 +629,15 @@ public class ModelLoader extends ModelBakery } } - private class WeightedRandomModel implements IModel + private static class WeightedRandomModel implements IModel { private final List variants; private final List locations = new ArrayList(); + private final Set textures = Sets.newHashSet(); private final List models = new ArrayList(); private final IModelState defaultState; - public WeightedRandomModel(ModelResourceLocation parent, VariantList variants) + public WeightedRandomModel(ResourceLocation parent, VariantList variants) { this.variants = variants.getVariantList(); ImmutableList.Builder> builder = ImmutableList.builder(); @@ -756,7 +649,7 @@ public class ModelLoader extends ModelBakery IModel model = null; try { - model = getModel(loc); + model = ModelLoaderRegistry.getModel(loc); } catch (Exception e) { @@ -765,21 +658,19 @@ public class ModelLoader extends ModelBakery * But that doesn't help debugging, so we maintain the missing model * so that resource pack makers have a hint that their states are broken. */ - FMLLog.warning("Unable to load block model: \'" + loc + "\' for variant: \'" + parent + "\': " + e.toString()); - model = getMissingModel(); + FMLLog.getLogger().error("Unable to load block model: \'" + loc + "\' for variant: \'" + parent, e); + model = ModelLoaderRegistry.getMissingModel(); } + // FIXME: is this the place? messes up dependency and texture resolution if (v instanceof ISmartVariant) { - model = ((ISmartVariant)v).process(model, ModelLoader.this); - try + model = ((ISmartVariant)v).process(model); + for(ResourceLocation location : model.getDependencies()) { - resolveDependencies(model); - } - catch (IOException e) - { - FMLLog.getLogger().error("Exception resolving indirect dependencies for model" + loc, e); + ModelLoaderRegistry.getModel(location); } + //FMLLog.getLogger().error("Exception resolving indirect dependencies for model" + loc, e); textures.addAll(model.getTextures()); // Kick this, just in case. } @@ -789,7 +680,7 @@ public class ModelLoader extends ModelBakery if (models.size() == 0) //If all variants are missing, add one with the missing model and default rotation. { - IModel missing = getMissingModel(); + IModel missing = ModelLoaderRegistry.getMissingModel(); models.add(missing); builder.add(Pair.of(missing, TRSRTransformation.identity())); } @@ -804,7 +695,7 @@ public class ModelLoader extends ModelBakery public Collection getTextures() { - return Collections.emptyList(); + return ImmutableSet.copyOf(textures); } public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) @@ -815,7 +706,6 @@ public class ModelLoader extends ModelBakery } if(variants.size() == 1) { - Variant v = variants.get(0); IModel model = models.get(0); return model.bake(MultiModelState.getPartState(state, model, 0), format, bakedTextureGetter); } @@ -823,7 +713,6 @@ public class ModelLoader extends ModelBakery for(int i = 0; i < variants.size(); i++) { IModel model = models.get(i); - Variant v = variants.get(i); builder.add(model.bake(MultiModelState.getPartState(state, model, i), format, bakedTextureGetter), variants.get(i).getWeight()); } return builder.build(); @@ -839,15 +728,7 @@ public class ModelLoader extends ModelBakery { if (missingModel == null) { - try - { - missingModel = getModel(new ResourceLocation(MODEL_MISSING.getResourceDomain(), MODEL_MISSING.getResourcePath())); - } - catch (IOException e) - { - // If this ever happens things are bad. Should never NOT be able to load the missing model. - Throwables.propagate(e); - } + missingModel = VanillaLoader.instance.loadModel(new ResourceLocation(MODEL_MISSING.getResourceDomain(), MODEL_MISSING.getResourcePath())); } return missingModel; } @@ -883,7 +764,7 @@ public class ModelLoader extends ModelBakery return true; } - public IModel loadModel(ResourceLocation modelLocation) throws IOException + public IModel loadModel(ResourceLocation modelLocation) { String modelPath = modelLocation.getResourcePath(); if(modelLocation.getResourcePath().startsWith("models/")) @@ -892,7 +773,27 @@ public class ModelLoader extends ModelBakery } ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getResourceDomain(), "armatures/" + modelPath + ".json"); ModelBlockAnimation animation = Animation.INSTANCE.loadVanillaAnimation(armatureLocation); - return loader.new VanillaModelWrapper(modelLocation, loader.loadModel(modelLocation), false, animation); + ModelBlock model = null; + try + { + model = loader.loadModel(modelLocation); + } + catch(Exception e) + { + // FIXME better error reporting? + FMLLog.getLogger().error("Unable to load vanilla model " + modelLocation, e); + } + if(model != null) + { + return loader.new VanillaModelWrapper(modelLocation, model, false, animation); + } + return ModelLoaderRegistry.getMissingModel(); + } + + @Override + public String toString() + { + return "VanillaLoader.instance"; } } @@ -1119,4 +1020,108 @@ public class ModelLoader extends ModelBakery { return DefaultTextureGetter.instance; } + + protected static enum VariantLoader implements ICustomModelLoader + { + instance; + + private ModelLoader loader; + + void setLoader(ModelLoader loader) + { + this.loader = loader; + } + + @Override + public void onResourceManagerReload(IResourceManager resourceManager) + { + // TODO Auto-generated method stub + } + + @Override + public boolean accepts(ResourceLocation modelLocation) + { + return modelLocation instanceof ModelResourceLocation; + } + + @Override + public IModel loadModel(ResourceLocation modelLocation) + { + ModelResourceLocation variant = (ModelResourceLocation) modelLocation; + ModelBlockDefinition definition = loader.getModelBlockDefinition(variant); + try + { + VariantList variants = definition.getVariant(variant.getVariant()); + return new WeightedRandomModel(variant, variants); + } + catch(MissingVariantException e) + { + if(definition.hasMultipartData()) + { + return new MultipartModel(new ResourceLocation(variant.getResourceDomain(), variant.getResourcePath()), definition.getMultipartData()); + } + // FIXME log missing model? + } + return ModelLoaderRegistry.getMissingModel(); + } + + @Override + public String toString() + { + return "VariantLoader.instance"; + } + } + + private static class MultipartModel implements IModel + { + private final ResourceLocation location; + private final Multipart multipart; + private final ImmutableMap partModels; + + public MultipartModel(ResourceLocation location, Multipart multipart) + { + this.location = location; + this.multipart = multipart; + ImmutableMap.Builder builder = ImmutableMap.builder(); + for (Selector selector : multipart.getSelectors()) + { + builder.put(selector, new WeightedRandomModel(location, selector.getVariantList())); + } + partModels = builder.build(); + } + + // FIXME: represent selectors as dependencies? + @Override + public Collection getDependencies() + { + return ImmutableSet.of(); + } + + @Override + public Collection getTextures() + { + return ImmutableSet.of(); + } + + // FIXME + @Override + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) + { + MultipartBakedModel.Builder builder = new MultipartBakedModel.Builder(); + + for (Selector selector : multipart.getSelectors()) + { + builder.putModel(selector.getPredicate(multipart.getStateContainer()), partModels.get(selector).bake(partModels.get(selector).getDefaultState(), format, bakedTextureGetter)); + } + + IBakedModel bakedModel = builder.makeMultipartModel(); + return bakedModel; + } + + @Override + public IModelState getDefaultState() + { + return TRSRTransformation.identity(); + } + } } diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index 1342d7ed32..13089f744f 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -1,8 +1,6 @@ package net.minecraftforge.client.model; -import java.io.IOException; -import java.util.HashMap; -import java.util.HashSet; +import java.util.Deque; import java.util.Map; import java.util.Set; @@ -11,19 +9,27 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.resources.IReloadableResourceManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader.VanillaLoader; +import net.minecraftforge.client.model.ModelLoader.VariantLoader; import net.minecraftforge.client.model.b3d.B3DLoader; import net.minecraftforge.client.model.obj.OBJLoader; import net.minecraftforge.fml.common.FMLLog; import org.apache.logging.log4j.Level; +import com.google.common.base.Joiner; +import com.google.common.collect.Maps; +import com.google.common.collect.Queues; +import com.google.common.collect.Sets; + /* * Central hub for custom model loaders. */ public class ModelLoaderRegistry { - private static final Set loaders = new HashSet(); - private static final Map cache = new HashMap(); + private static final Set loaders = Sets.newHashSet(); + private static final Map cache = Maps.newHashMap(); + private static final Deque loadingModels = Queues.newArrayDeque(); + private static final Set textures = Sets.newHashSet(); // Forge built-in loaders static @@ -53,6 +59,7 @@ public class ModelLoaderRegistry public static ResourceLocation getActualLocation(ResourceLocation location) { + if(location instanceof ModelResourceLocation) return location; if(location.getResourcePath().startsWith("builtin/")) return location; return new ResourceLocation(location.getResourceDomain(), "models/" + location.getResourcePath()); } @@ -62,25 +69,20 @@ public class ModelLoaderRegistry * ResourceLocation argument will be passed directly to the custom model loaders, * ModelResourceLocation argument will be loaded through the blockstate system. */ - public static IModel getModel(ResourceLocation location) throws IOException + public static IModel getModel(ResourceLocation location) { IModel model; - if(location instanceof ModelResourceLocation) + if(cache.containsKey(location)) return cache.get(location); + for(ResourceLocation loading : loadingModels) { - ModelLoader loader = ModelLoader.VanillaLoader.instance.getLoader(); - if(loader != null) + if(location.getClass() == loading.getClass() && location.equals(loading)) { - model = loader.getVariantModel((ModelResourceLocation)location); - } - else - { - FMLLog.log(Level.ERROR, "Loading model too early, skipping: %s", location); - model = getMissingModel(); + throw new IllegalStateException("circular model dependencies, stack: [" + Joiner.on(", ").join(loadingModels) + "]"); } } - else + loadingModels.addLast(location); + try { - if(cache.containsKey(location)) return cache.get(location); ResourceLocation actual = getActualLocation(location); ICustomModelLoader accepted = null; for(ICustomModelLoader loader : loaders) @@ -103,10 +105,17 @@ public class ModelLoaderRegistry } } - // no custom loaders found, try vanilla one + // no custom loaders found, try vanilla ones if(accepted == null) { - if(VanillaLoader.instance.accepts(actual)) accepted = VanillaLoader.instance; + if(VariantLoader.instance.accepts(actual)) + { + accepted = VariantLoader.instance; + } + else if(VanillaLoader.instance.accepts(actual)) + { + accepted = VanillaLoader.instance; + } } if(accepted == null) @@ -120,18 +129,36 @@ public class ModelLoaderRegistry { model = accepted.loadModel(actual); } - catch (IOException e) - { - throw e; - } catch(Exception e) { FMLLog.log(Level.ERROR, e, "Exception loading model %s with loader %s, skipping", location, accepted); model = getMissingModel(); } + if(model == getMissingModel()) + { + FMLLog.log(Level.ERROR, "Loader %s returned missing model while loading model %s", accepted, location); + } + if(model == null) + { + FMLLog.log(Level.ERROR, "Loader %s returned null while loading model %s", accepted, location); + model = getMissingModel(); + } + textures.addAll(model.getTextures()); + } + } + finally + { + ResourceLocation popLoc = loadingModels.removeLast(); + if(popLoc != location) + { + throw new IllegalStateException("Corrupted loading model stack: " + popLoc + " != " + location); } } cache.put(location, model); + for (ResourceLocation dep : model.getDependencies()) + { + getModel(dep); + } return model; } @@ -148,4 +175,9 @@ public class ModelLoaderRegistry cache.put(new ResourceLocation("minecraft:block/builtin/generated"), ModelLoader.VanillaLoader.instance.getLoader().getItemModel()); cache.put(new ResourceLocation("minecraft:item/builtin/generated"), ModelLoader.VanillaLoader.instance.getLoader().getItemModel()); } + + static Iterable getTextures() + { + return textures; + } } diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index 8f16b6765c..b8ae6d4314 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -1,6 +1,5 @@ package net.minecraftforge.client.model; -import java.io.IOException; import java.util.Collection; import java.util.List; @@ -23,7 +22,6 @@ import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.fml.common.FMLLog; import org.apache.commons.lang3.tuple.Pair; -import org.apache.logging.log4j.Level; import com.google.common.base.Function; import com.google.common.base.Optional; @@ -60,16 +58,7 @@ public class MultiLayerModel implements IModelCustomData ImmutableMap.Builder, IBakedModel> builder = ImmutableMap.builder(); for(Optional key : models.keySet()) { - IModel model; - try - { - model = ModelLoaderRegistry.getModel(models.get(key)); - } - catch (IOException e) - { - FMLLog.log(Level.ERROR, e, "Couldn't load MultiLayerModel dependency: %s", models.get(key)); - model = ModelLoaderRegistry.getMissingModel(); - } + IModel model = ModelLoaderRegistry.getModel(models.get(key)); builder.put(key, model.bake(new ModelStateComposition(state, model.getDefaultState()), format, bakedTextureGetter)); } return builder.build(); diff --git a/src/main/java/net/minecraftforge/client/model/animation/Clips.java b/src/main/java/net/minecraftforge/client/model/animation/Clips.java index 6e760694ea..2b5d910c2f 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/Clips.java +++ b/src/main/java/net/minecraftforge/client/model/animation/Clips.java @@ -62,23 +62,15 @@ public final class Clips */ public static IClip getModelClipNode(ResourceLocation modelLocation, String clipName) { - IModel model; - try + IModel model = ModelLoaderRegistry.getModel(modelLocation); + if(model instanceof IAnimatedModel) { - model = ModelLoaderRegistry.getModel(modelLocation); - if(model instanceof IAnimatedModel) + Optional clip = ((IAnimatedModel)model).getClip(clipName); + if(clip.isPresent()) { - Optional clip = ((IAnimatedModel)model).getClip(clipName); - if(clip.isPresent()) - { - return new ModelClip(clip.get(), modelLocation, clipName); - } - FMLLog.getLogger().error("Unable to find clip " + clipName + " in the model " + modelLocation); + return new ModelClip(clip.get(), modelLocation, clipName); } - } - catch (IOException e) - { - FMLLog.getLogger().error("Unable to load model" + modelLocation + " while loading clip " + clipName, e); + FMLLog.getLogger().error("Unable to find clip " + clipName + " in the model " + modelLocation); } // FIXME: missing clip? return new ModelClip(IdentityClip.instance, modelLocation, clipName); diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index c3e52742b3..0424343d61 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -48,6 +48,7 @@ import net.minecraftforge.fml.common.FMLLog; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Triple; +import org.apache.logging.log4j.Level; import com.google.common.base.Function; import com.google.common.base.Objects; @@ -94,7 +95,7 @@ public class B3DLoader implements ICustomModelLoader } @SuppressWarnings("unchecked") - public IModel loadModel(ResourceLocation modelLocation) throws IOException + public IModel loadModel(ResourceLocation modelLocation) { ResourceLocation file = new ResourceLocation(modelLocation.getResourceDomain(), modelLocation.getResourcePath()); if(!cache.containsKey(file)) @@ -120,9 +121,8 @@ public class B3DLoader implements ICustomModelLoader } catch(IOException e) { - //FMLLog.log(Level.ERROR, e, "Exception loading model %s with B3D loader, skipping", modelLocation); + FMLLog.log(Level.ERROR, e, "Exception loading model %s with B3D loader, skipping", modelLocation); cache.put(file, null); - throw e; } } B3DModel model = cache.get(file); diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java b/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java index 6d71fe7225..935f3ecbae 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java @@ -45,7 +45,7 @@ public class OBJLoader implements ICustomModelLoader { return enabledDomains.contains(modelLocation.getResourceDomain()) && modelLocation.getResourcePath().endsWith(".obj"); } - public IModel loadModel(ResourceLocation modelLocation) throws IOException + public IModel loadModel(ResourceLocation modelLocation) { ResourceLocation file = new ResourceLocation(modelLocation.getResourceDomain(), modelLocation.getResourcePath()); if (!cache.containsKey(file)) @@ -78,8 +78,7 @@ public class OBJLoader implements ICustomModelLoader { } catch (IOException e) { -// FMLLog.log(Level.ERROR, e, "Exception loading model '%s' with OBJ loader, skipping", modelLocation); - throw e; + cache.put(modelLocation, null); } } OBJModel model = cache.get(file); diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index 1951cfbc03..a554c07b92 100644 --- a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -194,54 +194,47 @@ public class ModelAnimationDebug { public Render createRenderFor(RenderManager manager) { - try + /*model = ModelLoaderRegistry.getModel(new ResourceLocation(ModelLoaderRegistryDebug.MODID, "block/chest.b3d")); + if(model instanceof IRetexturableModel) { - /*model = ModelLoaderRegistry.getModel(new ResourceLocation(ModelLoaderRegistryDebug.MODID, "block/chest.b3d")); - if(model instanceof IRetexturableModel) + model = ((IRetexturableModel)model).retexture(ImmutableMap.of("#chest", "entity/chest/normal")); + } + if(model instanceof IModelCustomData) + { + model = ((IModelCustomData)model).process(ImmutableMap.of("mesh", "[\"Base\", \"Lid\"]")); + }*/ + IModel base = ModelLoaderRegistry.getModel(new ResourceLocation(ModelAnimationDebug.MODID, "block/engine")); + IModel ring = ModelLoaderRegistry.getModel(new ResourceLocation(ModelAnimationDebug.MODID, "block/engine_ring")); + ImmutableMap textures = ImmutableMap.of( + "base", "blocks/stone", + "front", "blocks/log_oak", + "chamber", "blocks/redstone_block", + "trunk", "blocks/end_stone" + ); + base = ModelProcessingHelper.retexture(base, textures); + ring = ModelProcessingHelper.retexture(base, textures); + IModel model = new MultiModel( + new ResourceLocation(ModelAnimationDebug.MODID, "builtin/engine"), + ring, + TRSRTransformation.identity(), + ImmutableMap.of( + "base", Pair.of(base, TRSRTransformation.identity()) + ) + ); + return new RenderLiving(manager, new AnimationModelBase(model, new VertexLighterSmoothAo(Minecraft.getMinecraft().getBlockColors())) { - model = ((IRetexturableModel)model).retexture(ImmutableMap.of("#chest", "entity/chest/normal")); - } - if(model instanceof IModelCustomData) - { - model = ((IModelCustomData)model).process(ImmutableMap.of("mesh", "[\"Base\", \"Lid\"]")); - }*/ - IModel base = ModelLoaderRegistry.getModel(new ResourceLocation(ModelAnimationDebug.MODID, "block/engine")); - IModel ring = ModelLoaderRegistry.getModel(new ResourceLocation(ModelAnimationDebug.MODID, "block/engine_ring")); - ImmutableMap textures = ImmutableMap.of( - "base", "blocks/stone", - "front", "blocks/log_oak", - "chamber", "blocks/redstone_block", - "trunk", "blocks/end_stone" - ); - base = ModelProcessingHelper.retexture(base, textures); - ring = ModelProcessingHelper.retexture(base, textures); - IModel model = new MultiModel( - new ResourceLocation(ModelAnimationDebug.MODID, "builtin/engine"), - ring, - TRSRTransformation.identity(), - ImmutableMap.of( - "base", Pair.of(base, TRSRTransformation.identity()) - ) - ); - return new RenderLiving(manager, new AnimationModelBase(model, new VertexLighterSmoothAo(Minecraft.getMinecraft().getBlockColors())) + @Override + public void handleEvents(EntityChest chest, float time, Iterable pastEvents) { - @Override - public void handleEvents(EntityChest chest, float time, Iterable pastEvents) - { - chest.handleEvents(time, pastEvents); - } - }, 0.5f) - { - protected ResourceLocation getEntityTexture(EntityChest entity) - { - return TextureMap.locationBlocksTexture; + chest.handleEvents(time, pastEvents); } - }; - } - catch(IOException e) + }, 0.5f) { - throw new RuntimeException(e); - } + protected ResourceLocation getEntityTexture(EntityChest entity) + { + return TextureMap.locationBlocksTexture; + } + }; } }); } diff --git a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java index caac6a978b..8d41475488 100644 --- a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java @@ -255,15 +255,7 @@ public class ModelLoaderRegistryDebug { if (world.getTileEntity(pos) == null) world.setTileEntity(pos, new OBJTesseractTileEntity()); OBJTesseractTileEntity tileEntity = (OBJTesseractTileEntity) world.getTileEntity(pos); - IModel model = ModelLoaderRegistry.getMissingModel(); - try - { - model = ModelLoaderRegistry.getModel(new ResourceLocation(MODID.toLowerCase() + ":" + "block/tesseract.obj")); - } - catch (IOException e) - { - model = ModelLoaderRegistry.getMissingModel(); - } + IModel model = ModelLoaderRegistry.getModel(new ResourceLocation(MODID.toLowerCase() + ":" + "block/tesseract.obj")); if (player.isSneaking()) { diff --git a/src/test/resources/assets/forgedebugmodelanimation/models/block/engine.json b/src/test/resources/assets/forgedebugmodelanimation/models/block/engine.json index d7ef2789f3..a8d0b8ce9b 100644 --- a/src/test/resources/assets/forgedebugmodelanimation/models/block/engine.json +++ b/src/test/resources/assets/forgedebugmodelanimation/models/block/engine.json @@ -1,5 +1,3 @@ -// vanilla json model, no modifications - { "elements": [ { From c27b13c70570f39139c75f61ca8fbadda820dd0f Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 13 Mar 2016 18:32:53 -0700 Subject: [PATCH 081/243] Update patches for fixed inner class suffeling in srg files. --- build.gradle | 31 +- .../net/minecraft/init/Bootstrap.java.patch | 431 ------------------ .../net/minecraft/item/Item.java.patch | 32 -- 3 files changed, 15 insertions(+), 479 deletions(-) delete mode 100644 patches/minecraft/net/minecraft/init/Bootstrap.java.patch diff --git a/build.gradle b/build.gradle index 814d3c3d56..285a7ea677 100644 --- a/build.gradle +++ b/build.gradle @@ -171,25 +171,25 @@ task makeMdk(type: Zip) { from 'gradlew' from 'gradlew.bat' into ('gradle') { - from 'gradle' + from 'gradle' } into ('eclipse') { from 'mdk/eclipse' } from changelog.output from ('mdk') { - filter(ReplaceTokens, tokens: [ - VERSION: project.version, - MAPPINGS: minecraft.mappings.replace('nodoc_', '') - ]) - exclude 'eclipse' - rename 'gitignore\\.txt', '.gitignore' - from 'MinecraftForge-Credits.txt' - from 'MinecraftForge-License.txt' - from 'Paulscode IBXM Library License.txt' - from 'Paulscode SoundSystem CodecIBXM License.txt' - from 'CREDITS-fml.txt' - from 'LICENSE-fml.txt' + filter(ReplaceTokens, tokens: [ + VERSION: project.version, + MAPPINGS: minecraft.mappings.replace('nodoc_', '') + ]) + exclude 'eclipse' + rename 'gitignore\\.txt', '.gitignore' + from 'MinecraftForge-Credits.txt' + from 'MinecraftForge-License.txt' + from 'Paulscode IBXM Library License.txt' + from 'Paulscode SoundSystem CodecIBXM License.txt' + from 'CREDITS-fml.txt' + from 'LICENSE-fml.txt' } } tasks.build.dependsOn makeMdk @@ -375,13 +375,12 @@ String getVersionFromJava(File file) task setupForge { dependsOn 'setup' } task buildPackages { dependsOn 'build' } -//Temporary hack to fix compile errors caused by 1.8.9 mappings on 1.9 +//Temporary hack to fix compile errors caused by mappings shading in Bootstrap task fixParams << { logger.lifecycle('Fixing param names!') def params = new File(extractMcpMappings.destinationDir, 'params.csv') def text = params.text - text = text.replaceAll('p_150893_2_,block,', 'p_150893_2_,state,') - text = text.replaceAll('p_148611_1_,sound,', 'p_148611_1_,p_sound,') + text = text.replaceAll('p_82499_3_,stack,', 'p_82499_3_,stackIn,') params.write(text) } fixParams.dependsOn('extractMcpMappings') diff --git a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch deleted file mode 100644 index f57b0908c6..0000000000 --- a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch +++ /dev/null @@ -1,431 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/init/Bootstrap.java -+++ ../src-work/minecraft/net/minecraft/init/Bootstrap.java -@@ -74,6 +74,7 @@ - return field_151355_a; - } - -+ @SuppressWarnings("unused") - static void func_151353_a() - { - BlockDispenser.field_149943_a.func_82595_a(Items.field_151032_g, new BehaviorProjectileDispense() -@@ -87,42 +88,42 @@ - }); - BlockDispenser.field_149943_a.func_82595_a(Items.field_185167_i, new BehaviorProjectileDispense() - { -- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack stack) - { -- EntityTippedArrow entitytippedarrow = new EntityTippedArrow(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); -- entitytippedarrow.func_184555_a(p_82499_3_); -+ EntityTippedArrow entitytippedarrow = new EntityTippedArrow(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); -+ entitytippedarrow.func_184555_a(stack); - entitytippedarrow.field_70251_a = EntityArrow.PickupStatus.ALLOWED; - return entitytippedarrow; - } - }); - BlockDispenser.field_149943_a.func_82595_a(Items.field_185166_h, new BehaviorProjectileDispense() - { -- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack stack) - { -- EntityArrow entityarrow = new EntitySpectralArrow(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); -+ EntityArrow entityarrow = new EntitySpectralArrow(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); - entityarrow.field_70251_a = EntityArrow.PickupStatus.ALLOWED; - return entityarrow; - } - }); - BlockDispenser.field_149943_a.func_82595_a(Items.field_151110_aK, new BehaviorProjectileDispense() - { -- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack stack) - { -- return new EntityEgg(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); -+ return new EntityEgg(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); - } - }); - BlockDispenser.field_149943_a.func_82595_a(Items.field_151126_ay, new BehaviorProjectileDispense() - { -- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack stack) - { -- return new EntitySnowball(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); -+ return new EntitySnowball(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); - } - }); - BlockDispenser.field_149943_a.func_82595_a(Items.field_151062_by, new BehaviorProjectileDispense() - { -- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack stack) - { -- return new EntityExpBottle(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); -+ return new EntityExpBottle(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); - } - protected float func_82498_a() - { -@@ -135,13 +136,13 @@ - }); - BlockDispenser.field_149943_a.func_82595_a(Items.field_185155_bH, new IBehaviorDispenseItem() - { -- public ItemStack func_82482_a(IBlockSource p_82482_1_, final ItemStack p_82482_2_) -+ public ItemStack func_82482_a(IBlockSource source, final ItemStack stack) - { - return (new BehaviorProjectileDispense() - { -- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack stack) - { -- return new EntityPotion(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c(), p_82482_2_.func_77946_l()); -+ return new EntityPotion(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c(), stack.func_77946_l()); - } - protected float func_82498_a() - { -@@ -151,18 +152,18 @@ - { - return super.func_82500_b() * 1.25F; - } -- }).func_82482_a(p_82482_1_, p_82482_2_); -+ }).func_82482_a(source, stack); - } - }); - BlockDispenser.field_149943_a.func_82595_a(Items.field_185156_bI, new IBehaviorDispenseItem() - { -- public ItemStack func_82482_a(IBlockSource p_82482_1_, final ItemStack p_82482_2_) -+ public ItemStack func_82482_a(IBlockSource source, final ItemStack stack) - { - return (new BehaviorProjectileDispense() - { -- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_, ItemStack p_82499_3_) -+ protected IProjectile func_82499_a(World worldIn, IPosition position, ItemStack stack) - { -- return new EntityPotion(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c(), p_82482_2_.func_77946_l()); -+ return new EntityPotion(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c(), stack.func_77946_l()); - } - protected float func_82498_a() - { -@@ -172,7 +173,7 @@ - { - return super.func_82500_b() * 1.25F; - } -- }).func_82482_a(p_82482_1_, p_82482_2_); -+ }).func_82482_a(source, stack); - } - }); - BlockDispenser.field_149943_a.func_82595_a(Items.field_151063_bx, new BehaviorDefaultDispenseItem() -@@ -215,25 +216,25 @@ - }); - BlockDispenser.field_149943_a.func_82595_a(Items.field_151059_bz, new BehaviorDefaultDispenseItem() - { -- public ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) -+ public ItemStack func_82487_b(IBlockSource source, ItemStack stack) - { -- EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.func_82620_h()); -- IPosition iposition = BlockDispenser.func_149939_a(p_82487_1_); -+ EnumFacing enumfacing = BlockDispenser.func_149937_b(source.func_82620_h()); -+ IPosition iposition = BlockDispenser.func_149939_a(source); - double d0 = iposition.func_82615_a() + (double)((float)enumfacing.func_82601_c() * 0.3F); - double d1 = iposition.func_82617_b() + (double)((float)enumfacing.func_96559_d() * 0.3F); - double d2 = iposition.func_82616_c() + (double)((float)enumfacing.func_82599_e() * 0.3F); -- World world = p_82487_1_.func_82618_k(); -+ World world = source.func_82618_k(); - Random random = world.field_73012_v; - double d3 = random.nextGaussian() * 0.05D + (double)enumfacing.func_82601_c(); - double d4 = random.nextGaussian() * 0.05D + (double)enumfacing.func_96559_d(); - double d5 = random.nextGaussian() * 0.05D + (double)enumfacing.func_82599_e(); - world.func_72838_d(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5)); -- p_82487_2_.func_77979_a(1); -- return p_82487_2_; -+ stack.func_77979_a(1); -+ return stack; - } -- protected void func_82485_a(IBlockSource p_82485_1_) -+ protected void func_82485_a(IBlockSource source) - { -- p_82485_1_.func_82618_k().func_175718_b(1018, p_82485_1_.func_180699_d(), 0); -+ source.func_82618_k().func_175718_b(1018, source.func_180699_d(), 0); - } - }); - BlockDispenser.field_149943_a.func_82595_a(Items.field_151124_az, new Bootstrap.BehaviorDispenseBoat(EntityBoat.Type.OAK)); -@@ -244,21 +245,21 @@ - BlockDispenser.field_149943_a.func_82595_a(Items.field_185153_aK, new Bootstrap.BehaviorDispenseBoat(EntityBoat.Type.ACACIA)); - IBehaviorDispenseItem ibehaviordispenseitem = new BehaviorDefaultDispenseItem() - { -- private final BehaviorDefaultDispenseItem field_150841_b = new BehaviorDefaultDispenseItem(); -- public ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) -+ private final BehaviorDefaultDispenseItem dispenseBehavior = new BehaviorDefaultDispenseItem(); -+ public ItemStack func_82487_b(IBlockSource source, ItemStack stack) - { -- ItemBucket itembucket = (ItemBucket)p_82487_2_.func_77973_b(); -- BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(p_82487_1_.func_82620_h())); -+ ItemBucket itembucket = (ItemBucket)stack.func_77973_b(); -+ BlockPos blockpos = source.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(source.func_82620_h())); - -- if (itembucket.func_180616_a((EntityPlayer)null, p_82487_1_.func_82618_k(), blockpos)) -+ if (itembucket.func_180616_a((EntityPlayer)null, source.func_82618_k(), blockpos)) - { -- p_82487_2_.func_150996_a(Items.field_151133_ar); -- p_82487_2_.field_77994_a = 1; -- return p_82487_2_; -+ stack.func_150996_a(Items.field_151133_ar); -+ stack.field_77994_a = 1; -+ return stack; - } - else - { -- return this.field_150841_b.func_82482_a(p_82487_1_, p_82487_2_); -+ return this.dispenseBehavior.func_82482_a(source, stack); - } - } - }; -@@ -266,11 +267,11 @@ - BlockDispenser.field_149943_a.func_82595_a(Items.field_151131_as, ibehaviordispenseitem); - BlockDispenser.field_149943_a.func_82595_a(Items.field_151133_ar, new BehaviorDefaultDispenseItem() - { -- private final BehaviorDefaultDispenseItem field_150840_b = new BehaviorDefaultDispenseItem(); -- public ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) -+ private final BehaviorDefaultDispenseItem dispenseBehavior = new BehaviorDefaultDispenseItem(); -+ public ItemStack func_82487_b(IBlockSource source, ItemStack stack) - { -- World world = p_82487_1_.func_82618_k(); -- BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(p_82487_1_.func_82620_h())); -+ World world = source.func_82618_k(); -+ BlockPos blockpos = source.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(source.func_82620_h())); - IBlockState iblockstate = world.func_180495_p(blockpos); - Block block = iblockstate.func_177230_c(); - Material material = iblockstate.func_185904_a(); -@@ -284,7 +285,7 @@ - { - if (!Material.field_151587_i.equals(material) || !(block instanceof BlockLiquid) || ((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue() != 0) - { -- return super.func_82487_b(p_82487_1_, p_82487_2_); -+ return super.func_82487_b(source, stack); - } - - item = Items.field_151129_at; -@@ -292,34 +293,34 @@ - - world.func_175698_g(blockpos); - -- if (--p_82487_2_.field_77994_a == 0) -+ if (--stack.field_77994_a == 0) - { -- p_82487_2_.func_150996_a(item); -- p_82487_2_.field_77994_a = 1; -+ stack.func_150996_a(item); -+ stack.field_77994_a = 1; - } -- else if (((TileEntityDispenser)p_82487_1_.func_150835_j()).func_146019_a(new ItemStack(item)) < 0) -+ else if (((TileEntityDispenser)source.func_150835_j()).func_146019_a(new ItemStack(item)) < 0) - { -- this.field_150840_b.func_82482_a(p_82487_1_, new ItemStack(item)); -+ this.dispenseBehavior.func_82482_a(source, new ItemStack(item)); - } - -- return p_82487_2_; -+ return stack; - } - }); - BlockDispenser.field_149943_a.func_82595_a(Items.field_151033_d, new BehaviorDefaultDispenseItem() - { - private boolean field_150839_b = true; -- protected ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) -+ protected ItemStack func_82487_b(IBlockSource source, ItemStack stack) - { -- World world = p_82487_1_.func_82618_k(); -- BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(p_82487_1_.func_82620_h())); -+ World world = source.func_82618_k(); -+ BlockPos blockpos = source.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(source.func_82620_h())); - - if (world.func_175623_d(blockpos)) - { - world.func_175656_a(blockpos, Blocks.field_150480_ab.func_176223_P()); - -- if (p_82487_2_.func_96631_a(1, world.field_73012_v)) -+ if (stack.func_96631_a(1, world.field_73012_v)) - { -- p_82487_2_.field_77994_a = 0; -+ stack.field_77994_a = 0; - } - } - else if (world.func_180495_p(blockpos).func_177230_c() == Blocks.field_150335_W) -@@ -332,31 +333,31 @@ - this.field_150839_b = false; - } - -- return p_82487_2_; -+ return stack; - } -- protected void func_82485_a(IBlockSource p_82485_1_) -+ protected void func_82485_a(IBlockSource source) - { - if (this.field_150839_b) - { -- p_82485_1_.func_82618_k().func_175718_b(1000, p_82485_1_.func_180699_d(), 0); -+ source.func_82618_k().func_175718_b(1000, source.func_180699_d(), 0); - } - else - { -- p_82485_1_.func_82618_k().func_175718_b(1001, p_82485_1_.func_180699_d(), 0); -+ source.func_82618_k().func_175718_b(1001, source.func_180699_d(), 0); - } - } - }); - BlockDispenser.field_149943_a.func_82595_a(Items.field_151100_aR, new BehaviorDefaultDispenseItem() - { - private boolean field_150838_b = true; -- protected ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) -+ protected ItemStack func_82487_b(IBlockSource source, ItemStack stack) - { -- if (EnumDyeColor.WHITE == EnumDyeColor.func_176766_a(p_82487_2_.func_77960_j())) -+ if (EnumDyeColor.WHITE == EnumDyeColor.func_176766_a(stack.func_77960_j())) - { -- World world = p_82487_1_.func_82618_k(); -- BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(p_82487_1_.func_82620_h())); -+ World world = source.func_82618_k(); -+ BlockPos blockpos = source.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(source.func_82620_h())); - -- if (ItemDye.func_179234_a(p_82487_2_, world, blockpos)) -+ if (ItemDye.func_179234_a(stack, world, blockpos)) - { - if (!world.field_72995_K) - { -@@ -368,49 +369,49 @@ - this.field_150838_b = false; - } - -- return p_82487_2_; -+ return stack; - } - else - { -- return super.func_82487_b(p_82487_1_, p_82487_2_); -+ return super.func_82487_b(source, stack); - } - } -- protected void func_82485_a(IBlockSource p_82485_1_) -+ protected void func_82485_a(IBlockSource source) - { - if (this.field_150838_b) - { -- p_82485_1_.func_82618_k().func_175718_b(1000, p_82485_1_.func_180699_d(), 0); -+ source.func_82618_k().func_175718_b(1000, source.func_180699_d(), 0); - } - else - { -- p_82485_1_.func_82618_k().func_175718_b(1001, p_82485_1_.func_180699_d(), 0); -+ source.func_82618_k().func_175718_b(1001, source.func_180699_d(), 0); - } - } - }); - BlockDispenser.field_149943_a.func_82595_a(Item.func_150898_a(Blocks.field_150335_W), new BehaviorDefaultDispenseItem() - { -- protected ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) -+ protected ItemStack func_82487_b(IBlockSource source, ItemStack stack) - { -- World world = p_82487_1_.func_82618_k(); -- BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(p_82487_1_.func_82620_h())); -+ World world = source.func_82618_k(); -+ BlockPos blockpos = source.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(source.func_82620_h())); - EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o(), (double)blockpos.func_177952_p() + 0.5D, (EntityLivingBase)null); - world.func_72838_d(entitytntprimed); - world.func_184148_a((EntityPlayer)null, entitytntprimed.field_70165_t, entitytntprimed.field_70163_u, entitytntprimed.field_70161_v, SoundEvents.field_187904_gd, SoundCategory.BLOCKS, 1.0F, 1.0F); -- --p_82487_2_.field_77994_a; -- return p_82487_2_; -+ --stack.field_77994_a; -+ return stack; - } - }); - BlockDispenser.field_149943_a.func_82595_a(Items.field_151144_bL, new BehaviorDefaultDispenseItem() - { - private boolean field_179240_b = true; -- protected ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) -+ protected ItemStack func_82487_b(IBlockSource source, ItemStack stack) - { -- World world = p_82487_1_.func_82618_k(); -- EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.func_82620_h()); -- BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(enumfacing); -+ World world = source.func_82618_k(); -+ EnumFacing enumfacing = BlockDispenser.func_149937_b(source.func_82620_h()); -+ BlockPos blockpos = source.func_180699_d().func_177972_a(enumfacing); - BlockSkull blockskull = Blocks.field_150465_bP; - -- if (world.func_175623_d(blockpos) && blockskull.func_176415_b(world, blockpos, p_82487_2_)) -+ if (world.func_175623_d(blockpos) && blockskull.func_176415_b(world, blockpos, stack)) - { - if (!world.field_72995_K) - { -@@ -419,13 +420,13 @@ - - if (tileentity instanceof TileEntitySkull) - { -- if (p_82487_2_.func_77960_j() == 3) -+ if (stack.func_77960_j() == 3) - { - GameProfile gameprofile = null; - -- if (p_82487_2_.func_77942_o()) -+ if (stack.func_77942_o()) - { -- NBTTagCompound nbttagcompound = p_82487_2_.func_77978_p(); -+ NBTTagCompound nbttagcompound = stack.func_77978_p(); - - if (nbttagcompound.func_150297_b("SkullOwner", 10)) - { -@@ -446,32 +447,32 @@ - } - else - { -- ((TileEntitySkull)tileentity).func_152107_a(p_82487_2_.func_77960_j()); -+ ((TileEntitySkull)tileentity).func_152107_a(stack.func_77960_j()); - } - - ((TileEntitySkull)tileentity).func_145903_a(enumfacing.func_176734_d().func_176736_b() * 4); - Blocks.field_150465_bP.func_180679_a(world, blockpos, (TileEntitySkull)tileentity); - } - -- --p_82487_2_.field_77994_a; -+ --stack.field_77994_a; - } - } -- else if (ItemArmor.func_185082_a(p_82487_1_, p_82487_2_) == null) -+ else if (ItemArmor.func_185082_a(source, stack) == null) - { - this.field_179240_b = false; - } - -- return p_82487_2_; -+ return stack; - } -- protected void func_82485_a(IBlockSource p_82485_1_) -+ protected void func_82485_a(IBlockSource source) - { - if (this.field_179240_b) - { -- p_82485_1_.func_82618_k().func_175718_b(1000, p_82485_1_.func_180699_d(), 0); -+ source.func_82618_k().func_175718_b(1000, source.func_180699_d(), 0); - } - else - { -- p_82485_1_.func_82618_k().func_175718_b(1001, p_82485_1_.func_180699_d(), 0); -+ source.func_82618_k().func_175718_b(1001, source.func_180699_d(), 0); - } - } - }); -@@ -505,15 +506,15 @@ - - return p_82487_2_; - } -- protected void func_82485_a(IBlockSource p_82485_1_) -+ protected void func_82485_a(IBlockSource source) - { - if (this.field_179241_b) - { -- p_82485_1_.func_82618_k().func_175718_b(1000, p_82485_1_.func_180699_d(), 0); -+ source.func_82618_k().func_175718_b(1000, source.func_180699_d(), 0); - } - else - { -- p_82485_1_.func_82618_k().func_175718_b(1001, p_82485_1_.func_180699_d(), 0); -+ source.func_82618_k().func_175718_b(1001, source.func_180699_d(), 0); - } - } - }); diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 2ac6bf28a4..46f446cc99 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -11,38 +11,6 @@ private static final IItemPropertyGetter field_185046_b = new IItemPropertyGetter() { @SideOnly(Side.CLIENT) -@@ -71,25 +71,25 @@ - private static final IItemPropertyGetter field_185047_c = new IItemPropertyGetter() - { - @SideOnly(Side.CLIENT) -- public float func_185085_a(ItemStack p_185085_1_, World p_185085_2_, EntityLivingBase p_185085_3_) -+ public float func_185085_a(ItemStack stack, World worldIn, EntityLivingBase entityIn) - { -- return MathHelper.func_76131_a((float)p_185085_1_.func_77952_i() / (float)p_185085_1_.func_77958_k(), 0.0F, 1.0F); -+ return MathHelper.func_76131_a((float)stack.func_77952_i() / (float)stack.func_77958_k(), 0.0F, 1.0F); - } - }; - private static final IItemPropertyGetter field_185048_d = new IItemPropertyGetter() - { - @SideOnly(Side.CLIENT) -- public float func_185085_a(ItemStack p_185085_1_, World p_185085_2_, EntityLivingBase p_185085_3_) -+ public float func_185085_a(ItemStack stack, World worldIn, EntityLivingBase entityIn) - { -- return p_185085_3_ != null && p_185085_3_.func_184591_cq() != EnumHandSide.RIGHT ? 1.0F : 0.0F; -+ return entityIn != null && entityIn.func_184591_cq() != EnumHandSide.RIGHT ? 1.0F : 0.0F; - } - }; - private static final IItemPropertyGetter field_185049_e = new IItemPropertyGetter() - { - @SideOnly(Side.CLIENT) -- public float func_185085_a(ItemStack p_185085_1_, World p_185085_2_, EntityLivingBase p_185085_3_) -+ public float func_185085_a(ItemStack stack, World worldIn, EntityLivingBase entityIn) - { -- return p_185085_3_ instanceof EntityPlayer ? ((EntityPlayer)p_185085_3_).func_184811_cZ().func_185143_a(p_185085_1_.func_77973_b(), 0.0F) : 0.0F; -+ return entityIn instanceof EntityPlayer ? ((EntityPlayer)entityIn).func_184811_cZ().func_185143_a(stack.func_77973_b(), 0.0F) : 0.0F; - } - }; - private final IRegistry field_185051_m = new RegistrySimple(); @@ -104,6 +104,9 @@ private Item field_77700_c; private String field_77774_bZ; From 9e74f9e7c0700ea4501a07f62df7fd46551eaffd Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 13 Mar 2016 18:51:31 -0700 Subject: [PATCH 082/243] We are based on 1.9 not 1.8.9 :D --- jsons/1.9-rel.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/jsons/1.9-rel.json b/jsons/1.9-rel.json index 33e0246407..dcf68dbab6 100644 --- a/jsons/1.9-rel.json +++ b/jsons/1.9-rel.json @@ -15,12 +15,10 @@ "time": "@timestamp@", "releaseTime": "1960-01-01T00:00:00-0700", "type": "release", - "minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type} --tweakClass net.minecraftforge.fml.common.launcher.FMLTweaker", + "minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userType ${user_type} --tweakClass net.minecraftforge.fml.common.launcher.FMLTweaker --versionType Forge", "mainClass": "net.minecraft.launchwrapper.Launch", "minimumLauncherVersion": 14, - "assets": "1.8", - "inheritsFrom": "1.8.9", - "jar": "1.8.9", + "inheritsFrom": "1.9", "libraries": [ { "name": "@artifact@", From 3839d337701285169114cc7aaa8c7f9d250efa24 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 14 Mar 2016 21:07:05 -0700 Subject: [PATCH 083/243] Delete mcp patches. --- .../net/minecraft/block/Block.java.patch | 1365 ----------------- .../minecraft/block/BlockBanner.java.patch | 46 - .../net/minecraft/block/BlockBush.java.patch | 69 - .../minecraft/block/BlockButton.java.patch | 11 - .../minecraft/block/BlockCactus.java.patch | 41 - .../net/minecraft/block/BlockChest.java.patch | 11 - .../net/minecraft/block/BlockCocoa.java.patch | 27 - .../net/minecraft/block/BlockCrops.java.patch | 61 - .../minecraft/block/BlockDeadBush.java.patch | 32 - .../net/minecraft/block/BlockDoor.java.patch | 20 - .../block/BlockDoublePlant.java.patch | 90 -- .../minecraft/block/BlockDragonEgg.java.patch | 20 - .../minecraft/block/BlockDropper.java.patch | 11 - .../minecraft/block/BlockFalling.java.patch | 20 - .../minecraft/block/BlockFarmland.java.patch | 11 - .../net/minecraft/block/BlockFire.java.patch | 209 --- .../minecraft/block/BlockFlowerPot.java.patch | 48 - .../net/minecraft/block/BlockGrass.java.patch | 29 - .../block/BlockHugeMushroom.java.patch | 23 - .../net/minecraft/block/BlockIce.java.patch | 34 - .../minecraft/block/BlockLadder.java.patch | 30 - .../minecraft/block/BlockLeaves.java.patch | 127 -- .../net/minecraft/block/BlockLever.java.patch | 15 - .../net/minecraft/block/BlockLog.java.patch | 24 - .../block/BlockMobSpawner.java.patch | 19 - .../minecraft/block/BlockMushroom.java.patch | 11 - .../minecraft/block/BlockMycelium.java.patch | 20 - .../block/BlockNetherWart.java.patch | 51 - .../minecraft/block/BlockNewLeaf.java.patch | 22 - .../net/minecraft/block/BlockNote.java.patch | 23 - .../minecraft/block/BlockOldLeaf.java.patch | 28 - .../net/minecraft/block/BlockOre.java.patch | 50 - .../net/minecraft/block/BlockPane.java.patch | 26 - .../block/BlockPistonBase.java.patch | 31 - .../block/BlockPistonMoving.java.patch | 36 - .../minecraft/block/BlockPotato.java.patch | 25 - .../minecraft/block/BlockPumpkin.java.patch | 11 - .../minecraft/block/BlockQuartz.java.patch | 29 - .../minecraft/block/BlockRailBase.java.patch | 186 --- .../block/BlockRedstoneComparator.java.patch | 24 - .../block/BlockRedstoneDiode.java.patch | 11 - .../block/BlockRedstoneOre.java.patch | 22 - .../block/BlockRedstoneWire.java.patch | 55 - .../net/minecraft/block/BlockReed.java.patch | 40 - .../block/BlockRotatedPillar.java.patch | 24 - .../minecraft/block/BlockSapling.java.patch | 10 - .../net/minecraft/block/BlockSkull.java.patch | 57 - .../net/minecraft/block/BlockSlab.java.patch | 36 - .../net/minecraft/block/BlockSnow.java.patch | 55 - .../minecraft/block/BlockStairs.java.patch | 22 - .../block/BlockStaticLiquid.java.patch | 11 - .../net/minecraft/block/BlockStem.java.patch | 46 - .../minecraft/block/BlockTallGrass.java.patch | 61 - .../net/minecraft/block/BlockTorch.java.patch | 47 - .../minecraft/block/BlockTrapDoor.java.patch | 21 - .../block/BlockTripWireHook.java.patch | 28 - .../net/minecraft/block/BlockVine.java.patch | 35 - .../BlockPistonStructureHelper.java.patch | 29 - .../block/state/BlockStateBase.java.patch | 12 - .../state/BlockStateContainer.java.patch | 77 - .../block/state/IBlockProperties.java.patch | 27 - .../client/ClientBrandRetriever.java.patch | 10 - .../client/LoadingScreenRenderer.java.patch | 26 - .../net/minecraft/client/Minecraft.java.patch | 476 ------ .../client/audio/SoundManager.java.patch | 41 - .../entity/AbstractClientPlayer.java.patch | 10 - .../client/entity/EntityPlayerSP.java.patch | 73 - .../client/gui/FontRenderer.java.patch | 144 -- .../minecraft/client/gui/GuiButton.java.patch | 22 - .../minecraft/client/gui/GuiChat.java.patch | 10 - .../client/gui/GuiCreateWorld.java.patch | 36 - .../minecraft/client/gui/GuiIngame.java.patch | 12 - .../client/gui/GuiIngameMenu.java.patch | 33 - .../gui/GuiListWorldSelectionEntry.java.patch | 11 - .../client/gui/GuiMainMenu.java.patch | 42 - .../client/gui/GuiMultiplayer.java.patch | 19 - .../client/gui/GuiOverlayDebug.java.patch | 12 - .../minecraft/client/gui/GuiScreen.java.patch | 107 -- .../client/gui/GuiSleepMP.java.patch | 11 - .../minecraft/client/gui/GuiSlot.java.patch | 39 - .../gui/GuiUtilRenderComponents.java.patch | 10 - .../gui/ServerListEntryNormal.java.patch | 23 - .../achievement/GuiAchievements.java.patch | 116 -- .../gui/inventory/GuiContainer.java.patch | 70 - .../inventory/GuiContainerCreative.java.patch | 256 ---- .../client/model/ModelBase.java.patch | 10 - .../client/model/ModelBox.java.patch | 18 - .../client/model/ModelRenderer.java.patch | 42 - .../model/PositionTextureVertex.java.patch | 13 - .../client/model/TexturedQuad.java.patch | 18 - .../ChunkProviderClient.java.patch | 10 - .../multiplayer/GuiConnecting.java.patch | 11 - .../multiplayer/PlayerControllerMP.java.patch | 93 -- .../client/multiplayer/WorldClient.java.patch | 17 - .../NetHandlerHandshakeMemory.java.patch | 10 - .../network/NetHandlerLoginClient.java.patch | 14 - .../network/NetHandlerPlayClient.java.patch | 62 - .../client/network/ServerPinger.java.patch | 10 - .../client/particle/EffectRenderer.java.patch | 43 - .../renderer/BlockModelShapes.java.patch | 9 - .../BlockRendererDispatcher.java.patch | 31 - .../client/renderer/EntityRenderer.java.patch | 191 --- .../InventoryEffectRenderer.java.patch | 33 - .../renderer/ItemModelMesher.java.patch | 13 - .../client/renderer/ItemRenderer.java.patch | 58 - .../client/renderer/OpenGlHelper.java.patch | 26 - .../client/renderer/RenderGlobal.java.patch | 127 -- .../client/renderer/RenderItem.java.patch | 97 -- .../client/renderer/VertexBuffer.java.patch | 34 - .../WorldVertexBufferUploader.java.patch | 57 - .../renderer/block/model/BakedQuad.java.patch | 47 - .../block/model/FaceBakery.java.patch | 93 -- .../block/model/IBakedModel.java.patch | 10 - .../model/ItemCameraTransforms.java.patch | 45 - .../block/model/ItemOverrideList.java.patch | 40 - .../block/model/ItemTransformVec3f.java.patch | 18 - .../block/model/ModelBakery.java.patch | 107 -- .../model/ModelBlockDefinition.java.patch | 11 - .../block/model/ModelManager.java.patch | 15 - .../block/model/ModelRotation.java.patch | 21 - .../renderer/block/model/Variant.java.patch | 20 - .../block/statemap/StateMap.java.patch | 11 - .../renderer/chunk/RenderChunk.java.patch | 68 - .../entity/RenderEntityItem.java.patch | 83 - .../entity/RenderLivingBase.java.patch | 64 - .../renderer/entity/RenderManager.java.patch | 28 - .../renderer/entity/RenderPlayer.java.patch | 18 - .../renderer/entity/RenderVillager.java.patch | 11 - .../entity/layers/LayerArmorBase.java.patch | 106 -- .../entity/layers/LayerBipedArmor.java.patch | 13 - .../renderer/texture/Stitcher.java.patch | 36 - .../texture/TextureAtlasSprite.java.patch | 33 - .../texture/TextureManager.java.patch | 15 - .../renderer/texture/TextureMap.java.patch | 176 --- .../renderer/texture/TextureUtil.java.patch | 15 - .../tileentity/RenderItemFrame.java.patch | 31 - .../TileEntityItemStackRenderer.java.patch | 10 - .../TileEntityPistonRenderer.java.patch | 15 - .../TileEntityRendererDispatcher.java.patch | 79 - .../TileEntitySpecialRenderer.java.patch | 9 - .../vertex/VertexFormatElement.java.patch | 21 - .../resources/AbstractResourcePack.java.patch | 11 - .../FallbackResourceManager.java.patch | 10 - .../resources/LanguageManager.java.patch | 10 - .../client/resources/Locale.java.patch | 11 - ...SimpleReloadableResourceManager.java.patch | 43 - .../client/settings/GameSettings.java.patch | 10 - .../client/shader/Framebuffer.java.patch | 57 - .../minecraft/command/CommandBase.java.patch | 11 - .../command/CommandEnchant.java.patch | 11 - .../minecraft/command/CommandFill.java.patch | 28 - .../command/CommandHandler.java.patch | 28 - .../command/EntitySelector.java.patch | 14 - .../command/server/CommandSetBlock.java.patch | 20 - .../server/CommandTestForBlock.java.patch | 11 - .../minecraft/crash/CrashReport.java.patch | 19 - .../crash/CrashReportCategory.java.patch | 16 - .../creativetab/CreativeTabs.java.patch | 106 -- .../enchantment/Enchantment.java.patch | 38 - .../enchantment/EnchantmentHelper.java.patch | 39 - .../net/minecraft/entity/Entity.java.patch | 268 ---- .../minecraft/entity/EntityHanging.java.patch | 12 - .../minecraft/entity/EntityList.java.patch | 40 - .../minecraft/entity/EntityLiving.java.patch | 41 - .../entity/EntityLivingBase.java.patch | 286 ---- .../EntitySpawnPlacementRegistry.java.patch | 15 - .../minecraft/entity/EntityTracker.java.patch | 37 - .../entity/EntityTrackerEntry.java.patch | 43 - .../entity/ai/EntityAIAttackMelee.java.patch | 55 - .../entity/boss/EntityDragon.java.patch | 18 - .../entity/boss/EntityWither.java.patch | 11 - .../effect/EntityLightningBolt.java.patch | 12 - .../entity/item/EntityEnderPearl.java.patch | 25 - .../entity/item/EntityFallingBlock.java.patch | 10 - .../entity/item/EntityItem.java.patch | 114 -- .../entity/item/EntityItemFrame.java.patch | 11 - .../entity/item/EntityMinecart.java.patch | 439 ------ .../EntityMinecartCommandBlock.java.patch | 10 - .../item/EntityMinecartContainer.java.patch | 35 - .../item/EntityMinecartEmpty.java.patch | 11 - .../item/EntityMinecartFurnace.java.patch | 11 - .../item/EntityMinecartHopper.java.patch | 10 - .../entity/item/EntityXPOrb.java.patch | 10 - .../entity/monster/EntityEnderman.java.patch | 32 - .../entity/monster/EntityMagmaCube.java.patch | 10 - .../entity/monster/EntitySlime.java.patch | 35 - .../entity/monster/EntityZombie.java.patch | 67 - .../entity/passive/EntityHorse.java.patch | 10 - .../entity/passive/EntityMooshroom.java.patch | 64 - .../entity/passive/EntityOcelot.java.patch | 11 - .../entity/passive/EntitySheep.java.patch | 43 - .../entity/passive/EntityVillager.java.patch | 44 - .../entity/player/EntityPlayer.java.patch | 540 ------- .../entity/player/EntityPlayerMP.java.patch | 83 - .../entity/player/InventoryPlayer.java.patch | 33 - .../net/minecraft/init/Bootstrap.java.patch | 10 - .../minecraft/inventory/Container.java.patch | 11 - .../inventory/ContainerBeacon.java.patch | 11 - .../ContainerBrewingStand.java.patch | 21 - .../inventory/ContainerEnchantment.java.patch | 77 - .../inventory/ContainerPlayer.java.patch | 12 - .../inventory/ContainerRepair.java.patch | 52 - .../net/minecraft/inventory/Slot.java.patch | 75 - .../inventory/SlotCrafting.java.patch | 14 - .../inventory/SlotFurnaceOutput.java.patch | 11 - .../net/minecraft/item/Item.java.patch | 697 --------- .../net/minecraft/item/ItemArmor.java.patch | 28 - .../net/minecraft/item/ItemBlock.java.patch | 56 - .../net/minecraft/item/ItemBow.java.patch | 31 - .../net/minecraft/item/ItemBucket.java.patch | 11 - .../minecraft/item/ItemBucketMilk.java.patch | 11 - .../net/minecraft/item/ItemDye.java.patch | 47 - .../minecraft/item/ItemEmptyMap.java.patch | 11 - .../item/ItemFlintAndSteel.java.patch | 11 - .../net/minecraft/item/ItemHoe.java.patch | 17 - .../net/minecraft/item/ItemLilyPad.java.patch | 18 - .../net/minecraft/item/ItemMap.java.patch | 11 - .../item/ItemMonsterPlacer.java.patch | 11 - .../net/minecraft/item/ItemRecord.java.patch | 20 - .../minecraft/item/ItemSeedFood.java.patch | 38 - .../net/minecraft/item/ItemSeeds.java.patch | 38 - .../net/minecraft/item/ItemShears.java.patch | 91 -- .../net/minecraft/item/ItemSkull.java.patch | 22 - .../net/minecraft/item/ItemSnow.java.patch | 13 - .../net/minecraft/item/ItemStack.java.patch | 229 --- .../net/minecraft/item/ItemSword.java.patch | 13 - .../net/minecraft/item/ItemTool.java.patch | 72 - .../item/crafting/FurnaceRecipes.java.patch | 20 - .../item/crafting/RecipeFireworks.java.patch | 37 - .../item/crafting/RecipeRepairItem.java.patch | 42 - .../item/crafting/RecipesArmorDyes.java.patch | 15 - .../item/crafting/RecipesBanners.java.patch | 27 - .../crafting/RecipesMapCloning.java.patch | 15 - .../item/crafting/ShapedRecipes.java.patch | 15 - .../item/crafting/ShapelessRecipes.java.patch | 15 - .../nbt/CompressedStreamTools.java.patch | 53 - .../minecraft/nbt/NBTSizeTracker.java.patch | 37 - .../minecraft/nbt/NBTTagCompound.java.patch | 18 - .../net/minecraft/nbt/NBTTagString.java.patch | 11 - .../network/NetHandlerPlayServer.java.patch | 68 - .../network/NetworkManager.java.patch | 53 - .../network/NetworkSystem.java.patch | 11 - .../network/ServerStatusResponse.java.patch | 91 -- .../handshake/client/C00Handshake.java.patch | 48 - .../client/CPacketCustomPayload.java.patch | 14 - .../server/SPacketCustomPayload.java.patch | 14 - .../net/minecraft/potion/Potion.java.patch | 57 - .../minecraft/potion/PotionEffect.java.patch | 87 -- .../minecraft/realms/RealmsConnect.java.patch | 19 - .../server/MinecraftServer.java.patch | 273 ---- .../dedicated/DedicatedServer.java.patch | 62 - .../dedicated/ServerHangWatchdog.java.patch | 28 - .../server/gui/MinecraftServerGui.java.patch | 24 - .../integrated/IntegratedServer.java.patch | 87 -- .../PlayerInteractionManager.java.patch | 213 --- .../server/management/PlayerList.java.patch | 229 --- .../management/PlayerManager.java.patch | 10 - .../network/NetHandlerHandshakeTCP.java.patch | 11 - .../network/NetHandlerLoginServer.java.patch | 20 - .../net/minecraft/stats/StatList.java.patch | 101 -- .../tileentity/TileEntity.java.patch | 256 ---- .../tileentity/TileEntityBeacon.java.patch | 20 - .../TileEntityBrewingStand.java.patch | 86 -- .../tileentity/TileEntityChest.java.patch | 37 - .../tileentity/TileEntityFurnace.java.patch | 99 -- .../tileentity/TileEntityHopper.java.patch | 62 - .../tileentity/TileEntityLockable.java.patch | 28 - .../tileentity/TileEntityNote.java.patch | 12 - .../tileentity/TileEntityPiston.java.patch | 22 - .../tileentity/TileEntitySign.java.patch | 11 - .../minecraft/util/ActionResult.java.patch | 13 - .../util/BlockRenderLayer.java.patch | 12 - .../net/minecraft/util/EnumFacing.java.patch | 67 - .../util/IntIdentityHashBiMap.java.patch | 10 - .../net/minecraft/util/MouseHelper.java.patch | 10 - .../net/minecraft/util/Session.java.patch | 68 - .../minecraft/util/TabCompleter.java.patch | 39 - .../minecraft/util/math/BlockPos.java.patch | 41 - .../util/math/RayTraceResult.java.patch | 15 - .../net/minecraft/util/math/Vec3d.java.patch | 19 - ...egistryNamespacedDefaultedByKey.java.patch | 14 - .../util/text/ITextComponent.java.patch | 10 - .../net/minecraft/util/text/Style.java.patch | 10 - .../util/text/TextComponentBase.java.patch | 10 - .../text/translation/LanguageMap.java.patch | 54 - .../net/minecraft/world/ChunkCache.java.patch | 56 - .../net/minecraft/world/Explosion.java.patch | 52 - .../minecraft/world/IBlockAccess.java.patch | 17 - .../net/minecraft/world/World.java.patch | 882 ----------- .../world/WorldEntitySpawner.java.patch | 54 - .../minecraft/world/WorldProvider.java.patch | 384 ----- .../world/WorldProviderSurface.java.patch | 10 - .../minecraft/world/WorldServer.java.patch | 258 ---- .../world/WorldServerMulti.java.patch | 62 - .../net/minecraft/world/WorldType.java.patch | 166 -- .../world/biome/BiomeDecorator.java.patch | 167 -- .../world/biome/BiomeGenBase.java.patch | 127 -- .../world/biome/BiomeGenForest.java.patch | 25 - .../world/biome/BiomeGenHills.java.patch | 63 - .../world/biome/BiomeGenJungle.java.patch | 13 - .../world/biome/BiomeGenPlains.java.patch | 22 - .../world/biome/BiomeGenSwamp.java.patch | 13 - .../world/biome/BiomeProvider.java.patch | 38 - .../world/border/WorldBorder.java.patch | 12 - .../minecraft/world/chunk/Chunk.java.patch | 294 ---- .../chunk/storage/AnvilChunkLoader.java.patch | 161 -- .../chunk/storage/AnvilSaveHandler.java.patch | 23 - .../storage/ExtendedBlockStorage.java.patch | 11 - .../world/chunk/storage/RegionFile.java.patch | 42 - .../world/gen/ChunkProviderEnd.java.patch | 72 - .../world/gen/ChunkProviderHell.java.patch | 104 -- .../gen/ChunkProviderOverworld.java.patch | 101 -- .../world/gen/ChunkProviderServer.java.patch | 110 -- .../world/gen/MapGenCaves.java.patch | 121 -- .../world/gen/MapGenRavine.java.patch | 124 -- .../feature/WorldGenAbstractTree.java.patch | 13 - .../feature/WorldGenBigMushroom.java.patch | 34 - .../gen/feature/WorldGenBigTree.java.patch | 52 - .../gen/feature/WorldGenBirchTree.java.patch | 64 - .../world/gen/feature/WorldGenBush.java.patch | 11 - .../gen/feature/WorldGenCanopyTree.java.patch | 72 - .../gen/feature/WorldGenDeadBush.java.patch | 19 - .../gen/feature/WorldGenDungeons.java.patch | 10 - .../gen/feature/WorldGenGlowStone1.java.patch | 11 - .../gen/feature/WorldGenGlowStone2.java.patch | 11 - .../gen/feature/WorldGenHellLava.java.patch | 11 - .../gen/feature/WorldGenHugeTrees.java.patch | 69 - .../gen/feature/WorldGenIceSpike.java.patch | 29 - .../gen/feature/WorldGenLiquids.java.patch | 11 - .../gen/feature/WorldGenMegaJungle.java.patch | 50 - .../feature/WorldGenMegaPineTree.java.patch | 60 - .../gen/feature/WorldGenMinable.java.patch | 12 - .../feature/WorldGenSavannaTree.java.patch | 64 - .../gen/feature/WorldGenShrub.java.patch | 37 - .../gen/feature/WorldGenSwamp.java.patch | 98 -- .../gen/feature/WorldGenTaiga1.java.patch | 52 - .../gen/feature/WorldGenTaiga2.java.patch | 66 - .../gen/feature/WorldGenTallGrass.java.patch | 19 - .../gen/feature/WorldGenTrees.java.patch | 105 -- .../WorldGeneratorBonusChest.java.patch | 55 - .../world/gen/layer/GenLayer.java.patch | 56 - .../world/gen/layer/GenLayerBiome.java.patch | 93 -- .../gen/structure/MapGenStronghold.java.patch | 23 - .../gen/structure/MapGenStructure.java.patch | 17 - .../structure/StructureComponent.java.patch | 13 - .../gen/structure/StructureStart.java.patch | 23 - .../StructureVillagePieces.java.patch | 63 - .../world/storage/MapData.java.patch | 48 - .../world/storage/SaveFormatOld.java.patch | 27 - .../world/storage/SaveHandler.java.patch | 70 - .../world/storage/WorldInfo.java.patch | 37 - 351 files changed, 20335 deletions(-) delete mode 100644 patches.mcp/minecraft/net/minecraft/block/Block.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockDragonEgg.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockDropper.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockStaticLiquid.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/state/IBlockProperties.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiIngame.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/network/ServerPinger.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/command/CommandBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/command/EntitySelector.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/Item.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/management/PlayerList.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/ActionResult.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/BlockRenderLayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/IntIdentityHashBiMap.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/Session.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/TabCompleter.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/math/BlockPos.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/math/RayTraceResult.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/math/Vec3d.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/text/ITextComponent.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/text/Style.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/text/TextComponentBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/World.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldProviderSurface.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch diff --git a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch deleted file mode 100644 index 6cf1659ec8..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch +++ /dev/null @@ -1,1365 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/Block.java -+++ ../src-work/minecraft/net/minecraft/block/Block.java -@@ -46,8 +46,9 @@ - public class Block - { - private static final ResourceLocation AIR_ID = new ResourceLocation("air"); -- public static final RegistryNamespacedDefaultedByKey blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID); -- public static final ObjectIntIdentityMap BLOCK_STATE_IDS = new ObjectIntIdentityMap(); -+ public static final RegistryNamespacedDefaultedByKey blockRegistry = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); -+ @Deprecated //Modders: DO NOT use this! Use GameRegistry -+ public static final ObjectIntIdentityMap BLOCK_STATE_IDS = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); - public static final AxisAlignedBB field_185505_j = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); - public static final AxisAlignedBB field_185506_k = null; - private CreativeTabs displayOnCreativeTab; -@@ -70,6 +71,9 @@ - private IBlockState defaultBlockState; - private String unlocalizedName; - -+ public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = -+ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)blockRegistry).getDelegate(this, Block.class); -+ - public static int getIdFromBlock(Block blockIn) - { - return blockRegistry.getIDForObject(blockIn); -@@ -83,7 +87,8 @@ - - public static Block getBlockById(int id) - { -- return (Block)blockRegistry.getObjectById(id); -+ Block ret = (Block)blockRegistry.getObjectById(id); -+ return ret == null ? net.minecraft.init.Blocks.air : ret; - } - - public static IBlockState getStateById(int id) -@@ -268,7 +273,7 @@ - - public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) - { -- return false; -+ return worldIn.getBlockState(pos).func_185904_a().isReplaceable(); - } - - public Block setHardness(float hardness) -@@ -305,9 +310,10 @@ - return this.needsRandomTick; - } - -+ @Deprecated //Forge: New State sensitive version. - public boolean hasTileEntity() - { -- return this.isBlockContainer; -+ return hasTileEntity(getDefaultState()); - } - - public AxisAlignedBB func_185496_a(IBlockState p_185496_1_, IBlockAccess p_185496_2_, BlockPos p_185496_3_) -@@ -346,13 +352,13 @@ - @SideOnly(Side.CLIENT) - public int func_185484_c(IBlockState p_185484_1_, IBlockAccess p_185484_2_, BlockPos p_185484_3_) - { -- int i = p_185484_2_.getCombinedLight(p_185484_3_, p_185484_1_.func_185906_d()); -+ int i = p_185484_2_.getCombinedLight(p_185484_3_, p_185484_1_.getLightValue(p_185484_2_, p_185484_3_)); - - if (i == 0 && p_185484_1_.getBlock() instanceof BlockSlab) - { - p_185484_3_ = p_185484_3_.down(); - p_185484_1_ = p_185484_2_.getBlockState(p_185484_3_); -- return p_185484_2_.getCombinedLight(p_185484_3_, p_185484_1_.func_185906_d()); -+ return p_185484_2_.getCombinedLight(p_185484_3_, p_185484_1_.getLightValue(p_185484_2_, p_185484_3_)); - } - else - { -@@ -415,7 +421,7 @@ - } - } - -- return !pos.getBlockState(side.offset(p_176225_4_)).func_185914_p(); -+ return !pos.getBlockState(side.offset(p_176225_4_)).doesSideBlockRendering(pos, side.offset(p_176225_4_), p_176225_4_.getOpposite()); - } - - @SideOnly(Side.CLIENT) -@@ -472,6 +478,10 @@ - - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) - { -+ if (hasTileEntity(state) && !(this instanceof BlockContainer)) -+ { -+ worldIn.removeTileEntity(pos); -+ } - } - - public int quantityDropped(Random random) -@@ -486,8 +496,7 @@ - - public float getPlayerRelativeBlockHardness(IBlockState playerIn, EntityPlayer worldIn, World pos, BlockPos p_180647_4_) - { -- float f = playerIn.func_185887_b(pos, p_180647_4_); -- return f < 0.0F ? 0.0F : (!worldIn.func_184823_b(playerIn) ? worldIn.func_184813_a(playerIn) / f / 100.0F : worldIn.func_184813_a(playerIn) / f / 30.0F); -+ return net.minecraftforge.common.ForgeHooks.blockStrength(playerIn, worldIn, pos, p_180647_4_); - } - - public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture) -@@ -497,20 +506,16 @@ - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- if (!worldIn.isRemote) -+ if (!worldIn.isRemote && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe - { -- int i = this.quantityDroppedWithBonus(fortune, worldIn.rand); -+ java.util.List items = getDrops(worldIn, pos, state, fortune); -+ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, fortune, chance, false, harvesters.get()); - -- for (int j = 0; j < i; ++j) -+ for (ItemStack item : items) - { - if (worldIn.rand.nextFloat() <= chance) - { -- Item item = this.getItemDropped(state, worldIn.rand, fortune); -- -- if (item != null) -- { -- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); -- } -+ spawnAsEntity(worldIn, pos, item); - } - } - } -@@ -518,8 +523,13 @@ - - public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) - { -- if (!worldIn.isRemote && worldIn.getGameRules().getBoolean("doTileDrops")) -+ if (!worldIn.isRemote && worldIn.getGameRules().getBoolean("doTileDrops") && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe - { -+ if (captureDrops.get()) -+ { -+ capturedDrops.get().add(stack); -+ return; -+ } - float f = 0.5F; - double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; - double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -@@ -588,7 +598,7 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable(); -+ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos); - } - - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand side, ItemStack hitX, EnumFacing hitY, float hitZ, float p_180639_9_, float p_180639_10_) -@@ -638,25 +648,35 @@ - player.triggerAchievement(StatList.func_188055_a(this)); - player.addExhaustion(0.025F); - -- if (this.canSilkHarvest() && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0) -+ if (this.canSilkHarvest(worldIn, pos, state, player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0) - { -+ java.util.List items = new java.util.ArrayList(); - ItemStack itemstack = this.createStackedBlock(state); - - if (itemstack != null) - { -- spawnAsEntity(worldIn, pos, itemstack); -+ items.add(itemstack); - } -+ -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, 0, 1.0f, true, player); -+ for (ItemStack stack : items) -+ { -+ spawnAsEntity(worldIn, pos, stack); -+ } - } - else - { -+ harvesters.set(player); - int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185308_t, p_180657_6_); - this.dropBlockAsItem(worldIn, pos, state, i); -+ harvesters.set(null); - } - } - -+ @Deprecated //Forge: State sensitive version - protected boolean canSilkHarvest() - { -- return this.getDefaultState().func_185917_h() && !this.isBlockContainer; -+ return this.getDefaultState().func_185917_h() && !this.hasTileEntity(silk_check_state.get()); - } - - protected ItemStack createStackedBlock(IBlockState state) -@@ -747,6 +767,7 @@ - entityIn.motionY = 0.0D; - } - -+ @Deprecated // Forge: Use more sensitive version below: getPickBlock - public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) - { - return new ItemStack(Item.getItemFromBlock(this), 1, this.damageDropped(p_185473_3_)); -@@ -844,6 +865,1166 @@ - return "Block{" + blockRegistry.getNameForObject(this) + "}"; - } - -+ /* ======================================== FORGE START =====================================*/ -+ //For ForgeInternal use Only! -+ protected ThreadLocal harvesters = new ThreadLocal(); -+ private ThreadLocal silk_check_state = new ThreadLocal(); -+ protected static java.util.Random RANDOM = new java.util.Random(); // Useful for random things without a seed. -+ /** -+ * Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15 -+ * -+ * @param state Block state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return The light value -+ */ -+ public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ IBlockState other = world.getBlockState(pos); -+ if (other.getBlock() != this) -+ { -+ return other.getLightValue(world, pos); -+ } -+ return state.func_185906_d(); -+ } -+ -+ /** -+ * Checks if a player or entity can use this block to 'climb' like a ladder. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @param entity The entity trying to use the ladder, CAN be null. -+ * @return True if the block should act like a ladder -+ */ -+ public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return false; } -+ -+ /** -+ * Return true if the block is a normal, solid cube. This -+ * determines indirect power state, entity ejection from blocks, and a few -+ * others. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True if the block is a full cube -+ */ -+ public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return state.func_185904_a().isOpaque() && state.func_185917_h() && !state.func_185897_m(); -+ } -+ -+ /** -+ * Check if the face of a block should block rendering. -+ * -+ * Faces which are fully opaque should return true, faces with transparency -+ * or faces which do not span the full size of the block should return false. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param side The side to check -+ * @return True if the block is opaque on the specified side. -+ */ -+ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ return state.func_185914_p(); -+ } -+ -+ /** -+ * Checks if the block is a solid face on the given side, used by placement logic. -+ * -+ * @param base_state The base state, getActualState should be called first -+ * @param world The current world -+ * @param pos Block position in world -+ * @param side The side to check -+ * @return True if the block is solid on the specified side. -+ */ -+ public boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side) -+ { -+ if (base_state.func_185896_q()) // Short circuit to vanilla function if its true -+ return true; -+ -+ IBlockState state = this.getActualState(base_state, world, pos); -+ -+ if (this instanceof BlockSlab) -+ { -+ return base_state.func_185913_b() -+ || (state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP ) -+ || (state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM && side == EnumFacing.DOWN); -+ } -+ else if (this instanceof BlockFarmland) -+ { -+ return (side != EnumFacing.DOWN && side != EnumFacing.UP); -+ } -+ else if (this instanceof BlockStairs) -+ { -+ boolean flipped = state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP; -+ BlockStairs.EnumShape shape = (BlockStairs.EnumShape)state.getValue(BlockStairs.SHAPE); -+ EnumFacing facing = (EnumFacing)state.getValue(BlockStairs.FACING); -+ if (side == EnumFacing.UP) return flipped; -+ if (side == EnumFacing.DOWN) return !flipped; -+ if (facing == side) return true; -+ if (flipped) -+ { -+ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.rotateYCCW(); -+ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.rotateY(); -+ } -+ else -+ { -+ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.rotateY(); -+ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.rotateYCCW(); -+ } -+ return false; -+ } -+ else if (this instanceof BlockSnow) -+ { -+ return ((Integer)state.getValue(BlockSnow.LAYERS)) >= 8; -+ } -+ else if (this instanceof BlockHopper && side == EnumFacing.UP) -+ { -+ return true; -+ } -+ else if (this instanceof BlockCompressedPowered) -+ { -+ return true; -+ } -+ return isNormalCube(state, world, pos); -+ } -+ -+ /** -+ * Determines if this block should set fire and deal fire damage -+ * to entities coming into contact with it. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True if the block should deal damage -+ */ -+ public boolean isBurning(IBlockAccess world, BlockPos pos) -+ { -+ return false; -+ } -+ -+ /** -+ * Determines this block should be treated as an air block -+ * by the rest of the code. This method is primarily -+ * useful for creating pure logic-blocks that will be invisible -+ * to the player and otherwise interact as air would. -+ * -+ * @param sata The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True if the block considered air -+ */ -+ public boolean isAir(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return state.func_185904_a() == Material.air; -+ } -+ -+ /** -+ * Determines if the player can harvest this block, obtaining it's drops when the block is destroyed. -+ * -+ * @param player The player damaging the block, may be null -+ * @param meta The block's current metadata -+ * @return True to spawn the drops -+ */ -+ public boolean canHarvestBlock(IBlockAccess world, BlockPos pos, EntityPlayer player) -+ { -+ return net.minecraftforge.common.ForgeHooks.canHarvestBlock(this, player, world, pos); -+ } -+ -+ /** -+ * Called when a player removes a block. This is responsible for -+ * actually destroying the block, and the block is intact at time of call. -+ * This is called regardless of whether the player can harvest the block or -+ * not. -+ * -+ * Return true if the block is actually destroyed. -+ * -+ * Note: When used in multiplayer, this is called on both client and -+ * server sides! -+ * -+ * @param state The current state. -+ * @param world The current world -+ * @param player The player damaging the block, may be null -+ * @param pos Block position in world -+ * @param willHarvest True if Block.harvestBlock will be called after this, if the return in true. -+ * Can be useful to delay the destruction of tile entities till after harvestBlock -+ * @return True if the block is actually destroyed. -+ */ -+ public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) -+ { -+ this.onBlockHarvested(world, pos, state, player); -+ return world.setBlockState(pos, net.minecraft.init.Blocks.air.getDefaultState(), world.isRemote ? 11 : 3); -+ } -+ -+ /** -+ * Chance that fire will spread and consume this block. -+ * 300 being a 100% chance, 0, being a 0% chance. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param face The face that the fire is coming from -+ * @return A number ranging from 0 to 300 relating used to determine if the block will be consumed by fire -+ */ -+ public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ return net.minecraft.init.Blocks.fire.getFlammability(this); -+ } -+ -+ /** -+ * Called when fire is updating, checks if a block face can catch fire. -+ * -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param face The face that the fire is coming from -+ * @return True if the face can be on fire, false otherwise. -+ */ -+ public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ return getFlammability(world, pos, face) > 0; -+ } -+ -+ /** -+ * Called when fire is updating on a neighbor block. -+ * The higher the number returned, the faster fire will spread around this block. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param face The face that the fire is coming from -+ * @return A number that is used to determine the speed of fire growth around the block -+ */ -+ public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ return net.minecraft.init.Blocks.fire.getEncouragement(this); -+ } -+ -+ /** -+ * Currently only called by fire when it is on top of this block. -+ * Returning true will prevent the fire from naturally dying during updating. -+ * Also prevents firing from dying from rain. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param metadata The blocks current metadata -+ * @param side The face that the fire is coming from -+ * @return True if this block sustains fire, meaning it will never go out. -+ */ -+ public boolean isFireSource(World world, BlockPos pos, EnumFacing side) -+ { -+ if (this == net.minecraft.init.Blocks.netherrack && side == EnumFacing.UP) -+ { -+ return true; -+ } -+ if ((world.provider instanceof net.minecraft.world.WorldProviderEnd) && this == net.minecraft.init.Blocks.bedrock && side == EnumFacing.UP) -+ { -+ return true; -+ } -+ return false; -+ } -+ -+ private boolean isTileProvider = this instanceof ITileEntityProvider; -+ /** -+ * Called throughout the code as a replacement for block instanceof BlockContainer -+ * Moving this to the Block base class allows for mods that wish to extend vanilla -+ * blocks, and also want to have a tile entity on that block, may. -+ * -+ * Return true from this function to specify this block has a tile entity. -+ * -+ * @param state State of the current block -+ * @return True if block has a tile entity, false otherwise -+ */ -+ public boolean hasTileEntity(IBlockState state) -+ { -+ return isTileProvider; -+ } -+ -+ /** -+ * Called throughout the code as a replacement for ITileEntityProvider.createNewTileEntity -+ * Return the same thing you would from that function. -+ * This will fall back to ITileEntityProvider.createNewTileEntity(World) if this block is a ITileEntityProvider -+ * -+ * @param metadata The Metadata of the current block -+ * @return A instance of a class extending TileEntity -+ */ -+ public TileEntity createTileEntity(World world, IBlockState state) -+ { -+ if (isTileProvider) -+ { -+ return ((ITileEntityProvider)this).createNewTileEntity(world, getMetaFromState(state)); -+ } -+ return null; -+ } -+ -+ /** -+ * State and fortune sensitive version, this replaces the old (int meta, Random rand) -+ * version in 1.1. -+ * -+ * @param state Current state -+ * @param fortune Current item fortune level -+ * @param random Random number generator -+ * @return The number of items to drop -+ */ -+ public int quantityDropped(IBlockState state, int fortune, Random random) -+ { -+ return quantityDroppedWithBonus(fortune, random); -+ } -+ -+ /** -+ * This returns a complete list of items dropped from this block. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param state Current state -+ * @param fortune Breakers fortune level -+ * @return A ArrayList containing all items this block drops -+ */ -+ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ List ret = new java.util.ArrayList(); -+ -+ Random rand = world instanceof World ? ((World)world).rand : RANDOM; -+ -+ int count = quantityDropped(state, fortune, rand); -+ for(int i = 0; i < count; i++) -+ { -+ Item item = this.getItemDropped(state, rand, fortune); -+ if (item != null) -+ { -+ ret.add(new ItemStack(item, 1, this.damageDropped(state))); -+ } -+ } -+ return ret; -+ } -+ -+ /** -+ * Return true from this function if the player with silk touch can harvest this block directly, and not it's normal drops. -+ * -+ * @param world The world -+ * @param pos Block position in world -+ * @param state current block state -+ * @param player The player doing the harvesting -+ * @return True if the block can be directly harvested using silk touch -+ */ -+ public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) -+ { -+ silk_check_state.set(state);; -+ boolean ret = this.canSilkHarvest(); -+ silk_check_state.set(null); -+ return ret; -+ } -+ -+ /** -+ * Determines if a specified mob type can spawn on this block, returning false will -+ * prevent any mob from spawning on the block. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @param type The Mob Category Type -+ * @return True to allow a mob of the specified category to spawn, false to prevent it. -+ */ -+ public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, net.minecraft.entity.EntityLiving.SpawnPlacementType type) -+ { -+ return isSideSolid(state, world, pos, EnumFacing.UP); -+ } -+ -+ /** -+ * Determines if this block is classified as a Bed, Allowing -+ * players to sleep in it, though the block has to specifically -+ * perform the sleeping functionality in it's activated event. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @param player The player or camera entity, null in some cases. -+ * @return True to treat this as a bed -+ */ -+ public boolean isBed(IBlockState state, IBlockAccess world, BlockPos pos, Entity player) -+ { -+ return this == net.minecraft.init.Blocks.bed; -+ } -+ -+ /** -+ * Returns the position that the player is moved to upon -+ * waking up, or respawning at the bed. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @param player The player or camera entity, null in some cases. -+ * @return The spawn position -+ */ -+ public BlockPos getBedSpawnPosition(IBlockState state, IBlockAccess world, BlockPos pos, EntityPlayer player) -+ { -+ if (world instanceof World) -+ return BlockBed.getSafeExitLocation((World)world, pos, 0); -+ return null; -+ } -+ -+ /** -+ * Called when a user either starts or stops sleeping in the bed. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param player The player or camera entity, null in some cases. -+ * @param occupied True if we are occupying the bed, or false if they are stopping use of the bed -+ */ -+ public void setBedOccupied(IBlockAccess world, BlockPos pos, EntityPlayer player, boolean occupied) -+ { -+ if (world instanceof World) -+ { -+ IBlockState state = world.getBlockState(pos); -+ state = state.getBlock().getActualState(state, world, pos); -+ state = state.withProperty(BlockBed.OCCUPIED, true); -+ ((World)world).setBlockState(pos, state, 4); -+ } -+ } -+ -+ /** -+ * Returns the direction of the block. Same values that -+ * are returned by BlockDirectional -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return Bed direction -+ */ -+ public EnumFacing getBedDirection(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return (EnumFacing)getActualState(state, world, pos).getValue(BlockHorizontal.field_185512_D); -+ } -+ -+ /** -+ * Determines if the current block is the foot half of the bed. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True if the current block is the foot side of a bed. -+ */ -+ public boolean isBedFoot(IBlockAccess world, BlockPos pos) -+ { -+ return getActualState(world.getBlockState(pos), world, pos).getValue(BlockBed.PART) == BlockBed.EnumPartType.FOOT; -+ } -+ -+ /** -+ * Called when a leaf should start its decay process. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ */ -+ public void beginLeavesDecay(IBlockState state, World world, BlockPos pos){} -+ -+ /** -+ * Determines if this block can prevent leaves connected to it from decaying. -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return true if the presence this block can prevent leaves from decaying. -+ */ -+ public boolean canSustainLeaves(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return false; -+ } -+ -+ /** -+ * Determines if this block is considered a leaf block, used to apply the leaf decay and generation system. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return true if this block is considered leaves. -+ */ -+ public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return state.func_185904_a() == Material.leaves; -+ } -+ -+ /** -+ * Used during tree growth to determine if newly generated leaves can replace this block. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return true if this block can be replaced by growing leaves. -+ */ -+ public boolean canBeReplacedByLeaves(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return !state.func_185913_b(); -+ } -+ -+ /** -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return true if the block is wood (logs) -+ */ -+ public boolean isWood(IBlockAccess world, BlockPos pos) -+ { -+ return false; -+ } -+ -+ /** -+ * Determines if the current block is replaceable by Ore veins during world generation. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @param target The generic target block the gen is looking for, Standards define stone -+ * for overworld generation, and neatherack for the nether. -+ * @return True to allow this block to be replaced by a ore -+ */ -+ public boolean isReplaceableOreGen(IBlockState state, IBlockAccess world, BlockPos pos, com.google.common.base.Predicate target) -+ { -+ return target.apply(state); -+ } -+ -+ /** -+ * Location sensitive version of getExplosionRestance -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param exploder The entity that caused the explosion, can be null -+ * @param explosion The explosion -+ * @return The amount of the explosion absorbed. -+ */ -+ public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) -+ { -+ return getExplosionResistance(exploder); -+ } -+ -+ /** -+ * Called when the block is destroyed by an explosion. -+ * Useful for allowing the block to take into account tile entities, -+ * state, etc. when exploded, before it is removed. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param Explosion The explosion instance affecting the block -+ */ -+ public void onBlockExploded(World world, BlockPos pos, Explosion explosion) -+ { -+ world.setBlockToAir(pos); -+ onBlockDestroyedByExplosion(world, pos, explosion); -+ } -+ -+ /** -+ * Determine if this block can make a redstone connection on the side provided, -+ * Useful to control which sides are inputs and outputs for redstone wires. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @param side The side that is trying to make the connection, CAN BE NULL -+ * @return True to make the connection -+ */ -+ public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) -+ { -+ return state.func_185897_m() && side != null; -+ } -+ -+ /** -+ * Determines if a torch can be placed on the top surface of this block. -+ * Useful for creating your own block that torches can be on, such as fences. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True to allow the torch to be placed -+ */ -+ public boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ if (state.isSideSolid(world, pos, EnumFacing.UP)) -+ { -+ return true; -+ } -+ else -+ { -+ return this instanceof BlockFence || this == net.minecraft.init.Blocks.glass || this == net.minecraft.init.Blocks.cobblestone_wall || this == net.minecraft.init.Blocks.stained_glass; -+ } -+ } -+ -+ /** Dont think this exists in 1.8 anymore -+ /** -+ * Determines if this block should render in this pass. -+ * -+ * @param pass The pass in question -+ * @return True to render -+ * / -+ public boolean canRenderInPass(int pass) -+ { -+ return pass == func_149701_w(); -+ } -+ */ -+ -+ /** -+ * Called when a user uses the creative pick block button on this block -+ * -+ * @param target The full target the player is looking at -+ * @return A ItemStack to add to the player's inventory, Null if nothing should be added. -+ */ -+ public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) -+ { -+ return func_185473_a(world, pos, state); -+ } -+ -+ /** -+ * Used by getTopSolidOrLiquidBlock while placing biome decorations, villages, etc -+ * Also used to determine if the player can spawn on this block. -+ * -+ * @return False to disallow spawning -+ */ -+ public boolean isFoliage(IBlockAccess world, BlockPos pos) -+ { -+ return false; -+ } -+ -+ /** -+ * Allows a block to override the standard EntityLivingBase.updateFallState -+ * particles, this is a server side method that spawns particles with -+ * WorldServer.spawnParticle -+ * -+ * @param world The current Server world -+ * @param blockPosition of the block that the entity landed on. -+ * @param iblockstate State at the specific world/pos -+ * @param entity the entity that hit landed on the block. -+ * @param numberOfParticles that vanilla would have spawned. -+ * @return True to prevent vanilla landing particles form spawning. -+ */ -+ public boolean addLandingEffects(IBlockState state, net.minecraft.world.WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles ) -+ { -+ return false; -+ } -+ -+ /** -+ * Spawn a digging particle effect in the world, this is a wrapper -+ * around EffectRenderer.addBlockHitEffects to allow the block more -+ * control over the particles. Useful when you have entirely different -+ * texture sheets for different sides/locations in the world. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param target The target the player is looking at {x/y/z/side/sub} -+ * @param effectRenderer A reference to the current effect renderer. -+ * @return True to prevent vanilla digging particles form spawning. -+ */ -+ @SideOnly(Side.CLIENT) -+ public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, net.minecraft.client.particle.EffectRenderer effectRenderer) -+ { -+ return false; -+ } -+ -+ /** -+ * Spawn particles for when the block is destroyed. Due to the nature -+ * of how this is invoked, the x/y/z locations are not always guaranteed -+ * to host your block. So be sure to do proper sanity checks before assuming -+ * that the location is this block. -+ * -+ * @param world The current world -+ * @param pos Position to spawn the particle -+ * @param effectRenderer A reference to the current effect renderer. -+ * @return True to prevent vanilla break particles from spawning. -+ */ -+ @SideOnly(Side.CLIENT) -+ public boolean addDestroyEffects(World world, BlockPos pos, net.minecraft.client.particle.EffectRenderer effectRenderer) -+ { -+ return false; -+ } -+ -+ /** -+ * Determines if this block can support the passed in plant, allowing it to be planted and grow. -+ * Some examples: -+ * Reeds check if its a reed, or if its sand/dirt/grass and adjacent to water -+ * Cacti checks if its a cacti, or if its sand -+ * Nether types check for soul sand -+ * Crops check for tilled soil -+ * Caves check if it's a solid surface -+ * Plains check if its grass or dirt -+ * Water check if its still water -+ * -+ * @param state The Current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @param direction The direction relative to the given position the plant wants to be, typically its UP -+ * @param plantable The plant that wants to check -+ * @return True to allow the plant to be planted/stay. -+ */ -+ public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) -+ { -+ IBlockState plant = plantable.getPlant(world, pos.offset(direction)); -+ net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); -+ -+ if (plant.getBlock() == net.minecraft.init.Blocks.cactus && this == net.minecraft.init.Blocks.cactus) -+ { -+ return true; -+ } -+ -+ if (plant.getBlock() == net.minecraft.init.Blocks.reeds && this == net.minecraft.init.Blocks.reeds) -+ { -+ return true; -+ } -+ -+ if (plantable instanceof BlockBush && ((BlockBush)plantable).func_185514_i(state)) -+ { -+ return true; -+ } -+ -+ switch (plantType) -+ { -+ case Desert: return this == net.minecraft.init.Blocks.sand || this == net.minecraft.init.Blocks.hardened_clay || this == net.minecraft.init.Blocks.stained_hardened_clay || this == net.minecraft.init.Blocks.dirt; -+ case Nether: return this == net.minecraft.init.Blocks.soul_sand; -+ case Crop: return this == net.minecraft.init.Blocks.farmland; -+ case Cave: return state.isSideSolid(world, pos, EnumFacing.UP); -+ case Plains: return this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.farmland; -+ case Water: return state.func_185904_a() == Material.water && state.getValue(BlockLiquid.LEVEL) == 0; -+ case Beach: -+ boolean isBeach = this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.sand; -+ boolean hasWater = (world.getBlockState(pos.east()).func_185904_a() == Material.water || -+ world.getBlockState(pos.west()).func_185904_a() == Material.water || -+ world.getBlockState(pos.north()).func_185904_a() == Material.water || -+ world.getBlockState(pos.south()).func_185904_a() == Material.water); -+ return isBeach && hasWater; -+ } -+ -+ return false; -+ } -+ -+ /** -+ * Called when a plant grows on this block, only implemented for saplings using the WorldGen*Trees classes right now. -+ * Modder may implement this for custom plants. -+ * This does not use ForgeDirection, because large/huge trees can be located in non-representable direction, -+ * so the source location is specified. -+ * Currently this just changes the block to dirt if it was grass. -+ * -+ * Note: This happens DURING the generation, the generation may not be complete when this is called. -+ * -+ * @param state The current state -+ * @param world Current world -+ * @param pos Block position in world -+ * @param source Source plant's position in world -+ */ -+ public void onPlantGrow(IBlockState state, World world, BlockPos pos, BlockPos source) -+ { -+ if (this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.farmland) -+ { -+ world.setBlockState(pos, net.minecraft.init.Blocks.dirt.getDefaultState(), 2); -+ } -+ } -+ -+ /** -+ * Checks if this soil is fertile, typically this means that growth rates -+ * of plants on this soil will be slightly sped up. -+ * Only vanilla case is tilledField when it is within range of water. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True if the soil should be considered fertile. -+ */ -+ public boolean isFertile(World world, BlockPos pos) -+ { -+ if (this == net.minecraft.init.Blocks.farmland) -+ { -+ return ((Integer)world.getBlockState(pos).getValue(BlockFarmland.MOISTURE)) > 0; -+ } -+ -+ return false; -+ } -+ -+ /** -+ * Location aware and overrideable version of the lightOpacity array, -+ * return the number to subtract from the light value when it passes through this block. -+ * -+ * This is not guaranteed to have the tile entity in place before this is called, so it is -+ * Recommended that you have your tile entity call relight after being placed if you -+ * rely on it for light info. -+ * -+ * @param state The Block state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return The amount of light to block, 0 for air, 255 for fully opaque. -+ */ -+ public int getLightOpacity(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return state.func_185891_c(); -+ } -+ -+ /** -+ * Determines if this block is can be destroyed by the specified entities normal behavior. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True to allow the ender dragon to destroy this block -+ */ -+ public boolean canEntityDestroy(IBlockState state, IBlockAccess world, BlockPos pos, Entity entity) -+ { -+ if (entity instanceof net.minecraft.entity.boss.EntityDragon) -+ { -+ return this != net.minecraft.init.Blocks.barrier && -+ this != net.minecraft.init.Blocks.obsidian && -+ this != net.minecraft.init.Blocks.end_stone && -+ this != net.minecraft.init.Blocks.bedrock && -+ this != net.minecraft.init.Blocks.end_portal && -+ this != net.minecraft.init.Blocks.end_portal_frame && -+ this != net.minecraft.init.Blocks.command_block && -+ this != net.minecraft.init.Blocks.field_185776_dc && -+ this != net.minecraft.init.Blocks.field_185777_dd && -+ this != net.minecraft.init.Blocks.iron_bars && -+ this != net.minecraft.init.Blocks.field_185775_db; -+ } -+ else if (entity instanceof net.minecraft.entity.boss.EntityWither) -+ { -+ return net.minecraft.entity.boss.EntityWither.func_181033_a(this); -+ } -+ -+ return true; -+ } -+ -+ /** -+ * Determines if this block can be used as the base of a beacon. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param beacon Beacon position in world -+ * @return True, to support the beacon, and make it active with this block. -+ */ -+ public boolean isBeaconBase(IBlockAccess worldObj, BlockPos pos, BlockPos beacon) -+ { -+ return this == net.minecraft.init.Blocks.emerald_block || this == net.minecraft.init.Blocks.gold_block || this == net.minecraft.init.Blocks.diamond_block || this == net.minecraft.init.Blocks.iron_block; -+ } -+ -+ /** -+ * Rotate the block. For vanilla blocks this rotates around the axis passed in (generally, it should be the "face" that was hit). -+ * Note: for mod blocks, this is up to the block and modder to decide. It is not mandated that it be a rotation around the -+ * face, but could be a rotation to orient *to* that face, or a visiting of possible rotations. -+ * The method should return true if the rotation was successful though. -+ * -+ * @param world The world -+ * @param pos Block position in world -+ * @param axis The axis to rotate around -+ * @return True if the rotation was successful, False if the rotation failed, or is not possible -+ */ -+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("facing") || prop.getName().equals("rotation")) -+ { -+ world.setBlockState(pos, state.cycleProperty(prop)); -+ return true; -+ } -+ } -+ return false; -+ } -+ -+ /** -+ * Get the rotations that can apply to the block at the specified coordinates. Null means no rotations are possible. -+ * Note, this is up to the block to decide. It may not be accurate or representative. -+ * @param world The world -+ * @param pos Block position in world -+ * @return An array of valid axes to rotate around, or null for none or unknown -+ */ -+ public EnumFacing[] getValidRotations(World world, BlockPos pos) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("facing") && prop.getValueClass() == EnumFacing.class) -+ { -+ @SuppressWarnings("unchecked") -+ java.util.Collection values = ((java.util.Collection)prop.getAllowedValues()); -+ return values.toArray(new EnumFacing[values.size()]); -+ } -+ } -+ return null; -+ } -+ -+ /** -+ * Determines the amount of enchanting power this block can provide to an enchanting table. -+ * @param world The World -+ * @param pos Block position in world -+ * @return The amount of enchanting power this block produces. -+ */ -+ public float getEnchantPowerBonus(World world, BlockPos pos) -+ { -+ return this == net.minecraft.init.Blocks.bookshelf ? 1 : 0; -+ } -+ -+ /** -+ * Common way to recolor a block with an external tool -+ * @param world The world -+ * @param pos Block position in world -+ * @param side The side hit with the coloring tool -+ * @param color The color to change to -+ * @return If the recoloring was successful -+ */ -+ @SuppressWarnings({ "unchecked", "rawtypes" }) -+ public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, net.minecraft.item.EnumDyeColor color) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class) -+ { -+ net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.getValue(prop); -+ if (current != color) -+ { -+ world.setBlockState(pos, state.withProperty(prop, color)); -+ return true; -+ } -+ } -+ } -+ return false; -+ } -+ -+ /** -+ * Gathers how much experience this block drops when broken. -+ * -+ * @param state The current state -+ * @param world The world -+ * @param pos Block position -+ * @param fortune -+ * @return Amount of XP from breaking this block. -+ */ -+ public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return 0; -+ } -+ -+ /** -+ * Called when a tile entity on a side of this block changes is created or is destroyed. -+ * @param world The world -+ * @param pos Block position in world -+ * @param neighbor Block position of neighbor -+ */ -+ public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor){} -+ -+ /** -+ * Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules. -+ * @param world The world -+ * @param pos Block position in world -+ * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side -+ * @return Whether Block#isProvidingWeakPower should be called when determining indirect power -+ */ -+ public boolean shouldCheckWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) -+ { -+ return state.func_185915_l(); -+ } -+ -+ /** -+ * If this block should be notified of weak changes. -+ * Weak changes are changes 1 block away through a solid block. -+ * Similar to comparators. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param side The side to check -+ * @return true To be notified of changes -+ */ -+ public boolean getWeakChanges(IBlockAccess world, BlockPos pos) -+ { -+ return false; -+ } -+ -+ private String[] harvestTool = new String[16];; -+ private int[] harvestLevel = new int[]{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; -+ /** -+ * Sets or removes the tool and level required to harvest this block. -+ * -+ * @param toolClass Class -+ * @param level Harvest level: -+ * Wood: 0 -+ * Stone: 1 -+ * Iron: 2 -+ * Diamond: 3 -+ * Gold: 0 -+ */ -+ public void setHarvestLevel(String toolClass, int level) -+ { -+ java.util.Iterator itr = getBlockState().getValidStates().iterator(); -+ while (itr.hasNext()) -+ { -+ setHarvestLevel(toolClass, level, itr.next()); -+ } -+ } -+ -+ /** -+ * Sets or removes the tool and level required to harvest this block. -+ * -+ * @param toolClass Class -+ * @param level Harvest level: -+ * Wood: 0 -+ * Stone: 1 -+ * Iron: 2 -+ * Diamond: 3 -+ * Gold: 0 -+ * @param state The specific state. -+ */ -+ public void setHarvestLevel(String toolClass, int level, IBlockState state) -+ { -+ int idx = this.getMetaFromState(state); -+ this.harvestTool[idx] = toolClass; -+ this.harvestLevel[idx] = level; -+ } -+ -+ /** -+ * Queries the class of tool required to harvest this block, if null is returned -+ * we assume that anything can harvest this block. -+ */ -+ public String getHarvestTool(IBlockState state) -+ { -+ return harvestTool[getMetaFromState(state)]; -+ } -+ -+ /** -+ * Queries the harvest level of this item stack for the specified tool class, -+ * Returns -1 if this tool is not of the specified type -+ * -+ * @param stack This item stack instance -+ * @return Harvest level, or -1 if not the specified tool type. -+ */ -+ public int getHarvestLevel(IBlockState state) -+ { -+ return harvestLevel[getMetaFromState(state)]; -+ } -+ -+ /** -+ * Checks if the specified tool type is efficient on this block, -+ * meaning that it digs at full speed. -+ */ -+ public boolean isToolEffective(String type, IBlockState state) -+ { -+ if ("pickaxe".equals(type) && (this == net.minecraft.init.Blocks.redstone_ore || this == net.minecraft.init.Blocks.lit_redstone_ore || this == net.minecraft.init.Blocks.obsidian)) -+ return false; -+ return type != null && type.equals(getHarvestTool(state)); -+ } -+ -+ /** -+ * Can return IExtendedBlockState -+ */ -+ public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return state; -+ } -+ -+ /** -+ * Called when the entity is inside this block, may be used to determined if the entity can breathing, -+ * display material overlays, or if the entity can swim inside a block. -+ * -+ * @param world that is being tested. -+ * @param blockpos position thats being tested. -+ * @param iblockstate state at world/blockpos -+ * @param entity that is being tested. -+ * @param yToTest, primarily for testingHead, which sends the the eye level of the entity, other wise it sends a y that can be tested vs liquid height. -+ * @param materialIn to test for. -+ * @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment. -+ * @return null for default behavior, true if the entity is within the material, false if it was not. -+ */ -+ public Boolean isEntityInsideMaterial(IBlockAccess world, BlockPos blockpos, IBlockState iblockstate, Entity entity, double yToTest, Material materialIn, boolean testingHead) -+ { -+ return null; -+ } -+ -+ /** -+ * Called when boats or fishing hooks are inside the block to check if they are inside -+ * the material requested. -+ * -+ * @param world world that is being tested. -+ * @param pos block thats being tested. -+ * @param boundingBox box to test, generally the bounds of an entity that are besting tested. -+ * @param materialIn to check for. -+ * @return null for default behavior, true if the box is within the material, false if it was not. -+ */ -+ public Boolean isAABBInsideMaterial(World world, BlockPos pos, AxisAlignedBB boundingBox, Material materialIn) -+ { -+ return null; -+ } -+ -+ /** -+ * Queries if this block should render in a given layer. -+ * ISmartBlockModel can use MinecraftForgeClient.getRenderLayer to alter their model based on layer -+ */ -+ public boolean canRenderInLayer(BlockRenderLayer layer) -+ { -+ return getBlockLayer() == layer; -+ } -+ -+ // For Internal use only to capture droped items inside getDrops -+ protected static ThreadLocal captureDrops = new ThreadLocal() -+ { -+ @Override protected Boolean initialValue() { return false; } -+ }; -+ protected static ThreadLocal> capturedDrops = new ThreadLocal>() -+ { -+ @Override protected List initialValue() { return new java.util.ArrayList(); } -+ }; -+ protected List captureDrops(boolean start) -+ { -+ if (start) -+ { -+ captureDrops.set(true); -+ capturedDrops.get().clear(); -+ return null; -+ } -+ else -+ { -+ captureDrops.set(false); -+ return capturedDrops.get(); -+ } -+ } -+ -+ private ResourceLocation registryName = null; -+ /** -+ * Sets a unique name for this Block. This should be used for uniquely identify the instance of the Block. -+ * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. -+ * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. -+ * -+ * The supplied name will be prefixed with the currently active mod's modId. -+ * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. -+ * -+ * If a name already exists, or this Block is already registered in a registry, then an IllegalStateException is thrown. -+ * -+ * Returns 'this' to allow for chaining. -+ * -+ * @param name Unique registry name -+ * @return This instance -+ */ -+ public final Block setRegistryName(String name) -+ { -+ if (getRegistryName() != null) -+ throw new IllegalStateException("Attempted to set registry name on block with exisiting registry name! New: " + name + " Old: " + getRegistryName()); -+ int index = name.lastIndexOf(':'); -+ String oldPrefix = index == -1 ? "" : name.substring(0, index); -+ name = index == -1 ? name : name.substring(index + 1); -+ net.minecraftforge.fml.common.ModContainer mc = net.minecraftforge.fml.common.Loader.instance().activeModContainer(); -+ String prefix = mc == null ? "minecraft" : mc.getModId(); -+ if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) -+ { -+ net.minecraftforge.fml.common.FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name); -+ prefix = oldPrefix; -+ } -+ this.registryName = new ResourceLocation(prefix, name); -+ return this; -+ } -+ public final Block setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); } -+ public final Block setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); } -+ -+ /** -+ * A unique identifier for this block, if this block is registered in the game registry it will return that name. -+ * Otherwise it will return the name set in setRegistryName(). -+ * If neither are valid null is returned. -+ * -+ * @return Unique identifier or null. -+ */ -+ public final String getRegistryName() -+ { -+ if (delegate.getResourceName() != null) return delegate.getResourceName().toString(); -+ return registryName != null ? registryName.toString() : null; -+ } -+ /* ========================================= FORGE END ======================================*/ -+ - public static void registerBlocks() - { - registerBlock(0, AIR_ID, (new BlockAir()).setUnlocalizedName("air")); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch deleted file mode 100644 index 6a8da5c926..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockBanner.java -+++ ../src-work/minecraft/net/minecraft/block/BlockBanner.java -@@ -104,14 +104,7 @@ - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- ItemStack itemstack = this.func_185549_e(worldIn, pos, state); -- -- if (itemstack != null) - { -- spawnAsEntity(worldIn, pos, itemstack); -- } -- else -- { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); - } - } -@@ -138,6 +131,28 @@ - } - } - -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ TileEntity te = world.getTileEntity(pos); -+ -+ java.util.List ret = new java.util.ArrayList(); -+ if (te instanceof TileEntityBanner) -+ { -+ TileEntityBanner banner = (TileEntityBanner)te; -+ ItemStack item = new ItemStack(Items.banner, 1, banner.getBaseColor()); -+ NBTTagCompound nbt = new NBTTagCompound(); -+ TileEntityBanner.func_181020_a(nbt, banner.getBaseColor(), banner.func_181021_d()); -+ item.setTagInfo("BlockEntityTag", nbt); -+ ret.add(item); -+ } -+ else -+ { -+ ret.add(new ItemStack(Items.banner, 1, 0)); -+ } -+ return ret; -+ } -+ - public static class BlockBannerHanging extends BlockBanner - { - protected static final AxisAlignedBB field_185551_d = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 0.78125D, 1.0D); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch deleted file mode 100644 index ec7e1b3282..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockBush.java -+++ ../src-work/minecraft/net/minecraft/block/BlockBush.java -@@ -14,7 +14,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockBush extends Block -+public class BlockBush extends Block implements net.minecraftforge.common.IPlantable - { - protected static final AxisAlignedBB field_185515_b = new AxisAlignedBB(0.30000001192092896D, 0.0D, 0.30000001192092896D, 0.699999988079071D, 0.6000000238418579D, 0.699999988079071D); - -@@ -37,7 +37,8 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return super.canPlaceBlockAt(worldIn, pos) && this.func_185514_i(worldIn.getBlockState(pos.down())); -+ IBlockState soil = worldIn.getBlockState(pos.down()); -+ return super.canPlaceBlockAt(worldIn, pos) && soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); - } - - protected boolean func_185514_i(IBlockState p_185514_1_) -@@ -67,6 +68,11 @@ - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -+ if (state.getBlock() == this) //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. -+ { -+ IBlockState soil = worldIn.getBlockState(pos.down()); -+ return soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); -+ } - return this.func_185514_i(worldIn.getBlockState(pos.down())); - } - -@@ -90,6 +96,35 @@ - return false; - } - -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ if (this == Blocks.wheat) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.carrots) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.potatoes) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.melon_stem) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.pumpkin_stem) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.deadbush) return net.minecraftforge.common.EnumPlantType.Desert; -+ if (this == Blocks.waterlily) return net.minecraftforge.common.EnumPlantType.Water; -+ if (this == Blocks.red_mushroom) return net.minecraftforge.common.EnumPlantType.Cave; -+ if (this == Blocks.brown_mushroom) return net.minecraftforge.common.EnumPlantType.Cave; -+ if (this == Blocks.nether_wart) return net.minecraftforge.common.EnumPlantType.Nether; -+ if (this == Blocks.sapling) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.tallgrass) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.double_plant) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.red_flower) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.yellow_flower) return net.minecraftforge.common.EnumPlantType.Plains; -+ return net.minecraftforge.common.EnumPlantType.Plains; -+ } -+ -+ @Override -+ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ IBlockState state = world.getBlockState(pos); -+ if (state.getBlock() != this) return getDefaultState(); -+ return state; -+ } -+ - @SideOnly(Side.CLIENT) - public BlockRenderLayer getBlockLayer() - { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch deleted file mode 100644 index 965be0f0ca..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockButton.java -+++ ../src-work/minecraft/net/minecraft/block/BlockButton.java -@@ -89,7 +89,7 @@ - protected static boolean func_181088_a(World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_) - { - BlockPos blockpos = p_181088_1_.offset(p_181088_2_); -- return p_181088_2_ == EnumFacing.DOWN ? p_181088_0_.getBlockState(blockpos).func_185896_q() : p_181088_0_.getBlockState(blockpos).func_185915_l(); -+ return p_181088_0_.getBlockState(blockpos).isSideSolid(p_181088_0_, blockpos, p_181088_2_.getOpposite()); - } - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch deleted file mode 100644 index c6b8cd71c8..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockCactus.java -+++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java -@@ -18,7 +18,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockCactus extends Block -+public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable - { - public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); - protected static final AxisAlignedBB field_185593_b = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.9375D, 0.9375D); -@@ -110,8 +110,8 @@ - } - } - -- Block block = worldIn.getBlockState(pos.down()).getBlock(); -- return block == Blocks.cactus || block == Blocks.sand && !worldIn.getBlockState(pos.up()).func_185904_a().isLiquid(); -+ IBlockState state = worldIn.getBlockState(pos.down()); -+ return state.getBlock().canSustainPlant(state, worldIn, pos, EnumFacing.UP, this) && !worldIn.getBlockState(pos.up()).func_185904_a().isLiquid(); - } - - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) -@@ -135,6 +135,18 @@ - return ((Integer)state.getValue(AGE)).intValue(); - } - -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return net.minecraftforge.common.EnumPlantType.Desert; -+ } -+ -+ @Override -+ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return getDefaultState(); -+ } -+ - protected BlockStateContainer createBlockState() - { - return new BlockStateContainer(this, new IProperty[] {AGE}); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch deleted file mode 100644 index 80f84aa25f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockChest.java -+++ ../src-work/minecraft/net/minecraft/block/BlockChest.java -@@ -506,7 +506,7 @@ - - private boolean isBelowSolidBlock(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos.up()).func_185915_l(); -+ return worldIn.getBlockState(pos.up()).isSideSolid(worldIn, pos, EnumFacing.DOWN); - } - - private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch deleted file mode 100644 index b3bd5f03ef..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java -+++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java -@@ -131,6 +131,13 @@ - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -+ } -+ -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List dropped = super.getDrops(world, pos, state, fortune); - int i = ((Integer)state.getValue(AGE)).intValue(); - int j = 1; - -@@ -141,8 +148,9 @@ - - for (int k = 0; k < j; ++k) - { -- spawnAsEntity(worldIn, pos, new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage())); -+ dropped.add(new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage())); - } -+ return dropped; - } - - public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch deleted file mode 100644 index 07b5ee3046..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockCrops.java -+++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java -@@ -116,11 +116,11 @@ - float f1 = 0.0F; - IBlockState iblockstate = worldIn.getBlockState(blockpos.add(i, 0, j)); - -- if (iblockstate.getBlock() == Blocks.farmland) -+ if (iblockstate.getBlock().canSustainPlant(iblockstate, worldIn, blockpos.add(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)blockIn)) - { - f1 = 1.0F; - -- if (((Integer)iblockstate.getValue(BlockFarmland.MOISTURE)).intValue() > 0) -+ if (iblockstate.getBlock().isFertile(worldIn, blockpos.add(i, 0, j))) - { - f1 = 3.0F; - } -@@ -161,7 +161,8 @@ - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.func_185514_i(worldIn.getBlockState(pos.down())); -+ IBlockState soil = worldIn.getBlockState(pos.down()); -+ return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); - } - - protected Item getSeed() -@@ -174,11 +175,33 @@ - return Items.wheat; - } - -+ @Override -+ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = super.getDrops(world, pos, state, fortune); -+ int age = ((Integer)state.getValue(AGE)).intValue(); -+ Random rand = world instanceof World ? ((World)world).rand : new Random(); -+ -+ if (age >= 7) -+ { -+ int k = 3 + fortune; -+ -+ for (int i = 0; i < 3 + fortune; ++i) -+ { -+ if (rand.nextInt(15) <= age) -+ { -+ ret.add(new ItemStack(this.getSeed(), 1, 0)); -+ } -+ } -+ } -+ return ret; -+ } -+ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); - -- if (!worldIn.isRemote) -+ if (false && !worldIn.isRemote) // Forge: NOP all this. - { - int i = this.func_185527_x(state); - diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch deleted file mode 100644 index 6e163176ec..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockDeadBush.java -+++ ../src-work/minecraft/net/minecraft/block/BlockDeadBush.java -@@ -16,7 +16,7 @@ - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; - --public class BlockDeadBush extends BlockBush -+public class BlockDeadBush extends BlockBush implements net.minecraftforge.common.IShearable - { - protected static final AxisAlignedBB field_185516_a = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D); - -@@ -57,7 +57,7 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) - { -- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) -+ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) // Forge: Noop - { - player.triggerAchievement(StatList.func_188055_a(this)); - spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0)); -@@ -67,4 +67,11 @@ - super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_); - } - } -+ -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return java.util.Arrays.asList(new ItemStack(Blocks.deadbush)); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch deleted file mode 100644 index f0c530774e..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockDoor.java -+++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java -@@ -107,7 +107,7 @@ - { - if (this.blockMaterial == Material.iron) - { -- return true; -+ return false; //Allow items to interact with the door - } - else - { -@@ -219,7 +219,7 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return pos.getY() >= 255 ? false : worldIn.getBlockState(pos.down()).func_185896_q() && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); -+ return pos.getY() >= worldIn.getHeight() - 1 ? false : worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); - } - - public EnumPushReaction getMobilityFlag(IBlockState p_149656_1_) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch deleted file mode 100644 index f63ceb1764..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch +++ /dev/null @@ -1,90 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java -+++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java -@@ -25,7 +25,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockDoublePlant extends BlockBush implements IGrowable -+public class BlockDoublePlant extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable - { - public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockDoublePlant.EnumPlantType.class); - public static final PropertyEnum HALF = PropertyEnum.create("half", BlockDoublePlant.EnumBlockHalf.class); -@@ -88,6 +88,8 @@ - Block block = (Block)(flag ? this : worldIn.getBlockState(blockpos).getBlock()); - Block block1 = (Block)(flag ? worldIn.getBlockState(blockpos1).getBlock() : this); - -+ if (!flag) this.dropBlockAsItem(worldIn, pos, state, 0); //Forge move above the setting to air. -+ - if (block == this) - { - worldIn.setBlockState(blockpos, Blocks.air.getDefaultState(), 2); -@@ -96,17 +98,13 @@ - if (block1 == this) - { - worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3); -- -- if (!flag) -- { -- this.dropBlockAsItem(worldIn, blockpos1, state, 0); -- } - } - } - } - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -+ if (state.getBlock() != this) return super.canBlockStay(worldIn, pos, state); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. - if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) - { - return worldIn.getBlockState(pos.down()).getBlock() == this; -@@ -149,7 +147,6 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) - { -- if (worldIn.isRemote || p_180657_6_ == null || p_180657_6_.getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player)) - { - super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_); - } -@@ -212,8 +209,6 @@ - else - { - player.triggerAchievement(StatList.func_188055_a(this)); -- int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta(); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i)); - return true; - } - } -@@ -284,6 +279,33 @@ - return Block.EnumOffsetType.XZ; - } - -+ @Override -+ public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos) -+ { -+ IBlockState state = world.getBlockState(pos); -+ EnumPlantType type = (EnumPlantType)state.getValue(VARIANT); -+ return state.getValue(HALF) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS); -+ } -+ -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); -+ EnumPlantType type = (EnumPlantType)world.getBlockState(pos).getValue(VARIANT); -+ if (type == EnumPlantType.FERN) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.FERN.getMeta())); -+ if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.GRASS.getMeta())); -+ return ret; -+ } -+ -+ @Override -+ public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) -+ { -+ //Forge: Break both parts on the client to prevent the top part flickering as default type for a few frames. -+ if (state.getBlock() == this && state.getValue(HALF) == EnumBlockHalf.LOWER && world.getBlockState(pos.up()).getBlock() == this) -+ world.setBlockToAir(pos.up()); -+ return world.setBlockToAir(pos); -+ } -+ - public static enum EnumBlockHalf implements IStringSerializable - { - UPPER, diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDragonEgg.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDragonEgg.java.patch deleted file mode 100644 index 537d71b3f7..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDragonEgg.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockDragonEgg.java -+++ ../src-work/minecraft/net/minecraft/block/BlockDragonEgg.java -@@ -48,7 +48,7 @@ - - private void checkFall(World worldIn, BlockPos pos) - { -- if (BlockFalling.func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0) -+ if (worldIn.isAirBlock(pos.down()) && BlockFalling.func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0) - { - int i = 32; - -@@ -61,7 +61,7 @@ - worldIn.setBlockToAir(pos); - BlockPos blockpos; - -- for (blockpos = pos; BlockFalling.func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down()) -+ for (blockpos = pos; worldIn.isAirBlock(blockpos) && BlockFalling.func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down()) - { - ; - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDropper.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDropper.java.patch deleted file mode 100644 index 20608bde19..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDropper.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockDropper.java -+++ ../src-work/minecraft/net/minecraft/block/BlockDropper.java -@@ -43,7 +43,7 @@ - { - ItemStack itemstack = tileentitydispenser.getStackInSlot(i); - -- if (itemstack != null) -+ if (itemstack != null && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(worldIn, pos, tileentitydispenser, i, itemstack)) - { - EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING); - BlockPos blockpos = pos.offset(enumfacing); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch deleted file mode 100644 index 1df616bbac..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFalling.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java -@@ -44,7 +44,7 @@ - - private void checkFallable(World worldIn, BlockPos pos) - { -- if (func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0) -+ if (worldIn.isAirBlock(pos) && func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0) - { - int i = 32; - -@@ -62,7 +62,7 @@ - worldIn.setBlockToAir(pos); - BlockPos blockpos; - -- for (blockpos = pos.down(); func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down()) -+ for (blockpos = pos.down(); worldIn.isAirBlock(blockpos) && func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down()) - { - ; - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch deleted file mode 100644 index a41931a440..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java -@@ -87,7 +87,7 @@ - private boolean hasCrops(World worldIn, BlockPos pos) - { - Block block = worldIn.getBlockState(pos.up()).getBlock(); -- return block instanceof BlockCrops || block instanceof BlockStem; -+ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(worldIn.getBlockState(pos), worldIn, pos, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block); - } - - private boolean hasWater(World worldIn, BlockPos pos) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch deleted file mode 100644 index d8ce1b5fa7..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch +++ /dev/null @@ -1,209 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFire.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFire.java -@@ -37,7 +37,15 @@ - - public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) - { -- return !worldIn.getBlockState(pos.down()).func_185896_q() && !Blocks.fire.canCatchFire(worldIn, pos.down()) ? state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west()))).withProperty(UPPER, Boolean.valueOf(this.canCatchFire(worldIn, pos.up()))) : this.getDefaultState(); -+ if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) -+ { -+ return state.withProperty(NORTH, this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH)) -+ .withProperty(EAST, this.canCatchFire(worldIn, pos.east(), EnumFacing.WEST)) -+ .withProperty(SOUTH, this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH)) -+ .withProperty(WEST, this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST)) -+ .withProperty(UPPER, this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)); -+ } -+ return this.getDefaultState(); - } - - protected BlockFire() -@@ -90,6 +98,7 @@ - - public void setFireInfo(Block blockIn, int encouragement, int flammability) - { -+ if (blockIn == Blocks.air) throw new IllegalArgumentException("Tried to set air on fire... This is bad."); - this.encouragements.put(blockIn, Integer.valueOf(encouragement)); - this.flammabilities.put(blockIn, Integer.valueOf(flammability)); - } -@@ -129,13 +138,8 @@ - } - - Block block = worldIn.getBlockState(pos.down()).getBlock(); -- boolean flag = block == Blocks.netherrack; -+ boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP); - -- if (worldIn.provider instanceof WorldProviderEnd && block == Blocks.bedrock) -- { -- flag = true; -- } -- - int i = ((Integer)state.getValue(AGE)).intValue(); - - if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos) && rand.nextFloat() < 0.2F + (float)i * 0.03F) -@@ -156,7 +160,7 @@ - { - if (!this.canNeighborCatchFire(worldIn, pos)) - { -- if (!worldIn.getBlockState(pos.down()).func_185896_q() || i > 3) -+ if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) || i > 3) - { - worldIn.setBlockToAir(pos); - } -@@ -164,7 +168,7 @@ - return; - } - -- if (!this.canCatchFire(worldIn, pos.down()) && i == 15 && rand.nextInt(4) == 0) -+ if (!this.canCatchFire(worldIn, pos.down(), EnumFacing.UP) && i == 15 && rand.nextInt(4) == 0) - { - worldIn.setBlockToAir(pos); - return; -@@ -179,12 +183,12 @@ - j = -50; - } - -- this.catchOnFire(worldIn, pos.east(), 300 + j, rand, i); -- this.catchOnFire(worldIn, pos.west(), 300 + j, rand, i); -- this.catchOnFire(worldIn, pos.down(), 250 + j, rand, i); -- this.catchOnFire(worldIn, pos.up(), 250 + j, rand, i); -- this.catchOnFire(worldIn, pos.north(), 300 + j, rand, i); -- this.catchOnFire(worldIn, pos.south(), 300 + j, rand, i); -+ this.tryCatchFire(worldIn, pos.east(), 300 + j, rand, i, EnumFacing.WEST); -+ this.tryCatchFire(worldIn, pos.west(), 300 + j, rand, i, EnumFacing.EAST); -+ this.tryCatchFire(worldIn, pos.down(), 250 + j, rand, i, EnumFacing.UP); -+ this.tryCatchFire(worldIn, pos.up(), 250 + j, rand, i, EnumFacing.DOWN); -+ this.tryCatchFire(worldIn, pos.north(), 300 + j, rand, i, EnumFacing.SOUTH); -+ this.tryCatchFire(worldIn, pos.south(), 300 + j, rand, i, EnumFacing.NORTH); - - for (int k = -1; k <= 1; ++k) - { -@@ -243,22 +247,30 @@ - return false; - } - -+ @Deprecated // Use Block.getFlammability - public int getFlammability(Block blockIn) - { - Integer integer = (Integer)this.flammabilities.get(blockIn); - return integer == null ? 0 : integer.intValue(); - } - -+ @Deprecated // Use Block.getFlammability - public int getEncouragement(Block blockIn) - { - Integer integer = (Integer)this.encouragements.get(blockIn); - return integer == null ? 0 : integer.intValue(); - } - -+ @Deprecated // Use tryCatchFire with face below - private void catchOnFire(World worldIn, BlockPos pos, int chance, Random random, int age) - { -- int i = this.getFlammability(worldIn.getBlockState(pos).getBlock()); -+ this.tryCatchFire(worldIn, pos, chance, random, age, EnumFacing.UP); -+ } - -+ private void tryCatchFire(World worldIn, BlockPos pos, int chance, Random random, int age, EnumFacing face) -+ { -+ int i = worldIn.getBlockState(pos).getBlock().getFlammability(worldIn, pos, face); -+ - if (random.nextInt(chance) < i) - { - IBlockState iblockstate = worldIn.getBlockState(pos); -@@ -290,7 +302,7 @@ - { - for (EnumFacing enumfacing : EnumFacing.values()) - { -- if (this.canCatchFire(worldIn, pos.offset(enumfacing))) -+ if (this.canCatchFire(worldIn, pos.offset(enumfacing), enumfacing.getOpposite())) - { - return true; - } -@@ -311,7 +323,7 @@ - - for (EnumFacing enumfacing : EnumFacing.values()) - { -- i = Math.max(this.getEncouragement(worldIn.getBlockState(pos.offset(enumfacing)).getBlock()), i); -+ i = Math.max(worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getFlammability(worldIn, pos.offset(enumfacing), enumfacing.getOpposite()), i); - } - - return i; -@@ -323,9 +335,10 @@ - return false; - } - -+ @Deprecated // Use canCatchFire with face sensitive version below - public boolean canCatchFire(IBlockAccess worldIn, BlockPos pos) - { -- return this.getEncouragement(worldIn.getBlockState(pos).getBlock()) > 0; -+ return canCatchFire(worldIn, pos, EnumFacing.UP); - } - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) -@@ -364,9 +377,9 @@ - pos.func_184134_a((double)((float)state.getX() + 0.5F), (double)((float)state.getY() + 0.5F), (double)((float)state.getZ() + 0.5F), SoundEvents.field_187643_bs, SoundCategory.BLOCKS, 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false); - } - -- if (!pos.getBlockState(state.down()).func_185896_q() && !Blocks.fire.canCatchFire(pos, state.down())) -+ if (!pos.getBlockState(state.down()).isSideSolid(pos, state.down(), EnumFacing.UP) && !Blocks.fire.canCatchFire(pos, state.down(), EnumFacing.UP)) - { -- if (Blocks.fire.canCatchFire(pos, state.west())) -+ if (Blocks.fire.canCatchFire(pos, state.west(), EnumFacing.EAST)) - { - for (int j = 0; j < 2; ++j) - { -@@ -377,7 +390,7 @@ - } - } - -- if (Blocks.fire.canCatchFire(pos, state.east())) -+ if (Blocks.fire.canCatchFire(pos, state.east(), EnumFacing.WEST)) - { - for (int k = 0; k < 2; ++k) - { -@@ -388,7 +401,7 @@ - } - } - -- if (Blocks.fire.canCatchFire(pos, state.north())) -+ if (Blocks.fire.canCatchFire(pos, state.north(), EnumFacing.SOUTH)) - { - for (int l = 0; l < 2; ++l) - { -@@ -399,7 +412,7 @@ - } - } - -- if (Blocks.fire.canCatchFire(pos, state.south())) -+ if (Blocks.fire.canCatchFire(pos, state.south(), EnumFacing.NORTH)) - { - for (int i1 = 0; i1 < 2; ++i1) - { -@@ -410,7 +423,7 @@ - } - } - -- if (Blocks.fire.canCatchFire(pos, state.up())) -+ if (Blocks.fire.canCatchFire(pos, state.up(), EnumFacing.DOWN)) - { - for (int j1 = 0; j1 < 2; ++j1) - { -@@ -458,4 +471,19 @@ - { - return new BlockStateContainer(this, new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER}); - } -+ -+ /*================================= Forge Start ======================================*/ -+ /** -+ * Side sensitive version that calls the block function. -+ * -+ * @param world The current world -+ * @param pos Block position -+ * @param face The side the fire is coming from -+ * @return True if the face can catch fire. -+ */ -+ public boolean canCatchFire(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ return world.getBlockState(pos).getBlock().isFlammable(world, pos, face); -+ } -+ /*================================= Forge Start ======================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch deleted file mode 100644 index 0e6bf83a5b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java -@@ -148,13 +148,6 @@ - - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) - { -- TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); -- -- if (tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null) -- { -- spawnAsEntity(worldIn, pos, new ItemStack(tileentityflowerpot.getFlowerPotItem(), 1, tileentityflowerpot.getFlowerPotData())); -- } -- - super.breakBlock(worldIn, pos, state); - } - -@@ -374,6 +367,31 @@ - return BlockRenderLayer.CUTOUT; - } - -+ -+ /*============================FORGE START=====================================*/ -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = super.getDrops(world, pos, state, fortune); -+ TileEntityFlowerPot te = world.getTileEntity(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)world.getTileEntity(pos) : null; -+ if (te != null && te.getFlowerPotItem() != null) -+ ret.add(new ItemStack(te.getFlowerPotItem(), 1, te.getFlowerPotData())); -+ return ret; -+ } -+ @Override -+ public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) -+ { -+ if (willHarvest) return true; //If it will harvest, delay deletion of the block until after getDrops -+ return super.removedByPlayer(state, world, pos, player, willHarvest); -+ } -+ @Override -+ public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack tool) -+ { -+ super.harvestBlock(world, player, pos, state, te, tool); -+ world.setBlockToAir(pos); -+ } -+ /*===========================FORGE END==========================================*/ -+ - public static enum EnumFlowerType implements IStringSerializable - { - EMPTY("empty"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch deleted file mode 100644 index 6ead8373d9..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockGrass.java -+++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java -@@ -38,7 +38,7 @@ - { - if (!worldIn.isRemote) - { -- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).func_185891_c() > 2) -+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getLightOpacity(worldIn, pos.up()) > 2) - { - worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); - } -@@ -58,7 +58,7 @@ - IBlockState iblockstate = worldIn.getBlockState(blockpos.up()); - IBlockState iblockstate1 = worldIn.getBlockState(blockpos); - -- if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate.func_185891_c() <= 2) -+ if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate.getLightOpacity(worldIn, pos.up()) <= 2) - { - worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState()); - } -@@ -96,7 +96,7 @@ - { - if (j >= i / 16) - { -- if (worldIn.getBlockState(blockpos1).getBlock().blockMaterial == Material.air) -+ if (worldIn.isAirBlock(blockpos1)) - { - if (rand.nextInt(8) == 0) - { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch deleted file mode 100644 index 063f3fcbf9..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java -+++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java -@@ -221,6 +221,20 @@ - return new BlockStateContainer(this, new IProperty[] {VARIANT}); - } - -+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set>)state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("variant")) -+ { -+ world.setBlockState(pos, state.cycleProperty(prop)); -+ return true; -+ } -+ } -+ return false; -+ } -+ - public static enum EnumType implements IStringSerializable - { - NORTH_WEST(1, "north_west"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch deleted file mode 100644 index 4ecf2b559c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockIce.java -+++ ../src-work/minecraft/net/minecraft/block/BlockIce.java -@@ -40,14 +40,19 @@ - player.triggerAchievement(StatList.func_188055_a(this)); - player.addExhaustion(0.025F); - -- if (this.canSilkHarvest() && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0) -+ if (this.canSilkHarvest(worldIn, pos, state, player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0) - { -+ java.util.List items = new java.util.ArrayList(); - ItemStack itemstack = this.createStackedBlock(state); - - if (itemstack != null) - { -- spawnAsEntity(worldIn, pos, itemstack); -+ items.add(itemstack); - } -+ -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, 0, 1.0f, true, player); -+ for (ItemStack is : items) -+ spawnAsEntity(worldIn, pos, is); - } - else - { -@@ -58,7 +63,9 @@ - } - - int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185308_t, p_180657_6_); -+ harvesters.set(player); - this.dropBlockAsItem(worldIn, pos, state, i); -+ harvesters.set(null); - Material material = worldIn.getBlockState(pos.down()).func_185904_a(); - - if (material.blocksMovement() || material.isLiquid()) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch deleted file mode 100644 index ce3dc11ddd..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLadder.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java -@@ -61,7 +61,10 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos.west()).func_185915_l() ? true : (worldIn.getBlockState(pos.east()).func_185915_l() ? true : (worldIn.getBlockState(pos.north()).func_185915_l() ? true : worldIn.getBlockState(pos.south()).func_185915_l())); -+ return worldIn.getBlockState(pos.west()).isSideSolid(worldIn, pos.west(), EnumFacing.EAST) || -+ worldIn.getBlockState(pos.east()).isSideSolid(worldIn, pos.east(), EnumFacing.WEST) || -+ worldIn.getBlockState(pos.north()).isSideSolid(worldIn, pos.north(), EnumFacing.SOUTH) || -+ worldIn.getBlockState(pos.south()).isSideSolid(worldIn, pos.south(), EnumFacing.NORTH); - } - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) -@@ -99,7 +102,7 @@ - - protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing) - { -- return worldIn.getBlockState(pos.offset(facing.getOpposite())).func_185915_l(); -+ return worldIn.getBlockState(pos.offset(facing.getOpposite())).isSideSolid(worldIn, pos.offset(facing.getOpposite()), facing); - } - - public IBlockState getStateFromMeta(int meta) -@@ -139,4 +142,6 @@ - { - return new BlockStateContainer(this, new IProperty[] {FACING}); - } -+ -+ @Override public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch deleted file mode 100644 index 41697f0afa..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch +++ /dev/null @@ -1,127 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java -@@ -17,7 +17,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public abstract class BlockLeaves extends Block -+public abstract class BlockLeaves extends Block implements net.minecraftforge.common.IShearable - { - public static final PropertyBool DECAYABLE = PropertyBool.create("decayable"); - public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay"); -@@ -53,9 +53,9 @@ - BlockPos blockpos = pos.add(j1, k1, l1); - IBlockState iblockstate = worldIn.getBlockState(blockpos); - -- if (iblockstate.func_185904_a() == Material.leaves && !((Boolean)iblockstate.getValue(CHECK_DECAY)).booleanValue()) -+ if (iblockstate.getBlock().isLeaves(iblockstate, worldIn, blockpos)) - { -- worldIn.setBlockState(blockpos, iblockstate.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4); -+ iblockstate.getBlock().beginLeavesDecay(iblockstate, worldIn, blockpos); - } - } - } -@@ -96,9 +96,9 @@ - IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2)); - Block block = iblockstate.getBlock(); - -- if (block != Blocks.log && block != Blocks.log2) -+ if (!block.canSustainLeaves(iblockstate, worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2))) - { -- if (iblockstate.func_185904_a() == Material.leaves) -+ if (block.isLeaves(iblockstate, worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2))) - { - this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2; - } -@@ -205,40 +205,7 @@ - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- if (!worldIn.isRemote) -- { -- int i = this.getSaplingDropChance(state); -- -- if (fortune > 0) -- { -- i -= 2 << fortune; -- -- if (i < 10) -- { -- i = 10; -- } -- } -- -- if (worldIn.rand.nextInt(i) == 0) -- { -- Item item = this.getItemDropped(state, worldIn.rand, fortune); -- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); -- } -- -- i = 200; -- -- if (fortune > 0) -- { -- i -= 10 << fortune; -- -- if (i < 40) -- { -- i = 40; -- } -- } -- -- this.dropApple(worldIn, pos, state, i); -- } -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); - } - - protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) -@@ -274,6 +241,49 @@ - - public abstract BlockPlanks.EnumType getWoodType(int meta); - -+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } -+ @Override public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos){ return true; } -+ -+ @Override -+ public void beginLeavesDecay(IBlockState state, World world, BlockPos pos) -+ { -+ if (!(Boolean)state.getValue(CHECK_DECAY)) -+ { -+ world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4); -+ } -+ } -+ -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); -+ Random rand = world instanceof World ? ((World)world).rand : new Random(); -+ int chance = this.getSaplingDropChance(state); -+ -+ if (fortune > 0) -+ { -+ chance -= 2 << fortune; -+ if (chance < 10) chance = 10; -+ } -+ -+ if (rand.nextInt(chance) == 0) -+ ret.add(new ItemStack(getItemDropped(state, rand, fortune), 1, damageDropped(state))); -+ -+ chance = 200; -+ if (fortune > 0) -+ { -+ chance -= 10 << fortune; -+ if (chance < 40) chance = 40; -+ } -+ -+ this.captureDrops(true); -+ if (world instanceof World) -+ this.dropApple((World)world, pos, state, chance); // Dammet mojang -+ ret.addAll(this.captureDrops(false)); -+ return ret; -+ } -+ -+ - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockState worldIn, IBlockAccess pos, BlockPos side, EnumFacing p_176225_4_) - { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch deleted file mode 100644 index 66b146bb03..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLever.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLever.java -@@ -295,6 +295,12 @@ - return new BlockStateContainer(this, new IProperty[] {FACING, POWERED}); - } - -+ -+ private boolean canAttach(World world, BlockPos pos, EnumFacing side) -+ { -+ return world.isSideSolid(pos, side); -+ } -+ - public static enum EnumOrientation implements IStringSerializable - { - DOWN_X(0, "down_x", EnumFacing.DOWN), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch deleted file mode 100644 index 1476f20508..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLog.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLog.java -@@ -34,9 +34,9 @@ - { - IBlockState iblockstate = worldIn.getBlockState(blockpos); - -- if (iblockstate.func_185904_a() == Material.leaves && !((Boolean)iblockstate.getValue(BlockLeaves.CHECK_DECAY)).booleanValue()) -+ if (iblockstate.getBlock().isLeaves(iblockstate, worldIn, blockpos)) - { -- worldIn.setBlockState(blockpos, iblockstate.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4); -+ iblockstate.getBlock().beginLeavesDecay(iblockstate, worldIn, blockpos); - } - } - } -@@ -69,6 +69,9 @@ - } - } - -+ @Override public boolean canSustainLeaves(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } -+ @Override public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } -+ - public static enum EnumAxis implements IStringSerializable - { - X("x"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch deleted file mode 100644 index ecb65c7e07..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java -+++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java -@@ -39,10 +39,14 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -- int i = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15); -- this.dropXpOnBlockBreak(worldIn, pos, i); - } - -+ @Override -+ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); -+ } -+ - public boolean isOpaqueCube(IBlockState p_149662_1_) - { - return false; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch deleted file mode 100644 index ce3f419f53..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java -+++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java -@@ -78,7 +78,7 @@ - if (pos.getY() >= 0 && pos.getY() < 256) - { - IBlockState iblockstate = worldIn.getBlockState(pos.down()); -- return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.func_185514_i(iblockstate)); -+ return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate.getBlock().canSustainPlant(iblockstate, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this)); - } - else - { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch deleted file mode 100644 index 985648601b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java -+++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java -@@ -39,7 +39,7 @@ - { - if (!worldIn.isRemote) - { -- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).func_185891_c() > 2) -+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getLightOpacity(worldIn, pos.up()) > 2) - { - worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); - } -@@ -53,7 +53,7 @@ - IBlockState iblockstate = worldIn.getBlockState(blockpos); - IBlockState iblockstate1 = worldIn.getBlockState(blockpos.up()); - -- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate1.func_185891_c() <= 2) -+ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate1.getLightOpacity(worldIn, blockpos.up()) <= 2) - { - worldIn.setBlockState(blockpos, this.getDefaultState()); - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch deleted file mode 100644 index b266cf7bdc..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java -+++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java -@@ -42,7 +42,7 @@ - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return this.func_185514_i(worldIn.getBlockState(pos.down())); -+ return super.canBlockStay(worldIn, pos, state); - } - - public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) -@@ -58,9 +58,11 @@ - super.updateTick(worldIn, pos, state, rand); - } - -+ @SuppressWarnings("unused") - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- if (!worldIn.isRemote) -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -+ if (false && !worldIn.isRemote) - { - int i = 1; - -@@ -106,6 +108,26 @@ - return ((Integer)state.getValue(AGE)).intValue(); - } - -+ @Override -+ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); -+ Random rand = world instanceof World ? ((World)world).rand : new Random(); -+ int count = 1; -+ -+ if (((Integer)state.getValue(AGE)) >= 3) -+ { -+ count = 2 + rand.nextInt(3) + (fortune > 0 ? rand.nextInt(fortune + 1) : 0); -+ } -+ -+ for (int i = 0; i < count; i++) -+ { -+ ret.add(new ItemStack(Items.nether_wart)); -+ } -+ -+ return ret; -+ } -+ - protected BlockStateContainer createBlockState() - { - return new BlockStateContainer(this, new IProperty[] {AGE}); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch deleted file mode 100644 index d40cba379b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java -+++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java -@@ -98,7 +98,7 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) - { -- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) -+ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) //Forge: Noop this - { - player.triggerAchievement(StatList.func_188055_a(this)); - spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4)); -@@ -108,4 +108,10 @@ - super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_); - } - } -+ -+ @Override -+ public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return java.util.Arrays.asList(new ItemStack(this, 1, world.getBlockState(pos).getValue(VARIANT).getMetadata() - 4)); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch deleted file mode 100644 index ac733338cb..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockNote.java -+++ ../src-work/minecraft/net/minecraft/block/BlockNote.java -@@ -64,7 +64,9 @@ - if (tileentity instanceof TileEntityNote) - { - TileEntityNote tileentitynote = (TileEntityNote)tileentity; -+ int old = tileentitynote.note; - tileentitynote.changePitch(); -+ if (old == tileentitynote.note) return false; - tileentitynote.triggerNote(worldIn, pos); - playerIn.triggerAchievement(StatList.field_188087_U); - } -@@ -104,6 +106,10 @@ - - public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) - { -+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(worldIn, pos, state, eventParam, eventID); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false; -+ eventID = e.instrument.ordinal(); -+ eventParam = e.getVanillaNoteId(); - float f = (float)Math.pow(2.0D, (double)(eventParam - 12) / 12.0D); - worldIn.func_184133_a((EntityPlayer)null, pos, this.func_185576_e(eventID), SoundCategory.BLOCKS, 3.0F, f); - worldIn.spawnParticle(EnumParticleTypes.NOTE, (double)pos.getX() + 0.5D, (double)pos.getY() + 1.2D, (double)pos.getZ() + 0.5D, (double)eventParam / 24.0D, 0.0D, 0.0D, new int[0]); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch deleted file mode 100644 index 8cbcaa92ab..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java -+++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java -@@ -14,6 +14,7 @@ - import net.minecraft.stats.StatList; - import net.minecraft.tileentity.TileEntity; - 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; -@@ -103,11 +104,16 @@ - if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) - { - player.triggerAchievement(StatList.func_188055_a(this)); -- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata())); - } - else - { - super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_); - } - } -+ -+ @Override -+ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return java.util.Arrays.asList(new ItemStack(this, 1, world.getBlockState(pos).getValue(VARIANT).getMetadata())); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch deleted file mode 100644 index 7e269a4d5d..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockOre.java -+++ ../src-work/minecraft/net/minecraft/block/BlockOre.java -@@ -59,34 +59,39 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -- -- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) -+ } -+ @Override -+ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ Random rand = world instanceof World ? ((World)world).rand : new Random(); -+ if (this.getItemDropped(state, rand, fortune) != Item.getItemFromBlock(this)) - { - int i = 0; - - if (this == Blocks.coal_ore) - { -- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 0, 2); -+ i = MathHelper.getRandomIntegerInRange(rand, 0, 2); - } - else if (this == Blocks.diamond_ore) - { -- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); -+ i = MathHelper.getRandomIntegerInRange(rand, 3, 7); - } - else if (this == Blocks.emerald_ore) - { -- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); -+ i = MathHelper.getRandomIntegerInRange(rand, 3, 7); - } - else if (this == Blocks.lapis_ore) - { -- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); -+ i = MathHelper.getRandomIntegerInRange(rand, 2, 5); - } - else if (this == Blocks.quartz_ore) - { -- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); -+ i = MathHelper.getRandomIntegerInRange(rand, 2, 5); - } - -- this.dropXpOnBlockBreak(worldIn, pos, i); -+ return i; - } -+ return 0; - } - - public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch deleted file mode 100644 index aed4a64de4..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPane.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPane.java -@@ -105,7 +105,10 @@ - - public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) - { -- return state.withProperty(NORTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()))).withProperty(SOUTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()))).withProperty(WEST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()))).withProperty(EAST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()))); -+ return state.withProperty(NORTH, canPaneConnectTo(worldIn, pos, EnumFacing.NORTH)) -+ .withProperty(SOUTH, canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH)) -+ .withProperty(WEST, canPaneConnectTo(worldIn, pos, EnumFacing.WEST)) -+ .withProperty(EAST, canPaneConnectTo(worldIn, pos, EnumFacing.EAST)); - } - - public Item getItemDropped(IBlockState state, Random rand, int fortune) -@@ -182,4 +185,11 @@ - { - return new BlockStateContainer(this, new IProperty[] {NORTH, EAST, WEST, SOUTH}); - } -+ -+ public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir) -+ { -+ BlockPos off = pos.offset(dir); -+ IBlockState state = world.getBlockState(off); -+ return canPaneConnectToBlock(state.getBlock()) || state.isSideSolid(world, off, dir.getOpposite()); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch deleted file mode 100644 index 450fc64601..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java -@@ -235,7 +235,7 @@ - } - } - -- if (!flag1 && iblockstate.func_185904_a() != Material.air && func_185646_a(iblockstate, worldIn, blockpos, enumfacing.getOpposite(), false) && (iblockstate.func_185905_o() == EnumPushReaction.NORMAL || block == Blocks.piston || block == Blocks.sticky_piston)) -+ if (!flag1 && !iblockstate.getBlock().isAir(iblockstate, worldIn, blockpos) && func_185646_a(iblockstate, worldIn, blockpos, enumfacing.getOpposite(), false) && (iblockstate.func_185905_o() == EnumPushReaction.NORMAL || block == Blocks.piston || block == Blocks.sticky_piston)) - { - this.doMove(worldIn, pos, enumfacing, false); - } -@@ -320,7 +320,7 @@ - return false; - } - -- return !block.hasTileEntity(); -+ return !block.hasTileEntity(p_185646_0_); - } - else - { -@@ -366,7 +366,9 @@ - { - BlockPos blockpos1 = (BlockPos)list2.get(j); - IBlockState iblockstate = worldIn.getBlockState(blockpos1); -- iblockstate.getBlock().dropBlockAsItem(worldIn, blockpos1, iblockstate, 0); -+ // Forge: With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. -+ float chance = iblockstate.getBlock() instanceof BlockSnow ? -1.0f : 1.0f; -+ iblockstate.getBlock().dropBlockAsItemWithChance(worldIn, blockpos1, iblockstate, chance, 0); - worldIn.setBlockToAir(blockpos1); - --k; - aiblockstate[k] = iblockstate; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch deleted file mode 100644 index 38167e9bfd..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java -@@ -110,7 +110,7 @@ - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- if (!worldIn.isRemote) -+ if (false && !worldIn.isRemote) // Forge: Noop this out - { - TileEntityPiston tileentitypiston = this.func_185589_c(worldIn, pos); - -@@ -120,6 +120,7 @@ - iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0); - } - } -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); - } - - public RayTraceResult collisionRayTrace(IBlockState worldIn, World pos, BlockPos start, Vec3d end, Vec3d p_180636_5_) -@@ -190,4 +191,16 @@ - { - return new BlockStateContainer(this, new IProperty[] {FACING, TYPE}); - } -+ -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ TileEntityPiston tileentitypiston = this.func_185589_c(world, pos); -+ if (tileentitypiston != null) -+ { -+ IBlockState pushed = tileentitypiston.getPistonState(); -+ return pushed.getBlock().getDrops(world, pos, pushed, fortune); -+ } -+ return new java.util.ArrayList(); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch deleted file mode 100644 index adc939ebab..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPotato.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java -@@ -27,7 +27,7 @@ - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); - -- if (!worldIn.isRemote) -+ if (false && !worldIn.isRemote) //Forge: Moved to getDrops - { - if (this.func_185525_y(state) && worldIn.rand.nextInt(50) == 0) - { -@@ -40,4 +40,13 @@ - { - return field_185534_a[((Integer)p_185496_1_.getValue(this.func_185524_e())).intValue()]; - } -+ -+ @Override -+ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = super.getDrops(world, pos, state, fortune); -+ if (this.func_185525_y(state) && RANDOM.nextInt(50) == 0) -+ ret.add(new ItemStack(Items.poisonous_potato)); -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch deleted file mode 100644 index 06903e2d89..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java -@@ -117,7 +117,7 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && worldIn.getBlockState(pos.down()).func_185896_q(); -+ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos, EnumFacing.UP); - } - - public IBlockState func_185499_a(IBlockState p_185499_1_, Rotation p_185499_2_) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch deleted file mode 100644 index ba67d27d57..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockQuartz.java -+++ ../src-work/minecraft/net/minecraft/block/BlockQuartz.java -@@ -113,6 +113,26 @@ - return new BlockStateContainer(this, new IProperty[] {VARIANT}); - } - -+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("variant") && prop.getValueClass() == EnumType.class) -+ { -+ EnumType current = (EnumType)state.getValue(prop); -+ EnumType next = current == EnumType.LINES_X ? EnumType.LINES_Y : -+ current == EnumType.LINES_Y ? EnumType.LINES_Z : -+ current == EnumType.LINES_Z ? EnumType.LINES_X : current; -+ if (next == current) -+ return false; -+ world.setBlockState(pos, state.withProperty(prop, next)); -+ return true; -+ } -+ } -+ return false; -+ } -+ - public static enum EnumType implements IStringSerializable - { - DEFAULT(0, "default", "default"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch deleted file mode 100644 index bc05960c5c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch +++ /dev/null @@ -1,186 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRailBase.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRailBase.java -@@ -32,7 +32,7 @@ - public static boolean isRailBlock(IBlockState state) - { - Block block = state.getBlock(); -- return block == Blocks.rail || block == Blocks.golden_rail || block == Blocks.detector_rail || block == Blocks.activator_rail; -+ return block instanceof BlockRailBase; - } - - protected BlockRailBase(boolean isPowered) -@@ -65,7 +65,7 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos.down()).func_185896_q(); -+ return worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos, EnumFacing.UP); - } - - public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) -@@ -88,24 +88,24 @@ - BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(this.getShapeProperty()); - boolean flag = false; - -- if (!worldIn.getBlockState(pos.down()).func_185896_q()) -+ if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP)) - { - flag = true; - } - -- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !worldIn.getBlockState(pos.east()).func_185896_q()) -+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !worldIn.getBlockState(pos.east()).isSideSolid(worldIn, pos.east(), EnumFacing.UP)) - { - flag = true; - } -- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !worldIn.getBlockState(pos.west()).func_185896_q()) -+ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !worldIn.getBlockState(pos.west()).isSideSolid(worldIn, pos.west(), EnumFacing.UP)) - { - flag = true; - } -- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !worldIn.getBlockState(pos.north()).func_185896_q()) -+ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !worldIn.getBlockState(pos.north()).isSideSolid(worldIn, pos.north(), EnumFacing.UP)) - { - flag = true; - } -- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !worldIn.getBlockState(pos.south()).func_185896_q()) -+ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !worldIn.getBlockState(pos.south()).isSideSolid(worldIn, pos.south(), EnumFacing.UP)) - { - flag = true; - } -@@ -160,6 +160,81 @@ - - public abstract IProperty getShapeProperty(); - -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * Return true if the rail can make corners. -+ * Used by placement logic. -+ * @param world The world. -+ * @param pod Block's position in world -+ * @return True if the rail can make corners. -+ */ -+ public boolean isFlexibleRail(IBlockAccess world, BlockPos pos) -+ { -+ return !this.isPowered; -+ } -+ -+ /** -+ * Returns true if the rail can make up and down slopes. -+ * Used by placement logic. -+ * @param world The world. -+ * @param pod Block's position in world -+ * @return True if the rail can make slopes. -+ */ -+ public boolean canMakeSlopes(IBlockAccess world, BlockPos pos) -+ { -+ return true; -+ } -+ -+ /** -+ * Returns the max speed of the rail at the specified position. -+ * @param world The world. -+ * @param cart The cart on the rail, may be null. -+ * @param pod Block's position in world -+ * @return The max speed of the current rail. -+ */ -+ public float getRailMaxSpeed(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos) -+ { -+ return 0.4f; -+ } -+ -+ /** -+ * This function is called by any minecart that passes over this rail. -+ * It is called once per update tick that the minecart is on the rail. -+ * @param world The world. -+ * @param cart The cart on the rail. -+ * @param pod Block's position in world -+ */ -+ public void onMinecartPass(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos) -+ { -+ } -+ -+ /** -+ * Rotate the block. For vanilla blocks this rotates around the axis passed in (generally, it should be the "face" that was hit). -+ * Note: for mod blocks, this is up to the block and modder to decide. It is not mandated that it be a rotation around the -+ * face, but could be a rotation to orient *to* that face, or a visiting of possible rotations. -+ * The method should return true if the rotation was successful though. -+ * -+ * @param world The world -+ * @param pos Block position in world -+ * @param axis The axis to rotate around -+ * @return True if the rotation was successful, False if the rotation failed, or is not possible -+ */ -+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("shape")) -+ { -+ world.setBlockState(pos, state.cycleProperty(prop)); -+ return true; -+ } -+ } -+ return false; -+ } -+ -+ /* ======================================== FORGE END =====================================*/ -+ - public static enum EnumRailDirection implements IStringSerializable - { - NORTH_SOUTH(0, "north_south"), -@@ -230,6 +305,7 @@ - private IBlockState state; - private final boolean isPowered; - private final List field_150657_g = Lists.newArrayList(); -+ private final boolean canMakeSlopes; - - public Rail(World worldIn, BlockPos pos, IBlockState state) - { -@@ -238,7 +314,8 @@ - this.state = state; - this.block = (BlockRailBase)state.getBlock(); - BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(this.block.getShapeProperty()); -- this.isPowered = this.block.isPowered; -+ this.isPowered = !this.block.isFlexibleRail(worldIn, pos); -+ this.canMakeSlopes = this.block.canMakeSlopes(worldIn, pos); - this.func_180360_a(blockrailbase$enumraildirection); - } - -@@ -429,7 +506,7 @@ - } - } - -- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) -+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) - { - if (BlockRailBase.isRailBlock(this.world, blockpos.up())) - { -@@ -442,7 +519,7 @@ - } - } - -- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) -+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) - { - if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) - { -@@ -585,7 +662,7 @@ - } - } - -- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) -+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) - { - if (BlockRailBase.isRailBlock(this.world, blockpos.up())) - { -@@ -598,7 +675,7 @@ - } - } - -- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) -+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) - { - if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) - { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch deleted file mode 100644 index 68cb203840..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java -@@ -310,6 +310,21 @@ - return this.getDefaultState().withProperty(field_185512_D, placer.getHorizontalFacing().getOpposite()).withProperty(POWERED, Boolean.valueOf(false)).withProperty(MODE, BlockRedstoneComparator.Mode.COMPARE); - } - -+ @Override -+ public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) -+ { -+ if (pos.getY() == neighbor.getY() && world instanceof World) -+ { -+ onNeighborBlockChange((World)world, pos, world.getBlockState(pos), world.getBlockState(neighbor).getBlock()); -+ } -+ } -+ -+ @Override -+ public boolean getWeakChanges(IBlockAccess world, BlockPos pos) -+ { -+ return true; -+ } -+ - public static enum Mode implements IStringSerializable - { - COMPARE("compare"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch deleted file mode 100644 index 0b5a254905..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java -@@ -204,6 +204,8 @@ - { - EnumFacing enumfacing = (EnumFacing)state.getValue(field_185512_D); - BlockPos blockpos = pos.offset(enumfacing.getOpposite()); -+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldIn, pos, worldIn.getBlockState(pos), java.util.EnumSet.of(enumfacing.getOpposite())).isCanceled()) -+ return; - worldIn.notifyBlockOfStateChange(blockpos, this); - worldIn.notifyNeighborsOfStateExcept(blockpos, this, enumfacing); - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch deleted file mode 100644 index 7ef87d176d..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java -@@ -92,12 +92,16 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -+ } - -- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) -+ @Override -+ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ if (this.getItemDropped(state, RANDOM, fortune) != Item.getItemFromBlock(this)) - { -- int i = 1 + worldIn.rand.nextInt(5); -- this.dropXpOnBlockBreak(worldIn, pos, i); -+ return 1 + RANDOM.nextInt(5); - } -+ return 0; - } - - @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch deleted file mode 100644 index 0862f370aa..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java -@@ -97,15 +97,15 @@ - BlockPos blockpos = pos.offset(direction); - IBlockState iblockstate = worldIn.getBlockState(pos.offset(direction)); - -- if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (iblockstate.func_185915_l() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down())))) -+ if (!canConnectTo(worldIn.getBlockState(blockpos), direction, worldIn, blockpos) && (iblockstate.func_185915_l() || !canConnectUpwardsTo(worldIn, blockpos.down()))) - { - IBlockState iblockstate1 = worldIn.getBlockState(pos.up()); - - if (!iblockstate1.func_185915_l()) - { -- boolean flag = worldIn.getBlockState(blockpos).func_185896_q() || worldIn.getBlockState(blockpos).getBlock() == Blocks.glowstone; -+ boolean flag = worldIn.getBlockState(blockpos).isSideSolid(worldIn, blockpos, EnumFacing.UP) || worldIn.getBlockState(blockpos).getBlock() == Blocks.glowstone; - -- if (flag && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up()))) -+ if (flag && canConnectUpwardsTo(worldIn, blockpos.up())) - { - if (iblockstate.func_185898_k()) - { -@@ -406,21 +406,16 @@ - IBlockState iblockstate = worldIn.getBlockState(blockpos); - boolean flag = iblockstate.func_185915_l(); - boolean flag1 = worldIn.getBlockState(pos.up()).func_185915_l(); -- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (iblockstate.getBlock() == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.field_185512_D) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down()))); -+ return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side, worldIn, pos) ? true : (iblockstate.getBlock() == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.field_185512_D) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down()))); - } - - protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos) - { -- return canConnectUpwardsTo(worldIn.getBlockState(pos)); -+ return canConnectTo(worldIn.getBlockState(pos), null, worldIn, pos); - } - -- protected static boolean canConnectUpwardsTo(IBlockState state) -+ protected static boolean canConnectTo(IBlockState blockState, EnumFacing side, IBlockAccess world, BlockPos pos) - { -- return canConnectTo(state, (EnumFacing)null); -- } -- -- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) -- { - Block block = blockState.getBlock(); - - if (block == Blocks.redstone_wire) -@@ -434,7 +429,7 @@ - } - else - { -- return blockState.func_185897_m() && side != null; -+ return blockState.getBlock().canConnectRedstone(blockState, world, pos, side); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch deleted file mode 100644 index 904112b90c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockReed.java -+++ ../src-work/minecraft/net/minecraft/block/BlockReed.java -@@ -19,7 +19,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockReed extends Block -+public class BlockReed extends Block implements net.minecraftforge.common.IPlantable - { - public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); - protected static final AxisAlignedBB field_185701_b = new AxisAlignedBB(0.125D, 0.0D, 0.125D, 0.875D, 1.0D, 0.875D); -@@ -69,7 +69,9 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- Block block = worldIn.getBlockState(pos.down()).getBlock(); -+ IBlockState state = worldIn.getBlockState(pos.down()); -+ Block block = state.getBlock(); -+ if (block.canSustainPlant(state, worldIn, pos.down(), EnumFacing.UP, this)) return true; - - if (block == this) - { -@@ -162,6 +164,17 @@ - return ((Integer)state.getValue(AGE)).intValue(); - } - -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) -+ { -+ return net.minecraftforge.common.EnumPlantType.Beach; -+ } -+ @Override -+ public IBlockState getPlant(IBlockAccess world, BlockPos pos) -+ { -+ return this.getDefaultState(); -+ } -+ - protected BlockStateContainer createBlockState() - { - return new BlockStateContainer(this, new IProperty[] {AGE}); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch deleted file mode 100644 index 75bcd35ce3..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRotatedPillar.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRotatedPillar.java -@@ -28,6 +28,21 @@ - super(p_i46385_1_, p_i46385_2_); - } - -+ @Override -+ public boolean rotateBlock(net.minecraft.world.World world, BlockPos pos, EnumFacing axis) -+ { -+ net.minecraft.block.state.IBlockState state = world.getBlockState(pos); -+ for (net.minecraft.block.properties.IProperty prop : state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("axis")) -+ { -+ world.setBlockState(pos, state.cycleProperty(prop)); -+ return true; -+ } -+ } -+ return false; -+ } -+ - public IBlockState func_185499_a(IBlockState p_185499_1_, Rotation p_185499_2_) - { - switch (p_185499_2_) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch deleted file mode 100644 index 559b05cb5c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockSapling.java -+++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java -@@ -77,6 +77,7 @@ - - public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand) - { -+ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) return; - WorldGenerator worldgenerator = (WorldGenerator)(rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true)); - int i = 0; - int j = 0; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch deleted file mode 100644 index 9aeff23d66..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockSkull.java -+++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java -@@ -116,10 +116,6 @@ - return new ItemStack(Items.skull, 1, i); - } - -- public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) -- { -- } -- - public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) - { - if (player.capabilities.isCreativeMode) -@@ -127,13 +123,18 @@ - state = state.withProperty(NODROP, Boolean.valueOf(true)); - worldIn.setBlockState(pos, state, 4); - } -+ this.dropBlockAsItem(worldIn, pos, state, 0); - - super.onBlockHarvested(worldIn, pos, state, player); - } - - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) - { -- if (!worldIn.isRemote) -+ super.breakBlock(worldIn, pos, state); -+ } -+ public java.util.List getDrops(IBlockAccess worldIn, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); - { - if (!((Boolean)state.getValue(NODROP)).booleanValue()) - { -@@ -142,7 +143,7 @@ - if (tileentity instanceof TileEntitySkull) - { - TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; -- ItemStack itemstack = this.func_185473_a(worldIn, pos, state); -+ ItemStack itemstack = new ItemStack(Items.skull, 1, tileentityskull.getSkullType()); - - if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null) - { -@@ -152,12 +153,11 @@ - itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound); - } - -- spawnAsEntity(worldIn, pos, itemstack); -+ ret.add(itemstack); - } - } -- -- super.breakBlock(worldIn, pos, state); - } -+ return ret; - } - - public Item getItemDropped(IBlockState state, Random rand, int fortune) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch deleted file mode 100644 index 3091b3bbe9..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockSlab.java -+++ ../src-work/minecraft/net/minecraft/block/BlockSlab.java -@@ -50,6 +50,17 @@ - return this.isDouble(); - } - -+ @Override -+ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ if ( state.func_185914_p() ) -+ return true; -+ -+ // face is on the block being rendered, not this block. -+ EnumBlockHalf side = world.getBlockState(pos).getValue(HALF); -+ return (side == EnumBlockHalf.TOP && face == EnumFacing.DOWN) || (side == EnumBlockHalf.BOTTOM && face == EnumFacing.UP); -+ } -+ - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) - { - IBlockState iblockstate = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM); -@@ -77,13 +88,14 @@ - { - return false; - } -- else -+ else if (false) // Forge: Additional logic breaks doesSideBlockRendering and is no longer useful. - { - IBlockState iblockstate = pos.getBlockState(side.offset(p_176225_4_)); - boolean flag = func_185675_i(iblockstate) && iblockstate.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP; - boolean flag1 = func_185675_i(worldIn) && worldIn.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP; - return flag1 ? (p_176225_4_ == EnumFacing.DOWN ? true : (p_176225_4_ == EnumFacing.UP && super.shouldSideBeRendered(worldIn, pos, side, p_176225_4_) ? true : !func_185675_i(iblockstate) || !flag)) : (p_176225_4_ == EnumFacing.UP ? true : (p_176225_4_ == EnumFacing.DOWN && super.shouldSideBeRendered(worldIn, pos, side, p_176225_4_) ? true : !func_185675_i(iblockstate) || flag)); - } -+ return super.shouldSideBeRendered(worldIn, pos, side, p_176225_4_); - } - - @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch deleted file mode 100644 index c8f2925fef..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockSnow.java -+++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java -@@ -73,7 +73,7 @@ - { - IBlockState iblockstate = worldIn.getBlockState(pos.down()); - Block block = iblockstate.getBlock(); -- return block != Blocks.ice && block != Blocks.packed_ice ? (iblockstate.func_185904_a() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : iblockstate.func_185914_p() && iblockstate.func_185904_a().blocksMovement())) : false; -+ return block != Blocks.ice && block != Blocks.packed_ice ? (iblockstate.getBlock().isLeaves(iblockstate, worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : iblockstate.func_185914_p() && iblockstate.func_185904_a().blocksMovement())) : false; - } - - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) -@@ -85,7 +85,6 @@ - { - if (!this.canPlaceBlockAt(worldIn, pos)) - { -- this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); - return false; - } -@@ -97,9 +96,8 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) - { -- spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0)); -+ super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_); - worldIn.setBlockToAir(pos); -- player.triggerAchievement(StatList.func_188055_a(this)); - } - - public Item getItemDropped(IBlockState state, Random rand, int fortune) -@@ -109,14 +107,13 @@ - - public int quantityDropped(Random random) - { -- return 0; -+ return 1; - } - - public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) - { - if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11) - { -- this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0); - worldIn.setBlockToAir(pos); - } - } -@@ -150,6 +147,8 @@ - return ((Integer)state.getValue(LAYERS)).intValue() - 1; - } - -+ @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.getValue(LAYERS)) + 1; } -+ - protected BlockStateContainer createBlockState() - { - return new BlockStateContainer(this, new IProperty[] {LAYERS}); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch deleted file mode 100644 index be4923a137..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockStairs.java -+++ ../src-work/minecraft/net/minecraft/block/BlockStairs.java -@@ -443,6 +443,19 @@ - return new BlockStateContainer(this, new IProperty[] {FACING, HALF, SHAPE}); - } - -+ @Override -+ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ if ( state.func_185914_p() ) -+ return true; -+ -+ // face is on the block being rendered, not this block. -+ IBlockState iblockstate = world.getBlockState(pos); -+ EnumHalf half = iblockstate.getValue(HALF); -+ EnumFacing side = iblockstate.getValue(FACING); -+ return side == face.getOpposite() || (half == EnumHalf.TOP && face == EnumFacing.DOWN) || (half == EnumHalf.BOTTOM && face == EnumFacing.UP); -+ } -+ - public static enum EnumHalf implements IStringSerializable - { - TOP("top"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockStaticLiquid.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockStaticLiquid.java.patch deleted file mode 100644 index bbc3288ce5..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockStaticLiquid.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockStaticLiquid.java -+++ ../src-work/minecraft/net/minecraft/block/BlockStaticLiquid.java -@@ -52,7 +52,7 @@ - { - blockpos = blockpos.add(rand.nextInt(3) - 1, 1, rand.nextInt(3) - 1); - -- if (blockpos.getY() >= 0 && blockpos.getY() < 256 && !worldIn.isBlockLoaded(blockpos)) -+ if (blockpos.getY() >= 0 && blockpos.getY() < worldIn.getHeight() && !worldIn.isBlockLoaded(blockpos)) - { - return; - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch deleted file mode 100644 index 66121bb000..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockStem.java -+++ ../src-work/minecraft/net/minecraft/block/BlockStem.java -@@ -89,9 +89,10 @@ - } - - pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand)); -- Block block = worldIn.getBlockState(pos.down()).getBlock(); -+ IBlockState soil = worldIn.getBlockState(pos.down()); -+ Block block = soil.getBlock(); - -- if (worldIn.getBlockState(pos).getBlock().blockMaterial == Material.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass)) -+ if (worldIn.isAirBlock(pos) && (block.canSustainPlant(soil, worldIn, pos.down(), EnumFacing.UP, this) || block == Blocks.dirt || block == Blocks.grass)) - { - worldIn.setBlockState(pos, this.crop.getDefaultState()); - } -@@ -109,8 +110,12 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -+ } - -- if (!worldIn.isRemote) -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); - { - Item item = this.getSeedItem(); - -@@ -120,13 +125,14 @@ - - for (int j = 0; j < 3; ++j) - { -- if (worldIn.rand.nextInt(15) <= i) -+ if (RANDOM.nextInt(15) <= i) - { -- spawnAsEntity(worldIn, pos, new ItemStack(item)); -+ ret.add(new ItemStack(item)); - } - } - } - } -+ return ret; - } - - protected Item getSeedItem() diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch deleted file mode 100644 index 3698569fb0..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTallGrass.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTallGrass.java -@@ -23,7 +23,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockTallGrass extends BlockBush implements IGrowable -+public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable - { - public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockTallGrass.EnumType.class); - protected static final AxisAlignedBB field_185522_c = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D); -@@ -41,7 +41,7 @@ - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return this.func_185514_i(worldIn.getBlockState(pos.down())); -+ return super.canBlockStay(worldIn, pos, state); - } - - public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) -@@ -51,7 +51,7 @@ - - public Item getItemDropped(IBlockState state, Random rand, int fortune) - { -- return rand.nextInt(8) == 0 ? Items.wheat_seeds : null; -+ return null; - } - - public int quantityDroppedWithBonus(int fortune, Random random) -@@ -61,7 +61,7 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) - { -- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) -+ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) // Forge: Noop Taken care of by IShearable - { - player.triggerAchievement(StatList.func_188055_a(this)); - spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta())); -@@ -181,4 +181,22 @@ - } - } - } -+ -+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } -+ @Override -+ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) -+ { -+ List ret = new java.util.ArrayList(); -+ ret.add(new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)world.getBlockState(pos).getValue(TYPE)).getMeta())); -+ return ret; -+ } -+ @Override -+ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ List ret = new java.util.ArrayList(); -+ if (RANDOM.nextInt(8) != 0) return ret; -+ ItemStack seed = net.minecraftforge.common.ForgeHooks.getGrassSeed(RANDOM); -+ if (seed != null) ret.add(seed); -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch deleted file mode 100644 index 44dde77555..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTorch.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java -@@ -79,14 +79,14 @@ - - private boolean canPlaceOn(World worldIn, BlockPos pos) - { -- if (worldIn.getBlockState(pos).func_185896_q()) -+ IBlockState state = worldIn.getBlockState(pos); -+ if (state.isSideSolid(worldIn, pos, EnumFacing.UP)) - { - return true; - } - else - { -- Block block = worldIn.getBlockState(pos).getBlock(); -- return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block == Blocks.stained_glass; -+ return state.getBlock().canPlaceTorchOnTop(state, worldIn, pos); - } - } - -@@ -107,7 +107,7 @@ - { - BlockPos blockpos = pos.offset(facing.getOpposite()); - boolean flag = facing.getAxis().isHorizontal(); -- return flag && worldIn.isBlockNormalCube(blockpos, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos); -+ return flag && worldIn.isSideSolid(blockpos, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos); - } - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) -@@ -120,7 +120,7 @@ - { - for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) - { -- if (worldIn.isBlockNormalCube(pos.offset(enumfacing.getOpposite()), true)) -+ if (worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) - { - return this.getDefaultState().withProperty(FACING, enumfacing); - } -@@ -153,7 +153,7 @@ - EnumFacing enumfacing1 = enumfacing.getOpposite(); - boolean flag = false; - -- if (enumfacing$axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true)) -+ if (enumfacing$axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing, true)) - { - flag = true; - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch deleted file mode 100644 index e2af917e9c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java -@@ -241,6 +241,18 @@ - return new BlockStateContainer(this, new IProperty[] {FACING, OPEN, HALF}); - } - -+ @Override -+ public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) -+ { -+ if (state.getValue(OPEN)) -+ { -+ IBlockState down = world.getBlockState(pos.down()); -+ if (down.getBlock() == net.minecraft.init.Blocks.ladder) -+ return down.getValue(BlockLadder.FACING) == state.getValue(FACING); -+ } -+ return false; -+ } -+ - public static enum DoorHalf implements IStringSerializable - { - TOP("top"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch deleted file mode 100644 index 8f71d8c096..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java -@@ -77,14 +77,14 @@ - - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) - { -- return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).func_185915_l(); -+ return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).isSideSolid(worldIn, pos.offset(side.getOpposite()), side); - } - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { - for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) - { -- if (worldIn.getBlockState(pos.offset(enumfacing)).func_185915_l()) -+ if (worldIn.getBlockState(pos.offset(enumfacing)).isSideSolid(worldIn, pos.offset(enumfacing), enumfacing.getOpposite())) - { - return true; - } -@@ -118,7 +118,7 @@ - { - EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); - -- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).func_185915_l()) -+ if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).isSideSolid(worldIn, pos.offset(enumfacing.getOpposite()), enumfacing)) - { - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch deleted file mode 100644 index d2eff4f1ea..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockVine.java -+++ ../src-work/minecraft/net/minecraft/block/BlockVine.java -@@ -26,7 +26,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockVine extends Block -+public class BlockVine extends Block implements net.minecraftforge.common.IShearable - { - public static final PropertyBool UP = PropertyBool.create("up"); - public static final PropertyBool NORTH = PropertyBool.create("north"); -@@ -342,7 +342,7 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) - { -- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) -+ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) // Forge: Noop, Covered by IShearable - { - player.triggerAchievement(StatList.func_188055_a(this)); - spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0)); -@@ -457,4 +457,14 @@ - - return i; - } -+ /*************************FORGE START***********************************/ -+ @Override public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity){ return true; } -+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } -+ @Override -+ public java.util.List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return java.util.Arrays.asList(new ItemStack(this, 1)); -+ } -+ /*************************FORGE END***********************************/ -+ - } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch deleted file mode 100644 index a847006055..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java -+++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java -@@ -80,7 +80,7 @@ - IBlockState iblockstate = this.world.getBlockState(origin); - Block block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() == Material.air) -+ if (iblockstate.getBlock().isAir(iblockstate, this.world, origin)) - { - return true; - } -@@ -112,7 +112,7 @@ - iblockstate = this.world.getBlockState(blockpos); - block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() == Material.air || !BlockPistonBase.func_185646_a(iblockstate, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) -+ if (iblockstate.getBlock().isAir(iblockstate, this.world, blockpos) || !BlockPistonBase.func_185646_a(iblockstate, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) - { - break; - } -@@ -159,7 +159,7 @@ - - iblockstate = this.world.getBlockState(blockpos1); - -- if (iblockstate.func_185904_a() == Material.air) -+ if (iblockstate.getBlock().isAir(iblockstate, this.world, blockpos1)) - { - return true; - } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch deleted file mode 100644 index e6d4fff7f3..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/state/BlockStateBase.java -+++ ../src-work/minecraft/net/minecraft/block/state/BlockStateBase.java -@@ -71,4 +71,9 @@ - - return stringbuilder.toString(); - } -+ -+ public com.google.common.collect.ImmutableTable, Comparable, IBlockState> getPropertyValueTable() -+ { -+ return null; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch deleted file mode 100644 index 3342a4b24e..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/state/BlockStateContainer.java -+++ ../src-work/minecraft/net/minecraft/block/state/BlockStateContainer.java -@@ -55,6 +55,16 @@ - - public BlockStateContainer(Block blockIn, IProperty... properties) - { -+ this(blockIn, properties, null); -+ } -+ -+ protected StateImplementation createState(Block block, ImmutableMap, Comparable> properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) -+ { -+ return new StateImplementation(block, properties); -+ } -+ -+ protected BlockStateContainer(Block blockIn, IProperty[] properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) -+ { - this.block = blockIn; - Map < String, IProperty> map = Maps. < String, IProperty> newHashMap(); - -@@ -71,7 +81,7 @@ - for (List < Comparable> list : Cartesian.cartesianProduct(this.getAllowedValues())) - { - Map < IProperty, Comparable> map1 = MapPopulator. < IProperty, Comparable> createMap(this.properties.values(), list); -- BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation = new BlockStateContainer.StateImplementation(blockIn, ImmutableMap.copyOf(map1)); -+ BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map1), unlistedProperties); - map2.put(map1, blockstatecontainer$stateimplementation); - list1.add(blockstatecontainer$stateimplementation); - } -@@ -163,6 +173,13 @@ - this.properties = propertiesIn; - } - -+ protected StateImplementation(Block blockIn, ImmutableMap, Comparable> propertiesIn, ImmutableTable, Comparable, IBlockState> propertyValueTable) -+ { -+ this.block = blockIn; -+ this.properties = propertiesIn; -+ this.propertyValueTable = propertyValueTable; -+ } -+ - public Collection < IProperty> getPropertyNames() - { - return Collections. < IProperty> unmodifiableCollection(this.properties.keySet()); -@@ -414,5 +431,34 @@ - { - return this.block.func_185481_k(this); - } -+ -+ //Forge Start -+ public ImmutableTable, Comparable, IBlockState> getPropertyValueTable() -+ { -+ return propertyValueTable; -+ } -+ -+ @Override -+ public int getLightOpacity(IBlockAccess world, BlockPos pos) -+ { -+ return this.block.getLightOpacity(this, world, pos); -+ } -+ -+ @Override -+ public int getLightValue(IBlockAccess world, BlockPos pos) -+ { -+ return this.block.getLightValue(this, world, pos); -+ } -+ -+ public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) -+ { -+ return this.block.isSideSolid(this, world, pos, side); -+ } -+ -+ @Override -+ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing side) -+ { -+ return this.block.doesSideBlockRendering(this, world, pos, side); -+ } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/IBlockProperties.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/IBlockProperties.java.patch deleted file mode 100644 index e90318ea8f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/block/state/IBlockProperties.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/state/IBlockProperties.java -+++ ../src-work/minecraft/net/minecraft/block/state/IBlockProperties.java -@@ -25,9 +25,13 @@ - - boolean func_185913_b(); - -+ @Deprecated //Forge location aware version below - int func_185891_c(); -+ int getLightOpacity(IBlockAccess world, BlockPos pos); - -+ @Deprecated //Forge location aware version below - int func_185906_d(); -+ int getLightValue(IBlockAccess world, BlockPos pos); - - @SideOnly(Side.CLIENT) - boolean func_185895_e(); -@@ -88,5 +92,10 @@ - - RayTraceResult func_185910_a(World p_185910_1_, BlockPos p_185910_2_, Vec3d p_185910_3_, Vec3d p_185910_4_); - -+ @Deprecated // Forge: Use isSideSolid(IBlockAccess, BlockPos, EnumFacing.UP) instead - boolean func_185896_q(); -+ -+ //Forge added functions -+ boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing side); -+ boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side); - } diff --git a/patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch b/patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch deleted file mode 100644 index e666d37fe5..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/ClientBrandRetriever.java -+++ ../src-work/minecraft/net/minecraft/client/ClientBrandRetriever.java -@@ -8,6 +8,6 @@ - { - public static String getClientModName() - { -- return "vanilla"; -+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().getModName(); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch deleted file mode 100644 index c4f3c5cdb2..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/LoadingScreenRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/LoadingScreenRenderer.java -@@ -139,6 +139,10 @@ - GlStateManager.clear(16640); - } - -+ try -+ { -+ if (!net.minecraftforge.fml.client.FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) //FML Don't render while FML's pre-screen is rendering -+ { - Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer vertexbuffer = tessellator.getWorldRenderer(); - this.mc.getTextureManager().bindTexture(Gui.optionsBackground); -@@ -174,6 +178,12 @@ - GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - this.mc.fontRendererObj.drawStringWithShadow(this.currentlyDisplayedText, (float)((k - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2), (float)(l / 2 - 4 - 16), 16777215); - this.mc.fontRendererObj.drawStringWithShadow(this.message, (float)((k - this.mc.fontRendererObj.getStringWidth(this.message)) / 2), (float)(l / 2 - 4 + 8), 16777215); -+ } -+ } -+ catch (java.io.IOException e) -+ { -+ com.google.common.base.Throwables.propagate(e); -+ } //FML End - this.framebuffer.unbindFramebuffer(); - - if (OpenGlHelper.isFramebufferEnabled()) diff --git a/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch b/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch deleted file mode 100644 index 4bfb84b468..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch +++ /dev/null @@ -1,476 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/Minecraft.java -+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java -@@ -318,7 +318,6 @@ - this.sessionService = (new YggdrasilAuthenticationService(this.proxy, UUID.randomUUID().toString())).createMinecraftSessionService(); - this.session = gameConfig.userInfo.session; - logger.info("Setting user: " + this.session.getUsername()); -- logger.info("(Session ID is " + this.session.getSessionID() + ")"); - this.isDemo = gameConfig.gameInfo.isDemo; - this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1; - this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1; -@@ -432,10 +431,10 @@ - this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_); - this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language); - this.mcResourceManager.registerReloadListener(this.mcLanguageManager); -- this.refreshResources(); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.defaultResourcePacks, this.mcResourceManager); - this.renderEngine = new TextureManager(this.mcResourceManager); - this.mcResourceManager.registerReloadListener(this.renderEngine); -- this.drawSplashScreen(this.renderEngine); -+ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.renderEngine); - this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); - this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves"), this.field_184131_U); - this.mcSoundHandler = new SoundHandler(this.mcResourceManager, this.gameSettings); -@@ -469,6 +468,8 @@ - } - }); - this.mouseHelper = new MouseHelper(); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar= net.minecraftforge.fml.common.ProgressManager.push("Rendering Setup", 5, true); -+ bar.step("GL Setup"); - this.checkGLError("Pre startup"); - GlStateManager.enableTexture2D(); - GlStateManager.shadeModel(7425); -@@ -482,19 +483,23 @@ - GlStateManager.loadIdentity(); - GlStateManager.matrixMode(5888); - this.checkGLError("Startup"); -- this.textureMapBlocks = new TextureMap("textures"); -+ bar.step("Loading Texture Map"); -+ this.textureMapBlocks = new TextureMap("textures", true); - this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels); - this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks); - this.renderEngine.bindTexture(TextureMap.locationBlocksTexture); - this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0); -+ bar.step("Loading Model Manager"); - this.modelManager = new ModelManager(this.textureMapBlocks); - this.mcResourceManager.registerReloadListener(this.modelManager); - this.field_184127_aH = BlockColors.func_186723_a(); - this.field_184128_aI = ItemColors.func_186729_a(this.field_184127_aH); -+ bar.step("Loading Item Renderer"); - this.renderItem = new RenderItem(this.renderEngine, this.modelManager, this.field_184128_aI); - this.renderManager = new RenderManager(this.renderEngine, this.renderItem); - this.itemRenderer = new ItemRenderer(this); - this.mcResourceManager.registerReloadListener(this.renderItem); -+ bar.step("Loading Entity Renderer"); - this.entityRenderer = new EntityRenderer(this, this.mcResourceManager); - this.mcResourceManager.registerReloadListener(this.entityRenderer); - this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.field_184127_aH); -@@ -504,23 +509,26 @@ - this.guiAchievement = new GuiAchievement(this); - GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight); - this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading(); - this.checkGLError("Post startup"); -- this.ingameGUI = new GuiIngame(this); -+ this.ingameGUI = new net.minecraftforge.client.GuiIngameForge(this); - - if (this.serverName != null) - { -- this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort)); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.serverName, this.serverPort); - } - else - { - this.displayGuiScreen(new GuiMainMenu()); - } - -- this.renderEngine.deleteTexture(this.mojangLogo); -+ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(renderEngine, mojangLogo); - this.mojangLogo = null; - this.loadingScreen = new LoadingScreenRenderer(this); - this.field_184132_p = new DebugRenderer(this); - -+ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete(); - if (this.gameSettings.fullScreen && !this.fullscreen) - { - this.toggleFullscreen(); -@@ -692,21 +700,23 @@ - File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); - Bootstrap.printToSYSOUT(crashReportIn.getCompleteReport()); - -+ int retVal; - if (crashReportIn.getFile() != null) - { - Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + crashReportIn.getFile()); -- System.exit(-1); -+ retVal = -1; - } - else if (crashReportIn.saveToFile(file2)) - { - Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); -- System.exit(-1); -+ retVal = -1; - } - else - { - Bootstrap.printToSYSOUT("#@?@# Game crashed! Crash report could not be saved. #@?@#"); -- System.exit(-2); -+ retVal = -2; - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleExit(retVal); - } - - public boolean isUnicode() -@@ -899,11 +909,6 @@ - - public void displayGuiScreen(GuiScreen guiScreenIn) - { -- if (this.currentScreen != null) -- { -- this.currentScreen.onGuiClosed(); -- } -- - if (guiScreenIn == null && this.theWorld == null) - { - guiScreenIn = new GuiMainMenu(); -@@ -913,6 +918,17 @@ - guiScreenIn = new GuiGameOver((ITextComponent)null); - } - -+ GuiScreen old = this.currentScreen; -+ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(guiScreenIn); -+ -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; -+ -+ guiScreenIn = event.gui; -+ if (old != null && guiScreenIn != old) -+ { -+ old.onGuiClosed(); -+ } -+ - if (guiScreenIn instanceof GuiMainMenu || guiScreenIn instanceof GuiMultiplayer) - { - this.gameSettings.showDebugInfo = false; -@@ -1051,9 +1067,11 @@ - - if (!this.skipRenderWorld) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.timer.renderPartialTicks); - this.mcProfiler.endStartSection("gameRenderer"); - this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks, i); - this.mcProfiler.endSection(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.timer.renderPartialTicks); - } - - this.mcProfiler.endSection(); -@@ -1393,9 +1411,9 @@ - { - BlockPos blockpos = this.objectMouseOver.getBlockPos(); - -- if (this.theWorld.getBlockState(blockpos).func_185904_a() != Material.air && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit)) -+ if (!this.theWorld.isAirBlock(blockpos) && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit)) - { -- this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit); -+ this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver); - this.thePlayer.func_184609_a(EnumHand.MAIN_HAND); - } - } -@@ -1429,7 +1447,7 @@ - case BLOCK: - BlockPos blockpos = this.objectMouseOver.getBlockPos(); - -- if (this.theWorld.getBlockState(blockpos).func_185904_a() != Material.air) -+ if (!this.theWorld.isAirBlock(blockpos)) - { - this.playerController.clickBlock(blockpos, this.objectMouseOver.sideHit); - break; -@@ -1623,6 +1641,8 @@ - --this.rightClickDelayTimer; - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreClientTick(); -+ - this.mcProfiler.startSection("gui"); - - if (!this.isGamePaused) -@@ -1734,6 +1754,7 @@ - this.joinPlayerCounter = 0; - this.theWorld.joinEntityInSurroundings(this.thePlayer); - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput(); - } - - this.mcProfiler.endStartSection("gameRenderer"); -@@ -1821,6 +1842,7 @@ - this.myNetworkManager.processReceivedPackets(); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick(); - this.mcProfiler.endSection(); - this.systemTime = getSystemTime(); - } -@@ -1926,6 +1948,7 @@ - this.gameSettings.showLagometer = this.gameSettings.showDebugInfo && GuiScreen.isAltKeyDown(); - } - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput(); - } - } - -@@ -2166,6 +2189,8 @@ - { - while (Mouse.next()) - { -+ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; -+ - int i = Mouse.getEventButton(); - KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); - -@@ -2231,6 +2256,7 @@ - - public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn) - { -+ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(folderName, worldName, worldSettingsIn); - this.loadWorld((WorldClient)null); - System.gc(); - ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); -@@ -2273,6 +2299,12 @@ - - while (!this.theIntegratedServer.serverIsInRunLoop()) - { -+ if (!net.minecraftforge.fml.common.StartupQuery.check()) -+ { -+ loadWorld(null); -+ displayGuiScreen(null); -+ return; -+ } - String s = this.theIntegratedServer.getUserMessage(); - - if (s != null) -@@ -2298,8 +2330,14 @@ - SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); - NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); - networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); -- networkmanager.sendPacket(new C00Handshake(107, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); -- networkmanager.sendPacket(new CPacketLoginStart(this.getSession().getProfile())); -+ networkmanager.sendPacket(new C00Handshake(107, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true)); -+ com.mojang.authlib.GameProfile gameProfile = this.getSession().getProfile(); -+ if (!this.getSession().hasCachedProperties()) -+ { -+ gameProfile = sessionService.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. -+ this.getSession().setProperties(gameProfile.getProperties()); -+ } -+ networkmanager.sendPacket(new CPacketLoginStart(gameProfile)); - this.myNetworkManager = networkmanager; - } - -@@ -2310,6 +2348,8 @@ - - public void loadWorld(WorldClient worldClientIn, String loadingMessage) - { -+ if (theWorld != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(theWorld)); -+ - if (worldClientIn == null) - { - NetHandlerPlayClient nethandlerplayclient = this.getNetHandler(); -@@ -2322,6 +2362,18 @@ - if (this.theIntegratedServer != null && this.theIntegratedServer.isAnvilFileSet()) - { - this.theIntegratedServer.initiateShutdown(); -+ if (loadingScreen != null) -+ { -+ this.loadingScreen.displayLoadingString(I18n.format("forge.client.shutdown.internal")); -+ } -+ while (!theIntegratedServer.isServerStopped()) -+ { -+ try -+ { -+ Thread.sleep(10); -+ } -+ catch (InterruptedException ie) {} -+ } - } - - this.theIntegratedServer = null; -@@ -2345,6 +2397,7 @@ - this.ingameGUI.func_181029_i(); - this.setServerData((ServerData)null); - this.integratedServerIsRunning = false; -+ net.minecraftforge.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.theWorld); - } - - this.mcSoundHandler.stopSounds(); -@@ -2461,159 +2514,8 @@ - { - if (this.objectMouseOver != null && this.objectMouseOver.typeOfHit != RayTraceResult.Type.MISS) - { -- boolean flag = this.thePlayer.capabilities.isCreativeMode; -- TileEntity tileentity = null; -- ItemStack itemstack; -- -- if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) -- { -- BlockPos blockpos = this.objectMouseOver.getBlockPos(); -- IBlockState iblockstate = this.theWorld.getBlockState(blockpos); -- Block block = iblockstate.getBlock(); -- -- if (iblockstate.func_185904_a() == Material.air) -- { -- return; -- } -- -- itemstack = block.func_185473_a(this.theWorld, blockpos, iblockstate); -- -- if (itemstack == null) -- { -- return; -- } -- -- if (flag && GuiScreen.isCtrlKeyDown() && block.hasTileEntity()) -- { -- tileentity = this.theWorld.getTileEntity(blockpos); -- } -- } -- else -- { -- if (this.objectMouseOver.typeOfHit != RayTraceResult.Type.ENTITY || this.objectMouseOver.entityHit == null || !flag) -- { -- return; -- } -- -- if (this.objectMouseOver.entityHit instanceof EntityPainting) -- { -- itemstack = new ItemStack(Items.painting); -- } -- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) -- { -- itemstack = new ItemStack(Items.lead); -- } -- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) -- { -- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; -- ItemStack itemstack1 = entityitemframe.getDisplayedItem(); -- -- if (itemstack1 == null) -- { -- itemstack = new ItemStack(Items.item_frame); -- } -- else -- { -- itemstack = ItemStack.copyItemStack(itemstack1); -- } -- } -- else if (this.objectMouseOver.entityHit instanceof EntityMinecart) -- { -- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; -- Item item; -- -- switch (entityminecart.func_184264_v()) -- { -- case FURNACE: -- item = Items.furnace_minecart; -- break; -- case CHEST: -- item = Items.chest_minecart; -- break; -- case TNT: -- item = Items.tnt_minecart; -- break; -- case HOPPER: -- item = Items.hopper_minecart; -- break; -- case COMMAND_BLOCK: -- item = Items.command_block_minecart; -- break; -- default: -- item = Items.minecart; -- } -- -- itemstack = new ItemStack(item); -- } -- else if (this.objectMouseOver.entityHit instanceof EntityBoat) -- { -- itemstack = new ItemStack(((EntityBoat)this.objectMouseOver.entityHit).func_184455_j()); -- } -- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) -- { -- itemstack = new ItemStack(Items.armor_stand); -- } -- else if (this.objectMouseOver.entityHit instanceof EntityEnderCrystal) -- { -- itemstack = new ItemStack(Items.field_185158_cP); -- } -- else -- { -- String s = EntityList.getEntityString(this.objectMouseOver.entityHit); -- -- if (!EntityList.entityEggs.containsKey(s)) -- { -- return; -- } -- -- itemstack = new ItemStack(Items.spawn_egg); -- ItemMonsterPlacer.func_185078_a(itemstack, s); -- } -- } -- -- if (itemstack.getItem() == null) -- { -- String s1 = ""; -- -- if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) -- { -- s1 = ((ResourceLocation)Block.blockRegistry.getNameForObject(this.theWorld.getBlockState(this.objectMouseOver.getBlockPos()).getBlock())).toString(); -- } -- else if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.ENTITY) -- { -- s1 = EntityList.getEntityString(this.objectMouseOver.entityHit); -- } -- -- logger.warn("Picking on: [{}] {} gave null item", new Object[] {this.objectMouseOver.typeOfHit, s1}); -- } -- else -- { -- InventoryPlayer inventoryplayer = this.thePlayer.inventory; -- -- if (tileentity != null) -- { -- this.func_184119_a(itemstack, tileentity); -- } -- -- int i = inventoryplayer.func_184429_b(itemstack); -- -- if (flag) -- { -- inventoryplayer.func_184434_a(itemstack); -- this.playerController.sendSlotPacket(this.thePlayer.func_184586_b(EnumHand.MAIN_HAND), 36 + inventoryplayer.currentItem); -- } -- else if (i != -1) -- { -- if (InventoryPlayer.func_184435_e(i)) -- { -- inventoryplayer.currentItem = i; -- } -- else -- { -- this.playerController.func_187100_a(i); -- } -- } -- } -+ net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld); -+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions - } - } - -@@ -2909,18 +2811,8 @@ - - public static int getGLMaximumTextureSize() - { -- for (int i = 16384; i > 0; i >>= 1) -- { -- GlStateManager.func_187419_a(32868, 0, 6408, i, i, 0, 6408, 5121, (IntBuffer)null); -- int j = GlStateManager.func_187411_c(32868, 0, 4096); -- -- if (j != 0) -- { -- return i; -- } -- } -- -- return -1; -+ //Forge we redirect this to our code which caches the value before any splash screen stuff is done. -+ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize(); - } - - public boolean isSnooperEnabled() diff --git a/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch deleted file mode 100644 index a4124c09a9..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/audio/SoundManager.java -+++ ../src-work/minecraft/net/minecraft/client/audio/SoundManager.java -@@ -76,6 +76,7 @@ - { - SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); - SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundSetupEvent(this)); - } - catch (SoundSystemException soundsystemexception) - { -@@ -100,6 +101,7 @@ - - this.unloadSoundSystem(); - this.loadSoundSystem(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundLoadEvent(this)); - } - - private synchronized void loadSoundSystem() -@@ -350,6 +352,9 @@ - } - else - { -+ p_sound = net.minecraftforge.client.ForgeHooksClient.playSound(this, p_sound); -+ if (p_sound == null) return; -+ - if (!this.field_188777_o.isEmpty()) - { - for (ISoundEventListener isoundeventlistener : this.field_188777_o) -@@ -400,10 +405,12 @@ - if (sound.func_188723_h()) - { - this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation1), resourcelocation1.toString(), flag, p_sound.getXPosF(), p_sound.getYPosF(), p_sound.getZPosF(), p_sound.getAttenuationType().getTypeInt(), f); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, p_sound, s)); - } - else - { - this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation1), resourcelocation1.toString(), flag, p_sound.getXPosF(), p_sound.getYPosF(), p_sound.getZPosF(), p_sound.getAttenuationType().getTypeInt(), f); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, p_sound, s)); - } - - logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {sound.func_188719_a(), resourcelocation1, s}); diff --git a/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch deleted file mode 100644 index 74fca0297a..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java -+++ ../src-work/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java -@@ -148,6 +148,6 @@ - f *= 1.0F - f1 * 0.15F; - } - -- return f; -+ return net.minecraftforge.client.ForgeHooksClient.getOffsetFOV(this, f); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch deleted file mode 100644 index 1619065735..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ /dev/null @@ -1,73 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java -+++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java -@@ -400,6 +400,15 @@ - this.mc.ingameGUI.getChatGUI().printChatMessage(chatComponent); - } - -+ private boolean isHeadspaceFree(BlockPos pos, int height) -+ { -+ for (int y = 0; y < height; y++) -+ { -+ if (isOpenBlockSpace(pos.add(0, y, 0))) return false; -+ } -+ return true; -+ } -+ - protected boolean pushOutOfBlocks(double x, double y, double z) - { - if (this.noClip) -@@ -412,30 +421,34 @@ - double d0 = x - (double)blockpos.getX(); - double d1 = z - (double)blockpos.getZ(); - -- if (!this.isOpenBlockSpace(blockpos)) -+ int entHeight = Math.max(Math.round(this.height), 1); -+ -+ boolean inTranslucentBlock = this.isHeadspaceFree(blockpos, entHeight); -+ -+ if (inTranslucentBlock) - { - int i = -1; - double d2 = 9999.0D; - -- if (this.isOpenBlockSpace(blockpos.west()) && d0 < d2) -+ if (!this.isHeadspaceFree(blockpos.west(), entHeight) && d0 < d2) - { - d2 = d0; - i = 0; - } - -- if (this.isOpenBlockSpace(blockpos.east()) && 1.0D - d0 < d2) -+ if (!this.isHeadspaceFree(blockpos.east(), entHeight) && 1.0D - d0 < d2) - { - d2 = 1.0D - d0; - i = 1; - } - -- if (this.isOpenBlockSpace(blockpos.north()) && d1 < d2) -+ if (!this.isHeadspaceFree(blockpos.north(), entHeight) && d1 < d2) - { - d2 = d1; - i = 4; - } - -- if (this.isOpenBlockSpace(blockpos.south()) && 1.0D - d1 < d2) -+ if (!this.isHeadspaceFree(blockpos.south(), entHeight) && 1.0D - d1 < d2) - { - d2 = 1.0D - d1; - i = 5; -@@ -515,7 +528,13 @@ - - public void func_184185_a(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_) - { -- this.worldObj.func_184134_a(this.posX, this.posY, this.posZ, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false); -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_); -+ if (event.isCanceled() || event.getSound() == null) return; -+ p_184185_1_ = event.getSound(); -+ p_184185_2_ = event.getVolume(); -+ p_184185_3_ = event.getPitch(); -+ -+ this.worldObj.func_184134_a(this.posX, this.posY, this.posZ, p_184185_1_, event.getCategory(), p_184185_2_, p_184185_3_, false); - } - - public boolean isServerWorld() diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch deleted file mode 100644 index 2d53a7f250..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch +++ /dev/null @@ -1,144 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/FontRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/gui/FontRenderer.java -@@ -57,7 +57,7 @@ - this.locationFontTexture = location; - this.renderEngine = textureManagerIn; - this.unicodeFlag = unicode; -- textureManagerIn.bindTexture(this.locationFontTexture); -+ bindTexture(this.locationFontTexture); - - for (int i = 0; i < 32; ++i) - { -@@ -97,6 +97,7 @@ - public void onResourceManagerReload(IResourceManager resourceManager) - { - this.readFontTexture(); -+ this.readGlyphSizes(); - } - - private void readFontTexture() -@@ -106,7 +107,7 @@ - - try - { -- iresource = Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture); -+ iresource = getResource(this.locationFontTexture); - bufferedimage = TextureUtil.readBufferedImage(iresource.getInputStream()); - } - catch (IOException ioexception) -@@ -171,7 +172,7 @@ - - try - { -- iresource = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin")); -+ iresource = getResource(new ResourceLocation("font/glyph_sizes.bin")); - iresource.getInputStream().read(this.glyphWidth); - } - catch (IOException ioexception) -@@ -202,7 +203,7 @@ - int i = ch % 16 * 8; - int j = ch / 16 * 8; - int k = italic ? 1 : 0; -- this.renderEngine.bindTexture(this.locationFontTexture); -+ bindTexture(this.locationFontTexture); - int l = this.charWidth[ch]; - float f = (float)l - 0.01F; - GlStateManager.func_187447_r(5); -@@ -230,7 +231,7 @@ - - private void loadGlyphTexture(int page) - { -- this.renderEngine.bindTexture(this.getUnicodePageLocation(page)); -+ bindTexture(this.getUnicodePageLocation(page)); - } - - protected float renderUnicodeChar(char ch, boolean italic) -@@ -279,7 +280,7 @@ - - public int drawString(String text, float x, float y, int color, boolean dropShadow) - { -- GlStateManager.enableAlpha(); -+ enableAlpha(); - this.resetStyles(); - int i; - -@@ -349,7 +350,7 @@ - - int j1 = this.colorCode[i1]; - this.textColor = j1; -- GlStateManager.color((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.alpha); -+ setColor((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.alpha); - } - else if (i1 == 16) - { -@@ -378,7 +379,7 @@ - this.strikethroughStyle = false; - this.underlineStyle = false; - this.italicStyle = false; -- GlStateManager.color(this.red, this.blue, this.green, this.alpha); -+ setColor(this.red, this.blue, this.green, this.alpha); - } - - ++i; -@@ -406,7 +407,7 @@ - c0 = c1; - } - -- float f1 = this.unicodeFlag ? 0.5F : 1.0F; -+ float f1 = j == -1 || this.unicodeFlag ? 0.5f : 1f; - boolean flag = (c0 == 0 || j == -1 || this.unicodeFlag) && shadow; - - if (flag) -@@ -444,7 +445,16 @@ - - ++f; - } -+ doDraw(f); -+ } -+ } -+ } - -+ protected void doDraw(float f) -+ { -+ { -+ { -+ - if (this.strikethroughStyle) - { - Tessellator tessellator = Tessellator.getInstance(); -@@ -517,7 +527,7 @@ - this.blue = (float)(color >> 8 & 255) / 255.0F; - this.green = (float)(color & 255) / 255.0F; - this.alpha = (float)(color >> 24 & 255) / 255.0F; -- GlStateManager.color(this.red, this.blue, this.green, this.alpha); -+ setColor(this.red, this.blue, this.green, this.alpha); - this.posX = x; - this.posY = y; - this.renderStringAtPos(text, dropShadow); -@@ -848,6 +858,26 @@ - return this.bidiFlag; - } - -+ protected void setColor(float r, float g, float b, float a) -+ { -+ GlStateManager.color(r,g,b,a); -+ } -+ -+ protected void enableAlpha() -+ { -+ GlStateManager.enableAlpha(); -+ } -+ -+ protected void bindTexture(ResourceLocation location) -+ { -+ renderEngine.bindTexture(location); -+ } -+ -+ protected IResource getResource(ResourceLocation location) throws IOException -+ { -+ return Minecraft.getMinecraft().getResourceManager().getResource(location); -+ } -+ - public int getColorCode(char character) - { - int i = "0123456789abcdef".indexOf(character); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch deleted file mode 100644 index fa7fb1ca1e..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java -@@ -22,6 +22,7 @@ - public boolean enabled; - public boolean visible; - protected boolean hovered; -+ public int packedFGColour; //FML - - public GuiButton(int buttonId, int x, int y, String buttonText) - { -@@ -75,6 +76,11 @@ - this.mouseDragged(mc, mouseX, mouseY); - int j = 14737632; - -+ if (packedFGColour != 0) -+ { -+ j = packedFGColour; -+ } -+ else - if (!this.enabled) - { - j = 10526880; diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch deleted file mode 100644 index e3b5707827..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java -@@ -250,6 +250,7 @@ - - public BlockPos func_186839_b() - { -+ - BlockPos blockpos = null; - - if (this.field_186853_g.objectMouseOver != null && this.field_186853_g.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch deleted file mode 100644 index 420742007d..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -@@ -205,6 +205,8 @@ - } - } - -+ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress(); -+ - WorldSettings worldsettings = new WorldSettings(i, WorldSettings.GameType.getByName(this.gameMode), this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]); - worldsettings.setWorldName(this.chunkProviderSettingsJson); - -@@ -311,14 +313,7 @@ - } - else if (button.id == 8) - { -- if (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT) -- { -- this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.chunkProviderSettingsJson)); -- } -- else -- { -- this.mc.displayGuiScreen(new GuiCustomizeWorldScreen(this, this.chunkProviderSettingsJson)); -- } -+ WorldType.worldTypes[this.selectedIndex].onCustomizeButton(mc, this); - } - } - } -@@ -370,7 +365,7 @@ - this.btnBonusItems.visible = this.field_146344_y; - this.btnMapType.visible = this.field_146344_y; - this.btnAllowCommands.visible = this.field_146344_y; -- this.btnCustomizeType.visible = this.field_146344_y && (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT || WorldType.worldTypes[this.selectedIndex] == WorldType.CUSTOMIZED); -+ this.btnCustomizeType.visible = this.field_146344_y && WorldType.worldTypes[this.selectedIndex].isCustomizable(); - } - - this.func_146319_h(); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngame.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngame.java.patch deleted file mode 100644 index 2b9853f16a..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngame.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiIngame.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngame.java -@@ -360,7 +360,8 @@ - - BlockPos blockpos = raytraceresult.getBlockPos(); - -- if (!this.mc.theWorld.getBlockState(blockpos).getBlock().hasTileEntity() || !(this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory)) -+ net.minecraft.block.state.IBlockState state = this.mc.theWorld.getBlockState(blockpos); -+ if (!state.getBlock().hasTileEntity(state) || !(this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory)) - { - return; - } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch deleted file mode 100644 index aef607d2cf..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiIngameMenu.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java -@@ -30,8 +30,9 @@ - - this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + i, I18n.format("menu.returnToGame", new Object[0]))); - this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.options", new Object[0]))); -+ this.buttonList.add(new GuiButton(12, this.width / 2 + 2, this.height / 4 + 96 + i, 98, 20, I18n.format("fml.menu.modoptions"))); - GuiButton guibutton; -- this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.shareToLan", new Object[0]))); -+ this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 - 100, this.height / 4 + 72 + i, 200, 20, I18n.format("menu.shareToLan", new Object[0]))); - this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.achievements", new Object[0]))); - this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.stats", new Object[0]))); - guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic(); -@@ -74,13 +75,19 @@ - this.mc.setIngameFocus(); - break; - case 5: -+ if (this.mc.thePlayer != null) - this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.getStatFileWriter())); - break; - case 6: -+ if (this.mc.thePlayer != null) - this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); - break; - case 7: - this.mc.displayGuiScreen(new GuiShareToLan(this)); -+ break; -+ case 12: -+ net.minecraftforge.fml.client.FMLClientHandler.instance().showInGameModOptions(this); -+ break; - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java.patch deleted file mode 100644 index 3731eb6579..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java -@@ -242,7 +242,7 @@ - - if (this.field_186784_e.getSaveLoader().canLoadWorld(this.field_186786_g.getFileName())) - { -- this.field_186784_e.launchIntegratedServer(this.field_186786_g.getFileName(), this.field_186786_g.getDisplayName(), (WorldSettings)null); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(field_186785_f, this.field_186786_g); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch deleted file mode 100644 index 74df3b87b5..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java -@@ -216,7 +216,8 @@ - { - this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer", new Object[0]))); - this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0]))); -- this.buttonList.add(this.realmsButton = new GuiButton(14, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("menu.online", new Object[0]))); -+ this.buttonList.add(this.realmsButton = new GuiButton(14, this.width / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.format("menu.online", new Object[0]).replace("Minecraft", "").trim())); -+ this.buttonList.add(new GuiButton(6, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.format("fml.menu.mods"))); - } - - private void addDemoButtons(int p_73972_1_, int p_73972_2_) -@@ -264,6 +265,11 @@ - this.mc.shutdown(); - } - -+ if (button.id == 6) -+ { -+ this.mc.displayGuiScreen(new net.minecraftforge.fml.client.GuiModList(this)); -+ } -+ - if (button.id == 11) - { - this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings); -@@ -512,7 +518,16 @@ - s = s + ("release".equalsIgnoreCase(this.mc.func_184123_d()) ? "" : "/" + this.mc.func_184123_d()); - } - -- this.drawString(this.fontRendererObj, s, 2, this.height - 10, -1); -+ java.util.List brandings = com.google.common.collect.Lists.reverse(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(true)); -+ for (int brdline = 0; brdline < brandings.size(); brdline++) -+ { -+ String brd = brandings.get(brdline); -+ if (!com.google.common.base.Strings.isNullOrEmpty(brd)) -+ { -+ this.drawString(this.fontRendererObj, brd, 2, this.height - ( 10 + brdline * (this.fontRendererObj.FONT_HEIGHT + 1)), 16777215); -+ } -+ } -+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.fontRendererObj, this.width, this.height); - String s1 = "Copyright Mojang AB. Do not distribute!"; - this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2, this.height - 10, -1); - diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch deleted file mode 100644 index 4e8b2f3eb7..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiMultiplayer.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiMultiplayer.java -@@ -40,6 +40,7 @@ - public GuiMultiplayer(GuiScreen parentScreen) - { - this.parentScreen = parentScreen; -+ net.minecraftforge.fml.client.FMLClientHandler.instance().setupServerList(); - } - - public void initGui() -@@ -372,7 +373,7 @@ - - private void connectToServer(ServerData server) - { -- this.mc.displayGuiScreen(new GuiConnecting(this, this.mc, server)); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServer(this, server); - } - - public void selectServer(int index) diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch deleted file mode 100644 index 179cfc5683..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java -@@ -190,6 +190,9 @@ - long l = j - k; - List list = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.getCpu()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GlStateManager.func_187416_u(7936)}), GlStateManager.func_187416_u(7937), GlStateManager.func_187416_u(7938)}); - -+ list.add(""); -+ list.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false)); -+ - if (this.isReducedDebug()) - { - return list; diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch deleted file mode 100644 index 302b4e3bb0..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch +++ /dev/null @@ -1,107 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java -@@ -141,7 +141,8 @@ - } - } - -- this.drawHoveringText(list, x, y); -+ FontRenderer font = stack.getItem().getFontRenderer(stack); -+ this.drawHoveringText(list, x, y, (font == null ? fontRendererObj : font)); - } - - protected void drawCreativeTabHoveringText(String tabName, int mouseX, int mouseY) -@@ -151,6 +152,11 @@ - - protected void drawHoveringText(List textLines, int x, int y) - { -+ drawHoveringText(textLines, x, y, fontRendererObj); -+ } -+ -+ protected void drawHoveringText(List textLines, int x, int y, FontRenderer font) -+ { - if (!textLines.isEmpty()) - { - GlStateManager.disableRescaleNormal(); -@@ -161,7 +167,7 @@ - - for (String s : textLines) - { -- int j = this.fontRendererObj.getStringWidth(s); -+ int j = font.getStringWidth(s); - - if (j > i) - { -@@ -206,7 +212,7 @@ - for (int k1 = 0; k1 < textLines.size(); ++k1) - { - String s1 = (String)textLines.get(k1); -- this.fontRendererObj.drawStringWithShadow(s1, (float)l1, (float)i2, -1); -+ font.drawStringWithShadow(s1, (float)l1, (float)i2, -1); - - if (k1 == 0) - { -@@ -421,6 +427,7 @@ - { - this.mc.ingameGUI.getChatGUI().addToSentMessages(msg); - } -+ if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(mc.thePlayer, msg) != 0) return; - - this.mc.thePlayer.sendChatMessage(msg); - } -@@ -435,9 +442,15 @@ - - if (guibutton.mousePressed(this.mc, mouseX, mouseY)) - { -+ net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre event = new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre(this, guibutton, this.buttonList); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) -+ break; -+ guibutton = event.button; - this.selectedButton = guibutton; - guibutton.playPressSound(this.mc.getSoundHandler()); - this.actionPerformed(guibutton); -+ if (this.equals(this.mc.currentScreen)) -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Post(this, event.button, this.buttonList)); - } - } - } -@@ -467,8 +480,12 @@ - this.fontRendererObj = mc.fontRendererObj; - this.width = width; - this.height = height; -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.buttonList))) -+ { - this.buttonList.clear(); - this.initGui(); -+ } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.buttonList)); - } - - public void func_183500_a(int p_183500_1_, int p_183500_2_) -@@ -487,7 +504,9 @@ - { - while (Mouse.next()) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Pre(this))) continue; - this.handleMouseInput(); -+ if (this.equals(this.mc.currentScreen)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Post(this)); - } - } - -@@ -495,7 +514,9 @@ - { - while (Keyboard.next()) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Pre(this))) continue; - this.handleKeyboardInput(); -+ if (this.equals(this.mc.currentScreen)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Post(this)); - } - } - } -@@ -557,6 +578,7 @@ - public void drawDefaultBackground() - { - this.drawWorldBackground(0); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this)); - } - - public void drawWorldBackground(int tint) diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch deleted file mode 100644 index a179369e29..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiSleepMP.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSleepMP.java -@@ -32,7 +32,7 @@ - - if (!s.isEmpty()) - { -- this.mc.thePlayer.sendChatMessage(s); -+ this.sendChatMessage(s); // Forge: fix vanilla not adding messages to the sent list while sleeping - } - - this.inputField.setText(""); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch deleted file mode 100644 index 852133385e..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java -@@ -181,15 +181,8 @@ - GlStateManager.disableFog(); - Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer vertexbuffer = tessellator.getWorldRenderer(); -- this.mc.getTextureManager().bindTexture(Gui.optionsBackground); -- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -- float f = 32.0F; -- vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); -- vertexbuffer.pos((double)this.left, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -- vertexbuffer.pos((double)this.right, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -- vertexbuffer.pos((double)this.right, (double)this.top, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -- vertexbuffer.pos((double)this.left, (double)this.top, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -- tessellator.draw(); -+ // Forge: background rendering moved into separate method. -+ this.drawContainerBackground(tessellator); - int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; - int l = this.top + 4 - (int)this.amountScrolled; - -@@ -458,4 +451,18 @@ - { - return this.slotHeight; - } -+ -+ protected void drawContainerBackground(Tessellator tessellator) -+ { -+ VertexBuffer buffer = tessellator.getWorldRenderer(); -+ this.mc.getTextureManager().bindTexture(Gui.optionsBackground); -+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -+ float f = 32.0F; -+ buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); -+ buffer.pos((double)this.left, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -+ buffer.pos((double)this.right, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -+ buffer.pos((double)this.right, (double)this.top, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -+ buffer.pos((double)this.left, (double)this.top, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -+ tessellator.draw(); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch deleted file mode 100644 index 94e88d2d37..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java -@@ -73,6 +73,7 @@ - s3 = s4; - } - -+ s3 = FontRenderer.getFormatFromString(s2) + s3; //Forge: Fix chat formatting not surviving line wrapping. - TextComponentString textcomponentstring2 = new TextComponentString(s3); - textcomponentstring2.setChatStyle(itextcomponent1.getChatStyle().createShallowCopy()); - list1.add(j + 1, textcomponentstring2); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch deleted file mode 100644 index 9a197d3925..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java -+++ ../src-work/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java -@@ -82,7 +82,7 @@ - boolean flag1 = this.field_148301_e.version < 107; - boolean flag2 = flag || flag1; - this.mc.fontRendererObj.drawString(this.field_148301_e.serverName, x + 32 + 3, y + 1, 16777215); -- List list = this.mc.fontRendererObj.listFormattedStringToWidth(this.field_148301_e.serverMOTD, listWidth - 32 - 2); -+ List list = this.mc.fontRendererObj.listFormattedStringToWidth(net.minecraftforge.fml.client.FMLClientHandler.instance().fixDescription(this.field_148301_e.serverMOTD), listWidth - 48 - 2); - - for (int i = 0; i < Math.min(list.size(), 2); ++i) - { -@@ -176,6 +176,11 @@ - int i1 = mouseX - x; - int j1 = mouseY - y; - -+ String tooltip = net.minecraftforge.fml.client.FMLClientHandler.instance().enhanceServerListEntry(this, this.field_148301_e, x, listWidth, y, i1, j1); -+ if (tooltip != null) -+ { -+ this.field_148303_c.setHoveringText(tooltip); -+ } else - if (i1 >= listWidth - 15 && i1 <= listWidth - 5 && j1 >= 0 && j1 <= 8) - { - this.field_148303_c.setHoveringText(s1); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch deleted file mode 100644 index 7efb6b7a73..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch +++ /dev/null @@ -1,116 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java -+++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java -@@ -49,6 +49,10 @@ - private StatFileWriter statFileWriter; - private boolean loadingAchievements = true; - -+ private int currentPage = -1; -+ private GuiButton button; -+ private java.util.LinkedList minecraftAchievements = new java.util.LinkedList(); -+ - public GuiAchievements(GuiScreen parentScreenIn, StatFileWriter statFileWriterIn) - { - this.parentScreen = parentScreenIn; -@@ -57,6 +61,14 @@ - int j = 141; - this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.field_187982_f.displayColumn * 24 - i / 2 - 12); - this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.field_187982_f.displayRow * 24 - j / 2); -+ minecraftAchievements.clear(); -+ for (Achievement achievement : AchievementList.field_187981_e) -+ { -+ if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement)) -+ { -+ minecraftAchievements.add(achievement); -+ } -+ } - } - - public void initGui() -@@ -64,6 +76,7 @@ - this.mc.getNetHandler().addToSendQueue(new CPacketClientStatus(CPacketClientStatus.State.REQUEST_STATS)); - this.buttonList.clear(); - this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0]))); -+ this.buttonList.add(button = new GuiButton(2, (width - field_146555_f) / 2 + 24, height / 2 + 74, 125, 20, net.minecraftforge.common.AchievementPage.getTitle(currentPage))); - } - - protected void actionPerformed(GuiButton button) throws IOException -@@ -74,6 +87,16 @@ - { - this.mc.displayGuiScreen(this.parentScreen); - } -+ -+ if (button.id == 2) -+ { -+ currentPage++; -+ if (currentPage >= net.minecraftforge.common.AchievementPage.getAchievementPages().size()) -+ { -+ currentPage = -1; -+ } -+ this.button.displayString = net.minecraftforge.common.AchievementPage.getTitle(currentPage); -+ } - } - } - -@@ -257,7 +280,9 @@ - GlStateManager.depthFunc(518); - GlStateManager.pushMatrix(); - GlStateManager.translate((float)i1, (float)j1, -200.0F); -- GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 0.0F); -+ // FIXES models rendering weirdly in the acheivements pane -+ // see https://github.com/MinecraftForge/MinecraftForge/commit/1b7ce7592caafb760ec93066184182ae0711e793#commitcomment-10512284 -+ GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 1.0F); - GlStateManager.enableTexture2D(); - GlStateManager.disableLighting(); - GlStateManager.enableRescaleNormal(); -@@ -331,11 +356,12 @@ - GlStateManager.depthFunc(515); - this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND); - -- for (int j5 = 0; j5 < AchievementList.field_187981_e.size(); ++j5) -+ java.util.List achievementList = (currentPage == -1 ? minecraftAchievements : net.minecraftforge.common.AchievementPage.getAchievementPage(currentPage).getAchievements()); -+ for (int j5 = 0; j5 < achievementList.size(); ++j5) - { - Achievement achievement1 = (Achievement)AchievementList.field_187981_e.get(j5); - -- if (achievement1.parentAchievement != null) -+ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement)) - { - int k5 = achievement1.displayColumn * 24 - i + 11; - int l5 = achievement1.displayRow * 24 - j + 11; -@@ -389,9 +415,9 @@ - GlStateManager.enableRescaleNormal(); - GlStateManager.enableColorMaterial(); - -- for (int i6 = 0; i6 < AchievementList.field_187981_e.size(); ++i6) -+ for (int i6 = 0; i6 < achievementList.size(); ++i6) - { -- Achievement achievement2 = (Achievement)AchievementList.field_187981_e.get(i6); -+ Achievement achievement2 = achievementList.get(i6); - int l6 = achievement2.displayColumn * 24 - i; - int j7 = achievement2.displayRow * 24 - j; - -@@ -432,6 +458,7 @@ - - this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND); - -+ GlStateManager.enableBlend(); // Forge: Specifically enable blend because it is needed here. And we fix Generic RenderItem's leakage of it. - if (achievement2.getSpecial()) - { - this.drawTexturedModalRect(l6 - 2, j7 - 2, 26, 202, 26, 26); -@@ -440,6 +467,7 @@ - { - this.drawTexturedModalRect(l6 - 2, j7 - 2, 0, 202, 26, 26); - } -+ GlStateManager.disableBlend(); //Forge: Cleanup states we set. - - if (!this.statFileWriter.canUnlockAchievement(achievement2)) - { -@@ -448,7 +476,7 @@ - this.itemRender.func_175039_a(false); - } - -- GlStateManager.enableLighting(); -+ GlStateManager.disableLighting(); //Forge: Make sure Lighting is disabled. Fixes MC-33065 - GlStateManager.enableCull(); - this.itemRender.renderItemAndEffectIntoGUI(achievement2.theItemStack, l6 + 3, j7 + 3); - GlStateManager.func_187401_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch deleted file mode 100644 index 7e30615cfa..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java -+++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java -@@ -176,8 +176,11 @@ - GlStateManager.translate(0.0F, 0.0F, 32.0F); - this.zLevel = 200.0F; - this.itemRender.zLevel = 200.0F; -+ net.minecraft.client.gui.FontRenderer font = null; -+ if (stack != null) font = stack.getItem().getFontRenderer(stack); -+ if (font == null) font = fontRendererObj; - this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); -- this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); -+ this.itemRender.renderItemOverlayIntoGUI(font, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); - this.zLevel = 0.0F; - this.itemRender.zLevel = 0.0F; - } -@@ -240,13 +243,12 @@ - - if (itemstack == null && slotIn.canBeHovered()) - { -- String s1 = slotIn.getSlotTexture(); -+ TextureAtlasSprite textureatlassprite = slotIn.getBackgroundSprite(); - -- if (s1 != null) -+ if (textureatlassprite != null) - { -- TextureAtlasSprite textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite(s1); - GlStateManager.disableLighting(); -- this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); -+ this.mc.getTextureManager().bindTexture(slotIn.getBackgroundLocation()); - this.drawTexturedModalRect(i, j, textureatlassprite, 16, 16); - GlStateManager.enableLighting(); - flag1 = true; -@@ -327,6 +329,7 @@ - int j = this.guiLeft; - int k = this.guiTop; - boolean flag1 = mouseX < j || mouseY < k || mouseX >= j + this.xSize || mouseY >= k + this.ySize; -+ if (slot != null) flag1 = false; // Forge, prevent dropping of items through slots outside of GUI boundaries - int l = -1; - - if (slot != null) -@@ -464,10 +467,12 @@ - - protected void mouseReleased(int mouseX, int mouseY, int state) - { -+ super.mouseReleased(mouseX, mouseY, state); //Forge, Call parent to release buttons - Slot slot = this.getSlotAtPosition(mouseX, mouseY); - int i = this.guiLeft; - int j = this.guiTop; - boolean flag = mouseX < i || mouseY < j || mouseX >= i + this.xSize || mouseY >= j + this.ySize; -+ if (slot != null) flag = false; // Forge, prevent dropping of items through slots outside of GUI boundaries - int k = -1; - - if (slot != null) -@@ -686,4 +691,16 @@ - this.mc.thePlayer.closeScreen(); - } - } -+ -+ /* ======================================== FORGE START =====================================*/ -+ -+ /** -+ * Returns the slot that is currently displayed under the mouse. -+ */ -+ public Slot getSlotUnderMouse() -+ { -+ return this.theSlot; -+ } -+ -+ /* ======================================== FORGE END =====================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch deleted file mode 100644 index 58c34c352f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ /dev/null @@ -1,256 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java -+++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java -@@ -49,6 +49,8 @@ - private Slot field_147064_C; - private boolean field_147057_D; - private CreativeCrafting field_147059_E; -+ private static int tabPage = 0; -+ private int maxPages = 0; - - public GuiContainerCreative(EntityPlayer p_i1088_1_) - { -@@ -258,6 +260,13 @@ - this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]); - this.field_147059_E = new CreativeCrafting(this.mc); - this.mc.thePlayer.inventoryContainer.onCraftGuiOpened(this.field_147059_E); -+ int tabCount = CreativeTabs.creativeTabArray.length; -+ if (tabCount > 12) -+ { -+ buttonList.add(new GuiButton(101, guiLeft, guiTop - 50, 20, 20, "<")); -+ buttonList.add(new GuiButton(102, guiLeft + xSize - 20, guiTop - 50, 20, 20, ">")); -+ maxPages = ((tabCount - 12) / 10) + 1; -+ } - } - else - { -@@ -279,7 +288,7 @@ - - protected void keyTyped(char typedChar, int keyCode) throws IOException - { -- if (selectedTabIndex != CreativeTabs.tabAllSearch.getTabIndex()) -+ if (!CreativeTabs.creativeTabArray[selectedTabIndex].hasSearchBar()) - { - if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)) - { -@@ -317,6 +326,14 @@ - GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; - guicontainercreative$containercreative.itemList.clear(); - -+ CreativeTabs tab = CreativeTabs.creativeTabArray[selectedTabIndex]; -+ if (tab.hasSearchBar() && tab != CreativeTabs.tabAllSearch) -+ { -+ tab.displayAllReleventItems(guicontainercreative$containercreative.itemList); -+ updateFilteredItems(guicontainercreative$containercreative); -+ return; -+ } -+ - for (Item item : Item.itemRegistry) - { - if (item != null && item.getCreativeTab() != null) -@@ -324,7 +341,13 @@ - item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList); - } - } -+ updateFilteredItems(guicontainercreative$containercreative); -+ } - -+ //split from above for custom search tabs -+ private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$containercreative) -+ { -+ if (CreativeTabs.creativeTabArray[selectedTabIndex] == CreativeTabs.tabAllSearch) // FORGE: Only add enchanted books to the regular search - for (Enchantment enchantment : Enchantment.field_185264_b) - { - if (enchantment != null && enchantment.type != null) -@@ -332,7 +355,6 @@ - Items.enchanted_book.getAll(enchantment, guicontainercreative$containercreative.itemList); - } - } -- - Iterator iterator = guicontainercreative$containercreative.itemList.iterator(); - String s1 = this.searchField.getText().toLowerCase(); - -@@ -364,7 +386,7 @@ - { - CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; - -- if (creativetabs.drawInForegroundOfTab()) -+ if (creativetabs != null && creativetabs.drawInForegroundOfTab()) - { - GlStateManager.disableBlend(); - this.fontRendererObj.drawString(I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752); -@@ -399,7 +421,7 @@ - - for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray) - { -- if (this.func_147049_a(creativetabs, i, j)) -+ if (creativetabs != null && this.func_147049_a(creativetabs, i, j)) - { - this.setCurrentCreativeTab(creativetabs); - return; -@@ -412,11 +434,13 @@ - - private boolean needsScrollBars() - { -+ if (CreativeTabs.creativeTabArray[selectedTabIndex] == null) return false; - return selectedTabIndex != CreativeTabs.tabInventory.getTabIndex() && CreativeTabs.creativeTabArray[selectedTabIndex].shouldHidePlayerInventory() && ((GuiContainerCreative.ContainerCreative)this.inventorySlots).func_148328_e(); - } - - private void setCurrentCreativeTab(CreativeTabs p_147050_1_) - { -+ if (p_147050_1_ == null) return; - int i = selectedTabIndex; - selectedTabIndex = p_147050_1_.getTabIndex(); - GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; -@@ -487,12 +511,14 @@ - - if (this.searchField != null) - { -- if (p_147050_1_ == CreativeTabs.tabAllSearch) -+ if (p_147050_1_.hasSearchBar()) - { - this.searchField.setVisible(true); - this.searchField.setCanLoseFocus(false); - this.searchField.setFocused(true); - this.searchField.setText(""); -+ this.searchField.width = p_147050_1_.getSearchbarWidth(); -+ this.searchField.xPosition = this.guiLeft + (82 /*default left*/ + 89 /*default width*/) - this.searchField.width; - this.updateCreativeSearch(); - } - else -@@ -562,20 +588,43 @@ - } - - super.drawScreen(mouseX, mouseY, partialTicks); -+ int start = tabPage * 10; -+ int end = Math.min(CreativeTabs.creativeTabArray.length, ((tabPage + 1) * 10) + 2); -+ if (tabPage != 0) start += 2; -+ boolean rendered = false; - -- for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray) -+ for (CreativeTabs creativetabs : java.util.Arrays.copyOfRange(CreativeTabs.creativeTabArray,start,end)) - { -+ if (creativetabs == null) continue; - if (this.renderCreativeInventoryHoveringText(creativetabs, mouseX, mouseY)) - { -+ rendered = true; - break; - } - } - -+ if (!rendered && renderCreativeInventoryHoveringText(CreativeTabs.tabAllSearch, mouseX, mouseY)) -+ { -+ renderCreativeInventoryHoveringText(CreativeTabs.tabInventory, mouseX, mouseY); -+ } -+ - if (this.field_147064_C != null && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex() && this.isPointInRegion(this.field_147064_C.xDisplayPosition, this.field_147064_C.yDisplayPosition, 16, 16, mouseX, mouseY)) - { - this.drawCreativeTabHoveringText(I18n.format("inventory.binSlot", new Object[0]), mouseX, mouseY); - } - -+ if (maxPages != 0) -+ { -+ String page = String.format("%d / %d", tabPage + 1, maxPages + 1); -+ int width = fontRendererObj.getStringWidth(page); -+ GlStateManager.disableLighting(); -+ this.zLevel = 300.0F; -+ itemRender.zLevel = 300.0F; -+ fontRendererObj.drawString(page, guiLeft + (xSize / 2) - (width / 2), guiTop - 44, -1); -+ this.zLevel = 0.0F; -+ itemRender.zLevel = 0.0F; -+ } -+ - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.disableLighting(); - } -@@ -637,16 +686,35 @@ - RenderHelper.enableGUIStandardItemLighting(); - CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; - -- for (CreativeTabs creativetabs1 : CreativeTabs.creativeTabArray) -+ int start = tabPage * 10; -+ int end = Math.min(CreativeTabs.creativeTabArray.length, ((tabPage + 1) * 10 + 2)); -+ if (tabPage != 0) start += 2; -+ -+ for (CreativeTabs creativetabs1 : java.util.Arrays.copyOfRange(CreativeTabs.creativeTabArray,start,end)) - { - this.mc.getTextureManager().bindTexture(creativeInventoryTabs); - -+ if (creativetabs1 == null) continue; - if (creativetabs1.getTabIndex() != selectedTabIndex) - { - this.func_147051_a(creativetabs1); - } - } - -+ if (tabPage != 0) -+ { -+ if (creativetabs != CreativeTabs.tabAllSearch) -+ { -+ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); -+ func_147051_a(CreativeTabs.tabAllSearch); -+ } -+ if (creativetabs != CreativeTabs.tabInventory) -+ { -+ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); -+ func_147051_a(CreativeTabs.tabInventory); -+ } -+ } -+ - this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName())); - this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); - this.searchField.drawTextBox(); -@@ -661,6 +729,14 @@ - this.drawTexturedModalRect(i, j + (int)((float)(k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); - } - -+ if (creativetabs == null || creativetabs.getTabPage() != tabPage) -+ { -+ if (creativetabs != CreativeTabs.tabAllSearch && creativetabs != CreativeTabs.tabInventory) -+ { -+ return; -+ } -+ } -+ - this.func_147051_a(creativetabs); - - if (creativetabs == CreativeTabs.tabInventory) -@@ -671,6 +747,14 @@ - - protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) - { -+ if (p_147049_1_.getTabPage() != tabPage) -+ { -+ if (p_147049_1_ != CreativeTabs.tabAllSearch && p_147049_1_ != CreativeTabs.tabInventory) -+ { -+ return false; -+ } -+ } -+ - int i = p_147049_1_.getTabColumn(); - int j = 28 * i; - int k = 0; -@@ -767,6 +851,8 @@ - } - - GlStateManager.disableLighting(); -+ GlStateManager.color(1F, 1F, 1F); //Forge: Reset color in case Items change it. -+ GlStateManager.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border. - this.drawTexturedModalRect(l, i1, j, k, 28, j1); - this.zLevel = 100.0F; - this.itemRender.zLevel = 100.0F; -@@ -793,6 +879,15 @@ - { - this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); - } -+ -+ if (button.id == 101) -+ { -+ tabPage = Math.max(tabPage - 1, 0); -+ } -+ else if (button.id == 102) -+ { -+ tabPage = Math.min(tabPage + 1, maxPages); -+ } - } - - public int getSelectedTabIndex() diff --git a/patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch deleted file mode 100644 index 4f3c8aede2..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/ModelBase.java -+++ ../src-work/minecraft/net/minecraft/client/model/ModelBase.java -@@ -10,7 +10,6 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public abstract class ModelBase - { - public float swingProgress; diff --git a/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch deleted file mode 100644 index 5cacc5fd41..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/ModelBox.java -+++ ../src-work/minecraft/net/minecraft/client/model/ModelBox.java -@@ -4,7 +4,6 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public class ModelBox - { - private PositionTextureVertex[] vertexPositions; -@@ -81,6 +80,7 @@ - } - } - -+ @SideOnly(Side.CLIENT) - public void render(VertexBuffer renderer, float scale) - { - for (int i = 0; i < this.quadList.length; ++i) diff --git a/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch deleted file mode 100644 index 5e9ccffa83..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/ModelRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/model/ModelRenderer.java -@@ -9,7 +9,6 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public class ModelRenderer - { - public float textureWidth; -@@ -108,6 +107,7 @@ - this.rotationPointZ = rotationPointZIn; - } - -+ @SideOnly(Side.CLIENT) - public void render(float p_78785_1_) - { - if (!this.isHidden) -@@ -189,6 +189,7 @@ - } - } - -+ @SideOnly(Side.CLIENT) - public void renderWithRotation(float p_78791_1_) - { - if (!this.isHidden) -@@ -224,6 +225,7 @@ - } - } - -+ @SideOnly(Side.CLIENT) - public void postRender(float scale) - { - if (!this.isHidden) -@@ -265,6 +267,7 @@ - } - } - -+ @SideOnly(Side.CLIENT) - private void compileDisplayList(float scale) - { - this.displayList = GLAllocation.generateDisplayLists(1); diff --git a/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch deleted file mode 100644 index 1552e73aa0..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/PositionTextureVertex.java -+++ ../src-work/minecraft/net/minecraft/client/model/PositionTextureVertex.java -@@ -1,10 +1,7 @@ - package net.minecraft.client.model; - - import net.minecraft.util.math.Vec3d; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public class PositionTextureVertex - { - public Vec3d vector3D; diff --git a/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch deleted file mode 100644 index 1048fc20ce..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/TexturedQuad.java -+++ ../src-work/minecraft/net/minecraft/client/model/TexturedQuad.java -@@ -7,7 +7,6 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public class TexturedQuad - { - public PositionTextureVertex[] vertexPositions; -@@ -43,6 +42,7 @@ - this.vertexPositions = apositiontexturevertex; - } - -+ @SideOnly(Side.CLIENT) - public void draw(VertexBuffer renderer, float scale) - { - Vec3d vec3d = this.vertexPositions[1].vector3D.subtractReverse(this.vertexPositions[0].vector3D); diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch deleted file mode 100644 index 2fbae2903d..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java -@@ -52,6 +52,7 @@ - Chunk chunk = new Chunk(this.worldObj, p_73158_1_, p_73158_2_); - this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_), chunk); - this.chunkListing.add(chunk); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); - chunk.setChunkLoaded(true); - return chunk; - } diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch deleted file mode 100644 index 8a4f63a24c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java -@@ -67,7 +67,7 @@ - inetaddress = InetAddress.getByName(ip); - GuiConnecting.this.networkManager = NetworkManager.func_181124_a(inetaddress, port, GuiConnecting.this.mc.gameSettings.func_181148_f()); - GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen)); -- GuiConnecting.this.networkManager.sendPacket(new C00Handshake(107, ip, port, EnumConnectionState.LOGIN)); -+ GuiConnecting.this.networkManager.sendPacket(new C00Handshake(107, ip, port, EnumConnectionState.LOGIN, true)); - GuiConnecting.this.networkManager.sendPacket(new CPacketLoginStart(GuiConnecting.this.mc.getSession().getProfile())); - } - catch (UnknownHostException unknownhostexception) diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch deleted file mode 100644 index f19ab2b404..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ /dev/null @@ -1,93 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java -@@ -121,6 +121,12 @@ - } - } - -+ ItemStack stack = mc.thePlayer.func_184614_ca(); -+ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, p_187103_1_, mc.thePlayer)) -+ { -+ return false; -+ } -+ - if (this.currentGameType.isCreative() && this.mc.thePlayer.func_184614_ca() != null && this.mc.thePlayer.func_184614_ca().getItem() instanceof ItemSword) - { - return false; -@@ -142,14 +148,7 @@ - else - { - world.playAuxSFX(2001, p_187103_1_, Block.getStateId(iblockstate)); -- block.onBlockHarvested(world, p_187103_1_, iblockstate, this.mc.thePlayer); -- boolean flag = world.setBlockState(p_187103_1_, Blocks.air.getDefaultState(), 11); - -- if (flag) -- { -- block.onBlockDestroyedByPlayer(world, p_187103_1_, iblockstate); -- } -- - this.currentBlock = new BlockPos(this.currentBlock.getX(), -1, this.currentBlock.getZ()); - - if (!this.currentGameType.isCreative()) -@@ -160,13 +159,20 @@ - { - itemstack1.onBlockDestroyed(world, iblockstate, p_187103_1_, this.mc.thePlayer); - -- if (itemstack1.stackSize == 0) -+ if (itemstack1.stackSize <= 0) - { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.mc.thePlayer, itemstack1, EnumHand.MAIN_HAND); - this.mc.thePlayer.func_184611_a(EnumHand.MAIN_HAND, (ItemStack)null); - } - } - } - -+ boolean flag = block.removedByPlayer(iblockstate, world, p_187103_1_, mc.thePlayer, false); -+ -+ if (flag) -+ { -+ block.onBlockDestroyedByPlayer(world, p_187103_1_, iblockstate); -+ } - return flag; - } - } -@@ -373,11 +379,15 @@ - { - if (this.currentGameType != WorldSettings.GameType.SPECTATOR) - { -+ net.minecraft.item.Item item = p_187099_3_ == null ? null : p_187099_3_.getItem(); -+ EnumActionResult ret = item == null ? EnumActionResult.PASS : item.onItemUseFirst(p_187099_3_, p_187099_1_, p_187099_2_, p_187099_4_, p_187099_5_, f, f1, f2, p_187099_7_); -+ if (ret != EnumActionResult.PASS) return ret; -+ - IBlockState iblockstate = p_187099_2_.getBlockState(p_187099_4_); - -- if ((!p_187099_1_.isSneaking() || p_187099_1_.func_184614_ca() == null && p_187099_1_.func_184592_cb() == null) && iblockstate.getBlock().onBlockActivated(p_187099_2_, p_187099_4_, iblockstate, p_187099_1_, p_187099_7_, p_187099_3_, p_187099_5_, f, f1, f2)) -+ if ((!p_187099_1_.isSneaking() || (p_187099_1_.func_184614_ca() == null || item.doesSneakBypassUse(p_187099_3_, p_187099_2_, p_187099_4_, p_187099_1_)) && p_187099_1_.func_184592_cb() == null)) - { -- flag = true; -+ flag = iblockstate.getBlock().onBlockActivated(p_187099_2_, p_187099_4_, iblockstate, p_187099_1_, p_187099_7_, p_187099_3_, p_187099_5_, f, f1, f2); - } - - if (!flag && p_187099_3_ != null && p_187099_3_.getItem() instanceof ItemBlock) -@@ -418,7 +428,9 @@ - } - else - { -- return p_187099_3_.onItemUse(p_187099_1_, p_187099_2_, p_187099_4_, p_187099_7_, p_187099_5_, f, f1, f2); -+ EnumActionResult ret = p_187099_3_.onItemUse(p_187099_1_, p_187099_2_, p_187099_4_, p_187099_7_, p_187099_5_, f, f1, f2); -+ if (p_187099_3_.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187099_1_, p_187099_3_, p_187099_7_); -+ return ret; - } - } - else -@@ -453,9 +465,10 @@ - { - p_187101_1_.func_184611_a(p_187101_4_, itemstack); - -- if (itemstack.stackSize == 0) -+ if (itemstack.stackSize <= 0) - { - p_187101_1_.func_184611_a(p_187101_4_, (ItemStack)null); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187101_1_, itemstack, p_187101_4_); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch deleted file mode 100644 index 2d73af7075..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java -@@ -63,12 +63,13 @@ - this.field_184157_a = Sets.newHashSet(); - this.sendQueue = p_i45063_1_; - this.getWorldInfo().setDifficulty(p_i45063_4_); -- this.setSpawnPoint(new BlockPos(8, 64, 8)); - this.provider.registerWorld(this); -+ this.setSpawnPoint(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect. - this.chunkProvider = this.createChunkProvider(); - this.mapStorage = new SaveDataMemoryStorage(); - this.calculateInitialSkylight(); - this.calculateInitialWeather(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this)); - } - - public void tick() diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch deleted file mode 100644 index e1acbc07d3..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java -+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java -@@ -23,6 +23,7 @@ - - public void processHandshake(C00Handshake packetIn) - { -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; - this.networkManager.setConnectionState(packetIn.getRequestedState()); - this.networkManager.setNetHandler(new NetHandlerLoginServer(this.mcServer, this.networkManager)); - } diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch deleted file mode 100644 index 2aff2e5ca0..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java -+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java -@@ -106,7 +106,10 @@ - { - this.gameProfile = packetIn.getProfile(); - this.networkManager.setConnectionState(EnumConnectionState.PLAY); -- this.networkManager.setNetHandler(new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile)); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlClientHandshake(this.networkManager); -+ NetHandlerPlayClient nhpc = new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile); -+ this.networkManager.setNetHandler(nhpc); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().setPlayClient(nhpc); - } - - public void onDisconnect(ITextComponent reason) diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch deleted file mode 100644 index fcb57fff8a..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java -+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java -@@ -267,7 +267,7 @@ - { - PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); - this.gameController.playerController = new PlayerControllerMP(this.gameController, this); -- this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler); -+ this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(getNetworkManager()).getOverrideDimension(packetIn), packetIn.getDifficulty(), this.gameController.mcProfiler); - this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); - this.gameController.loadWorld(this.clientWorldController); - this.gameController.thePlayer.dimension = packetIn.getDimension(); -@@ -785,14 +785,16 @@ - public void handleChat(SPacketChat packetIn) - { - PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); -+ net.minecraft.util.text.ITextComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(packetIn.getType(), packetIn.getChatComponent()); -+ if (message == null) return; - - if (packetIn.getType() == 2) - { -- this.gameController.ingameGUI.setRecordPlaying(packetIn.getChatComponent(), false); -+ this.gameController.ingameGUI.setRecordPlaying(message, false); - } - else - { -- this.gameController.ingameGUI.getChatGUI().printChatMessage(packetIn.getChatComponent()); -+ this.gameController.ingameGUI.getChatGUI().printChatMessage(message); - } - } - -@@ -848,6 +850,11 @@ - float f = (float)(packetIn.getYaw() * 360) / 256.0F; - float f1 = (float)(packetIn.getPitch() * 360) / 256.0F; - EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.getEntityType(), this.gameController.theWorld); -+ if (entitylivingbase == null) -+ { -+ net.minecraftforge.fml.common.FMLLog.info("Server attempted to spawn an unknown entity using ID: {0} at ({1}, {2}, {3}) Skipping!", packetIn.getEntityType(), d0, d1, d2); -+ return; -+ } - EntityTracker.func_187254_a(entitylivingbase, d0, d1, d2); - entitylivingbase.renderYawOffset = entitylivingbase.rotationYawHead = (float)(packetIn.getHeadPitch() * 360) / 256.0F; - Entity[] aentity = entitylivingbase.getParts(); -@@ -1179,6 +1186,10 @@ - { - tileentity.readFromNBT(packetIn.getNbtCompound()); - } -+ else -+ { -+ tileentity.onDataPacket(netManager, packetIn); -+ } - - if (flag && this.gameController.currentScreen instanceof GuiCommandBlock) - { -@@ -1378,7 +1389,7 @@ - - if (entity instanceof EntityLivingBase) - { -- Potion potion = Potion.func_188412_a(packetIn.getEffectId()); -+ Potion potion = Potion.func_188412_a(packetIn.getEffectId() & 0xFF); - - if (potion != null) - { diff --git a/patches.mcp/minecraft/net/minecraft/client/network/ServerPinger.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/ServerPinger.java.patch deleted file mode 100644 index 9323892313..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/network/ServerPinger.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/network/ServerPinger.java -+++ ../src-work/minecraft/net/minecraft/client/network/ServerPinger.java -@@ -150,6 +150,7 @@ - server.setBase64EncodedIconData((String)null); - } - -+ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(server, serverstatusresponse); - this.field_175092_e = Minecraft.getSystemTime(); - networkmanager.sendPacket(new CPacketPing(this.field_175092_e)); - this.field_147403_d = true; diff --git a/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch deleted file mode 100644 index b41676c704..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java -@@ -3,6 +3,9 @@ - import com.google.common.collect.Lists; - import com.google.common.collect.Maps; - import com.google.common.collect.Queues; -+ -+import akka.actor.FSM.State; -+ - import java.util.ArrayDeque; - import java.util.Iterator; - import java.util.List; -@@ -143,6 +146,7 @@ - - public void addEffect(EntityFX effect) - { -+ if (effect == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs. - this.field_187241_h.add(effect); - } - -@@ -376,7 +380,7 @@ - - public void addBlockDestroyEffects(BlockPos pos, IBlockState state) - { -- if (state.func_185904_a() != Material.air) -+ if (state.getBlock().isAir(state, worldObj, pos) && !state.getBlock().addDestroyEffects(worldObj, pos, this)) - { - state = state.func_185899_b(this.worldObj, pos); - int i = 4; -@@ -460,4 +464,13 @@ - - return "" + i; - } -+ -+ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.math.RayTraceResult target) -+ { -+ IBlockState state = worldObj.getBlockState(pos); -+ if (state != null && !state.getBlock().addHitEffects(state, worldObj, target, this)) -+ { -+ addBlockHitEffects(pos, target.sideHit); -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch deleted file mode 100644 index 6ff9d53b7f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelShapes.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelShapes.java -@@ -307,5 +307,6 @@ - return new ModelResourceLocation(s + "_double_slab", s1); - } - }); -+ net.minecraftforge.client.model.ModelLoader.onRegisterAllBlocks(this); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch deleted file mode 100644 index 527de782ee..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java -@@ -29,7 +29,7 @@ - public BlockRendererDispatcher(BlockModelShapes p_i46577_1_, BlockColors p_i46577_2_) - { - this.blockModelShapes = p_i46577_1_; -- this.blockModelRenderer = new BlockModelRenderer(p_i46577_2_); -+ this.blockModelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(p_i46577_2_); - this.fluidRenderer = new BlockFluidRenderer(p_i46577_2_); - } - -@@ -44,7 +44,7 @@ - { - state = state.func_185899_b(blockAccess, pos); - IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(state); -- IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(state, ibakedmodel, texture, pos)).makeBakedModel(); -+ IBakedModel ibakedmodel1 = net.minecraftforge.client.ForgeHooksClient.getDamageModel(ibakedmodel, texture, state, blockAccess, pos); - this.blockModelRenderer.renderModel(blockAccess, ibakedmodel1, state, pos, Tessellator.getInstance().getWorldRenderer(), true); - } - } -@@ -76,7 +76,9 @@ - switch (enumblockrendertype) - { - case MODEL: -- return this.blockModelRenderer.renderModel(blockAccess, this.func_184389_a(state), state, pos, worldRendererIn, true); -+ IBakedModel model = this.func_184389_a(state); -+ state = state.getBlock().getExtendedState(state, blockAccess, pos); -+ return this.blockModelRenderer.renderModel(blockAccess, model, state, pos, worldRendererIn, true); - case ENTITYBLOCK_ANIMATED: - return false; - case LIQUID: diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch deleted file mode 100644 index d19583066d..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ /dev/null @@ -1,191 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java -@@ -207,6 +207,7 @@ - { - this.loadShader(new ResourceLocation("shaders/post/invert.json")); - } -+ else net.minecraftforge.client.ForgeHooksClient.loadEntityShader(entityIn, this); - } - } - -@@ -398,7 +399,7 @@ - - if (d3 < d2 || d2 == 0.0D) - { -- if (entity1.func_184208_bv() == entity.func_184208_bv()) -+ if (entity1.func_184208_bv() == entity.func_184208_bv() && !entity.canRiderInteract()) - { - if (d2 == 0.0D) - { -@@ -491,7 +492,7 @@ - f = f * 60.0F / 70.0F; - } - -- return f; -+ return net.minecraftforge.client.ForgeHooksClient.getFOVModifier(this, entity, iblockstate, partialTicks, f); - } - } - -@@ -555,14 +556,8 @@ - { - BlockPos blockpos = new BlockPos(entity); - IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); -- Block block = iblockstate.getBlock(); -+ net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.mc.theWorld, blockpos, iblockstate, entity); - -- if (block == Blocks.bed) -- { -- int j = ((EnumFacing)iblockstate.getValue(BlockBed.field_185512_D)).getHorizontalIndex(); -- GlStateManager.rotate((float)(j * 90), 0.0F, 1.0F, 0.0F); -- } -- - GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, -1.0F, 0.0F); - GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, -1.0F, 0.0F, 0.0F); - } -@@ -629,17 +624,20 @@ - - if (!this.mc.gameSettings.debugCamEnable) - { -- GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 1.0F, 0.0F, 0.0F); -- -+ float yaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F; -+ float pitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks; -+ float roll = 0.0F; - if (entity instanceof EntityAnimal) - { - EntityAnimal entityanimal = (EntityAnimal)entity; -- GlStateManager.rotate(entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); -+ yaw = entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * partialTicks + 180.0F; - } -- else -- { -- GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); -- } -+ IBlockState state = ActiveRenderInfo.func_186703_a(this.mc.theWorld, entity, partialTicks); -+ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, state, partialTicks, yaw, pitch, roll); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ GlStateManager.rotate(event.roll, 0.0F, 0.0F, 1.0F); -+ GlStateManager.rotate(event.pitch, 1.0F, 0.0F, 0.0F); -+ GlStateManager.rotate(event.yaw, 0.0F, 1.0F, 0.0F); - } - - GlStateManager.translate(0.0F, -f, 0.0F); -@@ -757,6 +755,7 @@ - - boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); - -+ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(mc.renderGlobal, partialTicks, xOffset)) - if (this.mc.gameSettings.thirdPersonView == 0 && !flag && !this.mc.gameSettings.hideGUI && !this.mc.playerController.isSpectator()) - { - this.enableLightmap(); -@@ -1092,7 +1091,7 @@ - - try - { -- this.mc.currentScreen.drawScreen(k1, l1, p_181560_1_); -+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.mc.currentScreen, k1, l1, p_181560_1_); - } - catch (Throwable throwable) - { -@@ -1187,7 +1186,7 @@ - - if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR) - { -- flag = block.hasTileEntity() && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; -+ flag = block.hasTileEntity(this.mc.theWorld.getBlockState(blockpos)) && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; - } - else - { -@@ -1312,7 +1311,9 @@ - GlStateManager.pushMatrix(); - RenderHelper.enableStandardItemLighting(); - this.mc.mcProfiler.endStartSection("entities"); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); - renderglobal.renderEntities(entity, icamera, partialTicks); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); - RenderHelper.disableStandardItemLighting(); - this.disableLightmap(); - } -@@ -1325,6 +1326,7 @@ - EntityPlayer entityplayer = (EntityPlayer)entity; - GlStateManager.disableAlpha(); - this.mc.mcProfiler.endStartSection("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, partialTicks)) - renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); - GlStateManager.enableAlpha(); - } -@@ -1366,6 +1368,17 @@ - GlStateManager.shadeModel(7425); - this.mc.mcProfiler.endStartSection("translucent"); - renderglobal.renderBlockLayer(BlockRenderLayer.TRANSLUCENT, (double)partialTicks, pass, entity); -+ if (!this.debugView) //Only render if render pass 0 happens as well. -+ { -+ RenderHelper.enableStandardItemLighting(); -+ this.mc.mcProfiler.endStartSection("entities"); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); -+ renderglobal.renderEntities(entity, icamera, partialTicks); -+ // restore blending function changed by RenderGlobal.preRenderDamagedBlocks -+ GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); -+ RenderHelper.disableStandardItemLighting(); -+ } - GlStateManager.shadeModel(7424); - GlStateManager.depthMask(true); - GlStateManager.enableCull(); -@@ -1378,6 +1391,9 @@ - this.renderCloudsCheck(renderglobal, partialTicks, pass); - } - -+ this.mc.mcProfiler.endStartSection("forge_render_last"); -+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(renderglobal, partialTicks); -+ - this.mc.mcProfiler.endStartSection("hand"); - - if (this.renderHand) -@@ -1490,6 +1506,13 @@ - - protected void renderRainSnow(float partialTicks) - { -+ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getWeatherRenderer(); -+ if (renderer != null) -+ { -+ renderer.render(partialTicks, this.mc.theWorld, mc); -+ return; -+ } -+ - float f = this.mc.theWorld.getRainStrength(partialTicks); - - if (f > 0.0F) -@@ -1820,6 +1843,13 @@ - this.fogColorBlue = f7; - } - -+ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, iblockstate, partialTicks, this.fogColorRed, this.fogColorGreen, this.fogColorBlue); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ -+ this.fogColorRed = event.red; -+ this.fogColorGreen = event.green; -+ this.fogColorBlue = event.blue; -+ - GlStateManager.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); - } - -@@ -1830,7 +1860,9 @@ - GlStateManager.func_187432_a(0.0F, -1.0F, 0.0F); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - IBlockState iblockstate = ActiveRenderInfo.func_186703_a(this.mc.theWorld, entity, partialTicks); -- -+ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, iblockstate, partialTicks, 0.1F); -+ if (hook >= 0) GlStateManager.setFogDensity(hook); -+ else - if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(MobEffects.blindness)) - { - float f1 = 5.0F; -@@ -1915,6 +1947,7 @@ - GlStateManager.setFogStart(f * 0.05F); - GlStateManager.setFogEnd(Math.min(f, 192.0F) * 0.5F); - } -+ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, iblockstate, partialTicks, p_78468_1_, f); - } - - GlStateManager.enableColorMaterial(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch deleted file mode 100644 index 2ac9eee595..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java -@@ -28,7 +28,12 @@ - - protected void updateActivePotionEffects() - { -- if (!this.mc.thePlayer.getActivePotionEffects().isEmpty()) -+ boolean hasVisibleEffect = false; -+ for(PotionEffect potioneffect : this.mc.thePlayer.getActivePotionEffects()) { -+ Potion potion = potioneffect.func_188419_a(); -+ if(potion.shouldRender(potioneffect)) { hasVisibleEffect = true; break; } -+ } -+ if (!this.mc.thePlayer.getActivePotionEffects().isEmpty() && hasVisibleEffect) - { - this.guiLeft = 160 + (this.width - this.xSize - 200) / 2; - this.hasActivePotionEffects = true; -@@ -71,6 +76,7 @@ - for (PotionEffect potioneffect : Ordering.natural().sortedCopy(collection)) - { - Potion potion = potioneffect.func_188419_a(); -+ if(!potion.shouldRender(potioneffect)) continue; - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(inventoryBackground); - this.drawTexturedModalRect(i, j, 0, 166, 140, 32); -@@ -81,6 +87,8 @@ - this.drawTexturedModalRect(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18); - } - -+ potion.renderInventoryEffect(i, j, potioneffect, mc); -+ if (!potion.shouldRenderInvText(potioneffect)) { j += l; continue; } - String s1 = I18n.format(potion.getName(), new Object[0]); - - if (potioneffect.getAmplifier() == 1) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch deleted file mode 100644 index 2870d8d283..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/ItemModelMesher.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/ItemModelMesher.java -@@ -32,7 +32,9 @@ - - public TextureAtlasSprite getParticleIcon(Item item, int meta) - { -- return this.getItemModel(new ItemStack(item, 1, meta)).getParticleTexture(); -+ ItemStack stack = new ItemStack(item, 1, meta); -+ IBakedModel model = this.getItemModel(stack); -+ return model.func_188617_f().handleItemState(model, stack, null, null).getParticleTexture(); - } - - public IBakedModel getItemModel(ItemStack stack) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch deleted file mode 100644 index ec372f4e72..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java -@@ -360,7 +360,7 @@ - this.func_187456_a(p_187457_7_, p_187457_5_, enumhandside); - } - } -- else if (p_187457_6_.getItem() == Items.filled_map) -+ else if (p_187457_6_.getItem() instanceof net.minecraft.item.ItemMap) - { - if (flag && this.field_187468_e == null) - { -@@ -444,6 +444,7 @@ - if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) - { - IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer)); -+ BlockPos overlayPos = new BlockPos(this.mc.thePlayer); - EntityPlayer entityplayer = this.mc.thePlayer; - - for (int i = 0; i < 8; ++i) -@@ -457,11 +458,13 @@ - if (iblockstate1.getBlock().isVisuallyOpaque()) - { - iblockstate = iblockstate1; -+ overlayPos = blockpos; - } - } - - if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, partialTicks, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, overlayPos)) - this.func_178108_a(partialTicks, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); - } - } -@@ -470,11 +473,13 @@ - { - if (this.mc.thePlayer.isInsideOfMaterial(Material.water)) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(mc.thePlayer, partialTicks)) - this.renderWaterOverlayTexture(partialTicks); - } - - if (this.mc.thePlayer.isBurning()) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderFireOverlay(mc.thePlayer, partialTicks)) - this.renderFireInFirstPerson(partialTicks); - } - } -@@ -596,8 +601,8 @@ - else - { - float f = entityplayersp.func_184825_o(1.0F); -- this.field_187469_f += MathHelper.clamp_float((Objects.equal(this.field_187467_d, itemstack) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); -- this.field_187471_h += MathHelper.clamp_float((float)(Objects.equal(this.field_187468_e, itemstack1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); -+ this.field_187469_f += MathHelper.clamp_float((net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187467_d, itemstack, entityplayersp.inventory.currentItem) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); -+ this.field_187471_h += MathHelper.clamp_float((float)(net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187468_e, itemstack1, -1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); - } - - if (this.field_187469_f < 0.1F) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch deleted file mode 100644 index 4dddb26481..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java -@@ -92,6 +92,10 @@ - public static int GL_ARRAY_BUFFER; - public static int GL_STATIC_DRAW; - -+ /* Stores the last values sent into setLightmapTextureCoords */ -+ public static float lastBrightnessX = 0.0f; -+ public static float lastBrightnessY = 0.0f; -+ - public static void initializeTextures() - { - ContextCapabilities contextcapabilities = GLContext.getCapabilities(); -@@ -852,6 +856,12 @@ - { - GL13.glMultiTexCoord2f(target, p_77475_1_, p_77475_2_); - } -+ -+ if (target == lightmapTexUnit) -+ { -+ lastBrightnessX = p_77475_1_; -+ lastBrightnessY = p_77475_2_; -+ } - } - - public static void glBlendFunc(int sFactorRGB, int dFactorRGB, int sfactorAlpha, int dfactorAlpha) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch deleted file mode 100644 index ed75c81f4d..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ /dev/null @@ -1,127 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/RenderGlobal.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java -@@ -547,8 +547,10 @@ - - public void renderEntities(Entity renderViewEntity, ICamera camera, float partialTicks) - { -+ int pass = net.minecraftforge.client.MinecraftForgeClient.getRenderPass(); - if (this.renderEntitiesStartupCounter > 0) - { -+ if (pass > 0) return; - --this.renderEntitiesStartupCounter; - } - else -@@ -559,9 +561,12 @@ - this.theWorld.theProfiler.startSection("prepare"); - TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), partialTicks); - this.renderManager.cacheActiveRenderInfo(this.theWorld, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks); -+ if(pass == 0) -+ { - this.countEntitiesTotal = 0; - this.countEntitiesRendered = 0; - this.countEntitiesHidden = 0; -+ } - Entity entity = this.mc.getRenderViewEntity(); - double d3 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; - double d4 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; -@@ -573,11 +578,15 @@ - this.mc.entityRenderer.enableLightmap(); - this.theWorld.theProfiler.endStartSection("global"); - List list = this.theWorld.getLoadedEntityList(); -+ if (pass == 0) -+ { - this.countEntitiesTotal = list.size(); -+ } - - for (int i = 0; i < this.theWorld.weatherEffects.size(); ++i) - { - Entity entity1 = (Entity)this.theWorld.weatherEffects.get(i); -+ if (!entity1.shouldRenderInPass(pass)) continue; - ++this.countEntitiesRendered; - - if (entity1.isInRangeToRender3d(d0, d1, d2)) -@@ -599,6 +608,7 @@ - { - for (Entity entity2 : classinheritancemultimap) - { -+ if(!entity2.shouldRenderInPass(pass)) continue; - boolean flag = this.renderManager.shouldRender(entity2, camera, d0, d1, d2) || entity2.func_184215_y(this.mc.thePlayer); - - if (flag) -@@ -672,6 +682,7 @@ - this.theWorld.theProfiler.endStartSection("blockentities"); - RenderHelper.enableStandardItemLighting(); - -+ TileEntityRendererDispatcher.instance.preDrawBatch(); - for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 : this.renderInfos) - { - List list3 = renderglobal$containerlocalrenderinformation1.renderChunk.getCompiledChunk().getTileEntities(); -@@ -680,6 +691,7 @@ - { - for (TileEntity tileentity2 : list3) - { -+ if (!tileentity2.shouldRenderInPass(pass) || !camera.isBoundingBoxInFrustum(tileentity2.getRenderBoundingBox())) continue; - TileEntityRendererDispatcher.instance.renderTileEntity(tileentity2, partialTicks, -1); - } - } -@@ -689,9 +701,11 @@ - { - for (TileEntity tileentity : this.setTileEntities) - { -+ if (!tileentity.shouldRenderInPass(pass) || !camera.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) continue; - TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, -1); - } - } -+ TileEntityRendererDispatcher.instance.drawBatch(pass); - - this.preRenderDamagedBlocks(); - -@@ -718,7 +732,7 @@ - - Block block = this.theWorld.getBlockState(blockpos).getBlock(); - -- if (tileentity1 != null && (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull)) -+ if (tileentity1 != null && tileentity1.shouldRenderInPass(pass) && tileentity1.canRenderBreaking() && camera.isBoundingBoxInFrustum(tileentity1.getRenderBoundingBox())) - { - TileEntityRendererDispatcher.instance.renderTileEntity(tileentity1, partialTicks, destroyblockprogress.getPartialBlockDamage()); - } -@@ -1210,6 +1224,13 @@ - - public void renderSky(float partialTicks, int pass) - { -+ net.minecraftforge.client.IRenderHandler renderer = this.theWorld.provider.getSkyRenderer(); -+ if (renderer != null) -+ { -+ renderer.render(partialTicks, theWorld, mc); -+ return; -+ } -+ - if (this.mc.theWorld.provider.func_186058_p().func_186068_a() == 1) - { - this.renderSkyEnd(); -@@ -1427,6 +1448,12 @@ - - public void renderClouds(float partialTicks, int pass) - { -+ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getCloudRenderer(); -+ if (renderer != null) -+ { -+ renderer.render(partialTicks, this.mc.theWorld, mc); -+ return; -+ } - if (this.mc.theWorld.provider.isSurfaceWorld()) - { - if (this.mc.gameSettings.func_181147_e() == 2) -@@ -1854,8 +1881,11 @@ - double d4 = (double)blockpos.getY() - d1; - double d5 = (double)blockpos.getZ() - d2; - Block block = this.theWorld.getBlockState(blockpos).getBlock(); -+ TileEntity te = this.theWorld.getTileEntity(blockpos); -+ boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull; -+ if (!hasBreak) hasBreak = te != null && te.canRenderBreaking(); - -- if (!(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull)) -+ if (!hasBreak) - { - if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) - { diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch deleted file mode 100644 index 4b085ab179..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch +++ /dev/null @@ -1,97 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/RenderItem.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/RenderItem.java -@@ -71,7 +71,7 @@ - public RenderItem(TextureManager p_i46552_1_, ModelManager p_i46552_2_, ItemColors p_i46552_3_) - { - this.textureManager = p_i46552_1_; -- this.itemModelMesher = new ItemModelMesher(p_i46552_2_); -+ this.itemModelMesher = new net.minecraftforge.client.ItemModelMesherForge(p_i46552_2_); - this.registerItems(); - this.field_184395_f = p_i46552_3_; - } -@@ -223,7 +223,7 @@ - k = k | -16777216; - } - -- this.renderQuad(renderer, bakedquad, k); -+ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, k); - } - } - -@@ -245,17 +245,7 @@ - public IBakedModel func_184393_a(ItemStack p_184393_1_, World p_184393_2_, EntityLivingBase p_184393_3_) - { - IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(p_184393_1_); -- Item item = p_184393_1_.getItem(); -- -- if (item != null && item.func_185040_i()) -- { -- ResourceLocation resourcelocation = ibakedmodel.func_188617_f().func_188021_a(p_184393_1_, p_184393_2_, p_184393_3_); -- return resourcelocation == null ? ibakedmodel : this.itemModelMesher.getModelManager().getModel(new ModelResourceLocation(resourcelocation, "inventory")); -- } -- else -- { -- return ibakedmodel; -- } -+ return ibakedmodel.func_188617_f().handleItemState(ibakedmodel, p_184393_1_, p_184393_2_, p_184393_3_); - } - - public void func_184392_a(ItemStack p_184392_1_, EntityLivingBase p_184392_2_, ItemCameraTransforms.TransformType p_184392_3_, boolean p_184392_4_) -@@ -279,14 +269,9 @@ - GlStateManager.enableBlend(); - GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.pushMatrix(); -- ItemCameraTransforms itemcameratransforms = p_184394_2_.getItemCameraTransforms(); -- ItemCameraTransforms.func_188034_a(itemcameratransforms.getTransform(p_184394_3_), p_184394_4_); -+ // TODO: check if negative scale is a thing -+ p_184394_2_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_184394_2_, p_184394_3_, p_184394_4_); - -- if (this.func_183005_a(itemcameratransforms.getTransform(p_184394_3_))) -- { -- GlStateManager.func_187407_a(GlStateManager.CullFace.FRONT); -- } -- - this.renderItem(p_184394_1_, p_184394_2_); - GlStateManager.func_187407_a(GlStateManager.CullFace.BACK); - GlStateManager.popMatrix(); -@@ -319,7 +304,7 @@ - GlStateManager.func_187401_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.setupGuiTransform(p_184390_2_, p_184390_3_, p_184390_4_.isGui3d()); -- p_184390_4_.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GUI); -+ p_184390_4_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_184390_4_, ItemCameraTransforms.TransformType.GUI, false); - this.renderItem(p_184390_1_, p_184390_4_); - GlStateManager.disableAlpha(); - GlStateManager.disableRescaleNormal(); -@@ -426,10 +411,11 @@ - GlStateManager.enableDepth(); - } - -- if (stack.isItemDamaged()) -+ if (stack.getItem().showDurabilityBar(stack)) - { -- int j = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage()); -- int i = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); -+ double health = stack.getItem().getDurabilityForDisplay(stack); -+ int j = (int)Math.round(13.0D - health * 13.0D); -+ int i = (int)Math.round(255.0D - health * 255.0D); - GlStateManager.disableLighting(); - GlStateManager.disableDepth(); - GlStateManager.disableTexture2D(); -@@ -440,7 +426,7 @@ - this.func_181565_a(vertexbuffer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255); - this.func_181565_a(vertexbuffer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255); - this.func_181565_a(vertexbuffer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255); -- GlStateManager.enableBlend(); -+ //GlStateManager.enableBlend(); // Forge: Disable Blend because it screws with a lot of things down the line. - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - GlStateManager.enableLighting(); -@@ -1053,6 +1039,7 @@ - this.registerBlock(Blocks.field_185779_df, TileEntityStructure.Mode.LOAD.func_185110_a(), "structure_block"); - this.registerBlock(Blocks.field_185779_df, TileEntityStructure.Mode.CORNER.func_185110_a(), "structure_block"); - this.registerBlock(Blocks.field_185779_df, TileEntityStructure.Mode.DATA.func_185110_a(), "structure_block"); -+ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.itemModelMesher); - } - - public void onResourceManagerReload(IResourceManager resourceManager) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch deleted file mode 100644 index e8a03041f3..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/VertexBuffer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/VertexBuffer.java -@@ -510,15 +510,15 @@ - break; - case USHORT: - case SHORT: -- this.byteBuffer.putShort(i, (short)((int)p_181663_1_ * 32767 & 65535)); -- this.byteBuffer.putShort(i + 2, (short)((int)p_181663_2_ * 32767 & 65535)); -- this.byteBuffer.putShort(i + 4, (short)((int)p_181663_3_ * 32767 & 65535)); -+ this.byteBuffer.putShort(i, (short)((int)(p_181663_1_ * 32767) & 65535)); -+ this.byteBuffer.putShort(i + 2, (short)((int)(p_181663_2_ * 32767) & 65535)); -+ this.byteBuffer.putShort(i + 4, (short)((int)(p_181663_3_ * 32767) & 65535)); - break; - case UBYTE: - case BYTE: -- this.byteBuffer.put(i, (byte)((int)p_181663_1_ * 127 & 255)); -- this.byteBuffer.put(i + 1, (byte)((int)p_181663_2_ * 127 & 255)); -- this.byteBuffer.put(i + 2, (byte)((int)p_181663_3_ * 127 & 255)); -+ this.byteBuffer.put(i, (byte)((int)(p_181663_1_ * 127) & 255)); -+ this.byteBuffer.put(i + 1, (byte)((int)(p_181663_2_ * 127) & 255)); -+ this.byteBuffer.put(i + 2, (byte)((int)(p_181663_3_ * 127) & 255)); - } - - this.nextVertexFormatIndex(); -@@ -609,4 +609,9 @@ - return this.stateVertexFormat; - } - } -+ -+ public boolean isColorDisabled() -+ { -+ return noColor; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch deleted file mode 100644 index 8d2a98861d..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java -@@ -28,26 +28,8 @@ - int l = vertexformatelement.getIndex(); - bytebuffer.position(vertexformat.func_181720_d(j)); - -- switch (vertexformatelement$enumusage) -- { -- case POSITION: -- GlStateManager.func_187427_b(vertexformatelement.getElementCount(), k, i, bytebuffer); -- GlStateManager.func_187410_q(32884); -- break; -- case UV: -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l); -- GlStateManager.func_187404_a(vertexformatelement.getElementCount(), k, i, bytebuffer); -- GlStateManager.func_187410_q(32888); -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); -- break; -- case COLOR: -- GlStateManager.func_187400_c(vertexformatelement.getElementCount(), k, i, bytebuffer); -- GlStateManager.func_187410_q(32886); -- break; -- case NORMAL: -- GlStateManager.func_187446_a(k, i, bytebuffer); -- GlStateManager.func_187410_q(32885); -- } -+ // moved to VertexFormatElement.preDraw -+ vertexformatelement.getUsage().preDraw(vertexformat, j, i, bytebuffer); - } - - GlStateManager.func_187439_f(p_181679_1_.getDrawMode(), 0, p_181679_1_.getVertexCount()); -@@ -59,23 +41,8 @@ - VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.getUsage(); - int k1 = vertexformatelement1.getIndex(); - -- switch (vertexformatelement$enumusage1) -- { -- case POSITION: -- GlStateManager.func_187429_p(32884); -- break; -- case UV: -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k1); -- GlStateManager.func_187429_p(32888); -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); -- break; -- case COLOR: -- GlStateManager.func_187429_p(32886); -- GlStateManager.resetColor(); -- break; -- case NORMAL: -- GlStateManager.func_187429_p(32885); -- } -+ // moved to VertexFormatElement.postDraw -+ vertexformatelement1.getUsage().postDraw(vertexformat, i1, i, bytebuffer); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch deleted file mode 100644 index 8d8d18d4e0..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java -@@ -6,15 +6,25 @@ - import net.minecraftforge.fml.relauncher.SideOnly; - - @SideOnly(Side.CLIENT) --public class BakedQuad -+public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer - { - protected final int[] vertexData; - protected final int tintIndex; - protected final EnumFacing face; - protected final TextureAtlasSprite field_187509_d; - -+ /** -+ * @deprecated Use constructor with the format argument. -+ */ -+ @Deprecated - public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_) - { -+ this(p_i46574_1_, p_i46574_2_, p_i46574_3_, p_i46574_4_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.ITEM); -+ } -+ -+ public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_, net.minecraft.client.renderer.vertex.VertexFormat format) -+ { -+ this.format = format; - this.vertexData = p_i46574_1_; - this.tintIndex = p_i46574_2_; - this.face = p_i46574_3_; -@@ -45,4 +55,17 @@ - { - return this.face; - } -+ -+ private final net.minecraft.client.renderer.vertex.VertexFormat format; -+ -+ @Override -+ public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) -+ { -+ net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); -+ } -+ -+ public net.minecraft.client.renderer.vertex.VertexFormat getFormat() -+ { -+ return format; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch deleted file mode 100644 index ade098febf..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ /dev/null @@ -1,93 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java -@@ -48,14 +48,20 @@ - - public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) - { -+ return makeBakedQuad(posFrom, posTo, face, sprite, facing, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); -+ } -+ -+ public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) -+ { - BlockFaceUV blockfaceuv = face.blockFaceUV; - - if (uvLocked) - { -- blockfaceuv = this.func_188010_a(face.blockFaceUV, facing, modelRotationIn); -+ // TODO fix uvlock for custom rotations -+ //blockfaceuv = this.func_188010_a(face.blockFaceUV, facing, modelRotationIn); - } - -- int[] aint = this.func_188012_a(blockfaceuv, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, shade); -+ int[] aint = this.makeQuadVertexData(blockfaceuv, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, shade); - EnumFacing enumfacing = getFacingFromVertexData(aint); - - if (partRotation == null) -@@ -63,6 +69,7 @@ - this.func_178408_a(aint, enumfacing); - } - -+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing); - return new BakedQuad(aint, face.tintIndex, enumfacing, sprite); - } - -@@ -73,11 +80,16 @@ - - private int[] func_188012_a(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, ModelRotation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) - { -+ return makeQuadVertexData(p_188012_1_, p_188012_2_, p_188012_3_, p_188012_4_, (net.minecraftforge.client.model.ITransformation)p_188012_5_, p_188012_6_, p_188012_7_); -+ } -+ -+ private int[] makeQuadVertexData(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, net.minecraftforge.client.model.ITransformation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) -+ { - int[] aint = new int[28]; - - for (int i = 0; i < 4; ++i) - { -- this.func_188015_a(aint, i, p_188012_3_, p_188012_1_, p_188012_4_, p_188012_2_, p_188012_5_, p_188012_6_, p_188012_7_); -+ this.fillVertexData(aint, i, p_188012_3_, p_188012_1_, p_188012_4_, p_188012_2_, p_188012_5_, p_188012_6_, p_188012_7_); - } - - return aint; -@@ -123,12 +135,17 @@ - - private void func_188015_a(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, ModelRotation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_) - { -- EnumFacing enumfacing = p_188015_7_.rotateFace(p_188015_3_); -+ fillVertexData(p_188015_1_, p_188015_2_, p_188015_3_, p_188015_4_, p_188015_5_, p_188015_6_, (net.minecraftforge.client.model.ITransformation)p_188015_7_, p_188015_8_, p_188015_9_); -+ } -+ -+ private void fillVertexData(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, net.minecraftforge.client.model.ITransformation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_) -+ { -+ EnumFacing enumfacing = p_188015_7_.rotate(p_188015_3_); - int i = p_188015_9_ ? this.getFaceShadeColor(enumfacing) : -1; - EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.getFacing(p_188015_3_).func_179025_a(p_188015_2_); - Vector3f vector3f = new Vector3f(p_188015_5_[enumfacedirection$vertexinformation.field_179184_a], p_188015_5_[enumfacedirection$vertexinformation.field_179182_b], p_188015_5_[enumfacedirection$vertexinformation.field_179183_c]); - this.func_178407_a(vector3f, p_188015_8_); -- int j = this.func_188011_a(vector3f, p_188015_3_, p_188015_2_, p_188015_7_); -+ int j = this.rotateVertex(vector3f, p_188015_3_, p_188015_2_, p_188015_7_); - this.storeVertexData(p_188015_1_, j, p_188015_2_, vector3f, i, p_188015_6_, p_188015_4_); - } - -@@ -189,14 +206,19 @@ - - public int func_188011_a(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, ModelRotation p_188011_4_) - { -+ return rotateVertex(p_188011_1_, p_188011_2_, p_188011_3_, (net.minecraftforge.client.model.ITransformation)p_188011_4_); -+ } -+ -+ public int rotateVertex(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, net.minecraftforge.client.model.ITransformation p_188011_4_) -+ { - if (p_188011_4_ == ModelRotation.X0_Y0) - { - return p_188011_3_; - } - else - { -- this.rotateScale(p_188011_1_, new Vector3f(0.5F, 0.5F, 0.5F), p_188011_4_.getMatrix4d(), new Vector3f(1.0F, 1.0F, 1.0F)); -- return p_188011_4_.rotateVertex(p_188011_2_, p_188011_3_); -+ net.minecraftforge.client.ForgeHooksClient.transform(p_188011_1_, p_188011_4_.getMatrix()); -+ return p_188011_4_.rotate(p_188011_2_, p_188011_3_); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch deleted file mode 100644 index b346a58914..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java -@@ -20,6 +20,7 @@ - - TextureAtlasSprite getParticleTexture(); - -+ @Deprecated - ItemCameraTransforms getItemCameraTransforms(); - - ItemOverrideList func_188617_f(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch deleted file mode 100644 index 26b790331f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java -@@ -12,6 +12,9 @@ - import net.minecraftforge.fml.relauncher.SideOnly; - import org.lwjgl.util.vector.Quaternion; - -+/* -+ * @deprecated use {@link net.minecraftforge.client.model.IPerspectiveAwareModel} instead -+ */ - @SideOnly(Side.CLIENT) - public class ItemCameraTransforms - { -@@ -39,6 +42,7 @@ - this(ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT); - } - -+ @Deprecated - public ItemCameraTransforms(ItemCameraTransforms p_i46443_1_) - { - this.field_188036_k = p_i46443_1_.field_188036_k; -@@ -51,6 +55,7 @@ - this.fixed = p_i46443_1_.fixed; - } - -+ @Deprecated - public ItemCameraTransforms(ItemTransformVec3f p_i46569_1_, ItemTransformVec3f p_i46569_2_, ItemTransformVec3f p_i46569_3_, ItemTransformVec3f p_i46569_4_, ItemTransformVec3f p_i46569_5_, ItemTransformVec3f p_i46569_6_, ItemTransformVec3f p_i46569_7_, ItemTransformVec3f p_i46569_8_) - { - this.field_188036_k = p_i46569_1_; -@@ -103,6 +108,7 @@ - return new Quaternion(f3 * f6 * f8 + f4 * f5 * f7, f4 * f5 * f8 - f3 * f6 * f7, f3 * f5 * f8 + f4 * f6 * f7, f4 * f6 * f8 - f3 * f5 * f7); - } - -+ @Deprecated - public ItemTransformVec3f getTransform(ItemCameraTransforms.TransformType p_181688_1_) - { - switch (p_181688_1_) -@@ -169,7 +175,7 @@ - } - - @SideOnly(Side.CLIENT) -- public static enum TransformType -+ public static enum TransformType implements net.minecraftforge.client.model.IModelPart - { - NONE, - THIRD_PERSON_LEFT_HAND, diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch deleted file mode 100644 index 5f9bcf1aa1..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java -@@ -1,7 +1,10 @@ - package net.minecraft.client.renderer.block.model; - - import com.google.common.collect.Lists; -+ - import java.util.List; -+ -+import net.minecraft.client.Minecraft; - import net.minecraft.entity.EntityLivingBase; - import net.minecraft.item.ItemStack; - import net.minecraft.util.ResourceLocation; -@@ -27,6 +30,7 @@ - } - } - -+ @Deprecated - public ResourceLocation func_188021_a(ItemStack p_188021_1_, World p_188021_2_, EntityLivingBase p_188021_3_) - { - if (!this.field_188023_b.isEmpty()) -@@ -42,4 +46,18 @@ - - return null; - } -+ -+ public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) -+ { -+ net.minecraft.item.Item item = stack.getItem(); -+ if (item != null && item.func_185040_i()) -+ { -+ ResourceLocation location = func_188021_a(stack, world, entity); -+ if (location != null) -+ { -+ return Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getModel(new ModelResourceLocation(location, "inventory")); -+ } -+ } -+ return originalModel; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch deleted file mode 100644 index 8e3564b56f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java -@@ -13,9 +13,14 @@ - import net.minecraftforge.fml.relauncher.SideOnly; - import org.lwjgl.util.vector.Vector3f; - -+/* -+ * @deprecated use {@link net.minecraftforge.client.model.IModelState} and {@link net.minecraftforge.client.model.TRSRTransformation} -+ */ - @SideOnly(Side.CLIENT) --public class ItemTransformVec3f -+@Deprecated -+public class ItemTransformVec3f implements net.minecraftforge.client.model.IModelState - { -+ public com.google.common.base.Optional apply(com.google.common.base.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(this, part); } - public static final ItemTransformVec3f DEFAULT = new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F)); - public final Vector3f rotation; - public final Vector3f translation; diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch deleted file mode 100644 index ebdfd263f2..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch +++ /dev/null @@ -1,107 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java -@@ -132,7 +132,7 @@ - { - if (!modelblockdefinition.func_188002_b()) - { -- LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation); -+ LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, var12); - } - } - } -@@ -370,6 +370,7 @@ - - protected void registerVariantNames() - { -+ this.variantNames.clear(); //FML clear this to prevent double ups. - this.variantNames.put(Item.getItemFromBlock(Blocks.stone), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); - this.variantNames.put(Item.getItemFromBlock(Blocks.dirt), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); - this.variantNames.put(Item.getItemFromBlock(Blocks.planks), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); -@@ -413,6 +414,10 @@ - this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence), Lists.newArrayList(new String[] {"oak_fence"})); - this.variantNames.put(Items.oak_door, Lists.newArrayList(new String[] {"oak_door"})); - this.variantNames.put(Items.boat, Lists.newArrayList(new String[] {"oak_boat"})); -+ for (Entry, Set> e : customVariantNames.entrySet()) -+ { -+ this.variantNames.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator())); -+ } - } - - protected List getVariantNames(Item p_177596_1_) -@@ -429,7 +434,7 @@ - - protected ResourceLocation getItemLocation(String p_177583_1_) - { -- ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_); -+ ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_.replaceAll("#.*", "")); - return new ResourceLocation(resourcelocation.getResourceDomain(), "item/" + resourcelocation.getResourcePath()); - } - -@@ -536,7 +541,7 @@ - for (Entry entry : this.itemLocations.entrySet()) - { - ResourceLocation resourcelocation = (ResourceLocation)entry.getValue(); -- ModelResourceLocation modelresourcelocation = new ModelResourceLocation((String)entry.getKey(), "inventory"); -+ ModelResourceLocation modelresourcelocation = net.minecraftforge.client.model.ModelLoader.getInventoryVariant(entry.getKey()); - ModelBlock modelblock = (ModelBlock)this.models.get(resourcelocation); - - if (modelblock != null && modelblock.isResolved()) -@@ -623,6 +628,11 @@ - - private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked) - { -+ return bakeModel(modelBlockIn, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); -+ } -+ -+ protected IBakedModel bakeModel(ModelBlock modelBlockIn, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) -+ { - TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle"))); - SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(modelBlockIn, modelBlockIn.func_187967_g())).setTexture(textureatlassprite); - -@@ -639,13 +649,13 @@ - BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); - TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture))); - -- if (blockpartface.cullFace == null) -+ if (blockpartface.cullFace == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix())) - { - simplebakedmodel$builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); - } - else - { -- simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); -+ simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); - } - } - } -@@ -656,6 +666,11 @@ - - private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) - { -+ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation)p_177589_5_, p_177589_6_); -+ } -+ -+ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) -+ { - return this.faceBakery.makeBakedQuad(p_177589_1_.positionFrom, p_177589_1_.positionTo, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.partRotation, p_177589_6_, p_177589_1_.shade); - } - -@@ -878,4 +893,18 @@ - MODEL_GENERATED.name = "generation marker"; - MODEL_ENTITY.name = "block entity marker"; - } -+ -+ private static Map, Set> customVariantNames = Maps.newHashMap(); -+ -+ public static void registerItemVariants(Item item, ResourceLocation... names) -+ { -+ if (!customVariantNames.containsKey(item.delegate)) -+ { -+ customVariantNames.put(item.delegate, Sets.newHashSet()); -+ } -+ for(ResourceLocation name : names) -+ { -+ customVariantNames.get(item.delegate).add(name.toString()); -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch deleted file mode 100644 index 5b8ebe4cd1..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java -@@ -31,7 +31,7 @@ - - public static ModelBlockDefinition parseFromReader(Reader p_178331_0_) - { -- return (ModelBlockDefinition)GSON.fromJson(p_178331_0_, ModelBlockDefinition.class); -+ return net.minecraftforge.client.model.BlockStateLoader.load(p_178331_0_, GSON); - } - - public ModelBlockDefinition(Map p_i46572_1_, Multipart p_i46572_2_) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch deleted file mode 100644 index 54256d1f3c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java -@@ -24,9 +24,11 @@ - - public void onResourceManagerReload(IResourceManager resourceManager) - { -- ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider); -+ // FIXME: reenable after ModelLoader is fixed -+ ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider); //new net.minecraftforge.client.model.ModelLoader(resourceManager, this.texMap, this.modelProvider); - this.modelRegistry = modelbakery.setupModelRegistry(); - this.defaultModel = (IBakedModel)this.modelRegistry.getObject(ModelBakery.MODEL_MISSING); -+ //net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelRegistry, modelbakery); - this.modelProvider.reloadModels(); - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch deleted file mode 100644 index cef4d35bb4..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java -@@ -10,7 +10,7 @@ - import org.lwjgl.util.vector.Vector3f; - - @SideOnly(Side.CLIENT) --public enum ModelRotation -+public enum ModelRotation implements net.minecraftforge.client.model.IModelState, net.minecraftforge.client.model.ITransformation - { - X0_Y0(0, 0), - X0_Y90(0, 90), -@@ -116,4 +116,9 @@ - mapRotations.put(Integer.valueOf(modelrotation.combinedXY), modelrotation); - } - } -+ -+ public com.google.common.base.Optional apply(com.google.common.base.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(getMatrix(), part); } -+ public javax.vecmath.Matrix4f getMatrix() { return net.minecraftforge.client.ForgeHooksClient.getMatrix(this); } -+ public EnumFacing rotate(EnumFacing facing) { return rotateFace(facing); } -+ public int rotate(EnumFacing facing, int vertexIndex) { return rotateVertex(facing, vertexIndex); } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch deleted file mode 100644 index 51f084a945..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/Variant.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/Variant.java -@@ -32,11 +32,17 @@ - return this.field_188050_a; - } - -+ @Deprecated - public ModelRotation func_188048_b() - { - return this.field_188051_b; - } - -+ public net.minecraftforge.client.model.IModelState getState() -+ { -+ return this.field_188051_b; -+ } -+ - public boolean func_188049_c() - { - return this.field_188052_c; diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch deleted file mode 100644 index 3d5288e138..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java -@@ -38,7 +38,7 @@ - } - else - { -- s = this.func_187490_a(this.name, map); -+ s = String.format("%s:%s", Block.blockRegistry.getNameForObject(state.getBlock()).getResourceDomain(), this.func_187490_a(this.name, map)); - } - - if (this.suffix != null) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch deleted file mode 100644 index 3db0e8b9a1..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java -@@ -133,7 +133,9 @@ - return; - } - -- iblockaccess = new RegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); -+ RegionRenderCache cache = createRegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); -+ net.minecraftforge.client.MinecraftForgeClient.onRebuildChunk(world, position, cache); -+ iblockaccess = cache; - generator.setCompiledChunk(compiledchunk); - } - finally -@@ -160,7 +162,7 @@ - lvt_10_1_.func_178606_a(blockpos$mutableblockpos); - } - -- if (block.hasTileEntity()) -+ if (block.hasTileEntity(iblockstate)) - { - TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos)); - TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileentity); -@@ -176,7 +178,9 @@ - } - } - -- BlockRenderLayer blockrenderlayer1 = block.getBlockLayer(); -+ for(BlockRenderLayer blockrenderlayer1 : BlockRenderLayer.values()) { -+ if(!block.canRenderInLayer(blockrenderlayer1)) continue; -+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(blockrenderlayer1); - int j = blockrenderlayer1.ordinal(); - - if (block.getDefaultState().func_185901_i() != EnumBlockRenderType.INVISIBLE) -@@ -191,6 +195,7 @@ - - aboolean[j] |= blockrendererdispatcher.renderBlock(iblockstate, blockpos$mutableblockpos, iblockaccess, vertexbuffer); - } -+ } - } - - for (BlockRenderLayer blockrenderlayer : BlockRenderLayer.values()) -@@ -413,6 +418,26 @@ - return this.needsUpdate && this.field_188284_q; - } - -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * Creates a new RegionRenderCache instance.
-+ * Extending classes can change the behavior of the cache, allowing to visually change -+ * blocks (schematics etc). -+ * -+ * @see RegionRenderCache -+ * @param world The world to cache. -+ * @param from The starting position of the chunk minus one on each axis. -+ * @param to The ending position of the chunk plus one on each axis. -+ * @param subtract Padding used internally by the RegionRenderCache constructor to make -+ * the cache a 20x20x20 cube, for a total of 8000 states in the cache. -+ * @return new RegionRenderCache instance -+ */ -+ protected RegionRenderCache createRegionRenderCache(World world, BlockPos from, BlockPos to, int subtract) -+ { -+ return new RegionRenderCache(world, from, to, subtract); -+ } -+ /* ========================================= FORGE END ======================================*/ -+ - public BlockPos getBlockPosOffset16(EnumFacing p_181701_1_) - { - return (BlockPos)this.mapEnumFacing.get(p_181701_1_); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch deleted file mode 100644 index b58a69c6de..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch +++ /dev/null @@ -1,83 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java -@@ -44,7 +44,7 @@ - boolean flag = p_177077_9_.isGui3d(); - int i = this.func_177078_a(itemstack); - float f = 0.25F; -- float f1 = MathHelper.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F; -+ float f1 = shouldBob() ? MathHelper.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F : 0; - float f2 = p_177077_9_.getItemCameraTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y; - GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_); - -@@ -114,16 +114,13 @@ - GlStateManager.pushMatrix(); - IBakedModel ibakedmodel = this.itemRenderer.func_184393_a(itemstack, entity.worldObj, (EntityLivingBase)null); - int j = this.func_177077_a(entity, x, y, z, partialTicks, ibakedmodel); -- float f = ibakedmodel.getItemCameraTransforms().ground.scale.x; -- float f1 = ibakedmodel.getItemCameraTransforms().ground.scale.y; -- float f2 = ibakedmodel.getItemCameraTransforms().ground.scale.z; - boolean flag1 = ibakedmodel.isGui3d(); - - if (!flag1) - { -- float f3 = -0.0F * (float)(j - 1) * 0.5F * f; -- float f4 = -0.0F * (float)(j - 1) * 0.5F * f1; -- float f5 = -0.09375F * (float)(j - 1) * 0.5F * f2; -+ float f3 = -0.0F * (float)(j - 1) * 0.5F; -+ float f4 = -0.0F * (float)(j - 1) * 0.5F; -+ float f5 = -0.09375F * (float)(j - 1) * 0.5F; - GlStateManager.translate(f3, f4, f5); - } - -@@ -144,10 +141,10 @@ - float f7 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f9 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f6 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; -- GlStateManager.translate(f7, f9, f6); -+ GlStateManager.translate(shouldSpreadItems() ? f7 : 0, shouldSpreadItems() ? f9 : 0, f6); - } - -- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); -+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); - this.itemRenderer.renderItem(itemstack, ibakedmodel); - GlStateManager.popMatrix(); - } -@@ -162,10 +159,10 @@ - GlStateManager.translate(f8, f10, 0.0F); - } - -- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); -+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); - this.itemRenderer.renderItem(itemstack, ibakedmodel); - GlStateManager.popMatrix(); -- GlStateManager.translate(0.0F * f, 0.0F * f1, 0.09375F * f2); -+ GlStateManager.translate(0.0F, 0.0F, 0.09375F); - } - } - -@@ -192,4 +189,25 @@ - { - return TextureMap.locationBlocksTexture; - } -+ -+ /*==================================== FORGE START ===========================================*/ -+ -+ /** -+ * Items should spread out when rendered in 3d? -+ * @return -+ */ -+ public boolean shouldSpreadItems() -+ { -+ return true; -+ } -+ -+ /** -+ * Items should have a bob effect -+ * @return -+ */ -+ public boolean shouldBob() -+ { -+ return true; -+ } -+ /*==================================== FORGE END =============================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch deleted file mode 100644 index a044bc481b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java -@@ -32,6 +32,9 @@ - protected List> layerRenderers = Lists.>newArrayList(); - protected boolean field_188323_j = false; - -+ public static float NAME_TAG_RANGE = 64.0f; -+ public static float NAME_TAG_RANGE_SNEAK = 32.0f; -+ - public RenderLivingBase(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) - { - super(renderManagerIn); -@@ -77,10 +80,12 @@ - - public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(entity, this, x, y, z))) return; - GlStateManager.pushMatrix(); - GlStateManager.disableCull(); - this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks); -- this.mainModel.isRiding = entity.func_184218_aH(); -+ boolean shouldSit = entity.func_184218_aH() && (entity.func_184187_bx() != null && entity.func_184187_bx().shouldRiderSit()); -+ this.mainModel.isRiding = shouldSit; - this.mainModel.isChild = entity.isChild(); - - try -@@ -89,7 +94,7 @@ - float f1 = this.interpolateRotation(entity.prevRotationYawHead, entity.rotationYawHead, partialTicks); - float f2 = f1 - f; - -- if (entity.func_184218_aH() && entity.func_184187_bx() instanceof EntityLivingBase) -+ if (shouldSit && entity.func_184187_bx() instanceof EntityLivingBase) - { - EntityLivingBase entitylivingbase = (EntityLivingBase)entity.func_184187_bx(); - f = this.interpolateRotation(entitylivingbase.prevRenderYawOffset, entitylivingbase.renderYawOffset, partialTicks); -@@ -197,6 +202,7 @@ - GlStateManager.enableCull(); - GlStateManager.popMatrix(); - super.doRender(entity, x, y, z, entityYaw, partialTicks); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(entity, this, x, y, z)); - } - - public float func_188322_c(T p_188322_1_, float p_188322_2_) -@@ -452,10 +458,11 @@ - - public void renderName(T entity, double x, double y, double z) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(entity, this, x, y, z))) return; - if (this.canRenderName(entity)) - { - double d0 = entity.getDistanceSqToEntity(this.renderManager.livingPlayer); -- float f = entity.isSneaking() ? 32.0F : 64.0F; -+ float f = entity.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; - - if (d0 < (double)(f * f)) - { -@@ -464,6 +471,7 @@ - this.func_188296_a(entity, x, y, z, s, d0); - } - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(entity, this, x, y, z)); - } - - protected boolean canRenderName(T entity) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch deleted file mode 100644 index 208c386cd8..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -@@ -204,8 +204,13 @@ - this.playerRenderer = new RenderPlayer(this); - this.skinMap.put("default", this.playerRenderer); - this.skinMap.put("slim", new RenderPlayer(this, true)); -+ net.minecraftforge.fml.client.registry.RenderingRegistry.loadEntityRenderers(this, this.entityRenderMap); - } - -+ public Map getSkinMap() { -+ return (Map) java.util.Collections.unmodifiableMap(skinMap); -+ } -+ - public void setRenderPosition(double renderPosXIn, double renderPosYIn, double renderPosZIn) - { - this.renderPosX = renderPosXIn; -@@ -253,9 +258,9 @@ - IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn)); - Block block = iblockstate.getBlock(); - -- if (block == Blocks.bed) -+ if (block.isBed(iblockstate, worldIn, new BlockPos(livingPlayerIn), (EntityLivingBase)livingPlayerIn)) - { -- int i = ((EnumFacing)iblockstate.getValue(BlockBed.field_185512_D)).getHorizontalIndex(); -+ int i = block.getBedDirection(iblockstate, worldIn, new BlockPos(livingPlayerIn)).getHorizontalIndex(); - this.playerViewY = (float)(i * 90 + 180); - this.playerViewX = 0.0F; - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch deleted file mode 100644 index 77c0de3c6f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -@@ -55,6 +55,7 @@ - - public void doRender(AbstractClientPlayer entity, double x, double y, double z, float entityYaw, float partialTicks) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(entity, this, partialTicks, x, y, z))) return; - if (!entity.isUser() || this.renderManager.livingPlayer == entity) - { - double d0 = y; -@@ -69,6 +70,7 @@ - super.doRender(entity, x, d0, z, entityYaw, partialTicks); - GlStateManager.func_187440_b(GlStateManager.Profile.PLAYER_SKIN); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(entity, this, partialTicks, x, y, z)); - } - - private void setModelVisibilities(AbstractClientPlayer clientPlayer) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch deleted file mode 100644 index e4a92b81b1..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java -@@ -44,7 +44,7 @@ - case 4: - return butcherVillagerTextures; - default: -- return villagerTextures; -+ return net.minecraftforge.fml.common.registry.VillagerRegistry.getVillagerSkin(entity.getProfession(), villagerTextures); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch deleted file mode 100644 index 5ba4fa1404..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch +++ /dev/null @@ -1,106 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java -@@ -59,29 +59,27 @@ - T t = this.func_188360_a(p_188361_9_); - t.setModelAttributes(this.renderer.getMainModel()); - t.setLivingAnimations(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_4_); -+ t = getArmorModelHook(p_188361_1_, itemstack, p_188361_9_, t); - this.func_188359_a(t, p_188361_9_); - boolean flag = this.func_188363_b(p_188361_9_); -- this.renderer.bindTexture(this.getArmorResource(itemarmor, flag)); -+ this.renderer.bindTexture(this.getArmorResource(p_188361_1_, itemstack, p_188361_9_, null)); - -- switch (itemarmor.getArmorMaterial()) -- { -- case LEATHER: - int i = itemarmor.getColor(itemstack); -+ { -+ if (i != 0xFFFFFF) // Allow this for anything, not only cloth -+ { - float f = (float)(i >> 16 & 255) / 255.0F; - float f1 = (float)(i >> 8 & 255) / 255.0F; - float f2 = (float)(i & 255) / 255.0F; - GlStateManager.color(this.colorR * f, this.colorG * f1, this.colorB * f2, this.alpha); - t.render(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); -- this.renderer.bindTexture(this.getArmorResource(itemarmor, flag, "overlay")); -- case CHAIN: -- case IRON: -- case GOLD: -- case DIAMOND: -+ this.renderer.bindTexture(this.getArmorResource(p_188361_1_, itemstack, p_188361_9_, "overlay")); -+ } -+ { // Non-colored - GlStateManager.color(this.colorR, this.colorG, this.colorB, this.alpha); - t.render(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); -- default: -- -- if (!this.field_177193_i && itemstack.isItemEnchanted()) -+ } // Default -+ if (!this.field_177193_i && itemstack.hasEffect()) - { - func_188364_a(this.renderer, p_188361_1_, t, p_188361_2_, p_188361_3_, p_188361_4_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); - } -@@ -140,11 +138,13 @@ - GlStateManager.disableBlend(); - } - -+ @Deprecated //Use the more sensitive version getArmorResource below - private ResourceLocation getArmorResource(ItemArmor p_177181_1_, boolean p_177181_2_) - { - return this.getArmorResource(p_177181_1_, p_177181_2_, (String)null); - } - -+ @Deprecated //Use the more sensitive version getArmorResource below - private ResourceLocation getArmorResource(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) - { - String s = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.getArmorMaterial().getName(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); -@@ -162,4 +162,49 @@ - protected abstract void initArmor(); - - protected abstract void func_188359_a(T p_188359_1_, EntityEquipmentSlot p_188359_2_); -+ -+ /*=================================== FORGE START =========================================*/ -+ -+ /** -+ * Hook to allow item-sensitive armor model. for LayerBipedArmor. -+ */ -+ protected T getArmorModelHook(EntityLivingBase entity, ItemStack itemStack, EntityEquipmentSlot slot, T model) -+ { -+ return model; -+ } -+ -+ /** -+ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. -+ * -+ * @param entity Entity wearing the armor -+ * @param stack ItemStack for the armor -+ * @param slot Slot ID that the item is in -+ * @param type Subtype, can be null or "overlay" -+ * @return ResourceLocation pointing at the armor's texture -+ */ -+ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, EntityEquipmentSlot slot, String type) -+ { -+ ItemArmor item = (ItemArmor)stack.getItem(); -+ String texture = item.getArmorMaterial().getName(); -+ String domain = "minecraft"; -+ int idx = texture.indexOf(':'); -+ if (idx != -1) -+ { -+ domain = texture.substring(0, idx); -+ texture = texture.substring(idx + 1); -+ } -+ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (func_188363_b(slot) ? 2 : 1), type == null ? "" : String.format("_%s", type)); -+ -+ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); -+ ResourceLocation resourcelocation = (ResourceLocation)ARMOR_TEXTURE_RES_MAP.get(s1); -+ -+ if (resourcelocation == null) -+ { -+ resourcelocation = new ResourceLocation(s1); -+ ARMOR_TEXTURE_RES_MAP.put(s1, resourcelocation); -+ } -+ -+ return resourcelocation; -+ } -+ /*=================================== FORGE END ===========================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch deleted file mode 100644 index 854dd052ad..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java -@@ -51,4 +51,10 @@ - { - p_177194_1_.setInvisible(false); - } -+ -+ @Override -+ protected ModelBiped getArmorModelHook(net.minecraft.entity.EntityLivingBase entity, net.minecraft.item.ItemStack itemStack, EntityEquipmentSlot slot, ModelBiped model) -+ { -+ return net.minecraftforge.client.ForgeHooksClient.getArmorModel(entity, itemStack, slot, model); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch deleted file mode 100644 index 7b10c36b2a..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java -@@ -56,18 +56,24 @@ - { - Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]); - Arrays.sort((Object[])astitcher$holder); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", astitcher$holder.length); - - for (Stitcher.Holder stitcher$holder : astitcher$holder) - { -+ bar.step(stitcher$holder.getAtlasSprite().getIconName()); - if (!this.allocateSlot(stitcher$holder)) - { - String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {stitcher$holder.getAtlasSprite().getIconName(), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconWidth()), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconHeight())}); -+ net.minecraftforge.fml.common.FMLLog.info(s); -+ for (Stitcher.Holder h : astitcher$holder) -+ net.minecraftforge.fml.common.FMLLog.info(" %s", h); - throw new StitcherException(stitcher$holder, s); - } - } - - this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth); - this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight); -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); - } - - public List getStichSlots() -@@ -238,7 +244,7 @@ - - public String toString() - { -- return "Holder{width=" + this.width + ", height=" + this.height + '}'; -+ return "Holder{width=" + this.width + ", height=" + this.height + ", name=" + this.theTexture.getIconName() + '}'; - } - - public int compareTo(Stitcher.Holder p_compareTo_1_) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch deleted file mode 100644 index 8ca6b9f2f3..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java -@@ -398,4 +398,30 @@ - { - return "TextureAtlasSprite{name=\'" + this.iconName + '\'' + ", frameCount=" + this.framesTextureData.size() + ", rotated=" + this.rotated + ", x=" + this.originX + ", y=" + this.originY + ", height=" + this.height + ", width=" + this.width + ", u0=" + this.minU + ", u1=" + this.maxU + ", v0=" + this.minV + ", v1=" + this.maxV + '}'; - } -+ -+ /*===================================== FORGE START =====================================*/ -+ /** -+ * The result of this function determines is the below 'load' function is called, and the -+ * default vanilla loading code is bypassed completely. -+ * @param manager -+ * @param location -+ * @return True to use your own custom load code and bypass vanilla loading. -+ */ -+ public boolean hasCustomLoader(net.minecraft.client.resources.IResourceManager manager, net.minecraft.util.ResourceLocation location) -+ { -+ return false; -+ } -+ -+ /** -+ * Load the specified resource as this sprite's data. -+ * Returning false from this function will prevent this icon from being stitched onto the master texture. -+ * @param manager Main resource manager -+ * @param location File resource location -+ * @return False to prevent this Icon from being stitched -+ */ -+ public boolean load(net.minecraft.client.resources.IResourceManager manager, net.minecraft.util.ResourceLocation location) -+ { -+ return true; -+ } -+ /*===================================== FORGE END ======================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch deleted file mode 100644 index 62022a2a2c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureManager.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureManager.java -@@ -137,9 +137,12 @@ - - public void onResourceManagerReload(IResourceManager resourceManager) - { -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Reloading Texture Manager", this.mapTextureObjects.keySet().size(), true); - for (Entry entry : this.mapTextureObjects.entrySet()) - { -+ bar.step(entry.getKey().toString()); - this.loadTexture((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue()); - } -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch deleted file mode 100644 index 7d50d76851..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ /dev/null @@ -1,176 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java -@@ -26,6 +26,7 @@ - @SideOnly(Side.CLIENT) - public class TextureMap extends AbstractTexture implements ITickableTextureObject - { -+ private static final boolean ENABLE_SKIP = Boolean.parseBoolean(System.getProperty("fml.skipFirstTextureLoad", "true")); - private static final Logger logger = LogManager.getLogger(); - public static final ResourceLocation LOCATION_MISSING_TEXTURE = new ResourceLocation("missingno"); - public static final ResourceLocation locationBlocksTexture = new ResourceLocation("textures/atlas/blocks.png"); -@@ -36,6 +37,7 @@ - private final IIconCreator iconCreator; - private int mipmapLevels; - private final TextureAtlasSprite missingImage; -+ private boolean skipFirst = false; - - public TextureMap(String p_i46099_1_) - { -@@ -44,12 +46,23 @@ - - public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn) - { -+ this(p_i46100_1_, iconCreatorIn, false); -+ } -+ -+ public TextureMap(String p_i46100_1_, boolean skipFirst) -+ { -+ this(p_i46100_1_, null, skipFirst); -+ } -+ -+ public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn, boolean skipFirst) -+ { - this.listAnimatedSprites = Lists.newArrayList(); - this.mapRegisteredSprites = Maps.newHashMap(); - this.mapUploadedSprites = Maps.newHashMap(); - this.missingImage = new TextureAtlasSprite("missingno"); - this.basePath = p_i46100_1_; - this.iconCreator = iconCreatorIn; -+ this.skipFirst = skipFirst && ENABLE_SKIP; - } - - private void initMissingImage() -@@ -88,12 +101,26 @@ - int j = Integer.MAX_VALUE; - int k = 1 << this.mipmapLevels; - -+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this); -+ net.minecraftforge.fml.common.FMLLog.info("Max texture size: %d", i); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.mapRegisteredSprites.size()); -+ -+ if(!skipFirst) - for (Entry entry : this.mapRegisteredSprites.entrySet()) - { - TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); - ResourceLocation resourcelocation = this.func_184396_a(textureatlassprite); -+ bar.step(resourcelocation.getResourcePath()); - IResource iresource = null; - -+ if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) -+ { -+ if (textureatlassprite.load(resourceManager, resourcelocation)) -+ { -+ continue; -+ } -+ } -+ else - try - { - PngSizeInfo pngsizeinfo = PngSizeInfo.func_188532_a(resourceManager.getResource(resourcelocation)); -@@ -103,12 +130,14 @@ - } - catch (RuntimeException runtimeexception) - { -- logger.error((String)("Unable to parse metadata from " + resourcelocation), (Throwable)runtimeexception); -+ //logger.error((String)("Unable to parse metadata from " + resourcelocation), (Throwable)runtimeexception); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation, runtimeexception.getMessage()); - continue; - } - catch (IOException ioexception) - { -- logger.error((String)("Using missing texture, unable to load " + resourcelocation), (Throwable)ioexception); -+ //logger.error((String)("Using missing texture, unable to load " + resourcelocation), (Throwable)ioexception); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation); - continue; - } - finally -@@ -128,6 +157,7 @@ - stitcher.addSprite(textureatlassprite); - } - -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); - int l = Math.min(j, k); - int i1 = MathHelper.calculateLogBaseTwo(l); - -@@ -139,9 +169,12 @@ - - this.missingImage.generateMipmaps(this.mipmapLevels); - stitcher.addSprite(this.missingImage); -+ skipFirst = false; -+ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 2); - - try - { -+ bar.step("Stitching"); - stitcher.doStitch(); - } - catch (StitcherException stitcherexception) -@@ -150,11 +183,16 @@ - } - - logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); -+ bar.step("Allocating GL texture"); - TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); - Map map = Maps.newHashMap(this.mapRegisteredSprites); - -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); -+ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture mipmap and upload", stitcher.getStichSlots().size()); -+ - for (TextureAtlasSprite textureatlassprite1 : stitcher.getStichSlots()) - { -+ bar.step(textureatlassprite1.getIconName()); - if (textureatlassprite1 == this.missingImage || this.func_184397_a(resourceManager, textureatlassprite1)) - { - String s = textureatlassprite1.getIconName(); -@@ -185,6 +223,13 @@ - { - textureatlassprite2.copyFrom(this.missingImage); - } -+ -+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); -+ -+ // TextureUtil.saveGlTexture is gone, FIXME -+ //if (!net.minecraftforge.common.ForgeModContainer.disableStitchedFileSaving) -+ //TextureUtil.saveGlTexture(this.basePath.replaceAll("/", "_"), this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); - } - - private boolean func_184397_a(IResourceManager p_184397_1_, final TextureAtlasSprite p_184397_2_) -@@ -317,4 +362,37 @@ - { - return this.missingImage; - } -+ -+ //=================================================================================================== -+ // Forge Start -+ //=================================================================================================== -+ /** -+ * Grabs the registered entry for the specified name, returning null if there was not a entry. -+ * Opposed to registerIcon, this will not instantiate the entry, useful to test if a mapping exists. -+ * -+ * @param name The name of the entry to find -+ * @return The registered entry, null if nothing was registered. -+ */ -+ public TextureAtlasSprite getTextureExtry(String name) -+ { -+ return (TextureAtlasSprite)mapRegisteredSprites.get(name); -+ } -+ -+ /** -+ * Adds a texture registry entry to this map for the specified name if one does not already exist. -+ * Returns false if the map already contains a entry for the specified name. -+ * -+ * @param name Entry name -+ * @param entry Entry instance -+ * @return True if the entry was added to the map, false otherwise. -+ */ -+ public boolean setTextureEntry(String name, TextureAtlasSprite entry) -+ { -+ if (!mapRegisteredSprites.containsKey(name)) -+ { -+ mapRegisteredSprites.put(name, entry); -+ return true; -+ } -+ return false; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch deleted file mode 100644 index b561d5a3df..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java -@@ -202,9 +202,11 @@ - - public static void allocateTextureImpl(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_) - { -+ synchronized (net.minecraftforge.fml.client.SplashProgress.class) -+ { - deleteTexture(p_180600_0_); - bindTexture(p_180600_0_); -- -+ } - if (p_180600_1_ >= 0) - { - GlStateManager.func_187421_b(3553, 33085, p_180600_1_); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch deleted file mode 100644 index 0b6520ff84..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java -@@ -105,15 +105,18 @@ - GlStateManager.disableLighting(); - int i = itemFrame.getRotation(); - -- if (item == Items.filled_map) -+ if (item instanceof net.minecraft.item.ItemMap) - { - i = i % 4 * 2; - } - - GlStateManager.rotate((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F); - -- if (item == Items.filled_map) -+ net.minecraftforge.client.event.RenderItemInFrameEvent event = new net.minecraftforge.client.event.RenderItemInFrameEvent(itemFrame, this); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) - { -+ if (item instanceof net.minecraft.item.ItemMap) -+ { - this.renderManager.renderEngine.bindTexture(mapBackgroundTextures); - GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); - float f = 0.0078125F; -@@ -142,6 +145,7 @@ - RenderHelper.disableStandardItemLighting(); - GlStateManager.popAttrib(); - } -+ } - - GlStateManager.enableLighting(); - GlStateManager.popMatrix(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch deleted file mode 100644 index bd351608ec..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java -@@ -98,6 +98,7 @@ - { - TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F); - } -+ else if (block != Blocks.chest) net.minecraftforge.client.ForgeHooksClient.renderTileItem(itemStackIn.getItem(), itemStackIn.getMetadata()); - else - { - TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java.patch deleted file mode 100644 index c78c4ad821..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java -@@ -23,10 +23,11 @@ - @SideOnly(Side.CLIENT) - public class TileEntityPistonRenderer extends TileEntitySpecialRenderer - { -- private final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); -+ private BlockRendererDispatcher blockRenderer; - - public void renderTileEntityAt(TileEntityPiston te, double x, double y, double z, float partialTicks, int destroyStage) - { -+ if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); - BlockPos blockpos = te.getPos(); - IBlockState iblockstate = te.getPistonState(); - Block block = iblockstate.getBlock(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch deleted file mode 100644 index d6b642afd9..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch +++ /dev/null @@ -1,79 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java -@@ -106,11 +106,14 @@ - { - if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared()) - { -+ if(!tileentityIn.hasFastRenderer()) -+ { - int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0); - int j = i % 65536; - int k = i / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -+ } - BlockPos blockpos = tileentityIn.getPos(); - this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage); - } -@@ -129,6 +132,11 @@ - { - try - { -+ if(tileEntityIn.hasFastRenderer()) -+ { -+ tileentityspecialrenderer.renderTileEntityFast(tileEntityIn, x, y, z, partialTicks, destroyStage, batchBuffer.getWorldRenderer()); -+ } -+ else - tileentityspecialrenderer.renderTileEntityAt(tileEntityIn, x, y, z, partialTicks, destroyStage); - } - catch (Throwable throwable) -@@ -155,4 +163,49 @@ - { - return this.fontRenderer; - } -+ -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * Buffer used for batched TESRs -+ */ -+ private net.minecraft.client.renderer.Tessellator batchBuffer = new net.minecraft.client.renderer.Tessellator(0x200000); -+ -+ /** -+ * Prepare for a batched TESR rendering. -+ * You probably shouldn't call this manually. -+ */ -+ public void preDrawBatch() -+ { -+ batchBuffer.getWorldRenderer().begin(org.lwjgl.opengl.GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.BLOCK); -+ } -+ -+ /** -+ * Render all TESRs batched so far. -+ * You probably shouldn't call this manually. -+ */ -+ public void drawBatch(int pass) -+ { -+ renderEngine.bindTexture(net.minecraft.client.renderer.texture.TextureMap.locationBlocksTexture); -+ net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); -+ GlStateManager.blendFunc(org.lwjgl.opengl.GL11.GL_SRC_ALPHA, org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA); -+ GlStateManager.enableBlend(); -+ GlStateManager.disableCull(); -+ -+ if (net.minecraft.client.Minecraft.isAmbientOcclusionEnabled()) -+ { -+ GlStateManager.shadeModel(org.lwjgl.opengl.GL11.GL_SMOOTH); -+ } -+ else -+ { -+ GlStateManager.shadeModel(org.lwjgl.opengl.GL11.GL_FLAT); -+ } -+ -+ if(pass > 0) -+ { -+ batchBuffer.getWorldRenderer().sortVertexData((float)staticPlayerX, (float)staticPlayerY, (float)staticPlayerZ); -+ } -+ batchBuffer.draw(); -+ -+ net.minecraft.client.renderer.RenderHelper.enableStandardItemLighting(); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch deleted file mode 100644 index adf45bb4c5..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java -@@ -45,4 +45,6 @@ - { - return false; - } -+ -+ public void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, net.minecraft.client.renderer.VertexBuffer buffer) {} - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch deleted file mode 100644 index 664239ceb7..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java -@@ -142,10 +142,17 @@ - NORMAL("Normal"), - COLOR("Vertex Color"), - UV("UV"), -+ // As of 1.8.8 - unused in vanilla; use GENERIC for now -+ @Deprecated - MATRIX("Bone Matrix"), -+ @Deprecated - BLEND_WEIGHT("Blend Weight"), -- PADDING("Padding"); -+ PADDING("Padding"), -+ GENERIC("Generic"); - -+ public void preDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.preDraw(this, format, element, stride, buffer); } -+ public void postDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.postDraw(this, format, element, stride, buffer); } -+ - private final String displayName; - - private EnumUsage(String displayNameIn) diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch deleted file mode 100644 index 2e41170995..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/AbstractResourcePack.java -+++ ../src-work/minecraft/net/minecraft/client/resources/AbstractResourcePack.java -@@ -58,7 +58,7 @@ - - protected void logNameNotLowercase(String p_110594_1_) - { -- resourceLog.warn("ResourcePack: ignored non-lowercase namespace: %s in %s", new Object[] {p_110594_1_, this.resourcePackFile}); -+ resourceLog.warn("ResourcePack: ignored non-lowercase namespace: {} in {}", new Object[] {p_110594_1_, this.resourcePackFile}); - } - - public T getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch deleted file mode 100644 index 89b1adcad7..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/FallbackResourceManager.java -+++ ../src-work/minecraft/net/minecraft/client/resources/FallbackResourceManager.java -@@ -68,6 +68,7 @@ - throw new FileNotFoundException(location.toString()); - } - -+ @SuppressWarnings("resource") - protected InputStream getInputStream(ResourceLocation location, IResourcePack resourcePack) throws IOException - { - InputStream inputstream = resourcePack.getInputStream(location); diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch deleted file mode 100644 index e4bd44cd85..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/LanguageManager.java -+++ ../src-work/minecraft/net/minecraft/client/resources/LanguageManager.java -@@ -73,6 +73,7 @@ - } - - currentLocale.loadLocaleDataFiles(resourceManager, list); -+ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(currentLocale.properties, this.currentLanguage); - LanguageMap.replaceWith(currentLocale.properties); - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch deleted file mode 100644 index c6fcea8cda..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/Locale.java -+++ ../src-work/minecraft/net/minecraft/client/resources/Locale.java -@@ -95,6 +95,8 @@ - - private void loadLocaleData(InputStream p_135021_1_) throws IOException - { -+ p_135021_1_ = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(properties, p_135021_1_); -+ if (p_135021_1_ == null) return; - for (String s : IOUtils.readLines(p_135021_1_, Charsets.UTF_8)) - { - if (!s.isEmpty() && s.charAt(0) != 35) diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch deleted file mode 100644 index 061a43cc38..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java -+++ ../src-work/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java -@@ -92,6 +92,7 @@ - public void reloadResources(List p_110541_1_) - { - this.clearResources(); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resources", p_110541_1_.size()+1, true); - logger.info("Reloading ResourceManager: " + joinerResourcePacks.join(Iterables.transform(p_110541_1_, new Function() - { - public String apply(IResourcePack p_apply_1_) -@@ -102,23 +103,32 @@ - - for (IResourcePack iresourcepack : p_110541_1_) - { -+ resReload.step(iresourcepack.getPackName()); - this.reloadResourcePack(iresourcepack); - } - -+ resReload.step("Reloading listeners"); - this.notifyReloadListeners(); -+ net.minecraftforge.fml.common.ProgressManager.pop(resReload); - } - - public void registerReloadListener(IResourceManagerReloadListener reloadListener) - { -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resource", 1); -+ resReload.step(reloadListener.getClass()); - this.reloadListeners.add(reloadListener); - reloadListener.onResourceManagerReload(this); -+ net.minecraftforge.fml.common.ProgressManager.pop(resReload); - } - - private void notifyReloadListeners() - { -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Reloading", this.reloadListeners.size()); - for (IResourceManagerReloadListener iresourcemanagerreloadlistener : this.reloadListeners) - { -+ resReload.step(iresourcemanagerreloadlistener.getClass()); - iresourcemanagerreloadlistener.onResourceManagerReload(this); - } -+ net.minecraftforge.fml.common.ProgressManager.pop(resReload); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch deleted file mode 100644 index df746d5ea9..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/settings/GameSettings.java -+++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java -@@ -887,6 +887,7 @@ - - public void saveOptions() - { -+ if (net.minecraftforge.fml.client.FMLClientHandler.instance().isLoading()) return; - try - { - PrintWriter printwriter = new PrintWriter(new FileWriter(this.optionsFile)); diff --git a/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch deleted file mode 100644 index a32bd143cb..0000000000 --- a/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/shader/Framebuffer.java -+++ ../src-work/minecraft/net/minecraft/client/shader/Framebuffer.java -@@ -118,8 +118,17 @@ - if (this.useDepth) - { - OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); -+ if (!this.stencilEnabled) -+ { - OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight); - OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); -+ } -+ else -+ { -+ OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.framebufferTextureWidth, this.framebufferTextureHeight); -+ OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); -+ OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); -+ } - } - - this.framebufferClear(); -@@ -279,4 +288,36 @@ - GlStateManager.clear(i); - this.unbindFramebuffer(); - } -+ -+ /*================================ FORGE START ================================================*/ -+ private boolean stencilEnabled = false; -+ /** -+ * Attempts to enabled 8 bits of stencil buffer on this FrameBuffer. -+ * Modders must call this directly to set things up. -+ * This is to prevent the default cause where graphics cards do not support stencil bits. -+ * Modders should check the below 'isStencilEnabled' to check if another modder has already enabled them. -+ * -+ * Note: -+ * As of now the only thing that is checked is if FBOs are supported entirely, in the future -+ * we may expand to check for errors. -+ * -+ * @return True if the FBO was re-initialized with stencil bits. -+ */ -+ public boolean enableStencil() -+ { -+ if (!OpenGlHelper.isFramebufferEnabled()) return false; -+ stencilEnabled = true; -+ this.createBindFramebuffer(framebufferWidth, framebufferHeight); -+ return true; //TODO: Find a way to detect if this failed? -+ } -+ -+ /** -+ * Returns wither or not this FBO has been successfully initialized with stencil bits. -+ * If not, and a modder wishes it to be, they must call enableStencil. -+ */ -+ public boolean isStencilEnabled() -+ { -+ return this.stencilEnabled; -+ } -+ /*================================ FORGE END ================================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandBase.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandBase.java.patch deleted file mode 100644 index 008a1bb217..0000000000 --- a/patches.mcp/minecraft/net/minecraft/command/CommandBase.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/CommandBase.java -+++ ../src-work/minecraft/net/minecraft/command/CommandBase.java -@@ -369,7 +369,7 @@ - itextcomponent.appendText(" "); - } - -- ITextComponent itextcomponent1 = new TextComponentString(args[i]); -+ ITextComponent itextcomponent1 = net.minecraftforge.common.ForgeHooks.newChatWithLinks(args[i]); // Forge: links for messages - - if (p_147176_3_) - { diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch deleted file mode 100644 index 20f6093fd5..0000000000 --- a/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/CommandEnchant.java -+++ ../src-work/minecraft/net/minecraft/command/CommandEnchant.java -@@ -85,7 +85,7 @@ - { - Enchantment enchantment1 = Enchantment.func_185262_c(k); - -- if (!enchantment.canApplyTogether(enchantment1)) -+ if (!enchantment.canApplyTogether(enchantment1) || !enchantment1.canApplyTogether(enchantment)) //Forge BugFix: Let Both enchantments veto being together - { - throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment.getTranslatedName(i), enchantment1.getTranslatedName(nbttaglist.getCompoundTagAt(j).getShort("lvl"))}); - } diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch deleted file mode 100644 index 94ffd1431c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/CommandFill.java -+++ ../src-work/minecraft/net/minecraft/command/CommandFill.java -@@ -50,6 +50,7 @@ - { - i = parseInt(p_184881_3_[7], 0, 15); - } -+ IBlockState state = block.getStateFromMeta(i); - - BlockPos blockpos2 = new BlockPos(Math.min(blockpos.getX(), blockpos1.getX()), Math.min(blockpos.getY(), blockpos1.getY()), Math.min(blockpos.getZ(), blockpos1.getZ())); - BlockPos blockpos3 = new BlockPos(Math.max(blockpos.getX(), blockpos1.getX()), Math.max(blockpos.getY(), blockpos1.getY()), Math.max(blockpos.getZ(), blockpos1.getZ())); -@@ -77,7 +78,7 @@ - NBTTagCompound nbttagcompound = new NBTTagCompound(); - boolean flag = false; - -- if (p_184881_3_.length >= 10 && block.hasTileEntity()) -+ if (p_184881_3_.length >= 10 && block.hasTileEntity(state)) - { - String s = getChatComponentFromNthArg(p_184881_2_, p_184881_3_, 9).getUnformattedText(); - -@@ -118,7 +119,7 @@ - continue; - } - } -- else if (p_184881_3_[8].equals("replace") && !block.hasTileEntity()) -+ else if (p_184881_3_[8].equals("replace") && !block.hasTileEntity(state)) - { - if (p_184881_3_.length > 9) - { diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch deleted file mode 100644 index 7afcafd3c1..0000000000 --- a/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/CommandHandler.java -+++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java -@@ -46,6 +46,16 @@ - } - else if (icommand.func_184882_a(this.func_184879_a(), sender)) - { -+ net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(icommand, sender, astring); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) -+ { -+ if (event.exception != null) -+ { -+ com.google.common.base.Throwables.propagateIfPossible(event.exception); -+ } -+ return 1; -+ } -+ - if (i > -1) - { - List list = EntitySelector.matchEntities(sender, astring[i], Entity.class); -@@ -109,7 +119,7 @@ - TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.generic.exception", new Object[0]); - textcomponenttranslation.getChatStyle().setColor(TextFormatting.RED); - sender.addChatMessage(textcomponenttranslation); -- logger.warn("Couldn\'t process command: \'" + input + "\'"); -+ logger.warn("Couldn\'t process command: \'" + input + "\'", var9); - } - - return false; diff --git a/patches.mcp/minecraft/net/minecraft/command/EntitySelector.java.patch b/patches.mcp/minecraft/net/minecraft/command/EntitySelector.java.patch deleted file mode 100644 index 0d8cb8557e..0000000000 --- a/patches.mcp/minecraft/net/minecraft/command/EntitySelector.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/EntitySelector.java -+++ ../src-work/minecraft/net/minecraft/command/EntitySelector.java -@@ -36,9 +36,9 @@ - - public class EntitySelector - { -- private static final Pattern tokenPattern = Pattern.compile("^@([pare])(?:\\[([\\w=,!-]*)\\])?$"); -+ private static final Pattern tokenPattern = Pattern.compile("^@([pare])(?:\\[([\\w\\.=,!-]*)\\])?$"); // FORGE: allow . in entity selectors - private static final Pattern intListPattern = Pattern.compile("\\G([-!]?[\\w-]*)(?:$|,)"); -- private static final Pattern keyValueListPattern = Pattern.compile("\\G(\\w+)=([-!]?[\\w-]*)(?:$|,)"); -+ private static final Pattern keyValueListPattern = Pattern.compile("\\G(\\w+)=([-!]?[\\w\\.-]*)(?:$|,)"); // FORGE: allow . in entity selectors - private static final Set WORLD_BINDING_ARGS = Sets.newHashSet(new String[] {"x", "y", "z", "dx", "dy", "dz", "rm", "r"}); - - public static EntityPlayerMP matchOnePlayer(ICommandSender sender, String token) diff --git a/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch b/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch deleted file mode 100644 index 07a4ff3943..0000000000 --- a/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/server/CommandSetBlock.java -+++ ../src-work/minecraft/net/minecraft/command/server/CommandSetBlock.java -@@ -54,6 +54,8 @@ - i = parseInt(p_184881_3_[4], 0, 15); - } - -+ IBlockState state = block.getStateFromMeta(i); -+ - World world = p_184881_2_.getEntityWorld(); - - if (!world.isBlockLoaded(blockpos)) -@@ -65,7 +67,7 @@ - NBTTagCompound nbttagcompound = new NBTTagCompound(); - boolean flag = false; - -- if (p_184881_3_.length >= 7 && block.hasTileEntity()) -+ if (p_184881_3_.length >= 7 && block.hasTileEntity(state)) - { - String s = getChatComponentFromNthArg(p_184881_2_, p_184881_3_, 6).getUnformattedText(); - diff --git a/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch b/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch deleted file mode 100644 index e5f4feaa62..0000000000 --- a/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/server/CommandTestForBlock.java -+++ ../src-work/minecraft/net/minecraft/command/server/CommandTestForBlock.java -@@ -72,7 +72,7 @@ - NBTTagCompound nbttagcompound = new NBTTagCompound(); - boolean flag = false; - -- if (p_184881_3_.length >= 6 && block.hasTileEntity()) -+ if (p_184881_3_.length >= 6 && block.hasTileEntity(block.getStateFromMeta(i))) - { - String s = getChatComponentFromNthArg(p_184881_2_, p_184881_3_, 5).getUnformattedText(); - diff --git a/patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch b/patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch deleted file mode 100644 index 2ad18820d5..0000000000 --- a/patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/crash/CrashReport.java -+++ ../src-work/minecraft/net/minecraft/crash/CrashReport.java -@@ -115,6 +115,7 @@ - return IntCache.getCacheSizes(); - } - }); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().enhanceCrashReport(this, this.theReportCategory); - } - - public String getDescription() -@@ -203,6 +204,8 @@ - { - StringBuilder stringbuilder = new StringBuilder(); - stringbuilder.append("---- Minecraft Crash Report ----\n"); -+ net.minecraftforge.fml.common.asm.transformers.BlamingTransformer.onCrash(stringbuilder); -+ net.minecraftforge.fml.relauncher.CoreModManager.onCrash(stringbuilder); - stringbuilder.append("// "); - stringbuilder.append(getWittyComment()); - stringbuilder.append("\n\n"); diff --git a/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch b/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch deleted file mode 100644 index babe95608a..0000000000 --- a/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/crash/CrashReportCategory.java -+++ ../src-work/minecraft/net/minecraft/crash/CrashReportCategory.java -@@ -122,8 +122,11 @@ - } - else - { -- this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - size]; -- System.arraycopy(astacktraceelement, 3 + size, this.stackTrace, 0, this.stackTrace.length); -+ int len = astacktraceelement.length - 3 - size; -+ // Really Mojang, Still, god damn... -+ if (len <= 0) len = astacktraceelement.length; -+ this.stackTrace = new StackTraceElement[len]; -+ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.stackTrace, 0, this.stackTrace.length); - return this.stackTrace.length; - } - } diff --git a/patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch b/patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch deleted file mode 100644 index 83ecfbcea4..0000000000 --- a/patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch +++ /dev/null @@ -1,106 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/creativetab/CreativeTabs.java -+++ ../src-work/minecraft/net/minecraft/creativetab/CreativeTabs.java -@@ -125,8 +125,22 @@ - @SideOnly(Side.CLIENT) - private ItemStack iconItemStack; - -+ public CreativeTabs(String label) -+ { -+ this(getNextID(), label); -+ } -+ - public CreativeTabs(int index, String label) - { -+ if (index >= creativeTabArray.length) -+ { -+ CreativeTabs[] tmp = new CreativeTabs[index + 1]; -+ for (int x = 0; x < creativeTabArray.length; x++) -+ { -+ tmp[x] = creativeTabArray[x]; -+ } -+ creativeTabArray = tmp; -+ } - this.tabIndex = index; - this.tabLabel = label; - creativeTabArray[index] = this; -@@ -209,12 +223,20 @@ - @SideOnly(Side.CLIENT) - public int getTabColumn() - { -+ if (tabIndex > 11) -+ { -+ return ((tabIndex - 12) % 10) % 5; -+ } - return this.tabIndex % 6; - } - - @SideOnly(Side.CLIENT) - public boolean isTabInFirstRow() - { -+ if (tabIndex > 11) -+ { -+ return ((tabIndex - 12) % 10) < 5; -+ } - return this.tabIndex < 6; - } - -@@ -256,10 +278,17 @@ - { - for (Item item : Item.itemRegistry) - { -- if (item != null && item.getCreativeTab() == this) -+ if (item == null) - { -- item.getSubItems(item, this, p_78018_1_); -+ continue; - } -+ for (CreativeTabs tab : item.getCreativeTabs()) -+ { -+ if (tab == this) -+ { -+ item.getSubItems(item, this, p_78018_1_); -+ } -+ } - } - - if (this.getRelevantEnchantmentTypes() != null) -@@ -292,4 +321,39 @@ - } - } - } -+ -+ public int getTabPage() -+ { -+ if (tabIndex > 11) -+ { -+ return ((tabIndex - 12) / 10) + 1; -+ } -+ return 0; -+ } -+ -+ public static int getNextID() -+ { -+ return creativeTabArray.length; -+ } -+ -+ /** -+ * Determines if the search bar should be shown for this tab. -+ * -+ * @return True to show the bar -+ */ -+ public boolean hasSearchBar() -+ { -+ return tabIndex == CreativeTabs.tabAllSearch.tabIndex; -+ } -+ -+ /** -+ * Gets the width of the search bar of the creative tab, use this if your -+ * creative tab name overflows together with a custom texture. -+ * -+ * @return The width of the search bar, 89 by default -+ */ -+ public int getSearchbarWidth() -+ { -+ return 89; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch deleted file mode 100644 index d6bac48898..0000000000 --- a/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/enchantment/Enchantment.java -+++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java -@@ -118,7 +118,7 @@ - - public boolean canApply(ItemStack stack) - { -- return this.type.canEnchantItem(stack.getItem()); -+ return canApplyAtEnchantingTable(stack); - } - - public void onEntityDamaged(EntityLivingBase user, Entity target, int level) -@@ -134,6 +134,26 @@ - return false; - } - -+ /** -+ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)} -+ * applies for all possible enchantments. -+ * @param stack -+ * @return -+ */ -+ public boolean canApplyAtEnchantingTable(ItemStack stack) -+ { -+ return this.type.canEnchantItem(stack.getItem()); -+ } -+ -+ /** -+ * Is this enchantment allowed to be enchanted on books via Enchantment Table -+ * @return false to disable the vanilla feature -+ */ -+ public boolean isAllowedOnBooks() -+ { -+ return true; -+ } -+ - public static void func_185257_f() - { - EntityEquipmentSlot[] aentityequipmentslot = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET}; diff --git a/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch deleted file mode 100644 index cf49768b5b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java -+++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java -@@ -292,7 +292,7 @@ - public static int calcItemStackEnchantability(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) - { - Item item = p_77514_3_.getItem(); -- int i = item.getItemEnchantability(); -+ int i = item.getItemEnchantability(p_77514_3_); - - if (i <= 0) - { -@@ -339,7 +339,7 @@ - { - List list = Lists.newArrayList(); - Item item = itemStackIn.getItem(); -- int i = item.getItemEnchantability(); -+ int i = item.getItemEnchantability(itemStackIn); - - if (i <= 0) - { -@@ -380,7 +380,8 @@ - - while (iterator.hasNext()) - { -- if (!p_185282_1_.enchantmentobj.canApplyTogether(((EnchantmentData)iterator.next()).enchantmentobj)) -+ Enchantment e2 = iterator.next().enchantmentobj; -+ if (!p_185282_1_.enchantmentobj.canApplyTogether(e2) || !e2.canApplyTogether(p_185282_1_.enchantmentobj)) //Forge BugFix: Let Both enchantments veto being together - { - iterator.remove(); - } -@@ -395,7 +396,7 @@ - - for (Enchantment enchantment : Enchantment.field_185264_b) - { -- if ((!enchantment.func_185261_e() || p_185291_2_) && (enchantment.type.canEnchantItem(item) || flag)) -+ if ((!enchantment.func_185261_e() || p_185291_2_) && (enchantment.canApplyAtEnchantingTable(p_185291_1_) || (flag || enchantment.isAllowedOnBooks()))) - { - for (int i = enchantment.getMaxLevel(); i > enchantment.getMinLevel() - 1; --i) - { diff --git a/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch b/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch deleted file mode 100644 index 652a2ff6e8..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch +++ /dev/null @@ -1,268 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/Entity.java -+++ ../src-work/minecraft/net/minecraft/entity/Entity.java -@@ -76,7 +76,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - --public abstract class Entity implements ICommandSender -+public abstract class Entity implements ICommandSender, net.minecraftforge.common.capabilities.ICapabilitySerializable - { - private static final Logger field_184243_a = LogManager.getLogger(); - private static final AxisAlignedBB ZERO_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); -@@ -195,8 +195,16 @@ - this.dataWatcher.func_187214_a(field_184242_az, ""); - this.dataWatcher.func_187214_a(field_184234_aB, Boolean.valueOf(false)); - this.entityInit(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); -+ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this); - } - -+ /** Forge: Used to store custom data for each entity. */ -+ private NBTTagCompound customEntityData; -+ public boolean captureDrops = false; -+ public java.util.ArrayList capturedDrops = new java.util.ArrayList(); -+ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities; -+ - public int getEntityId() - { - return this.entityId; -@@ -1134,12 +1142,12 @@ - BlockPos blockpos = new BlockPos(this.posX, d0, this.posZ); - IBlockState iblockstate = this.worldObj.getBlockState(blockpos); - -+ Boolean result = iblockstate.getBlock().isEntityInsideMaterial(this.worldObj, blockpos, iblockstate, this, d0, materialIn, true); -+ if (result != null) return result; -+ - if (iblockstate.func_185904_a() == materialIn) - { -- float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F; -- float f1 = (float)(blockpos.getY() + 1) - f; -- boolean flag = d0 < (double)f1; -- return !flag && this instanceof EntityPlayer ? false : flag; -+ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(materialIn, this, blockpos); - } - else - { -@@ -1534,6 +1542,9 @@ - tagCompund.setTag("Tags", nbttaglist); - } - -+ if (customEntityData != null) tagCompund.setTag("ForgeData", customEntityData); -+ if (this.capabilities != null) tagCompund.setTag("ForgeCaps", this.capabilities.serializeNBT()); -+ - this.writeEntityToNBT(tagCompund); - - if (this.func_184207_aI()) -@@ -1629,6 +1640,9 @@ - this.setSilent(tagCompund.getBoolean("Silent")); - this.func_184195_f(tagCompund.getBoolean("Glowing")); - -+ if (tagCompund.hasKey("ForgeData")) customEntityData = tagCompund.getCompoundTag("ForgeData"); -+ if (this.capabilities != null && tagCompund.hasKey("ForgeCaps")) this.capabilities.deserializeNBT(tagCompund.getCompoundTag("ForgeCaps")); -+ - if (tagCompund.hasKey("Tags", 9)) - { - this.field_184236_aF.clear(); -@@ -1715,7 +1729,10 @@ - { - EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, itemStackIn); - entityitem.setDefaultPickupDelay(); -- this.worldObj.spawnEntityInWorld(entityitem); -+ if (captureDrops) -+ this.capturedDrops.add(entityitem); -+ else -+ this.worldObj.spawnEntityInWorld(entityitem); - return entityitem; - } - else -@@ -1824,6 +1841,7 @@ - - public boolean func_184205_a(Entity p_184205_1_, boolean p_184205_2_) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_184205_1_, true)) return false; - if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) - { - if (this.func_184218_aH()) -@@ -2279,6 +2297,7 @@ - { - if (!this.worldObj.isRemote && !this.isDead) - { -+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return null; - this.worldObj.theProfiler.startSection("changeDimension"); - MinecraftServer minecraftserver = this.func_184102_h(); - int i = this.dimension; -@@ -2372,7 +2391,7 @@ - - public float getExplosionResistance(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn) - { -- return blockStateIn.getBlock().getExplosionResistance(this); -+ return blockStateIn.getBlock().getExplosionResistance(worldIn, pos, this, explosionIn); - } - - public boolean verifyExplosion(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn, float p_174816_5_) -@@ -2662,6 +2681,165 @@ - EnchantmentHelper.applyArthropodEnchantments(entityLivingBaseIn, entityIn); - } - -+ /* ================================== Forge Start =====================================*/ -+ /** -+ * Returns a NBTTagCompound that can be used to store custom data for this entity. -+ * It will be written, and read from disc, so it persists over world saves. -+ * @return A NBTTagCompound -+ */ -+ public NBTTagCompound getEntityData() -+ { -+ if (customEntityData == null) -+ { -+ customEntityData = new NBTTagCompound(); -+ } -+ return customEntityData; -+ } -+ -+ /** -+ * Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position. -+ * @return false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation. -+ */ -+ public boolean shouldRiderSit() -+ { -+ return true; -+ } -+ -+ /** -+ * Called when a user uses the creative pick block button on this entity. -+ * -+ * @param target The full target the player is looking at -+ * @return A ItemStack to add to the player's inventory, Null if nothing should be added. -+ */ -+ public ItemStack getPickedResult(RayTraceResult target) -+ { -+ if (this instanceof net.minecraft.entity.item.EntityPainting) -+ { -+ return new ItemStack(net.minecraft.init.Items.painting); -+ } -+ else if (this instanceof EntityLeashKnot) -+ { -+ return new ItemStack(net.minecraft.init.Items.lead); -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityItemFrame) -+ { -+ ItemStack held = ((net.minecraft.entity.item.EntityItemFrame)this).getDisplayedItem(); -+ if (held == null) -+ { -+ return new ItemStack(net.minecraft.init.Items.item_frame); -+ } -+ else -+ { -+ return held.copy(); -+ } -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityMinecart) -+ { -+ return ((net.minecraft.entity.item.EntityMinecart)this).getCartItem(); -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityBoat) -+ { -+ return new ItemStack(((EntityBoat)this).func_184455_j()); -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityArmorStand) -+ { -+ return new ItemStack(net.minecraft.init.Items.armor_stand); -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityEnderCrystal) -+ { -+ return new ItemStack(net.minecraft.init.Items.field_185158_cP); -+ } -+ else -+ { -+ String name = EntityList.getEntityString(this); -+ if (EntityList.entityEggs.containsKey(name)) -+ { -+ ItemStack stack = new ItemStack(net.minecraft.init.Items.spawn_egg); -+ net.minecraft.item.ItemMonsterPlacer.func_185078_a(stack, name); -+ return stack; -+ } -+ } -+ return null; -+ } -+ -+ public UUID getPersistentID() -+ { -+ return entityUniqueID; -+ } -+ -+ /** -+ * Reset the entity ID to a new value. Not to be used from Mod code -+ */ -+ public final void resetEntityId() -+ { -+ this.entityId = nextEntityID++; -+ } -+ -+ public boolean shouldRenderInPass(int pass) -+ { -+ return pass == 0; -+ } -+ -+ /** -+ * Returns true if the entity is of the @link{EnumCreatureType} provided -+ * @param type The EnumCreatureType type this entity is evaluating -+ * @param forSpawnCount If this is being invoked to check spawn count caps. -+ * @return If the creature is of the type provided -+ */ -+ public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) -+ { -+ if (forSpawnCount && (this instanceof EntityLiving) && ((EntityLiving)this).isNoDespawnRequired()) return false; -+ return type.getCreatureClass().isAssignableFrom(this.getClass()); -+ } -+ -+ /** -+ * If a rider of this entity can interact with this entity. Should return true on the -+ * ridden entity if so. -+ * -+ * @return if the entity can be interacted with from a rider -+ */ -+ public boolean canRiderInteract() -+ { -+ return false; -+ } -+ -+ /** -+ * If the rider should be dismounted from the entity when the entity goes under water -+ * -+ * @param rider The entity that is riding -+ * @return if the entity should be dismounted when under water -+ */ -+ public boolean shouldDismountInWater(Entity rider) -+ { -+ return this instanceof EntityLivingBase; -+ } -+ -+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ if (getCapability(capability, facing) != null) -+ return true; -+ return capabilities == null ? false : capabilities.hasCapability(capability, facing); -+ } -+ -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ return capabilities == null ? null : capabilities.getCapability(capability, facing); -+ } -+ -+ public void deserializeNBT(NBTTagCompound nbt) -+ { -+ this.readFromNBT(nbt); -+ } -+ -+ public NBTTagCompound serializeNBT() -+ { -+ NBTTagCompound ret = new NBTTagCompound(); -+ ret.setString("id", this.getEntityString()); -+ this.writeToNBT(ret); -+ return ret; -+ } -+ /* ================================== Forge End =====================================*/ -+ - public void func_184178_b(EntityPlayerMP p_184178_1_) - { - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch deleted file mode 100644 index e92e37ef7e..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityHanging.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityHanging.java -@@ -139,6 +139,9 @@ - BlockPos blockpos1 = blockpos.offset(enumfacing, k + i1).up(l + j1); - IBlockState iblockstate = this.worldObj.getBlockState(blockpos1); - -+ if (iblockstate.isSideSolid(this.worldObj, blockpos1, this.facingDirection)) -+ continue; -+ - if (!iblockstate.func_185904_a().isSolid() && !BlockRedstoneDiode.func_185546_B(iblockstate)) - { - return false; diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch deleted file mode 100644 index a795edd304..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityList.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityList.java -@@ -91,6 +91,7 @@ - - public static void addMapping(Class entityClass, String entityName, int id) - { -+ if (id < 0 || id > 255) throw new IllegalArgumentException("Attempted to register a entity with invalid ID: " + id + " Name: " + entityName + " Class: " + entityClass); - if (stringToClassMapping.containsKey(entityName)) - { - throw new IllegalArgumentException("ID is already registered: " + entityName); -@@ -148,9 +149,10 @@ - { - Entity entity = null; - -+ Class oclass = null; - try - { -- Class oclass = (Class)stringToClassMapping.get(nbt.getString("id")); -+ oclass = stringToClassMapping.get(nbt.getString("id")); - - if (oclass != null) - { -@@ -164,7 +166,17 @@ - - if (entity != null) - { -+ try -+ { - entity.readFromNBT(nbt); -+ } -+ catch (Exception e) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, -+ "An Entity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ nbt.getString("id"), oclass.getName()); -+ entity = null; -+ } - } - else - { diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch deleted file mode 100644 index ab82bb636b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java -@@ -171,6 +171,7 @@ - public void setAttackTarget(EntityLivingBase entitylivingbaseIn) - { - this.attackTarget = entitylivingbaseIn; -+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, entitylivingbaseIn); - } - - public boolean canAttackClass(Class cls) -@@ -699,10 +700,22 @@ - - protected void despawnEntity() - { -+ net.minecraftforge.fml.common.eventhandler.Event.Result result = null; - if (this.persistenceRequired) - { - this.entityAge = 0; - } -+ else if ((this.entityAge & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT) -+ { -+ if (result == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ this.entityAge = 0; -+ } -+ else -+ { -+ this.setDead(); -+ } -+ } - else - { - Entity entity = this.worldObj.getClosestPlayerToEntity(this, -1.0D); -@@ -835,7 +848,6 @@ - return !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()) && this.worldObj.func_184144_a(this, this.getEntityBoundingBox()).isEmpty() && this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this); - } - -- @SideOnly(Side.CLIENT) - public float getRenderSizeModifier() - { - return 1.0F; diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch deleted file mode 100644 index b27b6a34c3..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ /dev/null @@ -1,286 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java -@@ -190,9 +190,11 @@ - float f = (float)MathHelper.ceiling_float_int(this.fallDistance - 3.0F); - - if (p_184231_4_.func_185904_a() != Material.air) -+ if (p_184231_4_.getBlock().isAir(p_184231_4_, worldObj, p_184231_5_)) - { - double d0 = Math.min((double)(0.2F + f / 15.0F), 2.5D); - int i = (int)(150.0D * d0); -+ if (!p_184231_4_.getBlock().addLandingEffects(p_184231_4_, (WorldServer)this.worldObj, p_184231_5_, p_184231_4_, this, i)) - ((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.BLOCK_DUST, this.posX, this.posY, this.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] {Block.getStateId(p_184231_4_)}); - } - } -@@ -264,7 +266,7 @@ - } - } - -- if (!this.worldObj.isRemote && this.func_184218_aH() && this.func_184187_bx() instanceof EntityLivingBase) -+ if (!this.worldObj.isRemote && this.func_184218_aH() && this.func_184187_bx() != null && this.func_184187_bx().shouldDismountInWater(this)) - { - this.func_184210_p(); - } -@@ -363,7 +365,7 @@ - if (!this.worldObj.isRemote && (this.isPlayer() || this.recentlyHit > 0 && this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot"))) - { - int i = this.getExperiencePoints(this.attackingPlayer); -- -+ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.attackingPlayer, i); - while (i > 0) - { - int j = EntityXPOrb.getXPSplit(i); -@@ -424,6 +426,7 @@ - { - this.entityLivingToAttack = livingBase; - this.revengeTimer = this.ticksExisted; -+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, livingBase); - } - - public EntityLivingBase getLastAttacker() -@@ -775,6 +778,8 @@ - - public void heal(float healAmount) - { -+ healAmount = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, healAmount); -+ if (healAmount <= 0) return; - float f = this.getHealth(); - - if (f > 0.0F) -@@ -795,6 +800,7 @@ - - public boolean attackEntityFrom(DamageSource source, float amount) - { -+ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, source, amount)) return false; - if (this.isEntityInvulnerable(source)) - { - return false; -@@ -883,9 +889,9 @@ - this.recentlyHit = 100; - this.attackingPlayer = (EntityPlayer)entity; - } -- else if (entity instanceof EntityWolf) -+ else if (entity instanceof net.minecraft.entity.passive.EntityTameable) - { -- EntityWolf entitywolf = (EntityWolf)entity; -+ net.minecraft.entity.passive.EntityTameable entitywolf = (net.minecraft.entity.passive.EntityTameable)entity; - - if (entitywolf.isTamed()) - { -@@ -1007,6 +1013,7 @@ - - public void onDeath(DamageSource cause) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; - if (!this.dead) - { - Entity entity = cause.getEntity(); -@@ -1034,11 +1041,24 @@ - i = EnchantmentHelper.func_185283_h((EntityLivingBase)entity); - } - -+ captureDrops = true; -+ capturedDrops.clear(); -+ - if (this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot")) - { - boolean flag = this.recentlyHit > 0; - this.func_184610_a(flag, i, cause); - } -+ -+ captureDrops = false; -+ -+ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, cause, capturedDrops, i, recentlyHit > 0)) -+ { -+ for (EntityItem item : capturedDrops) -+ { -+ worldObj.spawnEntityInWorld(item); -+ } -+ } - } - - this.worldObj.setEntityState(this, (byte)3); -@@ -1113,7 +1133,7 @@ - BlockPos blockpos = new BlockPos(i, j, k); - IBlockState iblockstate = this.worldObj.getBlockState(blockpos); - Block block = iblockstate.getBlock(); -- return block != Blocks.ladder && block != Blocks.vine ? block instanceof BlockTrapDoor && this.func_184604_a(blockpos, iblockstate) : true; -+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(iblockstate, worldObj, new BlockPos(i, j, k), this); - } - } - -@@ -1139,6 +1159,9 @@ - - public void fall(float distance, float damageMultiplier) - { -+ float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, distance, damageMultiplier); -+ if (ret == null) return; -+ distance = ret[0]; damageMultiplier = ret[1]; - super.fall(distance, damageMultiplier); - PotionEffect potioneffect = this.getActivePotionEffect(MobEffects.jump); - float f = potioneffect == null ? 0.0F : (float)(potioneffect.getAmplifier() + 1); -@@ -1231,6 +1254,8 @@ - { - if (!this.isEntityInvulnerable(damageSrc)) - { -+ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); -+ if (damageAmount <= 0) return; - damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); - damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); - float f = damageAmount; -@@ -1279,6 +1304,11 @@ - - public void func_184609_a(EnumHand p_184609_1_) - { -+ ItemStack stack = this.func_184586_b(p_184609_1_); -+ if (stack != null && stack.getItem() != null) -+ { -+ if (stack.getItem().onEntitySwing(this, stack)) return; -+ } - if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) - { - this.swingProgressInt = -1; -@@ -1476,6 +1506,7 @@ - - public void dismountEntity(Entity p_110145_1_) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_110145_1_, false)) return; - if (!(p_110145_1_ instanceof EntityBoat) && !(p_110145_1_ instanceof EntityHorse)) - { - double d1 = p_110145_1_.posX; -@@ -1500,7 +1531,7 @@ - - if (!this.worldObj.func_184143_b(axisalignedbb1)) - { -- if (this.worldObj.getBlockState(new BlockPos(d11, this.posY, d12)).func_185896_q()) -+ if (this.worldObj.getBlockState(new BlockPos(d11, this.posY, d12)).isSideSolid(worldObj, new BlockPos(d11, this.posY, d12), EnumFacing.UP)) - { - this.setPositionAndUpdate(d11, this.posY + 1.0D, d12); - return; -@@ -1508,14 +1539,14 @@ - - BlockPos blockpos = new BlockPos(d11, this.posY - 1.0D, d12); - -- if (this.worldObj.getBlockState(blockpos).func_185896_q() || this.worldObj.getBlockState(blockpos).func_185904_a() == Material.water) -+ if (this.worldObj.getBlockState(blockpos).isSideSolid(worldObj, blockpos, EnumFacing.UP) || this.worldObj.getBlockState(blockpos).func_185904_a() == Material.water) - { - d1 = d11; - d13 = this.posY + 1.0D; - d14 = d12; - } - } -- else if (!this.worldObj.func_184143_b(axisalignedbb1.offset(0.0D, 1.0D, 0.0D)) && this.worldObj.getBlockState(new BlockPos(d11, this.posY + 1.0D, d12)).func_185896_q()) -+ else if (!this.worldObj.func_184143_b(axisalignedbb1.offset(0.0D, 1.0D, 0.0D)) && this.worldObj.getBlockState(new BlockPos(d11, this.posY + 1.0D, d12)).isSideSolid(worldObj, new BlockPos(d11, this.posY + 1.0D, d12), EnumFacing.UP)) - { - d1 = d11; - d13 = this.posY + 2.0D; -@@ -1586,6 +1617,7 @@ - } - - this.isAirBorne = true; -+ net.minecraftforge.common.ForgeHooks.onLivingJump(this); - } - - protected void updateAITick() -@@ -1845,6 +1877,7 @@ - - public void onUpdate() - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return; - super.onUpdate(); - this.func_184608_ct(); - -@@ -2351,6 +2384,40 @@ - this.potionsNeedUpdate = true; - } - -+ /*** -+ * Removes all potion effects that have curativeItem as a curative item for its effect -+ * @param curativeItem The itemstack we are using to cure potion effects -+ */ -+ public void curePotionEffects(ItemStack curativeItem) -+ { -+ if (worldObj.isRemote) return; -+ Iterator iterator = this.activePotionsMap.values().iterator(); -+ -+ while (iterator.hasNext()) -+ { -+ PotionEffect effect = iterator.next(); -+ -+ if (effect.isCurativeItem(curativeItem)) -+ { -+ onFinishedPotionEffect(effect); -+ iterator.remove(); -+ this.potionsNeedUpdate = true; -+ } -+ } -+ } -+ -+ /** -+ * Returns true if the entity's rider (EntityPlayer) should face forward when mounted. -+ * currently only used in vanilla code by pigs. -+ * -+ * @param player The player who is riding the entity. -+ * @return If the player should orient the same direction as this entity. -+ */ -+ public boolean shouldRiderFaceForward(EntityPlayer player) -+ { -+ return this instanceof net.minecraft.entity.passive.EntityPig; -+ } -+ - public abstract EnumHandSide func_184591_cq(); - - public boolean func_184587_cr() -@@ -2371,6 +2438,14 @@ - - if (itemstack == this.field_184627_bm) - { -+ field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn); -+ if (field_184628_bn <= 0) -+ { -+ this.onItemUseFinish(); -+ } -+ else -+ { // Forge Keep unindented to lower patch -+ field_184627_bm.getItem().onUsingTick(field_184627_bm, this, field_184628_bn); //Forge Added - if (this.func_184605_cv() <= 25 && this.func_184605_cv() % 4 == 0) - { - this.func_184584_a(this.field_184627_bm, 5); -@@ -2380,6 +2455,7 @@ - { - this.onItemUseFinish(); - } -+ } - } - else - { -@@ -2394,8 +2470,10 @@ - - if (itemstack != null && !this.func_184587_cr()) - { -+ int duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, itemstack, itemstack.getMaxItemUseDuration()); -+ if (duration <= 0) return; - this.field_184627_bm = itemstack; -- this.field_184628_bn = itemstack.getMaxItemUseDuration(); -+ this.field_184628_bn = duration; - - if (!this.worldObj.isRemote) - { -@@ -2478,6 +2556,8 @@ - this.func_184584_a(this.field_184627_bm, 16); - ItemStack itemstack = this.field_184627_bm.onItemUseFinish(this.worldObj, this); - -+ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, field_184627_bm, func_184605_cv(), itemstack); -+ - if (itemstack != null && itemstack.stackSize == 0) - { - itemstack = null; -@@ -2508,6 +2588,8 @@ - if (this.field_184627_bm != null) - { - this.field_184627_bm.onPlayerStoppedUsing(this.worldObj, this, this.func_184605_cv()); -+ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_184627_bm, this.func_184605_cv())) -+ this.field_184627_bm.onPlayerStoppedUsing(this.worldObj, this, this.func_184605_cv()); - } - - this.func_184602_cy(); diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch deleted file mode 100644 index 0e8f1cf592..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java -+++ ../src-work/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java -@@ -44,6 +44,12 @@ - return (EntityLiving.SpawnPlacementType)ENTITY_PLACEMENTS.get(entityClass); - } - -+ public static void setPlacementType(Class entityClass, EntityLiving.SpawnPlacementType placementType) -+ { -+ if(!ENTITY_PLACEMENTS.containsKey(entityClass)) -+ ENTITY_PLACEMENTS.put(entityClass, placementType); -+ } -+ - static - { - ENTITY_PLACEMENTS.put(EntityBat.class, EntityLiving.SpawnPlacementType.ON_GROUND); diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch deleted file mode 100644 index 8901784d44..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java -@@ -75,6 +75,8 @@ - - public void trackEntity(Entity p_72786_1_) - { -+ if (net.minecraftforge.fml.common.registry.EntityRegistry.instance().tryTrackingEntity(this, p_72786_1_)) return; -+ - if (p_72786_1_ instanceof EntityPlayerMP) - { - this.trackEntity(p_72786_1_, 512, 2); -@@ -329,6 +331,25 @@ - } - } - -+ /* ======================================== FORGE START =====================================*/ -+ -+ // don't expose the EntityTrackerEntry directly so mods can't mess with the data in there as easily -+ /** -+ * Get all players tracking the given Entity. The Entity must be part of the World that this Tracker belongs to. -+ * @param entity the Entity -+ * @return all players tracking the Entity -+ */ -+ public Set getTrackingPlayers(Entity entity) -+ { -+ EntityTrackerEntry entry = (EntityTrackerEntry) trackedEntityHashTable.lookup(entity.getEntityId()); -+ if (entry == null) -+ return java.util.Collections.emptySet(); -+ else -+ return java.util.Collections.unmodifiableSet(entry.trackingPlayers); -+ } -+ -+ /* ======================================== FORGE END =====================================*/ -+ - public void func_151248_b(Entity entityIn, Packet p_151248_2_) - { - EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry)this.trackedEntityHashTable.lookup(entityIn.getEntityId()); diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch deleted file mode 100644 index 42d43da738..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java -@@ -398,6 +398,14 @@ - this.lastTrackedEntityMotionY = this.trackedEntity.motionY; - this.motionZ = this.trackedEntity.motionZ; - -+ int posX = MathHelper.floor_double(this.trackedEntity.posX * 32.0D); -+ int posY = MathHelper.floor_double(this.trackedEntity.posY * 32.0D); -+ int posZ = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D); -+ if (posX != this.encodedPosX || posY != this.encodedPosY || posZ != this.encodedPosZ) -+ { -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.trackedEntity, playerMP, this.encodedPosX, this.encodedPosY, this.encodedPosZ); -+ } -+ - if (flag && !(packet instanceof SPacketSpawnMob)) - { - playerMP.playerNetServerHandler.sendPacket(new SPacketEntityVelocity(this.trackedEntity.getEntityId(), this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ)); -@@ -438,6 +446,7 @@ - - this.trackedEntity.func_184178_b(playerMP); - playerMP.func_184848_d(this.trackedEntity); -+ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(trackedEntity, playerMP); - } - } - else if (this.trackingPlayers.contains(playerMP)) -@@ -445,6 +454,7 @@ - this.trackingPlayers.remove(playerMP); - this.trackedEntity.func_184203_c(playerMP); - playerMP.removeEntity(this.trackedEntity); -+ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(trackedEntity, playerMP); - } - } - } -@@ -477,6 +487,9 @@ - logger.warn("Fetching addPacket for removed entity"); - } - -+ Packet pkt = net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.getEntitySpawningPacket(this.trackedEntity); -+ if (pkt != null) return pkt; -+ - if (this.trackedEntity instanceof EntityItem) - { - return new SPacketSpawnObject(this.trackedEntity, 2, 1); diff --git a/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch b/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch deleted file mode 100644 index df4bcbc3d2..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java -+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java -@@ -21,6 +21,8 @@ - private double targetY; - private double targetZ; - protected final int field_188493_g = 20; -+ private int failedPathFindingPenalty = 0; -+ private boolean canPenalize = false; - - public EntityAIAttackMelee(EntityCreature creature, double speedIn, boolean useLongMemory) - { -@@ -45,6 +47,19 @@ - } - else - { -+ if (canPenalize) -+ { -+ if (--this.delayCounter <= 0) -+ { -+ this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); -+ this.targetX = 4 + this.attacker.getRNG().nextInt(7); -+ return this.entityPathEntity != null; -+ } -+ else -+ { -+ return true; -+ } -+ } - this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); - return this.entityPathEntity != null; - } -@@ -89,6 +104,23 @@ - this.targetZ = entitylivingbase.posZ; - this.delayCounter = 4 + this.attacker.getRNG().nextInt(7); - -+ if (this.canPenalize) -+ { -+ this.targetX += failedPathFindingPenalty; -+ if (this.attacker.getNavigator().getPath() != null) -+ { -+ net.minecraft.pathfinding.PathPoint finalPathPoint = this.attacker.getNavigator().getPath().getFinalPathPoint(); -+ if (finalPathPoint != null && entitylivingbase.getDistanceSq(finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord) < 1) -+ failedPathFindingPenalty = 0; -+ else -+ failedPathFindingPenalty += 10; -+ } -+ else -+ { -+ failedPathFindingPenalty += 10; -+ } -+ } -+ - if (d0 > 1024.0D) - { - this.delayCounter += 10; diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch deleted file mode 100644 index f8d066e7e6..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/boss/EntityDragon.java -+++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java -@@ -474,13 +474,13 @@ - IBlockState iblockstate = this.worldObj.getBlockState(blockpos); - Block block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() != Material.air && iblockstate.func_185904_a() != Material.fire) -+ if (!block.isAir(iblockstate, this.worldObj, blockpos) && iblockstate.func_185904_a() != Material.fire) - { - if (!this.worldObj.getGameRules().getBoolean("mobGriefing")) - { - flag = true; - } -- else if (block != Blocks.barrier && block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && block != Blocks.end_portal && block != Blocks.end_portal_frame) -+ else if (block.canEntityDestroy(iblockstate, this.worldObj, blockpos, this)) - { - if (block != Blocks.command_block && block != Blocks.field_185776_dc && block != Blocks.field_185777_dd && block != Blocks.iron_bars && block != Blocks.field_185775_db) - { diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch deleted file mode 100644 index 8936ecdcb2..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/boss/EntityWither.java -+++ ../src-work/minecraft/net/minecraft/entity/boss/EntityWither.java -@@ -365,7 +365,7 @@ - IBlockState iblockstate = this.worldObj.getBlockState(blockpos); - Block block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() != Material.air && func_181033_a(block)) -+ if (!block.isAir(iblockstate, this.worldObj, blockpos)) - { - flag = this.worldObj.destroyBlock(blockpos, true) || flag; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch deleted file mode 100644 index e461fad3cc..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java -+++ ../src-work/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java -@@ -104,7 +104,8 @@ - for (int i = 0; i < list.size(); ++i) - { - Entity entity = (Entity)list.get(i); -- entity.onStruckByLightning(this); -+ if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this)) -+ entity.onStruckByLightning(this); - } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch deleted file mode 100644 index 4244d13761..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityEnderPearl.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java -@@ -84,6 +84,9 @@ - - if (entityplayermp.playerNetServerHandler.getNetworkManager().isChannelOpen() && entityplayermp.worldObj == this.worldObj && !entityplayermp.isPlayerSleeping()) - { -+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) -+ { // Don't indent to lower patch size - if (this.rand.nextFloat() < 0.05F && this.worldObj.getGameRules().getBoolean("doMobSpawning")) - { - EntityEndermite entityendermite = new EntityEndermite(this.worldObj); -@@ -97,9 +100,10 @@ - this.func_184210_p(); - } - -- entitylivingbase.setPositionAndUpdate(this.posX, this.posY, this.posZ); -+ entitylivingbase.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ); - entitylivingbase.fallDistance = 0.0F; -- entitylivingbase.attackEntityFrom(DamageSource.fall, 5.0F); -+ entitylivingbase.attackEntityFrom(DamageSource.fall, event.attackDamage); -+ } - } - } - else if (entitylivingbase != null) diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch deleted file mode 100644 index fca72641b7..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityFallingBlock.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityFallingBlock.java -@@ -129,6 +129,7 @@ - { - IBlockState iblockstate = this.worldObj.getBlockState(blockpos1); - -+ if (this.worldObj.isAirBlock(new BlockPos(this.posX, this.posY - 0.009999999776482582D, this.posZ))) //Forge: Don't indent below. - if (BlockFalling.func_185759_i(this.worldObj.getBlockState(new BlockPos(this.posX, this.posY - 0.009999999776482582D, this.posZ)))) - { - this.onGround = false; diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch deleted file mode 100644 index 5562fd6469..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch +++ /dev/null @@ -1,114 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java -@@ -37,6 +37,11 @@ - private String owner; - public float hoverStart; - -+ /** -+ * The maximum age of this EntityItem. The item is expired once this is reached. -+ */ -+ public int lifespan = 6000; -+ - public EntityItem(World worldIn, double x, double y, double z) - { - super(worldIn); -@@ -54,6 +59,7 @@ - { - this(worldIn, x, y, z); - this.setEntityItemStack(stack); -+ this.lifespan = (stack.getItem() == null ? 6000 : stack.getItem().getEntityLifespan(stack, worldIn)); - } - - protected boolean canTriggerWalking() -@@ -77,6 +83,8 @@ - - public void onUpdate() - { -+ ItemStack stack = this.func_184212_Q().func_187225_a(field_184533_c).orNull(); -+ if (stack != null && stack.getItem() != null && stack.getItem().onEntityItemUpdate(this)) return; - if (this.getEntityItem() == null) - { - this.setDead(); -@@ -137,8 +145,16 @@ - - this.handleWaterMovement(); - -- if (!this.worldObj.isRemote && this.age >= 6000) -+ ItemStack item = this.func_184212_Q().func_187225_a(field_184533_c).orNull(); -+ -+ if (!this.worldObj.isRemote && this.age >= lifespan) - { -+ int hook = net.minecraftforge.event.ForgeEventFactory.onItemExpire(this, item); -+ if (hook < 0) this.setDead(); -+ else this.lifespan += hook; -+ } -+ if (item != null && item.stackSize <= 0) -+ { - this.setDead(); - } - } -@@ -279,6 +295,7 @@ - tagCompound.setShort("Health", (short)this.health); - tagCompound.setShort("Age", (short)this.age); - tagCompound.setShort("PickupDelay", (short)this.delayBeforeCanPickup); -+ tagCompound.setInteger("Lifespan", lifespan); - - if (this.getThrower() != null) - { -@@ -319,20 +336,23 @@ - NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Item"); - this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound)); - -- if (this.getEntityItem() == null) -- { -- this.setDead(); -- } -+ ItemStack item = this.func_184212_Q().func_187225_a(field_184533_c).orNull(); -+ if (item == null || item.stackSize <= 0) this.setDead(); -+ if (tagCompund.hasKey("Lifespan")) lifespan = tagCompund.getInteger("Lifespan"); - } - - public void onCollideWithPlayer(EntityPlayer entityIn) - { - if (!this.worldObj.isRemote) - { -+ if (this.delayBeforeCanPickup > 0) return; - ItemStack itemstack = this.getEntityItem(); - int i = itemstack.stackSize; - -- if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack)) -+ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, entityIn, itemstack); -+ if (hook < 0) return; -+ -+ if (this.delayBeforeCanPickup <= 0 && (this.owner == null || lifespan - this.age <= 200 || this.owner.equals(entityIn.getName())) && (hook == 1 || i <= 0 || entityIn.inventory.addItemStackToInventory(itemstack))) - { - if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log)) - { -@@ -369,6 +389,7 @@ - } - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(entityIn, this); - if (!this.isSilent()) - { - this.worldObj.func_184148_a((EntityPlayer)null, entityIn.posX, entityIn.posY, entityIn.posZ, SoundEvents.field_187638_cR, SoundCategory.PLAYERS, 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); -@@ -414,11 +435,6 @@ - - if (itemstack == null) - { -- if (this.worldObj != null) -- { -- logger.error("Item entity " + this.getEntityId() + " has no item?!"); -- } -- - return new ItemStack(Blocks.stone); - } - else -@@ -492,6 +508,6 @@ - public void func_174870_v() - { - this.setInfinitePickupDelay(); -- this.age = 5999; -+ this.age = getEntityItem().getItem().getEntityLifespan(getEntityItem(), worldObj) - 1; - } - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch deleted file mode 100644 index a01a4c93ab..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityItemFrame.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityItemFrame.java -@@ -137,7 +137,7 @@ - { - if (p_110131_1_ != null) - { -- if (p_110131_1_.getItem() == Items.filled_map) -+ if (p_110131_1_.getItem() instanceof net.minecraft.item.ItemMap) - { - MapData mapdata = ((ItemMap)p_110131_1_.getItem()).getMapData(p_110131_1_, this.worldObj); - mapdata.mapDecorations.remove("frame-" + this.getEntityId()); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch deleted file mode 100644 index a9e284240d..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ /dev/null @@ -1,439 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecart.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecart.java -@@ -54,6 +54,20 @@ - @SideOnly(Side.CLIENT) - private double velocityZ; - -+ /* Forge: Minecart Compatibility Layer Integration. */ -+ public static float defaultMaxSpeedAirLateral = 0.4f; -+ public static float defaultMaxSpeedAirVertical = -1f; -+ public static double defaultDragAir = 0.94999998807907104D; -+ protected boolean canUseRail = true; -+ protected boolean canBePushed = true; -+ private static net.minecraftforge.common.IMinecartCollisionHandler collisionHandler = null; -+ -+ /* Instance versions of the above physics properties */ -+ private float currentSpeedRail = getMaxCartSpeedOnRail(); -+ protected float maxSpeedAirLateral = defaultMaxSpeedAirLateral; -+ protected float maxSpeedAirVertical = defaultMaxSpeedAirVertical; -+ protected double dragAir = defaultDragAir; -+ - public EntityMinecart(World worldIn) - { - super(worldIn); -@@ -99,17 +113,19 @@ - - public AxisAlignedBB getCollisionBox(Entity entityIn) - { -+ if (getCollisionHandler() != null) return getCollisionHandler().getCollisionBox(this, entityIn); - return entityIn.canBePushed() ? entityIn.getEntityBoundingBox() : null; - } - - public AxisAlignedBB getCollisionBoundingBox() - { -+ if (getCollisionHandler() != null) return getCollisionHandler().getBoundingBox(this); - return null; - } - - public boolean canBePushed() - { -- return true; -+ return canBePushed; - } - - public EntityMinecart(World worldIn, double x, double y, double z) -@@ -315,7 +331,7 @@ - BlockPos blockpos = new BlockPos(k, l, i1); - IBlockState iblockstate = this.worldObj.getBlockState(blockpos); - -- if (BlockRailBase.isRailBlock(iblockstate)) -+ if (canUseRail() && BlockRailBase.isRailBlock(iblockstate)) - { - this.func_180460_a(blockpos, iblockstate); - -@@ -354,7 +370,10 @@ - - this.setRotation(this.rotationYaw, this.rotationPitch); - -- for (Entity entity : this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D))) -+ AxisAlignedBB box; -+ if (getCollisionHandler() != null) box = getCollisionHandler().getMinecartCollisionBox(this); -+ else box = this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D); -+ for (Entity entity : this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box)) - { - if (!this.func_184196_w(entity) && entity.canBePushed() && entity instanceof EntityMinecart) - { -@@ -363,6 +382,7 @@ - } - - this.handleWaterMovement(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition())); - } - } - -@@ -377,10 +397,21 @@ - - protected void moveDerailedMinecart() - { -- double d0 = this.getMaximumSpeed(); -+ double d0 = onGround ? this.getMaximumSpeed() : getMaxSpeedAirLateral(); - this.motionX = MathHelper.clamp_double(this.motionX, -d0, d0); - this.motionZ = MathHelper.clamp_double(this.motionZ, -d0, d0); - -+ double moveY = motionY; -+ if(getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical()) -+ { -+ moveY = getMaxSpeedAirVertical(); -+ if(Math.abs(motionX) < 0.3f && Math.abs(motionZ) < 0.3f) -+ { -+ moveY = 0.15f; -+ motionY = moveY; -+ } -+ } -+ - if (this.onGround) - { - this.motionX *= 0.5D; -@@ -388,13 +419,13 @@ - this.motionZ *= 0.5D; - } - -- this.moveEntity(this.motionX, this.motionY, this.motionZ); -+ this.moveEntity(this.motionX, moveY, this.motionZ); - - if (!this.onGround) - { -- this.motionX *= 0.949999988079071D; -- this.motionY *= 0.949999988079071D; -- this.motionZ *= 0.949999988079071D; -+ this.motionX *= getDragAir(); -+ this.motionY *= getDragAir(); -+ this.motionZ *= getDragAir(); - } - } - -@@ -414,25 +445,25 @@ - flag1 = !flag; - } - -- double d0 = 0.0078125D; -+ double slopeAdjustment = getSlopeAdjustment(); - BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.getValue(blockrailbase.getShapeProperty()); - - switch (blockrailbase$enumraildirection) - { - case ASCENDING_EAST: -- this.motionX -= 0.0078125D; -+ this.motionX -= slopeAdjustment; - ++this.posY; - break; - case ASCENDING_WEST: -- this.motionX += 0.0078125D; -+ this.motionX += slopeAdjustment; - ++this.posY; - break; - case ASCENDING_NORTH: -- this.motionZ += 0.0078125D; -+ this.motionZ += slopeAdjustment; - ++this.posY; - break; - case ASCENDING_SOUTH: -- this.motionZ -= 0.0078125D; -+ this.motionZ -= slopeAdjustment; - ++this.posY; - } - -@@ -478,7 +509,7 @@ - } - } - -- if (flag1) -+ if (flag1 && shouldDoRailFunctions()) - { - double d17 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); - -@@ -526,6 +557,7 @@ - this.setPosition(this.posX, this.posY, this.posZ); - double d22 = this.motionX; - double d23 = this.motionZ; -+ this.moveMinecartOnRail(p_180460_1_); - - if (this.func_184207_aI()) - { -@@ -574,8 +606,14 @@ - this.motionZ = d5 * (double)(i - p_180460_1_.getZ()); - } - -- if (flag) -+ -+ if(shouldDoRailFunctions()) - { -+ ((BlockRailBase)p_180460_2_.getBlock()).onMinecartPass(worldObj, this, p_180460_1_); -+ } -+ -+ if (flag && shouldDoRailFunctions()) -+ { - double d15 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); - - if (d15 > 0.01D) -@@ -795,13 +833,19 @@ - - public void applyEntityCollision(Entity entityIn) - { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, entityIn)); -+ if (getCollisionHandler() != null) -+ { -+ getCollisionHandler().onEntityCollision(this, entityIn); -+ return; -+ } - if (!this.worldObj.isRemote) - { - if (!entityIn.noClip && !this.noClip) - { - if (!this.func_184196_w(entityIn)) - { -- if (entityIn instanceof EntityLivingBase && this.func_184264_v() == EntityMinecart.Type.RIDEABLE && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && !this.func_184207_aI() && !entityIn.func_184218_aH()) -+ if (entityIn instanceof EntityLivingBase && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && !this.func_184207_aI() && !entityIn.func_184218_aH()) - { - entityIn.func_184220_m(this); - } -@@ -847,7 +891,7 @@ - double d7 = entityIn.motionX + this.motionX; - double d8 = entityIn.motionZ + this.motionZ; - -- if (((EntityMinecart)entityIn).func_184264_v() == EntityMinecart.Type.FURNACE && this.func_184264_v() != EntityMinecart.Type.FURNACE) -+ if (((EntityMinecart)entityIn).isPoweredCart() && !isPoweredCart()) - { - this.motionX *= 0.20000000298023224D; - this.motionZ *= 0.20000000298023224D; -@@ -855,7 +899,7 @@ - entityIn.motionX *= 0.949999988079071D; - entityIn.motionZ *= 0.949999988079071D; - } -- else if (((EntityMinecart)entityIn).func_184264_v() != EntityMinecart.Type.FURNACE && this.func_184264_v() == EntityMinecart.Type.FURNACE) -+ else if (!((EntityMinecart)entityIn).isPoweredCart() && isPoweredCart()) - { - entityIn.motionX *= 0.20000000298023224D; - entityIn.motionZ *= 0.20000000298023224D; -@@ -982,6 +1026,221 @@ - this.func_184212_Q().func_187227_b(field_184270_f, Boolean.valueOf(p_94096_1_)); - } - -+ /* =================================== FORGE START ===========================================*/ -+ private BlockPos getCurrentRailPosition() -+ { -+ int x = MathHelper.floor_double(this.posX); -+ int y = MathHelper.floor_double(this.posY); -+ int z = MathHelper.floor_double(this.posZ); -+ -+ if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(x, y - 1, z))) y--; -+ return new BlockPos(x, y, z); -+ } -+ -+ protected double getMaxSpeed() -+ { -+ if (!canUseRail()) return getMaximumSpeed(); -+ BlockPos pos = this.getCurrentRailPosition(); -+ IBlockState state = this.worldObj.getBlockState(pos); -+ if (!BlockRailBase.isRailBlock(state)) return getMaximumSpeed(); -+ -+ float railMaxSpeed = ((BlockRailBase)state.getBlock()).getRailMaxSpeed(worldObj, this, pos); -+ return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); -+ } -+ -+ /** -+ * Moved to allow overrides. -+ * This code handles minecart movement and speed capping when on a rail. -+ */ -+ public void moveMinecartOnRail(BlockPos pos) -+ { -+ double mX = this.motionX; -+ double mZ = this.motionZ; -+ -+ if (this.func_184187_bx() != null) -+ { -+ mX *= 0.75D; -+ mZ *= 0.75D; -+ } -+ -+ double max = this.getMaxSpeed(); -+ mX = MathHelper.clamp_double(mX, -max, max); -+ mZ = MathHelper.clamp_double(mZ, -max, max); -+ this.moveEntity(mX, 0.0D, mZ); -+ } -+ -+ /** -+ * Gets the current global Minecart Collision handler if none -+ * is registered, returns null -+ * @return The collision handler or null -+ */ -+ public static net.minecraftforge.common.IMinecartCollisionHandler getCollisionHandler() -+ { -+ return collisionHandler; -+ } -+ -+ /** -+ * Sets the global Minecart Collision handler, overwrites any -+ * that is currently set. -+ * @param handler The new handler -+ */ -+ public static void setCollisionHandler(net.minecraftforge.common.IMinecartCollisionHandler handler) -+ { -+ collisionHandler = handler; -+ } -+ -+ /** -+ * This function returns an ItemStack that represents this cart. -+ * This should be an ItemStack that can be used by the player to place the cart, -+ * but is not necessary the item the cart drops when destroyed. -+ * @return An ItemStack that can be used to place the cart. -+ */ -+ public ItemStack getCartItem() -+ { -+ if (this instanceof EntityMinecartFurnace) -+ { -+ return new ItemStack(Items.furnace_minecart); -+ } -+ else if (this instanceof EntityMinecartChest) -+ { -+ return new ItemStack(Items.chest_minecart); -+ } -+ else if (this instanceof EntityMinecartTNT) -+ { -+ return new ItemStack(Items.tnt_minecart); -+ } -+ else if (this instanceof EntityMinecartHopper) -+ { -+ return new ItemStack(Items.hopper_minecart); -+ } -+ else if (this instanceof EntityMinecartCommandBlock) -+ { -+ return new ItemStack(Items.command_block_minecart); -+ } -+ return new ItemStack(Items.minecart); -+ } -+ -+ /** -+ * Returns true if this cart can currently use rails. -+ * This function is mainly used to gracefully detach a minecart from a rail. -+ * @return True if the minecart can use rails. -+ */ -+ public boolean canUseRail() -+ { -+ return canUseRail; -+ } -+ -+ /** -+ * Set whether the minecart can use rails. -+ * This function is mainly used to gracefully detach a minecart from a rail. -+ * @param use Whether the minecart can currently use rails. -+ */ -+ public void setCanUseRail(boolean use) -+ { -+ canUseRail = use; -+ } -+ -+ /** -+ * Return false if this cart should not call onMinecartPass() and should ignore Powered Rails. -+ * @return True if this cart should call onMinecartPass(). -+ */ -+ public boolean shouldDoRailFunctions() -+ { -+ return true; -+ } -+ -+ /** -+ * Returns true if this cart is self propelled. -+ * @return True if powered. -+ */ -+ public boolean isPoweredCart() -+ { -+ return func_184264_v() == EntityMinecart.Type.FURNACE; -+ } -+ -+ /** -+ * Returns true if this cart can be ridden by an Entity. -+ * @return True if this cart can be ridden. -+ */ -+ public boolean canBeRidden() -+ { -+ return this.func_184264_v() == EntityMinecart.Type.RIDEABLE; -+ } -+ -+ /** -+ * Getters/setters for physics variables -+ */ -+ -+ /** -+ * Returns the carts max speed when traveling on rails. Carts going faster -+ * than 1.1 cause issues with chunk loading. Carts cant traverse slopes or -+ * corners at greater than 0.5 - 0.6. This value is compared with the rails -+ * max speed and the carts current speed cap to determine the carts current -+ * max speed. A normal rail's max speed is 0.4. -+ * -+ * @return Carts max speed. -+ */ -+ public float getMaxCartSpeedOnRail() -+ { -+ return 1.2f; -+ } -+ -+ /** -+ * Returns the current speed cap for the cart when traveling on rails. This -+ * functions differs from getMaxCartSpeedOnRail() in that it controls -+ * current movement and cannot be overridden. The value however can never be -+ * higher than getMaxCartSpeedOnRail(). -+ * -+ * @return -+ */ -+ public final float getCurrentCartSpeedCapOnRail() -+ { -+ return currentSpeedRail; -+ } -+ -+ public final void setCurrentCartSpeedCapOnRail(float value) -+ { -+ value = Math.min(value, getMaxCartSpeedOnRail()); -+ currentSpeedRail = value; -+ } -+ -+ public float getMaxSpeedAirLateral() -+ { -+ return maxSpeedAirLateral; -+ } -+ -+ public void setMaxSpeedAirLateral(float value) -+ { -+ maxSpeedAirLateral = value; -+ } -+ -+ public float getMaxSpeedAirVertical() -+ { -+ return maxSpeedAirVertical; -+ } -+ -+ public void setMaxSpeedAirVertical(float value) -+ { -+ maxSpeedAirVertical = value; -+ } -+ -+ public double getDragAir() -+ { -+ return dragAir; -+ } -+ -+ public void setDragAir(double value) -+ { -+ dragAir = value; -+ } -+ -+ public double getSlopeAdjustment() -+ { -+ return 0.0078125D; -+ } -+ -+ /* =================================== FORGE END ===========================================*/ -+ - public static enum Type - { - RIDEABLE(0, "MinecartRideable"), diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch deleted file mode 100644 index 028fa17b8d..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java -@@ -122,6 +122,7 @@ - - public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; - this.commandBlockLogic.tryOpenEditCommandBlock(p_184230_1_); - return false; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch deleted file mode 100644 index 0663f08f19..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java -@@ -200,6 +200,7 @@ - - public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) - { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; - if (!this.worldObj.isRemote) - { - p_184230_1_.displayGUIChest(this); -@@ -279,6 +280,24 @@ - } - } - -+ public net.minecraftforge.items.IItemHandler itemHandler = new net.minecraftforge.items.wrapper.InvWrapper(this); -+ -+ @Override -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) -+ { -+ return (T) itemHandler; -+ } -+ return super.getCapability(capability, facing); -+ } -+ -+ @Override -+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); -+ } -+ - public void clear() - { - this.func_184288_f((EntityPlayer)null); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch deleted file mode 100644 index 4239cd058b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java -@@ -19,6 +19,8 @@ - - public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; -+ - if (p_184230_1_.isSneaking()) - { - return false; diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch deleted file mode 100644 index e80c6fb498..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java -@@ -136,6 +136,8 @@ - - public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; -+ - if (p_184230_2_ != null && p_184230_2_.getItem() == Items.coal && this.fuel + 3600 <= 32000) - { - if (!p_184230_1_.capabilities.isCreativeMode) diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch deleted file mode 100644 index 3fbedf27bb..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java -@@ -56,6 +56,7 @@ - - public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) - { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; - if (!this.worldObj.isRemote) - { - p_184230_1_.displayGUIChest(this); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch deleted file mode 100644 index 733ef29822..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityXPOrb.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityXPOrb.java -@@ -204,6 +204,7 @@ - { - if (this.delayBeforeCanPickup == 0 && entityIn.xpCooldown == 0) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerPickupXpEvent(entityIn, this))) return; - entityIn.xpCooldown = 2; - this.worldObj.func_184148_a((EntityPlayer)null, entityIn.posX, entityIn.posY, entityIn.posZ, SoundEvents.field_187607_bg, SoundCategory.PLAYERS, 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F)); - entityIn.onItemPickup(this, 1); diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch deleted file mode 100644 index dcd8ee527d..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java -+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java -@@ -259,7 +259,9 @@ - - private boolean teleportTo(double x, double y, double z) - { -- boolean flag = this.func_184595_k(x, y, z); -+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, x, y, z, 0); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; -+ boolean flag = this.func_184595_k(event.targetX, event.targetY, event.targetZ); - - if (flag) - { -@@ -342,6 +344,18 @@ - } - } - -+ /*===================================== Forge Start ==============================*/ -+ public static void setCarriable(Block block, boolean canCarry) -+ { -+ if (canCarry) carriableBlocks.add(block); -+ else carriableBlocks.remove(block); -+ } -+ public static boolean getCarriable(Block block) -+ { -+ return carriableBlocks.contains(block); -+ } -+ /*===================================== Forge End ==============================*/ -+ - public boolean isScreaming() - { - return ((Boolean)this.dataWatcher.func_187225_a(field_184719_bw)).booleanValue(); diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch deleted file mode 100644 index a8959be684..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java -+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java -@@ -86,6 +86,7 @@ - { - this.motionY = (double)(0.42F + (float)this.getSlimeSize() * 0.1F); - this.isAirBorne = true; -+ net.minecraftforge.common.ForgeHooks.onLivingJump(this); - } - - protected void handleJumpLava() diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch deleted file mode 100644 index 07ef5a4644..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java -+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java -@@ -125,7 +125,7 @@ - if (this.onGround && !this.wasOnGround) - { - int i = this.getSlimeSize(); -- -+ if (spawnCustomParticles()) { i = 0; } // don't spawn particles if it's handled by the implementation itself - for (int j = 0; j < i * 8; ++j) - { - float f = this.rand.nextFloat() * ((float)Math.PI * 2F); -@@ -291,7 +291,7 @@ - BlockPos blockpos = new BlockPos(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ)); - Chunk chunk = this.worldObj.getChunkFromBlockCoords(blockpos); - -- if (this.worldObj.getWorldInfo().getTerrainType() == WorldType.FLAT && this.rand.nextInt(4) != 1) -+ if (this.worldObj.getWorldInfo().getTerrainType().handleSlimeSpawnReduction(rand, worldObj)) - { - return false; - } -@@ -356,6 +356,14 @@ - return this.func_189101_db() ? SoundEvents.field_189110_fE : SoundEvents.field_187882_fq; - } - -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * Called when the slime spawns particles on landing, see onUpdate. -+ * Return true to prevent the spawning of the default particles. -+ */ -+ protected boolean spawnCustomParticles() { return false; } -+ /* ======================================== FORGE END =====================================*/ -+ - static class AISlimeAttack extends EntityAIBase - { - private EntitySlime slime; diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch deleted file mode 100644 index 47b77b2621..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch +++ /dev/null @@ -1,67 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java -+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java -@@ -101,7 +101,7 @@ - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); - this.getEntityAttribute(SharedMonsterAttributes.field_188791_g).setBaseValue(2.0D); -- this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * 0.10000000149011612D); -+ this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance); - } - - protected void entityInit() -@@ -259,12 +259,24 @@ - entitylivingbase = (EntityLivingBase)source.getEntity(); - } - -- if (entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue() && this.worldObj.getGameRules().getBoolean("doMobSpawning")) -+ int i = MathHelper.floor_double(this.posX); -+ int j = MathHelper.floor_double(this.posY); -+ int k = MathHelper.floor_double(this.posZ); -+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(reinforcementChance).getAttributeValue()); -+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true; -+ -+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || -+ entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue() && this.worldObj.getGameRules().getBoolean("doMobSpawning")) - { -- int i = MathHelper.floor_double(this.posX); -- int j = MathHelper.floor_double(this.posY); -- int k = MathHelper.floor_double(this.posZ); -- EntityZombie entityzombie = new EntityZombie(this.worldObj); -+ EntityZombie entityzombie; -+ if (summonAid.customSummonedAid != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) -+ { -+ entityzombie = summonAid.customSummonedAid; -+ } -+ else -+ { -+ entityzombie = new EntityZombie(this.worldObj); -+ } - - for (int l = 0; l < 50; ++l) - { -@@ -272,14 +284,14 @@ - int j1 = j + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1); - int k1 = k + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1); - -- if (this.worldObj.getBlockState(new BlockPos(i1, j1 - 1, k1)).func_185896_q() && this.worldObj.getLightFromNeighbors(new BlockPos(i1, j1, k1)) < 10) -+ if (this.worldObj.getBlockState(new BlockPos(i1, j1 - 1, k1)).isSideSolid(this.worldObj, new BlockPos(i1, j1 - 1, k1), net.minecraft.util.EnumFacing.UP) && this.worldObj.getLightFromNeighbors(new BlockPos(i1, j1, k1)) < 10) - { - entityzombie.setPosition((double)i1, (double)j1, (double)k1); - - if (!this.worldObj.isAnyPlayerWithinRangeAt((double)i1, (double)j1, (double)k1, 7.0D) && this.worldObj.checkNoEntityCollision(entityzombie.getEntityBoundingBox(), entityzombie) && this.worldObj.func_184144_a(entityzombie, entityzombie.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.getEntityBoundingBox())) - { - this.worldObj.spawnEntityInWorld(entityzombie); -- entityzombie.setAttackTarget(entitylivingbase); -+ if (entitylivingbase != null) entityzombie.setAttackTarget(entitylivingbase); - entityzombie.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null); - this.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); - entityzombie.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); -@@ -483,7 +495,7 @@ - - if (livingdata == null) - { -- livingdata = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < 0.05F, this.worldObj.rand.nextFloat() < 0.05F); -+ livingdata = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < net.minecraftforge.common.ForgeModContainer.zombieBabyChance, this.worldObj.rand.nextFloat() < 0.05F); - } - - if (livingdata instanceof EntityZombie.GroupData) diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch deleted file mode 100644 index 23074bd5b6..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntityHorse.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityHorse.java -@@ -1200,6 +1200,7 @@ - } - - this.jumpPower = 0.0F; -+ net.minecraftforge.common.ForgeHooks.onLivingJump(this); - } - - this.stepHeight = 1.0F; diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch deleted file mode 100644 index 47493b5699..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntityMooshroom.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityMooshroom.java -@@ -13,7 +13,7 @@ - import net.minecraft.world.World; - import net.minecraft.world.storage.loot.LootTableList; - --public class EntityMooshroom extends EntityCow -+public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable - { - public EntityMooshroom(World worldIn) - { -@@ -22,6 +22,7 @@ - this.spawnableBlock = Blocks.mycelium; - } - -+ @SuppressWarnings("unused") - public boolean func_184645_a(EntityPlayer p_184645_1_, EnumHand p_184645_2_, ItemStack p_184645_3_) - { - if (p_184645_3_ != null && p_184645_3_.getItem() == Items.bowl && this.getGrowingAge() >= 0 && !p_184645_1_.capabilities.isCreativeMode) -@@ -37,7 +38,7 @@ - - return true; - } -- else if (p_184645_3_ != null && p_184645_3_.getItem() == Items.shears && this.getGrowingAge() >= 0) -+ else if (false && p_184645_3_ != null && p_184645_3_.getItem() == Items.shears && this.getGrowingAge() >= 0) //Forge Disable, Moved to onSheared - { - this.setDead(); - this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); -@@ -78,6 +79,35 @@ - return new EntityMooshroom(this.worldObj); - } - -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.math.BlockPos pos){ return getGrowingAge() >= 0; } -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.math.BlockPos pos, int fortune) -+ { -+ this.setDead(); -+ this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); -+ -+ EntityCow entitycow = new EntityCow(this.worldObj); -+ entitycow.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); -+ entitycow.setHealth(this.getHealth()); -+ entitycow.renderYawOffset = this.renderYawOffset; -+ -+ if (this.hasCustomName()) -+ { -+ entitycow.setCustomNameTag(this.getCustomNameTag()); -+ } -+ -+ this.worldObj.spawnEntityInWorld(entitycow); -+ -+ java.util.List ret = new java.util.ArrayList(); -+ for (int i = 0; i < 5; ++i) -+ { -+ ret.add(new ItemStack(Blocks.red_mushroom)); -+ } -+ -+ this.func_184185_a(SoundEvents.field_187784_dt, 1.0F, 1.0F); -+ return ret; -+ } -+ - protected ResourceLocation func_184647_J() - { - return LootTableList.field_186400_H; diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch deleted file mode 100644 index 0a74cfc615..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java -@@ -285,7 +285,7 @@ - IBlockState iblockstate = this.worldObj.getBlockState(blockpos.down()); - Block block = iblockstate.getBlock(); - -- if (block == Blocks.grass || iblockstate.func_185904_a() == Material.leaves) -+ if (block == Blocks.grass || block.isLeaves(iblockstate, this.worldObj, blockpos.down())) - { - return true; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch deleted file mode 100644 index d8b60f9592..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntitySheep.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntitySheep.java -@@ -42,7 +42,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class EntitySheep extends EntityAnimal -+public class EntitySheep extends EntityAnimal implements net.minecraftforge.common.IShearable - { - private static final DataParameter field_184774_bv = EntityDataManager.func_187226_a(EntitySheep.class, DataSerializers.field_187191_a); - private final InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() -@@ -171,9 +171,10 @@ - } - } - -+ @SuppressWarnings("unused") - public boolean func_184645_a(EntityPlayer p_184645_1_, EnumHand p_184645_2_, ItemStack p_184645_3_) - { -- if (p_184645_3_ != null && p_184645_3_.getItem() == Items.shears && !this.getSheared() && !this.isChild()) -+ if (false && p_184645_3_ != null && p_184645_3_.getItem() == Items.shears && !this.getSheared() && !this.isChild()) //Forge: Moved to onSheared - { - if (!this.worldObj.isRemote) - { -@@ -356,4 +357,19 @@ - DYE_TO_RGB.put(EnumDyeColor.RED, new float[] {0.6F, 0.2F, 0.2F}); - DYE_TO_RGB.put(EnumDyeColor.BLACK, new float[] {0.1F, 0.1F, 0.1F}); - } -+ -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return !this.getSheared() && !this.isChild(); } -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ this.setSheared(true); -+ int i = 1 + this.rand.nextInt(3); -+ -+ java.util.List ret = new java.util.ArrayList(); -+ for (int j = 0; j < i; ++j) -+ ret.add(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, this.getFleeceColor().getMetadata())); -+ -+ this.func_184185_a(SoundEvents.field_187763_eJ, 1.0F, 1.0F); -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch deleted file mode 100644 index d2209ab8a2..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java -@@ -90,6 +90,7 @@ - private boolean isLookingForHome; - private boolean areAdditionalTasksSet; - private InventoryBasic villagerInventory; -+ @Deprecated //Use VillagerRegistry - private static final EntityVillager.ITradeList[][][][] DEFAULT_TRADE_LIST_MAP = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.wheat, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.potato, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.carrot, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.bread, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.pumpkin_pie, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.apple, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.cookie, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.cake, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.fish, new EntityVillager.PriceInfo(6, 6), Items.cooked_fish, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.fishing_rod, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.shears, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool)), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.arrow, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.bow, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new EntityVillager.PriceInfo(10, 10), Items.flint, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.paper, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.book, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.compass, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.written_book, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.clock, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.name_tag, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.rotten_flesh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.gold_ingot, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.redstone, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.ender_pearl, new EntityVillager.PriceInfo(4, 7)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.experience_bottle, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_helmet, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.iron_chestplate, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_chestplate, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.chainmail_boots, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_leggings, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.chainmail_helmet, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_chestplate, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_axe, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_sword, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_sword, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_axe, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_shovel, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_pickaxe, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.porkchop, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.chicken, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.cooked_porkchop, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.cooked_chicken, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.leather, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.leather_leggings, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.leather_chestplate, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.saddle, new EntityVillager.PriceInfo(8, 10))}}}}; - - public EntityVillager(World worldIn) -@@ -221,7 +222,7 @@ - { - boolean flag = p_184645_3_ != null && p_184645_3_.getItem() == Items.spawn_egg; - -- if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild()) -+ if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !p_184645_1_.isSneaking()) - { - if (!this.worldObj.isRemote && (this.buyingList == null || !this.buyingList.isEmpty())) - { -@@ -533,6 +534,7 @@ - - private void populateBuyingList() - { -+ //TODO: Hook into VillagerRegistry - EntityVillager.ITradeList[][][] aentityvillager$itradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()]; - - if (this.careerId != 0 && this.careerLevel != 0) -@@ -647,6 +649,7 @@ - } - } - -+ //TODO: Hook into VillagerRegistry to get name - if (s1 != null) - { - TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("entity.Villager." + s1, new Object[0]); -@@ -708,7 +711,7 @@ - public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) - { - livingdata = super.onInitialSpawn(difficulty, livingdata); -- this.setProfession(this.worldObj.rand.nextInt(5)); -+ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(this, this.worldObj.rand); - this.setAdditionalAItasks(); - return livingdata; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch deleted file mode 100644 index e347436882..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ /dev/null @@ -1,540 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java -+++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java -@@ -93,6 +93,11 @@ - @SuppressWarnings("incomplete-switch") - public abstract class EntityPlayer extends EntityLivingBase - { -+ public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; -+ private java.util.HashMap spawnChunkMap = new java.util.HashMap(); -+ private java.util.HashMap spawnForcedMap = new java.util.HashMap(); -+ public float eyeHeight = this.getDefaultEyeHeight(); -+ - private static final DataParameter field_184829_a = EntityDataManager.func_187226_a(EntityPlayer.class, DataSerializers.field_187193_c); - private static final DataParameter field_184830_b = EntityDataManager.func_187226_a(EntityPlayer.class, DataSerializers.field_187192_b); - protected static final DataParameter field_184827_bp = EntityDataManager.func_187226_a(EntityPlayer.class, DataSerializers.field_187191_a); -@@ -174,6 +179,7 @@ - - public void onUpdate() - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPreTick(this); - this.noClip = this.isSpectator(); - - if (this.isSpectator()) -@@ -219,7 +225,7 @@ - - super.onUpdate(); - -- if (!this.worldObj.isRemote && this.openContainer != null && !this.openContainer.canInteractWith(this)) -+ if (!this.worldObj.isRemote && this.openContainer != null && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.openContainer)) - { - this.closeScreen(); - this.openContainer = this.inventoryContainer; -@@ -360,6 +366,7 @@ - this.setSize(f, f1); - } - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPostTick(this); - } - - public int getMaxInPortalTime() -@@ -442,11 +449,11 @@ - this.cameraYaw = 0.0F; - this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); - -- if (this.func_184187_bx() instanceof EntityPig) -+ if (this.func_184187_bx() instanceof EntityLivingBase && ((EntityLivingBase)this.func_94060_bK()).shouldRiderFaceForward(this)) - { - this.rotationPitch = f1; - this.rotationYaw = f; -- this.renderYawOffset = ((EntityPig)this.func_184187_bx()).renderYawOffset; -+ this.renderYawOffset = ((EntityLivingBase)this.func_184187_bx()).renderYawOffset; - } - } - } -@@ -576,11 +583,15 @@ - - public void onDeath(DamageSource cause) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; - super.onDeath(cause); - this.setSize(0.2F, 0.2F); - this.setPosition(this.posX, this.posY, this.posZ); - this.motionY = 0.10000000149011612D; - -+ captureDrops = true; -+ capturedDrops.clear(); -+ - if (this.getName().equals("Notch")) - { - this.dropItem(new ItemStack(Items.apple, 1), true, false); -@@ -591,6 +602,9 @@ - this.inventory.dropAllItems(); - } - -+ captureDrops = false; -+ if (!worldObj.isRemote) net.minecraftforge.event.ForgeEventFactory.onPlayerDrops(this, cause, capturedDrops, recentlyHit > 0); -+ - if (cause != null) - { - this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * 0.017453292F) * 0.1F); -@@ -678,12 +692,25 @@ - - public EntityItem dropOneItem(boolean dropAll) - { -- return this.dropItem(this.inventory.decrStackSize(this.inventory.currentItem, dropAll && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1), false, true); -+ ItemStack stack = inventory.getCurrentItem(); -+ -+ if (stack == null) -+ { -+ return null; -+ } -+ -+ if (stack.getItem().onDroppedByPlayer(stack, this)) -+ { -+ int count = dropAll && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1; -+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, inventory.decrStackSize(inventory.currentItem, count), true); -+ } -+ -+ return null; - } - - public EntityItem dropPlayerItemWithRandomChoice(ItemStack itemStackIn, boolean unused) - { -- return this.dropItem(itemStackIn, false, false); -+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, itemStackIn, false); - } - - public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem) -@@ -746,15 +773,22 @@ - - public ItemStack func_184816_a(EntityItem p_184816_1_) - { -+ if (captureDrops) capturedDrops.add(p_184816_1_); -+ else // Forge: Don't indent to keep patch smaller. - this.worldObj.spawnEntityInWorld(p_184816_1_); - ItemStack itemstack = p_184816_1_.getEntityItem(); - return itemstack; - } - -+ @Deprecated //Use location sensitive version below - public float func_184813_a(IBlockState p_184813_1_) - { -- float f = this.inventory.func_184438_a(p_184813_1_); -+ return getBreakSpeed(p_184813_1_, new BlockPos(0, -1, 0)); -+ } - -+ public float getBreakSpeed(IBlockState state, BlockPos pos) -+ { -+ float f = this.inventory.func_184438_a(state); - if (f > 1.0F) - { - int i = EnchantmentHelper.func_185293_e(this); -@@ -804,12 +838,13 @@ - f /= 5.0F; - } - -- return f; -+ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos); -+ return (f < 0 ? 0 : f); - } - - public boolean func_184823_b(IBlockState p_184823_1_) - { -- return this.inventory.func_184432_b(p_184823_1_); -+ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_184823_1_, this.inventory.func_184432_b(p_184823_1_)); - } - - public void readEntityFromNBT(NBTTagCompound tagCompund) -@@ -845,6 +880,16 @@ - this.spawnForced = tagCompund.getBoolean("SpawnForced"); - } - -+ NBTTagList spawnlist = null; -+ spawnlist = tagCompund.getTagList("Spawns", 10); -+ for (int i = 0; i < spawnlist.tagCount(); i++) -+ { -+ NBTTagCompound spawndata = (NBTTagCompound)spawnlist.getCompoundTagAt(i); -+ int spawndim = spawndata.getInteger("Dim"); -+ this.spawnChunkMap.put(spawndim, new BlockPos(spawndata.getInteger("SpawnX"), spawndata.getInteger("SpawnY"), spawndata.getInteger("SpawnZ"))); -+ this.spawnForcedMap.put(spawndim, spawndata.getBoolean("SpawnForced")); -+ } -+ - this.foodStats.readNBT(tagCompund); - this.capabilities.readCapabilitiesFromNBT(tagCompund); - -@@ -877,6 +922,23 @@ - tagCompound.setBoolean("SpawnForced", this.spawnForced); - } - -+ NBTTagList spawnlist = new NBTTagList(); -+ for (java.util.Map.Entry entry : this.spawnChunkMap.entrySet()) -+ { -+ BlockPos spawn = entry.getValue(); -+ if (spawn == null) continue; -+ Boolean forced = spawnForcedMap.get(entry.getKey()); -+ if (forced == null) forced = false; -+ NBTTagCompound spawndata = new NBTTagCompound(); -+ spawndata.setInteger("Dim", entry.getKey()); -+ spawndata.setInteger("SpawnX", spawn.getX()); -+ spawndata.setInteger("SpawnY", spawn.getY()); -+ spawndata.setInteger("SpawnZ", spawn.getZ()); -+ spawndata.setBoolean("SpawnForced", forced); -+ spawnlist.appendTag(spawndata); -+ } -+ tagCompound.setTag("Spawns", spawnlist); -+ - this.foodStats.writeNBT(tagCompound); - this.capabilities.writeCapabilitiesToNBT(tagCompound); - tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT()); -@@ -884,6 +946,7 @@ - - public boolean attackEntityFrom(DamageSource source, float amount) - { -+ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, source, amount)) return false; - if (this.isEntityInvulnerable(source)) - { - return false; -@@ -966,6 +1029,7 @@ - if (this.field_184627_bm.stackSize <= 0) - { - EnumHand enumhand = this.func_184600_cs(); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, this.field_184627_bm, enumhand); - - if (enumhand == EnumHand.MAIN_HAND) - { -@@ -1001,8 +1065,12 @@ - { - if (!this.isEntityInvulnerable(damageSrc)) - { -+ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); -+ if (damageAmount <= 0) return; - damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); - damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); -+ damageAmount = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, inventory.armorInventory, damageSrc, damageAmount); -+ if (damageAmount <= 0) return; - float f = damageAmount; - damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); - this.setAbsorptionAmount(this.getAbsorptionAmount() - (f - damageAmount)); -@@ -1067,6 +1135,7 @@ - } - else - { -+ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, p_184822_1_, p_184822_2_, p_184822_3_)) return EnumActionResult.PASS; - ItemStack itemstack = p_184822_2_ != null ? p_184822_2_.copy() : null; - - if (!p_184822_1_.func_184230_a(this, p_184822_2_, p_184822_3_)) -@@ -1123,6 +1192,7 @@ - - public void attackTargetEntityWithCurrentItem(Entity targetEntity) - { -+ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, targetEntity)) return; - if (targetEntity.canAttackWithItem()) - { - if (!targetEntity.hitByEntity(this)) -@@ -1410,6 +1480,8 @@ - - public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation) - { -+ EntityPlayer.EnumStatus ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, bedLocation); -+ if (ret != null) return ret; - if (!this.worldObj.isRemote) - { - if (this.isPlayerSleeping() || !this.isEntityAlive()) -@@ -1449,9 +1521,10 @@ - - this.setSize(0.2F, 0.2F); - -- if (this.worldObj.isBlockLoaded(bedLocation)) -- { -- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(bedLocation).getValue(BlockHorizontal.field_185512_D); -+ IBlockState state = null; -+ if (this.worldObj.isBlockLoaded(bedLocation)) state = this.worldObj.getBlockState(bedLocation); -+ if (state != null && state.getBlock().isBed(state, this.worldObj, bedLocation, this)) { -+ EnumFacing enumfacing = state.getBlock().getBedDirection(state, this.worldObj, bedLocation); - float f = 0.5F; - float f1 = 0.5F; - -@@ -1514,13 +1587,14 @@ - - public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn) - { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_70999_1_, updateWorldFlag, setSpawn); - this.setSize(0.6F, 1.8F); - IBlockState iblockstate = this.worldObj.getBlockState(this.playerLocation); - -- if (this.playerLocation != null && iblockstate.getBlock() == Blocks.bed) -+ if (this.playerLocation != null && iblockstate.getBlock().isBed(iblockstate, worldObj, playerLocation, this)) - { -- this.worldObj.setBlockState(this.playerLocation, iblockstate.withProperty(BlockBed.OCCUPIED, Boolean.valueOf(false)), 4); -- BlockPos blockpos = BlockBed.getSafeExitLocation(this.worldObj, this.playerLocation, 0); -+ iblockstate.getBlock().setBedOccupied(worldObj, playerLocation, this, false); -+ BlockPos blockpos = iblockstate.getBlock().getBedSpawnPosition(iblockstate, worldObj, playerLocation, this); - - if (blockpos == null) - { -@@ -1529,6 +1603,10 @@ - - this.setPosition((double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.1F), (double)((float)blockpos.getZ() + 0.5F)); - } -+ else -+ { -+ setSpawn = false; -+ } - - this.sleeping = false; - -@@ -1547,14 +1625,15 @@ - - private boolean isInBed() - { -- return this.worldObj.getBlockState(this.playerLocation).getBlock() == Blocks.bed; -+ return net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, playerLocation); - } - - public static BlockPos getBedSpawnLocation(World worldIn, BlockPos bedLocation, boolean forceSpawn) - { -- Block block = worldIn.getBlockState(bedLocation).getBlock(); -+ IBlockState state = worldIn.getBlockState(bedLocation); -+ Block block = state.getBlock(); - -- if (block != Blocks.bed) -+ if (!block.isBed(state, worldIn, bedLocation, null)) - { - if (!forceSpawn) - { -@@ -1569,16 +1648,17 @@ - } - else - { -- return BlockBed.getSafeExitLocation(worldIn, bedLocation, 0); -+ return block.getBedSpawnPosition(state, worldIn, bedLocation, null); - } - } - - @SideOnly(Side.CLIENT) - public float getBedOrientationInDegrees() - { -- if (this.playerLocation != null) -+ IBlockState state = this.playerLocation == null ? null : this.worldObj.getBlockState(playerLocation); -+ if (state != null && state.getBlock().isBed(state, worldObj, playerLocation, this)) - { -- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockHorizontal.field_185512_D); -+ EnumFacing enumfacing = state.getBlock().getBedDirection(state, worldObj, playerLocation); - - switch (enumfacing) - { -@@ -1618,16 +1698,24 @@ - - public BlockPos getBedLocation() - { -- return this.spawnChunk; -+ return getBedLocation(this.dimension); - } - -+ @Deprecated // Use dimension-sensitive version. - public boolean isSpawnForced() - { -- return this.spawnForced; -+ return isSpawnForced(this.dimension); - } - - public void setSpawnPoint(BlockPos pos, boolean forced) - { -+ if(net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, pos, forced)) return; -+ if (this.dimension != 0) -+ { -+ setSpawnChunk(pos, forced, this.dimension); -+ return; -+ } -+ - if (pos != null) - { - this.spawnChunk = pos; -@@ -1822,6 +1910,10 @@ - - super.fall(distance, damageMultiplier); - } -+ else -+ { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, distance, damageMultiplier); -+ } - } - - protected void resetHeight() -@@ -2022,6 +2114,18 @@ - this.xpSeed = oldPlayer.xpSeed; - this.theInventoryEnderChest = oldPlayer.theInventoryEnderChest; - this.func_184212_Q().func_187227_b(field_184827_bp, oldPlayer.func_184212_Q().func_187225_a(field_184827_bp)); -+ -+ this.spawnChunkMap = oldPlayer.spawnChunkMap; -+ this.spawnForcedMap = oldPlayer.spawnForcedMap; -+ -+ //Copy over a section of the Entity Data from the old player. -+ //Allows mods to specify data that persists after players respawn. -+ NBTTagCompound old = oldPlayer.getEntityData(); -+ if (old.hasKey(PERSISTED_NBT_TAG)) -+ { -+ getEntityData().setTag(PERSISTED_NBT_TAG, old.getCompoundTag(PERSISTED_NBT_TAG)); -+ } -+ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, oldPlayer, !respawnFromEnd); - } - - protected boolean canTriggerWalking() -@@ -2120,7 +2224,10 @@ - - public ITextComponent getDisplayName() - { -- ITextComponent itextcomponent = new TextComponentString(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName())); -+ ITextComponent itextcomponent = new TextComponentString(""); -+ if (!prefixes.isEmpty()) for (ITextComponent prefix : prefixes) itextcomponent.appendSibling(prefix); -+ itextcomponent.appendSibling(new TextComponentString(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName()))); -+ if (!suffixes.isEmpty()) for (ITextComponent suffix : suffixes) itextcomponent.appendSibling(suffix); - itextcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); - itextcomponent.getChatStyle().setChatHoverEvent(this.getHoverEvent()); - itextcomponent.getChatStyle().setInsertion(this.getName()); -@@ -2129,7 +2236,7 @@ - - public float getEyeHeight() - { -- float f = 1.62F; -+ float f = eyeHeight; - - if (this.isPlayerSleeping()) - { -@@ -2340,6 +2447,136 @@ - return (float)this.getEntityAttribute(SharedMonsterAttributes.field_188792_h).getAttributeValue(); - } - -+ /** -+ * Opens a GUI with this player, uses FML's IGuiHandler system. -+ * Allows for extension by modders. -+ * -+ * @param mod The mod trying to open a GUI -+ * @param modGuiId GUI ID -+ * @param world Current World -+ * @param x Passed directly to IGuiHandler, data meaningless Typically world X position -+ * @param y Passed directly to IGuiHandler, data meaningless Typically world Y position -+ * @param z Passed directly to IGuiHandler, data meaningless Typically world Z position -+ */ -+ public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) -+ { -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z); -+ } -+ -+ -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * A dimension aware version of getBedLocation. -+ * @param dimension The dimension to get the bed spawn for -+ * @return The player specific spawn location for the dimension. May be null. -+ */ -+ public BlockPos getBedLocation(int dimension) -+ { -+ return dimension == 0 ? spawnChunk : spawnChunkMap.get(dimension); -+ } -+ -+ /** -+ * A dimension aware version of isSpawnForced. -+ * Noramally isSpawnForced is used to determine if the respawn system should check for a bed or not. -+ * This just extends that to be dimension aware. -+ * @param dimension The dimension to get whether to check for a bed before spawning for -+ * @return The player specific spawn location for the dimension. May be null. -+ */ -+ public boolean isSpawnForced(int dimension) -+ { -+ if (dimension == 0) return this.spawnForced; -+ Boolean forced = this.spawnForcedMap.get(dimension); -+ return forced == null ? false : forced; -+ } -+ -+ /** -+ * A dimension aware version of setSpawnChunk. -+ * This functions identically, but allows you to specify which dimension to affect, rather than affecting the player's current dimension. -+ * @param pos The spawn point to set as the player-specific spawn point for the dimension -+ * @param forced Whether or not the respawn code should check for a bed at this location (true means it won't check for a bed) -+ * @param dimension Which dimension to apply the player-specific respawn point to -+ */ -+ public void setSpawnChunk(BlockPos pos, boolean forced, int dimension) -+ { -+ if (dimension == 0) -+ { -+ if (pos != null) -+ { -+ spawnChunk = pos; -+ spawnForced = forced; -+ } -+ else -+ { -+ spawnChunk = null; -+ spawnForced = false; -+ } -+ return; -+ } -+ -+ if (pos != null) -+ { -+ spawnChunkMap.put(dimension, pos); -+ spawnForcedMap.put(dimension, forced); -+ } -+ else -+ { -+ spawnChunkMap.remove(dimension); -+ spawnForcedMap.remove(dimension); -+ } -+ } -+ -+ private String displayname; -+ -+ /** -+ * Returns the default eye height of the player -+ * @return player default eye height -+ */ -+ public float getDefaultEyeHeight() -+ { -+ return 1.62F; -+ } -+ -+ /** -+ * Get the currently computed display name, cached for efficiency. -+ * @return the current display name -+ */ -+ public String getDisplayNameString() -+ { -+ if(this.displayname == null) -+ { -+ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.getName()); -+ } -+ return this.displayname; -+ } -+ -+ /** -+ * Force the displayed name to refresh -+ */ -+ public void refreshDisplayName() -+ { -+ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.getName()); -+ } -+ -+ private final java.util.Collection prefixes = new java.util.LinkedList(); -+ private final java.util.Collection suffixes = new java.util.LinkedList(); -+ -+ /** -+ * Add a prefix to the player's username in chat -+ * @param prefix The prefix -+ */ -+ public void addPrefix(ITextComponent prefix) { prefixes.add(prefix); } -+ -+ /** -+ * Add a suffix to the player's username in chat -+ * @param suffix The suffix -+ */ -+ public void addSuffix(ITextComponent suffix) { suffixes.add(suffix); } -+ -+ public java.util.Collection getPrefixes() { return this.prefixes; } -+ public java.util.Collection getSuffixes() { return this.suffixes; } -+ -+ /* ======================================== FORGE END =====================================*/ -+ - public static enum EnumChatVisibility - { - FULL(0, "options.chat.visibility.full"), diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch deleted file mode 100644 index 08230f74aa..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ /dev/null @@ -1,83 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -+++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -@@ -134,14 +134,15 @@ - public int ping; - public boolean playerConqueredTheEnd; - -+ @SuppressWarnings("unused") - public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, PlayerInteractionManager interactionManager) - { - super(worldIn, profile); - interactionManager.thisPlayerMP = this; - this.theItemInWorldManager = interactionManager; -- BlockPos blockpos = worldIn.getSpawnPoint(); -+ BlockPos blockpos = worldIn.provider.getRandomizedSpawnPoint(); - -- if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) -+ if (false && !worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) - { - int i = Math.max(0, server.func_184108_a(worldIn)); - int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ())); -@@ -250,7 +251,7 @@ - - this.openContainer.detectAndSendChanges(); - -- if (!this.worldObj.isRemote && !this.openContainer.canInteractWith(this)) -+ if (!this.worldObj.isRemote && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.openContainer)) - { - this.closeScreen(); - this.openContainer = this.inventoryContainer; -@@ -433,6 +434,7 @@ - - public void onDeath(DamageSource cause) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; - boolean flag = this.worldObj.getGameRules().getBoolean("showDeathMessages"); - this.playerNetServerHandler.sendPacket(new SPacketCombatEvent(this.getCombatTracker(), SPacketCombatEvent.Event.ENTITY_DIED, flag)); - -@@ -459,7 +461,20 @@ - - if (!this.worldObj.getGameRules().getBoolean("keepInventory") && !this.isSpectator()) - { -+ captureDrops = true; -+ capturedDrops.clear(); -+ - this.inventory.dropAllItems(); -+ -+ captureDrops = false; -+ net.minecraftforge.event.entity.player.PlayerDropsEvent event = new net.minecraftforge.event.entity.player.PlayerDropsEvent(this, cause, capturedDrops, recentlyHit > 0); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) -+ { -+ for (net.minecraft.entity.item.EntityItem item : capturedDrops) -+ { -+ this.worldObj.spawnEntityInWorld(item); -+ } -+ } - } - - for (ScoreObjective scoreobjective : this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreCriteria.deathCount)) -@@ -540,6 +555,7 @@ - - public Entity func_184204_a(int p_184204_1_) - { -+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return this; - this.field_184851_cj = true; - - if (this.dimension == 1 && p_184204_1_ == 1) -@@ -697,7 +713,7 @@ - BlockPos blockpos = new BlockPos(i, j, k); - IBlockState iblockstate = this.worldObj.getBlockState(blockpos); - -- if (iblockstate.func_185904_a() == Material.air) -+ if (iblockstate.getBlock().isAir(iblockstate, this.worldObj, blockpos)) - { - BlockPos blockpos1 = blockpos.down(); - IBlockState iblockstate1 = this.worldObj.getBlockState(blockpos1); -@@ -921,6 +937,7 @@ - { - if (stat != null) - { -+ if (stat.isAchievement() && net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.AchievementEvent(this, (net.minecraft.stats.Achievement) stat))) return; - this.statsFile.increaseStat(this, stat, amount); - - for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(stat.func_150952_k())) diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch deleted file mode 100644 index 8f0f421e9e..0000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java -+++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java -@@ -270,13 +270,8 @@ - - if (itemstack == null) - { -- itemstack = new ItemStack(item, 0, itemStackIn.getMetadata()); -- -- if (itemStackIn.hasTagCompound()) -- { -- itemstack.setTagCompound((NBTTagCompound)itemStackIn.getTagCompound().copy()); -- } -- -+ itemstack = itemStackIn.copy(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up. -+ itemstack.stackSize = 0; - this.setInventorySlotContents(j, itemstack); - } - -@@ -344,6 +339,14 @@ - } - } - } -+ -+ for (int i = 0; i < armorInventory.length; i++) -+ { -+ if (armorInventory[i] != null) -+ { -+ armorInventory[i].getItem().onArmorTick(player.worldObj, player, armorInventory[i]); -+ } -+ } - } - - public boolean addItemStackToInventory(final ItemStack itemStackIn) diff --git a/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch b/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch deleted file mode 100644 index 7033d745ae..0000000000 --- a/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/init/Bootstrap.java -+++ ../src-work/minecraft/net/minecraft/init/Bootstrap.java -@@ -74,6 +74,7 @@ - return alreadyRegistered; - } - -+ @SuppressWarnings("unused") - static void registerDispenserBehaviors() - { - BlockDispenser.dispenseBehaviorRegistry.putObject(Items.arrow, new BehaviorProjectileDispense() diff --git a/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch deleted file mode 100644 index 0c7a86b06c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/Container.java -+++ ../src-work/minecraft/net/minecraft/inventory/Container.java -@@ -646,7 +646,7 @@ - Slot slot1 = (Slot)this.inventorySlots.get(i); - ItemStack itemstack1 = slot1.getStack(); - -- if (itemstack1 == null) -+ if (itemstack1 == null && slot1.isItemValid(stack)) // Forge: Make sure to respect isItemValid in the slot. - { - slot1.putStack(stack.copy()); - slot1.onSlotChanged(); diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch deleted file mode 100644 index d8b6bd0eb5..0000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerBeacon.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerBeacon.java -@@ -143,7 +143,7 @@ - - public boolean isItemValid(ItemStack stack) - { -- return stack == null ? false : stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot; -+ return stack == null ? false : stack.getItem().isBeaconPayment(stack); - } - - public int getSlotStackLimit() diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch deleted file mode 100644 index 2ff5ecea87..0000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerBrewingStand.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java -@@ -196,7 +196,7 @@ - - public boolean isItemValid(ItemStack stack) - { -- return stack != null && PotionHelper.func_185205_a(stack); -+ return stack != null && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack); - } - - public int getSlotStackLimit() -@@ -243,8 +243,7 @@ - } - else - { -- Item item = stack.getItem(); -- return item == Items.potionitem || item == Items.glass_bottle || item == Items.field_185155_bH || item == Items.field_185156_bI; -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack); - } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch deleted file mode 100644 index 41a1e9c6f1..0000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerEnchantment.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerEnchantment.java -@@ -68,9 +68,12 @@ - }); - this.addSlotToContainer(new Slot(this.tableInventory, 1, 35, 47) - { -+ java.util.List ores = net.minecraftforge.oredict.OreDictionary.getOres("gemLapis"); - public boolean isItemValid(ItemStack stack) - { -- return stack.getItem() == Items.dye && EnumDyeColor.byDyeDamage(stack.getMetadata()) == EnumDyeColor.BLUE; -+ for (ItemStack ore : ores) -+ if (net.minecraftforge.oredict.OreDictionary.itemMatches(ore, stack, false)) return true; -+ return false; - } - }); - -@@ -155,6 +158,7 @@ - if (!this.worldPointer.isRemote) - { - int l = 0; -+ float power = 0; - - for (int j = -1; j <= 1; ++j) - { -@@ -162,37 +166,14 @@ - { - if ((j != 0 || k != 0) && this.worldPointer.isAirBlock(this.position.add(k, 0, j)) && this.worldPointer.isAirBlock(this.position.add(k, 1, j))) - { -- if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j * 2)).getBlock() == Blocks.bookshelf) -- { -- ++l; -- } -- -- if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j * 2)).getBlock() == Blocks.bookshelf) -- { -- ++l; -- } -- -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 0, j * 2)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 1, j * 2)); - if (k != 0 && j != 0) - { -- if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j)).getBlock() == Blocks.bookshelf) -- { -- ++l; -- } -- -- if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j)).getBlock() == Blocks.bookshelf) -- { -- ++l; -- } -- -- if (this.worldPointer.getBlockState(this.position.add(k, 0, j * 2)).getBlock() == Blocks.bookshelf) -- { -- ++l; -- } -- -- if (this.worldPointer.getBlockState(this.position.add(k, 1, j * 2)).getBlock() == Blocks.bookshelf) -- { -- ++l; -- } -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 0, j)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 1, j)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k, 0, j * 2)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k, 1, j * 2)); - } - } - } -@@ -202,7 +183,7 @@ - - for (int i1 = 0; i1 < 3; ++i1) - { -- this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, l, itemstack); -+ this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, (int)power, itemstack); - this.field_185001_h[i1] = -1; - this.field_185002_i[i1] = -1; - diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch deleted file mode 100644 index 729349b46f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerPlayer.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerPlayer.java -@@ -48,8 +48,7 @@ - } - else - { -- EntityEquipmentSlot entityequipmentslot1 = EntityLiving.func_184640_d(stack); -- return entityequipmentslot1 == entityequipmentslot; -+ return stack.getItem().isValidArmor(stack, entityequipmentslot, thePlayer); - } - } - @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch deleted file mode 100644 index 4fe5a03f09..0000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerRepair.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerRepair.java -@@ -69,6 +69,8 @@ - playerIn.addExperienceLevel(-ContainerRepair.this.maximumCost); - } - -+ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(playerIn, stack, ContainerRepair.this.inputSlots.getStackInSlot(0), ContainerRepair.this.inputSlots.getStackInSlot(1)); -+ - ContainerRepair.this.inputSlots.setInventorySlotContents(0, (ItemStack)null); - - if (ContainerRepair.this.materialCost > 0) -@@ -93,7 +95,7 @@ - ContainerRepair.this.maximumCost = 0; - IBlockState iblockstate = worldIn.getBlockState(blockPosIn); - -- if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().nextFloat() < 0.12F) -+ if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().nextFloat() < breakChance) - { - int l = ((Integer)iblockstate.getValue(BlockAnvil.DAMAGE)).intValue(); - ++l; -@@ -160,10 +162,12 @@ - Map map = EnchantmentHelper.getEnchantments(itemstack1); - j = j + itemstack.getRepairCost() + (itemstack2 == null ? 0 : itemstack2.getRepairCost()); - this.materialCost = 0; -+ boolean flag = false; - - if (itemstack2 != null) - { -- boolean flag = itemstack2.getItem() == Items.enchanted_book && !Items.enchanted_book.getEnchantments(itemstack2).hasNoTags(); -+ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, j)) return; -+ flag = itemstack2.getItem() == Items.enchanted_book && !Items.enchanted_book.getEnchantments(itemstack2).hasNoTags(); - - if (itemstack1.isItemStackDamageable() && itemstack1.getItem().getIsRepairable(itemstack, itemstack2)) - { -@@ -235,7 +239,7 @@ - - for (Enchantment enchantment : map.keySet()) - { -- if (enchantment != enchantment1 && !enchantment1.canApplyTogether(enchantment)) -+ if (enchantment != enchantment1 && !(enchantment1.canApplyTogether(enchantment) && enchantment.canApplyTogether(enchantment1))) //Forge BugFix: Let Both enchantments veto being together - { - flag1 = false; - ++i; -@@ -279,6 +283,8 @@ - } - } - -+ if (flag && !itemstack1.getItem().isBookEnchantable(itemstack1, itemstack2)) itemstack1 = null; -+ - if (StringUtils.isBlank(this.repairedItemName)) - { - if (itemstack.hasDisplayName()) diff --git a/patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch deleted file mode 100644 index 543b01f37d..0000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch +++ /dev/null @@ -1,75 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/Slot.java -+++ ../src-work/minecraft/net/minecraft/inventory/Slot.java -@@ -89,7 +89,7 @@ - @SideOnly(Side.CLIENT) - public String getSlotTexture() - { -- return null; -+ return backgroundName; - } - - public ItemStack decrStackSize(int amount) -@@ -112,4 +112,63 @@ - { - return true; - } -+ -+ /*========================================= FORGE START =====================================*/ -+ protected String backgroundName = null; -+ protected net.minecraft.util.ResourceLocation backgroundLocation = null; -+ protected Object backgroundMap; -+ /** -+ * Gets the path of the texture file to use for the background image of this slot when drawing the GUI. -+ * @return The resource location for the background image -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.util.ResourceLocation getBackgroundLocation() -+ { -+ return (backgroundLocation == null ? net.minecraft.client.renderer.texture.TextureMap.locationBlocksTexture : backgroundLocation); -+ } -+ -+ /** -+ * Sets the texture file to use for the background image of the slot when it's empty. -+ * @param texture the resourcelocation for the texture -+ */ -+ @SideOnly(Side.CLIENT) -+ public void setBackgroundLocation(net.minecraft.util.ResourceLocation texture) -+ { -+ this.backgroundLocation = texture; -+ } -+ -+ /** -+ * Sets which icon index to use as the background image of the slot when it's empty. -+ * @param name The icon to use, null for none -+ */ -+ public void setBackgroundName(String name) -+ { -+ this.backgroundName = name; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite() -+ { -+ String name = getSlotTexture(); -+ return name == null ? null : getBackgroundMap().getAtlasSprite(name); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ protected net.minecraft.client.renderer.texture.TextureMap getBackgroundMap() -+ { -+ if (backgroundMap == null) backgroundMap = net.minecraft.client.Minecraft.getMinecraft().getTextureMapBlocks(); -+ return (net.minecraft.client.renderer.texture.TextureMap)backgroundMap; -+ } -+ -+ /** -+ * Retrieves the index in the inventory for this slot, this value should typically not -+ * be used, but can be useful for some occasions. -+ * -+ * @return Index in associated inventory for this slot. -+ */ -+ public int getSlotIndex() -+ { -+ return slotIndex; -+ } -+ /*========================================= FORGE END =====================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch deleted file mode 100644 index e4aff0d46a..0000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/SlotCrafting.java -+++ ../src-work/minecraft/net/minecraft/inventory/SlotCrafting.java -@@ -107,8 +107,11 @@ - - public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix); - this.onCrafting(stack); -+ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn); - ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b(this.craftMatrix, playerIn.worldObj); -+ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); - - for (int i = 0; i < aitemstack.length; ++i) - { diff --git a/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch deleted file mode 100644 index c184789a0b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java -+++ ../src-work/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java -@@ -81,6 +81,8 @@ - - this.field_75228_b = 0; - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(thePlayer, stack); -+ - if (stack.getItem() == Items.iron_ingot) - { - this.thePlayer.triggerAchievement(AchievementList.field_187987_k); diff --git a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch deleted file mode 100644 index b8507eda8f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch +++ /dev/null @@ -1,697 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/Item.java -+++ ../src-work/minecraft/net/minecraft/item/Item.java -@@ -58,8 +58,8 @@ - - public class Item - { -- public static final RegistryNamespaced itemRegistry = new RegistryNamespaced(); -- private static final Map BLOCK_TO_ITEM = Maps.newHashMap(); -+ public static final RegistryNamespaced itemRegistry = net.minecraftforge.fml.common.registry.GameData.getItemRegistry();; -+ private static final Map BLOCK_TO_ITEM = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap(); - private static final IItemPropertyGetter field_185046_b = new IItemPropertyGetter() - { - @SideOnly(Side.CLIENT) -@@ -104,6 +104,9 @@ - private Item containerItem; - private String unlocalizedName; - -+ public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = -+ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)itemRegistry).getDelegate(this, Item.class); -+ - public static int getIdFromItem(Item itemIn) - { - return itemIn == null ? 0 : itemRegistry.getIDForObject(itemIn); -@@ -192,6 +195,7 @@ - return stack; - } - -+ @Deprecated // Use ItemStack sensitive version below. - public int getItemStackLimit() - { - return this.maxStackSize; -@@ -312,6 +316,7 @@ - return this.containerItem; - } - -+ @Deprecated // Use ItemStack sensitive version below. - public boolean hasContainerItem() - { - return this.containerItem != null; -@@ -367,7 +372,7 @@ - - public boolean isItemTool(ItemStack stack) - { -- return this.getItemStackLimit() == 1 && this.isDamageable(); -+ return this.getItemStackLimit(stack) == 1 && this.isDamageable(); - } - - protected RayTraceResult getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids) -@@ -385,6 +390,10 @@ - float f6 = f3 * f4; - float f7 = f2 * f4; - double d3 = 5.0D; -+ if (playerIn instanceof net.minecraft.entity.player.EntityPlayerMP) -+ { -+ d3 = ((net.minecraft.entity.player.EntityPlayerMP)playerIn).theItemInWorldManager.getBlockReachDistance(); -+ } - Vec3d vec3d1 = vec3d.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); - return worldIn.rayTraceBlocks(vec3d, vec3d1, useLiquids, !useLiquids, false); - } -@@ -422,11 +431,588 @@ - return false; - } - -+ @Deprecated // Use ItemStack sensitive version below. - public Multimap getItemAttributeModifiers(EntityEquipmentSlot p_111205_1_) - { - return HashMultimap.create(); - } - -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * ItemStack sensitive version of getItemAttributeModifiers -+ */ -+ public Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) -+ { -+ return this.getItemAttributeModifiers(slot); -+ } -+ -+ /** -+ * Called when a player drops the item into the world, -+ * returning false from this will prevent the item from -+ * being removed from the players inventory and spawning -+ * in the world -+ * -+ * @param player The player that dropped the item -+ * @param item The item stack, before the item is removed. -+ */ -+ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) -+ { -+ return true; -+ } -+ -+ /** -+ * Allow the item one last chance to modify its name used for the -+ * tool highlight useful for adding something extra that can't be removed -+ * by a user in the displayed name, such as a mode of operation. -+ * -+ * @param item the ItemStack for the item. -+ * @param displayName the name that will be displayed unless it is changed in this method. -+ */ -+ public String getHighlightTip( ItemStack item, String displayName ) -+ { -+ return displayName; -+ } -+ -+ /** -+ * This is called when the item is used, before the block is activated. -+ * @param stack The Item Stack -+ * @param player The Player that used the item -+ * @param world The Current World -+ * @param pos Target position -+ * @param side The side of the target hit -+ * @param hand Which hand the item is being held in. -+ * @return Return PASS to allow vanilla handling, any other to skip normal code. -+ */ -+ public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) -+ { -+ return EnumActionResult.PASS; -+ } -+ -+ protected boolean canRepair = true; -+ /** -+ * Called by CraftingManager to determine if an item is reparable. -+ * @return True if reparable -+ */ -+ public boolean isRepairable() -+ { -+ return canRepair && isDamageable(); -+ } -+ -+ /** -+ * Call to disable repair recipes. -+ * @return The current Item instance -+ */ -+ public Item setNoRepair() -+ { -+ canRepair = false; -+ return this; -+ } -+ -+ /** -+ * Called before a block is broken. Return true to prevent default block harvesting. -+ * -+ * Note: In SMP, this is called on both client and server sides! -+ * -+ * @param itemstack The current ItemStack -+ * @param pos Block's position in world -+ * @param player The Player that is wielding the item -+ * @return True to prevent harvesting, false to continue as normal -+ */ -+ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) -+ { -+ return false; -+ } -+ -+ /** -+ * Called each tick while using an item. -+ * @param stack The Item being used -+ * @param player The Player using the item -+ * @param count The amount of time in tick the item has been used for continuously -+ */ -+ public void onUsingTick(ItemStack stack, EntityLivingBase player, int count) -+ { -+ } -+ -+ /** -+ * Called when the player Left Clicks (attacks) an entity. -+ * Processed before damage is done, if return value is true further processing is canceled -+ * and the entity is not attacked. -+ * -+ * @param stack The Item being used -+ * @param player The player that is attacking -+ * @param entity The entity being attacked -+ * @return True to cancel the rest of the interaction. -+ */ -+ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) -+ { -+ return false; -+ } -+ -+ /** -+ * ItemStack sensitive version of getContainerItem. -+ * Returns a full ItemStack instance of the result. -+ * -+ * @param itemStack The current ItemStack -+ * @return The resulting ItemStack -+ */ -+ public ItemStack getContainerItem(ItemStack itemStack) -+ { -+ if (!hasContainerItem(itemStack)) -+ { -+ return null; -+ } -+ return new ItemStack(getContainerItem()); -+ } -+ -+ /** -+ * ItemStack sensitive version of hasContainerItem -+ * @param stack The current item stack -+ * @return True if this item has a 'container' -+ */ -+ public boolean hasContainerItem(ItemStack stack) -+ { -+ return hasContainerItem(); -+ } -+ -+ /** -+ * Retrieves the normal 'lifespan' of this item when it is dropped on the ground as a EntityItem. -+ * This is in ticks, standard result is 6000, or 5 mins. -+ * -+ * @param itemStack The current ItemStack -+ * @param world The world the entity is in -+ * @return The normal lifespan in ticks. -+ */ -+ public int getEntityLifespan(ItemStack itemStack, World world) -+ { -+ return 6000; -+ } -+ -+ /** -+ * Determines if this Item has a special entity for when they are in the world. -+ * Is called when a EntityItem is spawned in the world, if true and Item#createCustomEntity -+ * returns non null, the EntityItem will be destroyed and the new Entity will be added to the world. -+ * -+ * @param stack The current item stack -+ * @return True of the item has a custom entity, If true, Item#createCustomEntity will be called -+ */ -+ public boolean hasCustomEntity(ItemStack stack) -+ { -+ return false; -+ } -+ -+ /** -+ * This function should return a new entity to replace the dropped item. -+ * Returning null here will not kill the EntityItem and will leave it to function normally. -+ * Called when the item it placed in a world. -+ * -+ * @param world The world object -+ * @param location The EntityItem object, useful for getting the position of the entity -+ * @param itemstack The current item stack -+ * @return A new Entity object to spawn or null -+ */ -+ public Entity createEntity(World world, Entity location, ItemStack itemstack) -+ { -+ return null; -+ } -+ -+ /** -+ * Called by the default implemetation of EntityItem's onUpdate method, allowing for cleaner -+ * control over the update of the item without having to write a subclass. -+ * -+ * @param entityItem The entity Item -+ * @return Return true to skip any further update code. -+ */ -+ public boolean onEntityItemUpdate(net.minecraft.entity.item.EntityItem entityItem) -+ { -+ return false; -+ } -+ -+ /** -+ * Gets a list of tabs that items belonging to this class can display on, -+ * combined properly with getSubItems allows for a single item to span -+ * many sub-items across many tabs. -+ * -+ * @return A list of all tabs that this item could possibly be one. -+ */ -+ public CreativeTabs[] getCreativeTabs() -+ { -+ return new CreativeTabs[]{ getCreativeTab() }; -+ } -+ -+ /** -+ * Determines the base experience for a player when they remove this item from a furnace slot. -+ * This number must be between 0 and 1 for it to be valid. -+ * This number will be multiplied by the stack size to get the total experience. -+ * -+ * @param item The item stack the player is picking up. -+ * @return The amount to award for each item. -+ */ -+ public float getSmeltingExperience(ItemStack item) -+ { -+ return -1; //-1 will default to the old lookups. -+ } -+ -+ /** -+ * -+ * Should this item, when held, allow sneak-clicks to pass through to the underlying block? -+ * -+ * @param world The world -+ * @param pos Block position in world -+ * @param player The Player that is wielding the item -+ * @return -+ */ -+ public boolean doesSneakBypassUse(ItemStack stack, net.minecraft.world.IBlockAccess world, BlockPos pos, EntityPlayer player) -+ { -+ return false; -+ } -+ -+ /** -+ * Called to tick armor in the armor slot. Override to do something -+ */ -+ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack){} -+ -+ /** -+ * Determines if the specific ItemStack can be placed in the specified armor slot. -+ * -+ * @param stack The ItemStack -+ * @param armorType Armor slot ID: 0: Helmet, 1: Chest, 2: Legs, 3: Boots -+ * @param entity The entity trying to equip the armor -+ * @return True if the given ItemStack can be inserted in the slot -+ */ -+ public boolean isValidArmor(ItemStack stack, EntityEquipmentSlot armorType, Entity entity) -+ { -+ return net.minecraft.entity.EntityLiving.func_184640_d(stack) == armorType; -+ } -+ -+ /** -+ * Allow or forbid the specific book/item combination as an anvil enchant -+ * -+ * @param stack The item -+ * @param book The book -+ * @return if the enchantment is allowed -+ */ -+ public boolean isBookEnchantable(ItemStack stack, ItemStack book) -+ { -+ return true; -+ } -+ -+ /** -+ * Called by RenderBiped and RenderPlayer to determine the armor texture that -+ * should be use for the currently equipped item. -+ * This will only be called on instances of ItemArmor. -+ * -+ * Returning null from this function will use the default value. -+ * -+ * @param stack ItemStack for the equipped armor -+ * @param entity The entity wearing the armor -+ * @param slot The slot the armor is in -+ * @param type The subtype, can be null or "overlay" -+ * @return Path of texture to bind, or null to use default -+ */ -+ public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) -+ { -+ return null; -+ } -+ -+ /** -+ * Returns the font renderer used to render tooltips and overlays for this item. -+ * Returning null will use the standard font renderer. -+ * -+ * @param stack The current item stack -+ * @return A instance of FontRenderer or null to use default -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack) -+ { -+ return null; -+ } -+ -+ /** -+ * Override this method to have an item handle its own armor rendering. -+ * -+ * @param entityLiving The entity wearing the armor -+ * @param itemStack The itemStack to render the model of -+ * @param armorSlot The slot the armor is in -+ * @param _default Original armor model. Will have attributes set. -+ * @return A ModelBiped to render instead of the default -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, net.minecraft.client.model.ModelBiped _default) -+ { -+ return null; -+ } -+ -+ /** -+ * Called when a entity tries to play the 'swing' animation. -+ * -+ * @param entityLiving The entity swinging the item. -+ * @param stack The Item stack -+ * @return True to cancel any further processing by EntityLiving -+ */ -+ public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) -+ { -+ return false; -+ } -+ -+ /** -+ * Called when the client starts rendering the HUD, for whatever item the player currently has as a helmet. -+ * This is where pumpkins would render there overlay. -+ * -+ * @param stack The ItemStack that is equipped -+ * @param player Reference to the current client entity -+ * @param resolution Resolution information about the current viewport and configured GUI Scale -+ * @param partialTicks Partial ticks for the renderer, useful for interpolation -+ */ -+ @SideOnly(Side.CLIENT) -+ public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, net.minecraft.client.gui.ScaledResolution resolution, float partialTicks){} -+ -+ /** -+ * Return the itemDamage represented by this ItemStack. Defaults to the itemDamage field on ItemStack, but can be overridden here for other sources such as NBT. -+ * -+ * @param stack The itemstack that is damaged -+ * @return the damage value -+ */ -+ public int getDamage(ItemStack stack) -+ { -+ return stack.itemDamage; -+ } -+ -+ /** -+ * This used to be 'display damage' but its really just 'aux' data in the ItemStack, usually shares the same variable as damage. -+ * @param stack -+ * @return -+ */ -+ public int getMetadata(ItemStack stack) -+ { -+ return stack.itemDamage; -+ } -+ -+ /** -+ * Determines if the durability bar should be rendered for this item. -+ * Defaults to vanilla stack.isDamaged behavior. -+ * But modders can use this for any data they wish. -+ * -+ * @param stack The current Item Stack -+ * @return True if it should render the 'durability' bar. -+ */ -+ public boolean showDurabilityBar(ItemStack stack) -+ { -+ return stack.isItemDamaged(); -+ } -+ -+ /** -+ * Queries the percentage of the 'Durability' bar that should be drawn. -+ * -+ * @param stack The current ItemStack -+ * @return 1.0 for 100% 0 for 0% -+ */ -+ public double getDurabilityForDisplay(ItemStack stack) -+ { -+ return (double)stack.getItemDamage() / (double)stack.getMaxDamage(); -+ } -+ -+ /** -+ * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item, -+ * but can be overridden here for other sources such as NBT. -+ * -+ * @param stack The itemstack that is damaged -+ * @return the damage value -+ */ -+ public int getMaxDamage(ItemStack stack) -+ { -+ return getMaxDamage(); -+ } -+ -+ /** -+ * Return if this itemstack is damaged. Note only called if {@link #isDamageable()} is true. -+ * @param stack the stack -+ * @return if the stack is damaged -+ */ -+ public boolean isDamaged(ItemStack stack) -+ { -+ return stack.itemDamage > 0; -+ } -+ -+ /** -+ * Set the damage for this itemstack. Note, this method is responsible for zero checking. -+ * @param stack the stack -+ * @param damage the new damage value -+ */ -+ public void setDamage(ItemStack stack, int damage) -+ { -+ stack.itemDamage = damage; -+ -+ if (stack.itemDamage < 0) -+ { -+ stack.itemDamage = 0; -+ } -+ } -+ -+ /** -+ * ItemStack sensitive version of {@link #canHarvestBlock(IBlockState)} -+ * @param state The block trying to harvest -+ * @param stack The itemstack used to harvest the block -+ * @return true if can harvest the block -+ */ -+ public boolean canHarvestBlock(IBlockState state, ItemStack stack) -+ { -+ return canHarvestBlock(state); -+ } -+ -+ /** -+ * Gets the maximum number of items that this stack should be able to hold. -+ * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit() -+ * -+ * @param stack The ItemStack -+ * @return The maximum number this item can be stacked to -+ */ -+ public int getItemStackLimit(ItemStack stack) -+ { -+ return this.getItemStackLimit(); -+ } -+ -+ private java.util.Map toolClasses = new java.util.HashMap(); -+ /** -+ * Sets or removes the harvest level for the specified tool class. -+ * -+ * @param toolClass Class -+ * @param level Harvest level: -+ * Wood: 0 -+ * Stone: 1 -+ * Iron: 2 -+ * Diamond: 3 -+ * Gold: 0 -+ */ -+ public void setHarvestLevel(String toolClass, int level) -+ { -+ if (level < 0) -+ toolClasses.remove(toolClass); -+ else -+ toolClasses.put(toolClass, level); -+ } -+ -+ public java.util.Set getToolClasses(ItemStack stack) -+ { -+ return toolClasses.keySet(); -+ } -+ -+ /** -+ * Queries the harvest level of this item stack for the specifred tool class, -+ * Returns -1 if this tool is not of the specified type -+ * -+ * @param stack This item stack instance -+ * @param toolClass Tool Class -+ * @return Harvest level, or -1 if not the specified tool type. -+ */ -+ public int getHarvestLevel(ItemStack stack, String toolClass) -+ { -+ Integer ret = toolClasses.get(toolClass); -+ return ret == null ? -1 : ret; -+ } -+ -+ /** -+ * ItemStack sensitive version of getItemEnchantability -+ * -+ * @param stack The ItemStack -+ * @return the item echantability value -+ */ -+ public int getItemEnchantability(ItemStack stack) -+ { -+ return getItemEnchantability(); -+ } -+ -+ /** -+ * Whether this Item can be used as a payment to activate the vanilla beacon. -+ * @param stack the ItemStack -+ * @return true if this Item can be used -+ */ -+ public boolean isBeaconPayment(ItemStack stack) -+ { -+ return this == Items.emerald || this == Items.diamond || this == Items.gold_ingot || this == Items.iron_ingot; -+ } -+ -+ /** -+ * Determine if the player switching between these two item stacks -+ * @param oldStack The old stack that was equipped -+ * @param newStack The new stack -+ * @param slotChanged If the current equipped slot was changed, -+ * Vanilla does not play the animation if you switch between two -+ * slots that hold the exact same item. -+ * @return True to play the item change animation -+ */ -+ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) -+ { -+ return !ItemStack.areItemStacksEqual(oldStack, newStack); -+ } -+ -+ private ResourceLocation registryName = null; -+ /** -+ * Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item. -+ * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. -+ * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. -+ * -+ * The supplied name will be prefixed with the currently active mod's modId. -+ * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. -+ * -+ * If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown. -+ * -+ * Returns 'this' to allow for chaining. -+ * -+ * @param name Unique registry name -+ * @return This instance -+ */ -+ public final Item setRegistryName(String name) -+ { -+ if (getRegistryName() != null) -+ throw new IllegalStateException("Attempted to set registry name on block with exisiting registry name! New: " + name + " Old: " + getRegistryName()); -+ int index = name.lastIndexOf(':'); -+ String oldPrefix = index == -1 ? "" : name.substring(0, index); -+ name = index == -1 ? name : name.substring(index + 1); -+ net.minecraftforge.fml.common.ModContainer mc = net.minecraftforge.fml.common.Loader.instance().activeModContainer(); -+ String prefix = mc == null ? "minecraft" : mc.getModId(); -+ if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) -+ { -+ net.minecraftforge.fml.common.FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name); -+ prefix = oldPrefix; -+ } -+ this.registryName = new ResourceLocation(prefix, name); -+ return this; -+ } -+ public final Item setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); } -+ public final Item setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); } -+ -+ /** -+ * A unique identifier for this block, if this block is registered in the game registry it will return that name. -+ * Otherwise it will return the name set in setRegistryName(). -+ * If neither are valid null is returned. -+ * -+ * @return Unique identifier or null. -+ */ -+ public final String getRegistryName() -+ { -+ if (delegate.getResourceName() != null) return delegate.getResourceName().toString(); -+ return registryName != null ? registryName.toString() : null; -+ } -+ -+ /** -+ * Called from ItemStack.setItem, will hold extra data for the life of this ItemStack. -+ * Can be retrieved from stack.getCapabilities() -+ * The NBT can be null if this is not called from readNBT or if the item the stack is -+ * changing FROM is different then this item, or the previous item had no capabilities. -+ * -+ * This is called BEFORE the stacks item is set so you can use stack.getItem() to see the OLD item. -+ * Remember that getItem CAN return null. -+ * -+ * @param stack The ItemStack -+ * @param nbt NBT of this item serialized, or null. -+ * @return A holder instance associated with this ItemStack where you can hold capabilities for the life of this item. -+ */ -+ public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) -+ { -+ return null; -+ } -+ /* ======================================== FORGE END =====================================*/ -+ - public static void registerItems() - { - registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() -@@ -935,6 +1521,10 @@ - private final float damageVsEntity; - private final int enchantability; - -+ //Added by forge for custom Tool materials. -+ @Deprecated public Item customCraftingMaterial = null; // Remote in 1.8.1 -+ private ItemStack repairMaterial = null; -+ - private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) - { - this.harvestLevel = harvestLevel; -@@ -969,9 +1559,36 @@ - return this.enchantability; - } - -+ @Deprecated // Use getRepairItemStack below - public Item getRepairItem() - { -- return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == DIAMOND ? Items.diamond : null)))); -+ switch (this) -+ { -+ case WOOD: return Item.getItemFromBlock(Blocks.planks); -+ case STONE: return Item.getItemFromBlock(Blocks.cobblestone); -+ case GOLD: return Items.gold_ingot; -+ case IRON: return Items.iron_ingot; -+ case DIAMOND: return Items.diamond; -+ default: return customCraftingMaterial; -+ } - } -+ -+ public ToolMaterial setRepairItem(ItemStack stack) -+ { -+ if (this.repairMaterial != null || customCraftingMaterial != null) throw new RuntimeException("Can not change already set repair material"); -+ if (this == WOOD || this == STONE || this == GOLD || this == IRON || this == DIAMOND) throw new RuntimeException("Can not change vanilla tool repair materials"); -+ this.repairMaterial = stack; -+ this.customCraftingMaterial = stack.getItem(); -+ return this; -+ } -+ -+ public ItemStack getRepairItemStack() -+ { -+ if (repairMaterial != null) return repairMaterial; -+ Item ret = this.getRepairItem(); -+ if (ret == null) return null; -+ repairMaterial = new ItemStack(ret, 1, net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE); -+ return repairMaterial; -+ } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch deleted file mode 100644 index 25d1f23e59..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemArmor.java -+++ ../src-work/minecraft/net/minecraft/item/ItemArmor.java -@@ -235,6 +235,8 @@ - private final int[] damageReductionAmountArray; - private final int enchantability; - private final SoundEvent field_185020_j; -+ //Added by forge for custom Armor materials. -+ public Item customCraftingMaterial = null; - - private ArmorMaterial(String p_i46796_3_, int p_i46796_4_, int[] p_i46796_5_, int p_i46796_6_, SoundEvent p_i46796_7_) - { -@@ -267,7 +269,15 @@ - - public Item getRepairItem() - { -- return this == LEATHER ? Items.leather : (this == CHAIN ? Items.iron_ingot : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == DIAMOND ? Items.diamond : null)))); -+ switch (this) -+ { -+ case LEATHER: return Items.leather; -+ case CHAIN: return Items.iron_ingot; -+ case GOLD: return Items.gold_ingot; -+ case IRON: return Items.iron_ingot; -+ case DIAMOND: return Items.diamond; -+ default: return customCraftingMaterial; -+ } - } - - @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch deleted file mode 100644 index 06dca56105..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBlock.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java -@@ -50,16 +50,8 @@ - int i = this.getMetadata(stack.getMetadata()); - IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, hitX, hitY, hitZ, p_180614_9_, i, playerIn); - -- if (worldIn.setBlockState(pos, iblockstate1, 11)) -+ if (placeBlockAt(stack, playerIn, worldIn, pos, hitX, hitY, hitZ, p_180614_9_, iblockstate1)) - { -- iblockstate1 = worldIn.getBlockState(pos); -- -- if (iblockstate1.getBlock() == this.block) -- { -- setTileEntityNBT(worldIn, playerIn, pos, stack); -- this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); -- } -- - SoundType soundtype = this.block.func_185467_w(); - worldIn.func_184133_a(playerIn, pos, soundtype.func_185841_e(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F); - --stack.stackSize; -@@ -121,7 +113,7 @@ - { - Block block = worldIn.getBlockState(pos).getBlock(); - -- if (block == Blocks.snow_layer) -+ if (block == Blocks.snow_layer && block.isReplaceable(worldIn, pos)) - { - side = EnumFacing.UP; - } -@@ -159,4 +151,26 @@ - { - return this.block; - } -+ -+ /** -+ * Called to actually place the block, after the location is determined -+ * and all permission checks have been made. -+ * -+ * @param stack The item stack that was used to place the block. This can be changed inside the method. -+ * @param player The player who is placing the block. Can be null if the block is not being placed by a player. -+ * @param side The side the player (or machine) right-clicked on. -+ */ -+ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) -+ { -+ if (!world.setBlockState(pos, newState, 3)) return false; -+ -+ IBlockState state = world.getBlockState(pos); -+ if (state.getBlock() == this.block) -+ { -+ setTileEntityNBT(world, player, pos, stack); -+ this.block.onBlockPlacedBy(world, pos, state, player, stack); -+ } -+ -+ return true; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch deleted file mode 100644 index 01c1117e7f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBow.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBow.java -@@ -90,6 +90,10 @@ - boolean flag = entityplayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185312_x, stack) > 0; - ItemStack itemstack = this.func_185060_a(entityplayer); - -+ int i = this.getMaxItemUseDuration(stack) - timeLeft; -+ i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(stack, worldIn, (EntityPlayer)playerIn, i, itemstack != null || flag); -+ if (i < 0) return; -+ - if (itemstack != null || flag) - { - if (itemstack == null) -@@ -97,7 +101,6 @@ - itemstack = new ItemStack(Items.arrow); - } - -- int i = this.getMaxItemUseDuration(stack) - timeLeft; - float f = func_185059_b(i); - - if ((double)f >= 0.1D) -@@ -189,6 +192,9 @@ - { - boolean flag = this.func_185060_a(playerIn) != null; - -+ ActionResult ret = net.minecraftforge.event.ForgeEventFactory.onArrowNock(itemStackIn, worldIn, playerIn, p_77659_4_, flag); -+ if (ret != null) return ret; -+ - if (!playerIn.capabilities.isCreativeMode && !flag) - { - return !flag ? new ActionResult(EnumActionResult.FAIL, itemStackIn) : new ActionResult(EnumActionResult.PASS, itemStackIn); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch deleted file mode 100644 index d2254fe35e..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBucket.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBucket.java -@@ -36,6 +36,8 @@ - { - boolean flag = this.isFull == Blocks.air; - RayTraceResult raytraceresult = this.getMovingObjectPositionFromPlayer(worldIn, playerIn, flag); -+ ActionResult ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(playerIn, worldIn, itemStackIn, raytraceresult); -+ if (ret != null) return ret; - - if (raytraceresult == null) - { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch deleted file mode 100644 index 02318fa887..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBucketMilk.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBucketMilk.java -@@ -27,7 +27,7 @@ - - if (!worldIn.isRemote) - { -- playerIn.clearActivePotions(); -+ playerIn.curePotionEffects(stack); - } - - if (playerIn instanceof EntityPlayer) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch deleted file mode 100644 index 94f89322ff..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemDye.java -+++ ../src-work/minecraft/net/minecraft/item/ItemDye.java -@@ -50,7 +50,7 @@ - - if (enumdyecolor == EnumDyeColor.WHITE) - { -- if (applyBonemeal(stack, worldIn, pos)) -+ if (applyBonemeal(stack, worldIn, pos, playerIn)) - { - if (!worldIn.isRemote) - { -@@ -97,8 +97,18 @@ - - public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target) - { -+ if (worldIn instanceof net.minecraft.world.WorldServer) -+ return applyBonemeal(stack, worldIn, target, net.minecraftforge.common.util.FakePlayerFactory.getMinecraft((net.minecraft.world.WorldServer)worldIn)); -+ return false; -+ } -+ -+ public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target, EntityPlayer player) -+ { - IBlockState iblockstate = worldIn.getBlockState(target); - -+ int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, worldIn, target, iblockstate, stack); -+ if (hook != 0) return hook > 0; -+ - if (iblockstate.getBlock() instanceof IGrowable) - { - IGrowable igrowable = (IGrowable)iblockstate.getBlock(); -@@ -142,6 +152,16 @@ - worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * iblockstate.func_185900_c(worldIn, pos).maxY, (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); - } - } -+ else -+ { -+ for (int i1 = 0; i1 < amount; ++i1) -+ { -+ double d0 = itemRand.nextGaussian() * 0.02D; -+ double d1 = itemRand.nextGaussian() * 0.02D; -+ double d2 = itemRand.nextGaussian() * 0.02D; -+ worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * 1.0f, (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); -+ } -+ } - } - - public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target, EnumHand p_111207_4_) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch deleted file mode 100644 index 03387eb421..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemEmptyMap.java -+++ ../src-work/minecraft/net/minecraft/item/ItemEmptyMap.java -@@ -25,7 +25,7 @@ - worldIn.setItemData(s, mapdata); - mapdata.scale = 0; - mapdata.calculateMapCenter(playerIn.posX, playerIn.posZ, mapdata.scale); -- mapdata.dimension = (byte)worldIn.provider.func_186058_p().func_186068_a(); -+ mapdata.dimension = worldIn.provider.func_186058_p().func_186068_a(); - mapdata.field_186210_e = true; - mapdata.markDirty(); - --itemStackIn.stackSize; diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch deleted file mode 100644 index 69f342f8bf..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemFlintAndSteel.java -+++ ../src-work/minecraft/net/minecraft/item/ItemFlintAndSteel.java -@@ -31,7 +31,7 @@ - } - else - { -- if (worldIn.getBlockState(pos).func_185904_a() == Material.air) -+ if (worldIn.isAirBlock(pos)) - { - worldIn.func_184133_a(playerIn, pos, SoundEvents.field_187649_bu, SoundCategory.BLOCKS, 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - worldIn.setBlockState(pos, Blocks.fire.getDefaultState(), 11); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch deleted file mode 100644 index f721d1fc7c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemHoe.java -+++ ../src-work/minecraft/net/minecraft/item/ItemHoe.java -@@ -45,10 +45,13 @@ - } - else - { -+ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, playerIn, worldIn, pos); -+ if (hook != 0) return hook > 0 ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; -+ - IBlockState iblockstate = worldIn.getBlockState(pos); - Block block = iblockstate.getBlock(); - -- if (hitX != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).func_185904_a() == Material.air) -+ if (hitX != EnumFacing.DOWN && worldIn.isAirBlock(pos.up())) - { - if (block == Blocks.grass || block == Blocks.field_185774_da) - { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch deleted file mode 100644 index 5c669d0a79..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemLilyPad.java -+++ ../src-work/minecraft/net/minecraft/item/ItemLilyPad.java -@@ -47,6 +47,15 @@ - - if (iblockstate.func_185904_a() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) - { -+ // special case for handling block placement with water lilies -+ net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(worldIn, blockpos1); -+ worldIn.setBlockState(blockpos1, Blocks.waterlily.getDefaultState()); -+ if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(playerIn, blocksnapshot, net.minecraft.util.EnumFacing.UP).isCanceled()) -+ { -+ blocksnapshot.restore(true, false); -+ return new ActionResult(EnumActionResult.FAIL, itemStackIn); -+ } -+ - worldIn.setBlockState(blockpos1, Blocks.waterlily.getDefaultState(), 11); - - if (!playerIn.capabilities.isCreativeMode) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch deleted file mode 100644 index 763a91d255..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemMap.java -+++ ../src-work/minecraft/net/minecraft/item/ItemMap.java -@@ -57,7 +57,7 @@ - mapdata = new MapData(s); - mapdata.scale = 3; - mapdata.calculateMapCenter((double)worldIn.getWorldInfo().getSpawnX(), (double)worldIn.getWorldInfo().getSpawnZ(), mapdata.scale); -- mapdata.dimension = (byte)worldIn.provider.func_186058_p().func_186068_a(); -+ mapdata.dimension = worldIn.provider.func_186058_p().func_186068_a(); - mapdata.markDirty(); - worldIn.setItemData(s, mapdata); - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch deleted file mode 100644 index d9e451c9f7..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemMonsterPlacer.java -+++ ../src-work/minecraft/net/minecraft/item/ItemMonsterPlacer.java -@@ -88,7 +88,7 @@ - pos = pos.offset(hitX); - double d0 = 0.0D; - -- if (hitX == EnumFacing.UP && iblockstate instanceof BlockFence) -+ if (hitX == EnumFacing.UP && iblockstate.getBlock() instanceof BlockFence) //Forge: Fix Vanilla bug comparing state instead of block - { - d0 = 0.5D; - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch deleted file mode 100644 index 16e050b5be..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemRecord.java -+++ ../src-work/minecraft/net/minecraft/item/ItemRecord.java -@@ -73,6 +73,17 @@ - return EnumRarity.RARE; - } - -+ /** -+ * Retrieves the resource location of the sound to play for this record. -+ * -+ * @param name The name of the record to play -+ * @return The resource location for the audio, null to use default. -+ */ -+ public net.minecraft.util.ResourceLocation getRecordResource(String name) -+ { -+ return new net.minecraft.util.ResourceLocation(name); -+ } -+ - @SideOnly(Side.CLIENT) - public static ItemRecord func_185074_a(SoundEvent p_185074_0_) - { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch deleted file mode 100644 index 1425a3d9cf..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSeedFood.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSeedFood.java -@@ -8,7 +8,7 @@ - import net.minecraft.util.math.BlockPos; - import net.minecraft.world.World; - --public class ItemSeedFood extends ItemFood -+public class ItemSeedFood extends ItemFood implements net.minecraftforge.common.IPlantable - { - private Block crops; - private Block soilId; -@@ -22,7 +22,8 @@ - - public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand side, EnumFacing hitX, float hitY, float hitZ, float p_180614_9_) - { -- if (hitX == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(hitX), hitX, stack) && worldIn.getBlockState(pos).getBlock() == this.soilId && worldIn.isAirBlock(pos.up())) -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos); -+ if (hitX == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(hitX), hitX, stack) && state.getBlock().canSustainPlant(state, worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) - { - worldIn.setBlockState(pos.up(), this.crops.getDefaultState(), 11); - --stack.stackSize; -@@ -33,4 +34,16 @@ - return EnumActionResult.FAIL; - } - } -+ -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return net.minecraftforge.common.EnumPlantType.Crop; -+ } -+ -+ @Override -+ public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return this.crops.getDefaultState(); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch deleted file mode 100644 index b176b6576b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSeeds.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSeeds.java -@@ -9,7 +9,7 @@ - import net.minecraft.util.math.BlockPos; - import net.minecraft.world.World; - --public class ItemSeeds extends Item -+public class ItemSeeds extends Item implements net.minecraftforge.common.IPlantable - { - private Block crops; - private Block soilBlockID; -@@ -23,7 +23,8 @@ - - public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand side, EnumFacing hitX, float hitY, float hitZ, float p_180614_9_) - { -- if (hitX == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(hitX), hitX, stack) && worldIn.getBlockState(pos).getBlock() == this.soilBlockID && worldIn.isAirBlock(pos.up())) -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos); -+ if (hitX == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(hitX), hitX, stack) && state.getBlock().canSustainPlant(state, worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) - { - worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); - --stack.stackSize; -@@ -34,4 +35,16 @@ - return EnumActionResult.FAIL; - } - } -+ -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return this.crops == net.minecraft.init.Blocks.nether_wart ? net.minecraftforge.common.EnumPlantType.Nether : net.minecraftforge.common.EnumPlantType.Crop; -+ } -+ -+ @Override -+ public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return this.crops.getDefaultState(); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch deleted file mode 100644 index e317586a72..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch +++ /dev/null @@ -1,91 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemShears.java -+++ ../src-work/minecraft/net/minecraft/item/ItemShears.java -@@ -6,6 +6,7 @@ - import net.minecraft.creativetab.CreativeTabs; - import net.minecraft.entity.EntityLivingBase; - import net.minecraft.init.Blocks; -+import net.minecraft.util.EnumHand; - import net.minecraft.util.math.BlockPos; - import net.minecraft.world.World; - -@@ -22,7 +23,7 @@ - { - stack.damageItem(1, playerIn); - Block block = blockIn.getBlock(); -- return blockIn.func_185904_a() != Material.leaves && block != Blocks.web && block != Blocks.tallgrass && block != Blocks.vine && block != Blocks.tripwire && block != Blocks.wool ? super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn) : true; -+ return blockIn.func_185904_a() != Material.leaves && block != Blocks.web && block != Blocks.tallgrass && block != Blocks.vine && block != Blocks.tripwire && block != Blocks.wool && !(blockIn instanceof net.minecraftforge.common.IShearable) ? super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn) : true; - } - - public boolean canHarvestBlock(IBlockState blockIn) -@@ -36,4 +37,71 @@ - Block block = state.getBlock(); - return block != Blocks.web && state.func_185904_a() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, state)) : 15.0F; - } -+ -+ -+ @Override -+ public boolean itemInteractionForEntity(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity, EnumHand hand) -+ { -+ if (entity.worldObj.isRemote) -+ { -+ return false; -+ } -+ if (entity instanceof net.minecraftforge.common.IShearable) -+ { -+ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)entity; -+ BlockPos pos = new BlockPos(entity.posX, entity.posY, entity.posZ); -+ if (target.isShearable(itemstack, entity.worldObj, pos)) -+ { -+ java.util.List drops = target.onSheared(itemstack, entity.worldObj, pos, -+ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.init.Enchantments.field_185308_t, itemstack)); -+ -+ java.util.Random rand = new java.util.Random(); -+ for(ItemStack stack : drops) -+ { -+ net.minecraft.entity.item.EntityItem ent = entity.entityDropItem(stack, 1.0F); -+ ent.motionY += rand.nextFloat() * 0.05F; -+ ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; -+ ent.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; -+ } -+ itemstack.damageItem(1, entity); -+ } -+ return true; -+ } -+ return false; -+ } -+ -+ @Override -+ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, net.minecraft.entity.player.EntityPlayer player) -+ { -+ if (player.worldObj.isRemote || player.capabilities.isCreativeMode) -+ { -+ return false; -+ } -+ Block block = player.worldObj.getBlockState(pos).getBlock(); -+ if (block instanceof net.minecraftforge.common.IShearable) -+ { -+ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)block; -+ if (target.isShearable(itemstack, player.worldObj, pos)) -+ { -+ java.util.List drops = target.onSheared(itemstack, player.worldObj, pos, -+ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.init.Enchantments.field_185308_t, itemstack)); -+ java.util.Random rand = new java.util.Random(); -+ -+ for(ItemStack stack : drops) -+ { -+ float f = 0.7F; -+ double d = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ double d1 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ double d2 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ net.minecraft.entity.item.EntityItem entityitem = new net.minecraft.entity.item.EntityItem(player.worldObj, (double)pos.getX() + d, (double)pos.getY() + d1, (double)pos.getZ() + d2, stack); -+ entityitem.setDefaultPickupDelay(); -+ player.worldObj.spawnEntityInWorld(entityitem); -+ } -+ -+ itemstack.damageItem(1, player); -+ player.triggerAchievement(net.minecraft.stats.StatList.func_188055_a(block)); -+ } -+ } -+ return false; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch deleted file mode 100644 index d30bce76ea..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSkull.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSkull.java -@@ -42,13 +42,18 @@ - } - else - { -+ if (worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos)) -+ { -+ hitX = EnumFacing.UP; -+ pos = pos.down(); -+ } - IBlockState iblockstate = worldIn.getBlockState(pos); - Block block = iblockstate.getBlock(); - boolean flag = block.isReplaceable(worldIn, pos); - - if (!flag) - { -- if (!worldIn.getBlockState(pos).func_185904_a().isSolid()) -+ if (!worldIn.getBlockState(pos).func_185904_a().isSolid() && !worldIn.isSideSolid(pos, hitX, true)) - { - return EnumActionResult.FAIL; - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch deleted file mode 100644 index 951947b54e..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSnow.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSnow.java -@@ -68,4 +68,10 @@ - { - return damage; - } -+ -+ public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) -+ { -+ IBlockState state = world.getBlockState(pos); -+ return (state.getBlock() != net.minecraft.init.Blocks.snow_layer || ((Integer)state.getValue(BlockSnow.LAYERS)) > 7) ? super.canPlaceBlockOnSide(world, pos, side, player, stack) : true; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch deleted file mode 100644 index f955a53d7f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch +++ /dev/null @@ -1,229 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemStack.java -+++ ../src-work/minecraft/net/minecraft/item/ItemStack.java -@@ -41,7 +41,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public final class ItemStack -+public final class ItemStack implements net.minecraftforge.common.capabilities.ICapabilitySerializable - { - public static final DecimalFormat DECIMALFORMAT = new DecimalFormat("#.##"); - public int stackSize; -@@ -55,6 +55,10 @@ - private Block canPlaceOnCacheBlock; - private boolean canPlaceOnCacheResult; - -+ private net.minecraftforge.fml.common.registry.RegistryDelegate delegate; -+ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities; -+ private NBTTagCompound capNBT; -+ - public ItemStack(Block blockIn) - { - this((Block)blockIn, 1); -@@ -80,13 +84,15 @@ - this((Item)itemIn, amount, 0); - } - -- public ItemStack(Item itemIn, int amount, int meta) -+ public ItemStack(Item itemIn, int amount, int meta) { this (itemIn, amount, meta, null); } -+ public ItemStack(Item itemIn, int amount, int meta, NBTTagCompound capNBT) - { -+ this.capNBT = capNBT; - this.canDestroyCacheBlock = null; - this.canDestroyCacheResult = false; - this.canPlaceOnCacheBlock = null; - this.canPlaceOnCacheResult = false; -- this.item = itemIn; -+ this.setItem(itemIn); - this.stackSize = amount; - this.itemDamage = meta; - -@@ -114,7 +120,7 @@ - public ItemStack splitStack(int amount) - { - amount = Math.min(amount, this.stackSize); -- ItemStack itemstack = new ItemStack(this.item, amount, this.itemDamage); -+ ItemStack itemstack = new ItemStack(this.item, amount, this.itemDamage, this.capabilities != null ? this.capabilities.serializeNBT() : null); - - if (this.stackTagCompound != null) - { -@@ -127,11 +133,12 @@ - - public Item getItem() - { -- return this.item; -+ return this.delegate != null ? this.delegate.get() : null; - } - - public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand side, EnumFacing hitX, float hitY, float hitZ, float p_179546_8_) - { -+ if (!worldIn.isRemote) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, playerIn, worldIn, pos, hitX, hitY, hitZ, p_179546_8_, side); - EnumActionResult enumactionresult = this.getItem().onItemUse(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ, p_179546_8_); - - if (enumactionresult == EnumActionResult.SUCCESS) -@@ -169,12 +176,16 @@ - nbt.setTag("tag", this.stackTagCompound); - } - -+ if (this.capabilities != null) nbt.setTag("ForgeCaps", this.capabilities.serializeNBT()); -+ - return nbt; - } - - public void readFromNBT(NBTTagCompound nbt) - { -- this.item = Item.getByNameOrId(nbt.getString("id")); -+ this.capNBT = nbt.hasKey("ForgeCaps") ? nbt.getCompoundTag("ForgeCaps") : null; -+ this.setItem(Item.getByNameOrId(nbt.getString("id"))); -+ this.capNBT = null; - this.stackSize = nbt.getByte("Count"); - this.itemDamage = nbt.getShort("Damage"); - -@@ -196,7 +207,7 @@ - - public int getMaxStackSize() - { -- return this.getItem().getItemStackLimit(); -+ return this.getItem().getItemStackLimit(this); - } - - public boolean isStackable() -@@ -206,7 +217,7 @@ - - public boolean isItemStackDamageable() - { -- return this.item == null ? false : (this.item.getMaxDamage() <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable")); -+ return this.item == null ? false : (this.item.getMaxDamage(this) <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable")); - } - - public boolean getHasSubtypes() -@@ -216,32 +227,27 @@ - - public boolean isItemDamaged() - { -- return this.isItemStackDamageable() && this.itemDamage > 0; -+ return this.isItemStackDamageable() && getItem().isDamaged(this); - } - - public int getItemDamage() - { -- return this.itemDamage; -+ return getItem().getDamage(this); - } - - public int getMetadata() - { -- return this.itemDamage; -+ return getItem().getMetadata(this); - } - - public void setItemDamage(int meta) - { -- this.itemDamage = meta; -- -- if (this.itemDamage < 0) -- { -- this.itemDamage = 0; -- } -+ getItem().setDamage(this, meta); - } - - public int getMaxDamage() - { -- return this.item == null ? 0 : this.item.getMaxDamage(); -+ return this.item == null ? 0 : this.item.getMaxDamage(this); - } - - public boolean attemptDamageItem(int amount, Random rand) -@@ -273,8 +279,8 @@ - } - } - -- this.itemDamage += amount; -- return this.itemDamage > this.getMaxDamage(); -+ setItemDamage(getItemDamage() + amount); //Redirect through Item's callback if applicable. -+ return getItemDamage() > getMaxDamage(); - } - } - -@@ -328,7 +334,7 @@ - - public boolean canHarvestBlock(IBlockState blockIn) - { -- return this.item.canHarvestBlock(blockIn); -+ return getItem().canHarvestBlock(blockIn, this); - } - - public boolean interactWithEntity(EntityPlayer playerIn, EntityLivingBase entityIn, EnumHand p_111282_3_) -@@ -338,7 +344,7 @@ - - public ItemStack copy() - { -- ItemStack itemstack = new ItemStack(this.item, this.stackSize, this.itemDamage); -+ ItemStack itemstack = new ItemStack(this.item, this.stackSize, this.itemDamage, this.capabilities != null ? this.capabilities.serializeNBT() : null); - - if (this.stackTagCompound != null) - { -@@ -759,6 +765,7 @@ - } - } - -+ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, playerIn, list, advanced); - return list; - } - -@@ -869,7 +876,7 @@ - } - else - { -- multimap = this.getItem().getItemAttributeModifiers(p_111283_1_); -+ multimap = this.getItem().getAttributeModifiers(p_111283_1_, this); - } - - return multimap; -@@ -901,6 +908,18 @@ - - public void setItem(Item newItem) - { -+ if (newItem == this.item && item != null && this.capabilities != null) //Item Didn't change but refreshed -+ { -+ net.minecraftforge.common.capabilities.ICapabilityProvider parent = item.initCapabilities(this, this.capabilities.serializeNBT()); -+ this.capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(item, this, parent); -+ } -+ else if (newItem != this.item && newItem != null) // Item Changed -+ { -+ net.minecraftforge.common.capabilities.ICapabilityProvider parent = newItem.initCapabilities(this, this.capNBT); -+ this.capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(newItem, this, parent); -+ } -+ if (this.capNBT != null && this.capabilities != null) this.capabilities.deserializeNBT(this.capNBT); -+ this.delegate = newItem != null ? newItem.delegate : null; - this.item = newItem; - } - -@@ -987,4 +1006,26 @@ - return false; - } - } -+ -+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ return this.capabilities == null ? false : this.capabilities.hasCapability(capability, facing); -+ } -+ -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ return this.capabilities == null ? null : this.capabilities.getCapability(capability, facing); -+ } -+ -+ public void deserializeNBT(NBTTagCompound nbt) -+ { -+ this.readFromNBT(nbt); -+ } -+ -+ public NBTTagCompound serializeNBT() -+ { -+ NBTTagCompound ret = new NBTTagCompound(); -+ this.writeToNBT(ret); -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch deleted file mode 100644 index f52fd59428..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSword.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSword.java -@@ -88,7 +88,9 @@ - - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) - { -- return this.material.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); -+ ItemStack mat = this.material.getRepairItemStack(); -+ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, repair, false)) return true; -+ return super.getIsRepairable(toRepair, repair); - } - - public Multimap getItemAttributeModifiers(EntityEquipmentSlot p_111205_1_) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch deleted file mode 100644 index 958fe75f33..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemTool.java -+++ ../src-work/minecraft/net/minecraft/item/ItemTool.java -@@ -33,6 +33,18 @@ - this.damageVsEntity = p_i46745_1_ + p_i46745_3_.getDamageVsEntity(); - this.field_185065_c = p_i46745_2_; - this.setCreativeTab(CreativeTabs.tabTools); -+ if (this instanceof ItemPickaxe) -+ { -+ toolClass = "pickaxe"; -+ } -+ else if (this instanceof ItemAxe) -+ { -+ toolClass = "axe"; -+ } -+ else if (this instanceof ItemSpade) -+ { -+ toolClass = "shovel"; -+ } - } - - protected ItemTool(Item.ToolMaterial p_i46746_1_, Set p_i46746_2_) -@@ -42,6 +54,11 @@ - - public float getStrVsBlock(ItemStack stack, IBlockState state) - { -+ for (String type : getToolClasses(stack)) -+ { -+ if (state.getBlock().isToolEffective(type, state)) -+ return efficiencyOnProperMaterial; -+ } - return this.effectiveBlocks.contains(state.getBlock()) ? this.efficiencyOnProperMaterial : 1.0F; - } - -@@ -84,7 +101,9 @@ - - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) - { -- return this.toolMaterial.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); -+ ItemStack mat = this.toolMaterial.getRepairItemStack(); -+ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, repair, false)) return true; -+ return super.getIsRepairable(toRepair, repair); - } - - public Multimap getItemAttributeModifiers(EntityEquipmentSlot p_111205_1_) -@@ -99,4 +118,27 @@ - - return multimap; - } -+ -+ /*===================================== FORGE START =================================*/ -+ private String toolClass; -+ @Override -+ public int getHarvestLevel(ItemStack stack, String toolClass) -+ { -+ int level = super.getHarvestLevel(stack, toolClass); -+ if (level == -1 && toolClass != null && toolClass.equals(this.toolClass)) -+ { -+ return this.toolMaterial.getHarvestLevel(); -+ } -+ else -+ { -+ return level; -+ } -+ } -+ -+ @Override -+ public Set getToolClasses(ItemStack stack) -+ { -+ return toolClass != null ? com.google.common.collect.ImmutableSet.of(toolClass) : super.getToolClasses(stack); -+ } -+ /*===================================== FORGE END =================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch deleted file mode 100644 index 5f38ff6047..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java -@@ -73,6 +73,7 @@ - - public void addSmeltingRecipe(ItemStack input, ItemStack stack, float experience) - { -+ if (getSmeltingResult(input) != null) { net.minecraftforge.fml.common.FMLLog.info("Ignored smelting recipe with conflicting input: " + input + " = " + stack); return; } - this.smeltingList.put(input, stack); - this.experienceList.put(stack, Float.valueOf(experience)); - } -@@ -102,6 +103,9 @@ - - public float getSmeltingExperience(ItemStack stack) - { -+ float ret = stack.getItem().getSmeltingExperience(stack); -+ if (ret != -1) return ret; -+ - for (Entry entry : this.experienceList.entrySet()) - { - if (this.compareItemStacks(stack, (ItemStack)entry.getKey())) diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch deleted file mode 100644 index 359c3119c9..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/RecipeFireworks.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeFireworks.java -@@ -86,9 +86,9 @@ - { - this.field_92102_a = new ItemStack(Items.fireworks); - -+ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - if (l > 0) - { -- NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - NBTTagCompound nbttagcompound3 = new NBTTagCompound(); - NBTTagList nbttaglist = new NBTTagList(); - -@@ -105,9 +105,9 @@ - nbttagcompound3.setTag("Explosions", nbttaglist); - nbttagcompound3.setByte("Flight", (byte)j); - nbttagcompound1.setTag("Fireworks", nbttagcompound3); -- this.field_92102_a.setTagCompound(nbttagcompound1); - } - -+ this.field_92102_a.setTagCompound(nbttagcompound1); //Forge BugFix: NPE Protection - return true; - } - else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1) -@@ -249,11 +249,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = inv.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch deleted file mode 100644 index b3ad23a686..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java -@@ -25,7 +25,7 @@ - { - ItemStack itemstack1 = (ItemStack)list.get(0); - -- if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable()) -+ if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isRepairable()) - { - return false; - } -@@ -52,7 +52,7 @@ - { - ItemStack itemstack1 = (ItemStack)list.get(0); - -- if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable()) -+ if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isRepairable()) - { - return null; - } -@@ -65,7 +65,7 @@ - ItemStack itemstack2 = (ItemStack)list.get(0); - ItemStack itemstack3 = (ItemStack)list.get(1); - -- if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isDamageable()) -+ if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isRepairable()) - { - Item item = itemstack2.getItem(); - int j = item.getMaxDamage() - itemstack2.getItemDamage(); -@@ -102,11 +102,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = inv.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch deleted file mode 100644 index 799b450b6f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java -@@ -146,11 +146,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = inv.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch deleted file mode 100644 index 2deece9748..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/RecipesBanners.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesBanners.java -@@ -135,11 +135,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = inv.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; -@@ -356,9 +352,9 @@ - - if (itemstack != null) - { -- if (itemstack.getItem().hasContainerItem()) -+ if (itemstack.getItem().hasContainerItem(itemstack)) - { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0) - { diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch deleted file mode 100644 index 9cf0ab1975..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java -@@ -108,11 +108,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = inv.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch deleted file mode 100644 index d6265c91ae..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/ShapedRecipes.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/ShapedRecipes.java -@@ -33,11 +33,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = inv.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch deleted file mode 100644 index 2241e26998..0000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java -@@ -29,11 +29,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = inv.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch deleted file mode 100644 index 76f2e67396..0000000000 --- a/patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/CompressedStreamTools.java -+++ ../src-work/minecraft/net/minecraft/nbt/CompressedStreamTools.java -@@ -17,8 +17,6 @@ - import net.minecraft.crash.CrashReport; - import net.minecraft.crash.CrashReportCategory; - import net.minecraft.util.ReportedException; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - - public class CompressedStreamTools - { -@@ -53,7 +51,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - public static void safeWrite(NBTTagCompound p_74793_0_, File p_74793_1_) throws IOException - { - File file1 = new File(p_74793_1_.getAbsolutePath() + "_tmp"); -@@ -118,6 +115,7 @@ - private static NBTBase func_152455_a(DataInput p_152455_0_, int p_152455_1_, NBTSizeTracker p_152455_2_) throws IOException - { - byte b0 = p_152455_0_.readByte(); -+ p_152455_2_.read(8); // Forge: Count everything! - - if (b0 == 0) - { -@@ -125,7 +123,8 @@ - } - else - { -- p_152455_0_.readUTF(); -+ NBTSizeTracker.readUTF(p_152455_2_, p_152455_0_.readUTF()); //Forge: Count this string. -+ p_152455_2_.read(32); //Forge: 4 extra bytes for the object allocation. - NBTBase nbtbase = NBTBase.createNewByType(b0); - - try -@@ -144,7 +143,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - public static void write(NBTTagCompound p_74795_0_, File p_74795_1_) throws IOException - { - DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(p_74795_1_)); -@@ -159,7 +157,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - public static NBTTagCompound read(File p_74797_0_) throws IOException - { - if (!p_74797_0_.exists()) diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch deleted file mode 100644 index 078cb5b16d..0000000000 --- a/patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTSizeTracker.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTSizeTracker.java -@@ -25,4 +25,34 @@ - throw new RuntimeException("Tried to read NBT tag that was too big; tried to allocate: " + this.read + "bytes where max allowed: " + this.max); - } - } -+ -+ /* -+ * UTF8 is not a simple encoding system, each character can be either -+ * 1, 2, or 3 bytes. Depending on where it's numerical value falls. -+ * We have to count up each character individually to see the true -+ * length of the data. -+ * -+ * Basic concept is that it uses the MSB of each byte as a 'read more' signal. -+ * So it has to shift each 7-bit segment. -+ * -+ * This will accurately count the correct byte length to encode this string, plus the 2 bytes for it's length prefix. -+ */ -+ public static void readUTF(NBTSizeTracker tracker, String data) -+ { -+ tracker.read(16); //Header length -+ if (data == null) -+ return; -+ -+ int len = data.length(); -+ int utflen = 0; -+ -+ for (int i = 0; i < len; i++) -+ { -+ int c = data.charAt(i); -+ if ((c >= 0x0001) && (c <= 0x007F)) utflen += 1; -+ else if (c > 0x07FF) utflen += 3; -+ else utflen += 2; -+ } -+ tracker.read(8 * utflen); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch deleted file mode 100644 index 8b17ab96cb..0000000000 --- a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTTagCompound.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTTagCompound.java -@@ -454,6 +454,7 @@ - - private static byte readType(DataInput input, NBTSizeTracker sizeTracker) throws IOException - { -+ sizeTracker.read(8); - return input.readByte(); - } - -@@ -464,6 +465,7 @@ - - static NBTBase readNBT(byte id, String key, DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException - { -+ sizeTracker.read(32); //Forge: 4 extra bytes for the object allocation. - NBTBase nbtbase = NBTBase.createNewByType(id); - - try diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch deleted file mode 100644 index c8ca6ca1aa..0000000000 --- a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTTagString.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTTagString.java -@@ -32,7 +32,7 @@ - { - sizeTracker.read(288L); - this.data = input.readUTF(); -- sizeTracker.read((long)(16 * this.data.length())); -+ NBTSizeTracker.readUTF(sizeTracker, data); // Forge: Correctly read String length including header. - } - - public byte getId() diff --git a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch deleted file mode 100644 index 2facd3bb90..0000000000 --- a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/NetHandlerPlayServer.java -+++ ../src-work/minecraft/net/minecraft/network/NetHandlerPlayServer.java -@@ -612,7 +612,10 @@ - double d2 = this.playerEntity.posZ - ((double)blockpos.getZ() + 0.5D); - double d3 = d0 * d0 + d1 * d1 + d2 * d2; - -- if (d3 > 36.0D) -+ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1; -+ dist *= dist; -+ -+ if (d3 > dist) - { - return; - } -@@ -670,7 +673,9 @@ - - if (blockpos.getY() < this.serverController.getBuildLimit() - 1 || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit()) - { -- if (this.field_184362_y == null && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < 64.0D && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) -+ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 3; -+ dist *= dist; -+ if (this.field_184362_y == null && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < dist && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) - { - this.playerEntity.theItemInWorldManager.func_187251_a(this.playerEntity, worldserver, itemstack, enumhand, blockpos, enumfacing, p_184337_1_.func_187026_d(), p_184337_1_.func_187025_e(), p_184337_1_.func_187020_f()); - } -@@ -689,6 +694,7 @@ - if (itemstack != null && itemstack.stackSize == 0) - { - this.playerEntity.func_184611_a(enumhand, (ItemStack)null); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.playerEntity, itemstack, enumhand); - itemstack = null; - } - } -@@ -703,12 +709,14 @@ - - if (itemstack != null) - { -+ //TODO: Hook interact event here... we don't know the type of itneration tho... - this.playerEntity.theItemInWorldManager.func_187250_a(this.playerEntity, worldserver, itemstack, enumhand); - itemstack = this.playerEntity.func_184586_b(enumhand); - - if (itemstack != null && itemstack.stackSize == 0) - { - this.playerEntity.func_184611_a(enumhand, (ItemStack)null); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.playerEntity, itemstack, enumhand); - itemstack = null; - } - } -@@ -888,7 +896,9 @@ - } - else - { -- ITextComponent itextcomponent = new TextComponentTranslation("chat.type.text", new Object[] {this.playerEntity.getDisplayName(), s}); -+ ITextComponent itextcomponent = new TextComponentTranslation("chat.type.text", this.playerEntity.getDisplayName(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s)); -+ itextcomponent = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, itextcomponent); -+ if (itextcomponent == null) return; - this.serverController.func_184103_al().sendChatMsgImpl(itextcomponent, false); - } - -@@ -1057,7 +1067,7 @@ - return; - } - -- this.playerEntity = this.serverController.func_184103_al().recreatePlayerEntity(this.playerEntity, 0, false); -+ this.playerEntity = this.serverController.func_184103_al().recreatePlayerEntity(this.playerEntity, playerEntity.dimension, false); - - if (this.serverController.isHardcore()) - { diff --git a/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch deleted file mode 100644 index 454485ec47..0000000000 --- a/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/NetworkManager.java -+++ ../src-work/minecraft/net/minecraft/network/NetworkManager.java -@@ -89,6 +89,11 @@ - this.direction = packetDirection; - } - -+ public EnumPacketDirection getDirection() -+ { -+ return this.direction; -+ } -+ - public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception - { - super.channelActive(p_channelActive_1_); -@@ -205,7 +210,7 @@ - final EnumConnectionState enumconnectionstate = EnumConnectionState.getFromPacket(inPacket); - final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.channel.attr(attrKeyConnectionState).get(); - -- if (enumconnectionstate1 != enumconnectionstate) -+ if (enumconnectionstate1 != enumconnectionstate && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) - { - logger.debug("Disabled auto read"); - this.channel.config().setAutoRead(false); -@@ -213,7 +218,7 @@ - - if (this.channel.eventLoop().inEventLoop()) - { -- if (enumconnectionstate != enumconnectionstate1) -+ if (enumconnectionstate != enumconnectionstate1 && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) - { - this.setConnectionState(enumconnectionstate); - } -@@ -233,7 +238,7 @@ - { - public void run() - { -- if (enumconnectionstate != enumconnectionstate1) -+ if (enumconnectionstate != enumconnectionstate1 && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) - { - NetworkManager.this.setConnectionState(enumconnectionstate); - } -@@ -452,6 +457,11 @@ - } - } - -+ public Channel channel() -+ { -+ return channel; -+ } -+ - static class InboundHandlerTuplePacketListener - { - private final Packet packet; diff --git a/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch deleted file mode 100644 index 2f2e97b705..0000000000 --- a/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/NetworkSystem.java -+++ ../src-work/minecraft/net/minecraft/network/NetworkSystem.java -@@ -111,7 +111,7 @@ - ; - } - -- p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"legacy_query", (ChannelHandler)(new LegacyPingHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new NettyVarint21FrameDecoder())).addLast((String)"decoder", (ChannelHandler)(new NettyPacketDecoder(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new NettyVarint21FrameEncoder())).addLast((String)"encoder", (ChannelHandler)(new NettyPacketEncoder(EnumPacketDirection.CLIENTBOUND))); -+ p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT))).addLast((String)"legacy_query", (ChannelHandler)(new LegacyPingHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new NettyVarint21FrameDecoder())).addLast((String)"decoder", (ChannelHandler)(new NettyPacketDecoder(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new NettyVarint21FrameEncoder())).addLast((String)"encoder", (ChannelHandler)(new NettyPacketEncoder(EnumPacketDirection.CLIENTBOUND))); - NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); - NetworkSystem.this.networkManagers.add(networkmanager); - p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager); diff --git a/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch b/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch deleted file mode 100644 index ce50f6b636..0000000000 --- a/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch +++ /dev/null @@ -1,91 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/ServerStatusResponse.java -+++ ../src-work/minecraft/net/minecraft/network/ServerStatusResponse.java -@@ -29,6 +29,7 @@ - public void setServerDescription(ITextComponent motd) - { - this.serverMotd = motd; -+ invalidateJson(); - } - - public ServerStatusResponse.Players getPlayerCountData() -@@ -39,6 +40,7 @@ - public void setPlayerCountData(ServerStatusResponse.Players countData) - { - this.playerCount = countData; -+ invalidateJson(); - } - - public ServerStatusResponse.Version getProtocolVersionInfo() -@@ -49,11 +51,13 @@ - public void setProtocolVersionInfo(ServerStatusResponse.Version protocolVersionData) - { - this.protocolVersion = protocolVersionData; -+ invalidateJson(); - } - - public void setFavicon(String faviconBlob) - { - this.favicon = faviconBlob; -+ invalidateJson(); - } - - public String getFavicon() -@@ -176,6 +180,7 @@ - serverstatusresponse.setFavicon(JsonUtils.getString(jsonobject, "favicon")); - } - -+ net.minecraftforge.fml.client.FMLClientHandler.instance().captureAdditionalData(serverstatusresponse, jsonobject); - return serverstatusresponse; - } - -@@ -203,10 +208,50 @@ - jsonobject.addProperty("favicon", p_serialize_1_.getFavicon()); - } - -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.enhanceStatusQuery(jsonobject); - return jsonobject; - } - } - -+ private java.util.concurrent.Semaphore mutex = new java.util.concurrent.Semaphore(1); -+ private String json = null; -+ /** -+ * Returns this object as a Json string. -+ * Converting to JSON if a cached version is not available. -+ * -+ * Also to prevent potentially large memory allocations on the server -+ * this is moved from the S00PacketServerInfo writePacket function -+ * -+ * As this method is called from the network threads thread safety is important! -+ * -+ * @return -+ */ -+ public String getJson() -+ { -+ String ret = this.json; -+ if (ret == null) -+ { -+ mutex.acquireUninterruptibly(); -+ ret = this.json; -+ if (ret == null) -+ { -+ ret = net.minecraft.network.status.server.SPacketServerInfo.GSON.toJson(this); -+ this.json = ret; -+ } -+ mutex.release(); -+ } -+ return ret; -+ } -+ -+ /** -+ * Invalidates the cached json, causing the next call to getJson to rebuild it. -+ * This is needed externally because PlayerCountData.setPlayer's is public. -+ */ -+ public void invalidateJson() -+ { -+ this.json = null; -+ } -+ - public static class Version - { - private final String name; diff --git a/patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch b/patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch deleted file mode 100644 index dbeee89f60..0000000000 --- a/patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/handshake/client/C00Handshake.java -+++ ../src-work/minecraft/net/minecraft/network/handshake/client/C00Handshake.java -@@ -14,6 +14,7 @@ - private String ip; - private int port; - private EnumConnectionState requestedState; -+ private boolean hasFMLMarker = false; - - public C00Handshake() - { -@@ -28,18 +29,26 @@ - this.requestedState = requestedState; - } - -+ public C00Handshake(int protocol, String address, int port, EnumConnectionState state, boolean addFMLMarker) -+ { -+ this(protocol, address, port, state); -+ this.hasFMLMarker = addFMLMarker; -+ } -+ - public void readPacketData(PacketBuffer buf) throws IOException - { - this.protocolVersion = buf.readVarIntFromBuffer(); - this.ip = buf.readStringFromBuffer(255); - this.port = buf.readUnsignedShort(); - this.requestedState = EnumConnectionState.getById(buf.readVarIntFromBuffer()); -+ this.hasFMLMarker = this.ip.contains("\0FML\0"); -+ this.ip = this.ip.split("\0")[0]; - } - - public void writePacketData(PacketBuffer buf) throws IOException - { - buf.writeVarIntToBuffer(this.protocolVersion); -- buf.writeString(this.ip); -+ buf.writeString(this.ip + "\0FML\0"); - buf.writeShort(this.port); - buf.writeVarIntToBuffer(this.requestedState.getId()); - } -@@ -58,4 +67,9 @@ - { - return this.protocolVersion; - } -+ -+ public boolean hasFMLMarker() -+ { -+ return this.hasFMLMarker; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java.patch b/patches.mcp/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java.patch deleted file mode 100644 index 1e6382e7d3..0000000000 --- a/patches.mcp/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java -+++ ../src-work/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java -@@ -47,7 +47,11 @@ - public void writePacketData(PacketBuffer buf) throws IOException - { - buf.writeString(this.channel); -+ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. -+ this.data.markReaderIndex(); - buf.writeBytes((ByteBuf)this.data); -+ this.data.resetReaderIndex(); -+ } - } - - public void processPacket(INetHandlerPlayServer handler) diff --git a/patches.mcp/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java.patch b/patches.mcp/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java.patch deleted file mode 100644 index 3ec2e8b499..0000000000 --- a/patches.mcp/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java -+++ ../src-work/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java -@@ -46,7 +46,11 @@ - public void writePacketData(PacketBuffer buf) throws IOException - { - buf.writeString(this.channel); -+ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. -+ this.data.markReaderIndex(); - buf.writeBytes((ByteBuf)this.data); -+ this.data.resetReaderIndex(); -+ } - } - - public void processPacket(INetHandlerPlayClient handler) diff --git a/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch b/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch deleted file mode 100644 index dc766effa5..0000000000 --- a/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/potion/Potion.java -+++ ../src-work/minecraft/net/minecraft/potion/Potion.java -@@ -23,7 +23,7 @@ - - public class Potion - { -- public static final RegistryNamespaced field_188414_b = new RegistryNamespaced(); -+ public static final RegistryNamespaced field_188414_b = net.minecraftforge.fml.common.registry.GameData.getPotionRegistry(); - private final Map attributeModifierMap = Maps.newHashMap(); - private final boolean isBadEffect; - private final int liquidColor; -@@ -195,7 +195,6 @@ - return this.statusIconIndex; - } - -- @SideOnly(Side.CLIENT) - public boolean isBadEffect() - { - return this.isBadEffect; -@@ -266,7 +265,37 @@ - return modifier.getAmount() * (double)(p_111183_1_ + 1); - } - -+ /* ======================================== FORGE START =====================================*/ -+ -+ /** -+ * If the Potion effect should be displayed in the players inventory -+ * @param effect the active PotionEffect -+ * @return true to display it (default), false to hide it. -+ */ -+ public boolean shouldRender(PotionEffect effect) { return true; } -+ -+ /** -+ * If the standard PotionEffect text (name and duration) should be drawn when this potion is active. -+ * @param effect the active PotionEffect -+ * @return true to draw the standard text -+ */ -+ public boolean shouldRenderInvText(PotionEffect effect) -+ { -+ return true; -+ } -+ -+ /** -+ * Called to draw the this Potion onto the player's inventory when it's active. -+ * This can be used to e.g. render Potion icons from your own texture. -+ * @param x the x coordinate -+ * @param y the y coordinate -+ * @param effect the active PotionEffect -+ * @param mc the Minecraft instance, for convenience -+ */ - @SideOnly(Side.CLIENT) -+ public void renderInventoryEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc) { } -+ -+ @SideOnly(Side.CLIENT) - public boolean func_188408_i() - { - return this.field_188415_h; diff --git a/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch deleted file mode 100644 index c89501ebfc..0000000000 --- a/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ /dev/null @@ -1,87 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/potion/PotionEffect.java -+++ ../src-work/minecraft/net/minecraft/potion/PotionEffect.java -@@ -19,6 +19,8 @@ - @SideOnly(Side.CLIENT) - private boolean isPotionDurationMax; - private boolean field_188421_h; -+ /** List of ItemStack that can cure the potion effect **/ -+ private java.util.List curativeItems; - - public PotionEffect(Potion p_i46811_1_) - { -@@ -51,6 +53,7 @@ - this.amplifier = other.amplifier; - this.isAmbient = other.isAmbient; - this.field_188421_h = other.field_188421_h; -+ this.curativeItems = other.curativeItems; - } - - public void combine(PotionEffect other) -@@ -200,7 +203,7 @@ - - public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) - { -- int i = nbt.getByte("Id"); -+ int i = nbt.getByte("Id") & 0xFF; - Potion potion = Potion.func_188412_a(i); - - if (potion == null) -@@ -240,4 +243,58 @@ - { - return this.isPotionDurationMax; - } -+ -+ /* ======================================== FORGE START =====================================*/ -+ /*** -+ * Returns a list of curative items for the potion effect -+ * @return The list (ItemStack) of curative items for the potion effect -+ */ -+ public java.util.List getCurativeItems() -+ { -+ if (this.curativeItems == null) //Lazy load this so that we don't create a circular dep on Items. -+ { -+ this.curativeItems = new java.util.ArrayList(); -+ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket)); -+ } -+ return this.curativeItems; -+ } -+ -+ /*** -+ * Checks the given ItemStack to see if it is in the list of curative items for the potion effect -+ * @param stack The ItemStack being checked against the list of curative items for the potion effect -+ * @return true if the given ItemStack is in the list of curative items for the potion effect, false otherwise -+ */ -+ public boolean isCurativeItem(net.minecraft.item.ItemStack stack) -+ { -+ for (net.minecraft.item.ItemStack curativeItem : this.getCurativeItems()) -+ { -+ if (curativeItem.isItemEqual(stack)) -+ { -+ return true; -+ } -+ } -+ -+ return false; -+ } -+ -+ /*** -+ * Sets the array of curative items for the potion effect -+ * @param curativeItems The list of ItemStacks being set to the potion effect -+ */ -+ public void setCurativeItems(java.util.List curativeItems) -+ { -+ this.curativeItems = curativeItems; -+ } -+ -+ /*** -+ * Adds the given stack to list of curative items for the potion effect -+ * @param stack The ItemStack being added to the curative item list -+ */ -+ public void addCurativeItem(net.minecraft.item.ItemStack stack) -+ { -+ if (!this.isCurativeItem(stack)) -+ { -+ this.getCurativeItems().add(stack); -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch b/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch deleted file mode 100644 index 8fa2dc50d6..0000000000 --- a/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/realms/RealmsConnect.java -+++ ../src-work/minecraft/net/minecraft/realms/RealmsConnect.java -@@ -38,6 +38,7 @@ - - try - { -+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToRealmsServer(p_connect_1_, p_connect_2_); - inetaddress = InetAddress.getByName(p_connect_1_); - - if (RealmsConnect.this.aborted) -@@ -59,7 +60,7 @@ - return; - } - -- RealmsConnect.this.connection.sendPacket(new C00Handshake(107, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); -+ RealmsConnect.this.connection.sendPacket(new C00Handshake(107, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true)); - - if (RealmsConnect.this.aborted) - { diff --git a/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch deleted file mode 100644 index 25a020376c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ /dev/null @@ -1,273 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java -+++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java -@@ -100,7 +100,7 @@ - @SideOnly(Side.SERVER) - private String hostname; - private int serverPort = -1; -- public WorldServer[] worldServers; -+ public WorldServer[] worldServers = new WorldServer[0]; - private PlayerList serverConfigManager; - private boolean serverRunning = true; - private boolean serverStopped; -@@ -117,7 +117,8 @@ - private int buildLimit; - private int maxPlayerIdleMinutes = 0; - public final long[] tickTimeArray = new long[100]; -- public long[][] timeOfLastDimensionTick; -+ //public long[][] timeOfLastDimensionTick; -+ public java.util.Hashtable worldTickTimes = new java.util.Hashtable(); - private KeyPair serverKeyPair; - private String serverOwner; - private String folderName; -@@ -215,8 +216,6 @@ - { - this.convertMapIfNeeded(p_71247_1_); - this.setUserMessage("menu.loadingLevel"); -- this.worldServers = new WorldServer[3]; -- this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; - ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true); - this.setResourcePackFromWorld(this.getFolderName(), isavehandler); - WorldInfo worldinfo = isavehandler.loadWorldInfo(); -@@ -247,47 +246,21 @@ - worldsettings = new WorldSettings(worldinfo); - } - -- for (int i = 0; i < this.worldServers.length; ++i) -+ WorldServer overWorld = (WorldServer)(isDemo() ? new DemoWorldServer(this, isavehandler, worldinfo, 0, theProfiler).init() : new WorldServer(this, isavehandler, worldinfo, 0, theProfiler).init()); -+ overWorld.initialize(worldsettings); -+ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) - { -- int j = 0; -+ WorldServer world = (dim == 0 ? overWorld : (WorldServer)new WorldServerMulti(this, isavehandler, dim, overWorld, theProfiler).init()); -+ world.addWorldAccess(new WorldManager(this, world)); - -- if (i == 1) -- { -- j = -1; -- } -- -- if (i == 2) -- { -- j = 1; -- } -- -- if (i == 0) -- { -- if (this.isDemo()) -- { -- this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); -- } -- else -- { -- this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); -- } -- -- this.worldServers[i].initialize(worldsettings); -- } -- else -- { -- this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); -- } -- -- this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); -- - if (!this.isSinglePlayer()) - { -- this.worldServers[i].getWorldInfo().setGameType(this.getGameType()); -+ world.getWorldInfo().setGameType(this.getGameType()); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); - } - -- this.serverConfigManager.setPlayerManager(this.worldServers); -+ this.serverConfigManager.setPlayerManager(new WorldServer[]{ overWorld }); - this.setDifficultyForAllWorlds(this.getDifficulty()); - this.initialWorldChunkLoad(); - } -@@ -302,7 +275,7 @@ - this.setUserMessage("menu.generatingTerrain"); - int j1 = 0; - logger.info("Preparing start region for level " + j1); -- WorldServer worldserver = this.worldServers[j1]; -+ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(j1); - BlockPos blockpos = worldserver.getSpawnPoint(); - long k1 = getCurrentTimeMillis(); - -@@ -420,9 +393,15 @@ - { - if (this.worldServers[j] != null) - { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(this.worldServers[j])); } - this.worldServers[j].flush(); -- } - } -+ -+ WorldServer[] tmp = worldServers; -+ for (WorldServer world : tmp) -+ { -+ net.minecraftforge.common.DimensionManager.setWorld(world.provider.getDimension(), null, this); -+ } - } - - if (this.usageSnooper.isSnooperRunning()) -@@ -447,6 +426,7 @@ - { - if (this.startServer()) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarted(); - this.currentTime = getCurrentTimeMillis(); - long i = 0L; - this.statusResponse.setServerDescription(new TextComponentString(this.motd)); -@@ -491,12 +471,20 @@ - Thread.sleep(Math.max(1L, 50L - i)); - this.serverIsRunning = true; - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopping(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions - } - else - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions - this.finalTick((CrashReport)null); - } - } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) -+ { -+ // ignore silently -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions -+ } - catch (Throwable throwable1) - { - logger.error("Encountered an unexpected exception", throwable1); -@@ -522,14 +510,15 @@ - logger.error("We were unable to save this crash report to disk."); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions - this.finalTick(crashreport); - } - finally - { - try - { -- this.serverStopped = true; - this.stopServer(); -+ this.serverStopped = true; - } - catch (Throwable throwable) - { -@@ -537,6 +526,8 @@ - } - finally - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopped(); -+ this.serverStopped = true; - this.systemExitNow(); - } - } -@@ -604,6 +595,7 @@ - public void tick() - { - long i = System.nanoTime(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreServerTick(); - ++this.tickCounter; - - if (this.startProfiling) -@@ -630,6 +622,7 @@ - - Collections.shuffle(Arrays.asList(agameprofile)); - this.statusResponse.getPlayerCountData().setPlayers(agameprofile); -+ this.statusResponse.invalidateJson(); - } - - if (this.tickCounter % 900 == 0) -@@ -657,6 +650,7 @@ - - this.theProfiler.endSection(); - this.theProfiler.endSection(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostServerTick(); - } - - public void updateTimeLightAndEntities() -@@ -672,14 +666,17 @@ - } - - this.theProfiler.endStartSection("levels"); -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.tick(); - -- for (int j = 0; j < this.worldServers.length; ++j) -+ Integer[] ids = net.minecraftforge.common.DimensionManager.getIDs(this.tickCounter % 200 == 0); -+ for (int x = 0; x < ids.length; x++) - { -+ int id = ids[x]; - long i = System.nanoTime(); - -- if (j == 0 || this.getAllowNether()) -+ if (id == 0 || this.getAllowNether()) - { -- WorldServer worldserver = this.worldServers[j]; -+ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(id); - this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); - - if (this.tickCounter % 20 == 0) -@@ -690,6 +687,7 @@ - } - - this.theProfiler.startSection("tick"); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreWorldTick(worldserver); - - try - { -@@ -713,6 +711,7 @@ - throw new ReportedException(crashreport1); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostWorldTick(worldserver); - this.theProfiler.endSection(); - this.theProfiler.startSection("tracker"); - worldserver.getEntityTracker().updateTrackedEntities(); -@@ -720,9 +719,11 @@ - this.theProfiler.endSection(); - } - -- this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i; -+ worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - i; - } - -+ this.theProfiler.endStartSection("dim_unloading"); -+ net.minecraftforge.common.DimensionManager.unloadWorlds(worldTickTimes); - this.theProfiler.endStartSection("connection"); - this.getNetworkSystem().networkTick(); - this.theProfiler.endStartSection("players"); -@@ -744,6 +745,7 @@ - - public void startServerThread() - { -+ net.minecraftforge.fml.common.StartupQuery.reset(); - this.serverThread = new Thread(this, "Server thread"); - this.serverThread.start(); - } -@@ -760,7 +762,13 @@ - - public WorldServer worldServerForDimension(int dimension) - { -- return dimension == -1 ? this.worldServers[1] : (dimension == 1 ? this.worldServers[2] : this.worldServers[0]); -+ WorldServer ret = net.minecraftforge.common.DimensionManager.getWorld(dimension); -+ if (ret == null) -+ { -+ net.minecraftforge.common.DimensionManager.initDimension(dimension); -+ ret = net.minecraftforge.common.DimensionManager.getWorld(dimension); -+ } -+ return ret; - } - - public String getMinecraftVersion() -@@ -790,7 +798,7 @@ - - public String getServerModName() - { -- return "vanilla"; -+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().getModName(); - } - - public CrashReport addServerInfoToCrashReport(CrashReport report) diff --git a/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch deleted file mode 100644 index 4e1062e8af..0000000000 --- a/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java -+++ ../src-work/minecraft/net/minecraft/server/dedicated/DedicatedServer.java -@@ -56,6 +56,7 @@ - private boolean canSpawnStructures; - private WorldSettings.GameType gameType; - private boolean guiIsEnabled; -+ public static boolean allowPlayerLogins = false; - - public DedicatedServer(File p_i47086_1_, DataFixer p_i47086_2_, YggdrasilAuthenticationService p_i47086_3_, MinecraftSessionService p_i47086_4_, GameProfileRepository p_i47086_5_, PlayerProfileCache p_i47086_6_) - { -@@ -89,6 +90,7 @@ - { - public void run() - { -+ if (net.minecraftforge.server.console.TerminalHandler.handleCommands(DedicatedServer.this)) return; - BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in)); - String s4; - -@@ -114,6 +116,8 @@ - logger.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStart(this); -+ - logger.info("Loading properties"); - this.settings = new PropertyManager(new File("server.properties")); - this.eula = new ServerEula(new File("eula.txt")); -@@ -205,6 +209,7 @@ - } - else - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStarted(); - this.func_184105_a(new DedicatedPlayerList(this)); - long j = System.nanoTime(); - -@@ -254,6 +259,7 @@ - TileEntitySkull.func_184293_a(this.getPlayerProfileCache()); - TileEntitySkull.func_184294_a(this.getMinecraftSessionService()); - PlayerProfileCache.func_187320_a(this.isServerInOnlineMode()); -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; - logger.info("Preparing level \"" + this.getFolderName() + "\""); - this.loadAllWorlds(this.getFolderName(), this.getFolderName(), k, worldtype, s2); - long i1 = System.nanoTime() - j; -@@ -282,7 +288,7 @@ - thread1.start(); - } - -- return true; -+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this); - } - } - } -@@ -580,6 +586,9 @@ - return this.settings.getIntProperty("network-compression-threshold", super.getNetworkCompressionTreshold()); - } - -+ //Forge: Enable formated text for colors in console. -+ @Override public void addChatMessage(net.minecraft.util.text.ITextComponent message) { logger.info(message.getFormattedText()); } -+ - protected boolean convertFiles() throws IOException - { - boolean flag = false; diff --git a/patches.mcp/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch b/patches.mcp/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch deleted file mode 100644 index 10a8b960a9..0000000000 --- a/patches.mcp/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java -+++ ../src-work/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java -@@ -22,6 +22,7 @@ - private static final Logger LOGGER = LogManager.getLogger(); - private final DedicatedServer server; - private final long maxTickTime; -+ private boolean firstRun = true; - - public ServerHangWatchdog(DedicatedServer server) - { -@@ -37,7 +38,7 @@ - long j = MinecraftServer.getCurrentTimeMillis(); - long k = j - i; - -- if (k > this.maxTickTime) -+ if (k > this.maxTickTime && !this.firstRun) - { - LOGGER.fatal("A single server tick took " + String.format("%.2f", new Object[] {Float.valueOf((float)k / 1000.0F)}) + " seconds (should be max " + String.format("%.2f", new Object[] {Float.valueOf(0.05F)}) + ")"); - LOGGER.fatal("Considering it to be crashed, server will forcibly shutdown."); -@@ -75,6 +76,8 @@ - this.scheduleHalt(); - } - -+ this.firstRun = false; -+ - try - { - Thread.sleep(i + this.maxTickTime - j); diff --git a/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch deleted file mode 100644 index 36c6157638..0000000000 --- a/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/gui/MinecraftServerGui.java -+++ ../src-work/minecraft/net/minecraft/server/gui/MinecraftServerGui.java -@@ -77,6 +77,7 @@ - System.exit(0); - } - }); -+ minecraftservergui.latch.countDown(); - } - - public MinecraftServerGui(DedicatedServer serverIn) -@@ -161,8 +162,13 @@ - return jpanel; - } - -+ private java.util.concurrent.CountDownLatch latch = new java.util.concurrent.CountDownLatch(1); - public void func_164247_a(final JTextArea p_164247_1_, final JScrollPane p_164247_2_, final String p_164247_3_) - { -+ try -+ { -+ latch.await(); -+ } catch (InterruptedException e){} //Prevent logging until after constructor has ended. - if (!SwingUtilities.isEventDispatchThread()) - { - SwingUtilities.invokeLater(new Runnable() diff --git a/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch deleted file mode 100644 index e83ac8ccbd..0000000000 --- a/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ /dev/null @@ -1,87 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java -+++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java -@@ -68,8 +68,6 @@ - protected void loadAllWorlds(String p_71247_1_, String p_71247_2_, long seed, WorldType type, String p_71247_6_) - { - this.convertMapIfNeeded(p_71247_1_); -- this.worldServers = new WorldServer[3]; -- this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; - ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(p_71247_1_, true); - this.setResourcePackFromWorld(this.getFolderName(), isavehandler); - WorldInfo worldinfo = isavehandler.loadWorldInfo(); -@@ -83,44 +81,23 @@ - worldinfo.setWorldName(p_71247_2_); - } - -- for (int i = 0; i < this.worldServers.length; ++i) -+ WorldServer overWorld = (isDemo() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init() : -+ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init()); -+ overWorld.initialize(this.theWorldSettings); -+ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) - { -- int j = 0; -- -- if (i == 1) -+ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.theProfiler)).init()); -+ world.addWorldAccess(new WorldManager(this, world)); -+ if (!this.isSinglePlayer()) - { -- j = -1; -+ world.getWorldInfo().setGameType(getGameType()); - } -- -- if (i == 2) -- { -- j = 1; -- } -- -- if (i == 0) -- { -- if (this.isDemo()) -- { -- this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); -- } -- else -- { -- this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); -- } -- -- this.worldServers[i].initialize(this.theWorldSettings); -- } -- else -- { -- this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); -- } -- -- this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); - } - -- this.func_184103_al().setPlayerManager(this.worldServers); -+ this.func_184103_al().setPlayerManager(new WorldServer[]{ overWorld }); - -- if (this.worldServers[0].getWorldInfo().getDifficulty() == null) -+ if (overWorld.getWorldInfo().getDifficulty() == null) - { - this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); - } -@@ -138,9 +115,10 @@ - this.setAllowFlight(true); - logger.info("Generating keypair"); - this.setKeyPair(CryptManager.generateKeyPair()); -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; - this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.getWorldName()); - this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName()); -- return true; -+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this); - } - - public void tick() -@@ -213,6 +191,7 @@ - - public EnumDifficulty getDifficulty() - { -+ if (this.mc.theWorld == null) return this.mc.gameSettings.difficulty; // Fix NPE just in case. - return this.mc.theWorld.getWorldInfo().getDifficulty(); - } - diff --git a/patches.mcp/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch deleted file mode 100644 index 3111f6a970..0000000000 --- a/patches.mcp/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch +++ /dev/null @@ -1,213 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/PlayerInteractionManager.java -+++ ../src-work/minecraft/net/minecraft/server/management/PlayerInteractionManager.java -@@ -27,6 +27,8 @@ - - public class PlayerInteractionManager - { -+ /** Forge reach distance */ -+ private double blockReachDistance = 5.0d; - public World theWorld; - public EntityPlayerMP thisPlayerMP; - private WorldSettings.GameType gameType = WorldSettings.GameType.NOT_SET; -@@ -88,7 +90,7 @@ - IBlockState iblockstate = this.theWorld.getBlockState(this.field_180241_i); - Block block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() == Material.air) -+ if (block.isAir(iblockstate, theWorld, field_180241_i)) - { - this.receivedFinishDiggingPacket = false; - } -@@ -115,7 +117,7 @@ - IBlockState iblockstate1 = this.theWorld.getBlockState(this.field_180240_f); - Block block1 = iblockstate1.getBlock(); - -- if (iblockstate1.func_185904_a() == Material.air) -+ if (block1.isAir(iblockstate1, theWorld, field_180240_f)) - { - this.theWorld.sendBlockBreakProgress(this.thisPlayerMP.getEntityId(), this.field_180240_f, -1); - this.durabilityRemainingOnBlock = -1; -@@ -124,7 +126,7 @@ - else - { - int k = this.curblockDamage - this.initialDamage; -- float f1 = iblockstate1.func_185903_a(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180241_i) * (float)(k + 1); -+ float f1 = iblockstate1.func_185903_a(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180240_f) * (float)(k + 1); // Forge: Fix network break progress using wrong position - int l = (int)(f1 * 10.0F); - - if (l != this.durabilityRemainingOnBlock) -@@ -138,6 +140,14 @@ - - public void onBlockClicked(BlockPos pos, EnumFacing side) - { -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thisPlayerMP, -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, theWorld, pos, side, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(thisPlayerMP, getBlockReachDistance() + 1)); -+ if (event.isCanceled()) -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new SPacketBlockChange(theWorld, pos)); -+ return; -+ } -+ - if (this.isCreative()) - { - if (!this.theWorld.extinguishFire((EntityPlayer)null, pos, side)) -@@ -173,17 +183,32 @@ - } - } - -- this.theWorld.extinguishFire((EntityPlayer)null, pos, side); - this.initialDamage = this.curblockDamage; - float f = 1.0F; - -- if (iblockstate.func_185904_a() != Material.air) -+ if (!iblockstate.getBlock().isAir(iblockstate, theWorld, pos)) - { -- block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); -+ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); -+ this.theWorld.extinguishFire((EntityPlayer)null, pos, side); -+ } -+ else -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new SPacketBlockChange(theWorld, pos)); -+ } - f = iblockstate.func_185903_a(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos); - } -+ if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ if (f >= 1.0F) -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new SPacketBlockChange(theWorld, pos)); -+ } -+ return; -+ } - -- if (iblockstate.func_185904_a() != Material.air && f >= 1.0F) -+ if (iblockstate.getBlock().isAir(iblockstate, theWorld, pos) && f >= 1.0F) - { - this.tryHarvestBlock(pos); - } -@@ -205,7 +230,7 @@ - int i = this.curblockDamage - this.initialDamage; - IBlockState iblockstate = this.theWorld.getBlockState(pos); - -- if (iblockstate.func_185904_a() != Material.air) -+ if (iblockstate.getBlock().isAir(iblockstate, theWorld, pos)) - { - float f = iblockstate.func_185903_a(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos) * (float)(i + 1); - -@@ -234,9 +259,14 @@ - - private boolean removeBlock(BlockPos pos) - { -+ return removeBlock(pos, false); -+ } -+ -+ private boolean removeBlock(BlockPos pos, boolean canHarvest) -+ { - IBlockState iblockstate = this.theWorld.getBlockState(pos); - iblockstate.getBlock().onBlockHarvested(this.theWorld, pos, iblockstate, this.thisPlayerMP); -- boolean flag = this.theWorld.setBlockToAir(pos); -+ boolean flag = iblockstate.getBlock().removedByPlayer(iblockstate, theWorld, pos, thisPlayerMP, canHarvest); - - if (flag) - { -@@ -248,7 +278,8 @@ - - public boolean tryHarvestBlock(BlockPos pos) - { -- if (this.gameType.isCreative() && this.thisPlayerMP.func_184614_ca() != null && this.thisPlayerMP.func_184614_ca().getItem() instanceof ItemSword) -+ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(theWorld, gameType, thisPlayerMP, pos); -+ if (exp == -1) - { - return false; - } -@@ -264,41 +295,22 @@ - } - else - { -- if (this.gameType.isAdventure()) -- { -- if (this.gameType == WorldSettings.GameType.SPECTATOR) -- { -- return false; -- } -+ ItemStack stack = thisPlayerMP.func_184614_ca(); -+ if (stack != null && stack.getItem().onBlockStartBreak(stack, pos, thisPlayerMP)) return false; - -- if (!this.thisPlayerMP.isAllowEdit()) -- { -- ItemStack itemstack = this.thisPlayerMP.func_184614_ca(); -- -- if (itemstack == null) -- { -- return false; -- } -- -- if (!itemstack.canDestroy(iblockstate.getBlock())) -- { -- return false; -- } -- } -- } -- - this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, pos, Block.getStateId(iblockstate)); -- boolean flag1 = this.removeBlock(pos); -+ boolean flag1 = false; - - if (this.isCreative()) - { -+ flag1 = this.removeBlock(pos); - this.thisPlayerMP.playerNetServerHandler.sendPacket(new SPacketBlockChange(this.theWorld, pos)); - } - else - { - ItemStack itemstack1 = this.thisPlayerMP.func_184614_ca(); - ItemStack itemstack2 = itemstack1 == null ? null : itemstack1.copy(); -- boolean flag = this.thisPlayerMP.func_184823_b(iblockstate); -+ boolean flag = iblockstate.getBlock().canHarvestBlock(theWorld, pos, thisPlayerMP); - - if (itemstack1 != null) - { -@@ -310,12 +322,18 @@ - } - } - -+ flag1 = this.removeBlock(pos, flag); - if (flag1 && flag) - { - iblockstate.getBlock().harvestBlock(this.theWorld, this.thisPlayerMP, pos, iblockstate, tileentity, itemstack2); - } - } - -+ // Drop experience -+ if (!this.isCreative() && flag1 && exp > 0) -+ { -+ iblockstate.getBlock().dropXpOnBlockBreak(theWorld, pos, exp); -+ } - return flag1; - } - } -@@ -359,6 +377,7 @@ - if (itemstack.stackSize == 0) - { - p_187250_1_.func_184611_a(p_187250_4_, (ItemStack)null); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187250_1_, itemstack, p_187250_4_); - } - - if (!p_187250_1_.func_184587_cr()) -@@ -445,4 +464,13 @@ - { - this.theWorld = serverWorld; - } -+ -+ public double getBlockReachDistance() -+ { -+ return blockReachDistance; -+ } -+ public void setBlockReachDistance(double distance) -+ { -+ blockReachDistance = distance; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/server/management/PlayerList.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/PlayerList.java.patch deleted file mode 100644 index 8ee09c07aa..0000000000 --- a/patches.mcp/minecraft/net/minecraft/server/management/PlayerList.java.patch +++ /dev/null @@ -1,229 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/PlayerList.java -+++ ../src-work/minecraft/net/minecraft/server/management/PlayerList.java -@@ -101,7 +101,7 @@ - this.maxPlayers = 8; - } - -- public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn) -+ public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn, NetHandlerPlayServer nethandlerplayserver) - { - GameProfile gameprofile = playerIn.getGameProfile(); - PlayerProfileCache playerprofilecache = this.mcServer.getPlayerProfileCache(); -@@ -110,6 +110,17 @@ - playerprofilecache.addEntry(gameprofile); - NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(playerIn); - playerIn.setWorld(this.mcServer.worldServerForDimension(playerIn.dimension)); -+ -+ World playerWorld = this.mcServer.worldServerForDimension(playerIn.dimension); -+ if (playerWorld == null) -+ { -+ playerIn.dimension = 0; -+ playerWorld = this.mcServer.worldServerForDimension(0); -+ BlockPos spawnPoint = playerWorld.provider.getRandomizedSpawnPoint(); -+ playerIn.setPosition(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ()); -+ } -+ -+ playerIn.setWorld(playerWorld); - playerIn.theItemInWorldManager.setWorld((WorldServer)playerIn.worldObj); - String s1 = "local"; - -@@ -123,7 +134,7 @@ - WorldInfo worldinfo = worldserver.getWorldInfo(); - BlockPos blockpos = worldserver.getSpawnPoint(); - this.setPlayerGameTypeBasedOnOther(playerIn, (EntityPlayerMP)null, worldserver); -- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.mcServer, netManager, playerIn); -+ playerIn.playerNetServerHandler = nethandlerplayserver; - nethandlerplayserver.sendPacket(new SPacketJoinGame(playerIn.getEntityId(), playerIn.theItemInWorldManager.getGameType(), worldinfo.isHardcoreModeEnabled(), worldserver.provider.func_186058_p().func_186068_a(), worldserver.getDifficulty(), this.getMaxPlayers(), worldinfo.getTerrainType(), worldserver.getGameRules().getBoolean("reducedDebugInfo"))); - nethandlerplayserver.sendPacket(new SPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(this.getServerInstance().getServerModName()))); - nethandlerplayserver.sendPacket(new SPacketServerDifficulty(worldinfo.getDifficulty(), worldinfo.isDifficultyLocked())); -@@ -213,6 +224,7 @@ - } - - playerIn.addSelfToInternalCraftingInventory(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(playerIn); - } - - protected void sendScoreboard(ServerScoreboard scoreboardIn, EntityPlayerMP playerIn) -@@ -302,6 +314,7 @@ - nbttagcompound1 = this.mcServer.func_184110_aI().func_188257_a(FixTypes.PLAYER, nbttagcompound); - playerIn.readFromNBT(nbttagcompound1); - logger.debug("loading single player"); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(playerIn, this.playerNBTManagerObj, playerIn.getUniqueID().toString()); - } - else - { -@@ -311,8 +324,24 @@ - return nbttagcompound1; - } - -+ public NBTTagCompound getPlayerNBT(EntityPlayerMP player) -+ { -+ // Hacky method to allow loading the NBT for a player prior to login -+ NBTTagCompound nbttagcompound = this.mcServer.worldServers[0].getWorldInfo().getPlayerNBTTagCompound(); -+ if (player.getName().equals(this.mcServer.getServerOwner()) && nbttagcompound != null) -+ { -+ return nbttagcompound; -+ } -+ else -+ { -+ return ((net.minecraft.world.storage.SaveHandler)this.playerNBTManagerObj).getPlayerNBT(player); -+ } -+ } -+ - protected void writePlayerData(EntityPlayerMP playerIn) - { -+ if (playerIn.playerNetServerHandler == null) return; -+ - this.playerNBTManagerObj.writePlayerData(playerIn); - StatisticsFile statisticsfile = (StatisticsFile)this.playerStatFiles.get(playerIn.getUniqueID()); - -@@ -334,6 +363,7 @@ - playerIn.playerNetServerHandler.sendPacket(new SPacketPlayerListItem(SPacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {(EntityPlayerMP)this.playerEntityList.get(i)})); - } - -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); - worldserver.spawnEntityInWorld(playerIn); - this.preparePlayer(playerIn, (WorldServer)null); - } -@@ -345,6 +375,7 @@ - - public void playerLoggedOut(EntityPlayerMP playerIn) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(playerIn); - WorldServer worldserver = playerIn.getServerForPlayer(); - playerIn.triggerAchievement(StatList.leaveGameStat); - this.writePlayerData(playerIn); -@@ -379,6 +410,7 @@ - this.uuidToPlayerMap.remove(uuid); - this.playerStatFiles.remove(uuid); - } -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); - - this.sendPacketToAllPlayers(new SPacketPlayerListItem(SPacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn})); - } -@@ -462,13 +494,23 @@ - - public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd) - { -+ World world = mcServer.worldServerForDimension(dimension); -+ if (world == null) -+ { -+ dimension = 0; -+ } -+ else if (!world.provider.canRespawnHere()) -+ { -+ dimension = world.provider.getRespawnDimension(playerIn); -+ } -+ - playerIn.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(playerIn); - playerIn.getServerForPlayer().getEntityTracker().untrackEntity(playerIn); - playerIn.getServerForPlayer().func_184164_w().removePlayer(playerIn); - this.playerEntityList.remove(playerIn); - this.mcServer.worldServerForDimension(playerIn.dimension).removePlayerEntityDangerously(playerIn); -- BlockPos blockpos = playerIn.getBedLocation(); -- boolean flag = playerIn.isSpawnForced(); -+ BlockPos blockpos = playerIn.getBedLocation(dimension); -+ boolean flag = playerIn.isSpawnForced(dimension); - playerIn.dimension = dimension; - PlayerInteractionManager playerinteractionmanager; - -@@ -484,7 +526,8 @@ - EntityPlayerMP entityplayermp = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), playerinteractionmanager); - entityplayermp.playerNetServerHandler = playerIn.playerNetServerHandler; - entityplayermp.clonePlayer(playerIn, conqueredEnd); -- entityplayermp.setEntityId(playerIn.getEntityId()); -+ entityplayermp.dimension = dimension; -+ entityplayermp.setEntityId(playerIn.getEntityId()); - entityplayermp.func_174817_o(playerIn); - entityplayermp.func_184819_a(playerIn.func_184591_cq()); - -@@ -531,6 +574,7 @@ - this.uuidToPlayerMap.put(entityplayermp.getUniqueID(), entityplayermp); - entityplayermp.addSelfToInternalCraftingInventory(); - entityplayermp.setHealth(entityplayermp.getHealth()); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp); - return entityplayermp; - } - -@@ -545,15 +589,20 @@ - - public void func_187242_a(EntityPlayerMP p_187242_1_, int p_187242_2_) - { -+ transferPlayerToDimension(p_187242_1_, p_187242_2_, mcServer.worldServerForDimension(p_187242_2_).getDefaultTeleporter()); -+ } -+ -+ public void transferPlayerToDimension(EntityPlayerMP p_187242_1_, int p_187242_2_, net.minecraft.world.Teleporter teleporter) -+ { - int i = p_187242_1_.dimension; - WorldServer worldserver = this.mcServer.worldServerForDimension(p_187242_1_.dimension); - p_187242_1_.dimension = p_187242_2_; - WorldServer worldserver1 = this.mcServer.worldServerForDimension(p_187242_1_.dimension); -- p_187242_1_.playerNetServerHandler.sendPacket(new SPacketRespawn(p_187242_1_.dimension, p_187242_1_.worldObj.getDifficulty(), p_187242_1_.worldObj.getWorldInfo().getTerrainType(), p_187242_1_.theItemInWorldManager.getGameType())); -+ p_187242_1_.playerNetServerHandler.sendPacket(new SPacketRespawn(p_187242_1_.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), p_187242_1_.theItemInWorldManager.getGameType())); - this.func_187243_f(p_187242_1_); - worldserver.removePlayerEntityDangerously(p_187242_1_); - p_187242_1_.isDead = false; -- this.transferEntityToWorld(p_187242_1_, i, worldserver, worldserver1); -+ this.transferEntityToWorld(p_187242_1_, i, worldserver, worldserver1, teleporter); - this.preparePlayer(p_187242_1_, worldserver); - p_187242_1_.playerNetServerHandler.setPlayerLocation(p_187242_1_.posX, p_187242_1_.posY, p_187242_1_.posZ, p_187242_1_.rotationYaw, p_187242_1_.rotationPitch); - p_187242_1_.theItemInWorldManager.setWorld(worldserver1); -@@ -565,17 +614,27 @@ - { - p_187242_1_.playerNetServerHandler.sendPacket(new SPacketEntityEffect(p_187242_1_.getEntityId(), potioneffect)); - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_187242_1_, i, p_187242_2_); - } - - public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) - { -- double d0 = entityIn.posX; -- double d1 = entityIn.posZ; -+ transferEntityToWorld(entityIn, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.getDefaultTeleporter()); -+ } -+ -+ @SuppressWarnings("unused") -+ public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter) -+ { -+ net.minecraft.world.WorldProvider pOld = p_82448_3_.provider; -+ net.minecraft.world.WorldProvider pNew = p_82448_4_.provider; -+ double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor(); -+ double d0 = entityIn.posX * moveFactor; -+ double d1 = entityIn.posZ * moveFactor; - double d2 = 8.0D; - float f = entityIn.rotationYaw; - p_82448_3_.theProfiler.startSection("moving"); - -- if (entityIn.dimension == -1) -+ if (false && entityIn.dimension == -1) - { - d0 = MathHelper.clamp_double(d0 / d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); - d1 = MathHelper.clamp_double(d1 / d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); -@@ -586,7 +645,7 @@ - p_82448_3_.updateEntityWithOptionalForce(entityIn, false); - } - } -- else if (entityIn.dimension == 0) -+ else if (false && entityIn.dimension == 0) - { - d0 = MathHelper.clamp_double(d0 * d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); - d1 = MathHelper.clamp_double(d1 * d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); -@@ -597,7 +656,8 @@ - p_82448_3_.updateEntityWithOptionalForce(entityIn, false); - } - } -- else -+ -+ if (entityIn.dimension == 1) - { - BlockPos blockpos; - -@@ -632,7 +692,7 @@ - if (entityIn.isEntityAlive()) - { - entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch); -- p_82448_4_.getDefaultTeleporter().placeInPortal(entityIn, f); -+ teleporter.placeInPortal(entityIn, f); - p_82448_4_.spawnEntityInWorld(entityIn); - p_82448_4_.updateEntityWithOptionalForce(entityIn, false); - } diff --git a/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch deleted file mode 100644 index a4e9541950..0000000000 --- a/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/PlayerManager.java -+++ ../src-work/minecraft/net/minecraft/server/management/PlayerManager.java -@@ -338,6 +338,7 @@ - int i1 = this.playerViewRadius; - int j1 = i - k; - int k1 = j - l; -+ List chunksToLoad = Lists.newArrayList(); - - if (j1 != 0 || k1 != 0) - { diff --git a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch b/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch deleted file mode 100644 index 6c4b469422..0000000000 --- a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java -+++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java -@@ -22,6 +22,8 @@ - - public void processHandshake(C00Handshake packetIn) - { -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; -+ - switch (packetIn.getRequestedState()) - { - case LOGIN: diff --git a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch deleted file mode 100644 index eab396c8e8..0000000000 --- a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java -+++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java -@@ -66,7 +66,7 @@ - if (entityplayermp == null) - { - this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; -- this.server.func_184103_al().initializeConnectionToPlayer(this.networkManager, this.field_181025_l); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.func_184103_al(), this.networkManager, this.field_181025_l); - this.field_181025_l = null; - } - } -@@ -130,7 +130,7 @@ - } - else - { -- this.server.func_184103_al().initializeConnectionToPlayer(this.networkManager, this.server.func_184103_al().createPlayerForUser(this.loginGameProfile)); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.func_184103_al(), this.networkManager, this.server.func_184103_al().createPlayerForUser(this.loginGameProfile)); - } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch b/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch deleted file mode 100644 index e925f22b96..0000000000 --- a/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch +++ /dev/null @@ -1,101 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/stats/StatList.java -+++ ../src-work/minecraft/net/minecraft/stats/StatList.java -@@ -155,7 +155,7 @@ - } - } - -- replaceAllSimilarBlocks(field_188066_af); -+ replaceAllSimilarBlocks(field_188066_af, true); - } - - private static void initMiningStats() -@@ -177,7 +177,7 @@ - } - } - -- replaceAllSimilarBlocks(field_188065_ae); -+ replaceAllSimilarBlocks(field_188065_ae, false); - } - - private static void initStats() -@@ -201,7 +201,7 @@ - } - } - -- replaceAllSimilarBlocks(objectUseStats); -+ replaceAllSimilarBlocks(objectUseStats, true); - } - - private static void initItemDepleteStats() -@@ -220,7 +220,7 @@ - } - } - -- replaceAllSimilarBlocks(objectBreakStats); -+ replaceAllSimilarBlocks(objectBreakStats, true); - } - - private static void func_188054_f() -@@ -240,7 +240,7 @@ - } - } - -- replaceAllSimilarBlocks(objectBreakStats); -+ replaceAllSimilarBlocks(objectBreakStats, true); - } - - private static String func_180204_a(Item p_180204_0_) -@@ -249,28 +249,35 @@ - return resourcelocation != null ? resourcelocation.toString().replace(':', '.') : null; - } - -- private static void replaceAllSimilarBlocks(StatBase[] p_75924_0_) -+ private static void replaceAllSimilarBlocks(StatBase[] p_75924_0_, boolean useItemIds) - { -- mergeStatBases(p_75924_0_, Blocks.water, Blocks.flowing_water); -- mergeStatBases(p_75924_0_, Blocks.lava, Blocks.flowing_lava); -- mergeStatBases(p_75924_0_, Blocks.lit_pumpkin, Blocks.pumpkin); -- mergeStatBases(p_75924_0_, Blocks.lit_furnace, Blocks.furnace); -- mergeStatBases(p_75924_0_, Blocks.lit_redstone_ore, Blocks.redstone_ore); -- mergeStatBases(p_75924_0_, Blocks.powered_repeater, Blocks.unpowered_repeater); -- mergeStatBases(p_75924_0_, Blocks.powered_comparator, Blocks.unpowered_comparator); -- mergeStatBases(p_75924_0_, Blocks.redstone_torch, Blocks.unlit_redstone_torch); -- mergeStatBases(p_75924_0_, Blocks.lit_redstone_lamp, Blocks.redstone_lamp); -- mergeStatBases(p_75924_0_, Blocks.double_stone_slab, Blocks.stone_slab); -- mergeStatBases(p_75924_0_, Blocks.double_wooden_slab, Blocks.wooden_slab); -- mergeStatBases(p_75924_0_, Blocks.double_stone_slab2, Blocks.stone_slab2); -- mergeStatBases(p_75924_0_, Blocks.grass, Blocks.dirt); -- mergeStatBases(p_75924_0_, Blocks.farmland, Blocks.dirt); -+ mergeStatBases(p_75924_0_, Blocks.water, Blocks.flowing_water, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.lava, Blocks.flowing_lava, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.lit_pumpkin, Blocks.pumpkin, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.lit_furnace, Blocks.furnace, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.lit_redstone_ore, Blocks.redstone_ore, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.powered_repeater, Blocks.unpowered_repeater, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.powered_comparator, Blocks.unpowered_comparator, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.redstone_torch, Blocks.unlit_redstone_torch, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.lit_redstone_lamp, Blocks.redstone_lamp, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.double_stone_slab, Blocks.stone_slab, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.double_wooden_slab, Blocks.wooden_slab, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.double_stone_slab2, Blocks.stone_slab2, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.grass, Blocks.dirt, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.farmland, Blocks.dirt, useItemIds); - } - -- private static void mergeStatBases(StatBase[] statBaseIn, Block p_151180_1_, Block p_151180_2_) -+ private static void mergeStatBases(StatBase[] statBaseIn, Block p_151180_1_, Block p_151180_2_, boolean useItemIds) - { -- int i = Block.getIdFromBlock(p_151180_1_); -- int j = Block.getIdFromBlock(p_151180_2_); -+ int i; -+ int j; -+ if (useItemIds) { -+ i = Item.getIdFromItem(Item.getItemFromBlock(p_151180_1_)); -+ j = Item.getIdFromItem(Item.getItemFromBlock(p_151180_2_)); -+ } else { -+ i = Block.getIdFromBlock(p_151180_1_); -+ j = Block.getIdFromBlock(p_151180_2_); -+ } - - if (statBaseIn[i] != null && statBaseIn[j] == null) - { diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch deleted file mode 100644 index 2f9115e8de..0000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ /dev/null @@ -1,256 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java -@@ -18,7 +18,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - --public abstract class TileEntity -+public abstract class TileEntity implements net.minecraftforge.common.capabilities.ICapabilitySerializable - { - private static final Logger logger = LogManager.getLogger(); - private static Map < String, Class > nameToClassMap = Maps. < String, Class > newHashMap(); -@@ -60,6 +60,8 @@ - public void readFromNBT(NBTTagCompound compound) - { - this.pos = new BlockPos(compound.getInteger("x"), compound.getInteger("y"), compound.getInteger("z")); -+ if (compound.hasKey("ForgeData")) this.customTileData = compound.getCompoundTag("ForgeData"); -+ if (this.capabilities != null && compound.hasKey("ForgeCaps")) this.capabilities.deserializeNBT(compound.getCompoundTag("ForgeCaps")); - } - - public void writeToNBT(NBTTagCompound compound) -@@ -76,6 +78,8 @@ - compound.setInteger("x", this.pos.getX()); - compound.setInteger("y", this.pos.getY()); - compound.setInteger("z", this.pos.getZ()); -+ if (this.customTileData != null) compound.setTag("ForgeData", this.customTileData); -+ if (this.capabilities != null) compound.setTag("ForgeCaps", this.capabilities.serializeNBT()); - } - } - -@@ -83,10 +87,11 @@ - { - TileEntity tileentity = null; - String s = p_184246_1_.getString("id"); -+ Class oclass = null; - - try - { -- Class oclass = (Class)nameToClassMap.get(s); -+ oclass = (Class)nameToClassMap.get(s); - - if (oclass != null) - { -@@ -96,6 +101,9 @@ - catch (Throwable throwable1) - { - logger.error("Failed to create block entity " + s, throwable1); -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, throwable1, -+ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ s, oclass.getName()); - } - - if (tileentity != null) -@@ -107,6 +115,9 @@ - catch (Throwable throwable) - { - logger.error("Failed to load data for block entity " + s, throwable); -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, throwable, -+ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ s, oclass.getName()); - tileentity = null; - } - } -@@ -144,7 +155,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - public double getDistanceSq(double x, double y, double z) - { - double d0 = (double)this.pos.getX() + 0.5D - x; -@@ -271,6 +281,185 @@ - return false; - } - -+ // -- BEGIN FORGE PATCHES -- -+ /** -+ * Called when you receive a TileEntityData packet for the location this -+ * TileEntity is currently in. On the client, the NetworkManager will always -+ * be the remote server. On the server, it will be whomever is responsible for -+ * sending the packet. -+ * -+ * @param net The NetworkManager the packet originated from -+ * @param pkt The data packet -+ */ -+ public void onDataPacket(net.minecraft.network.NetworkManager net, net.minecraft.network.play.server.SPacketUpdateTileEntity pkt) -+ { -+ } -+ -+ /** -+ * Called when the chunk this TileEntity is on is Unloaded. -+ */ -+ public void onChunkUnload() -+ { -+ } -+ -+ private boolean isVanilla = getClass().getName().startsWith("net.minecraft."); -+ /** -+ * Called from Chunk.setBlockIDWithMetadata and Chunk.fillChunk, determines if this tile entity should be re-created when the ID, or Metadata changes. -+ * Use with caution as this will leave straggler TileEntities, or create conflicts with other TileEntities if not used properly. -+ * -+ * @param world Current world -+ * @param pos Tile's world position -+ * @param oldState The old ID of the block -+ * @param newState The new ID of the block (May be the same) -+ * @return true forcing the invalidation of the existing TE, false not to invalidate the existing TE -+ */ -+ public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) -+ { -+ return isVanilla ? (oldState.getBlock() != newSate.getBlock()) : oldState != newSate; -+ } -+ -+ public boolean shouldRenderInPass(int pass) -+ { -+ return pass == 0; -+ } -+ -+ /** -+ * Sometimes default render bounding box: infinite in scope. Used to control rendering on {@link TileEntitySpecialRenderer}. -+ */ -+ public static final net.minecraft.util.math.AxisAlignedBB INFINITE_EXTENT_AABB = new net.minecraft.util.math.AxisAlignedBB(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); -+ /** -+ * Return an {@link AxisAlignedBB} that controls the visible scope of a {@link TileEntitySpecialRenderer} associated with this {@link TileEntity} -+ * Defaults to the collision bounding box {@link Block#getCollisionBoundingBoxFromPool(World, int, int, int)} associated with the block -+ * at this location. -+ * -+ * @return an appropriately size {@link AxisAlignedBB} for the {@link TileEntity} -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.util.math.AxisAlignedBB getRenderBoundingBox() -+ { -+ net.minecraft.util.math.AxisAlignedBB bb = INFINITE_EXTENT_AABB; -+ Block type = getBlockType(); -+ if (type == Blocks.enchanting_table) -+ { -+ bb = new net.minecraft.util.math.AxisAlignedBB(getPos(), getPos().add(1, 1, 1)); -+ } -+ else if (type == Blocks.chest || type == Blocks.trapped_chest) -+ { -+ bb = new net.minecraft.util.math.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(2, 2, 2)); -+ } -+ else if (type != null && type != Blocks.beacon) -+ { -+ net.minecraft.util.math.AxisAlignedBB cbb = null; -+ try -+ { -+ cbb = worldObj.getBlockState(getPos()).func_185890_d(worldObj, getPos()); -+ } -+ catch (Exception e) -+ { -+ // We have to capture any exceptions that may occur here because BUKKIT servers like to send -+ // the tile entity data BEFORE the chunk data, you know, the OPPOSITE of what vanilla does! -+ // So we can not GARENTEE that the world state is the real state for the block... -+ // So, once again in the long line of US having to accommodate BUKKIT breaking things, -+ // here it is, assume that the TE is only 1 cubic block. Problem with this is that it may -+ // cause the TileEntity renderer to error further down the line! But alas, nothing we can do. -+ cbb = new net.minecraft.util.math.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(1, 1, 1)); -+ } -+ if (cbb != null) bb = cbb; -+ } -+ return bb; -+ } -+ -+ /** -+ * Checks if this tile entity knows how to render its 'breaking' overlay effect. -+ * If this returns true, The TileEntitySpecialRenderer will be called again with break progress set. -+ * @return True to re-render tile with breaking effect. -+ */ -+ public boolean canRenderBreaking() -+ { -+ Block block = this.getBlockType(); -+ return (block instanceof net.minecraft.block.BlockChest || -+ block instanceof net.minecraft.block.BlockEnderChest || -+ block instanceof net.minecraft.block.BlockSign || -+ block instanceof net.minecraft.block.BlockSkull); -+ } -+ -+ private NBTTagCompound customTileData; -+ -+ /** -+ * Gets a {@link NBTTagCompound} that can be used to store custom data for this tile entity. -+ * It will be written, and read from disc, so it persists over world saves. -+ * -+ * @return A compound tag for custom data -+ */ -+ public NBTTagCompound getTileData() -+ { -+ if (this.customTileData == null) -+ { -+ this.customTileData = new NBTTagCompound(); -+ } -+ return this.customTileData; -+ } -+ -+ /** -+ * Determines if the player can overwrite the NBT data of this tile entity while they place it using a ItemStack. -+ * Added as a fix for MC-75630 - Exploit with signs and command blocks -+ * @return True to prevent NBT copy, false to allow. -+ */ -+ public boolean restrictNBTCopy() -+ { -+ return this instanceof TileEntityCommandBlock || -+ this instanceof TileEntityMobSpawner || -+ this instanceof TileEntitySign; -+ } -+ -+ -+ /** -+ * Called from the Chunk when this is first added to the world. Override instead of adding -+ * if (firstTick) stuff in update. Happens after validate and after it has been placed into the Chunk tileEntity -+ * map. -+ */ -+ public void onLoad() -+ { -+ // NOOP -+ } -+ -+ /** -+ * If the TileEntitySpecialRenderer associated with this TileEntity can be batched in with another renderers, and won't access the GL state. -+ * If TileEntity returns true, then TESR should have the same functionality as (and probably extend) the FastTESR class. -+ */ -+ public boolean hasFastRenderer() -+ { -+ return false; -+ } -+ -+ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities; -+ public TileEntity() -+ { -+ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this); -+ } -+ -+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ return capabilities == null ? false : capabilities.hasCapability(capability, facing); -+ } -+ -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ return capabilities == null ? null : capabilities.getCapability(capability, facing); -+ } -+ -+ public void deserializeNBT(NBTTagCompound nbt) -+ { -+ this.readFromNBT(nbt); -+ } -+ -+ public NBTTagCompound serializeNBT() -+ { -+ NBTTagCompound ret = new NBTTagCompound(); -+ this.writeToNBT(ret); -+ return ret; -+ } -+ - static - { - addMapping(TileEntityFurnace.class, "Furnace"); diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch deleted file mode 100644 index 9323da9f29..0000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -@@ -179,7 +179,7 @@ - { - Block block = this.worldObj.getBlockState(new BlockPos(j1, i2, k1)).getBlock(); - -- if (block != Blocks.emerald_block && block != Blocks.gold_block && block != Blocks.diamond_block && block != Blocks.iron_block) -+ if (!block.isBeaconBase(this.worldObj, new BlockPos(j1, i2, k1), getPos())) - { - flag1 = false; - break; -@@ -371,7 +371,7 @@ - - public boolean isItemValidForSlot(int index, ItemStack stack) - { -- return stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot; -+ return stack.getItem() != null && stack.getItem().isBeaconPayment(stack); - } - - public String getGuiID() diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch deleted file mode 100644 index b70efb2280..0000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ /dev/null @@ -1,86 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java -@@ -140,7 +140,7 @@ - - private boolean canBrew() - { -- if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0) -+ if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0 && false) // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe - { - ItemStack itemstack = this.brewingItemStacks[3]; - -@@ -165,25 +165,23 @@ - } - else - { -- return false; -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(brewingItemStacks, brewingItemStacks[3], outputSlots); - } - } - - private void brewPotions() - { -+ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBreaw(brewingItemStacks)) return; - ItemStack itemstack = this.brewingItemStacks[3]; - -- for (int i = 0; i < 3; ++i) -- { -- this.brewingItemStacks[i] = PotionHelper.func_185212_d(itemstack, this.brewingItemStacks[i]); -- } -+ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(brewingItemStacks, brewingItemStacks[3], outputSlots); - - --itemstack.stackSize; - BlockPos blockpos = this.getPos(); - -- if (itemstack.getItem().hasContainerItem()) -+ if (itemstack.getItem().hasContainerItem(itemstack)) - { -- ItemStack itemstack1 = new ItemStack(itemstack.getItem().getContainerItem()); -+ ItemStack itemstack1 = itemstack.getItem().getContainerItem(itemstack); - - if (itemstack.stackSize <= 0) - { -@@ -202,6 +200,7 @@ - - this.brewingItemStacks[3] = itemstack; - this.worldObj.playAuxSFX(1035, blockpos, 0); -+ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(brewingItemStacks); - } - - public void readFromNBT(NBTTagCompound compound) -@@ -303,12 +302,12 @@ - { - if (index == 3) - { -- return PotionHelper.func_185205_a(stack); -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack); - } - else - { - Item item = stack.getItem(); -- return index == 4 ? item == Items.blaze_powder : item == Items.potionitem || item == Items.field_185155_bH || item == Items.field_185156_bI || item == Items.glass_bottle; -+ return index == 4 ? item == Items.blaze_powder : net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack); - } - } - -@@ -362,6 +361,20 @@ - } - } - -+ net.minecraftforge.items.IItemHandler handlerInput = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.UP); -+ net.minecraftforge.items.IItemHandler handlerOutput = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.DOWN); -+ -+ @Override -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) -+ if (facing == EnumFacing.UP) -+ return (T) handlerInput; -+ else -+ return (T) handlerOutput; -+ return super.getCapability(capability, facing); -+ } -+ - public int getFieldCount() - { - return 2; diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch deleted file mode 100644 index 7fb580f300..0000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityChest.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityChest.java -@@ -171,6 +171,7 @@ - { - super.updateContainingBlockInfo(); - this.adjacentChestChecked = false; -+ doubleChestHandler = null; - } - - @SuppressWarnings("incomplete-switch") -@@ -457,6 +458,26 @@ - } - } - -+ public net.minecraftforge.items.VanillaDoubleChestItemHandler doubleChestHandler; -+ -+ @Override -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) -+ { -+ if(doubleChestHandler == null || doubleChestHandler.needsRefresh()) -+ doubleChestHandler = net.minecraftforge.items.VanillaDoubleChestItemHandler.get(this); -+ if (doubleChestHandler != null && doubleChestHandler != net.minecraftforge.items.VanillaDoubleChestItemHandler.NO_ADJACENT_CHESTS_INSTANCE) -+ return (T) doubleChestHandler; -+ } -+ return super.getCapability(capability, facing); -+ } -+ -+ public net.minecraftforge.items.IItemHandler getSingleChestHandler() -+ { -+ return super.getCapability(net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); -+ } -+ - public void func_184287_a(ResourceLocation p_184287_1_, long p_184287_2_) - { - this.field_184284_m = p_184287_1_; diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch deleted file mode 100644 index 32746de74a..0000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch +++ /dev/null @@ -1,99 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java -@@ -110,9 +110,9 @@ - } - } - -- this.furnaceBurnTime = compound.getShort("BurnTime"); -- this.cookTime = compound.getShort("CookTime"); -- this.totalCookTime = compound.getShort("CookTimeTotal"); -+ this.furnaceBurnTime = compound.getInteger("BurnTime"); -+ this.cookTime = compound.getInteger("CookTime"); -+ this.totalCookTime = compound.getInteger("CookTimeTotal"); - this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]); - - if (compound.hasKey("CustomName", 8)) -@@ -124,9 +124,9 @@ - public void writeToNBT(NBTTagCompound compound) - { - super.writeToNBT(compound); -- compound.setShort("BurnTime", (short)this.furnaceBurnTime); -- compound.setShort("CookTime", (short)this.cookTime); -- compound.setShort("CookTimeTotal", (short)this.totalCookTime); -+ compound.setInteger("BurnTime", this.furnaceBurnTime); -+ compound.setInteger("CookTime", this.cookTime); -+ compound.setInteger("CookTimeTotal", this.totalCookTime); - NBTTagList nbttaglist = new NBTTagList(); - - for (int i = 0; i < this.furnaceItemStacks.length; ++i) -@@ -192,8 +192,7 @@ - - if (this.furnaceItemStacks[1].stackSize == 0) - { -- Item item = this.furnaceItemStacks[1].getItem().getContainerItem(); -- this.furnaceItemStacks[1] = item != null ? new ItemStack(item) : null; -+ this.furnaceItemStacks[1] = furnaceItemStacks[1].getItem().getContainerItem(furnaceItemStacks[1]); - } - } - } -@@ -248,7 +247,11 @@ - else - { - ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]); -- return itemstack == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].isItemEqual(itemstack) ? false : (this.furnaceItemStacks[2].stackSize < this.getInventoryStackLimit() && this.furnaceItemStacks[2].stackSize < this.furnaceItemStacks[2].getMaxStackSize() ? true : this.furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize()))); -+ if (itemstack == null) return false; -+ if (this.furnaceItemStacks[2] == null) return true; -+ if (!this.furnaceItemStacks[2].isItemEqual(itemstack)) return false; -+ int result = furnaceItemStacks[2].stackSize + itemstack.stackSize; -+ return result <= getInventoryStackLimit() && result <= this.furnaceItemStacks[2].getMaxStackSize(); //Forge BugFix: Make it respect stack sizes properly. - } - } - -@@ -264,7 +267,7 @@ - } - else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem()) - { -- ++this.furnaceItemStacks[2].stackSize; -+ this.furnaceItemStacks[2].stackSize += itemstack.stackSize; // Forge BugFix: Results may have multiple items - } - - if (this.furnaceItemStacks[0].getItem() == Item.getItemFromBlock(Blocks.sponge) && this.furnaceItemStacks[0].getMetadata() == 1 && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].getItem() == Items.bucket) -@@ -311,7 +314,15 @@ - } - } - -- return item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD") ? 200 : (item == Items.stick ? 100 : (item == Items.coal ? 1600 : (item == Items.lava_bucket ? 20000 : (item == Item.getItemFromBlock(Blocks.sapling) ? 100 : (item == Items.blaze_rod ? 2400 : 0))))))); -+ if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200; -+ if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200; -+ if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200; -+ if (item == Items.stick) return 100; -+ if (item == Items.coal) return 1600; -+ if (item == Items.lava_bucket) return 20000; -+ if (item == Item.getItemFromBlock(Blocks.sapling)) return 100; -+ if (item == Items.blaze_rod) return 2400; -+ return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(p_145952_0_); - } - } - -@@ -432,4 +443,21 @@ - this.furnaceItemStacks[i] = null; - } - } -+ -+ net.minecraftforge.items.IItemHandler handlerTop = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.UP); -+ net.minecraftforge.items.IItemHandler handlerBottom = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.DOWN); -+ net.minecraftforge.items.IItemHandler handlerSide = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.WEST); -+ -+ @Override -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) -+ if (facing == EnumFacing.DOWN) -+ return (T) handlerBottom; -+ else if (facing == EnumFacing.UP) -+ return (T) handlerTop; -+ else -+ return (T) handlerSide; -+ return super.getCapability(capability, facing); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch deleted file mode 100644 index 2b856f03d0..0000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java -@@ -237,6 +237,7 @@ - - private boolean transferItemsOut() - { -+ if (net.minecraftforge.items.VanillaInventoryCodeHooks.insertHook(this)) { return true; } - IInventory iinventory = this.getInventoryForHopperTransfer(); - - if (iinventory == null) -@@ -343,6 +344,7 @@ - - public static boolean captureDroppedItems(IHopper p_145891_0_) - { -+ if (net.minecraftforge.items.VanillaInventoryCodeHooks.extractHook(p_145891_0_)) { return true; } - IInventory iinventory = getHopperInventory(p_145891_0_); - - if (iinventory != null) -@@ -492,17 +494,31 @@ - - if (itemstack == null) - { -+ //Forge: BUGFIX: Again, make things respect max stack sizes. -+ int max = Math.min(stack.getMaxStackSize(), inventoryIn.getInventoryStackLimit()); -+ if (max >= stack.stackSize) -+ { - inventoryIn.setInventorySlotContents(index, stack); - stack = null; -+ } -+ else -+ { -+ inventoryIn.setInventorySlotContents(index, stack.splitStack(max)); -+ } - flag = true; - } - else if (canCombine(itemstack, stack)) - { -- int i = stack.getMaxStackSize() - itemstack.stackSize; -+ //Forge: BUGFIX: Again, make things respect max stack sizes. -+ int max = Math.min(stack.getMaxStackSize(), inventoryIn.getInventoryStackLimit()); -+ if (max > itemstack.stackSize) -+ { -+ int i = max - itemstack.stackSize; - int j = Math.min(stack.stackSize, i); - stack.stackSize -= j; - itemstack.stackSize += j; - flag = j > 0; -+ } - } - - if (flag) -@@ -648,4 +664,10 @@ - this.inventory[i] = null; - } - } -+ -+ -+ protected net.minecraftforge.items.IItemHandler createUnSidedHandler() -+ { -+ return new net.minecraftforge.items.VanillaHopperItemHandler(this); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch deleted file mode 100644 index 1c12efd06f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityLockable.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityLockable.java -@@ -47,4 +47,25 @@ - { - return (ITextComponent)(this.hasCustomName() ? new TextComponentString(this.getName()) : new TextComponentTranslation(this.getName(), new Object[0])); - } -+ -+ private net.minecraftforge.items.IItemHandler itemHandler; -+ -+ protected net.minecraftforge.items.IItemHandler createUnSidedHandler() -+ { -+ return new net.minecraftforge.items.wrapper.InvWrapper(this); -+ } -+ -+ @Override -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) -+ return (T) (itemHandler == null ? (itemHandler = createUnSidedHandler()) : itemHandler); -+ return super.getCapability(capability, facing); -+ } -+ -+ @Override -+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch deleted file mode 100644 index b1c9e4aa44..0000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityNote.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityNote.java -@@ -29,7 +29,9 @@ - - public void changePitch() - { -+ byte old = note; - this.note = (byte)((this.note + 1) % 25); -+ if (!net.minecraftforge.common.ForgeHooks.onNoteChange(this, old)) return; - this.markDirty(); - } - diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch deleted file mode 100644 index d571436407..0000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityPiston.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityPiston.java -@@ -201,7 +201,8 @@ - if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) - { - this.worldObj.setBlockState(this.pos, this.pistonState, 3); -- this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); -+ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldObj, pos, worldObj.getBlockState(pos), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) -+ this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); - } - } - } -@@ -219,7 +220,8 @@ - if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) - { - this.worldObj.setBlockState(this.pos, this.pistonState, 3); -- this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); -+ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldObj, pos, worldObj.getBlockState(pos), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) -+ this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); - } - } - else diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch deleted file mode 100644 index 4c4f169df7..0000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntitySign.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntitySign.java -@@ -60,7 +60,7 @@ - } - public boolean canCommandSenderUseCommand(int permLevel, String commandName) - { -- return true; -+ return permLevel <= 2; //Forge: Fixes MC-75630 - Exploit with signs and command blocks - } - public BlockPos getPosition() - { diff --git a/patches.mcp/minecraft/net/minecraft/util/ActionResult.java.patch b/patches.mcp/minecraft/net/minecraft/util/ActionResult.java.patch deleted file mode 100644 index 28c5a82cff..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/ActionResult.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/ActionResult.java -+++ ../src-work/minecraft/net/minecraft/util/ActionResult.java -@@ -20,4 +20,10 @@ - { - return this.field_188400_b; - } -+ -+ //Just a generic helper function to make typecasing easier... -+ public static ActionResult newResult(EnumActionResult result, T value) -+ { -+ return new ActionResult(result, value); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/util/BlockRenderLayer.java.patch b/patches.mcp/minecraft/net/minecraft/util/BlockRenderLayer.java.patch deleted file mode 100644 index 80055839ac..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/BlockRenderLayer.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/BlockRenderLayer.java -+++ ../src-work/minecraft/net/minecraft/util/BlockRenderLayer.java -@@ -1,9 +1,5 @@ - package net.minecraft.util; - --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; -- --@SideOnly(Side.CLIENT) - public enum BlockRenderLayer - { - SOLID("Solid"), diff --git a/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch b/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch deleted file mode 100644 index 2102e3cc95..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch +++ /dev/null @@ -1,67 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/EnumFacing.java -+++ ../src-work/minecraft/net/minecraft/util/EnumFacing.java -@@ -8,8 +8,6 @@ - import java.util.Random; - import net.minecraft.util.math.MathHelper; - import net.minecraft.util.math.Vec3i; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - - public enum EnumFacing implements IStringSerializable - { -@@ -62,7 +60,6 @@ - return getFront(this.opposite); - } - -- @SideOnly(Side.CLIENT) - public EnumFacing rotateAround(EnumFacing.Axis axis) - { - switch (axis) -@@ -113,7 +110,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - private EnumFacing rotateX() - { - switch (this) -@@ -133,7 +129,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - private EnumFacing rotateZ() - { - switch (this) -@@ -194,7 +189,6 @@ - return this.axis; - } - -- @SideOnly(Side.CLIENT) - public static EnumFacing byName(String name) - { - return name == null ? null : (EnumFacing)NAME_LOOKUP.get(name.toLowerCase()); -@@ -225,7 +219,6 @@ - return values()[rand.nextInt(values().length)]; - } - -- @SideOnly(Side.CLIENT) - public static EnumFacing getFacingFromVector(float p_176737_0_, float p_176737_1_, float p_176737_2_) - { - EnumFacing enumfacing = NORTH; -@@ -268,7 +261,6 @@ - throw new IllegalArgumentException("No such direction: " + p_181076_0_ + " " + p_181076_1_); - } - -- @SideOnly(Side.CLIENT) - public Vec3i getDirectionVec() - { - return this.directionVec; -@@ -304,7 +296,6 @@ - this.plane = plane; - } - -- @SideOnly(Side.CLIENT) - public static EnumFacing.Axis byName(String name) - { - return name == null ? null : (EnumFacing.Axis)NAME_LOOKUP.get(name.toLowerCase()); diff --git a/patches.mcp/minecraft/net/minecraft/util/IntIdentityHashBiMap.java.patch b/patches.mcp/minecraft/net/minecraft/util/IntIdentityHashBiMap.java.patch deleted file mode 100644 index 2b9932be97..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/IntIdentityHashBiMap.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/IntIdentityHashBiMap.java -+++ ../src-work/minecraft/net/minecraft/util/IntIdentityHashBiMap.java -@@ -166,7 +166,6 @@ - return Iterators.filter(Iterators.forArray(this.field_186820_d), Predicates.notNull()); - } - -- @SideOnly(Side.CLIENT) - public void func_186812_a() - { - Arrays.fill(this.field_186818_b, (Object)null); diff --git a/patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch b/patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch deleted file mode 100644 index 7c04c79199..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/MouseHelper.java -+++ ../src-work/minecraft/net/minecraft/util/MouseHelper.java -@@ -13,6 +13,7 @@ - - public void grabMouseCursor() - { -+ if (Boolean.parseBoolean(System.getProperty("fml.noGrab","false"))) return; - Mouse.setGrabbed(true); - this.deltaX = 0; - this.deltaY = 0; diff --git a/patches.mcp/minecraft/net/minecraft/util/Session.java.patch b/patches.mcp/minecraft/net/minecraft/util/Session.java.patch deleted file mode 100644 index cd6f37383f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/Session.java.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/Session.java -+++ ../src-work/minecraft/net/minecraft/util/Session.java -@@ -5,6 +5,8 @@ - import com.mojang.util.UUIDTypeAdapter; - import java.util.Map; - import java.util.UUID; -+ -+import net.minecraftforge.fml.common.FMLLog; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - -@@ -15,9 +17,24 @@ - private final String playerID; - private final String token; - private final Session.Type sessionType; -+ /** Forge: Cache of the local session's GameProfile properties. */ -+ private com.mojang.authlib.properties.PropertyMap properties; - - public Session(String usernameIn, String playerIDIn, String tokenIn, String sessionTypeIn) - { -+ if (usernameIn == null || usernameIn.isEmpty()) -+ { -+ usernameIn = "MissingName"; -+ playerIDIn = tokenIn = "NotValid"; -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "========================================================="); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "WARNING!! the username was not set for this session, typically"); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "this means you installed Forge incorrectly. We have set your"); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "name to \"MissingName\" and your session to nothing. Please"); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "check your installation and post a console log from the launcher"); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "when asking for help!"); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "========================================================="); -+ } -+ - this.username = usernameIn; - this.playerID = playerIDIn; - this.token = tokenIn; -@@ -49,14 +66,29 @@ - try - { - UUID uuid = UUIDTypeAdapter.fromString(this.getPlayerID()); -- return new GameProfile(uuid, this.getUsername()); -+ GameProfile ret = new GameProfile(uuid, this.getUsername()); //Forge: Adds cached GameProfile properties to returned GameProfile. -+ if (properties != null) ret.getProperties().putAll(properties); // Helps to cut down on calls to the session service, -+ return ret; // which helps to fix MC-52974. - } - catch (IllegalArgumentException var2) - { -- return new GameProfile((UUID)null, this.getUsername()); -+ return new GameProfile(net.minecraft.entity.player.EntityPlayer.getUUID(new GameProfile((UUID)null, this.getUsername())), this.getUsername()); - } - } - -+ /* ======================================== FORGE START ===================================== */ -+ //For internal use only. Modders should never need to use this. -+ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) -+ { -+ if(this.properties == null) this.properties = properties; -+ } -+ -+ public boolean hasCachedProperties() -+ { -+ return properties != null; -+ } -+ /* ========================================= FORGE END ====================================== */ -+ - @SideOnly(Side.CLIENT) - public static enum Type - { diff --git a/patches.mcp/minecraft/net/minecraft/util/TabCompleter.java.patch b/patches.mcp/minecraft/net/minecraft/util/TabCompleter.java.patch deleted file mode 100644 index 0d235578fc..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/TabCompleter.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/TabCompleter.java -+++ ../src-work/minecraft/net/minecraft/util/TabCompleter.java -@@ -53,13 +53,14 @@ - this.field_186844_a.deleteFromCursor(i - this.field_186844_a.getCursorPosition()); - } - -- this.field_186844_a.writeText((String)this.field_186849_f.get(this.field_186848_e++)); -+ this.field_186844_a.writeText(net.minecraft.util.text.TextFormatting.getTextWithoutFormattingCodes(this.field_186849_f.get(this.field_186848_e++))); - } - - private void func_186838_a(String p_186838_1_) - { - if (p_186838_1_.length() >= 1) - { -+ net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_186838_1_); - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new CPacketTabComplete(p_186838_1_, this.func_186839_b(), this.field_186845_b)); - this.field_186847_d = true; - } -@@ -74,6 +75,12 @@ - this.field_186846_c = false; - this.field_186849_f.clear(); - -+ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete; -+ if (complete != null) -+ { -+ p_186840_1_ = com.google.common.collect.ObjectArrays.concat(complete, p_186840_1_, String.class); -+ } -+ - for (String s : p_186840_1_) - { - if (!s.isEmpty()) -@@ -84,6 +91,7 @@ - - String s1 = this.field_186844_a.getText().substring(this.field_186844_a.func_146197_a(-1, this.field_186844_a.getCursorPosition(), false)); - String s2 = org.apache.commons.lang3.StringUtils.getCommonPrefix(p_186840_1_); -+ s2 = net.minecraft.util.text.TextFormatting.getTextWithoutFormattingCodes(s2); - - if (!s2.isEmpty() && !s1.equalsIgnoreCase(s2)) - { diff --git a/patches.mcp/minecraft/net/minecraft/util/math/BlockPos.java.patch b/patches.mcp/minecraft/net/minecraft/util/math/BlockPos.java.patch deleted file mode 100644 index 5c3362674b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/math/BlockPos.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/math/BlockPos.java -+++ ../src-work/minecraft/net/minecraft/util/math/BlockPos.java -@@ -270,6 +270,21 @@ - }; - } - -+ /** -+ * Returns a version of this BlockPos that is guaranteed to be Immutable. -+ * In most cases this will return 'this', but if 'this' is an instance of -+ * MutableBlockPos it will return a new instance of BlockPos with the same values. -+ * -+ * When storing a parameter given to you for an extended period of time, make sure you -+ * use this in case the value is changed internally. -+ * -+ * @return An immutable BlockPos. -+ */ -+ public BlockPos getImmutable() -+ { -+ return this; -+ } -+ - public static final class MutableBlockPos extends BlockPos - { - private int x; -@@ -333,6 +348,8 @@ - { - return new BlockPos(this); - } -+ -+ @Override public BlockPos getImmutable() { return new BlockPos(this); } - } - - public static final class PooledMutableBlockPos extends BlockPos -@@ -443,5 +460,7 @@ - { - return this.func_185343_d(this.field_185347_c + p_185341_1_.getFrontOffsetX(), this.field_185348_d + p_185341_1_.getFrontOffsetY(), this.field_185349_e + p_185341_1_.getFrontOffsetZ()); - } -+ -+ @Override public BlockPos getImmutable() { return new BlockPos(this); } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/util/math/RayTraceResult.java.patch b/patches.mcp/minecraft/net/minecraft/util/math/RayTraceResult.java.patch deleted file mode 100644 index 4f56eb74e0..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/math/RayTraceResult.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/math/RayTraceResult.java -+++ ../src-work/minecraft/net/minecraft/util/math/RayTraceResult.java -@@ -5,6 +5,12 @@ - - public class RayTraceResult - { -+ /** Used to determine what sub-segment is hit */ -+ public int subHit = -1; -+ -+ /** Used to add extra hit info */ -+ public Object hitInfo = null; -+ - private BlockPos blockPos; - public RayTraceResult.Type typeOfHit; - public EnumFacing sideHit; diff --git a/patches.mcp/minecraft/net/minecraft/util/math/Vec3d.java.patch b/patches.mcp/minecraft/net/minecraft/util/math/Vec3d.java.patch deleted file mode 100644 index 6f9856cfef..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/math/Vec3d.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/math/Vec3d.java -+++ ../src-work/minecraft/net/minecraft/util/math/Vec3d.java -@@ -1,8 +1,5 @@ - package net.minecraft.util.math; - --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; -- - public class Vec3d - { - public static final Vec3d field_186680_a = new Vec3d(0.0D, 0.0D, 0.0D); -@@ -53,7 +50,6 @@ - return this.xCoord * vec.xCoord + this.yCoord * vec.yCoord + this.zCoord * vec.zCoord; - } - -- @SideOnly(Side.CLIENT) - public Vec3d crossProduct(Vec3d vec) - { - return new Vec3d(this.yCoord * vec.zCoord - this.zCoord * vec.yCoord, this.zCoord * vec.xCoord - this.xCoord * vec.zCoord, this.xCoord * vec.yCoord - this.yCoord * vec.xCoord); diff --git a/patches.mcp/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java.patch b/patches.mcp/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java.patch deleted file mode 100644 index ad6c8d499f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java -+++ ../src-work/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java -@@ -57,4 +57,11 @@ - V v = super.func_186801_a(p_186801_1_); - return (V)(v == null ? this.defaultValue : v); - } -+ -+ //Bypass functions to allow querying this registry WITHOUT getting the defaulted value. -+ // MODDERS DO NOT USE THIS IS FOR FORGE INTERNAL CHECKS -+ public int getIDForObjectBypass(V bypass) { return super.getIDForObject(bypass); } -+ public K getNameForObjectBypass(V value) { return super.getNameForObject(value); } -+ public V getObjectBypass(K name) { return super.getObject(name); } -+ public V getObjectByIdBypass(int id){ return super.getObjectById(id); } - } diff --git a/patches.mcp/minecraft/net/minecraft/util/text/ITextComponent.java.patch b/patches.mcp/minecraft/net/minecraft/util/text/ITextComponent.java.patch deleted file mode 100644 index d5497dbbcd..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/text/ITextComponent.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/text/ITextComponent.java -+++ ../src-work/minecraft/net/minecraft/util/text/ITextComponent.java -@@ -33,7 +33,6 @@ - - String getUnformattedText(); - -- @SideOnly(Side.CLIENT) - String getFormattedText(); - - List getSiblings(); diff --git a/patches.mcp/minecraft/net/minecraft/util/text/Style.java.patch b/patches.mcp/minecraft/net/minecraft/util/text/Style.java.patch deleted file mode 100644 index 8a3317bdc6..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/text/Style.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/text/Style.java -+++ ../src-work/minecraft/net/minecraft/util/text/Style.java -@@ -229,7 +229,6 @@ - return this; - } - -- @SideOnly(Side.CLIENT) - public String getFormattingCode() - { - if (this.isEmpty()) diff --git a/patches.mcp/minecraft/net/minecraft/util/text/TextComponentBase.java.patch b/patches.mcp/minecraft/net/minecraft/util/text/TextComponentBase.java.patch deleted file mode 100644 index e2a95ad34e..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/text/TextComponentBase.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/text/TextComponentBase.java -+++ ../src-work/minecraft/net/minecraft/util/text/TextComponentBase.java -@@ -74,7 +74,6 @@ - return stringbuilder.toString(); - } - -- @SideOnly(Side.CLIENT) - public final String getFormattedText() - { - StringBuilder stringbuilder = new StringBuilder(); diff --git a/patches.mcp/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch b/patches.mcp/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch deleted file mode 100644 index 332e5a6edb..0000000000 --- a/patches.mcp/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/text/translation/LanguageMap.java -+++ ../src-work/minecraft/net/minecraft/util/text/translation/LanguageMap.java -@@ -23,9 +23,29 @@ - - public LanguageMap() - { -+ InputStream inputstream = LanguageMap.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); -+ inject(this, inputstream); -+ } -+ -+ public static void inject(InputStream inputstream) -+ { -+ inject(instance, inputstream); -+ } -+ -+ private static void inject(LanguageMap inst, InputStream inputstream) -+ { -+ Map map = parseLangFile(inputstream); -+ inst.languageList.putAll(map); -+ inst.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); -+ } -+ -+ public static Map parseLangFile(InputStream inputstream) -+ { -+ Map table = Maps.newHashMap(); - try - { -- InputStream inputstream = LanguageMap.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); -+ inputstream = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(table, inputstream); -+ if (inputstream == null) return table; - - for (String s : IOUtils.readLines(inputstream, Charsets.UTF_8)) - { -@@ -37,17 +57,18 @@ - { - String s1 = astring[0]; - String s2 = numericVariablePattern.matcher(astring[1]).replaceAll("%$1s"); -- this.languageList.put(s1, s2); -+ table.put(s1, s2); - } - } - } - -- this.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); - } - catch (IOException var7) - { - ; - } -+ catch (Exception ex) {} -+ return table; - } - - static LanguageMap getInstance() diff --git a/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch deleted file mode 100644 index 014ea8af2b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/ChunkCache.java -+++ ../src-work/minecraft/net/minecraft/world/ChunkCache.java -@@ -61,6 +61,8 @@ - { - int i = (pos.getX() >> 4) - this.chunkX; - int j = (pos.getZ() >> 4) - this.chunkZ; -+ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return null; -+ if (chunkArray[i][j] == null) return null; - return this.chunkArray[i][j].getTileEntity(pos, Chunk.EnumCreateEntityType.IMMEDIATE); - } - -@@ -139,6 +141,8 @@ - { - int i = (pos.getX() >> 4) - this.chunkX; - int j = (pos.getZ() >> 4) - this.chunkZ; -+ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return p_175629_1_.defaultLightValue; -+ if (chunkArray[i][j] == null) return p_175629_1_.defaultLightValue; - return this.chunkArray[i][j].getLightFor(p_175629_1_, pos); - } - } -@@ -150,7 +154,8 @@ - - public boolean isAirBlock(BlockPos pos) - { -- return this.getBlockState(pos).func_185904_a() == Material.air; -+ IBlockState state = this.getBlockState(pos); -+ return state.getBlock().isAir(state, this, pos); - } - - @SideOnly(Side.CLIENT) -@@ -160,6 +165,7 @@ - { - int i = (pos.getX() >> 4) - this.chunkX; - int j = (pos.getZ() >> 4) - this.chunkZ; -+ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return p_175628_1_.defaultLightValue; - return this.chunkArray[i][j].getLightFor(p_175628_1_, pos); - } - else -@@ -178,4 +184,17 @@ - { - return this.worldObj.getWorldType(); - } -+ -+ @Override -+ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) -+ { -+ int x = (pos.getX() >> 4) - this.chunkX; -+ int z = (pos.getZ() >> 4) - this.chunkZ; -+ if (pos.getY() >= 0 && pos.getY() < 256) return _default; -+ if (x < 0 || x >= chunkArray.length || z < 0 || z >= chunkArray[x].length) return _default; -+ if (chunkArray[x][z] == null) return _default; -+ -+ IBlockState state = getBlockState(pos); -+ return state.getBlock().isSideSolid(state, this, pos, side); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch b/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch deleted file mode 100644 index 75563e98a0..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/Explosion.java -+++ ../src-work/minecraft/net/minecraft/world/Explosion.java -@@ -40,6 +40,7 @@ - private final float explosionSize; - private final List affectedBlockPositions; - private final Map playerKnockbackMap; -+ private final Vec3d position; - - @SideOnly(Side.CLIENT) - public Explosion(World worldIn, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) -@@ -67,6 +68,7 @@ - this.explosionZ = p_i45754_7_; - this.isFlaming = p_i45754_10_; - this.isSmoking = p_i45754_11_; -+ this.position = new Vec3d(explosionX, explosionY, explosionZ); - } - - public void doExplosionA() -@@ -101,7 +103,7 @@ - - if (iblockstate.func_185904_a() != Material.air) - { -- float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance((Entity)null); -+ float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance(worldObj, blockpos, (Entity)null, this); - f -= (f2 + 0.3F) * 0.3F; - } - -@@ -128,6 +130,7 @@ - int j2 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D); - int j1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D); - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); -+ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3); - Vec3d vec3d = new Vec3d(this.explosionX, this.explosionY, this.explosionZ); - - for (int k2 = 0; k2 < list.size(); ++k2) -@@ -227,8 +230,7 @@ - block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos), 1.0F / this.explosionSize, 0); - } - -- this.worldObj.setBlockState(blockpos, Blocks.air.getDefaultState(), 3); -- block.onBlockDestroyedByExplosion(this.worldObj, blockpos, this); -+ block.onBlockExploded(this.worldObj, blockpos, this); - } - } - } -@@ -264,4 +266,6 @@ - { - return this.affectedBlockPositions; - } -+ -+ public Vec3d getPosition(){ return this.position; } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch b/patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch deleted file mode 100644 index 7fb64f305a..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/IBlockAccess.java -+++ ../src-work/minecraft/net/minecraft/world/IBlockAccess.java -@@ -29,4 +29,14 @@ - - @SideOnly(Side.CLIENT) - WorldType getWorldType(); -+ -+ /** -+ * FORGE: isSideSolid, pulled up from {@link World} -+ * -+ * @param pos Position -+ * @param side Side -+ * @param _default default return value -+ * @return if the block is solid on the side -+ */ -+ boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/World.java.patch b/patches.mcp/minecraft/net/minecraft/world/World.java.patch deleted file mode 100644 index b06145937f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/World.java.patch +++ /dev/null @@ -1,882 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/World.java -+++ ../src-work/minecraft/net/minecraft/world/World.java -@@ -60,6 +60,13 @@ - - public abstract class World implements IBlockAccess - { -+ /** -+ * Used in the getEntitiesWithinAABB functions to expand the search area for entities. -+ * Modders should change this variable to a higher value if it is less then the radius -+ * of one of there entities. -+ */ -+ public static double MAX_ENTITY_RADIUS = 2.0D; -+ - private int seaLevel = 63; - protected boolean scheduledUpdatesAreImmediate; - public final List loadedEntityList = Lists.newArrayList(); -@@ -101,6 +108,10 @@ - private final WorldBorder worldBorder; - int[] lightUpdateBlockList; - -+ public boolean restoringBlockSnapshots = false; -+ public boolean captureBlockSnapshots = false; -+ public java.util.ArrayList capturedBlockSnapshots = new java.util.ArrayList(); -+ - protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) - { - this.worldAccesses = Lists.newArrayList(new IWorldEventListener[] {this.field_184152_t}); -@@ -115,6 +126,7 @@ - this.provider = providerIn; - this.isRemote = client; - this.worldBorder = providerIn.getWorldBorder(); -+ perWorldStorage = new MapStorage((ISaveHandler)null); - } - - public World init() -@@ -124,6 +136,11 @@ - - public BiomeGenBase getBiomeGenForCoords(final BlockPos pos) - { -+ return this.provider.getBiomeGenForCoords(pos); -+ } -+ -+ public BiomeGenBase getBiomeGenForCoordsBody(final BlockPos pos) -+ { - if (this.isBlockLoaded(pos)) - { - Chunk chunk = this.getChunkFromBlockCoords(pos); -@@ -194,7 +211,7 @@ - - public boolean isAirBlock(BlockPos pos) - { -- return this.getBlockState(pos).func_185904_a() == Material.air; -+ return this.getBlockState(pos).getBlock().isAir(this.getBlockState(pos), this, pos); - } - - public boolean isBlockLoaded(BlockPos pos) -@@ -291,23 +308,49 @@ - { - Chunk chunk = this.getChunkFromBlockCoords(pos); - Block block = newState.getBlock(); -+ -+ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; -+ if (this.captureBlockSnapshots && !this.isRemote) -+ { -+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, pos, flags); -+ this.capturedBlockSnapshots.add(blockSnapshot); -+ } -+ IBlockState oldState = getBlockState(pos); -+ int oldLight = oldState.getLightValue(this, pos); -+ int oldOpacity = oldState.getLightOpacity(this, pos); -+ - IBlockState iblockstate = chunk.setBlockState(pos, newState); - - if (iblockstate == null) - { -+ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); - return false; - } - else - { -- if (newState.func_185891_c() != iblockstate.func_185891_c() || newState.func_185906_d() != iblockstate.func_185906_d()) -+ if (newState.getLightOpacity(this, pos) != oldOpacity || newState.getLightValue(this, pos) != oldLight) - { - this.theProfiler.startSection("checkLight"); - this.checkLight(pos); - this.theProfiler.endSection(); - } - -- if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && chunk.isPopulated()) -+ if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates - { -+ this.markAndNotifyBlock(pos, chunk, iblockstate, newState, flags); -+ } -+ return true; -+ } -+ } -+ } -+ -+ // Split off from original setBlockState(BlockPos, IBlockState, int) method in order to directly send client and physic updates -+ public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState iblockstate, IBlockState newState, int flags) -+ { -+ { -+ { -+ if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && (chunk == null || chunk.isPopulated())) -+ { - this.func_184138_a(pos, iblockstate, newState, flags); - } - -@@ -317,11 +360,9 @@ - - if (newState.func_185912_n()) - { -- this.updateComparatorOutputLevel(pos, block); -+ this.updateComparatorOutputLevel(pos, newState.getBlock()); - } - } -- -- return true; - } - } - } -@@ -336,7 +377,7 @@ - IBlockState iblockstate = this.getBlockState(pos); - Block block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() == Material.air) -+ if (block.isAir(iblockstate, this, pos)) - { - return false; - } -@@ -409,6 +450,9 @@ - - public void notifyNeighborsOfStateChange(BlockPos pos, Block blockType) - { -+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), java.util.EnumSet.allOf(EnumFacing.class)).isCanceled()) -+ return; -+ - this.notifyBlockOfStateChange(pos.west(), blockType); - this.notifyBlockOfStateChange(pos.east(), blockType); - this.notifyBlockOfStateChange(pos.down(), blockType); -@@ -419,6 +463,11 @@ - - public void notifyNeighborsOfStateExcept(BlockPos pos, Block blockType, EnumFacing skipSide) - { -+ java.util.EnumSet directions = java.util.EnumSet.allOf(EnumFacing.class); -+ directions.remove(skipSide); -+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), directions).isCanceled()) -+ return; -+ - if (skipSide != EnumFacing.WEST) - { - this.notifyBlockOfStateChange(pos.west(), blockType); -@@ -514,7 +563,7 @@ - { - IBlockState iblockstate = this.getBlockState(blockpos); - -- if (iblockstate.func_185891_c() > 0 && !iblockstate.func_185904_a().isLiquid()) -+ if (iblockstate.getBlock().getLightOpacity(iblockstate, this, blockpos) > 0 && !iblockstate.func_185904_a().isLiquid()) - { - return false; - } -@@ -782,7 +831,7 @@ - - public boolean isDaytime() - { -- return this.skylightSubtracted < 4; -+ return this.provider.isDaytime(); - } - - public RayTraceResult rayTraceBlocks(Vec3d p_72933_1_, Vec3d p_72933_2_) -@@ -982,6 +1031,13 @@ - - public void func_184148_a(EntityPlayer p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) - { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_10_, p_184148_11_); -+ if (event.isCanceled() || event.getSound() == null) return; -+ p_184148_8_ = event.getSound(); -+ p_184148_9_ = event.getCategory(); -+ p_184148_10_ = event.getVolume(); -+ p_184148_11_ = event.getPitch(); -+ - for (int i = 0; i < this.worldAccesses.size(); ++i) - { - ((IWorldEventListener)this.worldAccesses.get(i)).func_184375_a(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_, p_184148_11_); -@@ -1027,6 +1083,9 @@ - - public boolean spawnEntityInWorld(Entity entityIn) - { -+ // do not drop any items while restoring blocksnapshots. Prevents dupes -+ if (!this.isRemote && (entityIn == null || (entityIn instanceof net.minecraft.entity.item.EntityItem && this.restoringBlockSnapshots))) return false; -+ - int i = MathHelper.floor_double(entityIn.posX / 16.0D); - int j = MathHelper.floor_double(entityIn.posZ / 16.0D); - boolean flag = entityIn.forceSpawn; -@@ -1049,6 +1108,8 @@ - this.updateAllPlayersSleepingFlag(); - } - -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entityIn, this)) && !flag) return false; -+ - this.getChunkFromChunkCoords(i, j).addEntity(entityIn); - this.loadedEntityList.add(entityIn); - this.onEntityAdded(entityIn); -@@ -1285,7 +1346,6 @@ - return list; - } - -- @SideOnly(Side.CLIENT) - public void removeWorldAccess(IWorldEventListener worldAccess) - { - this.worldAccesses.remove(worldAccess); -@@ -1348,19 +1408,38 @@ - - public int calculateSkylightSubtracted(float p_72967_1_) - { -+ float f = provider.getSunBrightnessFactor(p_72967_1_); -+ f = 1 - f; -+ return (int)(f * 11); -+ } -+ -+ /** -+ * The current sun brightness factor for this dimension. -+ * 0.0f means no light at all, and 1.0f means maximum sunlight. -+ * Highly recommended for sunlight detection like solar panel. -+ * -+ * @return The current brightness factor -+ * */ -+ public float getSunBrightnessFactor(float p_72967_1_) -+ { - float f = this.getCelestialAngle(p_72967_1_); - float f1 = 1.0F - (MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F); - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); - f1 = 1.0F - f1; - f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength(p_72967_1_) * 5.0F) / 16.0D)); - f1 = (float)((double)f1 * (1.0D - (double)(this.getThunderStrength(p_72967_1_) * 5.0F) / 16.0D)); -- f1 = 1.0F - f1; -- return (int)(f1 * 11.0F); -+ return f1; - } - - @SideOnly(Side.CLIENT) - public float getSunBrightness(float p_72971_1_) - { -+ return this.provider.getSunBrightness(p_72971_1_); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public float getSunBrightnessBody(float p_72971_1_) -+ { - float f = this.getCelestialAngle(p_72971_1_); - float f1 = 1.0F - (MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.2F); - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1373,6 +1452,12 @@ - @SideOnly(Side.CLIENT) - public Vec3d getSkyColor(Entity entityIn, float partialTicks) - { -+ return this.provider.getSkyColor(entityIn, partialTicks); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public Vec3d getSkyColorBody(Entity entityIn, float partialTicks) -+ { - float f = this.getCelestialAngle(partialTicks); - float f1 = MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F; - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1380,9 +1465,7 @@ - int j = MathHelper.floor_double(entityIn.posY); - int k = MathHelper.floor_double(entityIn.posZ); - BlockPos blockpos = new BlockPos(i, j, k); -- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(blockpos); -- float f2 = biomegenbase.getFloatTemperature(blockpos); -- int l = biomegenbase.getSkyColorByTemp(f2); -+ int l = net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(this, blockpos); - float f3 = (float)(l >> 16 & 255) / 255.0F; - float f4 = (float)(l >> 8 & 255) / 255.0F; - float f5 = (float)(l & 255) / 255.0F; -@@ -1442,6 +1525,11 @@ - - public float getCurrentMoonPhaseFactor() - { -+ return provider.getCurrentMoonPhaseFactor(); -+ } -+ -+ public float getCurrentMoonPhaseFactorBody() -+ { - return WorldProvider.moonPhaseFactors[this.provider.getMoonPhase(this.worldInfo.getWorldTime())]; - } - -@@ -1454,6 +1542,12 @@ - @SideOnly(Side.CLIENT) - public Vec3d getCloudColour(float partialTicks) - { -+ return this.provider.getCloudColor(partialTicks); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public Vec3d getCloudColorBody(float partialTicks) -+ { - float f = this.getCelestialAngle(partialTicks); - float f1 = MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F; - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1509,9 +1603,9 @@ - for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1) - { - blockpos1 = blockpos.down(); -- Material material = chunk.getBlockState(blockpos1).func_185904_a(); -+ IBlockState state = chunk.getBlockState(blockpos1); - -- if (material.blocksMovement() && material != Material.leaves) -+ if (state.func_185904_a().blocksMovement() && !state.getBlock().isLeaves(state, this, blockpos1) && !state.getBlock().isFoliage(this, blockpos1)) - { - break; - } -@@ -1523,6 +1617,12 @@ - @SideOnly(Side.CLIENT) - public float getStarBrightness(float partialTicks) - { -+ return this.provider.getStarBrightness(partialTicks); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public float getStarBrightnessBody(float partialTicks) -+ { - float f = this.getCelestialAngle(partialTicks); - float f1 = 1.0F - (MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.25F); - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1574,6 +1674,12 @@ - entity.addEntityCrashInfo(crashreportcategory); - } - -+ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe(crashreport.getCompleteReport()); -+ removeEntity(entity); -+ } -+ else - throw new ReportedException(crashreport); - } - -@@ -1635,6 +1741,12 @@ - CrashReport crashreport1 = CrashReport.makeCrashReport(throwable1, "Ticking entity"); - CrashReportCategory crashreportcategory1 = crashreport1.makeCategory("Entity being ticked"); - entity2.addEntityCrashInfo(crashreportcategory1); -+ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe(crashreport1.getCompleteReport()); -+ removeEntity(entity2); -+ } -+ else - throw new ReportedException(crashreport1); - } - } -@@ -1684,6 +1796,13 @@ - CrashReport crashreport2 = CrashReport.makeCrashReport(throwable, "Ticking block entity"); - CrashReportCategory crashreportcategory2 = crashreport2.makeCategory("Block entity being ticked"); - tileentity.addInfoToCrashReport(crashreportcategory2); -+ if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe(crashreport2.getCompleteReport()); -+ tileentity.invalidate(); -+ this.removeTileEntity(tileentity.getPos()); -+ } -+ else - throw new ReportedException(crashreport2); - } - } -@@ -1701,15 +1820,20 @@ - } - } - -- this.processingLoadedTiles = false; -- - if (!this.tileEntitiesToBeRemoved.isEmpty()) - { -+ for (Object tile : tileEntitiesToBeRemoved) -+ { -+ ((TileEntity)tile).onChunkUnload(); -+ } -+ - this.tickableTileEntities.removeAll(this.tileEntitiesToBeRemoved); - this.loadedTileEntityList.removeAll(this.tileEntitiesToBeRemoved); - this.tileEntitiesToBeRemoved.clear(); - } - -+ this.processingLoadedTiles = false; //FML Move below remove to prevent CMEs -+ - this.theProfiler.endStartSection("pendingBlockEntities"); - - if (!this.addedTileEntityList.isEmpty()) -@@ -1748,7 +1872,8 @@ - - public boolean addTileEntity(TileEntity tile) - { -- boolean flag = this.loadedTileEntityList.add(tile); -+ List dest = processingLoadedTiles ? addedTileEntityList : loadedTileEntityList; -+ boolean flag = dest.add(tile); - - if (flag && tile instanceof ITickable) - { -@@ -1782,9 +1907,13 @@ - { - int i = MathHelper.floor_double(entityIn.posX); - int j = MathHelper.floor_double(entityIn.posZ); -- int k = 32; -+ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(i >> 4, j >> 4)); -+ int k = isForced ? 0 : 32; -+ boolean canUpdate = !forceUpdate || this.isAreaLoaded(i - k, 0, j - k, i + k, 0, j + k, true); - -- if (!forceUpdate || this.isAreaLoaded(i - k, 0, j - k, i + k, 0, j + k, true)) -+ if (!canUpdate) canUpdate = net.minecraftforge.event.ForgeEventFactory.canEntityUpdate(entityIn); -+ -+ if (canUpdate) - { - entityIn.lastTickPosX = entityIn.posX; - entityIn.lastTickPosY = entityIn.posY; -@@ -1913,7 +2042,7 @@ - { - IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos.func_185343_d(k1, l1, i2)); - -- if (iblockstate.func_185904_a() != Material.air) -+ if (iblockstate.getBlock().isAir(iblockstate, this, new BlockPos(k1, l1, i2))) - { - blockpos$pooledmutableblockpos.func_185344_t(); - return true; -@@ -1983,6 +2112,10 @@ - blockpos$pooledmutableblockpos.func_185344_t(); - return true; - } -+ else if (block.isBurning(this, new BlockPos(k1, l1, i2))) -+ { -+ return true; -+ } - } - } - } -@@ -2022,6 +2155,16 @@ - IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos); - Block block = iblockstate.getBlock(); - -+ Boolean result = block.isEntityInsideMaterial(this, blockpos$pooledmutableblockpos, iblockstate, entityIn, (double)l, materialIn, false); -+ if (result != null && result == true) -+ { -+ // Forge: When requested call blocks modifyAcceleration method, and more importantly cause this method to return true, which results in an entity being "inWater" -+ flag = true; -+ vec3d = block.modifyAcceleration(this, blockpos$pooledmutableblockpos, entityIn, vec3d); -+ continue; -+ } -+ else if (result != null && result == false) continue; -+ - if (iblockstate.func_185904_a() == materialIn) - { - double d0 = (double)((float)(l1 + 1) - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue())); -@@ -2098,6 +2241,9 @@ - { - IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos.func_185343_d(k1, l1, i2)); - -+ Boolean result = iblockstate.getBlock().isAABBInsideMaterial(this, blockpos$pooledmutableblockpos, bb, materialIn); -+ if (result != null) return result; -+ - if (iblockstate.func_185904_a() == materialIn) - { - int j2 = ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue(); -@@ -2130,6 +2276,7 @@ - public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) - { - Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking); -+ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; - explosion.doExplosionA(); - explosion.doExplosionB(true); - return explosion; -@@ -2276,19 +2423,27 @@ - else - { - this.addTileEntity(tileEntityIn); -- this.getChunkFromBlockCoords(pos).addTileEntity(pos, tileEntityIn); -+ Chunk chunk = this.getChunkFromBlockCoords(pos); //Forge add NPE protection -+ if (chunk != null) chunk.addTileEntity(pos, tileEntityIn); - } -+ this.updateComparatorOutputLevel(pos, getBlockState(pos).getBlock()); //Notify neighbors of changes - } - } - - public void removeTileEntity(BlockPos pos) - { -+ //Chunk chunk = this.getChunkFromBlockCoords(pos); -+ //if (chunk != null) chunk.removeTileEntity(pos); -+ //Forge ToDO: Are these patches needed anymore? -+ - TileEntity tileentity = this.getTileEntity(pos); - - if (tileentity != null && this.processingLoadedTiles) - { - tileentity.invalidate(); - this.addedTileEntityList.remove(tileentity); -+ if (!(tileentity instanceof ITickable)) //Forge: If they are not tickable they wont be removed in the update loop. -+ this.loadedTileEntityList.remove(tileentity); - } - else - { -@@ -2301,6 +2456,7 @@ - - this.getChunkFromBlockCoords(pos).removeTileEntity(pos); - } -+ this.updateComparatorOutputLevel(pos, getBlockState(pos).getBlock()); //Notify neighbors of changes - } - - public void markTileEntityForRemoval(TileEntity tileEntityIn) -@@ -2327,7 +2483,7 @@ - if (chunk != null && !chunk.isEmpty()) - { - IBlockState iblockstate = this.getBlockState(pos); -- return iblockstate.func_185904_a().isOpaque() && iblockstate.func_185917_h(); -+ return iblockstate.getBlock().isNormalCube(iblockstate, this, pos); - } - else - { -@@ -2350,6 +2506,7 @@ - { - this.spawnHostileMobs = hostile; - this.spawnPeacefulMobs = peaceful; -+ this.provider.setAllowedSpawnTypes(hostile, peaceful); - } - - public void tick() -@@ -2359,6 +2516,11 @@ - - protected void calculateInitialWeather() - { -+ this.provider.calculateInitialWeather(); -+ } -+ -+ public void calculateInitialWeatherBody() -+ { - if (this.worldInfo.isRaining()) - { - this.rainingStrength = 1.0F; -@@ -2372,6 +2534,11 @@ - - protected void updateWeather() - { -+ this.provider.updateWeather(); -+ } -+ -+ public void updateWeatherBody() -+ { - if (!this.provider.getHasNoSky()) - { - if (!this.isRemote) -@@ -2491,6 +2658,11 @@ - - public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj) - { -+ return this.provider.canBlockFreeze(pos, noWaterAdj); -+ } -+ -+ public boolean canBlockFreezeBody(BlockPos pos, boolean noWaterAdj) -+ { - BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); - float f = biomegenbase.getFloatTemperature(pos); - -@@ -2532,6 +2704,11 @@ - - public boolean canSnowAt(BlockPos pos, boolean checkLight) - { -+ return this.provider.canSnowAt(pos, checkLight); -+ } -+ -+ public boolean canSnowAtBody(BlockPos pos, boolean checkLight) -+ { - BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); - float f = biomegenbase.getFloatTemperature(pos); - -@@ -2549,7 +2726,7 @@ - { - IBlockState iblockstate = this.getBlockState(pos); - -- if (iblockstate.func_185904_a() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos)) -+ if (iblockstate.getBlock().isAir(iblockstate, this, pos) && Blocks.snow_layer.canPlaceBlockAt(this, pos)) - { - return true; - } -@@ -2581,10 +2758,11 @@ - else - { - IBlockState iblockstate = this.getBlockState(pos); -- int i = lightType == EnumSkyBlock.SKY ? 0 : iblockstate.func_185906_d(); -- int j = iblockstate.func_185891_c(); -+ int blockLight = iblockstate.getBlock().getLightValue(iblockstate, this, pos); -+ int i = lightType == EnumSkyBlock.SKY ? 0 : blockLight; -+ int j = iblockstate.getBlock().getLightOpacity(iblockstate, this, pos); - -- if (j >= 15 && iblockstate.func_185906_d() > 0) -+ if (j >= 15 && blockLight > 0) - { - j = 1; - } -@@ -2683,7 +2861,7 @@ - int j4 = j2 + enumfacing.getFrontOffsetY(); - int k4 = k2 + enumfacing.getFrontOffsetZ(); - blockpos$pooledmutableblockpos.func_185343_d(i4, j4, k4); -- int l4 = Math.max(1, this.getBlockState(blockpos$pooledmutableblockpos).func_185891_c()); -+ int l4 = Math.max(1, this.getBlockState(blockpos$pooledmutableblockpos).getBlock().getLightOpacity(this.getBlockState(blockpos$pooledmutableblockpos), this, blockpos$pooledmutableblockpos)); - i3 = this.getLightFor(lightType, blockpos$pooledmutableblockpos); - - if (i3 == l2 - l4 && j < this.lightUpdateBlockList.length) -@@ -2789,10 +2967,10 @@ - public List getEntitiesInAABBexcluding(Entity entityIn, AxisAlignedBB boundingBox, Predicate predicate) - { - List list = Lists.newArrayList(); -- int i = MathHelper.floor_double((boundingBox.minX - 2.0D) / 16.0D); -- int j = MathHelper.floor_double((boundingBox.maxX + 2.0D) / 16.0D); -- int k = MathHelper.floor_double((boundingBox.minZ - 2.0D) / 16.0D); -- int l = MathHelper.floor_double((boundingBox.maxZ + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((boundingBox.minX - MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.floor_double((boundingBox.maxX + MAX_ENTITY_RADIUS) / 16.0D); -+ int k = MathHelper.floor_double((boundingBox.minZ - MAX_ENTITY_RADIUS) / 16.0D); -+ int l = MathHelper.floor_double((boundingBox.maxZ + MAX_ENTITY_RADIUS) / 16.0D); - - for (int i1 = i; i1 <= j; ++i1) - { -@@ -2845,10 +3023,10 @@ - - public List getEntitiesWithinAABB(Class clazz, AxisAlignedBB aabb, Predicate filter) - { -- int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D); -- int j = MathHelper.ceiling_double_int((aabb.maxX + 2.0D) / 16.0D); -- int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D); -- int l = MathHelper.ceiling_double_int((aabb.maxZ + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((aabb.minX - MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.ceiling_double_int((aabb.maxX + MAX_ENTITY_RADIUS) / 16.0D); -+ int k = MathHelper.floor_double((aabb.minZ - MAX_ENTITY_RADIUS) / 16.0D); -+ int l = MathHelper.ceiling_double_int((aabb.maxZ + MAX_ENTITY_RADIUS) / 16.0D); - List list = Lists.newArrayList(); - - for (int i1 = i; i1 < j; ++i1) -@@ -2926,11 +3104,13 @@ - - public void loadEntities(Collection entityCollection) - { -- this.loadedEntityList.addAll(entityCollection); -- - for (Entity entity : entityCollection) - { -- this.onEntityAdded(entity); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entity, this))) -+ { -+ loadedEntityList.add(entity); -+ this.onEntityAdded(entity); -+ } - } - } - -@@ -2943,7 +3123,7 @@ - { - IBlockState iblockstate = this.getBlockState(pos); - AxisAlignedBB axisalignedbb = p_175716_3_ ? null : blockIn.getDefaultState().func_185890_d(this, pos); -- return axisalignedbb != Block.field_185506_k && !this.checkNoEntityCollision(axisalignedbb.func_186670_a(pos), entityIn) ? false : (iblockstate.func_185904_a() == Material.circuits && blockIn == Blocks.anvil ? true : iblockstate.func_185904_a().isReplaceable() && blockIn.canReplace(this, pos, side, itemStackIn)); -+ return axisalignedbb != Block.field_185506_k && !this.checkNoEntityCollision(axisalignedbb.func_186670_a(pos), entityIn) ? false : (iblockstate.func_185904_a() == Material.circuits && blockIn == Blocks.anvil ? true : iblockstate.getBlock().isReplaceable(this, pos) && blockIn.canReplace(this, pos, side, itemStackIn)); - } - - public int getSeaLevel() -@@ -3026,7 +3206,7 @@ - public int getRedstonePower(BlockPos pos, EnumFacing facing) - { - IBlockState iblockstate = this.getBlockState(pos); -- return iblockstate.func_185915_l() ? this.getStrongPower(pos) : iblockstate.func_185911_a(this, pos, facing); -+ return iblockstate.getBlock().shouldCheckWeakPower(iblockstate, this, pos, facing) ? this.getStrongPower(pos) : iblockstate.func_185911_a(this, pos, facing); - } - - public boolean isBlockPowered(BlockPos pos) -@@ -3215,7 +3395,7 @@ - - public long getSeed() - { -- return this.worldInfo.getSeed(); -+ return this.provider.getSeed(); - } - - public long getTotalWorldTime() -@@ -3225,17 +3405,17 @@ - - public long getWorldTime() - { -- return this.worldInfo.getWorldTime(); -+ return this.provider.getWorldTime(); - } - - public void setWorldTime(long time) - { -- this.worldInfo.setWorldTime(time); -+ this.provider.setWorldTime(time); - } - - public BlockPos getSpawnPoint() - { -- BlockPos blockpos = new BlockPos(this.worldInfo.getSpawnX(), this.worldInfo.getSpawnY(), this.worldInfo.getSpawnZ()); -+ BlockPos blockpos = this.provider.getSpawnPoint(); - - if (!this.getWorldBorder().contains(blockpos)) - { -@@ -3247,7 +3427,7 @@ - - public void setSpawnPoint(BlockPos pos) - { -- this.worldInfo.setSpawn(pos); -+ this.provider.setSpawnPoint(pos); - } - - @SideOnly(Side.CLIENT) -@@ -3267,12 +3447,18 @@ - - if (!this.loadedEntityList.contains(entityIn)) - { -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entityIn, this))) - this.loadedEntityList.add(entityIn); - } - } - - public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) - { -+ return this.provider.canMineBlock(player, pos); -+ } -+ -+ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) -+ { - return true; - } - -@@ -3366,8 +3552,7 @@ - - public boolean isBlockinHighHumidity(BlockPos pos) - { -- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); -- return biomegenbase.isHighHumidity(); -+ return this.provider.isBlockHighHumidity(pos); - } - - public MapStorage getMapStorage() -@@ -3426,12 +3611,12 @@ - - public int getHeight() - { -- return 256; -+ return this.provider.getHeight(); - } - - public int getActualHeight() - { -- return this.provider.getHasNoSky() ? 128 : 256; -+ return this.provider.getActualHeight(); - } - - public Random setRandomSeed(int p_72843_1_, int p_72843_2_, int p_72843_3_) -@@ -3481,7 +3666,7 @@ - @SideOnly(Side.CLIENT) - public double getHorizon() - { -- return this.worldInfo.getTerrainType() == WorldType.FLAT ? 0.0D : 63.0D; -+ return provider.getHorizon(); - } - - public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) -@@ -3515,7 +3700,7 @@ - - public void updateComparatorOutputLevel(BlockPos pos, Block blockIn) - { -- for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) -+ for (EnumFacing enumfacing : EnumFacing.VALUES) - { - BlockPos blockpos = pos.offset(enumfacing); - -@@ -3523,18 +3708,14 @@ - { - IBlockState iblockstate = this.getBlockState(blockpos); - -- if (Blocks.unpowered_comparator.func_185547_C(iblockstate)) -+ iblockstate.getBlock().onNeighborChange(this, blockpos, pos); -+ if (iblockstate.getBlock().isNormalCube(iblockstate, this, blockpos)) - { -- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); -- } -- else if (iblockstate.func_185915_l()) -- { - blockpos = blockpos.offset(enumfacing); - iblockstate = this.getBlockState(blockpos); -- -- if (Blocks.unpowered_comparator.func_185547_C(iblockstate)) -+ if (iblockstate.getBlock().getWeakChanges(this, blockpos)) - { -- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); -+ iblockstate.getBlock().onNeighborChange(this, blockpos, pos); - } - } - } -@@ -3600,6 +3781,87 @@ - return i >= -k && i <= k && j >= -k && j <= k; - } - -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * Determine if the given block is considered solid on the -+ * specified side. Used by placement logic. -+ * -+ * @param pos Block Position -+ * @param side The Side in question -+ * @return True if the side is solid -+ */ -+ public boolean isSideSolid(BlockPos pos, EnumFacing side) -+ { -+ return isSideSolid(pos, side, false); -+ } -+ -+ /** -+ * Determine if the given block is considered solid on the -+ * specified side. Used by placement logic. -+ * -+ * @param pos Block Position -+ * @param side The Side in question -+ * @param _default The default to return if the block doesn't exist. -+ * @return True if the side is solid -+ */ -+ @Override -+ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) -+ { -+ if (!this.isValid(pos)) return _default; -+ -+ Chunk chunk = getChunkFromBlockCoords(pos); -+ if (chunk == null || chunk.isEmpty()) return _default; -+ return getBlockState(pos).isSideSolid(this, pos, side); -+ } -+ -+ /** -+ * Get the persistent chunks for this world -+ * -+ * @return -+ */ -+ public com.google.common.collect.ImmutableSetMultimap getPersistentChunks() -+ { -+ return net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this); -+ } -+ -+ public Iterator getPersistentChunkIterable(Iterator chunkIterator) -+ { -+ return net.minecraftforge.common.ForgeChunkManager.getPersistentChunksIterableFor(this, chunkIterator); -+ } -+ /** -+ * Readded as it was removed, very useful helper function -+ * -+ * @param pos Block position -+ * @return The blocks light opacity -+ */ -+ public int getBlockLightOpacity(BlockPos pos) -+ { -+ if (!this.isValid(pos)) return 0; -+ return getChunkFromBlockCoords(pos).getBlockLightOpacity(pos); -+ } -+ -+ /** -+ * Returns a count of entities that classify themselves as the specified creature type. -+ */ -+ public int countEntities(net.minecraft.entity.EnumCreatureType type, boolean forSpawnCount) -+ { -+ int count = 0; -+ for (int x = 0; x < loadedEntityList.size(); x++) -+ { -+ if (((Entity)loadedEntityList.get(x)).isCreatureType(type, forSpawnCount)) -+ { -+ count++; -+ } -+ } -+ return count; -+ } -+ -+ protected MapStorage perWorldStorage; //Moved to a getter to simulate final without being final so we can load in subclasses. -+ public MapStorage getPerWorldStorage() -+ { -+ return perWorldStorage; -+ } -+ - public void func_184135_a(Packet p_184135_1_) - { - throw new UnsupportedOperationException("Can\'t send packets to server unless you\'re on the client."); diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch deleted file mode 100644 index 4e7af74168..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldEntitySpawner.java -+++ ../src-work/minecraft/net/minecraft/world/WorldEntitySpawner.java -@@ -77,15 +77,17 @@ - { - if ((!enumcreaturetype.getPeacefulCreature() || spawnPeacefulMobs) && (enumcreaturetype.getPeacefulCreature() || spawnHostileMobs) && (!enumcreaturetype.getAnimal() || p_77192_4_)) - { -- int k4 = worldServerIn.countEntities(enumcreaturetype.getCreatureClass()); -+ int k4 = worldServerIn.countEntities(enumcreaturetype, true); - int l4 = enumcreaturetype.getMaxNumberOfCreature() * i / MOB_COUNT_DIV; - - if (k4 <= l4) - { -+ java.util.ArrayList shuffled = com.google.common.collect.Lists.newArrayList(this.eligibleChunksForSpawning); -+ java.util.Collections.shuffle(shuffled); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); - label415: - -- for (ChunkCoordIntPair chunkcoordintpair1 : this.eligibleChunksForSpawning) -+ for (ChunkCoordIntPair chunkcoordintpair1 : shuffled) - { - BlockPos blockpos = getRandomChunkPosition(worldServerIn, chunkcoordintpair1.chunkXPos, chunkcoordintpair1.chunkZPos); - int k1 = blockpos.getX(); -@@ -144,8 +146,10 @@ - - entityliving.setLocationAndAngles((double)f, (double)i3, (double)f1, worldServerIn.rand.nextFloat() * 360.0F, 0.0F); - -- if (entityliving.getCanSpawnHere() && entityliving.isNotColliding()) -+ net.minecraftforge.fml.common.eventhandler.Event.Result canSpawn = net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(entityliving, worldServerIn, f, i3, f1); -+ if (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT && (entityliving.getCanSpawnHere() && entityliving.isNotColliding()))) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, worldServerIn, f, l3, f1)) - ientitylivingdata = entityliving.onInitialSpawn(worldServerIn.getDifficultyForLocation(new BlockPos(entityliving)), ientitylivingdata); - - if (entityliving.isNotColliding()) -@@ -158,7 +162,7 @@ - entityliving.setDead(); - } - -- if (j2 >= entityliving.getMaxSpawnedInChunk()) -+ if (i2 >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(entityliving)) - { - continue label415; - } -@@ -211,8 +215,9 @@ - else - { - BlockPos blockpos = pos.down(); -+ IBlockState state = worldIn.getBlockState(blockpos); - -- if (!worldIn.getBlockState(blockpos).func_185896_q()) -+ if (!state.getBlock().canCreatureSpawn(state, worldIn, blockpos, spawnPlacementTypeIn)) - { - return false; - } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch deleted file mode 100644 index e30b710874..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch +++ /dev/null @@ -1,384 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldProvider.java -+++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java -@@ -52,26 +52,12 @@ - - protected void registerWorldChunkManager() - { -- WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType(); -- -- if (worldtype == WorldType.FLAT) -- { -- FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions()); -- this.worldChunkMgr = new BiomeProviderSingle(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), Biomes.field_180279_ad)); -- } -- else if (worldtype == WorldType.DEBUG_WORLD) -- { -- this.worldChunkMgr = new BiomeProviderSingle(Biomes.plains); -- } -- else -- { -- this.worldChunkMgr = new BiomeProvider(this.worldObj.getWorldInfo()); -- } -+ this.worldChunkMgr = terrainType.getBiomeProvider(worldObj); - } - - public IChunkGenerator func_186060_c() - { -- return (IChunkGenerator)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderOverworld(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderOverworld(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings)))); -+ return terrainType.getChunkGenerator(worldObj, generatorSettings); - } - - public boolean canCoordinateBeSpawn(int x, int z) -@@ -156,7 +142,7 @@ - @SideOnly(Side.CLIENT) - public float getCloudHeight() - { -- return 128.0F; -+ return this.terrainType.getCloudHeight(); - } - - @SideOnly(Side.CLIENT) -@@ -172,13 +158,13 @@ - - public int getAverageGroundLevel() - { -- return this.terrainType == WorldType.FLAT ? 4 : this.worldObj.getSeaLevel() + 1; -+ return this.terrainType.getMinimumSpawnHeight(this.worldObj); - } - - @SideOnly(Side.CLIENT) - public double getVoidFogYFactor() - { -- return this.terrainType == WorldType.FLAT ? 1.0D : 0.03125D; -+ return this.terrainType.voidFadeMagnitude(); - } - - @SideOnly(Side.CLIENT) -@@ -212,6 +198,327 @@ - return new WorldBorder(); - } - -+ /*======================================= Forge Start =========================================*/ -+ private net.minecraftforge.client.IRenderHandler skyRenderer = null; -+ private net.minecraftforge.client.IRenderHandler cloudRenderer = null; -+ private net.minecraftforge.client.IRenderHandler weatherRenderer = null; -+ private int dimensionId; -+ -+ /** -+ * Sets the providers current dimension ID, used in default getSaveFolder() -+ * Added to allow default providers to be registered for multiple dimensions. -+ * This is to denote the exact dimension ID opposed to the 'type' in WorldType -+ * -+ * @param dim Dimension ID -+ */ -+ public void setDimension(int dim) -+ { -+ this.dimensionId = dim; -+ } -+ public int getDimension() -+ { -+ return this.dimensionId; -+ } -+ -+ /** -+ * Returns the sub-folder of the world folder that this WorldProvider saves to. -+ * EXA: DIM1, DIM-1 -+ * @return The sub-folder name to save this world's chunks to. -+ */ -+ public String getSaveFolder() -+ { -+ return (dimensionId == 0 ? null : "DIM" + dimensionId); -+ } -+ -+ /** -+ * A message to display to the user when they transfer to this dimension. -+ * -+ * @return The message to be displayed -+ */ -+ public String getWelcomeMessage() -+ { -+ if (this instanceof WorldProviderEnd) -+ { -+ return "Entering the End"; -+ } -+ else if (this instanceof WorldProviderHell) -+ { -+ return "Entering the Nether"; -+ } -+ return null; -+ } -+ -+ /** -+ * A Message to display to the user when they transfer out of this dismension. -+ * -+ * @return The message to be displayed -+ */ -+ public String getDepartMessage() -+ { -+ if (this instanceof WorldProviderEnd) -+ { -+ return "Leaving the End"; -+ } -+ else if (this instanceof WorldProviderHell) -+ { -+ return "Leaving the Nether"; -+ } -+ return null; -+ } -+ -+ /** -+ * The dimensions movement factor. Relative to normal overworld. -+ * It is applied to the players position when they transfer dimensions. -+ * Exa: Nether movement is 8.0 -+ * @return The movement factor -+ */ -+ public double getMovementFactor() -+ { -+ if (this instanceof WorldProviderHell) -+ { -+ return 8.0; -+ } -+ return 1.0; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public net.minecraftforge.client.IRenderHandler getSkyRenderer() -+ { -+ return this.skyRenderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public void setSkyRenderer(net.minecraftforge.client.IRenderHandler skyRenderer) -+ { -+ this.skyRenderer = skyRenderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public net.minecraftforge.client.IRenderHandler getCloudRenderer() -+ { -+ return cloudRenderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public void setCloudRenderer(net.minecraftforge.client.IRenderHandler renderer) -+ { -+ cloudRenderer = renderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public net.minecraftforge.client.IRenderHandler getWeatherRenderer() -+ { -+ return weatherRenderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public void setWeatherRenderer(net.minecraftforge.client.IRenderHandler renderer) -+ { -+ weatherRenderer = renderer; -+ } -+ -+ public BlockPos getRandomizedSpawnPoint() -+ { -+ BlockPos ret = this.worldObj.getSpawnPoint(); -+ -+ boolean isAdventure = worldObj.getWorldInfo().getGameType() == WorldSettings.GameType.ADVENTURE; -+ int spawnFuzz = this.worldObj instanceof WorldServer ? terrainType.getSpawnFuzz((WorldServer)this.worldObj, this.worldObj.getMinecraftServer()) : 1; -+ int border = MathHelper.floor_double(worldObj.getWorldBorder().getClosestDistance(ret.getX(), ret.getZ())); -+ if (border < spawnFuzz) spawnFuzz = border; -+ if (spawnFuzz < 1) spawnFuzz = 1; -+ int spawnFuzzHalf = spawnFuzz / 2; -+ -+ if (!getHasNoSky() && !isAdventure) -+ { -+ ret = worldObj.getTopSolidOrLiquidBlock(ret.add(worldObj.rand.nextInt(spawnFuzzHalf) - spawnFuzz, 0, worldObj.rand.nextInt(spawnFuzzHalf) - spawnFuzz)); -+ } -+ -+ return ret; -+ } -+ /** -+ * Determine if the cursor on the map should 'spin' when rendered, like it does for the player in the nether. -+ * -+ * @param entity The entity holding the map, playername, or frame-ENTITYID -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position -+ * @return True to 'spin' the cursor -+ */ -+ public boolean shouldMapSpin(String entity, double x, double y, double z) -+ { -+ return dimensionId < 0; -+ } -+ -+ /** -+ * Determines the dimension the player will be respawned in, typically this brings them back to the overworld. -+ * -+ * @param player The player that is respawning -+ * @return The dimension to respawn the player in -+ */ -+ public int getRespawnDimension(net.minecraft.entity.player.EntityPlayerMP player) -+ { -+ return 0; -+ } -+ -+ /*======================================= Start Moved From World =========================================*/ -+ -+ public BiomeGenBase getBiomeGenForCoords(BlockPos pos) -+ { -+ return worldObj.getBiomeGenForCoordsBody(pos); -+ } -+ -+ public boolean isDaytime() -+ { -+ return worldObj.getSkylightSubtracted() < 4; -+ } -+ -+ /** -+ * The current sun brightness factor for this dimension. -+ * 0.0f means no light at all, and 1.0f means maximum sunlight. -+ * This will be used for the "calculateSkylightSubtracted" -+ * which is for Sky light value calculation. -+ * -+ * @return The current brightness factor -+ * */ -+ public float getSunBrightnessFactor(float par1) -+ { -+ return worldObj.getSunBrightnessFactor(par1); -+ } -+ -+ /** -+ * Calculates the current moon phase factor. -+ * This factor is effective for slimes. -+ * (This method do not affect the moon rendering) -+ * */ -+ public float getCurrentMoonPhaseFactor() -+ { -+ return worldObj.getCurrentMoonPhaseFactorBody(); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public Vec3d getSkyColor(net.minecraft.entity.Entity cameraEntity, float partialTicks) -+ { -+ return worldObj.getSkyColorBody(cameraEntity, partialTicks); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public Vec3d getCloudColor(float partialTicks) -+ { -+ return worldObj.getCloudColorBody(partialTicks); -+ } -+ -+ /** -+ * Gets the Sun Brightness for rendering sky. -+ * */ -+ @SideOnly(Side.CLIENT) -+ public float getSunBrightness(float par1) -+ { -+ return worldObj.getSunBrightnessBody(par1); -+ } -+ -+ /** -+ * Gets the Star Brightness for rendering sky. -+ * */ -+ @SideOnly(Side.CLIENT) -+ public float getStarBrightness(float par1) -+ { -+ return worldObj.getStarBrightnessBody(par1); -+ } -+ -+ public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) -+ { -+ worldObj.spawnHostileMobs = allowHostile; -+ worldObj.spawnPeacefulMobs = allowPeaceful; -+ } -+ -+ public void calculateInitialWeather() -+ { -+ worldObj.calculateInitialWeatherBody(); -+ } -+ -+ public void updateWeather() -+ { -+ worldObj.updateWeatherBody(); -+ } -+ -+ public boolean canBlockFreeze(BlockPos pos, boolean byWater) -+ { -+ return worldObj.canBlockFreezeBody(pos, byWater); -+ } -+ -+ public boolean canSnowAt(BlockPos pos, boolean checkLight) -+ { -+ return worldObj.canSnowAtBody(pos, checkLight); -+ } -+ public void setWorldTime(long time) -+ { -+ worldObj.worldInfo.setWorldTime(time); -+ } -+ -+ public long getSeed() -+ { -+ return worldObj.worldInfo.getSeed(); -+ } -+ -+ public long getWorldTime() -+ { -+ return worldObj.worldInfo.getWorldTime(); -+ } -+ -+ public BlockPos getSpawnPoint() -+ { -+ net.minecraft.world.storage.WorldInfo info = worldObj.worldInfo; -+ return new BlockPos(info.getSpawnX(), info.getSpawnY(), info.getSpawnZ()); -+ } -+ -+ public void setSpawnPoint(BlockPos pos) -+ { -+ worldObj.worldInfo.setSpawn(pos); -+ } -+ -+ public boolean canMineBlock(net.minecraft.entity.player.EntityPlayer player, BlockPos pos) -+ { -+ return worldObj.canMineBlockBody(player, pos); -+ } -+ -+ public boolean isBlockHighHumidity(BlockPos pos) -+ { -+ return worldObj.getBiomeGenForCoords(pos).isHighHumidity(); -+ } -+ -+ public int getHeight() -+ { -+ return 256; -+ } -+ -+ public int getActualHeight() -+ { -+ return hasNoSky ? 128 : 256; -+ } -+ -+ public double getHorizon() -+ { -+ return worldObj.worldInfo.getTerrainType().getHorizon(worldObj); -+ } -+ -+ public void resetRainAndThunder() -+ { -+ worldObj.worldInfo.setRainTime(0); -+ worldObj.worldInfo.setRaining(false); -+ worldObj.worldInfo.setThunderTime(0); -+ worldObj.worldInfo.setThundering(false); -+ } -+ -+ public boolean canDoLightning(net.minecraft.world.chunk.Chunk chunk) -+ { -+ return true; -+ } -+ -+ public boolean canDoRainSnowIce(net.minecraft.world.chunk.Chunk chunk) -+ { -+ return true; -+ } -+ - public void func_186061_a(EntityPlayerMP p_186061_1_) - { - } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldProviderSurface.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldProviderSurface.java.patch deleted file mode 100644 index d9aeb58c8b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/WorldProviderSurface.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldProviderSurface.java -+++ ../src-work/minecraft/net/minecraft/world/WorldProviderSurface.java -@@ -9,6 +9,6 @@ - - public boolean func_186056_c(int p_186056_1_, int p_186056_2_) - { -- return !this.worldObj.isSpawnChunk(p_186056_1_, p_186056_2_); -+ return !this.worldObj.isSpawnChunk(p_186056_1_, p_186056_2_) || !net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimension()); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch deleted file mode 100644 index 3c4eda1149..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch +++ /dev/null @@ -1,258 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldServer.java -+++ ../src-work/minecraft/net/minecraft/world/WorldServer.java -@@ -97,30 +97,39 @@ - private int blockEventCacheIndex; - private List pendingTickListEntriesThisTick = Lists.newArrayList(); - -+ /** Stores the recently processed (lighting) chunks */ -+ protected Set doneChunks = new java.util.HashSet(); -+ public List customTeleporters = new ArrayList(); -+ - public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) - { - super(saveHandlerIn, info, DimensionType.func_186069_a(dimensionId).func_186070_d(), profilerIn, false); - this.mcServer = server; - this.theEntityTracker = new EntityTracker(this); - this.thePlayerManager = new PlayerManager(this); -+ // Guarantee the dimension ID was not reset by the provider -+ int providerDim = this.provider.getDimension(); - this.provider.registerWorld(this); -+ this.provider.setDimension(providerDim); - this.chunkProvider = this.createChunkProvider(); -+ perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn)); - this.worldTeleporter = new Teleporter(this); - this.calculateInitialSkylight(); - this.calculateInitialWeather(); - this.getWorldBorder().setSize(server.getMaxWorldSize()); -+ net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this, mcServer); - } - - public World init() - { - this.mapStorage = new MapStorage(this.saveHandler); - String s = VillageCollection.fileNameForProvider(this.provider); -- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); -+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); - - if (villagecollection == null) - { - this.villageCollectionObj = new VillageCollection(this); -- this.mapStorage.setData(s, this.villageCollectionObj); -+ this.perWorldStorage.setData(s, this.villageCollectionObj); - } - else - { -@@ -214,6 +223,10 @@ - this.villageSiege.tick(); - this.theProfiler.endStartSection("portalForcer"); - this.worldTeleporter.removeStalePortalLocations(this.getTotalWorldTime()); -+ for (Teleporter tele : customTeleporters) -+ { -+ tele.removeStalePortalLocations(getTotalWorldTime()); -+ } - this.theProfiler.endSection(); - this.sendQueuedBlockEvents(); - } -@@ -221,12 +234,14 @@ - public BiomeGenBase.SpawnListEntry getSpawnListEntryForTypeAt(EnumCreatureType creatureType, BlockPos pos) - { - List list = this.getChunkProvider().getPossibleCreatures(creatureType, pos); -+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, creatureType, pos, list); - return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.getRandomItem(this.rand, list) : null; - } - - public boolean canCreatureTypeSpawnHere(EnumCreatureType creatureType, BiomeGenBase.SpawnListEntry spawnListEntry, BlockPos pos) - { - List list = this.getChunkProvider().getPossibleCreatures(creatureType, pos); -+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, creatureType, pos, list); - return list != null && !list.isEmpty() ? list.contains(spawnListEntry) : false; - } - -@@ -272,10 +287,7 @@ - - private void resetRainAndThunder() - { -- this.worldInfo.setRainTime(0); -- this.worldInfo.setRaining(false); -- this.worldInfo.setThunderTime(0); -- this.worldInfo.setThundering(false); -+ this.provider.resetRainAndThunder(); - } - - public boolean areAllPlayersAsleep() -@@ -368,7 +380,7 @@ - boolean flag1 = this.isThundering(); - this.theProfiler.startSection("pollingChunks"); - -- for (Iterator iterator = this.thePlayerManager.func_187300_b(); iterator.hasNext(); this.theProfiler.endSection()) -+ for (Iterator iterator = getPersistentChunkIterable(this.thePlayerManager.func_187300_b()); iterator.hasNext(); this.theProfiler.endSection()) - { - this.theProfiler.startSection("getChunk"); - Chunk chunk = (Chunk)iterator.next(); -@@ -380,7 +392,7 @@ - chunk.func_150804_b(false); - this.theProfiler.endStartSection("thunder"); - -- if (flag && flag1 && this.rand.nextInt(100000) == 0) -+ if (this.provider.canDoLightning(chunk) && flag && flag1 && this.rand.nextInt(100000) == 0) - { - this.updateLCG = this.updateLCG * 3 + 1013904223; - int l = this.updateLCG >> 2; -@@ -409,7 +421,7 @@ - - this.theProfiler.endStartSection("iceandsnow"); - -- if (this.rand.nextInt(16) == 0) -+ if (this.provider.canDoRainSnowIce(chunk) && this.rand.nextInt(16) == 0) - { - this.updateLCG = this.updateLCG * 3 + 1013904223; - int j2 = this.updateLCG >> 2; -@@ -527,6 +539,9 @@ - if (blockIn.requiresUpdates()) - { - i = 8; -+ //Keeping here as a note for future when it may be restored. -+ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(pos.getX() >> 4, pos.getZ() >> 4)); -+ i = isForced ? 0 : 8; - - if (this.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i))) - { -@@ -588,7 +603,7 @@ - - public void updateEntities() - { -- if (this.playerEntities.isEmpty()) -+ if (this.playerEntities.isEmpty() && getPersistentChunks().isEmpty()) - { - if (this.updateEntityTick++ >= 300) - { -@@ -712,6 +727,9 @@ - { - NextTickListEntry nextticklistentry1 = (NextTickListEntry)iterator.next(); - iterator.remove(); -+ //Keeping here as a note for future when it may be restored. -+ //boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.xCoord >> 4, nextticklistentry.zCoord >> 4)); -+ //byte b0 = isForced ? 0 : 8; - int k = 0; - - if (this.isAreaLoaded(nextticklistentry1.position.add(-k, -k, -k), nextticklistentry1.position.add(k, k, k))) -@@ -838,22 +856,40 @@ - { - List list = Lists.newArrayList(); - -- for (int i = 0; i < this.loadedTileEntityList.size(); ++i) -+ //Forge: Optimize this loop to only grab from the chunks it needs -+ for (int x = (minX & ~0x0F); x < maxX; x += 16) - { -- TileEntity tileentity = (TileEntity)this.loadedTileEntityList.get(i); -- BlockPos blockpos = tileentity.getPos(); -- -- if (blockpos.getX() >= minX && blockpos.getY() >= minY && blockpos.getZ() >= minZ && blockpos.getX() < maxX && blockpos.getY() < maxY && blockpos.getZ() < maxZ) -+ for (int z = (minZ & ~0x0F); z < maxZ; z += 16) // & ~0xF Floors it by 16. Yay bitmath! - { -- list.add(tileentity); -+ if (!this.isChunkLoaded(x >> 4, z >> 4, true)) continue; //Prevent loading extra chunks to just read data. This causes orphaned chunks that never unload. -+ Chunk chunk = this.getChunkFromChunkCoords(x >> 4, z >> 4); -+ if (chunk != null && !chunk.isEmpty()) -+ { -+ for (TileEntity entity : chunk.getTileEntityMap().values()) -+ { -+ if (!entity.isInvalid()) -+ { -+ BlockPos pos = entity.getPos(); -+ if (pos.getX() >= minX && pos.getY() >= minY && pos.getZ() >= minZ && -+ pos.getX() < maxX && pos.getY() < maxY && pos.getZ() < maxZ) -+ { -+ list.add(entity); -+ } -+ -+ } -+ } -+ } - } - } -- - return list; - } - - public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) - { -+ return super.isBlockModifiable(player, pos); -+ } -+ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) -+ { - return !this.mcServer.isBlockProtected(this, pos, player) && this.getWorldBorder().contains(pos); - } - -@@ -919,6 +955,7 @@ - } - else - { -+ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; - this.findingSpawnPoint = true; - BiomeProvider biomeprovider = this.provider.getWorldChunkManager(); - List list = biomeprovider.getBiomesToSpawnIn(); -@@ -1003,6 +1040,7 @@ - } - - chunkproviderserver.func_186027_a(p_73044_1_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); - - for (Chunk chunk : Lists.newArrayList(chunkproviderserver.func_152380_a())) - { -@@ -1047,6 +1085,7 @@ - this.worldInfo.setBorderLerpTime(this.getWorldBorder().getTimeUntilTarget()); - this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.func_184103_al().getHostPlayerData()); - this.mapStorage.saveAllData(); -+ this.perWorldStorage.saveAllData(); - } - - public boolean spawnEntityInWorld(Entity entityIn) -@@ -1161,6 +1200,7 @@ - public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) - { - Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking); -+ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; - explosion.doExplosionA(); - explosion.doExplosionB(false); - -@@ -1240,19 +1280,23 @@ - this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(8, this.thunderingStrength), this.provider.func_186058_p().func_186068_a()); - } - -+ /* The function in use here has been replaced in order to only send the weather info to players in the correct dimension, -+ * rather than to all players on the server. This is what causes the client-side rain, as the -+ * client believes that it has started raining locally, rather than in another dimension. -+ */ - if (flag != this.isRaining()) - { - if (flag) - { -- this.mcServer.func_184103_al().sendPacketToAllPlayers(new SPacketChangeGameState(2, 0.0F)); -+ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(2, 0.0F), this.provider.getDimension()); - } - else - { -- this.mcServer.func_184103_al().sendPacketToAllPlayers(new SPacketChangeGameState(1, 0.0F)); -+ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(1, 0.0F), this.provider.getDimension()); - } - -- this.mcServer.func_184103_al().sendPacketToAllPlayers(new SPacketChangeGameState(7, this.rainingStrength)); -- this.mcServer.func_184103_al().sendPacketToAllPlayers(new SPacketChangeGameState(8, this.thunderingStrength)); -+ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(7, this.rainingStrength), this.provider.getDimension()); -+ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimension()); - } - } - -@@ -1329,6 +1373,11 @@ - return this.mcServer.isCallingFromMinecraftThread(); - } - -+ public java.io.File getChunkSaveLocation() -+ { -+ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)getChunkProvider().chunkLoader).chunkSaveLocation; -+ } -+ - static class ServerBlockEventList extends ArrayList - { - private ServerBlockEventList() diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch deleted file mode 100644 index e99624d765..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldServerMulti.java -+++ ../src-work/minecraft/net/minecraft/world/WorldServerMulti.java -@@ -11,12 +11,13 @@ - public class WorldServerMulti extends WorldServer - { - private WorldServer delegate; -+ private IBorderListener borderListener; - - public WorldServerMulti(MinecraftServer server, ISaveHandler saveHandlerIn, int dimensionId, WorldServer delegate, Profiler profilerIn) - { - super(server, saveHandlerIn, new DerivedWorldInfo(delegate.getWorldInfo()), dimensionId, profilerIn); - this.delegate = delegate; -- delegate.getWorldBorder().addListener(new IBorderListener() -+ this.borderListener = new IBorderListener() - { - public void onSizeChanged(WorldBorder border, double newSize) - { -@@ -46,11 +47,13 @@ - { - WorldServerMulti.this.getWorldBorder().setDamageBuffer(newSize); - } -- }); -+ }; -+ this.delegate.getWorldBorder().addListener(this.borderListener); - } - - protected void saveLevel() throws MinecraftException - { -+ this.perWorldStorage.saveAllData(); - } - - public World init() -@@ -59,12 +62,12 @@ - this.worldScoreboard = this.delegate.getScoreboard(); - this.field_184151_B = this.delegate.func_184146_ak(); - String s = VillageCollection.fileNameForProvider(this.provider); -- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); -+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); - - if (villagecollection == null) - { - this.villageCollectionObj = new VillageCollection(this); -- this.mapStorage.setData(s, this.villageCollectionObj); -+ this.perWorldStorage.setData(s, this.villageCollectionObj); - } - else - { -@@ -75,6 +78,14 @@ - return this; - } - -+ -+ @Override -+ public void flush() -+ { -+ super.flush(); -+ this.delegate.getWorldBorder().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak. -+ } -+ - public void func_184166_c() - { - this.provider.func_186057_q(); diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch deleted file mode 100644 index a727426d40..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch +++ /dev/null @@ -1,166 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldType.java -+++ ../src-work/minecraft/net/minecraft/world/WorldType.java -@@ -1,5 +1,9 @@ - package net.minecraft.world; - -+import net.minecraft.world.chunk.IChunkGenerator; -+import net.minecraft.world.gen.ChunkProviderDebug; -+import net.minecraft.world.gen.ChunkProviderFlat; -+import net.minecraft.world.gen.ChunkProviderOverworld; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - -@@ -27,6 +31,7 @@ - - private WorldType(int id, String name, int version) - { -+ if (name.length() > 16 && DEBUG_WORLD != null) throw new IllegalArgumentException("World type names must not be longer then 16: " + name); - this.worldType = name; - this.generatorVersion = version; - this.canBeCreated = true; -@@ -113,4 +118,145 @@ - this.hasNotificationData = true; - return this; - } -+ -+ public net.minecraft.world.biome.BiomeProvider getBiomeProvider(World world) -+ { -+ if (this == FLAT) -+ { -+ net.minecraft.world.gen.FlatGeneratorInfo flatgeneratorinfo = net.minecraft.world.gen.FlatGeneratorInfo.createFlatGeneratorFromString(world.getWorldInfo().getGeneratorOptions()); -+ return new net.minecraft.world.biome.BiomeProviderSingle(net.minecraft.world.biome.BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), net.minecraft.init.Biomes.field_180279_ad)); -+ } -+ else if (this == DEBUG_WORLD) -+ { -+ return new net.minecraft.world.biome.BiomeProviderSingle(net.minecraft.init.Biomes.plains); -+ } -+ else -+ { -+ return new net.minecraft.world.biome.BiomeProvider(world.getWorldInfo()); -+ } -+ } -+ -+ public net.minecraft.world.chunk.IChunkGenerator getChunkGenerator(World world, String generatorOptions) -+ { -+ if (this == FLAT) return new net.minecraft.world.gen.ChunkProviderFlat(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); -+ if (this == DEBUG_WORLD) return new net.minecraft.world.gen.ChunkProviderDebug(world); -+ if (this == CUSTOMIZED) return new net.minecraft.world.gen.ChunkProviderOverworld(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); -+ return new net.minecraft.world.gen.ChunkProviderOverworld(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); -+ } -+ -+ public int getMinimumSpawnHeight(World world) -+ { -+ return this == FLAT ? 4 : 64; -+ } -+ -+ public double getHorizon(World world) -+ { -+ return this == FLAT ? 0.0D : 63.0D; -+ } -+ -+ public double voidFadeMagnitude() -+ { -+ return this == FLAT ? 1.0D : 0.03125D; -+ } -+ -+ public boolean handleSlimeSpawnReduction(java.util.Random random, World world) -+ { -+ return this == FLAT ? random.nextInt(4) != 1 : false; -+ } -+ -+ /*=================================================== FORGE START ======================================*/ -+ private static int getNextID() -+ { -+ for (int x = 0; x < worldTypes.length; x++) -+ { -+ if (worldTypes[x] == null) -+ { -+ return x; -+ } -+ } -+ -+ int oldLen = worldTypes.length; -+ worldTypes = java.util.Arrays.copyOf(worldTypes, oldLen + 16); -+ return oldLen; -+ } -+ -+ /** -+ * Creates a new world type, the ID is hidden and should not be referenced by modders. -+ * It will automatically expand the underlying workdType array if there are no IDs left. -+ * @param name -+ */ -+ public WorldType(String name) -+ { -+ this(getNextID(), name); -+ } -+ -+ /** -+ * Called when 'Create New World' button is pressed before starting game -+ */ -+ public void onGUICreateWorldPress() { } -+ -+ /** -+ * Gets the spawn fuzz for players who join the world. -+ * Useful for void world types. -+ * @return Fuzz for entity initial spawn in blocks. -+ */ -+ public int getSpawnFuzz(WorldServer world, net.minecraft.server.MinecraftServer server) -+ { -+ return Math.max(0, server.func_184108_a(world)); -+ } -+ -+ /** -+ * Called when the 'Customize' button is pressed on world creation GUI -+ * @param mc The Minecraft instance -+ * @param guiCreateWorld the createworld GUI -+ */ -+ @SideOnly(Side.CLIENT) -+ public void onCustomizeButton(net.minecraft.client.Minecraft mc, net.minecraft.client.gui.GuiCreateWorld guiCreateWorld) -+ { -+ if (this == WorldType.FLAT) -+ { -+ mc.displayGuiScreen(new net.minecraft.client.gui.GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.chunkProviderSettingsJson)); -+ } -+ else if (this == WorldType.CUSTOMIZED) -+ { -+ mc.displayGuiScreen(new net.minecraft.client.gui.GuiCustomizeWorldScreen(guiCreateWorld, guiCreateWorld.chunkProviderSettingsJson)); -+ } -+ } -+ -+ /** -+ * Should world creation GUI show 'Customize' button for this world type? -+ * @return if this world type has customization parameters -+ */ -+ public boolean isCustomizable() -+ { -+ return this == FLAT || this == WorldType.CUSTOMIZED; -+ } -+ -+ -+ /** -+ * Get the height to render the clouds for this world type -+ * @return The height to render clouds at -+ */ -+ public float getCloudHeight() -+ { -+ return 128.0F; -+ } -+ -+ /** -+ * Creates the GenLayerBiome used for generating the world with the specified ChunkProviderSettings JSON String -+ * *IF AND ONLY IF* this WorldType == WorldType.CUSTOMIZED. -+ * -+ * -+ * @param worldSeed The world seed -+ * @param parentLayer The parent layer to feed into any layer you return -+ * @param chunkProviderSettingsJson The JSON string to use when initializing ChunkProviderSettings.Factory -+ * @return A GenLayer that will return ints representing the Biomes to be generated, see GenLayerBiome -+ */ -+ public net.minecraft.world.gen.layer.GenLayer getBiomeLayer(long worldSeed, net.minecraft.world.gen.layer.GenLayer parentLayer, String chunkProviderSettingsJson) -+ { -+ net.minecraft.world.gen.layer.GenLayer ret = new net.minecraft.world.gen.layer.GenLayerBiome(200L, parentLayer, this, chunkProviderSettingsJson); -+ ret = net.minecraft.world.gen.layer.GenLayerZoom.magnify(1000L, ret, 2); -+ ret = new net.minecraft.world.gen.layer.GenLayerBiomeEdge(1000L, ret); -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch deleted file mode 100644 index 9a93d4f6d9..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch +++ /dev/null @@ -1,167 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeDecorator.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeDecorator.java -@@ -91,8 +91,10 @@ - - protected void genDecorations(BiomeGenBase biomeGenBaseIn, World p_150513_2_, Random p_150513_3_) - { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(p_150513_2_, p_150513_3_, field_180294_c)); - this.generateOres(p_150513_2_, p_150513_3_); - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND)) - for (int i = 0; i < this.sandPerChunk2; ++i) - { - int j = p_150513_3_.nextInt(16) + 8; -@@ -100,6 +102,7 @@ - this.sandGen.generate(p_150513_2_, p_150513_3_, p_150513_2_.getTopSolidOrLiquidBlock(this.field_180294_c.add(j, 0, k))); - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CLAY)) - for (int i1 = 0; i1 < this.clayPerChunk; ++i1) - { - int l1 = p_150513_3_.nextInt(16) + 8; -@@ -107,6 +110,7 @@ - this.clayGen.generate(p_150513_2_, p_150513_3_, p_150513_2_.getTopSolidOrLiquidBlock(this.field_180294_c.add(l1, 0, i6))); - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND_PASS2)) - for (int j1 = 0; j1 < this.sandPerChunk; ++j1) - { - int i2 = p_150513_3_.nextInt(16) + 8; -@@ -121,6 +125,7 @@ - ++k1; - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE)) - for (int j2 = 0; j2 < k1; ++j2) - { - int k6 = p_150513_3_.nextInt(16) + 8; -@@ -135,6 +140,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.BIG_SHROOM)) - for (int k2 = 0; k2 < this.bigMushroomsPerChunk; ++k2) - { - int l6 = p_150513_3_.nextInt(16) + 8; -@@ -142,6 +148,7 @@ - this.bigMushroomGen.generate(p_150513_2_, p_150513_3_, p_150513_2_.getHeight(this.field_180294_c.add(l6, 0, k10))); - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS)) - for (int l2 = 0; l2 < this.flowersPerChunk; ++l2) - { - int i7 = p_150513_3_.nextInt(16) + 8; -@@ -163,6 +170,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) - for (int i3 = 0; i3 < this.grassPerChunk; ++i3) - { - int j7 = p_150513_3_.nextInt(16) + 8; -@@ -176,6 +184,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.DEAD_BUSH)) - for (int j3 = 0; j3 < this.deadBushPerChunk; ++j3) - { - int k7 = p_150513_3_.nextInt(16) + 8; -@@ -189,6 +198,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LILYPAD)) - for (int k3 = 0; k3 < this.waterlilyPerChunk; ++k3) - { - int l7 = p_150513_3_.nextInt(16) + 8; -@@ -215,6 +225,8 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM)) -+ { - for (int l3 = 0; l3 < this.mushroomsPerChunk; ++l3) - { - if (p_150513_3_.nextInt(4) == 0) -@@ -265,7 +277,9 @@ - this.mushroomRedGen.generate(p_150513_2_, p_150513_3_, this.field_180294_c.add(j4, l15, l8)); - } - } -- -+ } // End of Mushroom generation -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.REED)) -+ { - for (int k4 = 0; k4 < this.reedsPerChunk; ++k4) - { - int i9 = p_150513_3_.nextInt(16) + 8; -@@ -291,7 +305,8 @@ - this.reedGen.generate(p_150513_2_, p_150513_3_, this.field_180294_c.add(j9, i19, i13)); - } - } -- -+ } // End of Reed generation -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.PUMPKIN)) - if (p_150513_3_.nextInt(32) == 0) - { - int i5 = p_150513_3_.nextInt(16) + 8; -@@ -305,6 +320,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CACTUS)) - for (int j5 = 0; j5 < this.cactiPerChunk; ++j5) - { - int l9 = p_150513_3_.nextInt(16) + 8; -@@ -320,6 +336,7 @@ - - if (this.generateLakes) - { -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_WATER)) - for (int k5 = 0; k5 < 50; ++k5) - { - int i10 = p_150513_3_.nextInt(16) + 8; -@@ -334,6 +351,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_LAVA)) - for (int l5 = 0; l5 < 20; ++l5) - { - int j10 = p_150513_3_.nextInt(16) + 8; -@@ -343,21 +361,35 @@ - (new WorldGenLiquids(Blocks.flowing_lava)).generate(p_150513_2_, p_150513_3_, blockpos3); - } - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post(p_150513_2_, p_150513_3_, field_180294_c)); - } - - protected void generateOres(World p_76797_1_, Random p_76797_2_) - { -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(p_76797_1_, p_76797_2_, field_180294_c)); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, dirtGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIRT)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.dirtCount, this.dirtGen, this.chunkProviderSettings.dirtMinHeight, this.chunkProviderSettings.dirtMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, gravelGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRAVEL)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.gravelCount, this.gravelGen, this.chunkProviderSettings.gravelMinHeight, this.chunkProviderSettings.gravelMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, dioriteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIORITE)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.dioriteCount, this.dioriteGen, this.chunkProviderSettings.dioriteMinHeight, this.chunkProviderSettings.dioriteMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, graniteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRANITE)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.graniteCount, this.graniteGen, this.chunkProviderSettings.graniteMinHeight, this.chunkProviderSettings.graniteMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, andesiteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.ANDESITE)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.andesiteCount, this.andesiteGen, this.chunkProviderSettings.andesiteMinHeight, this.chunkProviderSettings.andesiteMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, coalGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.COAL)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.coalCount, this.coalGen, this.chunkProviderSettings.coalMinHeight, this.chunkProviderSettings.coalMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, ironGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.IRON)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.ironCount, this.ironGen, this.chunkProviderSettings.ironMinHeight, this.chunkProviderSettings.ironMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, goldGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GOLD)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.goldCount, this.goldGen, this.chunkProviderSettings.goldMinHeight, this.chunkProviderSettings.goldMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, redstoneGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.REDSTONE)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.redstoneCount, this.redstoneGen, this.chunkProviderSettings.redstoneMinHeight, this.chunkProviderSettings.redstoneMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, diamondGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIAMOND)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.diamondCount, this.diamondGen, this.chunkProviderSettings.diamondMinHeight, this.chunkProviderSettings.diamondMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, lapisGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.LAPIS)) - this.genStandardOre2(p_76797_1_, p_76797_2_, this.chunkProviderSettings.lapisCount, this.lapisGen, this.chunkProviderSettings.lapisCenterHeight, this.chunkProviderSettings.lapisSpread); -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(p_76797_1_, p_76797_2_, field_180294_c)); - } - - protected void genStandardOre1(World blockCount, Random generator, int minHeight, WorldGenerator maxHeight, int p_76795_5_, int p_76795_6_) diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch deleted file mode 100644 index 826d96b122..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ /dev/null @@ -1,127 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenBase.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenBase.java -@@ -70,7 +70,7 @@ - protected static final WorldGenTrees worldGeneratorTrees = new WorldGenTrees(false); - protected static final WorldGenBigTree worldGeneratorBigTree = new WorldGenBigTree(false); - protected static final WorldGenSwamp worldGeneratorSwamp = new WorldGenSwamp(); -- public static final RegistryNamespaced field_185377_q = new RegistryNamespaced(); -+ public static final RegistryNamespaced field_185377_q = net.minecraftforge.fml.common.registry.GameData.getBiomeRegistry(); - private final String biomeName; - private final float minHeight; - private final float maxHeight; -@@ -128,11 +128,12 @@ - this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1)); - this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); - this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); -+ this.addDefaultFlowers(); - } - - public BiomeDecorator createBiomeDecorator() - { -- return new BiomeDecorator(); -+ return getModdedBiomeDecorator(new BiomeDecorator()); - } - - public boolean func_185363_b() -@@ -228,7 +229,7 @@ - { - double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(pos), 0.0F, 1.0F); - double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); -- return ColorizerGrass.getGrassColor(d0, d1); -+ return getModdedBiomeGrassColor(ColorizerGrass.getGrassColor(d0, d1)); - } - - public final void generateBiomeTerrain(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180628_4_, int p_180628_5_, double p_180628_6_) -@@ -321,7 +322,7 @@ - { - double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(pos), 0.0F, 1.0F); - double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); -- return ColorizerFoliage.getFoliageColor(d0, d1); -+ return getModdedBiomeFoliageColor(ColorizerFoliage.getFoliageColor(d0, d1)); - } - - public Class getBiomeClass() -@@ -386,6 +387,83 @@ - return this.enableSnow; - } - -+ /* ========================================= FORGE START ======================================*/ -+ protected List flowers = new java.util.ArrayList(); -+ -+ public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) -+ { -+ return new net.minecraftforge.event.terraingen.DeferredBiomeDecorator(original); -+ } -+ -+ public int getWaterColorMultiplier() -+ { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor(this, waterColorMultiplier); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; -+ } -+ -+ public int getModdedBiomeGrassColor(int original) -+ { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor(this, original); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; -+ } -+ -+ public int getModdedBiomeFoliageColor(int original) -+ { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor(this, original); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; -+ } -+ -+ /** -+ * Weighted random holder class used to hold possible flowers -+ * that can spawn in this biome when bonemeal is used on grass. -+ */ -+ public static class FlowerEntry extends WeightedRandom.Item -+ { -+ public final net.minecraft.block.state.IBlockState state; -+ public FlowerEntry(net.minecraft.block.state.IBlockState state, int weight) -+ { -+ super(weight); -+ this.state = state; -+ } -+ } -+ -+ /** -+ * Adds the default flowers, as of 1.7, it is 2 yellow, and 1 red. I chose 10 to allow some wiggle room in the numbers. -+ */ -+ public void addDefaultFlowers() -+ { -+ addFlower(Blocks.yellow_flower.getDefaultState().withProperty(Blocks.yellow_flower.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 20); -+ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); -+ } -+ -+ /** Register a new plant to be planted when bonemeal is used on grass. -+ * @param state The block to place. -+ * @param weight The weight of the plant, where red flowers are -+ * 10 and yellow flowers are 20. -+ */ -+ public void addFlower(IBlockState state, int weight) -+ { -+ this.flowers.add(new FlowerEntry(state, weight)); -+ } -+ -+ public void plantFlower(World world, Random rand, BlockPos pos) -+ { -+ FlowerEntry flower = (FlowerEntry)WeightedRandom.getRandomItem(rand, flowers); -+ if (flower == null || flower.state == null || -+ (flower.state.getBlock() instanceof net.minecraft.block.BlockBush && -+ !((net.minecraft.block.BlockBush)flower.state.getBlock()).canBlockStay(world, pos, flower.state))) -+ { -+ return; -+ } -+ -+ world.setBlockState(pos, flower.state, 3); -+ } -+ -+ /* ========================================= FORGE END ======================================*/ -+ - public static void func_185358_q() - { - func_185354_a(0, "ocean", new BiomeGenOcean((new BiomeGenBase.BiomeProperties("Ocean")).func_185398_c(-1.0F).func_185400_d(0.1F))); diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch deleted file mode 100644 index 7785a8e11f..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenForest.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenForest.java -@@ -147,6 +147,22 @@ - } - } - -+ @Override -+ public void addDefaultFlowers() -+ { -+ if (field_150632_aF != BiomeGenForest.Type.FLOWER) -+ { -+ super.addDefaultFlowers(); -+ return; -+ } -+ for (BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) -+ { -+ if (type.getBlockType() == BlockFlower.EnumFlowerColor.YELLOW) continue; -+ if (type == BlockFlower.EnumFlowerType.BLUE_ORCHID) type = BlockFlower.EnumFlowerType.POPPY; -+ addFlower(net.minecraft.init.Blocks.red_flower.getDefaultState().withProperty(net.minecraft.init.Blocks.red_flower.getTypeProperty(), type), 10); -+ } -+ } -+ - public Class getBiomeClass() - { - return BiomeGenForest.class; diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch deleted file mode 100644 index 031f46cf68..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenHills.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java -@@ -37,28 +37,20 @@ - public void decorate(World worldIn, Random rand, BlockPos pos) - { - super.decorate(worldIn, rand, pos); -- int i = 3 + rand.nextInt(6); -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(worldIn, rand, pos)); -+ WorldGenerator emeralds = new EmeraldGenerator(); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(worldIn, rand, emeralds, pos, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.EMERALD)) -+ emeralds.generate(worldIn, rand, pos); - -- for (int j = 0; j < i; ++j) -+ for (int i = 0; i < 7; ++i) - { -- int k = rand.nextInt(16); -- int l = rand.nextInt(28) + 4; -- int i1 = rand.nextInt(16); -- BlockPos blockpos = pos.add(k, l, i1); -- -- if (worldIn.getBlockState(blockpos).getBlock() == Blocks.stone) -- { -- worldIn.setBlockState(blockpos, Blocks.emerald_ore.getDefaultState(), 2); -- } -- } -- -- for (i = 0; i < 7; ++i) -- { - int j1 = rand.nextInt(16); - int k1 = rand.nextInt(64); - int l1 = rand.nextInt(16); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(worldIn, rand, theWorldGenerator, pos.add(j1, k1, l1), net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.SILVERFISH)) - this.theWorldGenerator.generate(worldIn, rand, pos.add(j1, k1, l1)); - } -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(worldIn, rand, pos)); - } - - public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_) -@@ -86,4 +78,24 @@ - EXTRA_TREES, - MUTATED; - } -+ -+ private static class EmeraldGenerator extends WorldGenerator -+ { -+ @Override -+ public boolean generate(World worldIn, Random rand, BlockPos pos) -+ { -+ int count = 3 + rand.nextInt(6); -+ for (int i = 0; i < count; i++) -+ { -+ BlockPos blockpos = pos.add(rand.nextInt(16), rand.nextInt(28) + 4, rand.nextInt(16)); -+ -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); -+ if (state.getBlock().isReplaceableOreGen(state, worldIn, blockpos, net.minecraft.block.state.pattern.BlockMatcher.forBlock(Blocks.stone))) -+ { -+ worldIn.setBlockState(blockpos, Blocks.emerald_ore.getDefaultState(), 2); -+ } -+ } -+ return true; -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch deleted file mode 100644 index d078f7459b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenJungle.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenJungle.java -@@ -68,7 +68,9 @@ - super.decorate(worldIn, rand, pos); - int i = rand.nextInt(16) + 8; - int j = rand.nextInt(16) + 8; -- int k = rand.nextInt(worldIn.getHeight(pos.add(i, 0, j)).getY() * 2); -+ int height = worldIn.getHeight(pos.add(i, 0, j)).getY() * 2; // could == 0, which crashes nextInt -+ if (height < 1) height = 1; -+ int k = rand.nextInt(height); - (new WorldGenMelon()).generate(worldIn, rand, pos.add(i, k, j)); - WorldGenVines worldgenvines = new WorldGenVines(); - diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch deleted file mode 100644 index af1488b9c4..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenPlains.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenPlains.java -@@ -92,4 +92,19 @@ - - super.decorate(worldIn, rand, pos); - } -+ -+ @Override -+ public void addDefaultFlowers() -+ { -+ BlockFlower red = net.minecraft.init.Blocks.red_flower; -+ BlockFlower yel = net.minecraft.init.Blocks.yellow_flower; -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.ORANGE_TULIP), 3); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.RED_TULIP), 3); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.PINK_TULIP), 3); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.WHITE_TULIP), 3); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.HOUSTONIA), 20); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.OXEYE_DAISY), 20); -+ addFlower(yel.getDefaultState().withProperty(yel.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 30); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch deleted file mode 100644 index c4cea2dc19..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java -@@ -86,4 +86,10 @@ - { - return 6975545; - } -+ -+ @Override -+ public void addDefaultFlowers() -+ { -+ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.BLUE_ORCHID), 10); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch deleted file mode 100644 index a1f44da1d6..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeProvider.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeProvider.java -@@ -15,6 +15,7 @@ - - public class BiomeProvider - { -+ public static List allowedBiomes = Lists.newArrayList(Biomes.forest, Biomes.plains, Biomes.taiga, Biomes.taigaHills, Biomes.forestHills, Biomes.jungle, Biomes.jungleHills); - private GenLayer genBiomes; - private GenLayer biomeIndexLayer; - private final BiomeCache biomeCache; -@@ -23,13 +24,14 @@ - protected BiomeProvider() - { - this.biomeCache = new BiomeCache(this); -- this.biomesToSpawnIn = Lists.newArrayList(new BiomeGenBase[] {Biomes.forest, Biomes.plains, Biomes.taiga, Biomes.taigaHills, Biomes.forestHills, Biomes.jungle, Biomes.jungleHills}); -+ this.biomesToSpawnIn = Lists.newArrayList(allowedBiomes); - } - - private BiomeProvider(long seed, WorldType p_i45744_3_, String p_i45744_4_) - { - this(); - GenLayer[] agenlayer = GenLayer.initializeAllBiomeGenerators(seed, p_i45744_3_, p_i45744_4_); -+ agenlayer = getModdedBiomeGenerators(p_i45744_3_, seed, agenlayer); - this.genBiomes = agenlayer[0]; - this.biomeIndexLayer = agenlayer[1]; - } -@@ -196,4 +198,11 @@ - { - this.biomeCache.cleanupCache(); - } -+ -+ public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original) -+ { -+ net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens event = new net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens(worldType, seed, original); -+ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ return event.newBiomeGens; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch b/patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch deleted file mode 100644 index 154d87191a..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/border/WorldBorder.java -+++ ../src-work/minecraft/net/minecraft/world/border/WorldBorder.java -@@ -277,4 +277,9 @@ - iborderlistener.onWarningDistanceChanged(this, warningDistance); - } - } -+ -+ public void removeListener(IBorderListener listener) -+ { -+ this.listeners.remove(listener); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch deleted file mode 100644 index c44a0d49fc..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ /dev/null @@ -1,294 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java -@@ -175,7 +175,7 @@ - { - IBlockState iblockstate = this.func_186032_a(j, l - 1, k); - -- if (iblockstate.func_185891_c() != 0) -+ if (iblockstate.getLightOpacity(this.worldObj, new BlockPos(j, l - 1, k)) != 0) - { - this.heightMap[k << 4 | j] = l; - -@@ -448,12 +448,12 @@ - - public int getBlockLightOpacity(BlockPos pos) - { -- return this.getBlockState(pos).func_185891_c(); -+ return this.getBlockState(pos).getLightOpacity(this.worldObj, pos); - } - - private int getBlockLightOpacity(int x, int y, int z) - { -- return this.func_186032_a(x, y, z).func_185891_c(); -+ return this.func_186032_a(x, y, z).getLightOpacity(this.worldObj, new BlockPos(x, y, z)); - } - - public IBlockState getBlockState(BlockPos pos) -@@ -534,6 +534,7 @@ - { - Block block = state.getBlock(); - Block block1 = iblockstate.getBlock(); -+ int k1 = iblockstate.getLightOpacity(this.worldObj, pos); // Relocate old light value lookup here, so that it is called before TE is removed. - ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4]; - boolean flag = false; - -@@ -550,14 +551,19 @@ - - extendedblockstorage.set(i, j & 15, k, state); - -- if (block1 != block) -+ //if (block1 != block) - { - if (!this.worldObj.isRemote) - { -+ if (block1 != block) //Only fire block breaks when the block changes. - block1.breakBlock(this.worldObj, pos, iblockstate); -+ TileEntity te = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); -+ if (te != null && te.shouldRefresh(this.worldObj, pos, iblockstate, state)) this.worldObj.removeTileEntity(pos); - } -- else if (block1 instanceof ITileEntityProvider) -+ else if (block1.hasTileEntity(iblockstate)) - { -+ TileEntity te = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); -+ if (te != null && te.shouldRefresh(this.worldObj, pos, iblockstate, state)) - this.worldObj.removeTileEntity(pos); - } - } -@@ -574,8 +580,7 @@ - } - else - { -- int j1 = state.func_185891_c(); -- int k1 = iblockstate.func_185891_c(); -+ int j1 = state.getLightOpacity(this.worldObj, pos); - - if (j1 > 0) - { -@@ -595,28 +600,18 @@ - } - } - -- if (block1 instanceof ITileEntityProvider) -- { -- TileEntity tileentity = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); -- -- if (tileentity != null) -- { -- tileentity.updateContainingBlockInfo(); -- } -- } -- - if (!this.worldObj.isRemote && block1 != block) - { - block.onBlockAdded(this.worldObj, pos, state); - } - -- if (block instanceof ITileEntityProvider) -+ if (block.hasTileEntity(state)) - { - TileEntity tileentity1 = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); - - if (tileentity1 == null) - { -- tileentity1 = ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, block.getMetaFromState(state)); -+ tileentity1 = block.createTileEntity(this.worldObj, state); - this.worldObj.setTileEntity(pos, tileentity1); - } - -@@ -719,6 +714,7 @@ - k = this.entityLists.length - 1; - } - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EnteringChunk(entityIn, this.xPosition, this.zPosition, entityIn.chunkCoordX, entityIn.chunkCoordZ)); - entityIn.addedToChunk = true; - entityIn.chunkCoordX = this.xPosition; - entityIn.chunkCoordY = k; -@@ -758,13 +754,19 @@ - { - IBlockState iblockstate = this.getBlockState(pos); - Block block = iblockstate.getBlock(); -- return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, iblockstate.getBlock().getMetaFromState(iblockstate)); -+ return !block.hasTileEntity(iblockstate) ? null : block.createTileEntity(this.worldObj, iblockstate); - } - - public TileEntity getTileEntity(BlockPos pos, Chunk.EnumCreateEntityType p_177424_2_) - { - TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(pos); - -+ if (tileentity != null && tileentity.isInvalid()) -+ { -+ chunkTileEntityMap.remove(pos); -+ tileentity = null; -+ } -+ - if (tileentity == null) - { - if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) -@@ -774,14 +776,9 @@ - } - else if (p_177424_2_ == Chunk.EnumCreateEntityType.QUEUED) - { -- this.tileEntityPosQueue.add(pos); -+ this.tileEntityPosQueue.add(pos.getImmutable()); - } - } -- else if (tileentity.isInvalid()) -- { -- this.chunkTileEntityMap.remove(pos); -- return null; -- } - - return tileentity; - } -@@ -801,7 +798,7 @@ - tileEntityIn.setWorldObj(this.worldObj); - tileEntityIn.setPos(pos); - -- if (this.getBlockState(pos).getBlock() instanceof ITileEntityProvider) -+ if (this.getBlockState(pos).getBlock().hasTileEntity(this.getBlockState(pos))) - { - if (this.chunkTileEntityMap.containsKey(pos)) - { -@@ -810,6 +807,7 @@ - - tileEntityIn.validate(); - this.chunkTileEntityMap.put(pos, tileEntityIn); -+ tileEntityIn.onLoad(); - } - } - -@@ -838,8 +836,9 @@ - entity.onChunkLoad(); - } - -- this.worldObj.loadEntities(this.entityLists[i]); -+ this.worldObj.loadEntities(com.google.common.collect.ImmutableList.copyOf(this.entityLists[i])); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(this)); - } - - public void onChunkUnload() -@@ -855,6 +854,7 @@ - { - this.worldObj.unloadEntities(this.entityLists[i]); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload(this)); - } - - public void setChunkModified() -@@ -864,8 +864,8 @@ - - public void getEntitiesWithinAABBForEntity(Entity entityIn, AxisAlignedBB aabb, List listToFill, Predicate p_177414_4_) - { -- int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D); -- int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.floor_double((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); - i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); - j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); - -@@ -904,8 +904,8 @@ - - public void getEntitiesOfTypeWithinAAAB(Class entityClass, AxisAlignedBB aabb, List listToFill, Predicate p_177430_4_) - { -- int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D); -- int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.floor_double((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); - i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); - j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); - -@@ -994,6 +994,7 @@ - { - this.func_150809_p(); - p_186034_1_.func_185931_b(this.xPosition, this.zPosition); -+ net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(this.xPosition, this.zPosition, this.worldObj, p_186034_1_, this.worldObj.getChunkProvider()); - this.setChunkModified(); - } - } -@@ -1050,7 +1051,7 @@ - { - BlockPos blockpos = (BlockPos)this.tileEntityPosQueue.poll(); - -- if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.getBlockState(blockpos).getBlock().hasTileEntity()) -+ if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.getBlockState(blockpos).getBlock().hasTileEntity(this.getBlockState(blockpos))) - { - TileEntity tileentity = this.createNewTileEntity(blockpos); - this.worldObj.setTileEntity(blockpos, tileentity); -@@ -1114,6 +1115,13 @@ - @SideOnly(Side.CLIENT) - public void func_186033_a(PacketBuffer p_186033_1_, int p_186033_2_, boolean p_186033_3_) - { -+ for(TileEntity tileEntity : chunkTileEntityMap.values()) -+ { -+ tileEntity.updateContainingBlockInfo(); -+ tileEntity.getBlockMetadata(); -+ tileEntity.getBlockType(); -+ } -+ - boolean flag = !this.worldObj.provider.getHasNoSky(); - - for (int i = 0; i < this.storageArrays.length; ++i) -@@ -1162,10 +1170,16 @@ - this.isTerrainPopulated = true; - this.generateHeightMap(); - -+ List invalidList = new java.util.ArrayList(); -+ - for (TileEntity tileentity : this.chunkTileEntityMap.values()) - { -+ if (tileentity.shouldRefresh(this.worldObj, tileentity.getPos(), tileentity.getBlockType().getStateFromMeta(tileentity.getBlockMetadata()), getBlockState(tileentity.getPos()))) -+ invalidList.add(tileentity); - tileentity.updateContainingBlockInfo(); - } -+ -+ for (TileEntity te : invalidList) te.invalidate(); - } - - public BiomeGenBase getBiome(BlockPos pos, BiomeProvider chunkManager) -@@ -1233,13 +1247,13 @@ - BlockPos blockpos1 = blockpos.add(k, (j << 4) + i1, l); - boolean flag = i1 == 0 || i1 == 15 || k == 0 || k == 15 || l == 0 || l == 15; - -- if (this.storageArrays[j] == field_186036_a && flag || this.storageArrays[j] != field_186036_a && this.storageArrays[j].get(k, i1, l).func_185904_a() == Material.air) -+ if (this.storageArrays[j] == field_186036_a && flag || this.storageArrays[j] != field_186036_a && this.storageArrays[j].get(k, i1, l).getBlock().isAir(this.storageArrays[j].get(k, i1, l), this.worldObj, blockpos1)) - { - for (EnumFacing enumfacing : EnumFacing.values()) - { - BlockPos blockpos2 = blockpos1.offset(enumfacing); - -- if (this.worldObj.getBlockState(blockpos2).func_185906_d() > 0) -+ if (this.worldObj.getBlockState(blockpos2).getLightValue(this.worldObj, blockpos2) > 0) - { - this.worldObj.checkLight(blockpos2); - } -@@ -1370,7 +1384,7 @@ - { - blockpos$mutableblockpos.set(blockpos$mutableblockpos.getX(), l, blockpos$mutableblockpos.getZ()); - -- if (this.getBlockState(blockpos$mutableblockpos).func_185906_d() > 0) -+ if (this.getBlockState(blockpos$mutableblockpos).getLightValue(this.worldObj, blockpos$mutableblockpos) > 0) - { - this.worldObj.checkLight(blockpos$mutableblockpos); - } -@@ -1481,4 +1495,20 @@ - QUEUED, - CHECK; - } -+ -+ /** -+ * Removes the tile entity at the specified position, only if it's -+ * marked as invalid. -+ */ -+ public void removeInvalidTileEntity(BlockPos pos) -+ { -+ if (isChunkLoaded) -+ { -+ TileEntity entity = (TileEntity)chunkTileEntityMap.get(pos); -+ if (entity != null && entity.isInvalid()) -+ { -+ chunkTileEntityMap.remove(pos); -+ } -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch deleted file mode 100644 index 46e4f5f777..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch +++ /dev/null @@ -1,161 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java -@@ -46,8 +46,41 @@ - this.field_186055_e = p_i46673_2_; - } - -+ public boolean chunkExists(World world, int x, int z) -+ { -+ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); -+ -+ if (this.pendingAnvilChunksCoordinates.contains(chunkcoordintpair)) -+ { -+ for(ChunkCoordIntPair pendingChunkCoord : this.chunksToRemove.keySet()) -+ { -+ if (pendingChunkCoord.equals(chunkcoordintpair)) -+ { -+ return true; -+ } -+ } -+ } -+ -+ return RegionFileCache.createOrLoadRegionFile(this.chunkSaveLocation, x, z).chunkExists(x & 31, z & 31); -+ } -+ - public Chunk loadChunk(World worldIn, int x, int z) throws IOException - { -+ Object[] data = this.loadChunk__Async(worldIn, x, z); -+ -+ if (data != null) -+ { -+ Chunk chunk = (Chunk) data[0]; -+ NBTTagCompound nbttagcompound = (NBTTagCompound) data[1]; -+ this.loadEntities(worldIn, nbttagcompound.getCompoundTag("Level"), chunk); -+ return chunk; -+ } -+ -+ return null; -+ } -+ -+ public Object[] loadChunk__Async(World worldIn, int x, int z) throws IOException -+ { - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); - NBTTagCompound nbttagcompound = (NBTTagCompound)this.chunksToRemove.get(chunkcoordintpair); - -@@ -63,11 +96,17 @@ - nbttagcompound = this.field_186055_e.func_188257_a(FixTypes.CHUNK, CompressedStreamTools.read(datainputstream)); - } - -- return this.checkedReadChunkFromNBT(worldIn, x, z, nbttagcompound); -+ return this.checkedReadChunkFromNBT__Async(worldIn, x, z, nbttagcompound); - } - - protected Chunk checkedReadChunkFromNBT(World worldIn, int x, int z, NBTTagCompound p_75822_4_) - { -+ Object[] data = this.checkedReadChunkFromNBT__Async(worldIn, x, z, p_75822_4_); -+ return data != null ? (Chunk)data[0] : null; -+ } -+ -+ protected Object[] checkedReadChunkFromNBT__Async(World worldIn, int x, int z, NBTTagCompound p_75822_4_) -+ { - if (!p_75822_4_.hasKey("Level", 10)) - { - logger.error("Chunk file at " + x + "," + z + " is missing level data, skipping"); -@@ -91,10 +130,29 @@ - logger.error("Chunk file at " + x + "," + z + " is in the wrong location; relocating. (Expected " + x + ", " + z + ", got " + chunk.xPosition + ", " + chunk.zPosition + ")"); - nbttagcompound.setInteger("xPos", x); - nbttagcompound.setInteger("zPos", z); -+ -+ // Have to move tile entities since we don't load them at this stage -+ NBTTagList _tileEntities = nbttagcompound.getTagList("TileEntities", 10); -+ -+ if (_tileEntities != null) -+ { -+ for (int te = 0; te < _tileEntities.tagCount(); te++) -+ { -+ NBTTagCompound _nbt = (NBTTagCompound) _tileEntities.getCompoundTagAt(te); -+ _nbt.setInteger("x", x * 16 + (_nbt.getInteger("x") - chunk.xPosition * 16)); -+ _nbt.setInteger("z", z * 16 + (_nbt.getInteger("z") - chunk.zPosition * 16)); -+ } -+ } -+ - chunk = this.readChunkFromNBT(worldIn, nbttagcompound); - } - -- return chunk; -+ Object[] data = new Object[2]; -+ data[0] = chunk; -+ data[1] = p_75822_4_; -+ // event is fired in ChunkIOProvider.callStage2 since it must be fired after TE's load. -+ // MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(chunk, par4NBTTagCompound)); -+ return data; - } - } - } -@@ -110,6 +168,7 @@ - nbttagcompound.setTag("Level", nbttagcompound1); - nbttagcompound.setInteger("DataVersion", 169); - this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(chunkIn, nbttagcompound)); - this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound); - } - catch (Exception exception) -@@ -265,8 +324,17 @@ - - if (entity.writeToNBTOptional(nbttagcompound2)) - { -+ try -+ { - chunkIn.setHasEntities(true); - nbttaglist1.appendTag(nbttagcompound2); -+ } -+ catch (Exception e) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, -+ "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author", -+ entity.getClass().getName()); -+ } - } - } - } -@@ -276,9 +344,18 @@ - - for (TileEntity tileentity : chunkIn.getTileEntityMap().values()) - { -+ try -+ { - NBTTagCompound nbttagcompound3 = new NBTTagCompound(); - tileentity.writeToNBT(nbttagcompound3); - nbttaglist2.appendTag(nbttagcompound3); -+ } -+ catch (Exception e) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, -+ "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author", -+ tileentity.getClass().getName()); -+ } - } - - p_75820_3_.setTag("TileEntities", nbttaglist2); -@@ -347,6 +424,12 @@ - chunk.setBiomeArray(p_75823_2_.getByteArray("Biomes")); - } - -+ // End this method here and split off entity loading to another method -+ return chunk; -+ } -+ -+ public void loadEntities(World worldIn, NBTTagCompound p_75823_2_, Chunk chunk) -+ { - NBTTagList nbttaglist1 = p_75823_2_.getTagList("Entities", 10); - - if (nbttaglist1 != null) -@@ -399,8 +482,6 @@ - } - } - } -- -- return chunk; - } - - public static Entity func_186050_a(NBTTagCompound p_186050_0_, World p_186050_1_, Chunk p_186050_2_) diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch deleted file mode 100644 index 401ade530a..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java -@@ -21,18 +21,12 @@ - { - File file1 = this.getWorldDirectory(); - -- if (provider instanceof WorldProviderHell) -+ if (provider.getSaveFolder() != null) - { -- File file3 = new File(file1, "DIM-1"); -+ File file3 = new File(file1, provider.getSaveFolder()); - file3.mkdirs(); - return new AnvilChunkLoader(file3, this.field_186341_a); - } -- else if (provider instanceof WorldProviderEnd) -- { -- File file2 = new File(file1, "DIM1"); -- file2.mkdirs(); -- return new AnvilChunkLoader(file2, this.field_186341_a); -- } - else - { - return new AnvilChunkLoader(file1, this.field_186341_a); diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch deleted file mode 100644 index 62b0bdc266..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java -@@ -34,6 +34,8 @@ - - public void set(int x, int y, int z, IBlockState state) - { -+ if (state instanceof net.minecraftforge.common.property.IExtendedBlockState) -+ state = ((net.minecraftforge.common.property.IExtendedBlockState) state).getClean(); - IBlockState iblockstate = this.get(x, y, z); - Block block = iblockstate.getBlock(); - Block block1 = state.getBlock(); diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch deleted file mode 100644 index bb5d0c2111..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/RegionFile.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/RegionFile.java -@@ -94,6 +94,39 @@ - } - } - -+ // This is a copy (sort of) of the method below it, make sure they stay in sync -+ public synchronized boolean chunkExists(int x, int z) -+ { -+ if (this.outOfBounds(x, z)) return false; -+ -+ try -+ { -+ int offset = this.getOffset(x, z); -+ -+ if (offset == 0) return false; -+ -+ int sectorNumber = offset >> 8; -+ int numSectors = offset & 255; -+ -+ if (sectorNumber + numSectors > this.sectorFree.size()) return false; -+ -+ this.dataFile.seek((long)(sectorNumber * 4096)); -+ int length = this.dataFile.readInt(); -+ -+ if (length > 4096 * numSectors || length <= 0) return false; -+ -+ byte version = this.dataFile.readByte(); -+ -+ if (version == 1 || version == 2) return true; -+ } -+ catch (IOException ioexception) -+ { -+ return false; -+ } -+ -+ return false; -+ } -+ - public synchronized DataInputStream getChunkDataInputStream(int x, int z) - { - if (this.outOfBounds(x, z)) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch deleted file mode 100644 index 827e84f8b0..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java -@@ -39,6 +39,9 @@ - double[] field_185967_f; - double[] field_185968_g; - private final WorldGenEndIsland field_185975_r = new WorldGenEndIsland(); -+ // temporary variables used during event handling -+ private int chunkX = 0; -+ private int chunkZ = 0; - - public ChunkProviderEnd(World p_i46667_1_, boolean p_i46667_2_, long p_i46667_3_) - { -@@ -51,6 +54,16 @@ - this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10); - this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16); - this.field_185973_o = new NoiseGeneratorSimplex(this.rand); -+ -+ net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextEnd ctx = -+ new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextEnd(field_185969_i, field_185970_j, field_185971_k, noiseGen5, noiseGen6, field_185973_o); -+ ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i46667_1_, this.rand, ctx); -+ this.field_185969_i = ctx.getLPerlin1(); -+ this.field_185970_j = ctx.getLPerlin2(); -+ this.field_185971_k = ctx.getPerlin(); -+ this.noiseGen5 = ctx.getDepth(); -+ this.noiseGen6 = ctx.getScale(); -+ this.field_185973_o = ctx.getIsland(); - } - - public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) -@@ -123,6 +136,7 @@ - - public void func_185962_a(ChunkPrimer p_185962_1_) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, this.chunkX, this.chunkZ, p_185962_1_, this.worldObj)) return; - for (int i = 0; i < 16; ++i) - { - for (int j = 0; j < 16; ++j) -@@ -174,6 +188,7 @@ - - public Chunk func_185932_a(int p_185932_1_, int p_185932_2_) - { -+ this.chunkX = p_185932_1_; this.chunkZ = p_185932_2_; - this.rand.setSeed((long)p_185932_1_ * 341873128712L + (long)p_185932_2_ * 132897987541L); - ChunkPrimer chunkprimer = new ChunkPrimer(); - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, p_185932_1_ * 16, p_185932_2_ * 16, 16, 16); -@@ -255,6 +270,10 @@ - - private double[] func_185963_a(double[] p_185963_1_, int p_185963_2_, int p_185963_3_, int p_185963_4_, int p_185963_5_, int p_185963_6_, int p_185963_7_) - { -+ net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField(this, p_185963_1_, p_185963_2_, p_185963_3_, p_185963_4_, p_185963_5_, p_185963_6_, p_185963_7_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; -+ - if (p_185963_1_ == null) - { - p_185963_1_ = new double[p_185963_5_ * p_185963_6_ * p_185963_7_]; -@@ -327,6 +346,7 @@ - public void func_185931_b(int p_185931_1_, int p_185931_2_) - { - BlockFalling.fallInstantly = true; -+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.worldObj, p_185931_1_, p_185931_2_, false); - BlockPos blockpos = new BlockPos(p_185931_1_ * 16, 0, p_185931_2_ * 16); - - if (this.mapFeaturesEnabled) -@@ -374,6 +394,7 @@ - } - } - -+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.worldObj, p_185931_1_, p_185931_2_, false); - BlockFalling.fallInstantly = false; - } - diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch deleted file mode 100644 index b0983b7e30..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch +++ /dev/null @@ -1,104 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderHell.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderHell.java -@@ -76,6 +76,19 @@ - this.field_185946_g = new NoiseGeneratorOctaves(this.field_185954_p, 10); - this.field_185947_h = new NoiseGeneratorOctaves(this.field_185954_p, 16); - worldIn.setSeaLevel(63); -+ -+ net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextHell ctx = -+ new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextHell(field_185957_u, field_185958_v, field_185959_w, slowsandGravelNoiseGen, netherrackExculsivityNoiseGen, field_185946_g, field_185947_h); -+ ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.field_185954_p, ctx); -+ this.field_185957_u = ctx.getLPerlin1(); -+ this.field_185958_v = ctx.getLPerlin2(); -+ this.field_185959_w = ctx.getPerlin(); -+ this.slowsandGravelNoiseGen = ctx.getPerlin2(); -+ this.netherrackExculsivityNoiseGen = ctx.getPerlin3(); -+ this.field_185946_g = ctx.getScale(); -+ this.field_185947_h = ctx.getDepth(); -+ this.genNetherBridge = (MapGenNetherBridge)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(genNetherBridge, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_BRIDGE); -+ this.field_185939_I = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_185939_I, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_CAVE); - } - - public void func_185936_a(int p_185936_1_, int p_185936_2_, ChunkPrimer p_185936_3_) -@@ -154,6 +167,7 @@ - - public void func_185937_b(int p_185937_1_, int p_185937_2_, ChunkPrimer p_185937_3_) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, p_185937_1_, p_185937_2_, p_185937_3_, this.field_185952_n)) return; - int i = this.field_185952_n.getSeaLevel() + 1; - double d0 = 0.03125D; - this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, p_185937_1_ * 16, p_185937_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); -@@ -276,6 +290,10 @@ - p_185938_1_ = new double[p_185938_5_ * p_185938_6_ * p_185938_7_]; - } - -+ net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField(this, p_185938_1_, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, p_185938_6_, p_185938_7_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; -+ - double d0 = 684.412D; - double d1 = 2053.236D; - this.noiseData4 = this.field_185946_g.generateNoiseOctaves(this.noiseData4, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, 1, p_185938_7_, 1.0D, 0.0D, 1.0D); -@@ -357,20 +375,25 @@ - public void func_185931_b(int p_185931_1_, int p_185931_2_) - { - BlockFalling.fallInstantly = true; -+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.field_185952_n, p_185931_1_, p_185931_2_, false); - BlockPos blockpos = new BlockPos(p_185931_1_ * 16, 0, p_185931_2_ * 16); - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_185931_1_, p_185931_2_); - this.genNetherBridge.generateStructure(this.field_185952_n, this.field_185954_p, chunkcoordintpair); - -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA)) - for (int i = 0; i < 8; ++i) - { - this.field_177472_y.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(120) + 4, this.field_185954_p.nextInt(16) + 8)); - } - -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.FIRE)) - for (int j = 0; j < this.field_185954_p.nextInt(this.field_185954_p.nextInt(10) + 1) + 1; ++j) - { - this.field_177470_t.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(120) + 4, this.field_185954_p.nextInt(16) + 8)); - } - -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.GLOWSTONE)) -+ { - for (int k = 0; k < this.field_185954_p.nextInt(this.field_185954_p.nextInt(10) + 1); ++k) - { - this.field_177469_u.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(120) + 4, this.field_185954_p.nextInt(16) + 8)); -@@ -380,7 +403,13 @@ - { - this.field_177468_v.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(128), this.field_185954_p.nextInt(16) + 8)); - } -+ }//Forge: End doGLowstone - -+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.field_185952_n, p_185931_1_, p_185931_2_, false); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(this.field_185952_n, this.field_185954_p, blockpos)); -+ -+ if (net.minecraftforge.event.terraingen.TerrainGen.decorate(this.field_185952_n, this.field_185954_p, blockpos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM)) -+ { - if (this.field_185954_p.nextBoolean()) - { - this.field_177471_z.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(128), this.field_185954_p.nextInt(16) + 8)); -@@ -390,17 +419,22 @@ - { - this.field_177465_A.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(128), this.field_185954_p.nextInt(16) + 8)); - } -+ } - -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(this.field_185952_n, this.field_185954_p, field_177467_w, blockpos, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.QUARTZ)) - for (int i1 = 0; i1 < 16; ++i1) - { - this.field_177467_w.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16), this.field_185954_p.nextInt(108) + 10, this.field_185954_p.nextInt(16))); - } - -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA2)) - for (int j1 = 0; j1 < 16; ++j1) - { - this.field_177473_x.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16), this.field_185954_p.nextInt(108) + 10, this.field_185954_p.nextInt(16))); - } - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post(this.field_185952_n, this.field_185954_p, blockpos)); -+ - BlockFalling.fallInstantly = false; - } - diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java.patch deleted file mode 100644 index a7478f3216..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java.patch +++ /dev/null @@ -1,101 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java -@@ -59,6 +59,15 @@ - - public ChunkProviderOverworld(World p_i46668_1_, long p_i46668_2_, boolean p_i46668_4_, String p_i46668_5_) - { -+ { -+ field_186003_v = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186003_v, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE); -+ field_186004_w = (MapGenStronghold)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186004_w, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD); -+ field_186005_x = (MapGenVillage)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186005_x, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE); -+ field_186006_y = (MapGenMineshaft)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186006_y, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT); -+ field_186007_z = (MapGenScatteredFeature)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186007_z, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE); -+ field_185979_A = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_185979_A, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE); -+ field_185980_B = (StructureOceanMonument)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_185980_B, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.OCEAN_MONUMENT); -+ } - this.field_185995_n = p_i46668_1_; - this.field_185996_o = p_i46668_4_; - this.field_185997_p = p_i46668_1_.getWorldInfo().getTerrainType(); -@@ -88,6 +97,17 @@ - this.field_186001_t = this.field_186000_s.useLavaOceans ? Blocks.lava.getDefaultState() : Blocks.water.getDefaultState(); - p_i46668_1_.setSeaLevel(this.field_186000_s.seaLevel); - } -+ -+ net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextOverworld ctx = -+ new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextOverworld(field_185991_j, field_185992_k, field_185993_l, field_185994_m, field_185983_b, field_185984_c, field_185985_d); -+ ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i46668_1_, this.field_185990_i, ctx); -+ this.field_185991_j = ctx.getLPerlin1(); -+ this.field_185992_k = ctx.getLPerlin2(); -+ this.field_185993_l = ctx.getPerlin(); -+ this.field_185994_m = ctx.getHeight(); -+ this.field_185983_b = ctx.getScale(); -+ this.field_185984_c = ctx.getDepth(); -+ this.field_185985_d = ctx.getForest(); - } - - public void func_185976_a(int p_185976_1_, int p_185976_2_, ChunkPrimer p_185976_3_) -@@ -161,6 +181,7 @@ - - public void func_185977_a(int p_185977_1_, int p_185977_2_, ChunkPrimer p_185977_3_, BiomeGenBase[] p_185977_4_) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, p_185977_1_, p_185977_2_, p_185977_3_, this.field_185995_n)) return; - double d0 = 0.03125D; - this.field_186002_u = this.field_185994_m.func_151599_a(this.field_186002_u, (double)(p_185977_1_ * 16), (double)(p_185977_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); - -@@ -365,6 +386,8 @@ - boolean flag = false; - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_185931_1_, p_185931_2_); - -+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.field_185995_n, p_185931_1_, p_185931_2_, flag); -+ - if (this.field_185996_o) - { - if (this.field_186000_s.useMineShafts) -@@ -394,6 +417,7 @@ - } - - if (biomegenbase != Biomes.desert && biomegenbase != Biomes.desertHills && this.field_186000_s.useWaterLakes && !flag && this.field_185990_i.nextInt(this.field_186000_s.waterLakeChance) == 0) -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) - { - int i1 = this.field_185990_i.nextInt(16) + 8; - int j1 = this.field_185990_i.nextInt(256); -@@ -402,6 +426,7 @@ - } - - if (!flag && this.field_185990_i.nextInt(this.field_186000_s.lavaLakeChance / 10) == 0 && this.field_186000_s.useLavaLakes) -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA)) - { - int i2 = this.field_185990_i.nextInt(16) + 8; - int l2 = this.field_185990_i.nextInt(this.field_185990_i.nextInt(248) + 8); -@@ -414,6 +439,7 @@ - } - - if (this.field_186000_s.useDungeons) -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON)) - { - for (int j2 = 0; j2 < this.field_186000_s.dungeonChance; ++j2) - { -@@ -425,9 +451,12 @@ - } - - biomegenbase.decorate(this.field_185995_n, this.field_185990_i, new BlockPos(i, 0, j)); -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS)) - WorldEntitySpawner.performWorldGenSpawning(this.field_185995_n, biomegenbase, i + 8, j + 8, 16, 16, this.field_185990_i); - blockpos = blockpos.add(8, 0, 8); - -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE)) -+ { - for (int k2 = 0; k2 < 16; ++k2) - { - for (int j3 = 0; j3 < 16; ++j3) -@@ -446,7 +475,10 @@ - } - } - } -+ }//Forge: End ICE - -+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.field_185995_n, p_185931_1_, p_185931_2_, flag); -+ - BlockFalling.fallInstantly = false; - } - diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch deleted file mode 100644 index fe5a8cf44e..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch +++ /dev/null @@ -1,110 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderServer.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderServer.java -@@ -33,6 +33,7 @@ - public final LongHashMap id2ChunkMap = new LongHashMap(); - public final List loadedChunks = Lists.newArrayList(); - public final WorldServer worldObj; -+ private Set loadingChunks = com.google.common.collect.Sets.newHashSet(); - - public ChunkProviderServer(WorldServer p_i46838_1_, IChunkLoader p_i46838_2_, IChunkGenerator p_i46838_3_) - { -@@ -92,14 +93,65 @@ - - public Chunk func_186025_d(int p_186025_1_, int p_186025_2_) - { -+ return loadChunk(p_186025_1_, p_186025_2_, null); -+ } -+ -+ public Chunk loadChunk(int X, int Z, Runnable runnable) -+ { -+ long pos = ChunkCoordIntPair.chunkXZ2Int(X, Z); -+ this.droppedChunksSet.remove(Long.valueOf(pos)); -+ Chunk chunk = this.id2ChunkMap.getValueByKey(pos); -+ net.minecraft.world.chunk.storage.AnvilChunkLoader loader = null; -+ -+ if (this.chunkLoader instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader) -+ { -+ loader = (net.minecraft.world.chunk.storage.AnvilChunkLoader) this.chunkLoader; -+ } -+ -+ // We can only use the queue for already generated chunks -+ if (chunk == null && loader != null && loader.chunkExists(this.worldObj, X, Z)) -+ { -+ if (runnable != null) -+ { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.queueChunkLoad(this.worldObj, loader, this, X, Z, runnable); -+ return null; -+ } -+ else -+ { -+ chunk = net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(this.worldObj, loader, this, X, Z); -+ } -+ } -+ else if (chunk == null) -+ { -+ chunk = this.originalLoadChunk(X, Z); -+ } -+ -+ // If we didn't load the chunk async and have a callback run it now -+ if (runnable != null) -+ { -+ runnable.run(); -+ } -+ -+ return chunk; -+ } -+ -+ public Chunk originalLoadChunk(int p_186025_1_, int p_186025_2_) -+ { - Chunk chunk = this.func_186028_c(p_186025_1_, p_186025_2_); - - if (chunk == null) - { - long i = ChunkCoordIntPair.chunkXZ2Int(p_186025_1_, p_186025_2_); -- chunk = this.loadChunkFromFile(p_186025_1_, p_186025_2_); -+ if (!loadingChunks.add(i)) -+ { -+ net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in di >mension %d that is already being loaded. This will cause weird chunk breakages.", p_186025_1_, p_186025_2_, worldObj.provider.getDimension()); -+ } -+ chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(i, this.worldObj); - - if (chunk == null) -+ chunk = this.loadChunkFromFile(p_186025_1_, p_186025_2_); -+ -+ if (chunk == null) - { - try - { -@@ -118,6 +170,7 @@ - - this.id2ChunkMap.add(i, chunk); - this.loadedChunks.add(chunk); -+ loadingChunks.remove(i); - chunk.onChunkLoad(); - chunk.func_186030_a(this, this.field_186029_c); - } -@@ -214,6 +267,11 @@ - { - if (!this.worldObj.disableLevelSaving) - { -+ for (ChunkCoordIntPair forced : this.worldObj.getPersistentChunks().keySet()) -+ { -+ this.droppedChunksSet.remove(ChunkCoordIntPair.chunkXZ2Int(forced.chunkXPos, forced.chunkZPos)); -+ } -+ - for (int i = 0; i < 100; ++i) - { - if (!this.droppedChunksSet.isEmpty()) -@@ -228,6 +286,12 @@ - this.saveChunkExtraData(chunk); - this.id2ChunkMap.remove(olong.longValue()); - this.loadedChunks.remove(chunk); -+ net.minecraftforge.common.ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.chunkXZ2Int(chunk.xPosition, chunk.zPosition), chunk); -+ if(loadedChunks.size() == 0 && net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this.worldObj).size() == 0 && !net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimension())){ -+ net.minecraftforge.common.DimensionManager.unloadWorld(this.worldObj.provider.getDimension()); -+ return false; -+ } -+ - } - - this.droppedChunksSet.remove(olong); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch deleted file mode 100644 index 7d067708c7..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch +++ /dev/null @@ -1,121 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/MapGenCaves.java -+++ ../src-work/minecraft/net/minecraft/world/gen/MapGenCaves.java -@@ -141,9 +141,7 @@ - { - if (l1 >= 0 && l1 < 256) - { -- IBlockState iblockstate = p_180702_5_.getBlockState(j1, l1, k1); -- -- if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) -+ if (isOceanBlock(p_180702_5_, j1, l1, k1, p_180702_3_, p_180702_4_)) - { - flag3 = true; - } -@@ -181,33 +179,12 @@ - IBlockState iblockstate1 = p_180702_5_.getBlockState(j3, j2, i2); - IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.getBlockState(j3, j2 + 1, i2), field_186127_b); - -- if (iblockstate1.getBlock() == Blocks.grass || iblockstate1.getBlock() == Blocks.mycelium) -+ if (isTopBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_)) - { - flag1 = true; - } - -- if (this.func_175793_a(iblockstate1, iblockstate2)) -- { -- if (j2 - 1 < 10) -- { -- p_180702_5_.setBlockState(j3, j2, i2, field_186126_a); -- } -- else -- { -- p_180702_5_.setBlockState(j3, j2, i2, field_186127_b); -- -- if (iblockstate2.getBlock() == Blocks.sand) -- { -- p_180702_5_.setBlockState(j3, j2 + 1, i2, iblockstate2.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? field_186129_d : field_186128_c); -- } -- -- if (flag1 && p_180702_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) -- { -- blockpos$mutableblockpos.set(j3 + p_180702_3_ * 16, 0, i2 + p_180702_4_ * 16); -- p_180702_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock.getBlock().getDefaultState()); -- } -- } -- } -+ digBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2); - } - } - } -@@ -266,4 +243,71 @@ - } - } - } -+ -+ protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) -+ { -+ net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock(); -+ return block== Blocks.flowing_water || block == Blocks.water; -+ } -+ -+ //Exception biomes to make sure we generate like vanilla -+ private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) -+ { -+ if (biome == net.minecraft.init.Biomes.beach) return true; -+ if (biome == net.minecraft.init.Biomes.desert) return true; -+ return false; -+ } -+ -+ //Determine if the block at the specified location is the top block for the biome, we take into account -+ //Vanilla bugs to make sure that we generate the map the same way vanilla does. -+ private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) -+ { -+ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState state = data.getBlockState(x, y, z); -+ return (isExceptionBiome(biome) ? state.getBlock() == Blocks.grass : state.getBlock() == biome.topBlock); -+ } -+ -+ /** -+ * Digs out the current block, default implementation removes stone, filler, and top block -+ * Sets the block to lava if y is less then 10, and air other wise. -+ * If setting to air, it also checks to see if we've broken the surface and if so -+ * tries to make the floor the biome's top block -+ * -+ * @param data Block data array -+ * @param index Pre-calculated index into block data -+ * @param x local X position -+ * @param y local Y position -+ * @param z local Z position -+ * @param chunkX Chunk X position -+ * @param chunkZ Chunk Y position -+ * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface. -+ */ -+ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop, IBlockState state, IBlockState up) -+ { -+ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState top = biome.topBlock; -+ IBlockState filler = biome.fillerBlock; -+ -+ if (this.func_175793_a(state, up) || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) -+ { -+ if (y - 1 < 10) -+ { -+ data.setBlockState(x, y, z, field_186126_a); -+ } -+ else -+ { -+ data.setBlockState(x, y, z, field_186127_b); -+ -+ if (up.getBlock() == Blocks.sand) -+ { -+ data.setBlockState(x, y + 1, z, up.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? field_186129_d : field_186128_c); -+ } -+ -+ if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) -+ { -+ data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); -+ } -+ } -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch deleted file mode 100644 index ce7bbd4f67..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch +++ /dev/null @@ -1,124 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/MapGenRavine.java -+++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java -@@ -128,9 +128,7 @@ - { - if (l1 >= 0 && l1 < 256) - { -- IBlockState iblockstate = p_180707_5_.getBlockState(j1, l1, k1); -- -- if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) -+ if (isOceanBlock(p_180707_5_, j1, l1, k1, p_180707_3_, p_180707_4_)) - { - flag2 = true; - } -@@ -146,8 +144,6 @@ - - if (!flag2) - { -- BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); -- - for (int j3 = k2; j3 < k; ++j3) - { - double d10 = ((double)(j3 + p_180707_3_ * 16) + 0.5D - p_180707_6_) / d9; -@@ -165,30 +161,12 @@ - - if ((d10 * d10 + d7 * d7) * (double)this.field_75046_d[j2 - 1] + d8 * d8 / 6.0D < 1.0D) - { -- IBlockState iblockstate1 = p_180707_5_.getBlockState(j3, j2, i2); -- -- if (iblockstate1.getBlock() == Blocks.grass) -+ if (isTopBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_)) - { - flag = true; - } - -- if (iblockstate1.getBlock() == Blocks.stone || iblockstate1.getBlock() == Blocks.dirt || iblockstate1.getBlock() == Blocks.grass) -- { -- if (j2 - 1 < 10) -- { -- p_180707_5_.setBlockState(j3, j2, i2, field_186135_a); -- } -- else -- { -- p_180707_5_.setBlockState(j3, j2, i2, field_186136_b); -- -- if (flag && p_180707_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) -- { -- blockpos$mutableblockpos.set(j3 + p_180707_3_ * 16, 0, i2 + p_180707_4_ * 16); -- p_180707_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock); -- } -- } -- } -+ digBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_, flag); - } - } - } -@@ -223,4 +201,68 @@ - } - } - } -+ protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) -+ { -+ net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock(); -+ return block== Blocks.flowing_water || block == Blocks.water; -+ } -+ -+ //Exception biomes to make sure we generate like vanilla -+ private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) -+ { -+ if (biome == net.minecraft.init.Biomes.beach) return true; -+ if (biome == net.minecraft.init.Biomes.desert) return true; -+ if (biome == net.minecraft.init.Biomes.mushroomIsland) return true; -+ if (biome == net.minecraft.init.Biomes.mushroomIslandShore) return true; -+ return false; -+ } -+ -+ //Determine if the block at the specified location is the top block for the biome, we take into account -+ //Vanilla bugs to make sure that we generate the map the same way vanilla does. -+ private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) -+ { -+ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState state = data.getBlockState(x, y, z); -+ return (isExceptionBiome(biome) ? state.getBlock() == Blocks.grass : state.getBlock() == biome.topBlock); -+ } -+ -+ /** -+ * Digs out the current block, default implementation removes stone, filler, and top block -+ * Sets the block to lava if y is less then 10, and air other wise. -+ * If setting to air, it also checks to see if we've broken the surface and if so -+ * tries to make the floor the biome's top block -+ * -+ * @param data Block data array -+ * @param index Pre-calculated index into block data -+ * @param x local X position -+ * @param y local Y position -+ * @param z local Z position -+ * @param chunkX Chunk X position -+ * @param chunkZ Chunk Y position -+ * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface. -+ */ -+ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop) -+ { -+ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState state = data.getBlockState(x, y, z); -+ IBlockState top = isExceptionBiome(biome) ? Blocks.grass.getDefaultState() : biome.topBlock; -+ IBlockState filler = isExceptionBiome(biome) ? Blocks.dirt.getDefaultState() : biome.fillerBlock; -+ -+ if (state.getBlock() == Blocks.stone || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) -+ { -+ if (y - 1 < 10) -+ { -+ data.setBlockState(x, y, z, field_186135_a); -+ } -+ else -+ { -+ data.setBlockState(x, y, z, field_186136_b); -+ -+ if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) -+ { -+ data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); -+ } -+ } -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch deleted file mode 100644 index aa33cb6073..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java -@@ -31,4 +31,10 @@ - this.setBlockAndNotifyAdequately(worldIn, p_175921_2_, Blocks.dirt.getDefaultState()); - } - } -+ -+ public boolean isReplaceable(World world, BlockPos pos) -+ { -+ net.minecraft.block.state.IBlockState state = world.getBlockState(pos); -+ return state.getBlock().isAir(state, world, pos) || state.getBlock().isLeaves(state, world, pos) || state.getBlock().isWood(world, pos) || func_150523_a(state.getBlock()); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch deleted file mode 100644 index 72784ad60b..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java -@@ -56,9 +56,9 @@ - { - if (j >= 0 && j < 256) - { -- Material material = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).func_185904_a(); -+ IBlockState state = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)); - -- if (material != Material.air && material != Material.leaves) -+ if (!state.getBlock().isAir(state, worldIn, blockpos$mutableblockpos) && !state.getBlock().isLeaves(state, worldIn, blockpos$mutableblockpos)) - { - flag = false; - } -@@ -193,8 +193,9 @@ - if (position.getY() >= position.getY() + i - 1 || blockhugemushroom$enumtype != BlockHugeMushroom.EnumType.ALL_INSIDE) - { - BlockPos blockpos = new BlockPos(l1, l2, i2); -+ IBlockState state = worldIn.getBlockState(blockpos); - -- if (!worldIn.getBlockState(blockpos).func_185913_b()) -+ if (state.getBlock().canBeReplacedByLeaves(state, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, block.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, blockhugemushroom$enumtype)); - } -@@ -207,7 +208,7 @@ - { - IBlockState iblockstate = worldIn.getBlockState(position.up(i3)); - -- if (!iblockstate.func_185913_b()) -+ if (iblockstate.getBlock().canBeReplacedByLeaves(iblockstate, worldIn, position.up(i3))) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(i3), block.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, BlockHugeMushroom.EnumType.STEM)); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch deleted file mode 100644 index 81386001d6..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java -@@ -99,9 +99,9 @@ - if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_181631_2_ * p_181631_2_)) - { - BlockPos blockpos = p_181631_1_.add(j, 0, k); -- Material material = this.world.getBlockState(blockpos).func_185904_a(); -+ IBlockState state = this.world.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(state, world, blockpos) || state.getBlock().isLeaves(state, world, blockpos)) - { - this.setBlockAndNotifyAdequately(this.world, blockpos, p_181631_3_); - } -@@ -254,7 +254,7 @@ - { - BlockPos blockpos1 = posOne.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); - -- if (!this.func_150523_a(this.world.getBlockState(blockpos1).getBlock())) -+ if (!this.isReplaceable(world, blockpos1)) - { - return j; - } -@@ -282,6 +282,7 @@ - - if (!this.validTreeLocation()) - { -+ this.world = null; //Fix vanilla Mem leak, holds latest world - return false; - } - else -@@ -290,15 +291,18 @@ - this.generateLeaves(); - this.generateTrunk(); - this.generateLeafNodeBases(); -+ this.world = null; //Fix vanilla Mem leak, holds latest world - return true; - } - } - - private boolean validTreeLocation() - { -- Block block = this.world.getBlockState(this.basePos.down()).getBlock(); -+ BlockPos down = this.basePos.down(); -+ net.minecraft.block.state.IBlockState state = this.world.getBlockState(down); -+ boolean isSoil = state.getBlock().canSustainPlant(state, this.world, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if (block != Blocks.dirt && block != Blocks.grass && block != Blocks.farmland) -+ if (!isSoil) - { - return false; - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch deleted file mode 100644 index f92c104f12..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java -@@ -8,6 +8,7 @@ - import net.minecraft.block.material.Material; - import net.minecraft.block.state.IBlockState; - import net.minecraft.init.Blocks; -+import net.minecraft.util.EnumFacing; - import net.minecraft.util.math.BlockPos; - import net.minecraft.world.World; - -@@ -56,9 +57,9 @@ - { - for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) - { -- if (j >= 0 && j < 256) -+ if (j >= 0 && j < worldIn.getHeight()) - { -- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock())) -+ if (!this.isReplaceable(worldIn, blockpos$mutableblockpos.set(l, j, i1))) - { - flag = false; - } -@@ -77,11 +78,13 @@ - } - else - { -- Block block = worldIn.getBlockState(position.down()).getBlock(); -+ BlockPos down = position.down(); -+ IBlockState state = worldIn.getBlockState(down); -+ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, down, EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); - -- if ((block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland) && position.getY() < 256 - i - 1) -+ if (isSoil && position.getY() < worldIn.getHeight() - i - 1) - { -- this.func_175921_a(worldIn, position.down()); -+ state.getBlock().onPlantGrow(state, worldIn, down, position); - - for (int i2 = position.getY() - 3 + i; i2 <= position.getY() + i; ++i2) - { -@@ -99,9 +102,9 @@ - if (Math.abs(j1) != l2 || Math.abs(l1) != l2 || rand.nextInt(2) != 0 && k2 != 0) - { - BlockPos blockpos = new BlockPos(i3, i2, k1); -- Material material = worldIn.getBlockState(blockpos).func_185904_a(); -+ IBlockState state2 = worldIn.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves) -+ if (state2.getBlock().isAir(state2, worldIn, blockpos) || state2.getBlock().isAir(state2, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181630_b); - } -@@ -112,9 +115,10 @@ - - for (int j2 = 0; j2 < i; ++j2) - { -- Material material1 = worldIn.getBlockState(position.up(j2)).func_185904_a(); -+ BlockPos upN = position.up(j2); -+ IBlockState state2 = worldIn.getBlockState(upN); - -- if (material1 == Material.air || material1 == Material.leaves) -+ if (state2.getBlock().isAir(state2, worldIn, upN) || state2.getBlock().isLeaves(state2, worldIn, upN)) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(j2), field_181629_a); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java.patch deleted file mode 100644 index 2949665850..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java -@@ -20,7 +20,7 @@ - { - BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8)); - -- if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky() || blockpos.getY() < 255) && this.field_175908_a.canBlockStay(worldIn, blockpos, this.field_175908_a.getDefaultState())) -+ if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky() || blockpos.getY() < worldIn.getHeight() - 1) && this.field_175908_a.canBlockStay(worldIn, blockpos, this.field_175908_a.getDefaultState())) - { - worldIn.setBlockState(blockpos, this.field_175908_a.getDefaultState(), 2); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch deleted file mode 100644 index 41b7963de6..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java -@@ -33,9 +33,10 @@ - if (k >= 1 && k + i + 1 < 256) - { - BlockPos blockpos = position.down(); -- Block block = worldIn.getBlockState(blockpos).getBlock(); -+ IBlockState state = worldIn.getBlockState(blockpos); -+ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if (block != Blocks.grass && block != Blocks.dirt) -+ if (!(isSoil && position.getY() < worldIn.getHeight() - i - 1)) - { - return false; - } -@@ -45,10 +46,10 @@ - } - else - { -- this.func_175921_a(worldIn, blockpos); -- this.func_175921_a(worldIn, blockpos.east()); -- this.func_175921_a(worldIn, blockpos.south()); -- this.func_175921_a(worldIn, blockpos.south().east()); -+ this.onPlantGrow(worldIn, blockpos, position); -+ this.onPlantGrow(worldIn, blockpos.east(), position); -+ this.onPlantGrow(worldIn, blockpos.south(), position); -+ this.onPlantGrow(worldIn, blockpos.south().east(), position); - EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand); - int i1 = i - rand.nextInt(4); - int j1 = 2 - rand.nextInt(3); -@@ -67,9 +68,9 @@ - - int k2 = k + j2; - BlockPos blockpos1 = new BlockPos(k1, k2, l1); -- Material material = worldIn.getBlockState(blockpos1).func_185904_a(); -+ state = worldIn.getBlockState(blockpos1); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(state, worldIn, blockpos1) || state.getBlock().isLeaves(state, worldIn, blockpos1)) - { - this.func_181639_b(worldIn, blockpos1); - this.func_181639_b(worldIn, blockpos1.east()); -@@ -187,7 +188,7 @@ - { - for (int k1 = -i1; k1 <= i1; ++k1) - { -- if (!this.func_150523_a(p_181638_1_.getBlockState(blockpos$mutableblockpos.set(i + j1, j + l, k + k1)).getBlock())) -+ if (!this.isReplaceable(p_181638_1_, blockpos$mutableblockpos.set(i + j1, j + l, k + k1))) - { - return false; - } -@@ -209,11 +210,18 @@ - private void func_150526_a(World worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) - { - BlockPos blockpos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); -- Material material = worldIn.getBlockState(blockpos).func_185904_a(); -+ IBlockState state = worldIn.getBlockState(blockpos); - -- if (material == Material.air) -+ if (state.getBlock().isAir(state, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181641_b); - } - } -+ -+ //Just a helper macro -+ private void onPlantGrow(World world, BlockPos pos, BlockPos source) -+ { -+ IBlockState state = world.getBlockState(pos); -+ state.getBlock().onPlantGrow(state, world, pos, source); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch deleted file mode 100644 index da651f127e..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java -@@ -11,12 +11,12 @@ - { - public boolean generate(World worldIn, Random rand, BlockPos position) - { -- IBlockState iblockstate; -- -- while (((iblockstate = worldIn.getBlockState(position)).func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) && position.getY() > 0) -+ do - { -+ IBlockState state = worldIn.getBlockState(position); -+ if (!state.getBlock().isAir(state, worldIn, position) && !state.getBlock().isLeaves(state, worldIn, position)) break; - position = position.down(); -- } -+ } while (position.getY() > 0); - - for (int i = 0; i < 4; ++i) - { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch deleted file mode 100644 index 1986b2cd5c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java -@@ -154,6 +154,6 @@ - - private String pickMobSpawner(Random p_76543_1_) - { -- return SPAWNERTYPES[p_76543_1_.nextInt(SPAWNERTYPES.length)]; -+ return net.minecraftforge.common.DungeonHooks.getRandomDungeonMob(p_76543_1_); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java.patch deleted file mode 100644 index 3108f459fe..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java -@@ -27,7 +27,7 @@ - { - BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), -rand.nextInt(12), rand.nextInt(8) - rand.nextInt(8)); - -- if (worldIn.getBlockState(blockpos).func_185904_a() == Material.air) -+ if (worldIn.isAirBlock(blockpos)) - { - int j = 0; - diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java.patch deleted file mode 100644 index 649c43e9bc..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java -@@ -27,7 +27,7 @@ - { - BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), -rand.nextInt(12), rand.nextInt(8) - rand.nextInt(8)); - -- if (worldIn.getBlockState(blockpos).func_185904_a() == Material.air) -+ if (worldIn.isAirBlock(blockpos)) - { - int j = 0; - diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java.patch deleted file mode 100644 index 2b60c9804c..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java -@@ -24,7 +24,7 @@ - { - return false; - } -- else if (worldIn.getBlockState(position).func_185904_a() != Material.air && worldIn.getBlockState(position).getBlock() != Blocks.netherrack) -+ else if (!worldIn.isAirBlock(position) && worldIn.getBlockState(position).getBlock() != Blocks.netherrack) - { - return false; - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch deleted file mode 100644 index 4a87bd3802..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java -@@ -59,7 +59,7 @@ - { - for (int l = -j; l <= j && flag; ++l) - { -- if (p_175926_2_.getY() + i < 0 || p_175926_2_.getY() + i >= 256 || !this.func_150523_a(worldIn.getBlockState(p_175926_2_.add(k, i, l)).getBlock())) -+ if (p_175926_2_.getY() + i < 0 || p_175926_2_.getY() + i >= 256 || !this.isReplaceable(worldIn,p_175926_2_.add(k, i, l))) - { - flag = false; - } -@@ -78,14 +78,15 @@ - private boolean func_175927_a(BlockPos p_175927_1_, World worldIn) - { - BlockPos blockpos = p_175927_1_.down(); -- Block block = worldIn.getBlockState(blockpos).getBlock(); -+ IBlockState state = worldIn.getBlockState(blockpos); -+ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if ((block == Blocks.grass || block == Blocks.dirt) && p_175927_1_.getY() >= 2) -+ if (isSoil && p_175927_1_.getY() >= 2) - { -- this.func_175921_a(worldIn, blockpos); -- this.func_175921_a(worldIn, blockpos.east()); -- this.func_175921_a(worldIn, blockpos.south()); -- this.func_175921_a(worldIn, blockpos.south().east()); -+ this.onPlantGrow(worldIn, blockpos, p_175927_1_); -+ this.onPlantGrow(worldIn, blockpos.east(), p_175927_1_); -+ this.onPlantGrow(worldIn, blockpos.south(), p_175927_1_); -+ this.onPlantGrow(worldIn, blockpos.south().east(), p_175927_1_); - return true; - } - else -@@ -113,9 +114,9 @@ - if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) - { - BlockPos blockpos = p_175925_2_.add(j, 0, k); -- Material material = worldIn.getBlockState(blockpos).func_185904_a(); -+ IBlockState state = worldIn.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); - } -@@ -135,9 +136,9 @@ - if (j * j + k * k <= i) - { - BlockPos blockpos = p_175928_2_.add(j, 0, k); -- Material material = worldIn.getBlockState(blockpos).func_185904_a(); -+ IBlockState state = worldIn.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); - } -@@ -145,4 +146,11 @@ - } - } - } -+ -+ //Just a helper macro -+ private void onPlantGrow(World world, BlockPos pos, BlockPos source) -+ { -+ IBlockState state = world.getBlockState(pos); -+ state.getBlock().onPlantGrow(state, world, pos, source); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java.patch deleted file mode 100644 index e3a4429626..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java -@@ -51,7 +51,7 @@ - IBlockState iblockstate = worldIn.getBlockState(position.add(i1, k, j1)); - Block block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() == Material.air || block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice) -+ if (iblockstate.getBlock().isAir(iblockstate, worldIn, position.add(i1, k, j1)) || block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice) - { - this.setBlockAndNotifyAdequately(worldIn, position.add(i1, k, j1), Blocks.packed_ice.getDefaultState()); - } -@@ -61,7 +61,7 @@ - iblockstate = worldIn.getBlockState(position.add(i1, -k, j1)); - block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() == Material.air || block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice) -+ if (iblockstate.getBlock().isAir(iblockstate, worldIn, position.add(i1, -k, j1)) || block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice) - { - this.setBlockAndNotifyAdequately(worldIn, position.add(i1, -k, j1), Blocks.packed_ice.getDefaultState()); - } -@@ -99,7 +99,7 @@ - IBlockState iblockstate1 = worldIn.getBlockState(blockpos); - Block block1 = iblockstate1.getBlock(); - -- if (iblockstate1.func_185904_a() != Material.air && block1 != Blocks.dirt && block1 != Blocks.snow && block1 != Blocks.ice && block1 != Blocks.packed_ice) -+ if (!iblockstate1.getBlock().isAir(iblockstate1, worldIn, blockpos) && block1 != Blocks.dirt && block1 != Blocks.snow && block1 != Blocks.ice && block1 != Blocks.packed_ice) - { - break; - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java.patch deleted file mode 100644 index 36c45d5d3e..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java -@@ -26,7 +26,7 @@ - { - return false; - } -- else if (worldIn.getBlockState(position).func_185904_a() != Material.air && worldIn.getBlockState(position).getBlock() != Blocks.stone) -+ else if (!worldIn.isAirBlock(position) && worldIn.getBlockState(position).getBlock() != Blocks.stone) - { - return false; - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch deleted file mode 100644 index 54882ef4d3..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java -@@ -55,7 +55,7 @@ - { - BlockPos blockpos = position.up(i2); - -- if (this.func_150523_a(worldIn.getBlockState(blockpos).getBlock())) -+ if (this.isAirLeaves(worldIn,blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.woodMetadata); - -@@ -70,7 +70,7 @@ - { - BlockPos blockpos1 = blockpos.east(); - -- if (this.func_150523_a(worldIn.getBlockState(blockpos1).getBlock())) -+ if (this.isAirLeaves(worldIn,blockpos1)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos1, this.woodMetadata); - -@@ -83,7 +83,7 @@ - - BlockPos blockpos2 = blockpos.south().east(); - -- if (this.func_150523_a(worldIn.getBlockState(blockpos2).getBlock())) -+ if (this.isAirLeaves(worldIn,blockpos2)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos2, this.woodMetadata); - -@@ -96,7 +96,7 @@ - - BlockPos blockpos3 = blockpos.south(); - -- if (this.func_150523_a(worldIn.getBlockState(blockpos3).getBlock())) -+ if (this.isAirLeaves(worldIn,blockpos3)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos3, this.woodMetadata); - -@@ -130,4 +130,11 @@ - this.func_175925_a(worldIn, p_175930_2_.up(j), p_175930_3_ + 1 - j); - } - } -+ -+ //Helper macro -+ private boolean isAirLeaves(World world, BlockPos pos) -+ { -+ IBlockState state = world.getBlockState(pos); -+ return state.getBlock().isAir(state, world, pos) || state.getBlock().isLeaves(state, world, pos); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch deleted file mode 100644 index da814bc5cd..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java -@@ -41,32 +41,25 @@ - - for (int j = 0; j < i; ++j) - { -- IBlockState iblockstate = worldIn.getBlockState(position.up(j)); -- -- if (iblockstate.func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) -+ if (isAirLeaves(worldIn, position.up(j))) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(j), this.woodMetadata); - } - - if (j < i - 1) - { -- iblockstate = worldIn.getBlockState(position.add(1, j, 0)); -- -- if (iblockstate.func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) -+ if (isAirLeaves(worldIn, position.add(1, j, 0))) - { - this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 0), this.woodMetadata); - } - -- iblockstate = worldIn.getBlockState(position.add(1, j, 1)); -- -- if (iblockstate.func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) -+ if (isAirLeaves(worldIn, position.add(1, j, 1))) - { - this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 1), this.woodMetadata); - } - -- iblockstate = worldIn.getBlockState(position.add(0, j, 1)); - -- if (iblockstate.func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) -+ if (isAirLeaves(worldIn, position.add(0, j, 1))) - { - this.setBlockAndNotifyAdequately(worldIn, position.add(0, j, 1), this.woodMetadata); - } -@@ -133,7 +126,7 @@ - IBlockState iblockstate = worldIn.getBlockState(blockpos); - Block block = iblockstate.getBlock(); - -- if (block == Blocks.grass || block == Blocks.dirt) -+ if (block.canSustainPlant(iblockstate, worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181635_g); - break; -@@ -145,4 +138,11 @@ - } - } - } -+ -+ //Helper macro -+ private boolean isAirLeaves(World world, BlockPos pos) -+ { -+ IBlockState state = world.getBlockState(pos); -+ return state.getBlock().isAir(state, world, pos) || state.getBlock().isLeaves(state, world, pos); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch deleted file mode 100644 index bc5a4713c8..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java -@@ -73,7 +73,8 @@ - { - BlockPos blockpos = new BlockPos(l1, i2, j2); - -- if (this.predicate.apply(worldIn.getBlockState(blockpos))) -+ IBlockState state = worldIn.getBlockState(blockpos); -+ if (state.getBlock().isReplaceableOreGen(state, worldIn, blockpos, this.predicate)) - { - worldIn.setBlockState(blockpos, this.oreBlock, 2); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch deleted file mode 100644 index 50dad44e18..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java -@@ -52,7 +52,7 @@ - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock())) -+ if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.set(l, j, i1))) - { - flag = false; - } -@@ -71,11 +71,13 @@ - } - else - { -- Block block = worldIn.getBlockState(position.down()).getBlock(); -+ BlockPos down = position.down(); -+ IBlockState state = worldIn.getBlockState(down); -+ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if ((block == Blocks.grass || block == Blocks.dirt) && position.getY() < 256 - i - 1) -+ if (isSoil && position.getY() < worldIn.getHeight() - i - 1) - { -- this.func_175921_a(worldIn, position.down()); -+ state.getBlock().onPlantGrow(state, worldIn, down, position); - EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand); - int k2 = i - rand.nextInt(4) - 1; - int l2 = 3 - rand.nextInt(3); -@@ -95,9 +97,9 @@ - } - - BlockPos blockpos = new BlockPos(i3, i2, j1); -- Material material = worldIn.getBlockState(blockpos).func_185904_a(); -+ state = worldIn.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos)) - { - this.func_181642_b(worldIn, blockpos); - k1 = i2; -@@ -149,9 +151,9 @@ - i3 += enumfacing1.getFrontOffsetX(); - j1 += enumfacing1.getFrontOffsetZ(); - BlockPos blockpos1 = new BlockPos(i3, j2, j1); -- Material material1 = worldIn.getBlockState(blockpos1).func_185904_a(); -+ state = worldIn.getBlockState(blockpos1); - -- if (material1 == Material.air || material1 == Material.leaves) -+ if (state.getBlock().isAir(state, worldIn, blockpos1) || state.getBlock().isLeaves(state, worldIn, blockpos1)) - { - this.func_181642_b(worldIn, blockpos1); - k1 = j2; -@@ -209,9 +211,9 @@ - - private void func_175924_b(World worldIn, BlockPos p_175924_2_) - { -- Material material = worldIn.getBlockState(p_175924_2_).func_185904_a(); -+ IBlockState state = worldIn.getBlockState(p_175924_2_); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(state, worldIn, p_175924_2_) || state.getBlock().isLeaves(state, worldIn, p_175924_2_)) - { - this.setBlockAndNotifyAdequately(worldIn, p_175924_2_, field_181644_b); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch deleted file mode 100644 index b5fb605796..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java -@@ -22,16 +22,16 @@ - - public boolean generate(World worldIn, Random rand, BlockPos position) - { -- IBlockState iblockstate; -- -- while (((iblockstate = worldIn.getBlockState(position)).func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) && position.getY() > 0) -+ do - { -+ IBlockState state = worldIn.getBlockState(position); -+ if (!state.getBlock().isLeaves(state, worldIn, position) && !state.getBlock().isLeaves(state, worldIn, position)) break; - position = position.down(); -- } -+ } while (position.getY() > 0); - -- Block block = worldIn.getBlockState(position).getBlock(); -+ IBlockState state = worldIn.getBlockState(position); - -- if (block == Blocks.dirt || block == Blocks.grass) -+ if (state.getBlock().canSustainPlant(state, worldIn, position, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) - { - position = position.up(); - this.setBlockAndNotifyAdequately(worldIn, position, this.woodMetadata); -@@ -52,9 +52,9 @@ - if (Math.abs(i1) != k || Math.abs(k1) != k || rand.nextInt(2) != 0) - { - BlockPos blockpos = new BlockPos(l, i, j1); -- Material material = worldIn.getBlockState(blockpos).func_185904_a(); -+ state = worldIn.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().canBeReplacedByLeaves(state, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch deleted file mode 100644 index 1adcecd9c6..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch +++ /dev/null @@ -1,98 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java -@@ -61,7 +61,7 @@ - IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)); - Block block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() != Material.air && iblockstate.func_185904_a() != Material.leaves) -+ if (!iblockstate.getBlock().isAir(iblockstate, worldIn, blockpos$mutableblockpos.set(l, j, i1)) && !iblockstate.getBlock().isLeaves(iblockstate, worldIn, blockpos$mutableblockpos.set(l, j, i1))) - { - if (block != Blocks.water && block != Blocks.flowing_water) - { -@@ -87,11 +87,13 @@ - } - else - { -- Block block1 = worldIn.getBlockState(position.down()).getBlock(); -+ BlockPos down = position.down(); -+ IBlockState state = worldIn.getBlockState(down); -+ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if ((block1 == Blocks.grass || block1 == Blocks.dirt) && position.getY() < 256 - i - 1) -+ if (isSoil && position.getY() < worldIn.getHeight() - i - 1) - { -- this.func_175921_a(worldIn, position.down()); -+ state.getBlock().onPlantGrow(state, worldIn, position.down(),position); - - for (int k1 = position.getY() - 3 + i; k1 <= position.getY() + i; ++k1) - { -@@ -109,8 +111,9 @@ - if (Math.abs(k3) != l2 || Math.abs(j1) != l2 || rand.nextInt(2) != 0 && j2 != 0) - { - BlockPos blockpos = new BlockPos(j3, k1, i4); -+ state = worldIn.getBlockState(blockpos); - -- if (!worldIn.getBlockState(blockpos).func_185913_b()) -+ if (state.getBlock().canBeReplacedByLeaves(state, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181649_b); - } -@@ -121,10 +124,11 @@ - - for (int l1 = 0; l1 < i; ++l1) - { -- IBlockState iblockstate1 = worldIn.getBlockState(position.up(l1)); -+ BlockPos upN = position.up(l1); -+ IBlockState iblockstate1 = worldIn.getBlockState(upN); - Block block2 = iblockstate1.getBlock(); - -- if (iblockstate1.func_185904_a() == Material.air || iblockstate1.func_185904_a() == Material.leaves || block2 == Blocks.flowing_water || block2 == Blocks.water) -+ if (block2.isAir(iblockstate1, worldIn, upN) || block2.isLeaves(iblockstate1, worldIn, upN) || block2 == Blocks.flowing_water || block2 == Blocks.water) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(l1), field_181648_a); - } -@@ -149,22 +153,22 @@ - BlockPos blockpos1 = blockpos$mutableblockpos1.north(); - BlockPos blockpos2 = blockpos$mutableblockpos1.south(); - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).func_185904_a() == Material.air) -+ if (rand.nextInt(4) == 0 && isAir(worldIn, blockpos3)) - { - this.func_181647_a(worldIn, blockpos3, BlockVine.EAST); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).func_185904_a() == Material.air) -+ if (rand.nextInt(4) == 0 && isAir(worldIn, blockpos4)) - { - this.func_181647_a(worldIn, blockpos4, BlockVine.WEST); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).func_185904_a() == Material.air) -+ if (rand.nextInt(4) == 0 && isAir(worldIn, blockpos1)) - { - this.func_181647_a(worldIn, blockpos1, BlockVine.SOUTH); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).func_185904_a() == Material.air) -+ if (rand.nextInt(4) == 0 && isAir(worldIn, blockpos2)) - { - this.func_181647_a(worldIn, blockpos2, BlockVine.NORTH); - } -@@ -193,10 +197,16 @@ - this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); - int i = 4; - -- for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).func_185904_a() == Material.air && i > 0; --i) -+ for (p_181647_2_ = p_181647_2_.down(); isAir(p_181647_1_, p_181647_2_) && i > 0; --i) - { - this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); - p_181647_2_ = p_181647_2_.down(); - } - } -+ -+ private boolean isAir(World world, BlockPos pos) -+ { -+ IBlockState state = world.getBlockState(pos); -+ return state.getBlock().isAir(state, world, pos); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch deleted file mode 100644 index fba5e3c2c8..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java -@@ -53,7 +53,7 @@ - { - if (i1 >= 0 && i1 < 256) - { -- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(k1, i1, l1)).getBlock())) -+ if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.set(k1, i1, l1))) - { - flag = false; - } -@@ -72,11 +72,13 @@ - } - else - { -- Block block = worldIn.getBlockState(position.down()).getBlock(); -+ BlockPos down = position.down(); -+ IBlockState state = worldIn.getBlockState(down); -+ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); - -- if ((block == Blocks.grass || block == Blocks.dirt) && position.getY() < 256 - i - 1) -+ if (isSoil && position.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, position.down()); -+ state.getBlock().onPlantGrow(state, worldIn, down, position); - int k2 = 0; - - for (int l2 = position.getY() + i; l2 >= position.getY() + j; --l2) -@@ -92,8 +94,9 @@ - if (Math.abs(k3) != k2 || Math.abs(j2) != k2 || k2 <= 0) - { - BlockPos blockpos = new BlockPos(j3, l2, i2); -+ state = worldIn.getBlockState(blockpos); - -- if (!worldIn.getBlockState(blockpos).func_185913_b()) -+ if (state.getBlock().canBeReplacedByLeaves(state, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181637_b); - } -@@ -113,9 +116,10 @@ - - for (int i3 = 0; i3 < i - 1; ++i3) - { -- Material material = worldIn.getBlockState(position.up(i3)).func_185904_a(); -+ BlockPos upN = position.up(i3); -+ state = worldIn.getBlockState(upN); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN)) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(i3), field_181636_a); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch deleted file mode 100644 index e4b0a43f86..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java -@@ -30,7 +30,7 @@ - int l = 2 + rand.nextInt(2); - boolean flag = true; - -- if (position.getY() >= 1 && position.getY() + i + 1 <= 256) -+ if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) - { - for (int i1 = position.getY(); i1 <= position.getY() + 1 + i && flag; ++i1) - { -@@ -51,11 +51,11 @@ - { - for (int l1 = position.getZ() - j1; l1 <= position.getZ() + j1 && flag; ++l1) - { -- if (i1 >= 0 && i1 < 256) -+ if (i1 >= 0 && i1 < worldIn.getHeight()) - { -- Material material = worldIn.getBlockState(blockpos$mutableblockpos.set(k1, i1, l1)).func_185904_a(); -+ IBlockState state = worldIn.getBlockState(blockpos$mutableblockpos.set(k1, i1, l1)); - -- if (material != Material.air && material != Material.leaves) -+ if (!state.getBlock().isAir(state, worldIn, blockpos$mutableblockpos.set(k1, i1, l1)) && !state.getBlock().isLeaves(state, worldIn, blockpos$mutableblockpos.set(k1, i1, l1))) - { - flag = false; - } -@@ -74,11 +74,12 @@ - } - else - { -- Block block = worldIn.getBlockState(position.down()).getBlock(); -+ BlockPos down = position.down(); -+ IBlockState state = worldIn.getBlockState(down); - -- if ((block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland) && position.getY() < 256 - i - 1) -+ if (state.getBlock().canSustainPlant(state, worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling) && position.getY() < worldIn.getHeight() - i - 1) - { -- this.func_175921_a(worldIn, position.down()); -+ state.getBlock().onPlantGrow(state, worldIn, down, position); - int i3 = rand.nextInt(2); - int j3 = 1; - int k3 = 0; -@@ -98,8 +99,9 @@ - if (Math.abs(j2) != i3 || Math.abs(l2) != i3 || i3 <= 0) - { - BlockPos blockpos = new BlockPos(i2, j4, k2); -+ state = worldIn.getBlockState(blockpos); - -- if (!worldIn.getBlockState(blockpos).func_185913_b()) -+ if (state.getBlock().canBeReplacedByLeaves(state, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181646_b); - } -@@ -128,9 +130,10 @@ - - for (int k4 = 0; k4 < i - i4; ++k4) - { -- Material material1 = worldIn.getBlockState(position.up(k4)).func_185904_a(); -+ BlockPos upN = position.up(k4); -+ state = worldIn.getBlockState(upN); - -- if (material1 == Material.air || material1 == Material.leaves) -+ if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN)) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(k4), field_181645_a); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch deleted file mode 100644 index 0dafce7542..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java -@@ -19,12 +19,12 @@ - - public boolean generate(World worldIn, Random rand, BlockPos position) - { -- IBlockState iblockstate; -- -- while (((iblockstate = worldIn.getBlockState(position)).func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) && position.getY() > 0) -+ do - { -+ IBlockState state = worldIn.getBlockState(position); -+ if (!state.getBlock().isAir(state, worldIn, position) && !state.getBlock().isLeaves(state, worldIn, position)) break; - position = position.down(); -- } -+ } while (position.getY() > 0); - - for (int i = 0; i < 128; ++i) - { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch deleted file mode 100644 index 4b2a82109e..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch +++ /dev/null @@ -1,105 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java -@@ -44,7 +44,7 @@ - int i = rand.nextInt(3) + this.minTreeHeight; - boolean flag = true; - -- if (position.getY() >= 1 && position.getY() + i + 1 <= 256) -+ if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) - { - for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) - { -@@ -66,9 +66,9 @@ - { - for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) - { -- if (j >= 0 && j < 256) -+ if (j >= 0 && j < worldIn.getHeight()) - { -- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock())) -+ if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.set(l, j, i1))) - { - flag = false; - } -@@ -87,9 +87,9 @@ - } - else - { -- Block block = worldIn.getBlockState(position.down()).getBlock(); -+ IBlockState state = worldIn.getBlockState(position.down()); - -- if ((block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland) && position.getY() < 256 - i - 1) -+ if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling) && position.getY() < worldIn.getHeight() - i - 1) - { - this.func_175921_a(worldIn, position.down()); - int k2 = 3; -@@ -111,9 +111,9 @@ - if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || rand.nextInt(2) != 0 && i4 != 0) - { - BlockPos blockpos = new BlockPos(k1, i3, i2); -- Material material = worldIn.getBlockState(blockpos).func_185904_a(); -+ state = worldIn.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves || material == Material.vine) -+ if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.func_185904_a() == Material.vine) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves); - } -@@ -124,9 +124,10 @@ - - for (int j3 = 0; j3 < i; ++j3) - { -- Material material1 = worldIn.getBlockState(position.up(j3)).func_185904_a(); -+ BlockPos upN = position.up(j3); -+ state = worldIn.getBlockState(upN); - -- if (material1 == Material.air || material1 == Material.leaves || material1 == Material.vine) -+ if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.func_185904_a() == Material.vine) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood); - -@@ -169,29 +170,30 @@ - { - blockpos$mutableblockpos1.set(l4, k3, i5); - -- if (worldIn.getBlockState(blockpos$mutableblockpos1).func_185904_a() == Material.leaves) -+ state = worldIn.getBlockState(blockpos$mutableblockpos1); -+ if (state.getBlock().isLeaves(state, worldIn, blockpos$mutableblockpos1)) - { - BlockPos blockpos2 = blockpos$mutableblockpos1.west(); - BlockPos blockpos3 = blockpos$mutableblockpos1.east(); - BlockPos blockpos4 = blockpos$mutableblockpos1.north(); - BlockPos blockpos1 = blockpos$mutableblockpos1.south(); - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).func_185904_a() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.isAirBlock(blockpos2)) - { - this.func_181650_b(worldIn, blockpos2, BlockVine.EAST); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).func_185904_a() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.isAirBlock(blockpos3)) - { - this.func_181650_b(worldIn, blockpos3, BlockVine.WEST); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).func_185904_a() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.isAirBlock(blockpos4)) - { - this.func_181650_b(worldIn, blockpos4, BlockVine.SOUTH); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).func_185904_a() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.isAirBlock(blockpos1)) - { - this.func_181650_b(worldIn, blockpos1, BlockVine.NORTH); - } -@@ -245,7 +247,7 @@ - this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); - int i = 4; - -- for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).func_185904_a() == Material.air && i > 0; --i) -+ for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.isAirBlock(p_181650_2_) && i > 0; --i) - { - this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); - p_181650_2_ = p_181650_2_.down(); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch deleted file mode 100644 index 9ff41f8ecf..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java -@@ -14,12 +14,12 @@ - { - public boolean generate(World worldIn, Random rand, BlockPos position) - { -- IBlockState iblockstate; -- -- while (((iblockstate = worldIn.getBlockState(position)).func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) && position.getY() > 1) -+ do - { -+ IBlockState state = worldIn.getBlockState(position); -+ if (!state.getBlock().isAir(state, worldIn, position) && !state.getBlock().isLeaves(state, worldIn, position)) break; - position = position.down(); -- } -+ } while (position.getY() > 0); - - if (position.getY() < 1) - { -@@ -33,7 +33,7 @@ - { - BlockPos blockpos = position.add(rand.nextInt(4) - rand.nextInt(4), rand.nextInt(3) - rand.nextInt(3), rand.nextInt(4) - rand.nextInt(4)); - -- if (worldIn.isAirBlock(blockpos) && worldIn.getBlockState(blockpos.down()).func_185896_q()) -+ if (worldIn.isAirBlock(blockpos) && worldIn.getBlockState(blockpos.down()).isSideSolid(worldIn, blockpos.down(), net.minecraft.util.EnumFacing.UP)) - { - worldIn.setBlockState(blockpos, Blocks.chest.getDefaultState(), 2); - TileEntity tileentity = worldIn.getTileEntity(blockpos); -@@ -48,22 +48,22 @@ - BlockPos blockpos3 = blockpos.north(); - BlockPos blockpos4 = blockpos.south(); - -- if (worldIn.isAirBlock(blockpos2) && worldIn.getBlockState(blockpos2.down()).func_185896_q()) -+ if (worldIn.isAirBlock(blockpos2) && worldIn.getBlockState(blockpos2.down()).isSideSolid(worldIn, blockpos2.down(), net.minecraft.util.EnumFacing.UP)) - { - worldIn.setBlockState(blockpos2, Blocks.torch.getDefaultState(), 2); - } - -- if (worldIn.isAirBlock(blockpos1) && worldIn.getBlockState(blockpos1.down()).func_185896_q()) -+ if (worldIn.isAirBlock(blockpos1) && worldIn.getBlockState(blockpos1.down()).isSideSolid(worldIn, blockpos1.down(), net.minecraft.util.EnumFacing.UP)) - { - worldIn.setBlockState(blockpos1, Blocks.torch.getDefaultState(), 2); - } - -- if (worldIn.isAirBlock(blockpos3) && worldIn.getBlockState(blockpos3.down()).func_185896_q()) -+ if (worldIn.isAirBlock(blockpos3) && worldIn.getBlockState(blockpos3.down()).isSideSolid(worldIn, blockpos3.down(), net.minecraft.util.EnumFacing.UP)) - { - worldIn.setBlockState(blockpos3, Blocks.torch.getDefaultState(), 2); - } - -- if (worldIn.isAirBlock(blockpos4) && worldIn.getBlockState(blockpos4.down()).func_185896_q()) -+ if (worldIn.isAirBlock(blockpos4) && worldIn.getBlockState(blockpos4.down()).isSideSolid(worldIn, blockpos4.down(), net.minecraft.util.EnumFacing.UP)) - { - worldIn.setBlockState(blockpos4, Blocks.torch.getDefaultState(), 2); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch deleted file mode 100644 index 2538914b03..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayer.java -+++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayer.java -@@ -49,12 +49,12 @@ - i = 6; - } - -+ i = getModdedBiomeSize(p_180781_2_, i); -+ - GenLayer lvt_8_1_ = GenLayerZoom.magnify(1000L, genlayer4, 0); - GenLayerRiverInit genlayerriverinit = new GenLayerRiverInit(100L, lvt_8_1_); -- GenLayerBiome lvt_9_1_ = new GenLayerBiome(200L, genlayer4, p_180781_2_, p_180781_3_); -- GenLayer genlayer6 = GenLayerZoom.magnify(1000L, lvt_9_1_, 2); -- GenLayerBiomeEdge genlayerbiomeedge = new GenLayerBiomeEdge(1000L, genlayer6); - GenLayer lvt_10_1_ = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); -+ GenLayer genlayerbiomeedge = p_180781_2_.getBiomeLayer(seed, genlayer4, p_180781_3_); - GenLayer genlayerhills = new GenLayerHills(1000L, genlayerbiomeedge, lvt_10_1_); - GenLayer genlayer5 = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); - genlayer5 = GenLayerZoom.magnify(1000L, genlayer5, j); -@@ -158,8 +158,7 @@ - - protected static boolean isBiomeOceanic(int p_151618_0_) - { -- BiomeGenBase biomegenbase = BiomeGenBase.getBiome(p_151618_0_); -- return biomegenbase == Biomes.ocean || biomegenbase == Biomes.deepOcean || biomegenbase == Biomes.frozenOcean; -+ return net.minecraftforge.common.BiomeManager.oceanBiomes.contains(BiomeGenBase.getBiome(p_151618_0_)); - } - - protected int selectRandom(int... p_151619_1_) -@@ -171,4 +170,27 @@ - { - 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 =====================================*/ -+ protected long nextLong(long par1) -+ { -+ long j = (this.chunkSeed >> 24) % par1; -+ -+ if (j < 0) -+ { -+ j += par1; -+ } -+ -+ this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; -+ this.chunkSeed += this.worldGenSeed; -+ return j; -+ } -+ -+ 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; -+ } -+ /* ========================================= FORGE END ======================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch deleted file mode 100644 index adc74b8ea2..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch +++ /dev/null @@ -1,93 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java -+++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java -@@ -7,10 +7,8 @@ - - public class GenLayerBiome extends GenLayer - { -- private BiomeGenBase[] field_151623_c = new BiomeGenBase[] {Biomes.desert, Biomes.desert, Biomes.desert, Biomes.savanna, Biomes.savanna, Biomes.plains}; -- private BiomeGenBase[] field_151621_d = new BiomeGenBase[] {Biomes.forest, Biomes.roofedForest, Biomes.extremeHills, Biomes.plains, Biomes.birchForest, Biomes.swampland}; -- private BiomeGenBase[] field_151622_e = new BiomeGenBase[] {Biomes.forest, Biomes.extremeHills, Biomes.taiga, Biomes.plains}; -- private BiomeGenBase[] field_151620_f = new BiomeGenBase[] {Biomes.icePlains, Biomes.icePlains, Biomes.icePlains, Biomes.coldTaiga}; -+ @SuppressWarnings("unchecked") -+ private java.util.List[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length]; - private final ChunkProviderSettings field_175973_g; - - public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_) -@@ -18,9 +16,30 @@ - super(p_i45560_1_); - this.parent = p_i45560_3_; - -+ for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values()) -+ { -+ com.google.common.collect.ImmutableList biomesToAdd = net.minecraftforge.common.BiomeManager.getBiomes(type); -+ int idx = type.ordinal(); -+ -+ if (biomes[idx] == null) biomes[idx] = new java.util.ArrayList(); -+ if (biomesToAdd != null) biomes[idx].addAll(biomesToAdd); -+ } -+ -+ int desertIdx = net.minecraftforge.common.BiomeManager.BiomeType.DESERT.ordinal(); -+ -+ 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) - { -- this.field_151623_c = new BiomeGenBase[] {Biomes.desert, Biomes.forest, Biomes.extremeHills, Biomes.swampland, Biomes.plains, Biomes.taiga}; -+ biomes[desertIdx].clear(); -+ 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.extremeHills, 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) -@@ -74,7 +93,7 @@ - } - else - { -- aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(this.field_151623_c[this.nextInt(this.field_151623_c.length)]); -+ aint1[k + i * areaWidth] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome); - } - } - else if (k == 2) -@@ -85,7 +104,7 @@ - } - else - { -- aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(this.field_151621_d[this.nextInt(this.field_151621_d.length)]); -+ aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM).biome); - } - } - else if (k == 3) -@@ -96,12 +115,12 @@ - } - else - { -- aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(this.field_151622_e[this.nextInt(this.field_151622_e.length)]); -+ aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL).biome); - } - } - else if (k == 4) - { -- aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(this.field_151620_f[this.nextInt(this.field_151620_f.length)]); -+ aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY).biome); - } - else - { -@@ -112,4 +131,12 @@ - - return aint1; - } -+ -+ protected net.minecraftforge.common.BiomeManager.BiomeEntry getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType type) -+ { -+ java.util.List biomeList = biomes[type.ordinal()]; -+ int totalWeight = net.minecraft.util.WeightedRandom.getTotalWeight(biomeList); -+ int weight = net.minecraftforge.common.BiomeManager.isTypeListModded(type)?nextInt(totalWeight):nextInt(totalWeight / 10) * 10; -+ return (net.minecraftforge.common.BiomeManager.BiomeEntry)net.minecraft.util.WeightedRandom.getRandomItem(biomeList, weight); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch deleted file mode 100644 index 81289f9368..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java -@@ -28,11 +28,19 @@ - - for (BiomeGenBase biomegenbase : BiomeGenBase.field_185377_q) - { -- if (biomegenbase != null && biomegenbase.func_185355_j() > 0.0F) -+ if (biomegenbase != null && biomegenbase.func_185355_j() > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) - { - this.field_151546_e.add(biomegenbase); - } - } -+ -+ for (BiomeGenBase biome : net.minecraftforge.common.BiomeManager.strongHoldBiomes) -+ { -+ if (!this.field_151546_e.contains(biome)) -+ { -+ this.field_151546_e.add(biome); -+ } -+ } - } - - public MapGenStronghold(Map p_i2068_1_) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch deleted file mode 100644 index ee60e931b9..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java -@@ -221,12 +221,12 @@ - { - if (this.structureData == null) - { -- this.structureData = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName()); -+ this.structureData = (MapGenStructureData)worldIn.getPerWorldStorage().loadData(MapGenStructureData.class, this.getStructureName()); - - if (this.structureData == null) - { - this.structureData = new MapGenStructureData(this.getStructureName()); -- worldIn.setItemData(this.getStructureName(), this.structureData); -+ worldIn.getPerWorldStorage().setData(this.getStructureName(), this.structureData); - } - else - { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch deleted file mode 100644 index 53fa790aea..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureComponent.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureComponent.java -@@ -38,6 +38,10 @@ - - public final NBTTagCompound createStructureBaseNBT() - { -+ if (MapGenStructureIO.getStructureComponentName(this) == null) // Friendlier error then the Null String error below. -+ { -+ throw new RuntimeException("StructureComponent \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); -+ } - NBTTagCompound nbttagcompound = new NBTTagCompound(); - nbttagcompound.setString("id", MapGenStructureIO.getStructureComponentName(this)); - nbttagcompound.setTag("BB", this.boundingBox.toNBTTagIntArray()); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch deleted file mode 100644 index 1d7352db01..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStart.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStart.java -@@ -63,6 +63,10 @@ - - public NBTTagCompound writeStructureComponentsToNBT(int chunkX, int chunkZ) - { -+ if (MapGenStructureIO.getStructureStartName(this) == null) // This is just a more friendly error instead of the 'Null String' below -+ { -+ throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); -+ } - NBTTagCompound nbttagcompound = new NBTTagCompound(); - nbttagcompound.setString("id", MapGenStructureIO.getStructureStartName(this)); - nbttagcompound.setInteger("ChunkX", chunkX); -@@ -98,7 +102,8 @@ - - for (int i = 0; i < nbttaglist.tagCount(); ++i) - { -- this.components.add(MapGenStructureIO.getStructureComponent(nbttaglist.getCompoundTagAt(i), worldIn)); -+ StructureComponent tmp = MapGenStructureIO.getStructureComponent(nbttaglist.getCompoundTagAt(i), worldIn); -+ if (tmp != null) this.components.add(tmp); //Forge: Prevent NPEs further down the line when a componenet can't be loaded. - } - - this.readFromNBT(tagCompound); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch deleted file mode 100644 index e861158b70..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java -@@ -58,6 +58,7 @@ - list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field2.class, 3, MathHelper.getRandomIntegerInRange(random, 2 + p_75084_1_, 4 + p_75084_1_ * 2))); - list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House2.class, 15, MathHelper.getRandomIntegerInRange(random, 0, 1 + p_75084_1_))); - list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House3.class, 8, MathHelper.getRandomIntegerInRange(random, 0 + p_75084_1_, 3 + p_75084_1_ * 2))); -+ net.minecraftforge.fml.common.registry.VillagerRegistry.addExtraVillageComponents(list, random, p_75084_1_); - Iterator iterator = list.iterator(); - - while (iterator.hasNext()) -@@ -130,6 +131,10 @@ - { - structurevillagepieces$village = StructureVillagePieces.House3.func_175849_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_); - } -+ else -+ { -+ structurevillagepieces$village = net.minecraftforge.fml.common.registry.VillagerRegistry.getVillageComponent(weight, start , p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_); -+ } - - return structurevillagepieces$village; - } -@@ -1447,6 +1452,7 @@ - public List structureVillageWeightedPieceList; - public List field_74932_i = Lists.newArrayList(); - public List field_74930_j = Lists.newArrayList(); -+ public BiomeGenBase biome; - - public Start() - { -@@ -1460,6 +1466,7 @@ - this.terrainType = p_i2104_7_; - BiomeGenBase biomegenbase = chunkManagerIn.getBiomeGenerator(new BlockPos(p_i2104_4_, 0, p_i2104_5_), Biomes.field_180279_ad); - this.inDesert = biomegenbase == Biomes.desert || biomegenbase == Biomes.desertHills; -+ this.biome = biomegenbase; - this.func_175846_a(this.inDesert); - } - -@@ -1520,6 +1527,7 @@ - protected int field_143015_k = -1; - private int villagersSpawned; - private boolean isDesertVillage; -+ private StructureVillagePieces.Start startPiece; - - public Village() - { -@@ -1532,6 +1540,7 @@ - if (start != null) - { - this.isDesertVillage = start.inDesert; -+ startPiece = start; - } - } - -@@ -1660,6 +1669,9 @@ - - protected IBlockState func_175847_a(IBlockState p_175847_1_) - { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetVillageBlockID event = new net.minecraftforge.event.terraingen.BiomeEvent.GetVillageBlockID(startPiece == null ? null : startPiece.biome, p_175847_1_); -+ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.replacement; - if (this.isDesertVillage) - { - if (p_175847_1_.getBlock() == Blocks.log || p_175847_1_.getBlock() == Blocks.log2) diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch deleted file mode 100644 index cf7f4d15e1..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/MapData.java -+++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java -@@ -21,7 +21,7 @@ - { - public int xCenter; - public int zCenter; -- public byte dimension; -+ public int dimension; //FML byte -> int - public boolean field_186210_e; - public byte scale; - public byte[] colors = new byte[16384]; -@@ -45,7 +45,17 @@ - - public void readFromNBT(NBTTagCompound nbt) - { -- this.dimension = nbt.getByte("dimension"); -+ net.minecraft.nbt.NBTBase dimension = nbt.getTag("dimension"); -+ -+ if (dimension instanceof net.minecraft.nbt.NBTTagByte) -+ { -+ this.dimension = ((net.minecraft.nbt.NBTTagByte)dimension).getByte(); -+ } -+ else -+ { -+ this.dimension = ((net.minecraft.nbt.NBTTagInt)dimension).getInt(); -+ } -+ - this.xCenter = nbt.getInteger("xCenter"); - this.zCenter = nbt.getInteger("zCenter"); - this.scale = nbt.getByte("scale"); -@@ -96,7 +106,7 @@ - - public void writeToNBT(NBTTagCompound nbt) - { -- nbt.setByte("dimension", this.dimension); -+ nbt.setInteger("dimension", this.dimension); - nbt.setInteger("xCenter", this.xCenter); - nbt.setInteger("zCenter", this.zCenter); - nbt.setByte("scale", this.scale); -@@ -176,7 +186,7 @@ - rotation = rotation + (rotation < 0.0D ? -8.0D : 8.0D); - b2 = (byte)((int)(rotation * 16.0D / 360.0D)); - -- if (this.dimension < 0) -+ if (worldIn.provider.shouldMapSpin(entityIdentifier, worldX, worldZ, rotation)) - { - int k = (int)(worldIn.getWorldInfo().getWorldTime() / 10L); - b2 = (byte)(k * k * 34187121 + k * 121 >> 15 & 15); diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch deleted file mode 100644 index c1fec8d2c6..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/SaveFormatOld.java -+++ ../src-work/minecraft/net/minecraft/world/storage/SaveFormatOld.java -@@ -106,6 +106,24 @@ - } - } - -+ //Forge: Special version of the above that runs during actual world loading and not metadata gathering. -+ public static WorldInfo loadAndFix(File file, DataFixer fixer, SaveHandler save) -+ { -+ try -+ { -+ NBTTagCompound nbt = CompressedStreamTools.readCompressed(new FileInputStream(file)); -+ WorldInfo info = new WorldInfo(fixer.func_188257_a(FixTypes.LEVEL, nbt.getCompoundTag("Data"))); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(save, info, nbt); -+ return info; -+ } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) { throw e; } -+ catch (Exception exception) -+ { -+ logger.error((String)("Exception reading " + file), (Throwable)exception); -+ return null; -+ } -+ } -+ - @SideOnly(Side.CLIENT) - public void renameWorld(String dirName, String newName) - { diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch deleted file mode 100644 index aba3075c0a..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java -+++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java -@@ -117,7 +117,7 @@ - - if (file1.exists()) - { -- WorldInfo worldinfo = SaveFormatOld.func_186353_a(file1, this.field_186341_a); -+ WorldInfo worldinfo = SaveFormatOld.loadAndFix(file1, this.field_186341_a, this); - - if (worldinfo != null) - { -@@ -125,8 +125,9 @@ - } - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); - file1 = new File(this.worldDirectory, "level.dat_old"); -- return file1.exists() ? SaveFormatOld.func_186353_a(file1, this.field_186341_a) : null; -+ return file1.exists() ? SaveFormatOld.loadAndFix(file1, this.field_186341_a, this) : null; - } - - public void saveWorldInfoWithPlayer(WorldInfo worldInformation, NBTTagCompound tagCompound) -@@ -135,6 +136,8 @@ - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setTag("Data", nbttagcompound); - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound1); -+ - try - { - File file1 = new File(this.worldDirectory, "level.dat_new"); -@@ -188,6 +191,7 @@ - } - - file1.renameTo(file2); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(player, this.playersDirectory, player.getUniqueID().toString()); - } - catch (Exception var5) - { -@@ -218,6 +222,7 @@ - player.readFromNBT(this.field_186341_a.func_188257_a(FixTypes.PLAYER, nbttagcompound)); - } - -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(player, playersDirectory, player.getUniqueID().toString()); - return nbttagcompound; - } - -@@ -259,4 +264,22 @@ - { - return this.field_186342_h; - } -+ -+ public NBTTagCompound getPlayerNBT(net.minecraft.entity.player.EntityPlayerMP player) -+ { -+ try -+ { -+ File file1 = new File(this.playersDirectory, player.getUniqueID().toString() + ".dat"); -+ -+ if (file1.exists() && file1.isFile()) -+ { -+ return CompressedStreamTools.readCompressed(new FileInputStream(file1)); -+ } -+ } -+ catch (Exception exception) -+ { -+ logger.warn("Failed to load player data for " + player.getName()); -+ } -+ return null; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch deleted file mode 100644 index f0459b69cf..0000000000 --- a/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java -+++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java -@@ -60,6 +60,7 @@ - private int borderWarningTime = 15; - private final Map field_186348_N = Maps.newEnumMap(DimensionType.class); - private GameRules theGameRules = new GameRules(); -+ private java.util.Map additionalProperties; - - protected WorldInfo() - { -@@ -785,6 +786,26 @@ - }); - } - -+ /** -+ * Allow access to additional mod specific world based properties -+ * Used by FML to store mod list associated with a world, and maybe an id map -+ * Used by Forge to store the dimensions available to a world -+ * @param additionalProperties -+ */ -+ public void setAdditionalProperties(java.util.Map additionalProperties) -+ { -+ // one time set for this -+ if (this.additionalProperties == null) -+ { -+ this.additionalProperties = additionalProperties; -+ } -+ } -+ -+ public net.minecraft.nbt.NBTBase getAdditionalProperty(String additionalProperty) -+ { -+ return this.additionalProperties!=null? this.additionalProperties.get(additionalProperty) : null; -+ } -+ - public NBTTagCompound func_186347_a(DimensionType p_186347_1_) - { - NBTTagCompound nbttagcompound = (NBTTagCompound)this.field_186348_N.get(p_186347_1_); From 28ae283b969e19649c78032d6ecd171460096abb Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 14 Mar 2016 22:58:01 -0700 Subject: [PATCH 084/243] PlayerManager updated. --- .../management/PlayerManager.java.patch | 123 +++++++++- .../management/PlayerManager.java.patch.rej | 223 ------------------ src/main/resources/forge_at.cfg | 3 + 3 files changed, 120 insertions(+), 229 deletions(-) delete mode 100644 rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej diff --git a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch index 7bb6f7e6d5..7340a0b5a5 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch @@ -1,10 +1,121 @@ --- ../src-base/minecraft/net/minecraft/server/management/PlayerManager.java +++ ../src-work/minecraft/net/minecraft/server/management/PlayerManager.java -@@ -338,6 +338,7 @@ - int i1 = this.field_72698_e; - int j1 = i - k; - int k1 = j - l; -+ List chunksToLoad = Lists.newArrayList(); +@@ -468,11 +468,18 @@ + private int field_187288_h; + private long field_187289_i; + private boolean field_187290_j; ++ private Runnable loadedRunnable = new Runnable() ++ { ++ public void run() ++ { ++ PlayerInstance.this.field_187286_f = PlayerManager.this.func_72688_a().func_72863_F().func_186028_c(PlayerInstance.this.field_187284_d.field_77276_a, PlayerInstance.this.field_187284_d.field_77275_b); ++ } ++ }; - if (j1 != 0 || k1 != 0) + public PlayerInstance(int p_i1518_2_, int p_i1518_3_) + { + this.field_187284_d = new ChunkCoordIntPair(p_i1518_2_, p_i1518_3_); +- this.field_187286_f = PlayerManager.this.func_72688_a().func_72863_F().func_186028_c(p_i1518_2_, p_i1518_3_); ++ PlayerManager.this.func_72688_a().func_72863_F().loadChunk(p_i1518_2_, p_i1518_3_, this.loadedRunnable); + } + + public ChunkCoordIntPair func_187264_a() +@@ -506,6 +513,20 @@ + { + if (this.field_187283_c.contains(p_187277_1_)) { ++ // If we haven't loaded yet don't load the chunk just so we can clean it up ++ if (this.field_187286_f == null) ++ { ++ this.field_187283_c.remove(p_187277_1_); ++ ++ if (this.field_187283_c.isEmpty()) ++ { ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.func_72688_a(), this.field_187284_d.field_77276_a, this.field_187284_d.field_77275_b, this.loadedRunnable); ++ PlayerManager.this.func_187305_b(this); ++ } ++ ++ return; ++ } ++ + if (this.field_187290_j) + { + p_187277_1_.field_71135_a.func_147359_a(new SPacketUnloadChunk(this.field_187284_d.field_77276_a, this.field_187284_d.field_77275_b)); +@@ -513,6 +534,8 @@ + + this.field_187283_c.remove(p_187277_1_); + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.UnWatch(this.field_187284_d, p_187277_1_)); ++ + if (this.field_187283_c.isEmpty()) + { + PlayerManager.this.func_187305_b(this); +@@ -625,7 +648,7 @@ + + this.field_187288_h |= 1 << (p_187265_2_ >> 4); + +- if (this.field_187287_g < 64) ++ //Forge; Cache everything, so always run + { + short short1 = (short)(p_187265_1_ << 12 | p_187265_3_ << 8 | p_187265_2_); + +@@ -637,6 +660,8 @@ + } + } + ++ if (this.field_187287_g == this.field_187285_e.length) ++ this.field_187285_e = java.util.Arrays.copyOf(this.field_187285_e, this.field_187285_e.length << 1); + this.field_187285_e[this.field_187287_g++] = short1; + } + } +@@ -653,6 +678,7 @@ + } + } + ++ @SuppressWarnings("unused") + public void func_187280_d() + { + if (this.field_187290_j && this.field_187286_f != null) +@@ -666,18 +692,20 @@ + int k = (this.field_187285_e[0] >> 8 & 15) + this.field_187284_d.field_77275_b * 16; + BlockPos blockpos = new BlockPos(i, j, k); + this.func_187267_a(new SPacketBlockChange(PlayerManager.this.func_72688_a(), blockpos)); ++ net.minecraft.block.state.IBlockState state = PlayerManager.this.func_72688_a().func_180495_p(blockpos); + +- if (PlayerManager.this.func_72688_a().func_180495_p(blockpos).func_177230_c().func_149716_u()) ++ if (state.func_177230_c().hasTileEntity(state)) + { + this.func_187273_a(PlayerManager.this.func_72688_a().func_175625_s(blockpos)); + } + } +- else if (this.field_187287_g == 64) ++ else if (this.field_187287_g >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) + { + int i1 = this.field_187284_d.field_77276_a * 16; + int k1 = this.field_187284_d.field_77275_b * 16; + this.func_187267_a(new SPacketChunkData(this.field_187286_f, false, this.field_187288_h)); + ++ if (false) // Forge: Grabs ALL the tile entities, costly on a modded server, only send needed ones + for (int i2 = 0; i2 < 16; ++i2) + { + if ((this.field_187288_h & 1 << i2) != 0) +@@ -695,15 +723,17 @@ + else + { + this.func_187267_a(new SPacketMultiBlockChange(this.field_187287_g, this.field_187285_e, this.field_187286_f)); +- ++ } ++ { // Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small + for (int j1 = 0; j1 < this.field_187287_g; ++j1) + { + int l1 = (this.field_187285_e[j1] >> 12 & 15) + this.field_187284_d.field_77276_a * 16; + int j2 = this.field_187285_e[j1] & 255; + int l2 = (this.field_187285_e[j1] >> 8 & 15) + this.field_187284_d.field_77275_b * 16; + BlockPos blockpos1 = new BlockPos(l1, j2, l2); ++ net.minecraft.block.state.IBlockState state = PlayerManager.this.func_72688_a().func_180495_p(blockpos1); + +- if (PlayerManager.this.func_72688_a().func_180495_p(blockpos1).func_177230_c().func_149716_u()) ++ if (state.func_177230_c().hasTileEntity(state)) + { + this.func_187273_a(PlayerManager.this.func_72688_a().func_175625_s(blockpos1)); + } diff --git a/rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej b/rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej deleted file mode 100644 index cb7cb9cca1..0000000000 --- a/rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej +++ /dev/null @@ -1,223 +0,0 @@ -++++ REJECTED PATCH 1 - int j = (int)player.posZ >> 4; - player.managedPosX = player.posX; - player.managedPosZ = player.posZ; -+ // Load nearby chunks first -+ List chunkList = Lists.newArrayList(); - - for (int k = i - this.playerViewRadius; k <= i + this.playerViewRadius; ++k) - { - for (int l = j - this.playerViewRadius; l <= j + this.playerViewRadius; ++l) - { -- this.getPlayerInstance(k, l, true).addPlayer(player); -+ chunkList.add(new ChunkCoordIntPair(k, l)); - } - } - -+ java.util.Collections.sort(chunkList, new net.minecraftforge.common.util.ChunkCoordComparator(player)); -+ -+ for (ChunkCoordIntPair pair : chunkList) -+ { -+ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(player); -+ } -+ - this.players.add(player); - this.filterChunkLoadQueue(player); - } -++++ END PATCH -++++ REJECTED PATCH 3 - { - if (!this.overlaps(l1, i2, k, l, i1)) - { -- this.getPlayerInstance(l1, i2, true).addPlayer(player); -+ chunksToLoad.add(new ChunkCoordIntPair(l1, i2)); - } - - if (!this.overlaps(l1 - j1, i2 - k1, i, j, i1)) -++++ END PATCH -++++ REJECTED PATCH 4 - this.filterChunkLoadQueue(player); - player.managedPosX = player.posX; - player.managedPosZ = player.posZ; -+ // send nearest chunks first -+ java.util.Collections.sort(chunksToLoad, new net.minecraftforge.common.util.ChunkCoordComparator(player)); -+ -+ for (ChunkCoordIntPair pair : chunksToLoad) -+ { -+ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(player); -+ } -+ -+ if (i1 > 1 || i1 < -1 || j1 > 1 || j1 < -1) -+ { -+ java.util.Collections.sort(player.loadedChunks, new net.minecraftforge.common.util.ChunkCoordComparator(player)); -+ } - } - } - } -++++ END PATCH -++++ REJECTED PATCH 5 - private int numBlocksToUpdate; - private int flagsYAreasToUpdate; - private long previousWorldTime; -+ private final java.util.HashMap players = new java.util.HashMap(); -+ private boolean loaded = false; -+ private Runnable loadedRunnable = new Runnable() -+ { -+ public void run() -+ { -+ PlayerInstance.this.loaded = true; -+ } -+ }; - - public PlayerInstance(int chunkX, int chunkZ) - { - this.chunkCoords = new ChunkCoordIntPair(chunkX, chunkZ); -- PlayerManager.this.getWorldServer().theChunkProviderServer.loadChunk(chunkX, chunkZ); -+ PlayerManager.this.getWorldServer().theChunkProviderServer.loadChunk(chunkX, chunkZ, this.loadedRunnable); - } - - public void addPlayer(EntityPlayerMP player) -++++ END PATCH -++++ REJECTED PATCH 6 - } - - this.playersWatchingChunk.add(player); -+ Runnable playerRunnable = null; -+ if (this.loaded) -+ { - player.loadedChunks.add(this.chunkCoords); -+ } -+ else -+ { -+ final EntityPlayerMP tmp = player; -+ playerRunnable = new Runnable() -+ { -+ public void run() -+ { -+ tmp.loadedChunks.add(PlayerInstance.this.chunkCoords); -+ } -+ }; -+ PlayerManager.this.getWorldServer().theChunkProviderServer.loadChunk(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, playerRunnable); -+ } -+ this.players.put(player, playerRunnable); - } - } - -++++ END PATCH -++++ REJECTED PATCH 7 - { - if (this.playersWatchingChunk.contains(player)) - { -+ // If we haven't loaded yet don't load the chunk just so we can clean it up -+ if (!this.loaded) -+ { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getWorldServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.players.get(player)); -+ this.playersWatchingChunk.remove(player); -+ this.players.remove(player); -+ -+ if (this.playersWatchingChunk.isEmpty()) -+ { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getWorldServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.loadedRunnable); -+ long i = (long) this.chunkCoords.chunkXPos + 2147483647L | (long) this.chunkCoords.chunkZPos + 2147483647L << 32; -+ PlayerManager.this.playerInstances.remove(i); -+ PlayerManager.this.playerInstanceList.remove(this); -+ } -+ -+ return; -+ } -+ - Chunk chunk = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos); - - if (chunk.isPopulated()) -++++ END PATCH -++++ REJECTED PATCH 8 - player.playerNetServerHandler.sendPacket(new S21PacketChunkData(chunk, true, 0)); - } - -+ this.players.remove(player); - this.playersWatchingChunk.remove(player); - player.loadedChunks.remove(this.chunkCoords); - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.UnWatch(chunkCoords, player)); -+ - if (this.playersWatchingChunk.isEmpty()) - { - long i = (long)this.chunkCoords.chunkXPos + 2147483647L | (long)this.chunkCoords.chunkZPos + 2147483647L << 32; -++++ END PATCH -++++ REJECTED PATCH 9 - - this.flagsYAreasToUpdate |= 1 << (y >> 4); - -- if (this.numBlocksToUpdate < 64) -+ //Forge; Cache everything, so always run - { - short short1 = (short)(x << 12 | z << 8 | y); - -++++ END PATCH -++++ REJECTED PATCH 10 - } - } - -+ if (numBlocksToUpdate == locationOfBlockChange.length) -+ { -+ locationOfBlockChange = java.util.Arrays.copyOf(locationOfBlockChange, locationOfBlockChange.length << 1); -+ } - this.locationOfBlockChange[this.numBlocksToUpdate++] = short1; - } - } -++++ END PATCH -++++ REJECTED PATCH 11 - } - } - -+ @SuppressWarnings("unused") - public void onUpdate() - { - if (this.numBlocksToUpdate != 0) -++++ END PATCH -++++ REJECTED PATCH 12 - BlockPos blockpos = new BlockPos(i, j, k); - this.sendToAllPlayersWatchingChunk(new S23PacketBlockChange(PlayerManager.this.theWorldServer, blockpos)); - -- if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity()) -+ if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity(PlayerManager.this.theWorldServer.getBlockState(blockpos))) - { - this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos)); - } - } -- else if (this.numBlocksToUpdate == 64) -+ else if (this.numBlocksToUpdate >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) - { - int i1 = this.chunkCoords.chunkXPos * 16; - int k1 = this.chunkCoords.chunkZPos * 16; - this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), false, this.flagsYAreasToUpdate)); - -- for (int i2 = 0; i2 < 16; ++i2) -+ // Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones -+ for (int i2 = 0; false && i2 < 16; ++i2) - { - if ((this.flagsYAreasToUpdate & 1 << i2) != 0) - { -++++ END PATCH -++++ REJECTED PATCH 13 - else - { - this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos))); -- -+ } -+ { // Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small -+ WorldServer world = PlayerManager.this.theWorldServer; - for (int j1 = 0; j1 < this.numBlocksToUpdate; ++j1) - { - int l1 = (this.locationOfBlockChange[j1] >> 12 & 15) + this.chunkCoords.chunkXPos * 16; -++++ END PATCH -++++ REJECTED PATCH 14 - int l2 = (this.locationOfBlockChange[j1] >> 8 & 15) + this.chunkCoords.chunkZPos * 16; - BlockPos blockpos1 = new BlockPos(l1, j2, l2); - -- if (PlayerManager.this.theWorldServer.getBlockState(blockpos1).getBlock().hasTileEntity()) -+ if (world.getBlockState(blockpos1).getBlock().hasTileEntity(world.getBlockState(blockpos1))) - { - this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos1)); - } -++++ END PATCH diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index 4281d02692..a2df630b2e 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -279,3 +279,6 @@ public-f net/minecraft/world/gen/ChunkProviderHell/field_185946_g #scale public-f net/minecraft/world/gen/ChunkProviderHell/field_185947_h #depth private-f net/minecraft/world/gen/ChunkProviderHell/field_185939_I #netherCaveGenerator private-f net/minecraft/world/gen/ChunkProviderHell/field_73172_c #netherBridgeGenerator + +# PlayerManager +private-f net.minecraft.server.management.PlayerManager$PlayerInstance field_187285_e # field_187285_e \ No newline at end of file From 7b0d8f09e94d3d9ff62d2d81ad5576b27eea947d Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 14 Mar 2016 23:44:10 -0700 Subject: [PATCH 085/243] Fix digging blocks in survival. --- .../server/management/PlayerInteractionManager.java.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch index 021fd24ea3..a6992ca07d 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch @@ -69,7 +69,7 @@ + this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); + } + else -+ { ++ { + field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(field_73092_a, p_180784_1_)); + } f = iblockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180784_1_); @@ -93,7 +93,7 @@ IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180785_1_); - if (iblockstate.func_185904_a() != Material.field_151579_a) -+ if (iblockstate.func_177230_c().isAir(iblockstate, field_73092_a, p_180785_1_)) ++ if (!iblockstate.func_177230_c().isAir(iblockstate, field_73092_a, p_180785_1_)) { float f = iblockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180785_1_) * (float)(i + 1); From ae72fa7ceb54de5b04f7dff05c1f540b3351c9bd Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 15 Mar 2016 01:17:38 -0700 Subject: [PATCH 086/243] Fixed breaking of tall grass. It now uses fortune. Expanded grass seed hooks to allow Fortune. Potentially removing in future in favor of LootTables. --- .../minecraft/block/BlockTallGrass.java.patch | 2 +- .../PlayerInteractionManager.java.patch | 2 +- .../net/minecraftforge/common/ForgeHooks.java | 17 ++++++++++++++--- .../minecraftforge/common/MinecraftForge.java | 8 +++++++- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch index 37298ca359..2327fb98d7 100644 --- a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch @@ -54,7 +54,7 @@ + { + List ret = new java.util.ArrayList(); + if (RANDOM.nextInt(8) != 0) return ret; -+ ItemStack seed = net.minecraftforge.common.ForgeHooks.getGrassSeed(RANDOM); ++ ItemStack seed = net.minecraftforge.common.ForgeHooks.getGrassSeed(RANDOM, fortune); + if (seed != null) ret.add(seed); + return ret; + } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch index a6992ca07d..18927e74a0 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch @@ -84,7 +84,7 @@ + } - if (iblockstate.func_185904_a() != Material.field_151579_a && f >= 1.0F) -+ if (iblockstate.func_177230_c().isAir(iblockstate, field_73092_a, p_180784_1_) && f >= 1.0F) ++ if (!iblockstate.func_177230_c().isAir(iblockstate, field_73092_a, p_180784_1_) && f >= 1.0F) { this.func_180237_b(p_180784_1_); } diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 025dd885de..9d95ad0f0d 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -111,6 +111,7 @@ import net.minecraftforge.fml.relauncher.ReflectionHelper; public class ForgeHooks { + //TODO: Loot tables? static class SeedEntry extends WeightedRandom.Item { public final ItemStack seed; @@ -119,17 +120,21 @@ public class ForgeHooks super(weight); this.seed = seed; } + public ItemStack getStack(Random rand, int fortune) + { + return seed.copy(); + } } static final List seedList = new ArrayList(); - public static ItemStack getGrassSeed(Random rand) + public static ItemStack getGrassSeed(Random rand, int fortune) { SeedEntry entry = (SeedEntry)WeightedRandom.getRandomItem(rand, seedList); if (entry == null || entry.seed == null) { return null; } - return entry.seed.copy(); + return entry.getStack(rand, fortune); } private static boolean toolInit = false; @@ -257,7 +262,13 @@ public class ForgeHooks static { - seedList.add(new SeedEntry(new ItemStack(Items.wheat_seeds), 10)); + seedList.add(new SeedEntry(new ItemStack(Items.wheat_seeds), 10) + { + public ItemStack getStack(Random rand, int fortune) + { + return new ItemStack(Items.wheat_seeds, 1 + rand.nextInt(fortune * 2 + 1)); + } + }); initTools(); } diff --git a/src/main/java/net/minecraftforge/common/MinecraftForge.java b/src/main/java/net/minecraftforge/common/MinecraftForge.java index 625e29a887..c386dcd8e0 100644 --- a/src/main/java/net/minecraftforge/common/MinecraftForge.java +++ b/src/main/java/net/minecraftforge/common/MinecraftForge.java @@ -38,10 +38,16 @@ public class MinecraftForge * @param seed The item to drop as a seed. * @param weight The relative probability of the seeds, * where wheat seeds are 10. + * + * Note: These functions may be going away soon, we're looking into loot tables.... */ public static void addGrassSeed(ItemStack seed, int weight) { - ForgeHooks.seedList.add(new SeedEntry(seed, weight)); + addGrassSeed(new SeedEntry(seed, weight)); + } + public static void addGrassSeed(SeedEntry seed) + { + ForgeHooks.seedList.add(seed); } /** From 05801a74af4cdbd5a491b388e7f9376799d9c71c Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Tue, 15 Mar 2016 17:52:58 +0000 Subject: [PATCH 087/243] 1.9: Fixed registering armor materials through EnumHelper exploding 1.9 ArmorMaterial now requires a SoundEvent for the equip sound. --- .../java/net/minecraftforge/common/util/EnumHelper.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minecraftforge/common/util/EnumHelper.java b/src/main/java/net/minecraftforge/common/util/EnumHelper.java index 8fee636af3..f1d7edb400 100644 --- a/src/main/java/net/minecraftforge/common/util/EnumHelper.java +++ b/src/main/java/net/minecraftforge/common/util/EnumHelper.java @@ -15,6 +15,7 @@ import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; +import net.minecraft.util.SoundEvent; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.EnumSkyBlock; @@ -35,7 +36,7 @@ public class EnumHelper private static Class[][] commonTypes = { {EnumAction.class}, - {ArmorMaterial.class, String.class, int.class, int[].class, int.class}, + {ArmorMaterial.class, String.class, int.class, int[].class, int.class, SoundEvent.class}, {EnumArt.class, String.class, int.class, int.class, int.class, int.class}, {EnumCreatureAttribute.class}, {EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class, boolean.class}, @@ -53,9 +54,9 @@ public class EnumHelper { return addEnum(EnumAction.class, name); } - public static ArmorMaterial addArmorMaterial(String name, String textureName, int durability, int[] reductionAmounts, int enchantability) + public static ArmorMaterial addArmorMaterial(String name, String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip) { - return addEnum(ArmorMaterial.class, name, textureName, durability, reductionAmounts, enchantability); + return addEnum(ArmorMaterial.class, name, textureName, durability, reductionAmounts, enchantability, soundOnEquip); } public static EnumArt addArt(String name, String tile, int sizeX, int sizeY, int offsetX, int offsetY) { @@ -281,4 +282,4 @@ public class EnumHelper setup(); } } -} \ No newline at end of file +} From b81a13d010d7356fd6398115491e88acbac37867 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 16 Mar 2016 01:42:01 +0300 Subject: [PATCH 088/243] Fixed model error reporting, fixed model errors in test mods that shouldn't happen, fixed custom texture loading, made more things private/final. --- .../renderer/texture/TextureMap.java.patch | 9 + .../client/model/BlockStateLoader.java | 3 +- .../client/model/ICustomModelLoader.java | 2 +- .../client/model/ItemLayerModel.java | 8 +- .../client/model/ModelDynBucket.java | 16 +- .../client/model/ModelFluid.java | 14 +- .../client/model/ModelLoader.java | 166 +++++++++--------- .../client/model/ModelLoaderRegistry.java | 95 +++++++--- .../client/model/MultiLayerModel.java | 6 +- .../client/model/MultiModel.java | 63 ++----- .../client/model/MultiModelState.java | 2 +- .../client/model/SimpleModelState.java | 2 +- .../client/model/TRSRTransformation.java | 2 +- .../client/model/animation/Clips.java | 2 +- .../client/model/b3d/B3DLoader.java | 58 +++--- .../client/model/obj/OBJLoader.java | 50 +++--- .../minecraftforge/debug/DynBucketTest.java | 4 +- .../minecraftforge/debug/ItemTileDebug.java | 2 +- .../debug/ModelAnimationDebug.java | 4 +- .../debug/ModelBakeEventDebug.java | 15 +- .../debug/ModelLoaderRegistryDebug.java | 2 +- .../test/NoBedSleepingTest.java | 32 +++- .../dynbuckettest/blockstates/simpletank.json | 10 ++ .../blockstates/custom_model_block.json | 10 ++ .../models/item/custom_model_block.json | 3 - .../models/item/sleeping_pill.json | 6 + 26 files changed, 308 insertions(+), 278 deletions(-) create mode 100644 src/test/resources/assets/dynbuckettest/blockstates/simpletank.json create mode 100644 src/test/resources/assets/forgedebugitemtile/blockstates/custom_model_block.json delete mode 100644 src/test/resources/assets/forgedebugitemtile/models/item/custom_model_block.json create mode 100644 src/test/resources/assets/forgedebugnobedsleeping/models/item/sleeping_pill.json diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 15086362c3..f7fad50b17 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -136,6 +136,15 @@ } private boolean func_184397_a(IResourceManager p_184397_1_, final TextureAtlasSprite p_184397_2_) +@@ -194,7 +239,7 @@ + label9: + { + boolean flag; +- ++ if (p_184397_2_.hasCustomLoader(p_184397_1_, resourcelocation)) break label9; + try + { + iresource = p_184397_1_.func_110536_a(resourcelocation); @@ -317,4 +362,37 @@ { return this.field_94249_f; diff --git a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java index 4700d20337..e813982b18 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java +++ b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java @@ -163,6 +163,7 @@ public class BlockStateLoader public IModel process(IModel base) { int size = parts.size(); + // FIXME: should missing base be handled this way? boolean hasBase = base != ModelLoaderRegistry.getMissingModel(); if (hasBase) @@ -182,7 +183,7 @@ public class BlockStateLoader { SubModel part = entry.getValue(); - IModel model = ModelLoaderRegistry.getModel(part.getModelLocation()); + IModel model = ModelLoaderRegistry.getModelOrLogError(part.getModelLocation(), "Unable to load block sub-model: \'" + part.getModelLocation()); IModelState partState = new ModelStateComposition(baseTr, part.getState()); diff --git a/src/main/java/net/minecraftforge/client/model/ICustomModelLoader.java b/src/main/java/net/minecraftforge/client/model/ICustomModelLoader.java index 6dd74668f9..3aea07e733 100644 --- a/src/main/java/net/minecraftforge/client/model/ICustomModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ICustomModelLoader.java @@ -14,5 +14,5 @@ public interface ICustomModelLoader extends IResourceManagerReloadListener /* * loads (or reloads) specified model */ - public IModel loadModel(ResourceLocation modelLocation); + public IModel loadModel(ResourceLocation modelLocation) throws Exception; } diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index b8946e1003..7d23d4dc72 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -29,7 +29,7 @@ import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -public class ItemLayerModel implements IRetexturableModel +public final class ItemLayerModel implements IRetexturableModel { public static final ItemLayerModel instance = new ItemLayerModel(ImmutableList.of()); @@ -108,7 +108,7 @@ public class ItemLayerModel implements IRetexturableModel return new BakedItemModel(builder.build(), particle, map, overrides, null); } - private static class BakedItemModel implements IPerspectiveAwareModel + private static final class BakedItemModel implements IPerspectiveAwareModel { private final ImmutableList quads; private final TextureAtlasSprite particle; @@ -170,7 +170,7 @@ public class ItemLayerModel implements IRetexturableModel } } - public ImmutableList getQuadsForSprite(int tint, TextureAtlasSprite sprite, VertexFormat format, Optional transform) + public static ImmutableList getQuadsForSprite(int tint, TextureAtlasSprite sprite, VertexFormat format, Optional transform) { ImmutableList.Builder builder = ImmutableList.builder(); @@ -240,7 +240,7 @@ public class ItemLayerModel implements IRetexturableModel return builder.build(); } - protected boolean isTransparent(int[] pixels, int uMax, int vMax, int u, int v) + private static boolean isTransparent(int[] pixels, int uMax, int vMax, int u, int v) { return (pixels[u + (vMax - 1 - v) * uMax] >> 24 & 0xFF) == 0; } diff --git a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java index 6b4303126c..31f28744a1 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java +++ b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java @@ -39,7 +39,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; -public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableModel +public final class ModelDynBucket implements IModel, IModelCustomData, IRetexturableModel { public static final ModelResourceLocation LOCATION = new ModelResourceLocation(new ResourceLocation("forge", "dynbucket"), "inventory"); @@ -51,12 +51,12 @@ public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableMo public static final IModel MODEL = new ModelDynBucket(); - protected final ResourceLocation baseLocation; - protected final ResourceLocation liquidLocation; - protected final ResourceLocation coverLocation; + private final ResourceLocation baseLocation; + private final ResourceLocation liquidLocation; + private final ResourceLocation coverLocation; - protected final Fluid fluid; - protected final boolean flipGas; + private final Fluid fluid; + private final boolean flipGas; public ModelDynBucket() { @@ -223,7 +223,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableMo } } - protected static final class BakedDynBucketOverrideHandler extends ItemOverrideList + private static final class BakedDynBucketOverrideHandler extends ItemOverrideList { public static final BakedDynBucketOverrideHandler INSTANCE = new BakedDynBucketOverrideHandler(); private BakedDynBucketOverrideHandler() @@ -277,7 +277,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableMo } // the dynamic bucket is based on the empty bucket - protected static class BakedDynBucket implements IPerspectiveAwareModel + private static final class BakedDynBucket implements IPerspectiveAwareModel { private final ModelDynBucket parent; diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index 2543037a57..a876fc4796 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -43,7 +43,7 @@ import com.google.common.collect.Maps; import com.google.gson.JsonElement; import com.google.gson.JsonParser; -public class ModelFluid implements IModelCustomData +public final class ModelFluid implements IModelCustomData { public static final ModelFluid waterModel = new ModelFluid(FluidRegistry.WATER); public static final ModelFluid lavaModel = new ModelFluid(FluidRegistry.LAVA); @@ -95,7 +95,7 @@ public class ModelFluid implements IModelCustomData } } - public static class BakedFluid implements IPerspectiveAwareModel + private static final class BakedFluid implements IPerspectiveAwareModel { private static final int x[] = { 0, 0, 1, 1 }; private static final int z[] = { 0, 1, 1, 0 }; @@ -126,16 +126,6 @@ public class ModelFluid implements IModelCustomData private final boolean gas; private final EnumMap> faceQuads; - public BakedFluid(Optional transformation, VertexFormat format, int color, TextureAtlasSprite still, TextureAtlasSprite flowing, boolean gas) - { - this(transformation, format, color, still, flowing, gas, Optional.absent()); - } - - public BakedFluid(Optional transformation, VertexFormat format, int color, TextureAtlasSprite still, TextureAtlasSprite flowing, boolean gas, Optional stateOption) - { - this(transformation, ImmutableMap.of(), format, color, still, flowing, gas, stateOption); - } - public BakedFluid(Optional transformation, ImmutableMap transforms, VertexFormat format, int color, TextureAtlasSprite still, TextureAtlasSprite flowing, boolean gas, Optional stateOption) { this(transformation, transforms, format, color, still, flowing, gas, stateOption.isPresent(), getCorners(stateOption), getFlow(stateOption)); diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 781bafbe2b..b3c8280ab4 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -10,12 +10,8 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.Queue; import java.util.Set; -import com.google.common.base.Joiner; -import com.google.common.collect.*; - import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -26,15 +22,24 @@ import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.BlockPart; import net.minecraft.client.renderer.block.model.BlockPartFace; import net.minecraft.client.renderer.block.model.BlockPartRotation; +import net.minecraft.client.renderer.block.model.BuiltInModel; +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.ItemModelGenerator; +import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelBlock; import net.minecraft.client.renderer.block.model.ModelBlockDefinition; import net.minecraft.client.renderer.block.model.ModelBlockDefinition.MissingVariantException; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelRotation; import net.minecraft.client.renderer.block.model.MultipartBakedModel; +import net.minecraft.client.renderer.block.model.SimpleBakedModel; import net.minecraft.client.renderer.block.model.Variant; import net.minecraft.client.renderer.block.model.VariantList; +import net.minecraft.client.renderer.block.model.WeightedBakedModel; +import net.minecraft.client.renderer.block.model.multipart.Multipart; +import net.minecraft.client.renderer.block.model.multipart.Selector; import net.minecraft.client.renderer.block.statemap.IStateMapper; import net.minecraft.client.renderer.texture.IIconCreator; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -42,22 +47,13 @@ import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.renderer.block.model.BuiltInModel; -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.model.ModelRotation; -import net.minecraft.client.renderer.block.model.SimpleBakedModel; -import net.minecraft.client.renderer.block.model.WeightedBakedModel; -import net.minecraft.client.renderer.block.model.multipart.Multipart; -import net.minecraft.client.renderer.block.model.multipart.Selector; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.launchwrapper.Launch; import net.minecraft.util.EnumFacing; -import net.minecraft.util.registry.IRegistry; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.IRegistry; import net.minecraftforge.client.model.animation.Animation; import net.minecraftforge.client.model.animation.IAnimatedModel; import net.minecraftforge.client.model.animation.IClip; @@ -78,9 +74,18 @@ import net.minecraftforge.fml.common.registry.RegistryDelegate; import org.apache.commons.lang3.tuple.Pair; import com.google.common.base.Function; +import com.google.common.base.Joiner; import com.google.common.base.Optional; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Multimap; +import com.google.common.collect.Sets; -public class ModelLoader extends ModelBakery +public final class ModelLoader extends ModelBakery { private final Map stateModels = Maps.newHashMap(); private final Set missingVariants = Sets.newHashSet(); @@ -110,7 +115,7 @@ public class ModelLoader extends ModelBakery isLoading = true; loadBlocks(); loadVariantItemModels(); - missingModel = ModelLoaderRegistry.getModel(new ResourceLocation(MODEL_MISSING.getResourceDomain(), MODEL_MISSING.getResourcePath())); + missingModel = ModelLoaderRegistry.getMissingModel(); stateModels.put(MODEL_MISSING, missingModel); final Set textures = Sets.newHashSet(ModelLoaderRegistry.getTextures()); @@ -181,7 +186,17 @@ public class ModelLoader extends ModelBakery @Override protected void registerVariant(ModelBlockDefinition definition, ModelResourceLocation location) { - stateModels.put(location, ModelLoaderRegistry.getModel(location)); + IModel model; + try + { + model = ModelLoaderRegistry.getModel(location); + } + catch(Exception e) + { + storeException(location, e); + model = getMissingModel(); + } + stateModels.put(location, model); } @Override @@ -189,7 +204,7 @@ public class ModelLoader extends ModelBakery { for (ModelResourceLocation location : locations) { - stateModels.put(location, ModelLoaderRegistry.getModel(location)); + registerVariant(null, location); } } @@ -235,25 +250,27 @@ public class ModelLoader extends ModelBakery ResourceLocation file = getItemLocation(s); ModelResourceLocation memory = getInventoryVariant(s); itemBar.step(memory.toString()); + IModel model = ModelLoaderRegistry.getMissingModel(); + Exception exception = null; try { - IModel model = ModelLoaderRegistry.getModel(file); - if(model == getMissingModel()) - { - // try blockstate json if the item model is missing - FMLLog.fine("Item json isn't found for '" + memory + "', trying to load the variant from the blockstate json"); - try - { - model = ModelLoaderRegistry.getModel(memory); - } - catch (Exception exception) - { - storeException(memory, new Exception("Could not load item model either from the normal location " + file + " or from the blockstate", exception)); - } - } - stateModels.put(memory, model); + model = ModelLoaderRegistry.getModel(file); } - catch (Exception exception) + catch(Exception e) + { + // try blockstate json if the item model is missing + FMLLog.fine("Item json isn't found for '" + memory + "', trying to load the variant from the blockstate json"); + try + { + model = ModelLoaderRegistry.getModel(memory); + } + catch (Exception ex) + { + exception = new Exception("Could not load item model either from the normal location " + file + " or from the blockstate", ex); + } + } + stateModels.put(memory, model); + if(exception != null) { storeException(memory, exception); } @@ -282,7 +299,7 @@ public class ModelLoader extends ModelBakery for(String s : getVariantNames(Items.bucket)) { ModelResourceLocation memory = getInventoryVariant(s); - IModel model = ModelLoaderRegistry.getModel(new ResourceLocation("forge", "item/bucket")); + IModel model = ModelLoaderRegistry.getModelOrMissing(new ResourceLocation("forge", "item/bucket")); // only on successful load, otherwise continue using the old model if(model != getMissingModel()) { @@ -309,7 +326,7 @@ public class ModelLoader extends ModelBakery for(String s : getVariantNames(Items.milk_bucket)) { ModelResourceLocation memory = getInventoryVariant(s); - IModel model = ModelLoaderRegistry.getModel(new ResourceLocation("forge", "item/bucket_milk")); + IModel model = ModelLoaderRegistry.getModelOrMissing(new ResourceLocation("forge", "item/bucket_milk")); // only on successful load, otherwise continue using the old model if(model != getMissingModel()) { @@ -348,7 +365,7 @@ public class ModelLoader extends ModelBakery return new ResourceLocation(model.getResourceDomain(), model.getResourcePath() + ".json"); } - private class VanillaModelWrapper implements IRetexturableModel, IModelSimpleProperties, IModelUVLock, IAnimatedModel + private final class VanillaModelWrapper implements IRetexturableModel, IModelSimpleProperties, IModelUVLock, IAnimatedModel { private final ResourceLocation location; private final ModelBlock model; @@ -372,7 +389,7 @@ public class ModelLoader extends ModelBakery { set.add(dep); // TODO: check if this can go somewhere else, random access to global things is bad - stateModels.put(getInventoryVariant(dep.toString()), ModelLoaderRegistry.getModel(dep)); + stateModels.put(getInventoryVariant(dep.toString()), ModelLoaderRegistry.getModelOrLogError(dep, "Could not load override model " + dep + " for model " + location)); } } if(model.getParentLocation() != null && !model.getParentLocation().getResourcePath().startsWith("builtin/")) @@ -393,11 +410,7 @@ public class ModelLoader extends ModelBakery } else { - IModel parent = ModelLoaderRegistry.getModel(model.getParentLocation()); - if(parent == getMissingModel()) - { - FMLLog.warning("Could not load vanilla model parent '" + model.getParentLocation() + "' for '" + model); - } + IModel parent = ModelLoaderRegistry.getModelOrLogError(model.getParentLocation(), "Could not load vanilla model parent '" + model.getParentLocation() + "' for '" + model); if(parent instanceof VanillaModelWrapper) { model.parent = ((VanillaModelWrapper) parent).model; @@ -629,7 +642,7 @@ public class ModelLoader extends ModelBakery } } - private static class WeightedRandomModel implements IModel + private static final class WeightedRandomModel implements IModel { private final List variants; private final List locations = new ArrayList(); @@ -637,7 +650,7 @@ public class ModelLoader extends ModelBakery private final List models = new ArrayList(); private final IModelState defaultState; - public WeightedRandomModel(ResourceLocation parent, VariantList variants) + public WeightedRandomModel(ResourceLocation parent, VariantList variants) throws Exception { this.variants = variants.getVariantList(); ImmutableList.Builder> builder = ImmutableList.builder(); @@ -646,21 +659,11 @@ public class ModelLoader extends ModelBakery ResourceLocation loc = v.getModelLocation(); locations.add(loc); - IModel model = null; - try - { - model = ModelLoaderRegistry.getModel(loc); - } - catch (Exception e) - { - /* - * Vanilla eats this, which makes it only show variants that have models. - * But that doesn't help debugging, so we maintain the missing model - * so that resource pack makers have a hint that their states are broken. - */ - FMLLog.getLogger().error("Unable to load block model: \'" + loc + "\' for variant: \'" + parent, e); - model = ModelLoaderRegistry.getMissingModel(); - } + /* + * Vanilla eats this, which makes it only show variants that have models. + * But that doesn't help debugging, so throw the exception + */ + IModel model = ModelLoaderRegistry.getModel(loc); // FIXME: is this the place? messes up dependency and texture resolution if (v instanceof ISmartVariant) @@ -668,7 +671,7 @@ public class ModelLoader extends ModelBakery model = ((ISmartVariant)v).process(model); for(ResourceLocation location : model.getDependencies()) { - ModelLoaderRegistry.getModel(location); + ModelLoaderRegistry.getModelOrMissing(location); } //FMLLog.getLogger().error("Exception resolving indirect dependencies for model" + loc, e); textures.addAll(model.getTextures()); // Kick this, just in case. @@ -680,6 +683,7 @@ public class ModelLoader extends ModelBakery if (models.size() == 0) //If all variants are missing, add one with the missing model and default rotation. { + // FIXME: log this? IModel missing = ModelLoaderRegistry.getMissingModel(); models.add(missing); builder.add(Pair.of(missing, TRSRTransformation.identity())); @@ -728,7 +732,14 @@ public class ModelLoader extends ModelBakery { if (missingModel == null) { - missingModel = VanillaLoader.instance.loadModel(new ResourceLocation(MODEL_MISSING.getResourceDomain(), MODEL_MISSING.getResourcePath())); + try + { + missingModel = VanillaLoader.instance.loadModel(new ResourceLocation(MODEL_MISSING.getResourceDomain(), MODEL_MISSING.getResourcePath())); + } + catch(Exception e) + { + throw new RuntimeException("Missing the missing model, this should never happen"); + } } return missingModel; } @@ -738,7 +749,7 @@ public class ModelLoader extends ModelBakery return itemModel; } - static enum VanillaLoader implements ICustomModelLoader + protected static enum VanillaLoader implements ICustomModelLoader { instance; @@ -764,7 +775,7 @@ public class ModelLoader extends ModelBakery return true; } - public IModel loadModel(ResourceLocation modelLocation) + public IModel loadModel(ResourceLocation modelLocation) throws Exception { String modelPath = modelLocation.getResourcePath(); if(modelLocation.getResourcePath().startsWith("models/")) @@ -773,21 +784,8 @@ public class ModelLoader extends ModelBakery } ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getResourceDomain(), "armatures/" + modelPath + ".json"); ModelBlockAnimation animation = Animation.INSTANCE.loadVanillaAnimation(armatureLocation); - ModelBlock model = null; - try - { - model = loader.loadModel(modelLocation); - } - catch(Exception e) - { - // FIXME better error reporting? - FMLLog.getLogger().error("Unable to load vanilla model " + modelLocation, e); - } - if(model != null) - { - return loader.new VanillaModelWrapper(modelLocation, model, false, animation); - } - return ModelLoaderRegistry.getMissingModel(); + ModelBlock model = loader.loadModel(modelLocation); + return loader.new VanillaModelWrapper(modelLocation, model, false, animation); } @Override @@ -797,7 +795,7 @@ public class ModelLoader extends ModelBakery } } - public static class White extends TextureAtlasSprite + public static final class White extends TextureAtlasSprite { public static ResourceLocation loc = new ResourceLocation("white"); public static White instance = new White(); @@ -824,6 +822,7 @@ public class ModelLoader extends ModelBakery int[][] pixels = new int[Minecraft.getMinecraft().gameSettings.mipmapLevels + 1][]; pixels[0] = new int[image.getWidth() * image.getHeight()]; image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels[0], 0, image.getWidth()); + this.clearFramesTextureData(); this.framesTextureData.add(pixels); return false; } @@ -1045,7 +1044,7 @@ public class ModelLoader extends ModelBakery } @Override - public IModel loadModel(ResourceLocation modelLocation) + public IModel loadModel(ResourceLocation modelLocation) throws Exception { ModelResourceLocation variant = (ModelResourceLocation) modelLocation; ModelBlockDefinition definition = loader.getModelBlockDefinition(variant); @@ -1060,9 +1059,8 @@ public class ModelLoader extends ModelBakery { return new MultipartModel(new ResourceLocation(variant.getResourceDomain(), variant.getResourcePath()), definition.getMultipartData()); } - // FIXME log missing model? + throw e; } - return ModelLoaderRegistry.getMissingModel(); } @Override @@ -1078,7 +1076,7 @@ public class ModelLoader extends ModelBakery private final Multipart multipart; private final ImmutableMap partModels; - public MultipartModel(ResourceLocation location, Multipart multipart) + public MultipartModel(ResourceLocation location, Multipart multipart) throws Exception { this.location = location; this.multipart = multipart; diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index 13089f744f..3f64a7c71d 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -69,7 +69,7 @@ public class ModelLoaderRegistry * ResourceLocation argument will be passed directly to the custom model loaders, * ModelResourceLocation argument will be loaded through the blockstate system. */ - public static IModel getModel(ResourceLocation location) + public static IModel getModel(ResourceLocation location) throws Exception { IModel model; if(cache.containsKey(location)) return cache.get(location); @@ -77,7 +77,7 @@ public class ModelLoaderRegistry { if(location.getClass() == loading.getClass() && location.equals(loading)) { - throw new IllegalStateException("circular model dependencies, stack: [" + Joiner.on(", ").join(loadingModels) + "]"); + throw new LoaderException("circular model dependencies, stack: [" + Joiner.on(", ").join(loadingModels) + "]"); } } loadingModels.addLast(location); @@ -93,15 +93,14 @@ public class ModelLoaderRegistry { if(accepted != null) { - FMLLog.severe("2 loaders (%s and %s) want to load the same model %s", accepted, loader, location); - throw new IllegalStateException("2 loaders want to load the same model"); + throw new LoaderException(String.format("2 loaders (%s and %s) want to load the same model %s", accepted, loader, location)); } accepted = loader; } } catch(Exception e) { - FMLLog.log(Level.ERROR, e, "Exception checking if model %s can be loaded with loader %s, skipping", location, loader); + throw new LoaderException(String.format("Exception checking if model %s can be loaded with loader %s, skipping", location, loader), e); } } @@ -120,31 +119,25 @@ public class ModelLoaderRegistry if(accepted == null) { - FMLLog.severe("no suitable loader found for the model %s, skipping", location); - model = getMissingModel(); + throw new LoaderException("no suitable loader found for the model " + location + ", skipping"); } - else + try { - try - { - model = accepted.loadModel(actual); - } - catch(Exception e) - { - FMLLog.log(Level.ERROR, e, "Exception loading model %s with loader %s, skipping", location, accepted); - model = getMissingModel(); - } - if(model == getMissingModel()) - { - FMLLog.log(Level.ERROR, "Loader %s returned missing model while loading model %s", accepted, location); - } - if(model == null) - { - FMLLog.log(Level.ERROR, "Loader %s returned null while loading model %s", accepted, location); - model = getMissingModel(); - } - textures.addAll(model.getTextures()); + model = accepted.loadModel(actual); } + catch(Exception e) + { + throw new LoaderException(String.format("Exception loading model %s with loader %s, skipping", location, accepted), e); + } + if(model == getMissingModel()) + { + throw new LoaderException(String.format("Loader %s returned missing model while loading model %s", accepted, location)); + } + if(model == null) + { + throw new LoaderException(String.format("Loader %s returned null while loading model %s", accepted, location)); + } + textures.addAll(model.getTextures()); } finally { @@ -157,11 +150,42 @@ public class ModelLoaderRegistry cache.put(location, model); for (ResourceLocation dep : model.getDependencies()) { - getModel(dep); + getModelOrMissing(dep); } return model; } + /** + * Use this if you don't care about the exception and want some model anyway. + */ + public static IModel getModelOrMissing(ResourceLocation location) + { + try + { + return getModel(location); + } + catch(Exception e) + { + return getMissingModel(); + } + } + + /** + * Use this if you want the model, but need to log the error. + */ + public static IModel getModelOrLogError(ResourceLocation location, String error) + { + try + { + return getModel(location); + } + catch(Exception e) + { + FMLLog.getLogger().error(error, e); + return getMissingModel(); + } + } + public static IModel getMissingModel() { return ModelLoader.VanillaLoader.instance.getLoader().getMissingModel(); @@ -180,4 +204,19 @@ public class ModelLoaderRegistry { return textures; } + + public static class LoaderException extends Exception + { + public LoaderException(String message) + { + super(message); + } + + public LoaderException(String message, Throwable cause) + { + super(message, cause); + } + + private static final long serialVersionUID = 1L; + } } diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index b8ae6d4314..b110763cb9 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -30,7 +30,7 @@ import com.google.common.collect.ImmutableMap; import com.google.gson.JsonElement; import com.google.gson.JsonParser; -public class MultiLayerModel implements IModelCustomData +public final class MultiLayerModel implements IModelCustomData { public static final MultiLayerModel instance = new MultiLayerModel(ImmutableMap., ModelResourceLocation>of()); @@ -58,7 +58,7 @@ public class MultiLayerModel implements IModelCustomData ImmutableMap.Builder, IBakedModel> builder = ImmutableMap.builder(); for(Optional key : models.keySet()) { - IModel model = ModelLoaderRegistry.getModel(models.get(key)); + IModel model = ModelLoaderRegistry.getModelOrLogError(models.get(key), "Couldn't load MultiLayerModel dependency: " + models.get(key)); builder.put(key, model.bake(new ModelStateComposition(state, model.getDefaultState()), format, bakedTextureGetter)); } return builder.build(); @@ -115,7 +115,7 @@ public class MultiLayerModel implements IModelCustomData return new ModelResourceLocation("builtin/missing", "missing"); } - public static class MultiLayerBakedModel implements IPerspectiveAwareModel + private static final class MultiLayerBakedModel implements IPerspectiveAwareModel { private final ImmutableMap, IBakedModel> models; private final ImmutableMap cameraTransforms;; diff --git a/src/main/java/net/minecraftforge/client/model/MultiModel.java b/src/main/java/net/minecraftforge/client/model/MultiModel.java index c35004f7a6..a6f3b6c8c8 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiModel.java @@ -32,21 +32,16 @@ import com.google.common.collect.Sets; // TODO: Switch to vanilla class, or to something similar @Deprecated -public class MultiModel implements IModel +public final class MultiModel implements IModel { - public static class Baked implements IPerspectiveAwareModel + private static final class Baked implements IPerspectiveAwareModel { - protected final IBakedModel base; - protected final ImmutableMap parts; + private final IBakedModel base; + private final ImmutableMap parts; - protected final IBakedModel internalBase; - protected ImmutableMap, ImmutableList> quads; - protected final ImmutableMap> transforms; - - public Baked(IBakedModel base, ImmutableMap parts) - { - this(null, false, base, parts); - } + private final IBakedModel internalBase; + private ImmutableMap, ImmutableList> quads; + private final ImmutableMap> transforms; public Baked(ResourceLocation location, boolean perspective, IBakedModel base, ImmutableMap parts) { @@ -148,16 +143,6 @@ public class MultiModel implements IModel return quads.get(Optional.fromNullable(side)); } - public IBakedModel getBaseModel() - { - return base; - } - - public Map getParts() - { - return parts; - } - @Override public Pair handlePerspective(TransformType cameraTransformType) { @@ -173,10 +158,10 @@ public class MultiModel implements IModel } } - protected final ResourceLocation location; - protected final IModel base; - protected final IModelState baseState; - protected final Map> parts; + private final ResourceLocation location; + private final IModel base; + private final IModelState baseState; + private final Map> parts; public MultiModel(ResourceLocation location, IModel base, IModelState baseState, ImmutableMap> parts) { @@ -186,16 +171,6 @@ public class MultiModel implements IModel this.parts = parts; } - public MultiModel(IModel base, IModelState baseState, ImmutableMap> parts) - { - this(null, base, baseState, parts); - } - - public MultiModel(IModel base, IModelState baseState, Map> parts) - { - this(null, base, baseState, ImmutableMap.copyOf(parts)); - } - public MultiModel(ResourceLocation location, IModel base, IModelState baseState, Map> parts) { this(location, base, baseState, ImmutableMap.copyOf(parts)); @@ -254,22 +229,6 @@ public class MultiModel implements IModel return new Baked(location, true, bakedBase, mapBuilder.build()); } - /** - * @return The base model of this MultiModel. May be null. - */ - public IModel getBaseModel() - { - return base; - } - - /** - * @return A map of the submodel name to its IModel and IModelState. - */ - public Map> getParts() - { - return parts; - } - @Override public IModelState getDefaultState() { diff --git a/src/main/java/net/minecraftforge/client/model/MultiModelState.java b/src/main/java/net/minecraftforge/client/model/MultiModelState.java index 15e9dff77a..6b06fcc76c 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiModelState.java +++ b/src/main/java/net/minecraftforge/client/model/MultiModelState.java @@ -7,7 +7,7 @@ import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -public class MultiModelState implements IModelState +public final class MultiModelState implements IModelState { private final ImmutableMap states; diff --git a/src/main/java/net/minecraftforge/client/model/SimpleModelState.java b/src/main/java/net/minecraftforge/client/model/SimpleModelState.java index a4da1cc287..5c2e384399 100644 --- a/src/main/java/net/minecraftforge/client/model/SimpleModelState.java +++ b/src/main/java/net/minecraftforge/client/model/SimpleModelState.java @@ -6,7 +6,7 @@ import com.google.common.collect.ImmutableMap; /* * Simple implementation of IModelState via a map and a default value. */ -public class SimpleModelState implements IModelState +public final class SimpleModelState implements IModelState { private final ImmutableMap map; private final Optional def; diff --git a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java index 06d05167b2..368c2adc58 100644 --- a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java +++ b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java @@ -30,7 +30,7 @@ import com.google.common.base.Optional; * should be comparable to using Matrix4f directly. * Immutable. */ -public class TRSRTransformation implements IModelState, ITransformation +public final class TRSRTransformation implements IModelState, ITransformation { private final Matrix4f matrix; diff --git a/src/main/java/net/minecraftforge/client/model/animation/Clips.java b/src/main/java/net/minecraftforge/client/model/animation/Clips.java index 2b5d910c2f..5561e3d187 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/Clips.java +++ b/src/main/java/net/minecraftforge/client/model/animation/Clips.java @@ -62,7 +62,7 @@ public final class Clips */ public static IClip getModelClipNode(ResourceLocation modelLocation, String clipName) { - IModel model = ModelLoaderRegistry.getModel(modelLocation); + IModel model = ModelLoaderRegistry.getModelOrMissing(modelLocation); if(model instanceof IAnimatedModel) { Optional clip = ((IAnimatedModel)model).getClip(clipName); diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 0424343d61..7196cda27c 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -25,15 +25,25 @@ import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.IResource; import net.minecraft.client.resources.IResourceManager; import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.*; -import net.minecraftforge.client.model.animation.IClip; +import net.minecraft.util.math.MathHelper; +import net.minecraftforge.client.model.ICustomModelLoader; +import net.minecraftforge.client.model.IModel; +import net.minecraftforge.client.model.IModelCustomData; +import net.minecraftforge.client.model.IModelPart; +import net.minecraftforge.client.model.IModelSimpleProperties; +import net.minecraftforge.client.model.IModelState; +import net.minecraftforge.client.model.IPerspectiveAwareModel; +import net.minecraftforge.client.model.IRetexturableModel; +import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.client.model.ModelLoaderRegistry; +import net.minecraftforge.client.model.ModelStateComposition; +import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.client.model.animation.IAnimatedModel; +import net.minecraftforge.client.model.animation.IClip; import net.minecraftforge.client.model.animation.IJoint; import net.minecraftforge.client.model.b3d.B3DModel.Animation; import net.minecraftforge.client.model.b3d.B3DModel.Face; -import net.minecraftforge.client.model.b3d.B3DModel.IKind; import net.minecraftforge.client.model.b3d.B3DModel.Key; import net.minecraftforge.client.model.b3d.B3DModel.Mesh; import net.minecraftforge.client.model.b3d.B3DModel.Node; @@ -48,7 +58,6 @@ import net.minecraftforge.fml.common.FMLLog; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Triple; -import org.apache.logging.log4j.Level; import com.google.common.base.Function; import com.google.common.base.Objects; @@ -69,7 +78,7 @@ import com.google.gson.JsonParser; * To enable for your mod call instance.addDomain(modid). * If you need more control over accepted resources - extend the class, and register a new instance with ModelLoaderRegistry. */ -public class B3DLoader implements ICustomModelLoader +public final class B3DLoader implements ICustomModelLoader { public static final B3DLoader instance = new B3DLoader(); @@ -95,7 +104,7 @@ public class B3DLoader implements ICustomModelLoader } @SuppressWarnings("unchecked") - public IModel loadModel(ResourceLocation modelLocation) + public IModel loadModel(ResourceLocation modelLocation) throws Exception { ResourceLocation file = new ResourceLocation(modelLocation.getResourceDomain(), modelLocation.getResourcePath()); if(!cache.containsKey(file)) @@ -121,12 +130,12 @@ public class B3DLoader implements ICustomModelLoader } catch(IOException e) { - FMLLog.log(Level.ERROR, e, "Exception loading model %s with B3D loader, skipping", modelLocation); cache.put(file, null); + throw e; } } B3DModel model = cache.get(file); - if(model == null) return ModelLoaderRegistry.getMissingModel(); + if(model == null) throw new ModelLoaderRegistry.LoaderException("Error loading model previously: " + file); if(!(model.getRoot().getKind() instanceof Mesh)) { return new ModelWrapper(modelLocation, model, ImmutableSet.of(), true, true, 1); @@ -134,7 +143,7 @@ public class B3DLoader implements ICustomModelLoader return new ModelWrapper(modelLocation, model, ImmutableSet.of(((Node)model.getRoot()).getName()), true, true, 1); } - public static class B3DState implements IModelState + public static final class B3DState implements IModelState { private final Animation animation; private final int frame; @@ -304,7 +313,7 @@ public class B3DLoader implements ICustomModelLoader } } - public static class NodeJoint implements IJoint + static final class NodeJoint implements IJoint { private final Node node; @@ -380,27 +389,7 @@ public class B3DLoader implements ICustomModelLoader } } - public static class PartWrapper> implements IModelPart - { - private final Node node; - - public static > PartWrapper create(Node node) - { - return new PartWrapper(node); - } - - public PartWrapper(Node node) - { - this.node = node; - } - - public Node getNode() - { - return node; - } - } - - public static class ModelWrapper implements IRetexturableModel, IModelCustomData, IModelSimpleProperties, IAnimatedModel + private static final class ModelWrapper implements IRetexturableModel, IModelCustomData, IModelSimpleProperties, IAnimatedModel { private final ResourceLocation modelLocation; private final B3DModel model; @@ -591,7 +580,7 @@ public class B3DLoader implements ICustomModelLoader } } - private static class BakedWrapper implements IPerspectiveAwareModel + private static final class BakedWrapper implements IPerspectiveAwareModel { private final Node node; private final IModelState state; @@ -697,7 +686,7 @@ public class B3DLoader implements ICustomModelLoader return quads; } - protected void generateQuads(ImmutableList.Builder builder, Node node, final IModelState state) + private void generateQuads(ImmutableList.Builder builder, Node node, final IModelState state) { for(Node child : node.getNodes().values()) { @@ -828,7 +817,6 @@ public class B3DLoader implements ICustomModelLoader return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, state, cameraTransformType); } - @Override public ItemOverrideList getOverrides() { // TODO handle items diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java b/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java index 935f3ecbae..a84b680f6b 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java @@ -1,7 +1,6 @@ package net.minecraftforge.client.model.obj; import java.io.FileNotFoundException; -import java.io.IOException; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -22,7 +21,7 @@ import org.apache.logging.log4j.Level; * To enable your mod call instance.addDomain(modid). * If you need more control over accepted resources - extend the class, and register a new instance with ModelLoaderRegistry. */ -public class OBJLoader implements ICustomModelLoader { +public final class OBJLoader implements ICustomModelLoader { public static final OBJLoader instance = new OBJLoader(); private IResourceManager manager; private final Set enabledDomains = new HashSet(); @@ -45,44 +44,37 @@ public class OBJLoader implements ICustomModelLoader { return enabledDomains.contains(modelLocation.getResourceDomain()) && modelLocation.getResourcePath().endsWith(".obj"); } - public IModel loadModel(ResourceLocation modelLocation) + public IModel loadModel(ResourceLocation modelLocation) throws Exception { ResourceLocation file = new ResourceLocation(modelLocation.getResourceDomain(), modelLocation.getResourcePath()); if (!cache.containsKey(file)) { + IResource resource = null; try { - IResource resource = null; - try - { - resource = manager.getResource(file); - } - catch (FileNotFoundException e) - { - if (modelLocation.getResourcePath().startsWith("models/block/")) - resource = manager.getResource(new ResourceLocation(file.getResourceDomain(), "models/item/" + file.getResourcePath().substring("models/block/".length()))); - else if (modelLocation.getResourcePath().startsWith("models/item/")) - resource = manager.getResource(new ResourceLocation(file.getResourceDomain(), "models/block/" + file.getResourcePath().substring("models/item/".length()))); - else throw e; - } - OBJModel.Parser parser = new OBJModel.Parser(resource, manager); - OBJModel model = null; - try - { - model = parser.parse(); - } - finally - { - cache.put(modelLocation, model); - } + resource = manager.getResource(file); } - catch (IOException e) + catch (FileNotFoundException e) { - cache.put(modelLocation, null); + if (modelLocation.getResourcePath().startsWith("models/block/")) + resource = manager.getResource(new ResourceLocation(file.getResourceDomain(), "models/item/" + file.getResourcePath().substring("models/block/".length()))); + else if (modelLocation.getResourcePath().startsWith("models/item/")) + resource = manager.getResource(new ResourceLocation(file.getResourceDomain(), "models/block/" + file.getResourcePath().substring("models/item/".length()))); + else throw e; + } + OBJModel.Parser parser = new OBJModel.Parser(resource, manager); + OBJModel model = null; + try + { + model = parser.parse(); + } + finally + { + cache.put(modelLocation, model); } } OBJModel model = cache.get(file); - if (model == null) return ModelLoaderRegistry.getMissingModel(); + if (model == null) throw new ModelLoaderRegistry.LoaderException("Error loading model previously: " + file); return model; } } diff --git a/src/test/java/net/minecraftforge/debug/DynBucketTest.java b/src/test/java/net/minecraftforge/debug/DynBucketTest.java index a303f048ac..6e0b4e6eac 100644 --- a/src/test/java/net/minecraftforge/debug/DynBucketTest.java +++ b/src/test/java/net/minecraftforge/debug/DynBucketTest.java @@ -37,9 +37,10 @@ import net.minecraftforge.fml.common.registry.GameRegistry; import java.util.List; -@Mod(modid = "DynBucketTest", version = "0.1", dependencies = "after:" + ModelFluidDebug.MODID) +@Mod(modid = DynBucketTest.MODID, version = "0.1", dependencies = "after:" + ModelFluidDebug.MODID) public class DynBucketTest { + public static final String MODID = "DynBucketTest"; public static final Item dynBucket = new DynBucket(); public static final Item dynBottle = new DynBottle(); @@ -79,6 +80,7 @@ public class DynBucketTest } }); ModelBakery.registerItemVariants(dynBottle, bottle); + ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GameRegistry.findBlock(MODID, "simpletank")), 0, new ModelResourceLocation(new ResourceLocation(MODID, "simpletank"), "normal")); } } diff --git a/src/test/java/net/minecraftforge/debug/ItemTileDebug.java b/src/test/java/net/minecraftforge/debug/ItemTileDebug.java index 644155865b..309a4ea6c5 100644 --- a/src/test/java/net/minecraftforge/debug/ItemTileDebug.java +++ b/src/test/java/net/minecraftforge/debug/ItemTileDebug.java @@ -55,7 +55,7 @@ public class ItemTileDebug public static class ClientProxy extends CommonProxy { - private static ModelResourceLocation itemLocation = new ModelResourceLocation(blockName, "inventory"); + private static ModelResourceLocation itemLocation = new ModelResourceLocation(blockName, "normal"); @SuppressWarnings("deprecation") @Override diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index a554c07b92..3156a226fb 100644 --- a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -203,8 +203,8 @@ public class ModelAnimationDebug { model = ((IModelCustomData)model).process(ImmutableMap.of("mesh", "[\"Base\", \"Lid\"]")); }*/ - IModel base = ModelLoaderRegistry.getModel(new ResourceLocation(ModelAnimationDebug.MODID, "block/engine")); - IModel ring = ModelLoaderRegistry.getModel(new ResourceLocation(ModelAnimationDebug.MODID, "block/engine_ring")); + IModel base = ModelLoaderRegistry.getModelOrMissing(new ResourceLocation(ModelAnimationDebug.MODID, "block/engine")); + IModel ring = ModelLoaderRegistry.getModelOrMissing(new ResourceLocation(ModelAnimationDebug.MODID, "block/engine_ring")); ImmutableMap textures = ImmutableMap.of( "base", "blocks/stone", "front", "blocks/log_oak", diff --git a/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java b/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java index cb829bec5c..c15b75b289 100644 --- a/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java @@ -251,21 +251,24 @@ public class ModelBakeEventDebug @Override public List getQuads(IBlockState state, EnumFacing side, long rand) { - if(side != null || !(state instanceof IExtendedBlockState)) return ImmutableList.of(); + if(side != null) return ImmutableList.of(); IExtendedBlockState exState = (IExtendedBlockState)state; int len = cubeSize * 5 + 1; List ret = new ArrayList(); for(EnumFacing f : EnumFacing.values()) { ret.add(createSidedBakedQuad(0, 1, 0, 1, 1, base, f)); - for(int i = 0; i < cubeSize; i++) + if(state != null) { - for(int j = 0; j < cubeSize; j++) + for(int i = 0; i < cubeSize; i++) { - Integer value = exState.getValue(properties[f.ordinal()]); - if(value != null && (value & (1 << (i * cubeSize + j))) != 0) + for(int j = 0; j < cubeSize; j++) { - ret.add(createSidedBakedQuad((float)(1 + i * 5) / len, (float)(5 + i * 5) / len, (float)(1 + j * 5) / len, (float)(5 + j * 5) / len, 1.0001f, overlay, f)); + Integer value = exState.getValue(properties[f.ordinal()]); + if(value != null && (value & (1 << (i * cubeSize + j))) != 0) + { + ret.add(createSidedBakedQuad((float)(1 + i * 5) / len, (float)(5 + i * 5) / len, (float)(1 + j * 5) / len, (float)(5 + j * 5) / len, 1.0001f, overlay, f)); + } } } } diff --git a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java index 8d41475488..68488aa299 100644 --- a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java @@ -255,7 +255,7 @@ public class ModelLoaderRegistryDebug { if (world.getTileEntity(pos) == null) world.setTileEntity(pos, new OBJTesseractTileEntity()); OBJTesseractTileEntity tileEntity = (OBJTesseractTileEntity) world.getTileEntity(pos); - IModel model = ModelLoaderRegistry.getModel(new ResourceLocation(MODID.toLowerCase() + ":" + "block/tesseract.obj")); + IModel model = ModelLoaderRegistry.getModelOrMissing(new ResourceLocation(MODID.toLowerCase() + ":" + "block/tesseract.obj")); if (player.isSneaking()) { diff --git a/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java b/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java index 88ea98dc39..6b5d702f42 100644 --- a/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java +++ b/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java @@ -1,5 +1,6 @@ package net.minecraftforge.test; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer.EnumStatus; @@ -14,6 +15,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; @@ -24,6 +26,7 @@ import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; import net.minecraftforge.event.entity.player.SleepingLocationCheckEvent; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.Event.Result; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -37,12 +40,35 @@ public class NoBedSleepingTest @CapabilityInject(IExtraSleeping.class) private static final Capability SLEEP_CAP = null; + @SidedProxy + public static CommonProxy proxy = null; + + public static abstract class CommonProxy + { + public void preInit(FMLPreInitializationEvent event) + { + GameRegistry.registerItem(ItemSleepingPill.instance, ItemSleepingPill.name); + CapabilityManager.INSTANCE.register(IExtraSleeping.class, new Storage(), DefaultImpl.class); + MinecraftForge.EVENT_BUS.register(new EventHandler()); + } + } + + public static final class ServerProxy extends CommonProxy {} + + public static final class ClientProxy extends CommonProxy + { + @Override + public void preInit(FMLPreInitializationEvent event) + { + super.preInit(event); + ModelLoader.setCustomModelResourceLocation(ItemSleepingPill.instance, 0, new ModelResourceLocation(new ResourceLocation(MODID, ItemSleepingPill.name), "inventory")); + } + } + @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { - GameRegistry.registerItem(ItemSleepingPill.instance, ItemSleepingPill.name); - CapabilityManager.INSTANCE.register(IExtraSleeping.class, new Storage(), DefaultImpl.class); - MinecraftForge.EVENT_BUS.register(new EventHandler()); + proxy.preInit(event); } public static class EventHandler diff --git a/src/test/resources/assets/dynbuckettest/blockstates/simpletank.json b/src/test/resources/assets/dynbuckettest/blockstates/simpletank.json new file mode 100644 index 0000000000..a407ada13e --- /dev/null +++ b/src/test/resources/assets/dynbuckettest/blockstates/simpletank.json @@ -0,0 +1,10 @@ +{ + "forge_marker": 1, + "defaults": { + "transform": "forge:default-block", + "model": "builtin/generated" + }, + "variants": { + "normal": [{}] + } +} \ No newline at end of file diff --git a/src/test/resources/assets/forgedebugitemtile/blockstates/custom_model_block.json b/src/test/resources/assets/forgedebugitemtile/blockstates/custom_model_block.json new file mode 100644 index 0000000000..67e2f34328 --- /dev/null +++ b/src/test/resources/assets/forgedebugitemtile/blockstates/custom_model_block.json @@ -0,0 +1,10 @@ +{ + "forge_marker": 1, + "defaults": { + "transform": "forge:default-block", + "model": "builtin/generated" + }, + "variants": { + "normal": [{}] + } +} diff --git a/src/test/resources/assets/forgedebugitemtile/models/item/custom_model_block.json b/src/test/resources/assets/forgedebugitemtile/models/item/custom_model_block.json deleted file mode 100644 index 43a272a605..0000000000 --- a/src/test/resources/assets/forgedebugitemtile/models/item/custom_model_block.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "builtin/entity" -} diff --git a/src/test/resources/assets/forgedebugnobedsleeping/models/item/sleeping_pill.json b/src/test/resources/assets/forgedebugnobedsleeping/models/item/sleeping_pill.json new file mode 100644 index 0000000000..15928e0b20 --- /dev/null +++ b/src/test/resources/assets/forgedebugnobedsleeping/models/item/sleeping_pill.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "items/beef_cooked" + } +} \ No newline at end of file From 78a397bc696d3ca9a3f5f369015d5ef19919880c Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 16 Mar 2016 03:58:51 +0300 Subject: [PATCH 089/243] Fixed incorrect rotations for items in the left hand. Closes #2548. --- src/main/java/net/minecraftforge/client/ForgeHooksClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 3b6096a8a7..541683a881 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -403,7 +403,7 @@ public class ForgeHooksClient matrix.mul(flipX, matrix); matrix.mul(matrix, flipX); } - if(pair.getRight() != null) multiplyCurrentGlMatrix(pair.getRight()); + multiplyCurrentGlMatrix(matrix); } return pair.getLeft(); } From 12c051d52bb459e8200fe054a463cc14fdc53816 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 16 Mar 2016 03:59:21 +0300 Subject: [PATCH 090/243] Fixed incorrect culling of mod TESRs. --- .../net/minecraft/tileentity/TileEntity.java.patch | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index 05673acff1..8e771c7091 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -68,7 +68,7 @@ public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_) { double d0 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_; -@@ -271,6 +281,185 @@ +@@ -271,6 +281,186 @@ return false; } @@ -130,20 +130,21 @@ + { + net.minecraft.util.math.AxisAlignedBB bb = INFINITE_EXTENT_AABB; + Block type = func_145838_q(); ++ BlockPos pos = func_174877_v(); + if (type == Blocks.field_150381_bn) + { -+ bb = new net.minecraft.util.math.AxisAlignedBB(func_174877_v(), func_174877_v().func_177982_a(1, 1, 1)); ++ bb = new net.minecraft.util.math.AxisAlignedBB(pos, pos.func_177982_a(1, 1, 1)); + } + else if (type == Blocks.field_150486_ae || type == Blocks.field_150447_bR) + { -+ bb = new net.minecraft.util.math.AxisAlignedBB(func_174877_v().func_177982_a(-1, 0, -1), func_174877_v().func_177982_a(2, 2, 2)); ++ bb = new net.minecraft.util.math.AxisAlignedBB(pos.func_177982_a(-1, 0, -1), pos.func_177982_a(2, 2, 2)); + } + else if (type != null && type != Blocks.field_150461_bJ) + { + net.minecraft.util.math.AxisAlignedBB cbb = null; + try + { -+ cbb = field_145850_b.func_180495_p(func_174877_v()).func_185890_d(field_145850_b, func_174877_v()); ++ cbb = field_145850_b.func_180495_p(func_174877_v()).func_185890_d(field_145850_b, pos).func_72321_a(pos.func_177958_n(), pos.func_177956_o(), pos.func_177952_p()); + } + catch (Exception e) + { From 4189f6390518f1b49fce91ad8d9702585256d632 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 16 Mar 2016 04:11:47 +0300 Subject: [PATCH 091/243] Fixed EffectRenderer patch, closes #2547. --- .../client/particle/EffectRenderer.java.patch | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch index 17332afbd5..d3cfc56bc3 100644 --- a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch @@ -1,16 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java +++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java -@@ -3,6 +3,9 @@ - import com.google.common.collect.Lists; - import com.google.common.collect.Maps; - import com.google.common.collect.Queues; -+ -+import akka.actor.FSM.State; -+ - import java.util.ArrayDeque; - import java.util.Iterator; - import java.util.List; -@@ -143,6 +146,7 @@ +@@ -143,6 +143,7 @@ public void func_78873_a(EntityFX p_78873_1_) { @@ -18,16 +8,16 @@ this.field_187241_h.add(p_78873_1_); } -@@ -376,7 +380,7 @@ +@@ -376,7 +377,7 @@ public void func_180533_a(BlockPos p_180533_1_, IBlockState p_180533_2_) { - if (p_180533_2_.func_185904_a() != Material.field_151579_a) -+ if (p_180533_2_.func_177230_c().isAir(p_180533_2_, field_78878_a, p_180533_1_) && !p_180533_2_.func_177230_c().addDestroyEffects(field_78878_a, p_180533_1_, this)) ++ if (!p_180533_2_.func_177230_c().isAir(p_180533_2_, field_78878_a, p_180533_1_) && !p_180533_2_.func_177230_c().addDestroyEffects(field_78878_a, p_180533_1_, this)) { p_180533_2_ = p_180533_2_.func_185899_b(this.field_78878_a, p_180533_1_); int i = 4; -@@ -460,4 +464,13 @@ +@@ -460,4 +461,13 @@ return "" + i; } From 87f435178301dfc969f9447c41874fab9fb11d04 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 16 Mar 2016 04:23:02 +0300 Subject: [PATCH 092/243] Removed imports in patches. --- .../minecraft/block/BlockOldLeaf.java.patch | 12 ++------ .../net/minecraft/item/ItemShears.java.patch | 14 ++-------- .../net/minecraft/util/Session.java.patch | 28 +++++++------------ .../net/minecraft/world/WorldType.java.patch | 14 ++-------- .../gen/feature/WorldGenBirchTree.java.patch | 18 ++++-------- 5 files changed, 22 insertions(+), 64 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch index c056b175b3..a9f19415b0 100644 --- a/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch @@ -1,14 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java +++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java -@@ -14,6 +14,7 @@ - import net.minecraft.stats.StatList; - import net.minecraft.tileentity.TileEntity; - 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; -@@ -103,11 +104,16 @@ +@@ -103,11 +103,16 @@ if (!p_180657_1_.field_72995_K && p_180657_6_ != null && p_180657_6_.func_77973_b() == Items.field_151097_aZ) { p_180657_2_.func_71029_a(StatList.func_188055_a(this)); @@ -21,7 +13,7 @@ } + + @Override -+ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) ++ public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { + return java.util.Arrays.asList(new ItemStack(this, 1, world.func_180495_p(pos).func_177229_b(field_176239_P).func_176839_a())); + } diff --git a/patches/minecraft/net/minecraft/item/ItemShears.java.patch b/patches/minecraft/net/minecraft/item/ItemShears.java.patch index 700dd18bd4..3746b62ab7 100644 --- a/patches/minecraft/net/minecraft/item/ItemShears.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemShears.java.patch @@ -1,14 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemShears.java +++ ../src-work/minecraft/net/minecraft/item/ItemShears.java -@@ -6,6 +6,7 @@ - import net.minecraft.creativetab.CreativeTabs; - import net.minecraft.entity.EntityLivingBase; - import net.minecraft.init.Blocks; -+import net.minecraft.util.EnumHand; - import net.minecraft.util.math.BlockPos; - import net.minecraft.world.World; - -@@ -22,7 +23,7 @@ +@@ -22,7 +22,7 @@ { p_179218_1_.func_77972_a(1, p_179218_5_); Block block = p_179218_3_.func_177230_c(); @@ -17,14 +9,14 @@ } public boolean func_150897_b(IBlockState p_150897_1_) -@@ -36,4 +37,71 @@ +@@ -36,4 +36,71 @@ Block block = p_150893_2_.func_177230_c(); return block != Blocks.field_150321_G && p_150893_2_.func_185904_a() != Material.field_151584_j ? (block == Blocks.field_150325_L ? 5.0F : super.func_150893_a(p_150893_1_, p_150893_2_)) : 15.0F; } + + + @Override -+ public boolean func_111207_a(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity, EnumHand hand) ++ public boolean func_111207_a(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity, net.minecraft.util.EnumHand hand) + { + if (entity.field_70170_p.field_72995_K) + { diff --git a/patches/minecraft/net/minecraft/util/Session.java.patch b/patches/minecraft/net/minecraft/util/Session.java.patch index 6ac3242785..db649de70e 100644 --- a/patches/minecraft/net/minecraft/util/Session.java.patch +++ b/patches/minecraft/net/minecraft/util/Session.java.patch @@ -1,15 +1,6 @@ --- ../src-base/minecraft/net/minecraft/util/Session.java +++ ../src-work/minecraft/net/minecraft/util/Session.java -@@ -5,6 +5,8 @@ - import com.mojang.util.UUIDTypeAdapter; - import java.util.Map; - import java.util.UUID; -+ -+import net.minecraftforge.fml.common.FMLLog; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - -@@ -15,9 +17,24 @@ +@@ -15,9 +15,25 @@ private final String field_148257_b; private final String field_148258_c; private final Session.Type field_152429_d; @@ -22,19 +13,20 @@ + { + p_i1098_1_ = "MissingName"; + p_i1098_2_ = p_i1098_3_ = "NotValid"; -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "========================================================="); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "WARNING!! the username was not set for this session, typically"); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "this means you installed Forge incorrectly. We have set your"); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "name to \"MissingName\" and your session to nothing. Please"); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "check your installation and post a console log from the launcher"); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "when asking for help!"); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "========================================================="); ++ org.apache.logging.log4j.Logger logger = net.minecraftforge.fml.common.FMLLog.getLogger(); ++ logger.log(org.apache.logging.log4j.Level.WARN, "========================================================="); ++ logger.log(org.apache.logging.log4j.Level.WARN, "WARNING!! the username was not set for this session, typically"); ++ logger.log(org.apache.logging.log4j.Level.WARN, "this means you installed Forge incorrectly. We have set your"); ++ logger.log(org.apache.logging.log4j.Level.WARN, "name to \"MissingName\" and your session to nothing. Please"); ++ logger.log(org.apache.logging.log4j.Level.WARN, "check your installation and post a console log from the launcher"); ++ logger.log(org.apache.logging.log4j.Level.WARN, "when asking for help!"); ++ logger.log(org.apache.logging.log4j.Level.WARN, "========================================================="); + } + this.field_74286_b = p_i1098_1_; this.field_148257_b = p_i1098_2_; this.field_148258_c = p_i1098_3_; -@@ -49,14 +66,29 @@ +@@ -49,14 +65,29 @@ try { UUID uuid = UUIDTypeAdapter.fromString(this.func_148255_b()); diff --git a/patches/minecraft/net/minecraft/world/WorldType.java.patch b/patches/minecraft/net/minecraft/world/WorldType.java.patch index 55e06c22c2..eeb74f3943 100644 --- a/patches/minecraft/net/minecraft/world/WorldType.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldType.java.patch @@ -1,16 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/WorldType.java +++ ../src-work/minecraft/net/minecraft/world/WorldType.java -@@ -1,5 +1,9 @@ - package net.minecraft.world; - -+import net.minecraft.world.chunk.IChunkGenerator; -+import net.minecraft.world.gen.ChunkProviderDebug; -+import net.minecraft.world.gen.ChunkProviderFlat; -+import net.minecraft.world.gen.ChunkProviderOverworld; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - -@@ -27,6 +31,7 @@ +@@ -27,6 +27,7 @@ private WorldType(int p_i1960_1_, String p_i1960_2_, int p_i1960_3_) { @@ -18,7 +8,7 @@ this.field_77133_f = p_i1960_2_; this.field_77134_g = p_i1960_3_; this.field_77140_h = true; -@@ -113,4 +118,145 @@ +@@ -113,4 +114,145 @@ this.field_151361_l = true; return this; } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch index 0dde48dc2d..77d4b839e8 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch @@ -1,14 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java -@@ -8,6 +8,7 @@ - import net.minecraft.block.material.Material; - import net.minecraft.block.state.IBlockState; - import net.minecraft.init.Blocks; -+import net.minecraft.util.EnumFacing; - import net.minecraft.util.math.BlockPos; - import net.minecraft.world.World; - -@@ -56,9 +57,9 @@ +@@ -56,9 +56,9 @@ { for (int i1 = p_180709_3_.func_177952_p() - k; i1 <= p_180709_3_.func_177952_p() + k && flag; ++i1) { @@ -20,14 +12,14 @@ { flag = false; } -@@ -77,11 +78,13 @@ +@@ -77,11 +77,13 @@ } else { - Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); + BlockPos down = p_180709_3_.func_177977_b(); + IBlockState state = p_180709_1_.func_180495_p(down); -+ boolean isSoil = state.func_177230_c().canSustainPlant(state, p_180709_1_, down, EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g); ++ boolean isSoil = state.func_177230_c().canSustainPlant(state, p_180709_1_, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g); - if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d || block == Blocks.field_150458_ak) && p_180709_3_.func_177956_o() < 256 - i - 1) + if (isSoil && p_180709_3_.func_177956_o() < p_180709_1_.func_72800_K() - i - 1) @@ -37,7 +29,7 @@ for (int i2 = p_180709_3_.func_177956_o() - 3 + i; i2 <= p_180709_3_.func_177956_o() + i; ++i2) { -@@ -99,9 +102,9 @@ +@@ -99,9 +101,9 @@ if (Math.abs(j1) != l2 || Math.abs(l1) != l2 || p_180709_2_.nextInt(2) != 0 && k2 != 0) { BlockPos blockpos = new BlockPos(i3, i2, k1); @@ -49,7 +41,7 @@ { this.func_175903_a(p_180709_1_, blockpos, field_181630_b); } -@@ -112,9 +115,10 @@ +@@ -112,9 +114,10 @@ for (int j2 = 0; j2 < i; ++j2) { From 8b4bce37de693b2fb192c5c2bb2adf7c72b66bd6 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 16 Mar 2016 05:00:44 +0300 Subject: [PATCH 093/243] Fixed progress reporting for model loading. --- .../block/model/ModelBakery.java.patch | 51 +++++++-- .../client/model/ModelLoader.java | 102 +++++++++++------- 2 files changed, 103 insertions(+), 50 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch index f3b09c438e..4f6cd2e15e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch @@ -1,6 +1,28 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java -@@ -109,7 +109,7 @@ +@@ -102,6 +102,21 @@ + { + try + { ++ loadBlock(blockstatemapper, block, resourcelocation); ++ } ++ catch (Exception exception) ++ { ++ field_177603_c.warn((String)("Unable to load definition " + resourcelocation), (Throwable)exception); ++ } ++ } ++ } ++ } ++ ++ protected void loadBlock(BlockStateMapper blockstatemapper, Block block, final ResourceLocation resourcelocation) ++ { ++ { ++ { ++ { + ModelBlockDefinition modelblockdefinition = this.func_177586_a(resourcelocation); + Map map = blockstatemapper.func_188181_b(block); + +@@ -109,7 +124,7 @@ { Collection collection = Sets.newHashSet(map.values()); modelblockdefinition.func_188001_c().func_188138_a(block.func_176194_O()); @@ -9,7 +31,7 @@ { public boolean apply(ModelResourceLocation p_apply_1_) { -@@ -126,13 +126,13 @@ +@@ -126,22 +141,18 @@ { try { @@ -25,7 +47,16 @@ } } } -@@ -370,6 +370,7 @@ + } + } +- catch (Exception exception) +- { +- field_177603_c.warn((String)("Unable to load definition " + resourcelocation), (Throwable)exception); +- } + } + } + } +@@ -370,6 +381,7 @@ protected void func_177592_e() { @@ -33,7 +64,7 @@ this.field_177613_u.put(Item.func_150898_a(Blocks.field_150348_b), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); this.field_177613_u.put(Item.func_150898_a(Blocks.field_150346_d), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); this.field_177613_u.put(Item.func_150898_a(Blocks.field_150344_f), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); -@@ -413,6 +414,10 @@ +@@ -413,6 +425,10 @@ this.field_177613_u.put(Item.func_150898_a(Blocks.field_180407_aO), Lists.newArrayList(new String[] {"oak_fence"})); this.field_177613_u.put(Items.field_179570_aq, Lists.newArrayList(new String[] {"oak_door"})); this.field_177613_u.put(Items.field_151124_az, Lists.newArrayList(new String[] {"oak_boat"})); @@ -44,7 +75,7 @@ } protected List func_177596_a(Item p_177596_1_) -@@ -429,7 +434,7 @@ +@@ -429,7 +445,7 @@ protected ResourceLocation func_177583_a(String p_177583_1_) { @@ -53,7 +84,7 @@ return new ResourceLocation(resourcelocation.func_110624_b(), "item/" + resourcelocation.func_110623_a()); } -@@ -536,7 +541,7 @@ +@@ -536,7 +552,7 @@ for (Entry entry : this.field_177615_s.entrySet()) { ResourceLocation resourcelocation = (ResourceLocation)entry.getValue(); @@ -62,7 +93,7 @@ ModelBlock modelblock = (ModelBlock)this.field_177611_h.get(resourcelocation); if (modelblock != null && modelblock.func_178303_d()) -@@ -623,6 +628,11 @@ +@@ -623,6 +639,11 @@ private IBakedModel func_177578_a(ModelBlock p_177578_1_, ModelRotation p_177578_2_, boolean p_177578_3_) { @@ -74,7 +105,7 @@ TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c("particle"))); SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(p_177578_1_, p_177578_1_.func_187967_g())).func_177646_a(textureatlassprite); -@@ -639,13 +649,13 @@ +@@ -639,13 +660,13 @@ BlockPartFace blockpartface = (BlockPartFace)blockpart.field_178240_c.get(enumfacing); TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c(blockpartface.field_178242_d))); @@ -91,7 +122,7 @@ } } } -@@ -656,9 +666,14 @@ +@@ -656,9 +677,14 @@ private BakedQuad func_177589_a(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) { @@ -107,7 +138,7 @@ private void func_177597_h() { this.func_177574_i(); -@@ -878,4 +893,23 @@ +@@ -878,4 +904,23 @@ field_177606_o.field_178317_b = "generation marker"; field_177616_r.field_178317_b = "block entity marker"; } diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index b3c8280ab4..73f40e770c 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -6,6 +6,7 @@ import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -40,6 +41,7 @@ import net.minecraft.client.renderer.block.model.VariantList; import net.minecraft.client.renderer.block.model.WeightedBakedModel; import net.minecraft.client.renderer.block.model.multipart.Multipart; import net.minecraft.client.renderer.block.model.multipart.Selector; +import net.minecraft.client.renderer.block.statemap.BlockStateMapper; import net.minecraft.client.renderer.block.statemap.IStateMapper; import net.minecraft.client.renderer.texture.IIconCreator; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -83,6 +85,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Multimap; +import com.google.common.collect.Multimaps; import com.google.common.collect.Sets; public final class ModelLoader extends ModelBakery @@ -135,8 +138,14 @@ public final class ModelLoader extends ModelBakery IBakedModel missingBaked = missingModel.bake(missingModel.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.instance); Map bakedModels = Maps.newHashMap(); - for(IModel model : stateModels.values()) + HashMultimap models = HashMultimap.create(); + Multimaps.invertFrom(Multimaps.forMap(stateModels), models); + + ProgressBar bakeBar = ProgressManager.push("ModelLoader: baking", models.keySet().size()); + + for(IModel model : models.keySet()) { + bakeBar.step("[" + Joiner.on(", ").join(models.get(model)) + "]"); if(model == getMissingModel()) { bakedModels.put(model, missingBaked); @@ -146,6 +155,9 @@ public final class ModelLoader extends ModelBakery bakedModels.put(model, model.bake(model.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.instance)); } } + + ProgressManager.pop(bakeBar); + for (Entry e : stateModels.entrySet()) { bakedRegistry.putObject(e.getKey(), bakedModels.get(e.getValue())); @@ -161,27 +173,31 @@ public final class ModelLoader extends ModelBakery @Override protected void loadMultipartVariantModels() {} - /*private void loadBlocks() + @Override + protected void loadBlocks() { - Map stateMap = blockModelShapes.getBlockStateMapper().putAllStateModelLocations(); - List variants = Lists.newArrayList(stateMap.values()); - variants.add(new ModelResourceLocation("minecraft:item_frame", "normal")); //Vanilla special cases item_frames so must we - variants.add(new ModelResourceLocation("minecraft:item_frame", "map")); - Collections.sort(variants, new Comparator() + List blocks = Lists.newArrayList(Block.blockRegistry); + Collections.sort(blocks, new Comparator() { - public int compare(ModelResourceLocation v1, ModelResourceLocation v2) + public int compare(Block b1, Block b2) { - return v1.toString().compareTo(v2.toString()); + return b1.getRegistryName().compareTo(b2.getRegistryName()); } }); - ProgressBar blockBar = ProgressManager.push("ModelLoader: blocks", variants.size()); - for(ModelResourceLocation variant : variants) + ProgressBar blockBar = ProgressManager.push("ModelLoader: blocks", blocks.size()); + + BlockStateMapper mapper = this.blockModelShapes.getBlockStateMapper(); + + for(Block block : blocks) { - loadVariant(variant); - blockBar.step(variant.toString()); + blockBar.step(block.getRegistryName()); + for(ResourceLocation location : mapper.getBlockstateLocations(block)) + { + loadBlock(mapper, block, location); + } } ProgressManager.pop(blockBar); - }*/ + } @Override protected void registerVariant(ModelBlockDefinition definition, ModelResourceLocation location) @@ -238,41 +254,47 @@ public final class ModelLoader extends ModelBakery registerVariantNames(); - List itemVariants = Lists.newArrayList(); - for(Item item : GameData.getItemRegistry().typeSafeIterable()) + List items = Lists.newArrayList(GameData.getItemRegistry().typeSafeIterable()); + Collections.sort(items, new Comparator() { - itemVariants.addAll(getVariantNames(item)); - } - Collections.sort(itemVariants); - ProgressBar itemBar = ProgressManager.push("ModelLoader: items", itemVariants.size()); - for(String s : itemVariants) - { - ResourceLocation file = getItemLocation(s); - ModelResourceLocation memory = getInventoryVariant(s); - itemBar.step(memory.toString()); - IModel model = ModelLoaderRegistry.getMissingModel(); - Exception exception = null; - try + public int compare(Item i1, Item i2) { - model = ModelLoaderRegistry.getModel(file); + return i1.getRegistryName().compareTo(i2.getRegistryName()); } - catch(Exception e) + }); + + ProgressBar itemBar = ProgressManager.push("ModelLoader: items", items.size()); + for(Item item : items) + { + itemBar.step(item.getRegistryName()); + for(String s : getVariantNames(item)) { - // try blockstate json if the item model is missing - FMLLog.fine("Item json isn't found for '" + memory + "', trying to load the variant from the blockstate json"); + ResourceLocation file = getItemLocation(s); + ModelResourceLocation memory = getInventoryVariant(s); + IModel model = ModelLoaderRegistry.getMissingModel(); + Exception exception = null; try { - model = ModelLoaderRegistry.getModel(memory); + model = ModelLoaderRegistry.getModel(file); } - catch (Exception ex) + catch(Exception e) { - exception = new Exception("Could not load item model either from the normal location " + file + " or from the blockstate", ex); + // try blockstate json if the item model is missing + FMLLog.fine("Item json isn't found for '" + memory + "', trying to load the variant from the blockstate json"); + try + { + model = ModelLoaderRegistry.getModel(memory); + } + catch (Exception ex) + { + exception = new Exception("Could not load item model either from the normal location " + file + " or from the blockstate", ex); + } + } + stateModels.put(memory, model); + if(exception != null) + { + storeException(memory, exception); } - } - stateModels.put(memory, model); - if(exception != null) - { - storeException(memory, exception); } } ProgressManager.pop(itemBar); From 6b926f9a0673190ab1e307c72bddafaccc24aebd Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 16 Mar 2016 05:17:33 +0300 Subject: [PATCH 094/243] Javadocs, small cleanup. --- .../client/model/ModelLoader.java | 44 ++++++++++++------- .../client/model/ModelLoaderRegistry.java | 6 +-- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 73f40e770c..b72b8cf46c 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -94,7 +94,6 @@ public final class ModelLoader extends ModelBakery private final Set missingVariants = Sets.newHashSet(); private final Map loadingExceptions = Maps.newHashMap(); private IModel missingModel = null; - private IModel itemModel = new ItemLayerModel(MODEL_GENERATED); private boolean isLoading = false; public boolean isLoading() @@ -372,6 +371,9 @@ public final class ModelLoader extends ModelBakery } } + /** + * Hooked from ModelBakery, allows using MRLs that don't end with "inventory" for items. + */ public static ModelResourceLocation getInventoryVariant(String s) { if(s.contains("#")) @@ -750,7 +752,7 @@ public final class ModelLoader extends ModelBakery } } - public IModel getMissingModel() + protected IModel getMissingModel() { if (missingModel == null) { @@ -766,11 +768,6 @@ public final class ModelLoader extends ModelBakery return missingModel; } - public IModel getItemModel() - { - return itemModel; - } - protected static enum VanillaLoader implements ICustomModelLoader { instance; @@ -787,10 +784,8 @@ public final class ModelLoader extends ModelBakery return loader; } - public void onResourceManagerReload(IResourceManager resourceManager) - { - // do nothing, cause loader will store the reference to the resourceManager - } + // NOOP, handled in loader + public void onResourceManagerReload(IResourceManager resourceManager) {} public boolean accepts(ResourceLocation modelLocation) { @@ -817,12 +812,15 @@ public final class ModelLoader extends ModelBakery } } + /** + * 16x16 pure white sprite. + */ public static final class White extends TextureAtlasSprite { public static ResourceLocation loc = new ResourceLocation("white"); public static White instance = new White(); - protected White() + private White() { super(loc.toString()); } @@ -833,7 +831,6 @@ public final class ModelLoader extends ModelBakery return true; } - // TODO: check if this code is correct @Override public boolean load(IResourceManager manager, ResourceLocation location) { @@ -855,6 +852,9 @@ public final class ModelLoader extends ModelBakery } } + /** + * Internal, do not use. + */ public void onPostBakeEvent(IRegistry modelRegistry) { IBakedModel missingModel = modelRegistry.getObject(MODEL_MISSING); @@ -973,6 +973,9 @@ public final class ModelLoader extends ModelBakery customStateMappers.put(block.delegate, mapper); } + /** + * Internal, do not use. + */ public static void onRegisterAllBlocks(BlockModelShapes shapes) { for (Entry, IStateMapper> e : customStateMappers.entrySet()) @@ -1003,6 +1006,9 @@ public final class ModelLoader extends ModelBakery customMeshDefinitions.put(item.delegate, meshDefinition); } + /** + * Helper method for registering all itemstacks for given item to map to universal bucket model. + */ public static void setBucketModelDefinition(Item item) { ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() { @@ -1015,6 +1021,9 @@ public final class ModelLoader extends ModelBakery ModelBakery.registerItemVariants(item, ModelDynBucket.LOCATION); } + /** + * Internal, do not use. + */ public static void onRegisterItems(ItemModelMesher mesher) { for (Map.Entry, ItemMeshDefinition> e : customMeshDefinitions.entrySet()) @@ -1037,6 +1046,9 @@ public final class ModelLoader extends ModelBakery } } + /** + * Get the default texture getter the models will be baked with. + */ public static Function defaultTextureGetter() { return DefaultTextureGetter.instance; @@ -1053,11 +1065,9 @@ public final class ModelLoader extends ModelBakery this.loader = loader; } + // NOOP, handled in loader @Override - public void onResourceManagerReload(IResourceManager resourceManager) - { - // TODO Auto-generated method stub - } + public void onResourceManagerReload(IResourceManager resourceManager) {} @Override public boolean accepts(ResourceLocation modelLocation) diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index 3f64a7c71d..93b4c39fb1 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -195,9 +195,9 @@ public class ModelLoaderRegistry { cache.clear(); // putting the builtin models in - cache.put(new ResourceLocation("minecraft:builtin/generated"), ModelLoader.VanillaLoader.instance.getLoader().getItemModel()); - cache.put(new ResourceLocation("minecraft:block/builtin/generated"), ModelLoader.VanillaLoader.instance.getLoader().getItemModel()); - cache.put(new ResourceLocation("minecraft:item/builtin/generated"), ModelLoader.VanillaLoader.instance.getLoader().getItemModel()); + cache.put(new ResourceLocation("minecraft:builtin/generated"), ItemLayerModel.instance); + cache.put(new ResourceLocation("minecraft:block/builtin/generated"), ItemLayerModel.instance); + cache.put(new ResourceLocation("minecraft:item/builtin/generated"), ItemLayerModel.instance); } static Iterable getTextures() From f22ed86ad928cce8f9b8f629dbb96a048273757b Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 16 Mar 2016 18:24:11 -0700 Subject: [PATCH 095/243] Remove our entity position fixer. Vanilla fixed the bug in 1.9. --- .../entity/EntityTrackerEntry.java.patch | 21 ++---------- .../network/internal/EntitySpawnHandler.java | 20 ------------ .../common/network/internal/FMLMessage.java | 32 ------------------- .../network/internal/FMLNetworkHandler.java | 8 ----- .../network/internal/FMLRuntimeCodec.java | 1 - 5 files changed, 3 insertions(+), 79 deletions(-) diff --git a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch index c8af86c881..af7161360d 100644 --- a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch @@ -1,21 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java +++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java -@@ -398,6 +398,14 @@ - this.field_73138_k = this.field_73132_a.field_70181_x; - this.field_73135_l = this.field_73132_a.field_70179_y; - -+ int posX = MathHelper.func_76128_c(this.field_73132_a.field_70165_t * 32.0D); -+ int posY = MathHelper.func_76128_c(this.field_73132_a.field_70163_u * 32.0D); -+ int posZ = MathHelper.func_76128_c(this.field_73132_a.field_70161_v * 32.0D); -+ if (posX != this.field_73128_d || posY != this.field_73129_e || posZ != this.field_73126_f) -+ { -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.field_73132_a, p_73117_1_, this.field_73128_d, this.field_73129_e, this.field_73126_f); -+ } -+ - if (flag && !(packet instanceof SPacketSpawnMob)) - { - p_73117_1_.field_71135_a.func_147359_a(new SPacketEntityVelocity(this.field_73132_a.func_145782_y(), this.field_73132_a.field_70159_w, this.field_73132_a.field_70181_x, this.field_73132_a.field_70179_y)); -@@ -438,6 +446,7 @@ +@@ -438,6 +438,7 @@ this.field_73132_a.func_184178_b(p_73117_1_); p_73117_1_.func_184848_d(this.field_73132_a); @@ -23,7 +8,7 @@ } } else if (this.field_73134_o.contains(p_73117_1_)) -@@ -445,6 +454,7 @@ +@@ -445,6 +446,7 @@ this.field_73134_o.remove(p_73117_1_); this.field_73132_a.func_184203_c(p_73117_1_); p_73117_1_.func_152339_d(this.field_73132_a); @@ -31,7 +16,7 @@ } } } -@@ -477,6 +487,9 @@ +@@ -477,6 +479,9 @@ field_151262_p.warn("Fetching addPacket for removed entity"); } diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java b/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java index 4d6675d4ee..2cf6b6e05b 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java @@ -17,7 +17,6 @@ import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.common.network.NetworkRegistry; -import net.minecraftforge.fml.common.network.internal.FMLMessage.EntityAdjustMessage; import net.minecraftforge.fml.common.network.internal.FMLMessage.EntityMessage; import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; @@ -53,25 +52,6 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler getEntitySpawningPacket(Entity entity) { EntityRegistration er = EntityRegistry.instance().lookupModSpawn(entity.getClass(), false); diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLRuntimeCodec.java b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLRuntimeCodec.java index 0212fe9f1c..8dfbe9937d 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLRuntimeCodec.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLRuntimeCodec.java @@ -16,7 +16,6 @@ public class FMLRuntimeCodec extends FMLIndexedMessageToMessageCodec addDiscriminator(0,FMLMessage.CompleteHandshake.class); addDiscriminator(1,FMLMessage.OpenGui.class); addDiscriminator(2,FMLMessage.EntitySpawnMessage.class); - addDiscriminator(3,FMLMessage.EntityAdjustMessage.class); } @Override public void encodeInto(ChannelHandlerContext ctx, FMLMessage msg, ByteBuf target) throws Exception From 1591373bf65dbd36b29fb16a2b235e73d4299d23 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 16 Mar 2016 18:24:48 -0700 Subject: [PATCH 096/243] Fix vanilla bug where bows consumed tipped arrows in creative. --- patches/minecraft/net/minecraft/item/ItemBow.java.patch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/item/ItemBow.java.patch b/patches/minecraft/net/minecraft/item/ItemBow.java.patch index d91f85c800..f8f76a314d 100644 --- a/patches/minecraft/net/minecraft/item/ItemBow.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBow.java.patch @@ -11,7 +11,7 @@ if (itemstack != null || flag) { if (itemstack == null) -@@ -97,7 +101,6 @@ +@@ -97,12 +101,11 @@ itemstack = new ItemStack(Items.field_151032_g); } @@ -19,6 +19,12 @@ float f = func_185059_b(i); if ((double)f >= 0.1D) + { +- boolean flag1 = flag && itemstack.func_77973_b() == Items.field_151032_g; ++ boolean flag1 = flag && itemstack.func_77973_b() instanceof ItemArrow; //Forge: Fix consuming custom arrows. + + if (!p_77615_2_.field_72995_K) + { @@ -189,6 +192,9 @@ { boolean flag = this.func_185060_a(p_77659_3_) != null; From c442cd29093d96ce08d6ac34eecfc61991c86c95 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 16 Mar 2016 18:25:14 -0700 Subject: [PATCH 097/243] Fixed onUseStop being called twice {Bows firing twice} --- .../net/minecraft/entity/EntityLivingBase.java.patch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index e9e581bdf3..2ddf22c6d7 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -275,10 +275,11 @@ if (itemstack != null && itemstack.field_77994_a == 0) { itemstack = null; -@@ -2508,6 +2588,8 @@ +@@ -2507,7 +2587,8 @@ + { if (this.field_184627_bm != null) { - this.field_184627_bm.func_77974_b(this.field_70170_p, this, this.func_184605_cv()); +- this.field_184627_bm.func_77974_b(this.field_70170_p, this, this.func_184605_cv()); + if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_184627_bm, this.func_184605_cv())) + this.field_184627_bm.func_77974_b(this.field_70170_p, this, this.func_184605_cv()); } From 1d2d9ebc834b88b1eab3cfae3494533db79be7ec Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 16 Mar 2016 18:25:26 -0700 Subject: [PATCH 098/243] Fixed Sand not falling. --- patches/minecraft/net/minecraft/block/BlockFalling.java.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/BlockFalling.java.patch b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch index 60dba8b047..6d9cfd9f47 100644 --- a/patches/minecraft/net/minecraft/block/BlockFalling.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch @@ -5,7 +5,7 @@ private void func_176503_e(World p_176503_1_, BlockPos p_176503_2_) { - if (func_185759_i(p_176503_1_.func_180495_p(p_176503_2_.func_177977_b())) && p_176503_2_.func_177956_o() >= 0) -+ if (p_176503_1_.func_175623_d(p_176503_2_) && func_185759_i(p_176503_1_.func_180495_p(p_176503_2_.func_177977_b())) && p_176503_2_.func_177956_o() >= 0) ++ if ((p_176503_1_.func_175623_d(p_176503_2_.func_177977_b()) || func_185759_i(p_176503_1_.func_180495_p(p_176503_2_.func_177977_b()))) && p_176503_2_.func_177956_o() >= 0) { int i = 32; @@ -14,7 +14,7 @@ BlockPos blockpos; - for (blockpos = p_176503_2_.func_177977_b(); func_185759_i(p_176503_1_.func_180495_p(blockpos)) && blockpos.func_177956_o() > 0; blockpos = blockpos.func_177977_b()) -+ for (blockpos = p_176503_2_.func_177977_b(); p_176503_1_.func_175623_d(blockpos) && func_185759_i(p_176503_1_.func_180495_p(blockpos)) && blockpos.func_177956_o() > 0; blockpos = blockpos.func_177977_b()) ++ for (blockpos = p_176503_2_.func_177977_b(); (p_176503_1_.func_175623_d(blockpos) || func_185759_i(p_176503_1_.func_180495_p(blockpos))) && blockpos.func_177956_o() > 0; blockpos = blockpos.func_177977_b()) { ; } From 0b0b5097e5efbcd143097d2524cf4d44c6049b6c Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 16 Mar 2016 18:25:53 -0700 Subject: [PATCH 099/243] Fixed NPE when sneak using a item. --- .../client/multiplayer/PlayerControllerMP.java.patch | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index 8cc02cf1a3..e28a1fd5c5 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -50,7 +50,7 @@ return flag; } } -@@ -373,11 +379,15 @@ +@@ -373,11 +379,18 @@ { if (this.field_78779_k != WorldSettings.GameType.SPECTATOR) { @@ -59,16 +59,19 @@ + if (ret != EnumActionResult.PASS) return ret; + IBlockState iblockstate = p_187099_2_.func_180495_p(p_187099_4_); ++ boolean bypass = true; ++ for (ItemStack s : new ItemStack[]{p_187099_1_.func_184614_ca(), p_187099_1_.func_184592_cb()}) //TODO: Expand to more hands? player.inv.getHands()? ++ bypass = bypass && (s == null || s.func_77973_b().doesSneakBypassUse(s, p_187099_2_, p_187099_4_, p_187099_1_)); - if ((!p_187099_1_.func_70093_af() || p_187099_1_.func_184614_ca() == null && p_187099_1_.func_184592_cb() == null) && iblockstate.func_177230_c().func_180639_a(p_187099_2_, p_187099_4_, iblockstate, p_187099_1_, p_187099_7_, p_187099_3_, p_187099_5_, f, f1, f2)) -+ if ((!p_187099_1_.func_70093_af() || (p_187099_1_.func_184614_ca() == null || item.doesSneakBypassUse(p_187099_3_, p_187099_2_, p_187099_4_, p_187099_1_)) && p_187099_1_.func_184592_cb() == null)) ++ if (!p_187099_1_.func_70093_af() || bypass) { - flag = true; + flag = iblockstate.func_177230_c().func_180639_a(p_187099_2_, p_187099_4_, iblockstate, p_187099_1_, p_187099_7_, p_187099_3_, p_187099_5_, f, f1, f2); } if (!flag && p_187099_3_ != null && p_187099_3_.func_77973_b() instanceof ItemBlock) -@@ -418,7 +428,9 @@ +@@ -418,7 +431,9 @@ } else { @@ -79,7 +82,7 @@ } } else -@@ -453,9 +465,10 @@ +@@ -453,9 +468,10 @@ { p_187101_1_.func_184611_a(p_187101_4_, itemstack); From 02e228095e7d5dd302bd2fa2256829fdc0138d8b Mon Sep 17 00:00:00 2001 From: Adubbz Date: Thu, 17 Mar 2016 13:11:12 +1100 Subject: [PATCH 100/243] BlockColors and ItemColors no longer assume non-Vanilla id constancy. Added a getter for ItemColors. --- .../net/minecraft/client/Minecraft.java.patch | 11 +++++ .../renderer/color/BlockColors.java.patch | 32 ++++++++++++++ .../renderer/color/ItemColors.java.patch | 43 +++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 patches/minecraft/net/minecraft/client/renderer/color/BlockColors.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/color/ItemColors.java.patch diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 8a29254d6d..d778153109 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -474,3 +474,14 @@ } public boolean func_70002_Q() +@@ -3192,4 +3084,10 @@ + { + return this.field_184127_aH; + } ++ ++ // FORGE ++ public ItemColors getItemColors() ++ { ++ return this.field_184128_aI; ++ } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/color/BlockColors.java.patch b/patches/minecraft/net/minecraft/client/renderer/color/BlockColors.java.patch new file mode 100644 index 0000000000..93ce7f14e3 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/color/BlockColors.java.patch @@ -0,0 +1,32 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/color/BlockColors.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/color/BlockColors.java +@@ -25,7 +25,8 @@ + @SideOnly(Side.CLIENT) + public class BlockColors + { +- private final ObjectIntIdentityMap field_186725_a = new ObjectIntIdentityMap(32); ++ // FORGE: Use RegistryDelegates as non-Vanilla block ids are not constant ++ private final java.util.Map, IBlockColor> blockColorMap = com.google.common.collect.Maps.newHashMap(); + + public static BlockColors func_186723_a() + { +@@ -145,7 +146,7 @@ + + public int func_186724_a(IBlockState p_186724_1_, IBlockAccess p_186724_2_, BlockPos p_186724_3_, int p_186724_4_) + { +- IBlockColor iblockcolor = (IBlockColor)this.field_186725_a.func_148745_a(Block.func_149682_b(p_186724_1_.func_177230_c())); ++ IBlockColor iblockcolor = (IBlockColor)this.blockColorMap.get(p_186724_1_.func_177230_c().delegate); + return iblockcolor == null ? -1 : iblockcolor.func_186720_a(p_186724_1_, p_186724_2_, p_186724_3_, p_186724_4_); + } + +@@ -155,7 +156,9 @@ + + for (int j = p_186722_2_.length; i < j; ++i) + { +- this.field_186725_a.func_148746_a(p_186722_1_, Block.func_149682_b(p_186722_2_[i])); ++ if (p_186722_2_[i] == null) throw new IllegalArgumentException("Block registered to block color handler cannot be null!"); ++ if (p_186722_2_[i].getRegistryName() == null) throw new IllegalArgumentException("Block must be registered before assigning color handler."); ++ this.blockColorMap.put(p_186722_2_[i].delegate, p_186722_1_); + } + } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/color/ItemColors.java.patch b/patches/minecraft/net/minecraft/client/renderer/color/ItemColors.java.patch new file mode 100644 index 0000000000..c9764c9846 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/color/ItemColors.java.patch @@ -0,0 +1,43 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/color/ItemColors.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/color/ItemColors.java +@@ -26,7 +26,8 @@ + @SideOnly(Side.CLIENT) + public class ItemColors + { +- private final ObjectIntIdentityMap field_186732_a = new ObjectIntIdentityMap(32); ++ // FORGE: Use RegistryDelegates as non-Vanilla item ids are not constant ++ private final java.util.Map, IItemColor> itemColorMap = com.google.common.collect.Maps.newHashMap(); + + public static ItemColors func_186729_a(final BlockColors p_186729_0_) + { +@@ -136,7 +137,7 @@ + + public int func_186728_a(ItemStack p_186728_1_, int p_186728_2_) + { +- IItemColor iitemcolor = (IItemColor)this.field_186732_a.func_148745_a(Item.field_150901_e.func_148757_b(p_186728_1_.func_77973_b())); ++ IItemColor iitemcolor = (IItemColor)this.itemColorMap.get(p_186728_1_.func_77973_b().delegate); + return iitemcolor == null ? -1 : iitemcolor.func_186726_a(p_186728_1_, p_186728_2_); + } + +@@ -146,7 +147,9 @@ + + for (int j = p_186731_2_.length; i < j; ++i) + { +- this.field_186732_a.func_148746_a(p_186731_1_, Item.func_150891_b(Item.func_150898_a(p_186731_2_[i]))); ++ if (p_186731_2_[i] == null) throw new IllegalArgumentException("Block registered to item color handler cannot be null!"); ++ if (p_186731_2_[i].getRegistryName() == null) throw new IllegalArgumentException("Block must be registered before assigning color handler."); ++ this.itemColorMap.put(Item.func_150898_a(p_186731_2_[i]).delegate, p_186731_1_); + } + } + +@@ -156,7 +159,9 @@ + + for (int j = p_186730_2_.length; i < j; ++i) + { +- this.field_186732_a.func_148746_a(p_186730_1_, Item.func_150891_b(p_186730_2_[i])); ++ if (p_186730_2_[i] == null) throw new IllegalArgumentException("Item registered to item color handler cannot be null!"); ++ if (p_186730_2_[i].getRegistryName() == null) throw new IllegalArgumentException("Item must be registered before assigning color handler."); ++ this.itemColorMap.put(p_186730_2_[i].delegate, p_186730_1_); + } + } + } From b8bb8c374c922c9f843df9a29b2653b430a10902 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 17 Mar 2016 07:28:19 +0300 Subject: [PATCH 101/243] Fixed MultiLayerModel not getting correct submodels; Unified the gui lighting of normal and custom models - diffuse lighting is now done in the pipeline, no need for IColoredBakedQuad anymore. --- .../block/model/ModelBakery.java.patch | 2 +- .../renderer/chunk/RenderChunk.java.patch | 5 ++-- .../client/ForgeHooksClient.java | 17 +++++------ .../client/model/IColoredBakedQuad.java | 16 ---------- .../model/ItemTextureQuadConverter.java | 1 - .../client/model/ModelFluid.java | 11 ++----- .../client/model/MultiLayerModel.java | 3 +- .../client/model/b3d/B3DLoader.java | 6 ++-- .../client/model/obj/OBJModel.java | 15 +++------- .../model/pipeline/IVertexConsumer.java | 1 - .../client/model/pipeline/LightUtil.java | 29 ++----------------- .../model/pipeline/UnpackedBakedQuad.java | 23 --------------- .../model/pipeline/VertexBufferConsumer.java | 1 - .../model/pipeline/VertexLighterFlat.java | 6 +++- .../model/pipeline/VertexTransformer.java | 5 ---- .../blockstates/test_animation_block.json | 9 +----- .../blockstates/CustomModelBlock.json | 9 +----- .../blockstates/test_layer_block.json | 5 +++- 18 files changed, 36 insertions(+), 128 deletions(-) delete mode 100644 src/main/java/net/minecraftforge/client/model/IColoredBakedQuad.java diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch index 4f6cd2e15e..78f75f8215 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch @@ -132,7 +132,7 @@ + protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) + { -+ return this.field_177607_l.makeBakedQuad(p_177589_1_.field_178241_a, p_177589_1_.field_178239_b, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.field_178237_d, p_177589_6_, p_177589_1_.field_178238_e); ++ return this.field_177607_l.makeBakedQuad(p_177589_1_.field_178241_a, p_177589_1_.field_178239_b, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.field_178237_d, p_177589_6_, false); + } + private void func_177597_h() diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch index e256ce39c0..00f4a4f0e0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch @@ -31,15 +31,16 @@ int j = blockrenderlayer1.ordinal(); if (block.func_176223_P().func_185901_i() != EnumBlockRenderType.INVISIBLE) -@@ -191,6 +195,7 @@ +@@ -191,6 +195,8 @@ aboolean[j] |= blockrendererdispatcher.func_175018_a(iblockstate, blockpos$mutableblockpos, iblockaccess, vertexbuffer); } + } ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(null); } for (BlockRenderLayer blockrenderlayer : BlockRenderLayer.values()) -@@ -413,6 +418,26 @@ +@@ -413,6 +419,26 @@ return this.field_178593_n && this.field_188284_q; } diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 541683a881..111dad6c41 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -149,13 +149,7 @@ public class ForgeHooksClient renderPass = pass; } - static final ThreadLocal renderLayer = new ThreadLocal() - { - protected BlockRenderLayer initialValue() - { - return BlockRenderLayer.SOLID; - } - }; + static final ThreadLocal renderLayer = new ThreadLocal(); public static void setRenderLayer(BlockRenderLayer layer) { @@ -525,13 +519,16 @@ public class ForgeHooksClient public static void putQuadColor(VertexBuffer renderer, BakedQuad quad, int color) { - float cr = color & 0xFF; + float cb = color & 0xFF; float cg = (color >>> 8) & 0xFF; - float cb = (color >>> 16) & 0xFF; + float cr = (color >>> 16) & 0xFF; float ca = (color >>> 24) & 0xFF; + VertexFormat format = quad.getFormat(); + int size = format.getIntegerSize(); + int offset = format.getColorOffset() / 4; // assumes that color is aligned for(int i = 0; i < 4; i++) { - int vc = quad.getVertexData()[3 + 7 * i]; + int vc = quad.getVertexData()[offset + size * i]; float vcr = vc & 0xFF; float vcg = (vc >>> 8) & 0xFF; float vcb = (vc >>> 16) & 0xFF; diff --git a/src/main/java/net/minecraftforge/client/model/IColoredBakedQuad.java b/src/main/java/net/minecraftforge/client/model/IColoredBakedQuad.java deleted file mode 100644 index e8acab1cb7..0000000000 --- a/src/main/java/net/minecraftforge/client/model/IColoredBakedQuad.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.minecraftforge.client.model; - -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; - -public interface IColoredBakedQuad { - public static class ColoredBakedQuad extends BakedQuad implements IColoredBakedQuad - { - public ColoredBakedQuad(int[] data, int tintIndex, EnumFacing side, TextureAtlasSprite sprite, VertexFormat format) - { - super(data, tintIndex, side, sprite, format); - } - } -} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java b/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java index 074e687e55..c9467393ce 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java +++ b/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java @@ -206,7 +206,6 @@ public final class ItemTextureQuadConverter UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); builder.setQuadTint(-1); builder.setQuadOrientation(side); - builder.setQuadColored(); if (side == EnumFacing.NORTH) { diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index a876fc4796..be1134a11c 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -209,7 +209,6 @@ public final class ModelFluid implements IModelCustomData EnumFacing side = gas ? EnumFacing.DOWN : EnumFacing.UP; UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); builder.setQuadOrientation(side); - builder.setQuadColored(); for(int i = gas ? 3 : 0; i != (gas ? -1 : 4); i+= (gas ? -1 : 1)) { putVertex( @@ -225,7 +224,6 @@ public final class ModelFluid implements IModelCustomData side = side.getOpposite(); builder = new UnpackedBakedQuad.Builder(format); builder.setQuadOrientation(side); - builder.setQuadColored(); for(int i = gas ? 3 : 0; i != (gas ? -1 : 4); i+= (gas ? -1 : 1)) { putVertex( @@ -247,7 +245,6 @@ public final class ModelFluid implements IModelCustomData { builder = new UnpackedBakedQuad.Builder(format); builder.setQuadOrientation(side); - builder.setQuadColored(); for(int j = 0; j < 4; j++) { int l = (k * 3) + (1 - 2 * k) * j; @@ -269,7 +266,6 @@ public final class ModelFluid implements IModelCustomData // 1 quad for inventory UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); builder.setQuadOrientation(EnumFacing.UP); - builder.setQuadColored(); for(int i = 0; i < 4; i++) { putVertex( @@ -299,11 +295,10 @@ public final class ModelFluid implements IModelCustomData builder.put(e, data); break; case COLOR: - float d = LightUtil.diffuseLight(side); builder.put(e, - d * ((color >> 16) & 0xFF) / 255f, - d * ((color >> 8) & 0xFF) / 255f, - d * (color & 0xFF) / 255f, + ((color >> 16) & 0xFF) / 255f, + ((color >> 8) & 0xFF) / 255f, + (color & 0xFF) / 255f, ((color >> 24) & 0xFF) / 255f); break; case UV: if(format.getElement(e).getIndex() == 0) diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index b110763cb9..347884188c 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -164,7 +164,7 @@ public final class MultiLayerModel implements IModelCustomData { return quads.get(Optional.fromNullable(side)); } - else if(!models.containsKey(layer)) + else if(!models.containsKey(Optional.of(layer))) { model = missing; } @@ -172,6 +172,7 @@ public final class MultiLayerModel implements IModelCustomData { model = models.get(Optional.of(layer)); } + // assumes that child model will handle this state properly. FIXME? return model.getQuads(state, side, rand); } diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 7196cda27c..34371c50f2 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -717,7 +717,6 @@ public final class B3DLoader implements ICustomModelLoader { UnpackedBakedQuad.Builder quadBuilder = new UnpackedBakedQuad.Builder(format); quadBuilder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z)); - quadBuilder.setQuadColored(); List textures = null; if(f.getBrush() != null) textures = f.getBrush().getTextures(); TextureAtlasSprite sprite; @@ -744,14 +743,13 @@ public final class B3DLoader implements ICustomModelLoader builder.put(e, v.getPos().x, v.getPos().y, v.getPos().z, 1); break; case COLOR: - float d = LightUtil.diffuseLight(faceNormal.x, faceNormal.y, faceNormal.z); if(v.getColor() != null) { - builder.put(e, d * v.getColor().x, d * v.getColor().y, d * v.getColor().z, v.getColor().w); + builder.put(e, v.getColor().x, v.getColor().y, v.getColor().z, v.getColor().w); } else { - builder.put(e, d, d, d, 1); + builder.put(e, 1, 1, 1, 1); } break; case UV: diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index 5c9df533cc..fc53067645 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -1400,7 +1400,6 @@ public class OBJModel implements IRetexturableModel, IModelCustomData } else sprite = this.textures.get(f.getMaterialName()); UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); builder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z)); - builder.setQuadColored(); Normal faceNormal = f.getNormal(); putVertexData(builder, f.verts[0], faceNormal, TextureCoordinate.getDefaultUVs()[0], sprite); putVertexData(builder, f.verts[1], faceNormal, TextureCoordinate.getDefaultUVs()[1], sprite); @@ -1423,20 +1422,14 @@ public class OBJModel implements IRetexturableModel, IModelCustomData builder.put(e, v.getPos().x, v.getPos().y, v.getPos().z, v.getPos().w); break; case COLOR: - float d; - if (v.hasNormal()) - d = LightUtil.diffuseLight(v.getNormal().x, v.getNormal().y, v.getNormal().z); - else - d = LightUtil.diffuseLight(faceNormal.x, faceNormal.y, faceNormal.z); - if (v.getMaterial() != null) builder.put(e, - d * v.getMaterial().getColor().x, - d * v.getMaterial().getColor().y, - d * v.getMaterial().getColor().z, + v.getMaterial().getColor().x, + v.getMaterial().getColor().y, + v.getMaterial().getColor().z, v.getMaterial().getColor().w); else - builder.put(e, d, d, d, 1); + builder.put(e, 1, 1, 1, 1); break; case UV: if (!v.hasTextureCoordinate()) diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/IVertexConsumer.java b/src/main/java/net/minecraftforge/client/model/pipeline/IVertexConsumer.java index 92cf355ca9..f079cb17cd 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/IVertexConsumer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/IVertexConsumer.java @@ -17,7 +17,6 @@ public interface IVertexConsumer void setQuadTint(int tint); void setQuadOrientation(EnumFacing orientation); - void setQuadColored(); void put(int element, float... data); } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java index de273c2f41..c6e7bdb740 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java @@ -8,7 +8,6 @@ import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage; import net.minecraft.util.EnumFacing; import net.minecraftforge.client.ForgeHooksClient; -import net.minecraftforge.client.model.IColoredBakedQuad; import org.apache.commons.lang3.tuple.Pair; @@ -89,10 +88,6 @@ public class LightUtil { consumer.setQuadTint(quad.getTintIndex()); } - if(quad instanceof IColoredBakedQuad) - { - consumer.setQuadColored(); - } //int[] eMap = mapFormats(consumer.getVertexFormat(), DefaultVertexFormats.ITEM); float[] data = new float[4]; VertexFormat formatFrom = consumer.getVertexFormat(); @@ -281,19 +276,11 @@ public class LightUtil public static void renderQuadColor(VertexBuffer wr, BakedQuad quad, int auxColor) { wr.addVertexData(quad.getVertexData()); - if(quad instanceof IColoredBakedQuad) - { - ForgeHooksClient.putQuadColor(wr, quad, auxColor); - } - else - { - wr.putColor4(auxColor); - } + ForgeHooksClient.putQuadColor(wr, quad, auxColor); } public static class ItemConsumer extends VertexTransformer { - private boolean colored = false; private int vertices = 0; private float[] auxColor = new float[]{1, 1, 1, 1}; @@ -309,23 +296,14 @@ public class LightUtil System.arraycopy(auxColor, 0, this.auxColor, 0, this.auxColor.length); } - @Override - public void setQuadColored() - { - colored = true; - } - public void put(int element, float... data) { if(getVertexFormat().getElement(element).getUsage() == EnumUsage.COLOR) { System.arraycopy(auxColor, 0, buf, 0, buf.length); - if(colored) + for(int i = 0; i < 4; i++) { - for(int i = 0; i < 4; i++) - { - buf[i] *= data[i]; - } + buf[i] *= data[i]; } super.put(element, buf); } @@ -339,7 +317,6 @@ public class LightUtil if(vertices == 4) { vertices = 0; - colored = false; } } } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java b/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java index 8e04342919..1dc298bd95 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java @@ -4,7 +4,6 @@ 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.IColoredBakedQuad; // advantages: non-fixed-length vertex format, no overhead of packing and unpacking attributes to transform the model // disadvantages: (possibly) larger memory footprint, overhead on packing the attributes at the final rendering stage @@ -48,10 +47,6 @@ public class UnpackedBakedQuad extends BakedQuad consumer.setQuadTint(getTintIndex()); } consumer.setQuadOrientation(getFace()); - if(this instanceof IColoredBakedQuad) - { - consumer.setQuadColored(); - } for(int v = 0; v < 4; v++) { for(int e = 0; e < consumer.getVertexFormat().getElementCount(); e++) @@ -68,14 +63,6 @@ public class UnpackedBakedQuad extends BakedQuad } } - public static class Colored extends UnpackedBakedQuad implements IColoredBakedQuad - { - public Colored(float[][][] unpackedData, int tint, EnumFacing orientation, TextureAtlasSprite texture, VertexFormat format) - { - super(unpackedData, tint, orientation, texture, format); - } - } - public static class Builder implements IVertexConsumer { private final VertexFormat format; @@ -83,7 +70,6 @@ public class UnpackedBakedQuad extends BakedQuad private int tint = -1; private EnumFacing orientation; private TextureAtlasSprite texture; - private boolean isColored = false; private int vertices = 0; private int elements = 0; @@ -115,11 +101,6 @@ public class UnpackedBakedQuad extends BakedQuad this.texture = texture; } - public void setQuadColored() - { - this.isColored = true; - } - public void put(int element, float... data) { for(int i = 0; i < 4; i++) @@ -151,10 +132,6 @@ public class UnpackedBakedQuad extends BakedQuad { throw new IllegalStateException("not enough data"); } - if(isColored) - { - return new Colored(unpackedData, tint, orientation, texture, format); - } return new UnpackedBakedQuad(unpackedData, tint, orientation, texture, format); } } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java index 7a783b4d97..f07e1498c5 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java @@ -57,5 +57,4 @@ public class VertexBufferConsumer implements IVertexConsumer public void setQuadTint(int tint) {} public void setQuadOrientation(EnumFacing orientation) {} - public void setQuadColored() {} } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java index 5ffd67f67b..3f5d9132af 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java @@ -148,6 +148,11 @@ public class VertexLighterFlat extends QuadGatheringTransformer if(skyLight > lightmap[v][1]) lightmap[v][1] = skyLight; } updateColor(normal[v], color[v], x, y, z, tint, multiplier); + float diffuse = LightUtil.diffuseLight(normal[v][0], normal[v][1], normal[v][2]); + for(int i = 0; i < 3; i++) + { + color[v][i] *= diffuse; + } if(EntityRenderer.anaglyphEnable) { applyAnaglyph(color[v]); @@ -234,7 +239,6 @@ public class VertexLighterFlat extends QuadGatheringTransformer } public void setQuadOrientation(EnumFacing orientation) {} public void setQuadCulled() {} - public void setQuadColored() {} public void setWorld(IBlockAccess world) { diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexTransformer.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexTransformer.java index 5fe6565ed9..7a384675d4 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexTransformer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexTransformer.java @@ -27,11 +27,6 @@ public class VertexTransformer implements IVertexConsumer parent.setQuadOrientation(orientation); } - public void setQuadColored() - { - parent.setQuadColored(); - } - public void put(int element, float... data) { parent.put(element, data); diff --git a/src/test/resources/assets/forgedebugmodelanimation/blockstates/test_animation_block.json b/src/test/resources/assets/forgedebugmodelanimation/blockstates/test_animation_block.json index 6fc5602258..f2faef79e5 100644 --- a/src/test/resources/assets/forgedebugmodelanimation/blockstates/test_animation_block.json +++ b/src/test/resources/assets/forgedebugmodelanimation/blockstates/test_animation_block.json @@ -16,14 +16,7 @@ "variants": { "normal": [{}], "inventory": [{ - "transform": { - "rotation": { "y": 180 }, - "thirdperson": { - "rotation": [ { "z": 170 }, { "y": -45 }, { "z": 20 } ], - "translation": [ 0, 0.09375, -0.171875 ], - "scale": 0.375 - } - }, + "transform": "forge:default-block", "model": "forgedebugmodelanimation:engine", "submodel": { "ring": { "model": "forgedebugmodelanimation:engine_ring" } diff --git a/src/test/resources/assets/forgedebugmodelloaderregistry/blockstates/CustomModelBlock.json b/src/test/resources/assets/forgedebugmodelloaderregistry/blockstates/CustomModelBlock.json index e4e82e072e..ced7cffd1c 100644 --- a/src/test/resources/assets/forgedebugmodelloaderregistry/blockstates/CustomModelBlock.json +++ b/src/test/resources/assets/forgedebugmodelloaderregistry/blockstates/CustomModelBlock.json @@ -13,14 +13,7 @@ "variants": { "normal": [{}], "inventory": [{ - "transform": { - "rotation": { "y": 180 }, - "thirdperson": { - "rotation": [ { "z": 170 }, { "y": -45 }, { "z": 20 } ], - "translation": [ 0, 0.09375, -0.171875 ], - "scale": 0.375 - } - } + "transform": "forge:default-block" }], "facing": { "down": {"x": 90}, diff --git a/src/test/resources/assets/forgedebugmultilayermodel/blockstates/test_layer_block.json b/src/test/resources/assets/forgedebugmultilayermodel/blockstates/test_layer_block.json index 15a23f01cf..e5ff027bd1 100644 --- a/src/test/resources/assets/forgedebugmultilayermodel/blockstates/test_layer_block.json +++ b/src/test/resources/assets/forgedebugmultilayermodel/blockstates/test_layer_block.json @@ -7,13 +7,16 @@ "base": "forgedebugmultilayermodel:test_layer_block#aux", // per-layer models "Solid": "forgedebugmultilayermodel:test_layer_block#aux", - "Translucent": "minecraft:pink_stained_glass_pane#east=true,north=false,south=false,west=true" + "Translucent": "forgedebugmultilayermodel:test_layer_block#pane" }, "transform": "forge:default-block" }, "variants": { "normal": [{}], "inventory": [{}], + "pane": [{ + "model": "minecraft:pink_stained_glass_pane_noside" + }], "aux": [{ "model": "cube_all", "textures": { "all": "blocks/slime" }, From a81dfbc4ef20a27e4be8702270fc13fa37761a30 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 17 Mar 2016 14:10:44 +0300 Subject: [PATCH 102/243] Fixed quads that don't need diffuse lighting getting it anyway. --- .../renderer/block/model/BakedQuad.java.patch | 17 +++++++++---- .../model/BakedQuadRetextured.java.patch | 25 +++++++++++++++++++ .../block/model/FaceBakery.java.patch | 8 +++--- .../block/model/ModelBakery.java.patch | 2 +- .../model/pipeline/IVertexConsumer.java | 1 + .../client/model/pipeline/LightUtil.java | 1 + .../model/pipeline/UnpackedBakedQuad.java | 12 ++++++--- .../model/pipeline/VertexBufferConsumer.java | 1 + .../model/pipeline/VertexLighterFlat.java | 14 ++++++++--- .../model/pipeline/VertexTransformer.java | 5 ++++ src/main/resources/forge.exc | 2 +- .../debug/ModelBakeEventDebug.java | 2 +- 12 files changed, 73 insertions(+), 17 deletions(-) create mode 100644 patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuadRetextured.java.patch diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch index 8a1013f885..2348edf932 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java -@@ -6,15 +6,25 @@ +@@ -6,15 +6,26 @@ import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) @@ -18,21 +18,23 @@ + @Deprecated public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_) { -+ this(p_i46574_1_, p_i46574_2_, p_i46574_3_, p_i46574_4_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); ++ this(p_i46574_1_, p_i46574_2_, p_i46574_3_, p_i46574_4_, true, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); + } + -+ public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_, net.minecraft.client.renderer.vertex.VertexFormat format) ++ public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_, boolean applyDiffuseLighting, net.minecraft.client.renderer.vertex.VertexFormat format) + { + this.format = format; ++ this.applyDiffuseLighting = applyDiffuseLighting; this.field_178215_a = p_i46574_1_; this.field_178213_b = p_i46574_2_; this.field_178214_c = p_i46574_3_; -@@ -45,4 +55,17 @@ +@@ -45,4 +56,23 @@ { return this.field_178214_c; } + -+ private final net.minecraft.client.renderer.vertex.VertexFormat format; ++ protected final net.minecraft.client.renderer.vertex.VertexFormat format; ++ protected final boolean applyDiffuseLighting; + + @Override + public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) @@ -43,5 +45,10 @@ + public net.minecraft.client.renderer.vertex.VertexFormat getFormat() + { + return format; ++ } ++ ++ public boolean shouldApplyDiffuseLighting() ++ { ++ return applyDiffuseLighting; + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuadRetextured.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuadRetextured.java.patch new file mode 100644 index 0000000000..4c13ace1da --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuadRetextured.java.patch @@ -0,0 +1,25 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuadRetextured.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuadRetextured.java +@@ -12,7 +12,7 @@ + + public BakedQuadRetextured(BakedQuad p_i46217_1_, TextureAtlasSprite p_i46217_2_) + { +- super(Arrays.copyOf(p_i46217_1_.func_178209_a(), p_i46217_1_.func_178209_a().length), p_i46217_1_.field_178213_b, FaceBakery.func_178410_a(p_i46217_1_.func_178209_a()), p_i46217_1_.func_187508_a()); ++ super(Arrays.copyOf(p_i46217_1_.func_178209_a(), p_i46217_1_.func_178209_a().length), p_i46217_1_.field_178213_b, FaceBakery.func_178410_a(p_i46217_1_.func_178209_a()), p_i46217_1_.func_187508_a(), p_i46217_1_.applyDiffuseLighting, p_i46217_1_.format); + this.field_178218_d = p_i46217_2_; + this.func_178217_e(); + } +@@ -21,9 +21,10 @@ + { + for (int i = 0; i < 4; ++i) + { +- int j = 7 * i; +- this.field_178215_a[j + 4] = Float.floatToRawIntBits(this.field_178218_d.func_94214_a((double)this.field_187509_d.func_188537_a(Float.intBitsToFloat(this.field_178215_a[j + 4])))); +- this.field_178215_a[j + 4 + 1] = Float.floatToRawIntBits(this.field_178218_d.func_94207_b((double)this.field_187509_d.func_188536_b(Float.intBitsToFloat(this.field_178215_a[j + 4 + 1])))); ++ int j = format.func_181719_f() * i; ++ int uvIndex = format.func_177344_b(0); ++ this.field_178215_a[j + uvIndex] = Float.floatToRawIntBits(this.field_178218_d.func_94214_a((double)this.field_187509_d.func_188537_a(Float.intBitsToFloat(this.field_178215_a[j + uvIndex])))); ++ this.field_178215_a[j + uvIndex + 1] = Float.floatToRawIntBits(this.field_178218_d.func_94207_b((double)this.field_187509_d.func_188536_b(Float.intBitsToFloat(this.field_178215_a[j + uvIndex + 1])))); + } + } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch index 2d771db866..a45204c7eb 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -19,18 +19,20 @@ } - int[] aint = this.func_188012_a(blockfaceuv, p_178414_4_, p_178414_5_, this.func_178403_a(p_178414_1_, p_178414_2_), p_178414_6_, p_178414_7_, p_178414_9_); -+ int[] aint = this.makeQuadVertexData(blockfaceuv, p_178414_4_, p_178414_5_, this.func_178403_a(p_178414_1_, p_178414_2_), p_178414_6_, p_178414_7_, p_178414_9_); ++ int[] aint = this.makeQuadVertexData(blockfaceuv, p_178414_4_, p_178414_5_, this.func_178403_a(p_178414_1_, p_178414_2_), p_178414_6_, p_178414_7_, false); EnumFacing enumfacing = func_178410_a(aint); if (p_178414_7_ == null) -@@ -63,6 +69,7 @@ +@@ -63,7 +69,8 @@ this.func_178408_a(aint, enumfacing); } +- return new BakedQuad(aint, p_178414_3_.field_178245_c, enumfacing, p_178414_4_); + net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing); - return new BakedQuad(aint, p_178414_3_.field_178245_c, enumfacing, p_178414_4_); ++ return new BakedQuad(aint, p_178414_3_.field_178245_c, enumfacing, p_178414_4_, p_178414_9_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); } + private BlockFaceUV func_188010_a(BlockFaceUV p_188010_1_, EnumFacing p_188010_2_, ModelRotation p_188010_3_) @@ -73,11 +80,16 @@ private int[] func_188012_a(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, ModelRotation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch index 78f75f8215..4f6cd2e15e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch @@ -132,7 +132,7 @@ + protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) + { -+ return this.field_177607_l.makeBakedQuad(p_177589_1_.field_178241_a, p_177589_1_.field_178239_b, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.field_178237_d, p_177589_6_, false); ++ return this.field_177607_l.makeBakedQuad(p_177589_1_.field_178241_a, p_177589_1_.field_178239_b, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.field_178237_d, p_177589_6_, p_177589_1_.field_178238_e); + } + private void func_177597_h() diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/IVertexConsumer.java b/src/main/java/net/minecraftforge/client/model/pipeline/IVertexConsumer.java index f079cb17cd..2adff8964c 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/IVertexConsumer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/IVertexConsumer.java @@ -17,6 +17,7 @@ public interface IVertexConsumer void setQuadTint(int tint); void setQuadOrientation(EnumFacing orientation); + void setApplyDiffuseLighting(boolean diffuse); void put(int element, float... data); } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java index c6e7bdb740..cbcdb23ccc 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java @@ -88,6 +88,7 @@ public class LightUtil { consumer.setQuadTint(quad.getTintIndex()); } + consumer.setApplyDiffuseLighting(quad.shouldApplyDiffuseLighting()); //int[] eMap = mapFormats(consumer.getVertexFormat(), DefaultVertexFormats.ITEM); float[] data = new float[4]; VertexFormat formatFrom = consumer.getVertexFormat(); diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java b/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java index 1dc298bd95..cecb447789 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java @@ -13,9 +13,9 @@ public class UnpackedBakedQuad extends BakedQuad protected final VertexFormat format; protected boolean packed = false; - public UnpackedBakedQuad(float[][][] unpackedData, int tint, EnumFacing orientation, TextureAtlasSprite texture, VertexFormat format) + public UnpackedBakedQuad(float[][][] unpackedData, int tint, EnumFacing orientation, TextureAtlasSprite texture, boolean applyDiffuseLighting, VertexFormat format) { - super(new int[format.getNextOffset() /* / 4 * 4 */], tint, orientation, texture, format); + super(new int[format.getNextOffset() /* / 4 * 4 */], tint, orientation, texture, applyDiffuseLighting, format); this.unpackedData = unpackedData; this.format = format; } @@ -70,6 +70,7 @@ public class UnpackedBakedQuad extends BakedQuad private int tint = -1; private EnumFacing orientation; private TextureAtlasSprite texture; + private boolean applyDiffuseLighting; private int vertices = 0; private int elements = 0; @@ -101,6 +102,11 @@ public class UnpackedBakedQuad extends BakedQuad this.texture = texture; } + public void setApplyDiffuseLighting(boolean diffuse) + { + this.applyDiffuseLighting = diffuse; + } + public void put(int element, float... data) { for(int i = 0; i < 4; i++) @@ -132,7 +138,7 @@ public class UnpackedBakedQuad extends BakedQuad { throw new IllegalStateException("not enough data"); } - return new UnpackedBakedQuad(unpackedData, tint, orientation, texture, format); + return new UnpackedBakedQuad(unpackedData, tint, orientation, texture, applyDiffuseLighting, format); } } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java index f07e1498c5..de40252230 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java @@ -57,4 +57,5 @@ public class VertexBufferConsumer implements IVertexConsumer public void setQuadTint(int tint) {} public void setQuadOrientation(EnumFacing orientation) {} + public void setApplyDiffuseLighting(boolean diffuse) {} } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java index 3f5d9132af..8492dda252 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java @@ -17,6 +17,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer { protected final BlockInfo blockInfo; private int tint = -1; + private boolean diffuse = true; protected int posIndex = -1; protected int normalIndex = -1; @@ -148,10 +149,13 @@ public class VertexLighterFlat extends QuadGatheringTransformer if(skyLight > lightmap[v][1]) lightmap[v][1] = skyLight; } updateColor(normal[v], color[v], x, y, z, tint, multiplier); - float diffuse = LightUtil.diffuseLight(normal[v][0], normal[v][1], normal[v][2]); - for(int i = 0; i < 3; i++) + if(diffuse) { - color[v][i] *= diffuse; + float d = LightUtil.diffuseLight(normal[v][0], normal[v][1], normal[v][2]); + for(int i = 0; i < 3; i++) + { + color[v][i] *= d; + } } if(EntityRenderer.anaglyphEnable) { @@ -239,6 +243,10 @@ public class VertexLighterFlat extends QuadGatheringTransformer } public void setQuadOrientation(EnumFacing orientation) {} public void setQuadCulled() {} + public void setApplyDiffuseLighting(boolean diffuse) + { + this.diffuse = diffuse; + } public void setWorld(IBlockAccess world) { diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexTransformer.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexTransformer.java index 7a384675d4..1bd4ecda73 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexTransformer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexTransformer.java @@ -27,6 +27,11 @@ public class VertexTransformer implements IVertexConsumer parent.setQuadOrientation(orientation); } + public void setApplyDiffuseLighting(boolean diffuse) + { + parent.setApplyDiffuseLighting(diffuse); + } + public void put(int element, float... data) { parent.put(element, data); diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 9b6ed04ffb..01b0f0b6f5 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -45,5 +45,5 @@ net/minecraft/stats/StatList.mergeStatBases([Lnet/minecraft/stats/StatBase;Lnet/ net/minecraft/item/ItemStack.(Lnet/minecraft/item/Item;IILnet/minecraft/nbt/NBTTagCompound;)V=|p_i1881_1_,p_i1881_2_,p_i1881_3_,capNBT net/minecraft/block/BlockRedstoneWire.canConnectTo(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/EnumFacing;Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;)Z=p_176343_0_,p_176343_1_,world,pos -net/minecraft/client/renderer/block/model/BakedQuad.([IILnet/minecraft/util/EnumFacing;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/client/renderer/vertex/VertexFormat;)V=|p_i46574_1_,p_i46574_2_,p_i46574_3_,p_i46574_4_,format +net/minecraft/client/renderer/block/model/BakedQuad.([IILnet/minecraft/util/EnumFacing;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;ZLnet/minecraft/client/renderer/vertex/VertexFormat;)V=|p_i46574_1_,p_i46574_2_,p_i46574_3_,p_i46574_4_,applyDiffuseLighting,format net/minecraft/client/renderer/texture/TextureMap.(Ljava/lang/String;Lnet/minecraft/client/renderer/texture/IIconCreator;Z)V=|p_i46100_1_,p_i46100_2_,skipFirst diff --git a/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java b/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java index c15b75b289..ace5cdec09 100644 --- a/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java @@ -245,7 +245,7 @@ public class ModelBakeEventDebug vertexToInts((float)v2.xCoord, (float)v2.yCoord, (float)v2.zCoord, -1, texture, 0, 16), vertexToInts((float)v3.xCoord, (float)v3.yCoord, (float)v3.zCoord, -1, texture, 16, 16), vertexToInts((float)v4.xCoord, (float)v4.yCoord, (float)v4.zCoord, -1, texture, 16, 0) - ), -1, side, texture, DefaultVertexFormats.BLOCK); + ), -1, side, texture, true, DefaultVertexFormats.BLOCK); } @Override From 093646e6f1c6ff88162357c643ce74e02b24e9d7 Mon Sep 17 00:00:00 2001 From: LexManos Date: Fri, 18 Mar 2016 00:29:57 -0700 Subject: [PATCH 103/243] Fix AT lines. --- src/main/resources/forge_at.cfg | 48 ++++++++++++++++----------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index a2df630b2e..da08226c1a 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -251,34 +251,34 @@ protected net.minecraft.client.gui.FontRenderer func_78277_a(CZ)F # renderUnicod # ChunkProviderServer # ChunkProviderEnd -private-f net/minecraft/world/gen/ChunkProviderEnd/field_185969_i #lperlin1 -private-f net/minecraft/world/gen/ChunkProviderEnd/field_185970_j #lperlin2 -private-f net/minecraft/world/gen/ChunkProviderEnd/field_185971_k #perlin -private-f net/minecraft/world/gen/ChunkProviderEnd/field_185973_o #island +private-f net.minecraft.world.gen.ChunkProviderEnd field_185969_i #lperlin1 +private-f net.minecraft.world.gen.ChunkProviderEnd field_185970_j #lperlin2 +private-f net.minecraft.world.gen.ChunkProviderEnd field_185971_k #perlin +private-f net.minecraft.world.gen.ChunkProviderEnd field_185973_o #island # ChunkProviderOverworld -private-f net/minecraft/world/gen/ChunkProviderOverworld/field_185991_j #lperlin1 -private-f net/minecraft/world/gen/ChunkProviderOverworld/field_185992_k #lperlin2 -private-f net/minecraft/world/gen/ChunkProviderOverworld/field_185993_l #perlin -private-f net/minecraft/world/gen/ChunkProviderOverworld/field_185994_m #surface -private-f net/minecraft/world/gen/ChunkProviderOverworld/field_185979_A #ravineGenerator -private-f net/minecraft/world/gen/ChunkProviderOverworld/field_185980_B #oceanMonumentGenerator -private-f net/minecraft/world/gen/ChunkProviderOverworld/field_186003_v #caveGenerator -private-f net/minecraft/world/gen/ChunkProviderOverworld/field_186004_w #strongholdGenerator -private-f net/minecraft/world/gen/ChunkProviderOverworld/field_186005_x #villageGenerator -private-f net/minecraft/world/gen/ChunkProviderOverworld/field_186006_y #mineshaftGenerator -private-f net/minecraft/world/gen/ChunkProviderOverworld/field_186007_z #scatteredFeatureGenerator +private-f net.minecraft.world.gen.ChunkProviderOverworld field_185991_j #lperlin1 +private-f net.minecraft.world.gen.ChunkProviderOverworld field_185992_k #lperlin2 +private-f net.minecraft.world.gen.ChunkProviderOverworld field_185993_l #perlin +private-f net.minecraft.world.gen.ChunkProviderOverworld field_185994_m #surface +private-f net.minecraft.world.gen.ChunkProviderOverworld field_185979_A #ravineGenerator +private-f net.minecraft.world.gen.ChunkProviderOverworld field_185980_B #oceanMonumentGenerator +private-f net.minecraft.world.gen.ChunkProviderOverworld field_186003_v #caveGenerator +private-f net.minecraft.world.gen.ChunkProviderOverworld field_186004_w #strongholdGenerator +private-f net.minecraft.world.gen.ChunkProviderOverworld field_186005_x #villageGenerator +private-f net.minecraft.world.gen.ChunkProviderOverworld field_186006_y #mineshaftGenerator +private-f net.minecraft.world.gen.ChunkProviderOverworld field_186007_z #scatteredFeatureGenerator # ChunkProviderHell -private-f net/minecraft/world/gen/ChunkProviderHell/field_185957_u #lperlin1 -private-f net/minecraft/world/gen/ChunkProviderHell/field_185958_v #lperlin2 -private-f net/minecraft/world/gen/ChunkProviderHell/field_185959_w #perlin -private-f net/minecraft/world/gen/ChunkProviderHell/field_73177_m #perlin2 -private-f net/minecraft/world/gen/ChunkProviderHell/field_73174_n #perlin3 -public-f net/minecraft/world/gen/ChunkProviderHell/field_185946_g #scale -public-f net/minecraft/world/gen/ChunkProviderHell/field_185947_h #depth -private-f net/minecraft/world/gen/ChunkProviderHell/field_185939_I #netherCaveGenerator -private-f net/minecraft/world/gen/ChunkProviderHell/field_73172_c #netherBridgeGenerator +private-f net.minecraft.world.gen.ChunkProviderHell field_185957_u #lperlin1 +private-f net.minecraft.world.gen.ChunkProviderHell field_185958_v #lperlin2 +private-f net.minecraft.world.gen.ChunkProviderHell field_185959_w #perlin +private-f net.minecraft.world.gen.ChunkProviderHell field_73177_m #perlin2 +private-f net.minecraft.world.gen.ChunkProviderHell field_73174_n #perlin3 +public-f net.minecraft.world.gen.ChunkProviderHell field_185946_g #scale +public-f net.minecraft.world.gen.ChunkProviderHell field_185947_h #depth +private-f net.minecraft.world.gen.ChunkProviderHell field_185939_I #netherCaveGenerator +private-f net.minecraft.world.gen.ChunkProviderHell field_73172_c #netherBridgeGenerator # PlayerManager private-f net.minecraft.server.management.PlayerManager$PlayerInstance field_187285_e # field_187285_e \ No newline at end of file From 3f3989f6acdea74e2847e4be961bb53a5d5a6434 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Fri, 18 Mar 2016 16:55:18 +0300 Subject: [PATCH 104/243] Fixed invalid index calculation in BakedQuadRetextured. --- .../client/renderer/block/model/BakedQuadRetextured.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuadRetextured.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuadRetextured.java.patch index 4c13ace1da..10b56f5345 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuadRetextured.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuadRetextured.java.patch @@ -17,7 +17,7 @@ - this.field_178215_a[j + 4] = Float.floatToRawIntBits(this.field_178218_d.func_94214_a((double)this.field_187509_d.func_188537_a(Float.intBitsToFloat(this.field_178215_a[j + 4])))); - this.field_178215_a[j + 4 + 1] = Float.floatToRawIntBits(this.field_178218_d.func_94207_b((double)this.field_187509_d.func_188536_b(Float.intBitsToFloat(this.field_178215_a[j + 4 + 1])))); + int j = format.func_181719_f() * i; -+ int uvIndex = format.func_177344_b(0); ++ int uvIndex = format.func_177344_b(0) / 4; + this.field_178215_a[j + uvIndex] = Float.floatToRawIntBits(this.field_178218_d.func_94214_a((double)this.field_187509_d.func_188537_a(Float.intBitsToFloat(this.field_178215_a[j + uvIndex])))); + this.field_178215_a[j + uvIndex + 1] = Float.floatToRawIntBits(this.field_178218_d.func_94207_b((double)this.field_187509_d.func_188536_b(Float.intBitsToFloat(this.field_178215_a[j + uvIndex + 1])))); } From f37a80b302831da99e4861674eb321d02d8e7688 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sat, 19 Mar 2016 07:20:25 +0300 Subject: [PATCH 105/243] Fixed Block.doesSideBlockRendering, closes #2564. --- patches/minecraft/net/minecraft/block/Block.java.patch | 5 +++-- .../minecraft/net/minecraft/block/BlockSlab.java.patch | 9 ++++----- .../net/minecraft/block/BlockStairs.java.patch | 10 ++++------ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 71acb3f7ca..603fb92489 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -196,7 +196,7 @@ public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) { return new ItemStack(Item.func_150898_a(this), 1, this.func_180651_a(p_185473_3_)); -@@ -844,6 +865,1166 @@ +@@ -844,6 +865,1167 @@ return "Block{" + field_149771_c.func_177774_c(this) + "}"; } @@ -255,9 +255,10 @@ + * Faces which are fully opaque should return true, faces with transparency + * or faces which do not span the full size of the block should return false. + * ++ * @param state The current block state + * @param world The current world + * @param pos Block position in world -+ * @param side The side to check ++ * @param face The side to check + * @return True if the block is opaque on the specified side. + */ + public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) diff --git a/patches/minecraft/net/minecraft/block/BlockSlab.java.patch b/patches/minecraft/net/minecraft/block/BlockSlab.java.patch index 0acded7082..c3f6a8f109 100644 --- a/patches/minecraft/net/minecraft/block/BlockSlab.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSlab.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSlab.java +++ ../src-work/minecraft/net/minecraft/block/BlockSlab.java -@@ -50,6 +50,17 @@ +@@ -50,6 +50,16 @@ return this.func_176552_j(); } @@ -10,15 +10,14 @@ + if ( state.func_185914_p() ) + return true; + -+ // face is on the block being rendered, not this block. -+ EnumBlockHalf side = world.func_180495_p(pos).func_177229_b(field_176554_a); -+ return (side == EnumBlockHalf.TOP && face == EnumFacing.DOWN) || (side == EnumBlockHalf.BOTTOM && face == EnumFacing.UP); ++ EnumBlockHalf side = state.func_177229_b(field_176554_a); ++ return (side == EnumBlockHalf.TOP && face == EnumFacing.UP) || (side == EnumBlockHalf.BOTTOM && face == EnumFacing.DOWN); + } + public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) { IBlockState iblockstate = super.func_180642_a(p_180642_1_, p_180642_2_, p_180642_3_, p_180642_4_, p_180642_5_, p_180642_6_, p_180642_7_, p_180642_8_).func_177226_a(field_176554_a, BlockSlab.EnumBlockHalf.BOTTOM); -@@ -77,13 +88,14 @@ +@@ -77,13 +87,14 @@ { return false; } diff --git a/patches/minecraft/net/minecraft/block/BlockStairs.java.patch b/patches/minecraft/net/minecraft/block/BlockStairs.java.patch index 3f83775111..239394de81 100644 --- a/patches/minecraft/net/minecraft/block/BlockStairs.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockStairs.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockStairs.java +++ ../src-work/minecraft/net/minecraft/block/BlockStairs.java -@@ -443,6 +443,19 @@ +@@ -443,6 +443,17 @@ return new BlockStateContainer(this, new IProperty[] {field_176309_a, field_176308_b, field_176310_M}); } @@ -10,11 +10,9 @@ + if ( state.func_185914_p() ) + return true; + -+ // face is on the block being rendered, not this block. -+ IBlockState iblockstate = world.func_180495_p(pos); -+ EnumHalf half = iblockstate.func_177229_b(field_176308_b); -+ EnumFacing side = iblockstate.func_177229_b(field_176309_a); -+ return side == face.func_176734_d() || (half == EnumHalf.TOP && face == EnumFacing.DOWN) || (half == EnumHalf.BOTTOM && face == EnumFacing.UP); ++ EnumHalf half = state.func_177229_b(field_176308_b); ++ EnumFacing side = state.func_177229_b(field_176309_a); ++ return side == face || (half == EnumHalf.TOP && face == EnumFacing.UP) || (half == EnumHalf.BOTTOM && face == EnumFacing.DOWN); + } + public static enum EnumHalf implements IStringSerializable From 77955704219476c481247a95a8f6d63ec9424873 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sat, 19 Mar 2016 08:24:59 +0300 Subject: [PATCH 106/243] Fixed outline shader rendering, closes #2560. --- .../client/renderer/RenderGlobal.java.patch | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch index b71bd566dd..cb766654a5 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -48,7 +48,15 @@ boolean flag = this.field_175010_j.func_178635_a(entity2, p_180446_2_, d0, d1, d2) || entity2.func_184215_y(this.field_72777_q.field_71439_g); if (flag) -@@ -672,6 +682,7 @@ +@@ -633,6 +643,7 @@ + } + } + ++ if(pass == 0) + if (this.func_174985_d() && (!list1.isEmpty() || this.field_184386_ad)) + { + this.field_72769_h.field_72984_F.func_76318_c("entityOutlines"); +@@ -672,6 +683,7 @@ this.field_72769_h.field_72984_F.func_76318_c("blockentities"); RenderHelper.func_74519_b(); @@ -56,7 +64,7 @@ for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 : this.field_72755_R) { List list3 = renderglobal$containerlocalrenderinformation1.field_178036_a.func_178571_g().func_178485_b(); -@@ -680,6 +691,7 @@ +@@ -680,6 +692,7 @@ { for (TileEntity tileentity2 : list3) { @@ -64,7 +72,7 @@ TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity2, p_180446_3_, -1); } } -@@ -689,9 +701,11 @@ +@@ -689,9 +702,11 @@ { for (TileEntity tileentity : this.field_181024_n) { @@ -76,7 +84,7 @@ this.func_180443_s(); -@@ -718,7 +732,7 @@ +@@ -718,7 +733,7 @@ Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c(); @@ -85,7 +93,7 @@ { TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity1, p_180446_3_, destroyblockprogress.func_73106_e()); } -@@ -1210,6 +1224,13 @@ +@@ -1210,6 +1225,13 @@ public void func_174976_a(float p_174976_1_, int p_174976_2_) { @@ -99,7 +107,7 @@ if (this.field_72777_q.field_71441_e.field_73011_w.func_186058_p().func_186068_a() == 1) { this.func_180448_r(); -@@ -1427,6 +1448,12 @@ +@@ -1427,6 +1449,12 @@ public void func_180447_b(float p_180447_1_, int p_180447_2_) { @@ -112,7 +120,7 @@ if (this.field_72777_q.field_71441_e.field_73011_w.func_76569_d()) { if (this.field_72777_q.field_71474_y.func_181147_e() == 2) -@@ -1854,8 +1881,11 @@ +@@ -1854,8 +1882,11 @@ double d4 = (double)blockpos.func_177956_o() - d1; double d5 = (double)blockpos.func_177952_p() - d2; Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c(); From ad03581fbe50f53028f1414eec03ddc9240c6caa Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sat, 19 Mar 2016 09:48:46 +0300 Subject: [PATCH 107/243] Fixed sprite not being passed to the quad builder for custom models. --- .../net/minecraftforge/client/model/ItemLayerModel.java | 9 +++++---- .../client/model/ItemTextureQuadConverter.java | 5 +++-- .../java/net/minecraftforge/client/model/ModelFluid.java | 4 ++++ .../net/minecraftforge/client/model/b3d/B3DLoader.java | 1 + .../net/minecraftforge/client/model/obj/OBJModel.java | 1 + 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index 7d23d4dc72..ca7b14f662 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -224,14 +224,14 @@ public final class ItemLayerModel implements IRetexturableModel } } // front - builder.add(buildQuad(format, transform, EnumFacing.NORTH, tint, + builder.add(buildQuad(format, transform, EnumFacing.NORTH, sprite, tint, 0, 0, 7.5f / 16f, sprite.getMinU(), sprite.getMaxV(), 0, 1, 7.5f / 16f, sprite.getMinU(), sprite.getMinV(), 1, 1, 7.5f / 16f, sprite.getMaxU(), sprite.getMinV(), 1, 0, 7.5f / 16f, sprite.getMaxU(), sprite.getMaxV() )); // back - builder.add(buildQuad(format, transform, EnumFacing.SOUTH, tint, + builder.add(buildQuad(format, transform, EnumFacing.SOUTH, sprite, tint, 0, 0, 8.5f / 16f, sprite.getMinU(), sprite.getMaxV(), 1, 0, 8.5f / 16f, sprite.getMaxU(), sprite.getMaxV(), 1, 1, 8.5f / 16f, sprite.getMaxU(), sprite.getMinV(), @@ -329,7 +329,7 @@ public final class ItemLayerModel implements IRetexturableModel throw new IllegalArgumentException("can't handle z-oriented side"); } return buildQuad( - format, transform, side.getOpposite(), tint, // getOpposite is related either to the swapping of V direction, or something else + format, transform, side.getOpposite(), sprite, tint, // getOpposite is related either to the swapping of V direction, or something else x0, y0, z1, sprite.getInterpolatedU(u0), sprite.getInterpolatedV(v0), x1, y1, z1, sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v1), x1, y1, z2, sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v1), @@ -338,7 +338,7 @@ public final class ItemLayerModel implements IRetexturableModel } private static final BakedQuad buildQuad( - VertexFormat format, Optional transform, EnumFacing side, int tint, + VertexFormat format, Optional transform, EnumFacing side, TextureAtlasSprite sprite, int tint, float x0, float y0, float z0, float u0, float v0, float x1, float y1, float z1, float u1, float v1, float x2, float y2, float z2, float u2, float v2, @@ -347,6 +347,7 @@ public final class ItemLayerModel implements IRetexturableModel UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); builder.setQuadTint(tint); builder.setQuadOrientation(side); + builder.setTexture(sprite); putVertex(builder, format, transform, side, x0, y0, z0, u0, v0); putVertex(builder, format, transform, side, x1, y1, z1, u1, v1); putVertex(builder, format, transform, side, x2, y2, z2, u2, v2); diff --git a/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java b/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java index c9467393ce..14746db939 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java +++ b/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java @@ -195,10 +195,10 @@ public final class ItemTextureQuadConverter y1 = 1f - y2; y2 = 1f - tmp; - return putQuad(format, transform, facing, color, x1, y1, x2, y2, z, u1, v1, u2, v2); + return putQuad(format, transform, facing, sprite, color, x1, y1, x2, y2, z, u1, v1, u2, v2); } - private static UnpackedBakedQuad putQuad(VertexFormat format, TRSRTransformation transform, EnumFacing side, int color, + private static UnpackedBakedQuad putQuad(VertexFormat format, TRSRTransformation transform, EnumFacing side, TextureAtlasSprite sprite, int color, float x1, float y1, float x2, float y2, float z, float u1, float v1, float u2, float v2) { @@ -206,6 +206,7 @@ public final class ItemTextureQuadConverter UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); builder.setQuadTint(-1); builder.setQuadOrientation(side); + builder.setTexture(sprite); if (side == EnumFacing.NORTH) { diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index be1134a11c..50f3774b69 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -209,6 +209,7 @@ public final class ModelFluid implements IModelCustomData EnumFacing side = gas ? EnumFacing.DOWN : EnumFacing.UP; UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); builder.setQuadOrientation(side); + builder.setTexture(topSprite); for(int i = gas ? 3 : 0; i != (gas ? -1 : 4); i+= (gas ? -1 : 1)) { putVertex( @@ -224,6 +225,7 @@ public final class ModelFluid implements IModelCustomData side = side.getOpposite(); builder = new UnpackedBakedQuad.Builder(format); builder.setQuadOrientation(side); + builder.setTexture(still); for(int i = gas ? 3 : 0; i != (gas ? -1 : 4); i+= (gas ? -1 : 1)) { putVertex( @@ -245,6 +247,7 @@ public final class ModelFluid implements IModelCustomData { builder = new UnpackedBakedQuad.Builder(format); builder.setQuadOrientation(side); + builder.setTexture(flowing); for(int j = 0; j < 4; j++) { int l = (k * 3) + (1 - 2 * k) * j; @@ -266,6 +269,7 @@ public final class ModelFluid implements IModelCustomData // 1 quad for inventory UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); builder.setQuadOrientation(EnumFacing.UP); + builder.setTexture(still); for(int i = 0; i < 4; i++) { putVertex( diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 34371c50f2..6e9cf90719 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -723,6 +723,7 @@ public final class B3DLoader implements ICustomModelLoader if(textures == null || textures.isEmpty()) sprite = this.textures.get("missingno"); else if(textures.get(0) == B3DModel.Texture.White) sprite = ModelLoader.White.instance; else sprite = this.textures.get(textures.get(0).getPath()); + quadBuilder.setTexture(sprite); putVertexData(quadBuilder, f.getV1(), f.getNormal(), sprite); putVertexData(quadBuilder, f.getV2(), f.getNormal(), sprite); putVertexData(quadBuilder, f.getV3(), f.getNormal(), sprite); diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index fc53067645..585441359b 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -1400,6 +1400,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData } else sprite = this.textures.get(f.getMaterialName()); UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); builder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z)); + builder.setTexture(sprite); Normal faceNormal = f.getNormal(); putVertexData(builder, f.verts[0], faceNormal, TextureCoordinate.getDefaultUVs()[0], sprite); putVertexData(builder, f.verts[1], faceNormal, TextureCoordinate.getDefaultUVs()[1], sprite); From 8ea90eb39e4c80c44deb786a83054f1b389eb034 Mon Sep 17 00:00:00 2001 From: Corosauce Date: Sat, 19 Mar 2016 16:55:19 -0400 Subject: [PATCH 108/243] Fix for patch targetting the wrong field to change for failed pathfinding penalty --- .../net/minecraft/entity/ai/EntityAIAttackMelee.java.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch index 851c2ecc12..2962e3ed5a 100644 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch @@ -18,7 +18,7 @@ + if (--this.field_75445_i <= 0) + { + this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase); -+ this.field_151497_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); ++ this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); + return this.field_75438_g != null; + } + else @@ -35,7 +35,7 @@ + if (this.canPenalize) + { -+ this.field_151497_i += failedPathFindingPenalty; ++ this.field_75445_i += failedPathFindingPenalty; + if (this.field_75441_b.func_70661_as().func_75505_d() != null) + { + net.minecraft.pathfinding.PathPoint finalPathPoint = this.field_75441_b.func_70661_as().func_75505_d().func_75870_c(); From d5d03740154c5c9bbcdc107c0e24edfe0c383fd1 Mon Sep 17 00:00:00 2001 From: iTitus Date: Sat, 19 Mar 2016 22:37:59 +0100 Subject: [PATCH 109/243] Fix the EntityPlayer patch In 1.8.9 the call goes to getDisplayNameString() so that any changes from the PlayerEvent.NameFormat event are being take into account. In this patch the call goes to func_70005_c_() which is the getter for the GameProfile name. I changed it back. Sorry if you do not want to accept it because it is a one-liner. --- .../net/minecraft/entity/player/EntityPlayer.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index b6f1f07826..b8255a8a53 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -387,7 +387,7 @@ - ITextComponent itextcomponent = new TextComponentString(ScorePlayerTeam.func_96667_a(this.func_96124_cp(), this.func_70005_c_())); + ITextComponent itextcomponent = new TextComponentString(""); + if (!prefixes.isEmpty()) for (ITextComponent prefix : prefixes) itextcomponent.func_150257_a(prefix); -+ itextcomponent.func_150257_a(new TextComponentString(ScorePlayerTeam.func_96667_a(this.func_96124_cp(), this.func_70005_c_()))); ++ itextcomponent.func_150257_a(new TextComponentString(ScorePlayerTeam.func_96667_a(this.func_96124_cp(), this.getDisplayNameString()))); + if (!suffixes.isEmpty()) for (ITextComponent suffix : suffixes) itextcomponent.func_150257_a(suffix); itextcomponent.func_150256_b().func_150241_a(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.func_70005_c_() + " ")); itextcomponent.func_150256_b().func_150209_a(this.func_174823_aP()); From b1a5339b29c3423bcf11d9e89c7e176fccd7af10 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Sat, 19 Mar 2016 17:15:26 -0500 Subject: [PATCH 110/243] Fix #2555 --- patches/minecraft/net/minecraft/block/BlockCrops.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch index 55eadae084..05b445d3c9 100644 --- a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch @@ -32,7 +32,7 @@ + public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { + java.util.List ret = super.getDrops(world, pos, state, fortune); -+ int age = ((Integer)state.func_177229_b(field_176488_a)).intValue(); ++ int age = ((Integer)state.func_177229_b(func_185524_e())).intValue(); + Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); + + if (age >= 7) From 590f3f610efff92fd1aa048611390f5257f1dbd9 Mon Sep 17 00:00:00 2001 From: Take Weiland Date: Sun, 20 Mar 2016 00:11:03 +0100 Subject: [PATCH 111/243] Fix broken patch in EntityPlayer.updateRidden --- .../net/minecraft/entity/player/EntityPlayer.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index b6f1f07826..635341f23a 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -42,7 +42,7 @@ this.func_71015_k(this.field_70165_t - d0, this.field_70163_u - d1, this.field_70161_v - d2); - if (this.func_184187_bx() instanceof EntityPig) -+ if (this.func_184187_bx() instanceof EntityLivingBase && ((EntityLivingBase)this.func_94060_bK()).shouldRiderFaceForward(this)) ++ if (this.func_184187_bx() instanceof EntityLivingBase && ((EntityLivingBase)this.func_184187_bx()).shouldRiderFaceForward(this)) { this.field_70125_A = f1; this.field_70177_z = f; From 8c38f6c1d34d34bfcee612596f4015f46ac031cb Mon Sep 17 00:00:00 2001 From: Blay09 Date: Sun, 20 Mar 2016 00:12:08 +0100 Subject: [PATCH 112/243] Fix KeyInputEvent only being fired if Keyboard.getEventKeyState() is false. It used to be called for both key-up and key-down states prior to 1.9, so I assume Vanilla's changes to F3 behavior broke the patch. --- patches/minecraft/net/minecraft/client/Minecraft.java.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index d778153109..f718dfd55a 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -200,14 +200,14 @@ this.field_71424_I.func_76319_b(); this.field_71423_H = func_71386_F(); } -@@ -1926,6 +1948,7 @@ - this.field_71474_y.field_181657_aC = this.field_71474_y.field_74330_P && GuiScreen.func_175283_s(); +@@ -1927,6 +1949,7 @@ } } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput(); } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput(); } + this.func_184117_aA(); @@ -2166,6 +2189,8 @@ { while (Mouse.next()) From ee6c0414246d4647db91686d91e414c80ea1fa8a Mon Sep 17 00:00:00 2001 From: Matthew Prenger Date: Sat, 19 Mar 2016 19:07:04 -0500 Subject: [PATCH 113/243] Pass exceptions thrown in mod event buses back to FML to handle apropriately --- .../minecraftforge/fml/common/LoadController.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/LoadController.java b/src/main/java/net/minecraftforge/fml/common/LoadController.java index 3a5a60a5a0..59429b69c1 100644 --- a/src/main/java/net/minecraftforge/fml/common/LoadController.java +++ b/src/main/java/net/minecraftforge/fml/common/LoadController.java @@ -44,6 +44,8 @@ import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; +import com.google.common.eventbus.SubscriberExceptionHandler; +import com.google.common.eventbus.SubscriberExceptionContext; public class LoadController { @@ -88,10 +90,18 @@ public class LoadController { Builder eventBus = ImmutableMap.builder(); - for (ModContainer mod : loader.getModList()) + for (final ModContainer mod : loader.getModList()) { //Create mod logger, and make the EventBus logger a child of it. - EventBus bus = new EventBus(mod.getModId()); + EventBus bus = new EventBus(new SubscriberExceptionHandler() + { + @Override + public void handleException(final Throwable exception, final SubscriberExceptionContext context) + { + LoadController.this.errorOccurred(mod, exception); + } + }); + boolean isActive = mod.registerBus(bus, this); if (isActive) { From c39328993e593b42b2b082aff561e1c98ebf0fd2 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Sat, 19 Mar 2016 19:57:11 -0500 Subject: [PATCH 114/243] Fix double dropping of items. Closes #2549 --- src/main/java/net/minecraftforge/common/ForgeHooks.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 9d95ad0f0d..ef548d4334 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -556,7 +556,10 @@ public class ForgeHooks return null; } - player.getEntityWorld().spawnEntityInWorld(event.entityItem); + if (player.isServerWorld()) + { + player.getEntityWorld().spawnEntityInWorld(event.entityItem); + } return event.entityItem; } From af4b74b079365f047b41edc83fe8428f2d73dbf8 Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 19 Mar 2016 21:18:47 -0400 Subject: [PATCH 115/243] Ignore classes directory --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index aa408adefb..ee7a997dd5 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ #idea /.idea +/classes *.iml #gradle From 76e93e854af57837ca9be86e18d78acbbd28ea26 Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 19 Mar 2016 21:36:21 -0400 Subject: [PATCH 116/243] Fix bucket test --- src/test/java/net/minecraftforge/debug/DynBucketTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/test/java/net/minecraftforge/debug/DynBucketTest.java b/src/test/java/net/minecraftforge/debug/DynBucketTest.java index df4aae2b2a..360d8021b2 100644 --- a/src/test/java/net/minecraftforge/debug/DynBucketTest.java +++ b/src/test/java/net/minecraftforge/debug/DynBucketTest.java @@ -17,6 +17,8 @@ import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; import net.minecraft.util.EnumFacing; @@ -164,10 +166,10 @@ public class DynBucketTest public static class TestItem extends Item { @Override - public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + public ActionResult onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { if(worldIn.isRemote) - return itemStackIn; + return new ActionResult(EnumActionResult.PASS, itemStackIn); ItemStackHandler handler = new ItemStackHandler(5); ItemStackHandler handler2 = new ItemStackHandler(5); @@ -197,7 +199,7 @@ public class DynBucketTest System.out.println("Joined: " + joined.getStackInSlot(i)); } - return itemStackIn; + return new ActionResult(EnumActionResult.SUCCESS, itemStackIn); } } From 313d7bbc115b6f2a3e320e305ee355fe75dbe879 Mon Sep 17 00:00:00 2001 From: Take Weiland Date: Sun, 20 Mar 2016 15:02:28 +0100 Subject: [PATCH 117/243] Fix EntityList.func_188429_b not supporting mod-entities, fixes spawn eggs, fixes #2581 --- .../net/minecraft/entity/EntityList.java.patch | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/patches/minecraft/net/minecraft/entity/EntityList.java.patch b/patches/minecraft/net/minecraft/entity/EntityList.java.patch index 479c2500d7..968ebb6115 100644 --- a/patches/minecraft/net/minecraft/entity/EntityList.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityList.java.patch @@ -38,3 +38,13 @@ } else { +@@ -202,7 +214,8 @@ + + public static Entity func_188429_b(String p_188429_0_, World p_188429_1_) + { +- return func_75616_a(func_180122_a(p_188429_0_), p_188429_1_); ++ Entity e = func_75620_a(p_188429_0_, p_188429_1_); // Forge: Support entities without global ID ++ return e == null ? func_75620_a("Pig", p_188429_1_) : e; + } + + public static int func_75619_a(Entity p_75619_0_) From 17589e61bd7564d43489a0c09d330e73a02d8436 Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Sun, 20 Mar 2016 16:33:49 -0700 Subject: [PATCH 118/243] Fix #2601 Minecart infinite acceleration --- .../entity/item/EntityMinecart.java.patch | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch index 8f801c3e93..d6ed1dfe1f 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -152,15 +152,29 @@ { double d17 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y); -@@ -526,6 +557,7 @@ +@@ -524,20 +555,8 @@ + this.field_70165_t = d19 + d1 * d18; + this.field_70161_v = d20 + d2 * d18; this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); - double d22 = this.field_70159_w; - double d23 = this.field_70179_y; +- double d22 = this.field_70159_w; +- double d23 = this.field_70179_y; + this.moveMinecartOnRail(p_180460_1_); - if (this.func_184207_aI()) +- if (this.func_184207_aI()) +- { +- d22 *= 0.75D; +- d23 *= 0.75D; +- } +- +- double d13 = this.func_174898_m(); +- d22 = MathHelper.func_151237_a(d22, -d13, d13); +- d23 = MathHelper.func_151237_a(d23, -d13, d13); +- this.func_70091_d(d22, 0.0D, d23); +- + if (aint[0][1] != 0 && MathHelper.func_76128_c(this.field_70165_t) - p_180460_1_.func_177958_n() == aint[0][0] && MathHelper.func_76128_c(this.field_70161_v) - p_180460_1_.func_177952_p() == aint[0][2]) { -@@ -574,8 +606,14 @@ + this.func_70107_b(this.field_70165_t, this.field_70163_u + (double)aint[0][1], this.field_70161_v); +@@ -574,8 +593,14 @@ this.field_70179_y = d5 * (double)(i - p_180460_1_.func_177952_p()); } @@ -176,7 +190,7 @@ double d15 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y); if (d15 > 0.01D) -@@ -795,13 +833,19 @@ +@@ -795,13 +820,19 @@ public void func_70108_f(Entity p_70108_1_) { @@ -197,7 +211,7 @@ { p_70108_1_.func_184220_m(this); } -@@ -847,7 +891,7 @@ +@@ -847,7 +878,7 @@ double d7 = p_70108_1_.field_70159_w + this.field_70159_w; double d8 = p_70108_1_.field_70179_y + this.field_70179_y; @@ -206,7 +220,7 @@ { this.field_70159_w *= 0.20000000298023224D; this.field_70179_y *= 0.20000000298023224D; -@@ -855,7 +899,7 @@ +@@ -855,7 +886,7 @@ p_70108_1_.field_70159_w *= 0.949999988079071D; p_70108_1_.field_70179_y *= 0.949999988079071D; } @@ -215,7 +229,7 @@ { p_70108_1_.field_70159_w *= 0.20000000298023224D; p_70108_1_.field_70179_y *= 0.20000000298023224D; -@@ -982,6 +1026,221 @@ +@@ -982,6 +1013,221 @@ this.func_184212_Q().func_187227_b(field_184270_f, Boolean.valueOf(p_94096_1_)); } @@ -250,7 +264,7 @@ + double mX = this.field_70159_w; + double mZ = this.field_70179_y; + -+ if (this.func_184187_bx() != null) ++ if (this.func_184207_aI()) + { + mX *= 0.75D; + mZ *= 0.75D; From 449bf3a292bb1807851e58283119557c4c5dad3b Mon Sep 17 00:00:00 2001 From: gigaherz Date: Mon, 21 Mar 2016 04:18:16 +0100 Subject: [PATCH 119/243] Fix a condition that caused the enchantment table to roll invalid enchantments. --- .../net/minecraft/enchantment/EnchantmentHelper.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index 010e0173e4..e874421c40 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -33,7 +33,7 @@ for (Enchantment enchantment : Enchantment.field_185264_b) { - if ((!enchantment.func_185261_e() || p_185291_2_) && (enchantment.field_77351_y.func_77557_a(item) || flag)) -+ if ((!enchantment.func_185261_e() || p_185291_2_) && (enchantment.canApplyAtEnchantingTable(p_185291_1_) || (flag || enchantment.isAllowedOnBooks()))) ++ if ((!enchantment.func_185261_e() || p_185291_2_) && (enchantment.canApplyAtEnchantingTable(p_185291_1_) || (flag && enchantment.isAllowedOnBooks()))) { for (int i = enchantment.func_77325_b(); i > enchantment.func_77319_d() - 1; --i) { From 5f62404f8afd835c1f553bd2324cae5929f23f64 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Mon, 21 Mar 2016 09:15:39 +0300 Subject: [PATCH 120/243] Switched animation system to capabilities, added animated item example, fixed state passing in MultiModel. --- .../block/model/ItemOverrideList.java.patch | 7 +- .../net/minecraft/item/Item.java.patch | 24 ++- .../client/model/BlockStateLoader.java | 4 +- .../client/model/ModelLoader.java | 19 ++- .../client/model/MultiModel.java | 57 ++++++- .../client/model/animation/Animation.java | 4 +- .../animation/AnimationItemOverrideList.java | 63 ++++++++ .../model/animation/AnimationModelBase.java | 17 ++- .../client/model/animation/AnimationTESR.java | 8 +- .../model/animation/CapabilityAnimation.java | 61 ++++++++ .../model/animation/IAnimationProvider.java | 12 -- .../client/model/b3d/B3DLoader.java | 10 +- .../debug/ModelAnimationDebug.java | 143 +++++++++++------- .../blockstates/test_animation_block.json | 8 +- 14 files changed, 338 insertions(+), 99 deletions(-) create mode 100644 src/main/java/net/minecraftforge/client/model/animation/AnimationItemOverrideList.java create mode 100644 src/main/java/net/minecraftforge/client/model/animation/CapabilityAnimation.java delete mode 100644 src/main/java/net/minecraftforge/client/model/animation/IAnimationProvider.java diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch index c6a455d288..a000941766 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch @@ -8,7 +8,7 @@ public ResourceLocation func_188021_a(ItemStack p_188021_1_, World p_188021_2_, EntityLivingBase p_188021_3_) { if (!this.field_188023_b.isEmpty()) -@@ -42,4 +43,18 @@ +@@ -42,4 +43,23 @@ return null; } @@ -25,5 +25,10 @@ + } + } + return originalModel; ++ } ++ ++ public com.google.common.collect.ImmutableList getOverrides() ++ { ++ return com.google.common.collect.ImmutableList.copyOf(field_188023_b); + } } diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 46f446cc99..23d952ef4e 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -57,7 +57,7 @@ Vec3d vec3d1 = vec3d.func_72441_c((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); return p_77621_1_.func_147447_a(vec3d, vec3d1, p_77621_3_, !p_77621_3_, false); } -@@ -422,11 +431,588 @@ +@@ -422,11 +431,606 @@ return false; } @@ -641,12 +641,30 @@ + { + return null; + } ++ ++ public com.google.common.collect.ImmutableMap getAnimationParameters(final ItemStack stack, final World world, final EntityLivingBase entity) ++ { ++ com.google.common.collect.ImmutableMap.Builder builder = com.google.common.collect.ImmutableMap.builder(); ++ for(ResourceLocation location : field_185051_m.func_148742_b()) ++ { ++ final IItemPropertyGetter parameter = field_185051_m.func_82594_a(location); ++ builder.put(location.toString(), new net.minecraftforge.client.model.animation.ITimeValue() ++ { ++ public float apply(float input) ++ { ++ return parameter.func_185085_a(stack, world, entity); ++ } ++ }); ++ } ++ return builder.build(); ++ } ++ + /* ======================================== FORGE END =====================================*/ + public static void func_150900_l() { func_179214_a(Blocks.field_150348_b, (new ItemMultiTexture(Blocks.field_150348_b, Blocks.field_150348_b, new Function() -@@ -935,6 +1521,10 @@ +@@ -935,6 +1539,10 @@ private final float field_78011_i; private final int field_78008_j; @@ -657,7 +675,7 @@ private ToolMaterial(int p_i1874_3_, int p_i1874_4_, float p_i1874_5_, float p_i1874_6_, int p_i1874_7_) { this.field_78001_f = p_i1874_3_; -@@ -969,9 +1559,36 @@ +@@ -969,9 +1577,36 @@ return this.field_78008_j; } diff --git a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java index e813982b18..89141ec737 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java +++ b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java @@ -185,9 +185,7 @@ public class BlockStateLoader IModel model = ModelLoaderRegistry.getModelOrLogError(part.getModelLocation(), "Unable to load block sub-model: \'" + part.getModelLocation()); - IModelState partState = new ModelStateComposition(baseTr, part.getState()); - - models.put(entry.getKey(), Pair.of(runModelHooks(model, part.smooth, part.gui3d, part.uvLock, part.getTextures(), part.getCustomData()), partState)); + models.put(entry.getKey(), Pair.of(runModelHooks(model, part.smooth, part.gui3d, part.uvLock, part.getTextures(), part.getCustomData()), part.getState())); } return new MultiModel(getModelLocation(), hasBase ? base : null, baseTr, models.build()); diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index b72b8cf46c..395913f585 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -28,6 +28,7 @@ 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.ItemModelGenerator; +import net.minecraft.client.renderer.block.model.ItemOverrideList; import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelBlock; import net.minecraft.client.renderer.block.model.ModelBlockDefinition; @@ -57,6 +58,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.registry.IRegistry; import net.minecraftforge.client.model.animation.Animation; +import net.minecraftforge.client.model.animation.AnimationItemOverrideList; import net.minecraftforge.client.model.animation.IAnimatedModel; import net.minecraftforge.client.model.animation.IClip; import net.minecraftforge.client.model.animation.ModelBlockAnimation; @@ -497,17 +499,18 @@ public final class ModelLoader extends ModelBakery return new ItemLayerModel(model).bake(perState, format, bakedTextureGetter); } if(isCustomRenderer(model)) return new BuiltInModel(transforms, model.createOverrides()); - return bakeNormal(model, perState, state.apply(Optional.absent()).or(TRSRTransformation.identity()), newTransforms, format, bakedTextureGetter, uvlock); + return bakeNormal(model, perState, state, newTransforms, format, bakedTextureGetter, uvlock); } - private IBakedModel bakeNormal(ModelBlock model, IModelState perState, final TRSRTransformation modelState, List newTransforms, final VertexFormat format, final Function bakedTextureGetter, boolean uvLocked) + private IBakedModel bakeNormal(ModelBlock model, IModelState perState, final IModelState modelState, List newTransforms, final VertexFormat format, final Function bakedTextureGetter, boolean uvLocked) { + final TRSRTransformation baseState = modelState.apply(Optional.absent()).or(TRSRTransformation.identity()); TextureAtlasSprite particle = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName("particle"))); SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(model, model.createOverrides())).setTexture(particle); for(int i = 0; i < model.getElements().size(); i++) { BlockPart part = model.getElements().get(i); - TRSRTransformation transformation = modelState; + TRSRTransformation transformation = baseState; if(newTransforms.get(i) != null) { transformation = transformation.compose(newTransforms.get(i)); @@ -525,13 +528,15 @@ public final class ModelLoader extends ModelBakery } else { - builder.addFaceQuad(modelState.rotate(e.getValue().cullFace), makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), transformation, uvLocked)); + builder.addFaceQuad(baseState.rotate(e.getValue().cullFace), makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), transformation, uvLocked)); } } } return new IPerspectiveAwareModel.MapWrapper(builder.makeBakedModel(), perState) { + private final ItemOverrideList overrides = new AnimationItemOverrideList(VanillaModelWrapper.this, modelState, format, bakedTextureGetter, super.getOverrides()); + @Override public List getQuads(IBlockState state, EnumFacing side, long rand) { @@ -550,6 +555,12 @@ public final class ModelLoader extends ModelBakery } return super.getQuads(state, side, rand); }; + + @Override + public ItemOverrideList getOverrides() + { + return overrides; + } }; } diff --git a/src/main/java/net/minecraftforge/client/model/MultiModel.java b/src/main/java/net/minecraftforge/client/model/MultiModel.java index a6f3b6c8c8..7db688ee40 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiModel.java @@ -14,11 +14,15 @@ 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.ItemOverride; import net.minecraft.client.renderer.block.model.ItemOverrideList; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLLog; import org.apache.commons.lang3.tuple.Pair; @@ -28,6 +32,7 @@ import com.google.common.base.Function; import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; import com.google.common.collect.Sets; // TODO: Switch to vanilla class, or to something similar @@ -36,15 +41,55 @@ public final class MultiModel implements IModel { private static final class Baked implements IPerspectiveAwareModel { + private final ResourceLocation location; private final IBakedModel base; private final ImmutableMap parts; private final IBakedModel internalBase; private ImmutableMap, ImmutableList> quads; private final ImmutableMap> transforms; + private final ItemOverrideList overrides = new ItemOverrideList(Lists.newArrayList()) + { + @Override + public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) + { + if(originalModel != Baked.this) + { + return originalModel; + } + boolean dirty = false; + IBakedModel newBase = null; + + if(base != null) + { + newBase = base.getOverrides().handleItemState(base, stack, world, entity); + if(base != newBase) + { + dirty = true; + } + } + ImmutableMap.Builder builder = ImmutableMap.builder(); + for(Map.Entry entry : parts.entrySet()) + { + IBakedModel newPart = entry.getValue().getOverrides().handleItemState(entry.getValue(), stack, world, entity); + builder.put(entry.getKey(), newPart); + if(entry.getValue() != newPart) + { + dirty = true; + } + } + if(dirty) + { + // TODO: caching? + return new Baked(location, newBase instanceof IPerspectiveAwareModel, newBase, builder.build()); + } + return Baked.this; + } + }; public Baked(ResourceLocation location, boolean perspective, IBakedModel base, ImmutableMap parts) { + this.location = location; this.base = base; this.parts = parts; @@ -120,22 +165,22 @@ public final class MultiModel implements IModel ImmutableList.Builder quads = ImmutableList.builder(); if (base != null) { - quads.addAll(base.getQuads(null, face, 0)); + quads.addAll(base.getQuads(state, face, 0)); } for (IBakedModel bakedPart : parts.values()) { - quads.addAll(bakedPart.getQuads(null, face, 0)); + quads.addAll(bakedPart.getQuads(state, face, 0)); } builder.put(Optional.of(face), quads.build()); } ImmutableList.Builder quads = ImmutableList.builder(); if (base != null) { - quads.addAll(base.getQuads(null, null, 0)); + quads.addAll(base.getQuads(state, null, 0)); } for (IBakedModel bakedPart : parts.values()) { - quads.addAll(bakedPart.getQuads(null, null, 0)); + quads.addAll(bakedPart.getQuads(state, null, 0)); } builder.put(Optional.absent(), quads.build()); this.quads = builder.build(); @@ -154,7 +199,7 @@ public final class MultiModel implements IModel @Override public ItemOverrideList getOverrides() { - return ItemOverrideList.NONE; + return overrides; } } @@ -217,7 +262,7 @@ public final class MultiModel implements IModel for (Entry> entry : parts.entrySet()) { Pair pair = entry.getValue(); - mapBuilder.put(entry.getKey(), pair.getLeft().bake(pair.getRight(), format, bakedTextureGetter)); + mapBuilder.put(entry.getKey(), pair.getLeft().bake(new ModelStateComposition(state, pair.getRight()), format, bakedTextureGetter)); } if(bakedBase == null && parts.isEmpty()) diff --git a/src/main/java/net/minecraftforge/client/model/animation/Animation.java b/src/main/java/net/minecraftforge/client/model/animation/Animation.java index 75cc9ccac1..e25786c528 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/Animation.java +++ b/src/main/java/net/minecraftforge/client/model/animation/Animation.java @@ -107,7 +107,7 @@ public enum Animation implements IResourceManagerReloadListener return defaultModelBlockAnimation; } ModelBlockAnimation mba = mbaGson.fromJson(new InputStreamReader(resource.getInputStream(), "UTF-8"), ModelBlockAnimation.class); - String json = mbaGson.toJson(mba); + //String json = mbaGson.toJson(mba); return mba; } catch(IOException e) @@ -124,7 +124,7 @@ public enum Animation implements IResourceManagerReloadListener private IResourceManager manager; - private final AnimationStateMachine missing = new AnimationStateMachine( + protected final AnimationStateMachine missing = new AnimationStateMachine( ImmutableMap.of(), ImmutableMap.of("missingno", (IClip)Clips.IdentityClip.instance), ImmutableList.of("missingno"), diff --git a/src/main/java/net/minecraftforge/client/model/animation/AnimationItemOverrideList.java b/src/main/java/net/minecraftforge/client/model/animation/AnimationItemOverrideList.java new file mode 100644 index 0000000000..9fe76315fe --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/animation/AnimationItemOverrideList.java @@ -0,0 +1,63 @@ +package net.minecraftforge.client.model.animation; + +import java.util.List; + +import net.minecraft.client.Minecraft; +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.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraftforge.client.model.IModel; +import net.minecraftforge.client.model.IModelState; +import net.minecraftforge.client.model.ModelStateComposition; +import net.minecraftforge.common.model.animation.IAnimationStateMachine; + +import com.google.common.base.Function; + +public final class AnimationItemOverrideList extends ItemOverrideList +{ + private final IModel model; + private final IModelState state; + private final VertexFormat format; + private final Function bakedTextureGetter; + + public AnimationItemOverrideList(IModel model, IModelState state, VertexFormat format, Function bakedTextureGetter, ItemOverrideList overrides) + { + this(model, state, format, bakedTextureGetter, overrides.getOverrides()); + } + + public AnimationItemOverrideList(IModel model, IModelState state, VertexFormat format, Function bakedTextureGetter, List overrides) + { + super(overrides); + this.model = model; + this.state = state; + this.format = format; + this.bakedTextureGetter = bakedTextureGetter; + } + + @Override + public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) + { + if(stack.hasCapability(net.minecraftforge.client.model.animation.CapabilityAnimation.ANIMATION_CAPABILITY, null)) + { + // TODO: caching? + IAnimationStateMachine asm = stack.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null); + if(world == null) + { + world = entity.worldObj; + } + if(world == null) + { + world = Minecraft.getMinecraft().theWorld; + } + IModelState state = asm.apply(Animation.getWorldTime(world, Animation.getPartialTickTime())).getLeft(); + return model.bake(new ModelStateComposition(state, this.state), format, bakedTextureGetter); + } + return originalModel; + } +} diff --git a/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java b/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java index 6174ee335c..3273967920 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java +++ b/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java @@ -14,9 +14,11 @@ import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.IModel; import net.minecraftforge.client.model.IModelState; import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.client.model.pipeline.VertexLighterFlat; import net.minecraftforge.client.model.pipeline.VertexBufferConsumer; @@ -28,14 +30,14 @@ import org.lwjgl.opengl.GL11; * Some quirks are still left, deprecated for the moment. */ @Deprecated -public class AnimationModelBase extends ModelBase implements IEventHandler +public class AnimationModelBase extends ModelBase implements IEventHandler { private final VertexLighterFlat lighter; - private final IModel model; + private final ResourceLocation modelLocation; - public AnimationModelBase(IModel model, VertexLighterFlat lighter) + public AnimationModelBase(ResourceLocation modelLocation, VertexLighterFlat lighter) { - this.model = model; + this.modelLocation = modelLocation; this.lighter = lighter; } @@ -43,13 +45,14 @@ public class AnimationModelBase extends M @Override public void render(Entity entity, float limbSwing, float limbSwingSpeed, float timeAlive, float yawHead, float rotationPitch, float scale) { - if(!(entity instanceof IAnimationProvider)) + if(!(entity.hasCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null))) { - throw new ClassCastException("AnimationModelBase expects IAnimationProvider"); + return; } - Pair> pair = ((IAnimationProvider)entity).asm().apply(timeAlive / 20); + Pair> pair = entity.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null).apply(timeAlive / 20); handleEvents((T)entity, timeAlive / 20, pair.getRight()); + IModel model = ModelLoaderRegistry.getModelOrMissing(modelLocation); IBakedModel bakedModel = model.bake(pair.getLeft(), DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter()); BlockPos pos = new BlockPos(entity.posX, entity.posY + entity.height, entity.posZ); diff --git a/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java b/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java index ac6ec94d6f..db81f323d7 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java +++ b/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java @@ -18,12 +18,16 @@ import org.apache.commons.lang3.tuple.Pair; /** * Generic TileEntitySpecialRenderer that works with the Forge model system and animations. */ -public class AnimationTESR extends FastTESR implements IEventHandler +public class AnimationTESR extends FastTESR implements IEventHandler { protected static BlockRendererDispatcher blockRenderer; public void renderTileEntityFast(T te, double x, double y, double z, float partialTick, int breakStage, VertexBuffer renderer) { + if(!te.hasCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null)) + { + return; + } if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); BlockPos pos = te.getPos(); IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos); @@ -38,7 +42,7 @@ public class AnimationTESR extends Fa if(exState.getUnlistedNames().contains(Properties.AnimationProperty)) { float time = Animation.getWorldTime(getWorld(), partialTick); - Pair> pair = te.asm().apply(time); + Pair> pair = te.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null).apply(time); handleEvents(te, time, pair.getRight()); // TODO: caching? diff --git a/src/main/java/net/minecraftforge/client/model/animation/CapabilityAnimation.java b/src/main/java/net/minecraftforge/client/model/animation/CapabilityAnimation.java new file mode 100644 index 0000000000..3181e463d2 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/animation/CapabilityAnimation.java @@ -0,0 +1,61 @@ +package net.minecraftforge.client.model.animation; + +import java.util.concurrent.Callable; + +import net.minecraft.nbt.NBTBase; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityInject; +import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.common.model.animation.IAnimationStateMachine; + +public class CapabilityAnimation +{ + @CapabilityInject(IAnimationStateMachine.class) + public static Capability ANIMATION_CAPABILITY = null; + + public static void register() + { + CapabilityManager.INSTANCE.register(IAnimationStateMachine.class, new Capability.IStorage() + { + public NBTBase writeNBT(Capability capability, IAnimationStateMachine instance, EnumFacing side) + { + return null; + } + + public void readNBT(Capability capability, IAnimationStateMachine instance, EnumFacing side, NBTBase nbt) {} + }, new Callable() + { + public IAnimationStateMachine call() throws Exception + { + return Animation.INSTANCE.missing; + } + }); + } + + public static class DefaultItemAnimationCapabilityProvider implements ICapabilityProvider + { + private final IAnimationStateMachine asm; + + public DefaultItemAnimationCapabilityProvider(IAnimationStateMachine asm) + { + this.asm = asm; + } + + public boolean hasCapability(Capability capability, EnumFacing facing) + { + return capability == ANIMATION_CAPABILITY; + } + + @SuppressWarnings("unchecked") + public T getCapability(Capability capability, EnumFacing facing) + { + if(capability == ANIMATION_CAPABILITY) + { + return (T)asm; + } + return null; + } + } +} diff --git a/src/main/java/net/minecraftforge/client/model/animation/IAnimationProvider.java b/src/main/java/net/minecraftforge/client/model/animation/IAnimationProvider.java deleted file mode 100644 index 94723d38f1..0000000000 --- a/src/main/java/net/minecraftforge/client/model/animation/IAnimationProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.minecraftforge.client.model.animation; - -import net.minecraftforge.common.model.animation.IAnimationStateMachine; - - -/** - * Something that can provide the Animation State Machine, for example and Entity or a Block - */ -public interface IAnimationProvider -{ - public IAnimationStateMachine asm(); -} diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 6e9cf90719..9ae3fdc8e3 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -49,7 +49,6 @@ import net.minecraftforge.client.model.b3d.B3DModel.Mesh; import net.minecraftforge.client.model.b3d.B3DModel.Node; import net.minecraftforge.client.model.b3d.B3DModel.Texture; import net.minecraftforge.client.model.b3d.B3DModel.Vertex; -import net.minecraftforge.client.model.pipeline.LightUtil; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; @@ -680,9 +679,16 @@ public final class B3DLoader implements ICustomModelLoader if(quads == null) { ImmutableList.Builder builder = ImmutableList.builder(); - generateQuads(builder, node, modelState); + generateQuads(builder, node, this.state); quads = builder.build(); } + // TODO: caching? + if(this.state != modelState) + { + ImmutableList.Builder builder = ImmutableList.builder(); + generateQuads(builder, node, modelState); + return builder.build(); + } return quads; } diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index 3156a226fb..07c248117d 100644 --- a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -1,7 +1,5 @@ package net.minecraftforge.debug; -import java.io.IOException; - import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; import net.minecraft.block.material.Material; @@ -20,7 +18,9 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; @@ -28,23 +28,17 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.client.model.IModel; -import net.minecraftforge.client.model.IModelState; -import net.minecraftforge.client.model.IRetexturableModel; import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.client.model.ModelLoaderRegistry; -import net.minecraftforge.client.model.ModelProcessingHelper; -import net.minecraftforge.client.model.MultiModel; -import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.client.model.animation.Animation; -import net.minecraftforge.client.model.animation.AnimationModelBase; import net.minecraftforge.client.model.animation.AnimationTESR; +import net.minecraftforge.client.model.animation.CapabilityAnimation; import net.minecraftforge.client.model.animation.Event; -import net.minecraftforge.client.model.animation.IAnimationProvider; import net.minecraftforge.client.model.animation.ITimeValue; import net.minecraftforge.client.model.animation.TimeValues.VariableValue; import net.minecraftforge.client.model.b3d.B3DLoader; import net.minecraftforge.client.model.pipeline.VertexLighterSmoothAo; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.model.animation.IAnimationStateMachine; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; @@ -60,8 +54,6 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.common.registry.GameRegistry; -import org.apache.commons.lang3.tuple.Pair; - import com.google.common.collect.ImmutableMap; @Mod(modid = ModelAnimationDebug.MODID, version = ModelAnimationDebug.VERSION) @@ -156,6 +148,14 @@ public class ModelAnimationDebug } return true; } + }, null, blockName); + GameRegistry.registerItem(new ItemBlock(GameRegistry.findBlock(MODID, blockName)) + { + @Override + public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) + { + return new ItemAnimationHolder(); + } }, blockName); GameRegistry.registerTileEntity(Chest.class, MODID + ":" + "tile_" + blockName); } @@ -192,6 +192,7 @@ public class ModelAnimationDebug EntityRegistry.registerModEntity(EntityChest.class, entityName, 0, ModelAnimationDebug.instance, 64, 20, true, 0xFFAAAA00, 0xFFDDDD00); RenderingRegistry.registerEntityRenderingHandler(EntityChest.class, new IRenderFactory() { + @SuppressWarnings("deprecation") public Render createRenderFor(RenderManager manager) { /*model = ModelLoaderRegistry.getModel(new ResourceLocation(ModelLoaderRegistryDebug.MODID, "block/chest.b3d")); @@ -203,25 +204,8 @@ public class ModelAnimationDebug { model = ((IModelCustomData)model).process(ImmutableMap.of("mesh", "[\"Base\", \"Lid\"]")); }*/ - IModel base = ModelLoaderRegistry.getModelOrMissing(new ResourceLocation(ModelAnimationDebug.MODID, "block/engine")); - IModel ring = ModelLoaderRegistry.getModelOrMissing(new ResourceLocation(ModelAnimationDebug.MODID, "block/engine_ring")); - ImmutableMap textures = ImmutableMap.of( - "base", "blocks/stone", - "front", "blocks/log_oak", - "chamber", "blocks/redstone_block", - "trunk", "blocks/end_stone" - ); - base = ModelProcessingHelper.retexture(base, textures); - ring = ModelProcessingHelper.retexture(base, textures); - IModel model = new MultiModel( - new ResourceLocation(ModelAnimationDebug.MODID, "builtin/engine"), - ring, - TRSRTransformation.identity(), - ImmutableMap.of( - "base", Pair.of(base, TRSRTransformation.identity()) - ) - ); - return new RenderLiving(manager, new AnimationModelBase(model, new VertexLighterSmoothAo(Minecraft.getMinecraft().getBlockColors())) + ResourceLocation location = new ModelResourceLocation(new ResourceLocation(MODID, blockName), "entity"); + return new RenderLiving(manager, new net.minecraftforge.client.model.animation.AnimationModelBase(location, new VertexLighterSmoothAo(Minecraft.getMinecraft().getBlockColors())) { @Override public void handleEvents(EntityChest chest, float time, Iterable pastEvents) @@ -246,10 +230,34 @@ public class ModelAnimationDebug } + private static class ItemAnimationHolder implements ICapabilityProvider + { + private final VariableValue cycleLength = new VariableValue(4); + + private final IAnimationStateMachine asm = proxy.load(new ResourceLocation(MODID.toLowerCase(), "asms/block/engine.json"), ImmutableMap.of( + "cycle_length", cycleLength + )); + + public boolean hasCapability(Capability capability, EnumFacing facing) + { + return capability == CapabilityAnimation.ANIMATION_CAPABILITY; + } + + @SuppressWarnings("unchecked") + public T getCapability(Capability capability, EnumFacing facing) + { + if(capability == CapabilityAnimation.ANIMATION_CAPABILITY) + { + return (T)asm; + } + return null; + } + } + @EventHandler public void preInit(FMLPreInitializationEvent event) { proxy.preInit(event); } - public static class Chest extends TileEntity implements IAnimationProvider + public static class Chest extends TileEntity { private final IAnimationStateMachine asm; private final VariableValue cycleLength = new VariableValue(4); @@ -319,25 +327,37 @@ public class ModelAnimationDebug } } - public IAnimationStateMachine asm() + @Override + public boolean hasCapability(Capability capability, EnumFacing side) { - return asm; + if(capability == CapabilityAnimation.ANIMATION_CAPABILITY) + { + return true; + } + return super.hasCapability(capability, side); + } + + @SuppressWarnings("unchecked") + @Override + public T getCapability(Capability capability, EnumFacing side) + { + if(capability == CapabilityAnimation.ANIMATION_CAPABILITY) + { + return (T)asm; + } + return super.getCapability(capability, side); } } - public static class EntityChest extends EntityLiving implements IAnimationProvider + public static class EntityChest extends EntityLiving { private final IAnimationStateMachine asm; - private VariableValue cycleLength; + private final VariableValue cycleLength = new VariableValue(getHealth() / 5); public EntityChest(World world) { super(world); setSize(1, 1); - if(cycleLength == null) - { - cycleLength = new VariableValue(getHealth() / 5); - } asm = proxy.load(new ResourceLocation(MODID.toLowerCase(), "asms/block/engine.json"), ImmutableMap.of( "cycle_length", cycleLength )); @@ -348,25 +368,15 @@ public class ModelAnimationDebug // TODO Auto-generated method stub } - public IAnimationStateMachine asm() + @Override + public void onEntityUpdate() { - return asm; - } - - // FIXME update health - /*@Override - public void func_184206_a(DataParameter key) - { - super.func_184206_a(key); - if(field_184632_c.equals(key)) // health + super.onEntityUpdate(); + if(worldObj.isRemote && cycleLength != null) { - if(cycleLength == null) - { - cycleLength = new VariableValue(0); - } cycleLength.setValue(getHealth() / 5); } - }*/ + } @Override protected void applyEntityAttributes() @@ -374,6 +384,27 @@ public class ModelAnimationDebug super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(60); } + + @Override + public boolean hasCapability(Capability capability, EnumFacing side) + { + if(capability == CapabilityAnimation.ANIMATION_CAPABILITY) + { + return true; + } + return super.hasCapability(capability, side); + } + + @SuppressWarnings("unchecked") + @Override + public T getCapability(Capability capability, EnumFacing side) + { + if(capability == CapabilityAnimation.ANIMATION_CAPABILITY) + { + return (T)asm; + } + return super.getCapability(capability, side); + } } } diff --git a/src/test/resources/assets/forgedebugmodelanimation/blockstates/test_animation_block.json b/src/test/resources/assets/forgedebugmodelanimation/blockstates/test_animation_block.json index f2faef79e5..26dc74ed9d 100644 --- a/src/test/resources/assets/forgedebugmodelanimation/blockstates/test_animation_block.json +++ b/src/test/resources/assets/forgedebugmodelanimation/blockstates/test_animation_block.json @@ -43,6 +43,12 @@ }*/ "model": "forgedebugmodelanimation:engine_ring" } - } + }, + "entity": [{ + "model": "forgedebugmodelanimation:engine", + "submodel": { + "ring": { "model": "forgedebugmodelanimation:engine_ring" } + } + }] } } From 286c8c05b78240c37e3850b14ffb5701ba394578 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Mon, 21 Mar 2016 10:01:30 +0300 Subject: [PATCH 121/243] Separated model classes to client and common packages. --- .../block/model/FaceBakery.java.patch | 18 +- .../model/ItemCameraTransforms.java.patch | 2 +- .../block/model/ItemTransformVec3f.java.patch | 4 +- .../block/model/ModelBakery.java.patch | 10 +- .../model/ModelResourceLocation.java.patch | 14 ++ .../block/model/ModelRotation.java.patch | 4 +- .../renderer/block/model/Variant.java.patch | 2 +- .../net/minecraft/item/Item.java.patch | 6 +- .../client/ForgeHooksClient.java | 4 +- .../client/model/BlockStateLoader.java | 2 + .../client/model/ForgeBlockStateV1.java | 2 + .../minecraftforge/client/model/IModel.java | 1 + .../client/model/IPerspectiveAwareModel.java | 2 + .../client/model/ItemLayerModel.java | 3 + .../model/ItemTextureQuadConverter.java | 3 + .../client/model/MapModelState.java | 4 + .../client/model/ModelDynBucket.java | 3 + .../client/model/ModelFluid.java | 3 + .../client/model/ModelLoader.java | 10 +- .../client/model/ModelLoaderRegistry.java | 16 +- .../client/model/ModelStateComposition.java | 4 + .../client/model/MultiLayerModel.java | 2 + .../client/model/MultiModel.java | 2 + .../client/model/MultiModelState.java | 4 + .../client/model/SimpleModelState.java | 4 + .../client/model/animation/Animation.java | 164 +----------------- .../animation/AnimationItemOverrideList.java | 5 +- .../model/animation/AnimationModelBase.java | 5 +- .../client/model/animation/AnimationTESR.java | 5 +- .../model/animation/IAnimatedModel.java | 1 + .../model/animation/ModelBlockAnimation.java | 65 ++++++- .../client/model/b3d/B3DClip.java | 12 +- .../client/model/b3d/B3DLoader.java | 10 +- .../client/model/obj/OBJModel.java | 3 + .../model => common}/animation/Event.java | 2 +- .../animation/IEventHandler.java | 3 +- .../animation/ITimeValue.java | 2 +- .../animation/TimeValues.java | 2 +- .../{client => common}/model/IModelPart.java | 2 +- .../{client => common}/model/IModelState.java | 2 +- .../model/ITransformation.java | 2 +- .../model/TRSRTransformation.java | 20 ++- .../animation/AnimationStateMachine.java | 135 +++++++++++--- .../model/animation/CapabilityAnimation.java | 5 +- .../model/animation/Clips.java | 14 +- .../animation/IAnimationStateMachine.java | 4 +- .../model/animation/IClip.java | 4 +- .../model/animation/IJoint.java | 6 +- .../model/animation/IJointClip.java | 4 +- .../model/animation/JointClips.java | 4 +- .../common/property/Properties.java | 2 +- .../fml/client/FMLClientHandler.java | 4 - src/main/resources/forge.exc | 12 +- .../debug/ModelAnimationDebug.java | 11 +- .../debug/ModelLoaderRegistryDebug.java | 2 +- 55 files changed, 365 insertions(+), 276 deletions(-) create mode 100644 patches/minecraft/net/minecraft/client/renderer/block/model/ModelResourceLocation.java.patch rename src/main/java/net/minecraftforge/{client/model => common}/animation/Event.java (94%) rename src/main/java/net/minecraftforge/{client/model => common}/animation/IEventHandler.java (75%) rename src/main/java/net/minecraftforge/{client/model => common}/animation/ITimeValue.java (87%) rename src/main/java/net/minecraftforge/{client/model => common}/animation/TimeValues.java (99%) rename src/main/java/net/minecraftforge/{client => common}/model/IModelPart.java (85%) rename src/main/java/net/minecraftforge/{client => common}/model/IModelState.java (92%) rename src/main/java/net/minecraftforge/{client => common}/model/ITransformation.java (90%) rename src/main/java/net/minecraftforge/{client => common}/model/TRSRTransformation.java (97%) rename src/main/java/net/minecraftforge/{client => common}/model/animation/AnimationStateMachine.java (54%) rename src/main/java/net/minecraftforge/{client => common}/model/animation/CapabilityAnimation.java (91%) rename src/main/java/net/minecraftforge/{client => common}/model/animation/Clips.java (97%) rename src/main/java/net/minecraftforge/{client => common}/model/animation/IClip.java (61%) rename src/main/java/net/minecraftforge/{client => common}/model/animation/IJoint.java (60%) rename src/main/java/net/minecraftforge/{client => common}/model/animation/IJointClip.java (58%) rename src/main/java/net/minecraftforge/{client => common}/model/animation/JointClips.java (86%) diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch index a45204c7eb..3d8f0f3597 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -4,17 +4,17 @@ public BakedQuad func_178414_a(Vector3f p_178414_1_, Vector3f p_178414_2_, BlockPartFace p_178414_3_, TextureAtlasSprite p_178414_4_, EnumFacing p_178414_5_, ModelRotation p_178414_6_, BlockPartRotation p_178414_7_, boolean p_178414_8_, boolean p_178414_9_) { -+ return makeBakedQuad(p_178414_1_, p_178414_2_, p_178414_3_, p_178414_4_, p_178414_5_, (net.minecraftforge.client.model.ITransformation)p_178414_6_, p_178414_7_, p_178414_8_, p_178414_9_); ++ return makeBakedQuad(p_178414_1_, p_178414_2_, p_178414_3_, p_178414_4_, p_178414_5_, (net.minecraftforge.common.model.ITransformation)p_178414_6_, p_178414_7_, p_178414_8_, p_178414_9_); + } + -+ public BakedQuad makeBakedQuad(Vector3f p_178414_1_, Vector3f p_178414_2_, BlockPartFace p_178414_3_, TextureAtlasSprite p_178414_4_, EnumFacing p_178414_5_, net.minecraftforge.client.model.ITransformation p_178414_6_, BlockPartRotation p_178414_7_, boolean p_178414_8_, boolean p_178414_9_) ++ public BakedQuad makeBakedQuad(Vector3f p_178414_1_, Vector3f p_178414_2_, BlockPartFace p_178414_3_, TextureAtlasSprite p_178414_4_, EnumFacing p_178414_5_, net.minecraftforge.common.model.ITransformation p_178414_6_, BlockPartRotation p_178414_7_, boolean p_178414_8_, boolean p_178414_9_) + { BlockFaceUV blockfaceuv = p_178414_3_.field_178243_e; if (p_178414_8_) { - blockfaceuv = this.func_188010_a(p_178414_3_.field_178243_e, p_178414_5_, p_178414_6_); -+ // TODO fix uvlock for custom rotations ++ // TODO fix uvlock for custom rotations + //blockfaceuv = this.applyUVLock(face.blockFaceUV, facing, modelRotationIn); } @@ -37,10 +37,10 @@ private int[] func_188012_a(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, ModelRotation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) { -+ return makeQuadVertexData(p_188012_1_, p_188012_2_, p_188012_3_, p_188012_4_, (net.minecraftforge.client.model.ITransformation)p_188012_5_, p_188012_6_, p_188012_7_); ++ return makeQuadVertexData(p_188012_1_, p_188012_2_, p_188012_3_, p_188012_4_, (net.minecraftforge.common.model.ITransformation)p_188012_5_, p_188012_6_, p_188012_7_); + } + -+ private int[] makeQuadVertexData(BlockFaceUV uvs, TextureAtlasSprite sprite, EnumFacing orientation, float[] p_188012_4_, net.minecraftforge.client.model.ITransformation rotationIn, BlockPartRotation partRotation, boolean shade) ++ private int[] makeQuadVertexData(BlockFaceUV uvs, TextureAtlasSprite sprite, EnumFacing orientation, float[] p_188012_4_, net.minecraftforge.common.model.ITransformation rotationIn, BlockPartRotation partRotation, boolean shade) + { int[] aint = new int[28]; @@ -56,10 +56,10 @@ private void func_188015_a(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, ModelRotation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_) { - EnumFacing enumfacing = p_188015_7_.func_177523_a(p_188015_3_); -+ fillVertexData(p_188015_1_, p_188015_2_, p_188015_3_, p_188015_4_, p_188015_5_, p_188015_6_, (net.minecraftforge.client.model.ITransformation)p_188015_7_, p_188015_8_, p_188015_9_); ++ fillVertexData(p_188015_1_, p_188015_2_, p_188015_3_, p_188015_4_, p_188015_5_, p_188015_6_, (net.minecraftforge.common.model.ITransformation)p_188015_7_, p_188015_8_, p_188015_9_); + } + -+ private void fillVertexData(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, net.minecraftforge.client.model.ITransformation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_) ++ private void fillVertexData(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, net.minecraftforge.common.model.ITransformation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_) + { + EnumFacing enumfacing = p_188015_7_.rotate(p_188015_3_); int i = p_188015_9_ ? this.func_178413_a(enumfacing) : -1; @@ -75,10 +75,10 @@ public int func_188011_a(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, ModelRotation p_188011_4_) { -+ return rotateVertex(p_188011_1_, p_188011_2_, p_188011_3_, (net.minecraftforge.client.model.ITransformation)p_188011_4_); ++ return rotateVertex(p_188011_1_, p_188011_2_, p_188011_3_, (net.minecraftforge.common.model.ITransformation)p_188011_4_); + } + -+ public int rotateVertex(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, net.minecraftforge.client.model.ITransformation p_188011_4_) ++ public int rotateVertex(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, net.minecraftforge.common.model.ITransformation p_188011_4_) + { if (p_188011_4_ == ModelRotation.X0_Y0) { diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch index 91ecaba4df..74a4f9c042 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch @@ -39,7 +39,7 @@ @SideOnly(Side.CLIENT) - public static enum TransformType -+ public static enum TransformType implements net.minecraftforge.client.model.IModelPart ++ public static enum TransformType implements net.minecraftforge.common.model.IModelPart { NONE, THIRD_PERSON_LEFT_HAND, diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch index 22f1377820..9dde502f97 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch @@ -10,9 +10,9 @@ @SideOnly(Side.CLIENT) -public class ItemTransformVec3f +@Deprecated -+public class ItemTransformVec3f implements net.minecraftforge.client.model.IModelState ++public class ItemTransformVec3f implements net.minecraftforge.common.model.IModelState { -+ public com.google.common.base.Optional apply(com.google.common.base.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(this, part); } ++ public com.google.common.base.Optional apply(com.google.common.base.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(this, part); } public static final ItemTransformVec3f field_178366_a = new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F)); public final Vector3f field_178364_b; public final Vector3f field_178365_c; diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch index 4f6cd2e15e..b7ac03ea1f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch @@ -97,10 +97,10 @@ private IBakedModel func_177578_a(ModelBlock p_177578_1_, ModelRotation p_177578_2_, boolean p_177578_3_) { -+ return bakeModel(p_177578_1_, (net.minecraftforge.client.model.ITransformation)p_177578_2_, p_177578_3_); ++ return bakeModel(p_177578_1_, (net.minecraftforge.common.model.ITransformation)p_177578_2_, p_177578_3_); + } + -+ protected IBakedModel bakeModel(ModelBlock p_177578_1_, net.minecraftforge.client.model.ITransformation p_177578_2_, boolean p_177578_3_) ++ protected IBakedModel bakeModel(ModelBlock p_177578_1_, net.minecraftforge.common.model.ITransformation p_177578_2_, boolean p_177578_3_) + { TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c("particle"))); SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(p_177578_1_, p_177578_1_.func_187967_g())).func_177646_a(textureatlassprite); @@ -110,7 +110,7 @@ TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c(blockpartface.field_178242_d))); - if (blockpartface.field_178244_b == null) -+ if (blockpartface.field_178244_b == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(p_177578_2_.getMatrix())) ++ if (blockpartface.field_178244_b == null || !net.minecraftforge.common.model.TRSRTransformation.isInteger(p_177578_2_.getMatrix())) { - simplebakedmodel$builder.func_177648_a(this.func_177589_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); + simplebakedmodel$builder.func_177648_a(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); @@ -127,10 +127,10 @@ private BakedQuad func_177589_a(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) { - return this.field_177607_l.func_178414_a(p_177589_1_.field_178241_a, p_177589_1_.field_178239_b, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.field_178237_d, p_177589_6_, p_177589_1_.field_178238_e); -+ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation)p_177589_5_, p_177589_6_); ++ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.common.model.ITransformation)p_177589_5_, p_177589_6_); } -+ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) ++ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.common.model.ITransformation p_177589_5_, boolean p_177589_6_) + { + return this.field_177607_l.makeBakedQuad(p_177589_1_.field_178241_a, p_177589_1_.field_178239_b, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.field_178237_d, p_177589_6_, p_177589_1_.field_178238_e); + } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelResourceLocation.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelResourceLocation.java.patch new file mode 100644 index 0000000000..b9461784b3 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelResourceLocation.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelResourceLocation.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelResourceLocation.java +@@ -1,11 +1,8 @@ + package net.minecraft.client.renderer.block.model; + + import net.minecraft.util.ResourceLocation; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.StringUtils; + +-@SideOnly(Side.CLIENT) + public class ModelResourceLocation extends ResourceLocation + { + private final String field_177519_c; diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch index 39044dd39d..af4bc66637 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch @@ -5,7 +5,7 @@ @SideOnly(Side.CLIENT) -public enum ModelRotation -+public enum ModelRotation implements net.minecraftforge.client.model.IModelState, net.minecraftforge.client.model.ITransformation ++public enum ModelRotation implements net.minecraftforge.common.model.IModelState, net.minecraftforge.common.model.ITransformation { X0_Y0(0, 0), X0_Y90(0, 90), @@ -14,7 +14,7 @@ } } + -+ public com.google.common.base.Optional apply(com.google.common.base.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(getMatrix(), part); } ++ public com.google.common.base.Optional apply(com.google.common.base.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(getMatrix(), part); } + public javax.vecmath.Matrix4f getMatrix() { return net.minecraftforge.client.ForgeHooksClient.getMatrix(this); } + public EnumFacing rotate(EnumFacing facing) { return func_177523_a(facing); } + public int rotate(EnumFacing facing, int vertexIndex) { return func_177520_a(facing, vertexIndex); } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch index 51f084a945..2a57fbefe1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch @@ -10,7 +10,7 @@ return this.field_188051_b; } -+ public net.minecraftforge.client.model.IModelState getState() ++ public net.minecraftforge.common.model.IModelState getState() + { + return this.field_188051_b; + } diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 23d952ef4e..d0a84e64b9 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -642,13 +642,13 @@ + return null; + } + -+ public com.google.common.collect.ImmutableMap getAnimationParameters(final ItemStack stack, final World world, final EntityLivingBase entity) ++ public com.google.common.collect.ImmutableMap getAnimationParameters(final ItemStack stack, final World world, final EntityLivingBase entity) + { -+ com.google.common.collect.ImmutableMap.Builder builder = com.google.common.collect.ImmutableMap.builder(); ++ com.google.common.collect.ImmutableMap.Builder builder = com.google.common.collect.ImmutableMap.builder(); + for(ResourceLocation location : field_185051_m.func_148742_b()) + { + final IItemPropertyGetter parameter = field_185051_m.func_82594_a(location); -+ builder.put(location.toString(), new net.minecraftforge.client.model.animation.ITimeValue() ++ builder.put(location.toString(), new net.minecraftforge.common.animation.ITimeValue() + { + public float apply(float input) + { diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 111dad6c41..80f7942bd9 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -70,13 +70,13 @@ import net.minecraftforge.client.event.RenderHandEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent; -import net.minecraftforge.client.model.IModelPart; import net.minecraftforge.client.model.IPerspectiveAwareModel; import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.common.ForgeModContainer; import net.minecraftforge.common.ForgeVersion; import net.minecraftforge.common.ForgeVersion.Status; +import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.client.registry.ClientRegistry; diff --git a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java index 89141ec737..8497735ce8 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java +++ b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java @@ -14,6 +14,8 @@ 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.ResourceLocation; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.fml.common.FMLLog; import org.apache.commons.io.Charsets; diff --git a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java index e178bc33aa..93433bb023 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java @@ -22,6 +22,8 @@ import net.minecraft.util.JsonUtils; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.BlockStateLoader.Marker; import net.minecraftforge.client.model.BlockStateLoader.SubModel; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.fml.common.FMLLog; import com.google.common.base.Optional; diff --git a/src/main/java/net/minecraftforge/client/model/IModel.java b/src/main/java/net/minecraftforge/client/model/IModel.java index 884b2f27ef..9cb33f277a 100644 --- a/src/main/java/net/minecraftforge/client/model/IModel.java +++ b/src/main/java/net/minecraftforge/client/model/IModel.java @@ -6,6 +6,7 @@ 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.common.model.IModelState; import com.google.common.base.Function; diff --git a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java index 4d3f155cea..2c529f9b86 100644 --- a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java +++ b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java @@ -12,6 +12,8 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformT import net.minecraft.client.renderer.block.model.ItemOverrideList; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.EnumFacing; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; import org.apache.commons.lang3.tuple.Pair; diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index ca7b14f662..a1f9bce91c 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -23,6 +23,9 @@ import net.minecraft.client.resources.IResourceManager; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; +import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; import com.google.common.base.Function; import com.google.common.base.Optional; diff --git a/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java b/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java index 14746db939..d95f7958ef 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java +++ b/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java @@ -1,12 +1,15 @@ package net.minecraftforge.client.model; import com.google.common.collect.Lists; + 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.UnpackedBakedQuad; +import net.minecraftforge.common.model.TRSRTransformation; import javax.vecmath.Vector4f; + import java.util.List; public final class ItemTextureQuadConverter diff --git a/src/main/java/net/minecraftforge/client/model/MapModelState.java b/src/main/java/net/minecraftforge/client/model/MapModelState.java index 2f1469f3c9..831404ebc1 100644 --- a/src/main/java/net/minecraftforge/client/model/MapModelState.java +++ b/src/main/java/net/minecraftforge/client/model/MapModelState.java @@ -2,6 +2,10 @@ package net.minecraftforge.client.model; import java.util.Map; +import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; + import com.google.common.base.Objects; import com.google.common.base.Optional; import com.google.common.collect.ImmutableMap; diff --git a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java index 31f28744a1..5e035d7947 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java +++ b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java @@ -24,6 +24,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index 50f3774b69..5faa872584 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -23,6 +23,9 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import net.minecraftforge.client.model.pipeline.LightUtil; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; +import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.fluids.BlockFluidBase; import net.minecraftforge.fluids.Fluid; diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 395913f585..3b4a706ef3 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -57,12 +57,14 @@ import net.minecraft.launchwrapper.Launch; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.registry.IRegistry; -import net.minecraftforge.client.model.animation.Animation; import net.minecraftforge.client.model.animation.AnimationItemOverrideList; import net.minecraftforge.client.model.animation.IAnimatedModel; -import net.minecraftforge.client.model.animation.IClip; import net.minecraftforge.client.model.animation.ModelBlockAnimation; import net.minecraftforge.common.ForgeModContainer; +import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; +import net.minecraftforge.common.model.animation.IClip; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.Properties; import net.minecraftforge.fluids.Fluid; @@ -110,7 +112,7 @@ public final class ModelLoader extends ModelBakery super(manager, map, shapes); VanillaLoader.instance.setLoader(this); VariantLoader.instance.setLoader(this); - ModelLoaderRegistry.clearModelCache(); + ModelLoaderRegistry.clearModelCache(manager); } @Override @@ -811,7 +813,7 @@ public final class ModelLoader extends ModelBakery modelPath = modelPath.substring("models/".length()); } ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getResourceDomain(), "armatures/" + modelPath + ".json"); - ModelBlockAnimation animation = Animation.INSTANCE.loadVanillaAnimation(armatureLocation); + ModelBlockAnimation animation = ModelBlockAnimation.loadVanillaAnimation(loader.resourceManager, armatureLocation); ModelBlock model = loader.loadModel(modelLocation); return loader.new VanillaModelWrapper(modelLocation, model, false, animation); } diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index 93b4c39fb1..4d0e6e33aa 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -7,16 +7,19 @@ import java.util.Set; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.resources.IReloadableResourceManager; +import net.minecraft.client.resources.IResourceManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader.VanillaLoader; import net.minecraftforge.client.model.ModelLoader.VariantLoader; import net.minecraftforge.client.model.b3d.B3DLoader; import net.minecraftforge.client.model.obj.OBJLoader; +import net.minecraftforge.common.animation.ITimeValue; +import net.minecraftforge.common.model.animation.AnimationStateMachine; +import net.minecraftforge.common.model.animation.IAnimationStateMachine; import net.minecraftforge.fml.common.FMLLog; -import org.apache.logging.log4j.Level; - import com.google.common.base.Joiner; +import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import com.google.common.collect.Queues; import com.google.common.collect.Sets; @@ -30,6 +33,7 @@ public class ModelLoaderRegistry private static final Map cache = Maps.newHashMap(); private static final Deque loadingModels = Queues.newArrayDeque(); private static final Set textures = Sets.newHashSet(); + private static IResourceManager manager; // Forge built-in loaders static @@ -191,8 +195,9 @@ public class ModelLoaderRegistry return ModelLoader.VanillaLoader.instance.getLoader().getMissingModel(); } - public static void clearModelCache() + public static void clearModelCache(IResourceManager manager) { + ModelLoaderRegistry.manager = manager; cache.clear(); // putting the builtin models in cache.put(new ResourceLocation("minecraft:builtin/generated"), ItemLayerModel.instance); @@ -219,4 +224,9 @@ public class ModelLoaderRegistry private static final long serialVersionUID = 1L; } + + public static IAnimationStateMachine loadASM(ResourceLocation location, ImmutableMap customParameters) + { + return AnimationStateMachine.load(manager, location, customParameters); + } } diff --git a/src/main/java/net/minecraftforge/client/model/ModelStateComposition.java b/src/main/java/net/minecraftforge/client/model/ModelStateComposition.java index 231b47b0ed..07eed52826 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelStateComposition.java +++ b/src/main/java/net/minecraftforge/client/model/ModelStateComposition.java @@ -1,5 +1,9 @@ package net.minecraftforge.client.model; +import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; + import com.google.common.base.Optional; public class ModelStateComposition implements IModelState diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index 347884188c..d82f5fb892 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -19,6 +19,8 @@ import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.MinecraftForgeClient; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.fml.common.FMLLog; import org.apache.commons.lang3.tuple.Pair; diff --git a/src/main/java/net/minecraftforge/client/model/MultiModel.java b/src/main/java/net/minecraftforge/client/model/MultiModel.java index 7db688ee40..e32a9456c6 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiModel.java @@ -23,6 +23,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.fml.common.FMLLog; import org.apache.commons.lang3.tuple.Pair; diff --git a/src/main/java/net/minecraftforge/client/model/MultiModelState.java b/src/main/java/net/minecraftforge/client/model/MultiModelState.java index 6b06fcc76c..c3a5c8cfb4 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiModelState.java +++ b/src/main/java/net/minecraftforge/client/model/MultiModelState.java @@ -1,5 +1,9 @@ package net.minecraftforge.client.model; +import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; + import org.apache.commons.lang3.tuple.Pair; import com.google.common.base.Objects; diff --git a/src/main/java/net/minecraftforge/client/model/SimpleModelState.java b/src/main/java/net/minecraftforge/client/model/SimpleModelState.java index 5c2e384399..2f52a660ea 100644 --- a/src/main/java/net/minecraftforge/client/model/SimpleModelState.java +++ b/src/main/java/net/minecraftforge/client/model/SimpleModelState.java @@ -1,5 +1,9 @@ package net.minecraftforge.client.model; +import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; + import com.google.common.base.Optional; import com.google.common.collect.ImmutableMap; diff --git a/src/main/java/net/minecraftforge/client/model/animation/Animation.java b/src/main/java/net/minecraftforge/client/model/animation/Animation.java index e25786c528..953bbafae3 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/Animation.java +++ b/src/main/java/net/minecraftforge/client/model/animation/Animation.java @@ -1,28 +1,8 @@ package net.minecraftforge.client.model.animation; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStreamReader; - -import net.minecraft.client.resources.IResource; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.IResourceManagerReloadListener; -import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; -import net.minecraftforge.common.model.animation.IAnimationStateMachine; -import net.minecraftforge.common.util.JsonUtils; -import net.minecraftforge.fml.common.FMLLog; -import org.apache.logging.log4j.Level; - -import com.google.common.base.Function; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonParseException; - -public enum Animation implements IResourceManagerReloadListener +public enum Animation { INSTANCE; @@ -52,152 +32,10 @@ public enum Animation implements IResourceManagerReloadListener return INSTANCE.clientPartialTickTime; } - /** - * Load a new instance if AnimationStateMachine at specified location, with specified custom parameters. - */ - public IAnimationStateMachine load(ResourceLocation location, ImmutableMap customParameters) - { - try - { - ClipResolver clipResolver = new ClipResolver(); - ParameterResolver parameterResolver = new ParameterResolver(customParameters); - Clips.CommonClipTypeAdapterFactory.INSTANCE.setClipResolver(clipResolver); - TimeValues.CommonTimeValueTypeAdapterFactory.INSTANCE.setValueResolver(parameterResolver); - IResource resource = manager.getResource(location); - AnimationStateMachine asm = asmGson.fromJson(new InputStreamReader(resource.getInputStream(), "UTF-8"), AnimationStateMachine.class); - clipResolver.asm = asm; - parameterResolver.asm = asm; - asm.initialize(); - //String json = asmGson.toJson(asm); - //System.out.println(location + ": " + json); - return asm; - } - catch(IOException e) - { - FMLLog.log(Level.ERROR, e, "Exception loading Animation State Machine %s, skipping", location); - return missing; - } - catch(JsonParseException e) - { - FMLLog.log(Level.ERROR, e, "Exception loading Animation State Machine %s, skipping", location); - return missing; - } - finally - { - Clips.CommonClipTypeAdapterFactory.INSTANCE.setClipResolver(null); - TimeValues.CommonTimeValueTypeAdapterFactory.INSTANCE.setValueResolver(null); - } - } - - /** - * Load armature associated with a vanilla model. - */ - public ModelBlockAnimation loadVanillaAnimation(ResourceLocation armatureLocation) - { - try - { - IResource resource = null; - try - { - resource = manager.getResource(armatureLocation); - } - catch(FileNotFoundException e) - { - // this is normal. FIXME: error reporting? - return defaultModelBlockAnimation; - } - ModelBlockAnimation mba = mbaGson.fromJson(new InputStreamReader(resource.getInputStream(), "UTF-8"), ModelBlockAnimation.class); - //String json = mbaGson.toJson(mba); - return mba; - } - catch(IOException e) - { - FMLLog.log(Level.ERROR, e, "Exception loading vanilla model aniamtion %s, skipping", armatureLocation); - return defaultModelBlockAnimation; - } - catch(JsonParseException e) - { - FMLLog.log(Level.ERROR, e, "Exception loading vanilla model aniamtion %s, skipping", armatureLocation); - return defaultModelBlockAnimation; - } - } - - private IResourceManager manager; - - protected final AnimationStateMachine missing = new AnimationStateMachine( - ImmutableMap.of(), - ImmutableMap.of("missingno", (IClip)Clips.IdentityClip.instance), - ImmutableList.of("missingno"), - ImmutableMap.of(), - "missingno"); - - { - missing.initialize(); - } - - private final Gson asmGson = new GsonBuilder() - .registerTypeAdapter(ImmutableList.class, JsonUtils.ImmutableListTypeAdapter.INSTANCE) - .registerTypeAdapter(ImmutableMap.class, JsonUtils.ImmutableMapTypeAdapter.INSTANCE) - .registerTypeAdapterFactory(Clips.CommonClipTypeAdapterFactory.INSTANCE) - //.registerTypeAdapterFactory(ClipProviders.CommonClipProviderTypeAdapterFactory.INSTANCE) - .registerTypeAdapterFactory(TimeValues.CommonTimeValueTypeAdapterFactory.INSTANCE) - .setPrettyPrinting() - .enableComplexMapKeySerialization() - .disableHtmlEscaping() - .create(); - - private static final class ClipResolver implements Function - { - private AnimationStateMachine asm; - - public IClip apply(String name) - { - return asm.getClips().get(name); - } - } - - private static final class ParameterResolver implements Function - { - private final ImmutableMap customParameters; - private AnimationStateMachine asm; - - public ParameterResolver(ImmutableMap customParameters) - { - this.customParameters = customParameters; - } - - public ITimeValue apply(String name) - { - if(asm.getParameters().containsKey(name)) - { - return asm.getParameters().get(name); - } - return customParameters.get(name); - } - } - - private final Gson mbaGson = new GsonBuilder() - .registerTypeAdapter(ImmutableList.class, JsonUtils.ImmutableListTypeAdapter.INSTANCE) - .registerTypeAdapter(ImmutableMap.class, JsonUtils.ImmutableMapTypeAdapter.INSTANCE) - .setPrettyPrinting() - .enableComplexMapKeySerialization() - .disableHtmlEscaping() - .create(); - - private final ModelBlockAnimation defaultModelBlockAnimation = new ModelBlockAnimation(ImmutableMap.>of(), ImmutableMap.of()); - /** * Iternal hook, do not use. */ public static void setClientPartialTickTime(float clientPartialTickTime) { Animation.INSTANCE.clientPartialTickTime = clientPartialTickTime; } - - /** - * Iternal hook, do not use. - */ - public void onResourceManagerReload(IResourceManager manager) - { - this.manager = manager; - } } diff --git a/src/main/java/net/minecraftforge/client/model/animation/AnimationItemOverrideList.java b/src/main/java/net/minecraftforge/client/model/animation/AnimationItemOverrideList.java index 9fe76315fe..e281dd2b43 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/AnimationItemOverrideList.java +++ b/src/main/java/net/minecraftforge/client/model/animation/AnimationItemOverrideList.java @@ -13,8 +13,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.model.IModel; -import net.minecraftforge.client.model.IModelState; import net.minecraftforge.client.model.ModelStateComposition; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.animation.CapabilityAnimation; import net.minecraftforge.common.model.animation.IAnimationStateMachine; import com.google.common.base.Function; @@ -43,7 +44,7 @@ public final class AnimationItemOverrideList extends ItemOverrideList @Override public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) { - if(stack.hasCapability(net.minecraftforge.client.model.animation.CapabilityAnimation.ANIMATION_CAPABILITY, null)) + if(stack.hasCapability(net.minecraftforge.common.model.animation.CapabilityAnimation.ANIMATION_CAPABILITY, null)) { // TODO: caching? IAnimationStateMachine asm = stack.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null); diff --git a/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java b/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java index 3273967920..d36f03ca00 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java +++ b/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java @@ -16,11 +16,14 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.IModel; -import net.minecraftforge.client.model.IModelState; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.client.model.pipeline.VertexLighterFlat; import net.minecraftforge.client.model.pipeline.VertexBufferConsumer; +import net.minecraftforge.common.animation.Event; +import net.minecraftforge.common.animation.IEventHandler; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.animation.CapabilityAnimation; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java b/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java index db81f323d7..c1e2f0e91c 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java +++ b/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java @@ -9,7 +9,10 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.client.MinecraftForgeClient; -import net.minecraftforge.client.model.IModelState; +import net.minecraftforge.common.animation.Event; +import net.minecraftforge.common.animation.IEventHandler; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.animation.CapabilityAnimation; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.Properties; diff --git a/src/main/java/net/minecraftforge/client/model/animation/IAnimatedModel.java b/src/main/java/net/minecraftforge/client/model/animation/IAnimatedModel.java index e4d6df8ee0..a841ed12b8 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/IAnimatedModel.java +++ b/src/main/java/net/minecraftforge/client/model/animation/IAnimatedModel.java @@ -1,6 +1,7 @@ package net.minecraftforge.client.model.animation; import net.minecraftforge.client.model.IModel; +import net.minecraftforge.common.model.animation.IClip; import com.google.common.base.Optional; diff --git a/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java b/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java index 2e5598975c..792d83eaa4 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java +++ b/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java @@ -1,5 +1,8 @@ package net.minecraftforge.client.model.animation; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; import java.util.Collections; import java.util.EnumSet; import java.util.Iterator; @@ -12,13 +15,25 @@ import javax.vecmath.Matrix4f; import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; +import org.apache.logging.log4j.Level; + import net.minecraft.client.renderer.block.model.BlockPart; +import net.minecraft.client.resources.IResource; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; -import net.minecraftforge.client.model.IModelState; -import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.client.model.animation.ModelBlockAnimation.Parameter.Interpolation; import net.minecraftforge.client.model.animation.ModelBlockAnimation.Parameter.Type; import net.minecraftforge.client.model.animation.ModelBlockAnimation.Parameter.Variable; +import net.minecraftforge.common.animation.Event; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; +import net.minecraftforge.common.model.animation.IClip; +import net.minecraftforge.common.model.animation.IJoint; +import net.minecraftforge.common.model.animation.IJointClip; +import net.minecraftforge.common.model.animation.JointClips; +import net.minecraftforge.common.util.JsonUtils; +import net.minecraftforge.fml.common.FMLLog; import com.google.common.base.Optional; import com.google.common.collect.ImmutableCollection; @@ -28,6 +43,9 @@ import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.google.common.collect.UnmodifiableIterator; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; import com.google.gson.annotations.SerializedName; public class ModelBlockAnimation @@ -509,4 +527,47 @@ public class ModelBlockAnimation } return null; } + + /** + * Load armature associated with a vanilla model. + */ + public static ModelBlockAnimation loadVanillaAnimation(IResourceManager manager, ResourceLocation armatureLocation) + { + try + { + IResource resource = null; + try + { + resource = manager.getResource(armatureLocation); + } + catch(FileNotFoundException e) + { + // this is normal. FIXME: error reporting? + return defaultModelBlockAnimation; + } + ModelBlockAnimation mba = mbaGson.fromJson(new InputStreamReader(resource.getInputStream(), "UTF-8"), ModelBlockAnimation.class); + //String json = mbaGson.toJson(mba); + return mba; + } + catch(IOException e) + { + FMLLog.log(Level.ERROR, e, "Exception loading vanilla model aniamtion %s, skipping", armatureLocation); + return defaultModelBlockAnimation; + } + catch(JsonParseException e) + { + FMLLog.log(Level.ERROR, e, "Exception loading vanilla model aniamtion %s, skipping", armatureLocation); + return defaultModelBlockAnimation; + } + } + + private static final Gson mbaGson = new GsonBuilder() + .registerTypeAdapter(ImmutableList.class, JsonUtils.ImmutableListTypeAdapter.INSTANCE) + .registerTypeAdapter(ImmutableMap.class, JsonUtils.ImmutableMapTypeAdapter.INSTANCE) + .setPrettyPrinting() + .enableComplexMapKeySerialization() + .disableHtmlEscaping() + .create(); + + private static final ModelBlockAnimation defaultModelBlockAnimation = new ModelBlockAnimation(ImmutableMap.>of(), ImmutableMap.of()); } diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java index 91df31ae1e..dc667ee0ad 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java @@ -1,14 +1,14 @@ package net.minecraftforge.client.model.b3d; -import net.minecraftforge.client.model.TRSRTransformation; -import net.minecraftforge.client.model.animation.Event; -import net.minecraftforge.client.model.animation.IClip; -import net.minecraftforge.client.model.animation.IJoint; -import net.minecraftforge.client.model.animation.IJointClip; -import net.minecraftforge.client.model.animation.JointClips; import net.minecraftforge.client.model.b3d.B3DLoader.NodeJoint; import net.minecraftforge.client.model.b3d.B3DModel.Key; import net.minecraftforge.client.model.b3d.B3DModel.Node; +import net.minecraftforge.common.animation.Event; +import net.minecraftforge.common.model.TRSRTransformation; +import net.minecraftforge.common.model.animation.IClip; +import net.minecraftforge.common.model.animation.IJoint; +import net.minecraftforge.common.model.animation.IJointClip; +import net.minecraftforge.common.model.animation.JointClips; import com.google.common.collect.ImmutableSet; diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 9ae3fdc8e3..4eeefef5a0 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -30,18 +30,13 @@ import net.minecraft.util.math.MathHelper; import net.minecraftforge.client.model.ICustomModelLoader; import net.minecraftforge.client.model.IModel; import net.minecraftforge.client.model.IModelCustomData; -import net.minecraftforge.client.model.IModelPart; import net.minecraftforge.client.model.IModelSimpleProperties; -import net.minecraftforge.client.model.IModelState; import net.minecraftforge.client.model.IPerspectiveAwareModel; import net.minecraftforge.client.model.IRetexturableModel; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.client.model.ModelStateComposition; -import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.client.model.animation.IAnimatedModel; -import net.minecraftforge.client.model.animation.IClip; -import net.minecraftforge.client.model.animation.IJoint; import net.minecraftforge.client.model.b3d.B3DModel.Animation; import net.minecraftforge.client.model.b3d.B3DModel.Face; import net.minecraftforge.client.model.b3d.B3DModel.Key; @@ -50,6 +45,11 @@ import net.minecraftforge.client.model.b3d.B3DModel.Node; import net.minecraftforge.client.model.b3d.B3DModel.Texture; import net.minecraftforge.client.model.b3d.B3DModel.Vertex; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; +import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; +import net.minecraftforge.common.model.animation.IClip; +import net.minecraftforge.common.model.animation.IJoint; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; import net.minecraftforge.common.property.Properties; diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index 585441359b..0d6186fed6 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -36,6 +36,9 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.*; import net.minecraftforge.client.model.pipeline.LightUtil; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; +import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; import net.minecraftforge.fml.common.FMLLog; diff --git a/src/main/java/net/minecraftforge/client/model/animation/Event.java b/src/main/java/net/minecraftforge/common/animation/Event.java similarity index 94% rename from src/main/java/net/minecraftforge/client/model/animation/Event.java rename to src/main/java/net/minecraftforge/common/animation/Event.java index 96135d2d3f..aabe3e6300 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/Event.java +++ b/src/main/java/net/minecraftforge/common/animation/Event.java @@ -1,4 +1,4 @@ -package net.minecraftforge.client.model.animation; +package net.minecraftforge.common.animation; import com.google.common.base.Objects; diff --git a/src/main/java/net/minecraftforge/client/model/animation/IEventHandler.java b/src/main/java/net/minecraftforge/common/animation/IEventHandler.java similarity index 75% rename from src/main/java/net/minecraftforge/client/model/animation/IEventHandler.java rename to src/main/java/net/minecraftforge/common/animation/IEventHandler.java index 81c7f38927..1133737384 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/IEventHandler.java +++ b/src/main/java/net/minecraftforge/common/animation/IEventHandler.java @@ -1,4 +1,5 @@ -package net.minecraftforge.client.model.animation; +package net.minecraftforge.common.animation; + /** diff --git a/src/main/java/net/minecraftforge/client/model/animation/ITimeValue.java b/src/main/java/net/minecraftforge/common/animation/ITimeValue.java similarity index 87% rename from src/main/java/net/minecraftforge/client/model/animation/ITimeValue.java rename to src/main/java/net/minecraftforge/common/animation/ITimeValue.java index 88770b1250..dfb7fc8ec1 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/ITimeValue.java +++ b/src/main/java/net/minecraftforge/common/animation/ITimeValue.java @@ -1,4 +1,4 @@ -package net.minecraftforge.client.model.animation; +package net.minecraftforge.common.animation; /** * Time-varying value associated with the animation. diff --git a/src/main/java/net/minecraftforge/client/model/animation/TimeValues.java b/src/main/java/net/minecraftforge/common/animation/TimeValues.java similarity index 99% rename from src/main/java/net/minecraftforge/client/model/animation/TimeValues.java rename to src/main/java/net/minecraftforge/common/animation/TimeValues.java index a612685787..d289cc744b 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/TimeValues.java +++ b/src/main/java/net/minecraftforge/common/animation/TimeValues.java @@ -1,4 +1,4 @@ -package net.minecraftforge.client.model.animation; +package net.minecraftforge.common.animation; import java.io.IOException; import java.util.regex.Pattern; diff --git a/src/main/java/net/minecraftforge/client/model/IModelPart.java b/src/main/java/net/minecraftforge/common/model/IModelPart.java similarity index 85% rename from src/main/java/net/minecraftforge/client/model/IModelPart.java rename to src/main/java/net/minecraftforge/common/model/IModelPart.java index e8fe6bedd9..48fdb4752b 100644 --- a/src/main/java/net/minecraftforge/client/model/IModelPart.java +++ b/src/main/java/net/minecraftforge/common/model/IModelPart.java @@ -1,4 +1,4 @@ -package net.minecraftforge.client.model; +package net.minecraftforge.common.model; /* * Represents the part of the model you can refer to, for example: mesh, diff --git a/src/main/java/net/minecraftforge/client/model/IModelState.java b/src/main/java/net/minecraftforge/common/model/IModelState.java similarity index 92% rename from src/main/java/net/minecraftforge/client/model/IModelState.java rename to src/main/java/net/minecraftforge/common/model/IModelState.java index dff153de36..d53fd234ab 100644 --- a/src/main/java/net/minecraftforge/client/model/IModelState.java +++ b/src/main/java/net/minecraftforge/common/model/IModelState.java @@ -1,4 +1,4 @@ -package net.minecraftforge.client.model; +package net.minecraftforge.common.model; import com.google.common.base.Optional; diff --git a/src/main/java/net/minecraftforge/client/model/ITransformation.java b/src/main/java/net/minecraftforge/common/model/ITransformation.java similarity index 90% rename from src/main/java/net/minecraftforge/client/model/ITransformation.java rename to src/main/java/net/minecraftforge/common/model/ITransformation.java index 36f22b03f0..f57604c89f 100644 --- a/src/main/java/net/minecraftforge/client/model/ITransformation.java +++ b/src/main/java/net/minecraftforge/common/model/ITransformation.java @@ -1,4 +1,4 @@ -package net.minecraftforge.client.model; +package net.minecraftforge.common.model; import javax.vecmath.Matrix4f; diff --git a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java b/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java similarity index 97% rename from src/main/java/net/minecraftforge/client/model/TRSRTransformation.java rename to src/main/java/net/minecraftforge/common/model/TRSRTransformation.java index 368c2adc58..3c84d27aa5 100644 --- a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java +++ b/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java @@ -1,4 +1,4 @@ -package net.minecraftforge.client.model; +package net.minecraftforge.common.model; import javax.vecmath.Matrix3f; import javax.vecmath.Matrix4f; @@ -11,6 +11,8 @@ import javax.vecmath.Vector4f; import net.minecraft.client.renderer.block.model.ModelRotation; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.Vec3i; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Triple; @@ -63,28 +65,33 @@ public final class TRSRTransformation implements IModelState, ITransformation } @Deprecated + @SideOnly(Side.CLIENT) public TRSRTransformation(net.minecraft.client.renderer.block.model.ItemTransformVec3f transform) { this(getMatrix(transform)); } @Deprecated + @SideOnly(Side.CLIENT) public static Matrix4f getMatrix(net.minecraft.client.renderer.block.model.ItemTransformVec3f transform) { TRSRTransformation ret = new TRSRTransformation(toVecmath(transform.translation), quatFromXYZDegrees(toVecmath(transform.rotation)), toVecmath(transform.scale), null); return blockCenterToCorner(ret).getMatrix(); } + @SideOnly(Side.CLIENT) public TRSRTransformation(ModelRotation rotation) { this(rotation.getMatrix()); } - + + @SideOnly(Side.CLIENT) public TRSRTransformation(EnumFacing facing) { this(getMatrix(facing)); } - + + @SideOnly(Side.CLIENT) public static Matrix4f getMatrix(EnumFacing facing) { switch(facing) @@ -491,6 +498,7 @@ public final class TRSRTransformation implements IModelState, ITransformation * Don't use this if you don't need to, conversion is lossy (second rotation component is lost). */ @Deprecated + @SideOnly(Side.CLIENT) public net.minecraft.client.renderer.block.model.ItemTransformVec3f toItemTransform() { return new net.minecraft.client.renderer.block.model.ItemTransformVec3f(toLwjgl(toXYZDegrees(getLeftRot())), toLwjgl(getTranslation()), toLwjgl(getScale())); @@ -636,16 +644,19 @@ public final class TRSRTransformation implements IModelState, ITransformation return true; } + @SideOnly(Side.CLIENT) public static Vector3f toVecmath(org.lwjgl.util.vector.Vector3f vec) { return new Vector3f(vec.x, vec.y, vec.z); } + @SideOnly(Side.CLIENT) public static Vector4f toVecmath(org.lwjgl.util.vector.Vector4f vec) { return new Vector4f(vec.x, vec.y, vec.z, vec.w); } + @SideOnly(Side.CLIENT) public static Matrix4f toVecmath(org.lwjgl.util.vector.Matrix4f m) { return new Matrix4f( @@ -655,16 +666,19 @@ public final class TRSRTransformation implements IModelState, ITransformation m.m03, m.m13, m.m23, m.m33); } + @SideOnly(Side.CLIENT) public static org.lwjgl.util.vector.Vector3f toLwjgl(Vector3f vec) { return new org.lwjgl.util.vector.Vector3f(vec.x, vec.y, vec.z); } + @SideOnly(Side.CLIENT) public static org.lwjgl.util.vector.Vector4f toLwjgl(Vector4f vec) { return new org.lwjgl.util.vector.Vector4f(vec.x, vec.y, vec.z, vec.w); } + @SideOnly(Side.CLIENT) public static org.lwjgl.util.vector.Matrix4f toLwjgl(Matrix4f m) { org.lwjgl.util.vector.Matrix4f r = new org.lwjgl.util.vector.Matrix4f(); diff --git a/src/main/java/net/minecraftforge/client/model/animation/AnimationStateMachine.java b/src/main/java/net/minecraftforge/common/model/animation/AnimationStateMachine.java similarity index 54% rename from src/main/java/net/minecraftforge/client/model/animation/AnimationStateMachine.java rename to src/main/java/net/minecraftforge/common/model/animation/AnimationStateMachine.java index d2a7c8f371..29b8d964dd 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/AnimationStateMachine.java +++ b/src/main/java/net/minecraftforge/common/model/animation/AnimationStateMachine.java @@ -1,13 +1,26 @@ -package net.minecraftforge.client.model.animation; +package net.minecraftforge.common.model.animation; +import java.io.IOException; +import java.io.InputStreamReader; import java.util.concurrent.TimeUnit; -import net.minecraftforge.client.model.IModelState; -import net.minecraftforge.common.model.animation.IAnimationStateMachine; +import net.minecraft.client.resources.IResource; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.animation.Event; +import net.minecraftforge.common.animation.ITimeValue; +import net.minecraftforge.common.animation.TimeValues; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.util.JsonUtils; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Triple; +import org.apache.logging.log4j.Level; +import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; @@ -15,10 +28,12 @@ import com.google.common.cache.LoadingCache; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonParseException; import com.google.gson.annotations.SerializedName; -class AnimationStateMachine implements IAnimationStateMachine +public final class AnimationStateMachine implements IAnimationStateMachine { private final ImmutableMap parameters; private final ImmutableMap clips; @@ -52,22 +67,6 @@ class AnimationStateMachine implements IAnimationStateMachine this.startState = startState; } - /** - * Used during resolution of parameter references. - */ - ImmutableMap getParameters() - { - return parameters; - } - - /** - * Used during resolution of clip references. - */ - ImmutableMap getClips() - { - return clips; - } - /** * post-loading initialization hook. */ @@ -166,4 +165,100 @@ class AnimationStateMachine implements IAnimationStateMachine { shouldHandleSpecialEvents = true; } + + /** + * Load a new instance if AnimationStateMachine at specified location, with specified custom parameters. + */ + @SideOnly(Side.CLIENT) + public static IAnimationStateMachine load(IResourceManager manager, ResourceLocation location, ImmutableMap customParameters) + { + try + { + ClipResolver clipResolver = new ClipResolver(); + ParameterResolver parameterResolver = new ParameterResolver(customParameters); + Clips.CommonClipTypeAdapterFactory.INSTANCE.setClipResolver(clipResolver); + TimeValues.CommonTimeValueTypeAdapterFactory.INSTANCE.setValueResolver(parameterResolver); + IResource resource = manager.getResource(location); + AnimationStateMachine asm = asmGson.fromJson(new InputStreamReader(resource.getInputStream(), "UTF-8"), AnimationStateMachine.class); + clipResolver.asm = asm; + parameterResolver.asm = asm; + asm.initialize(); + //String json = asmGson.toJson(asm); + //System.out.println(location + ": " + json); + return asm; + } + catch(IOException e) + { + FMLLog.log(Level.ERROR, e, "Exception loading Animation State Machine %s, skipping", location); + return missing; + } + catch(JsonParseException e) + { + FMLLog.log(Level.ERROR, e, "Exception loading Animation State Machine %s, skipping", location); + return missing; + } + finally + { + Clips.CommonClipTypeAdapterFactory.INSTANCE.setClipResolver(null); + TimeValues.CommonTimeValueTypeAdapterFactory.INSTANCE.setValueResolver(null); + } + } + + private static final AnimationStateMachine missing = new AnimationStateMachine( + ImmutableMap.of(), + ImmutableMap.of("missingno", (IClip)Clips.IdentityClip.instance), + ImmutableList.of("missingno"), + ImmutableMap.of(), + "missingno"); + + static + { + missing.initialize(); + } + + public static final AnimationStateMachine getMissing() + { + return missing; + } + + private static final class ClipResolver implements Function + { + private AnimationStateMachine asm; + + public IClip apply(String name) + { + return asm.clips.get(name); + } + } + + private static final class ParameterResolver implements Function + { + private final ImmutableMap customParameters; + private AnimationStateMachine asm; + + public ParameterResolver(ImmutableMap customParameters) + { + this.customParameters = customParameters; + } + + public ITimeValue apply(String name) + { + if(asm.parameters.containsKey(name)) + { + return asm.parameters.get(name); + } + return customParameters.get(name); + } + } + + private static final Gson asmGson = new GsonBuilder() + .registerTypeAdapter(ImmutableList.class, JsonUtils.ImmutableListTypeAdapter.INSTANCE) + .registerTypeAdapter(ImmutableMap.class, JsonUtils.ImmutableMapTypeAdapter.INSTANCE) + .registerTypeAdapterFactory(Clips.CommonClipTypeAdapterFactory.INSTANCE) + //.registerTypeAdapterFactory(ClipProviders.CommonClipProviderTypeAdapterFactory.INSTANCE) + .registerTypeAdapterFactory(TimeValues.CommonTimeValueTypeAdapterFactory.INSTANCE) + .setPrettyPrinting() + .enableComplexMapKeySerialization() + .disableHtmlEscaping() + .create(); } diff --git a/src/main/java/net/minecraftforge/client/model/animation/CapabilityAnimation.java b/src/main/java/net/minecraftforge/common/model/animation/CapabilityAnimation.java similarity index 91% rename from src/main/java/net/minecraftforge/client/model/animation/CapabilityAnimation.java rename to src/main/java/net/minecraftforge/common/model/animation/CapabilityAnimation.java index 3181e463d2..093afafb9c 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/CapabilityAnimation.java +++ b/src/main/java/net/minecraftforge/common/model/animation/CapabilityAnimation.java @@ -1,4 +1,4 @@ -package net.minecraftforge.client.model.animation; +package net.minecraftforge.common.model.animation; import java.util.concurrent.Callable; @@ -8,7 +8,6 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.common.model.animation.IAnimationStateMachine; public class CapabilityAnimation { @@ -29,7 +28,7 @@ public class CapabilityAnimation { public IAnimationStateMachine call() throws Exception { - return Animation.INSTANCE.missing; + return AnimationStateMachine.getMissing(); } }); } diff --git a/src/main/java/net/minecraftforge/client/model/animation/Clips.java b/src/main/java/net/minecraftforge/common/model/animation/Clips.java similarity index 97% rename from src/main/java/net/minecraftforge/client/model/animation/Clips.java rename to src/main/java/net/minecraftforge/common/model/animation/Clips.java index 5561e3d187..4fab7d4e12 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/Clips.java +++ b/src/main/java/net/minecraftforge/common/model/animation/Clips.java @@ -1,4 +1,4 @@ -package net.minecraftforge.client.model.animation; +package net.minecraftforge.common.model.animation; import java.io.IOException; @@ -7,11 +7,16 @@ import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.IModel; -import net.minecraftforge.client.model.IModelPart; -import net.minecraftforge.client.model.IModelState; import net.minecraftforge.client.model.ModelLoaderRegistry; -import net.minecraftforge.client.model.TRSRTransformation; +import net.minecraftforge.client.model.animation.IAnimatedModel; +import net.minecraftforge.common.animation.Event; +import net.minecraftforge.common.animation.ITimeValue; +import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.lang3.NotImplementedException; import org.apache.commons.lang3.tuple.Pair; @@ -60,6 +65,7 @@ public final class Clips /** * Retrieves the clip from the model. */ + @SideOnly(Side.CLIENT) public static IClip getModelClipNode(ResourceLocation modelLocation, String clipName) { IModel model = ModelLoaderRegistry.getModelOrMissing(modelLocation); diff --git a/src/main/java/net/minecraftforge/common/model/animation/IAnimationStateMachine.java b/src/main/java/net/minecraftforge/common/model/animation/IAnimationStateMachine.java index 53b640c21d..bb84e244c9 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/IAnimationStateMachine.java +++ b/src/main/java/net/minecraftforge/common/model/animation/IAnimationStateMachine.java @@ -1,7 +1,7 @@ package net.minecraftforge.common.model.animation; -import net.minecraftforge.client.model.IModelState; -import net.minecraftforge.client.model.animation.Event; +import net.minecraftforge.common.animation.Event; +import net.minecraftforge.common.model.IModelState; import org.apache.commons.lang3.tuple.Pair; diff --git a/src/main/java/net/minecraftforge/client/model/animation/IClip.java b/src/main/java/net/minecraftforge/common/model/animation/IClip.java similarity index 61% rename from src/main/java/net/minecraftforge/client/model/animation/IClip.java rename to src/main/java/net/minecraftforge/common/model/animation/IClip.java index 714322a01b..4e0ff222a8 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/IClip.java +++ b/src/main/java/net/minecraftforge/common/model/animation/IClip.java @@ -1,4 +1,6 @@ -package net.minecraftforge.client.model.animation; +package net.minecraftforge.common.model.animation; + +import net.minecraftforge.common.animation.Event; /** diff --git a/src/main/java/net/minecraftforge/client/model/animation/IJoint.java b/src/main/java/net/minecraftforge/common/model/animation/IJoint.java similarity index 60% rename from src/main/java/net/minecraftforge/client/model/animation/IJoint.java rename to src/main/java/net/minecraftforge/common/model/animation/IJoint.java index 288a0cc4e4..4afde21554 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/IJoint.java +++ b/src/main/java/net/minecraftforge/common/model/animation/IJoint.java @@ -1,9 +1,9 @@ -package net.minecraftforge.client.model.animation; +package net.minecraftforge.common.model.animation; import com.google.common.base.Optional; -import net.minecraftforge.client.model.IModelPart; -import net.minecraftforge.client.model.TRSRTransformation; +import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.TRSRTransformation; /** * Model part that's a part of the hierarchical skeleton. diff --git a/src/main/java/net/minecraftforge/client/model/animation/IJointClip.java b/src/main/java/net/minecraftforge/common/model/animation/IJointClip.java similarity index 58% rename from src/main/java/net/minecraftforge/client/model/animation/IJointClip.java rename to src/main/java/net/minecraftforge/common/model/animation/IJointClip.java index 27edea0e5b..09dc177d58 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/IJointClip.java +++ b/src/main/java/net/minecraftforge/common/model/animation/IJointClip.java @@ -1,6 +1,6 @@ -package net.minecraftforge.client.model.animation; +package net.minecraftforge.common.model.animation; -import net.minecraftforge.client.model.TRSRTransformation; +import net.minecraftforge.common.model.TRSRTransformation; /** * Returns Local joint pose; animation clip for specific model part. diff --git a/src/main/java/net/minecraftforge/client/model/animation/JointClips.java b/src/main/java/net/minecraftforge/common/model/animation/JointClips.java similarity index 86% rename from src/main/java/net/minecraftforge/client/model/animation/JointClips.java rename to src/main/java/net/minecraftforge/common/model/animation/JointClips.java index 945c54f466..8e449a4fd5 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/JointClips.java +++ b/src/main/java/net/minecraftforge/common/model/animation/JointClips.java @@ -1,6 +1,6 @@ -package net.minecraftforge.client.model.animation; +package net.minecraftforge.common.model.animation; -import net.minecraftforge.client.model.TRSRTransformation; +import net.minecraftforge.common.model.TRSRTransformation; /** * Various implementations of IJointClip. diff --git a/src/main/java/net/minecraftforge/common/property/Properties.java b/src/main/java/net/minecraftforge/common/property/Properties.java index 243109cc06..1bc1d4f6c2 100644 --- a/src/main/java/net/minecraftforge/common/property/Properties.java +++ b/src/main/java/net/minecraftforge/common/property/Properties.java @@ -2,7 +2,7 @@ package net.minecraftforge.common.property; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; -import net.minecraftforge.client.model.IModelState; +import net.minecraftforge.common.model.IModelState; public class Properties { diff --git a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java index a782e3042a..f1f1200fa0 100644 --- a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java +++ b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java @@ -30,7 +30,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiIngameMenu; -import net.minecraft.client.gui.GuiListWorldSelectionEntry; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiWorldSelection; @@ -70,7 +69,6 @@ import net.minecraft.util.StringUtils; import net.minecraft.world.WorldSettings; import net.minecraft.world.storage.SaveFormatComparator; import net.minecraft.world.storage.SaveFormatOld; -import net.minecraftforge.client.model.animation.Animation; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.DummyModContainer; import net.minecraftforge.fml.common.DuplicateModsFoundException; @@ -202,8 +200,6 @@ public class FMLClientHandler implements IFMLSidedHandler return; } - resourceManager.registerReloadListener(Animation.INSTANCE); - FMLCommonHandler.instance().beginLoading(this); try { diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 01b0f0b6f5..6902fcec98 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -29,12 +29,12 @@ net/minecraft/server/management/ItemInWorldManager.removeBlock(Lnet/minecraft/ut net/minecraft/client/gui/GuiScreen.drawHoveringText(Ljava/util/List;IILnet/minecraft/client/gui/FontRenderer;)V=|p_146283_1_,p_146283_2_,p_146283_3_,font net/minecraft/block/state/BlockState.(Lnet/minecraft/block/Block;[Lnet/minecraft/block/properties/IProperty;Lcom/google/common/collect/ImmutableMap;)V=|p_i45663_1_,p_i45663_2_,unlistedProperties net/minecraft/client/renderer/entity/RenderItem.applyVanillaTransform(Lnet/minecraft/client/renderer/block/model/ItemTransformVec3f;)V=|p_175034_1_ -net/minecraft/client/renderer/block/model/ModelBakery.bakeModel(Lnet/minecraft/client/renderer/block/model/ModelBlock;Lnet/minecraftforge/client/model/ITransformation;Z)Lnet/minecraft/client/renderer/block/model/IBakedModel;=|p_177578_1_,p_177578_2_,p_177578_3_ -net/minecraft/client/renderer/block/model/ModelBakery.makeBakedQuad(Lnet/minecraft/client/renderer/block/model/BlockPart;Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;Lnet/minecraftforge/client/model/ITransformation;Z)Lnet/minecraft/client/renderer/block/model/BakedQuad;=|p_177589_1_,p_177589_2_,p_177589_3_,p_177589_4_,p_177589_5_,p_177589_6_ -net/minecraft/client/renderer/block/model/FaceBakery.makeBakedQuad(Lorg/lwjgl/util/vector/Vector3f;Lorg/lwjgl/util/vector/Vector3f;Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;Lnet/minecraftforge/client/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;ZZ)Lnet/minecraft/client/renderer/block/model/BakedQuad;=|p_178414_1_,p_178414_2_,p_178414_3_,p_178414_4_,p_178414_5_,p_178414_6_,p_178414_7_,p_178414_8_,p_178414_9_ -net/minecraft/client/renderer/block/model/FaceBakery.makeQuadVertexData(Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;[FLnet/minecraftforge/client/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;Z)[I=|p_188012_1_,p_188012_2_,p_188012_3_,p_188012_4_,p_188012_5_,p_188012_6_,p_188012_7_ -net/minecraft/client/renderer/block/model/FaceBakery.fillVertexData([IILnet/minecraft/util/EnumFacing;Lnet/minecraft/client/renderer/block/model/BlockFaceUV;[FLnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraftforge/client/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;Z)V=|p_188015_1_,p_188015_2_,p_188015_3_,p_188015_4_,p_188015_5_,p_188015_6_,p_188015_7_,p_188015_8_,p_188015_9_ -net/minecraft/client/renderer/block/model/FaceBakery.rotateVertex(Lorg/lwjgl/util/vector/Vector3f;Lnet/minecraft/util/EnumFacing;ILnet/minecraftforge/client/model/ITransformation)I=|p_188011_1_,p_188011_2_,p_188011_3_,p_188011_4_ +net/minecraft/client/renderer/block/model/ModelBakery.bakeModel(Lnet/minecraft/client/renderer/block/model/ModelBlock;Lnet/minecraftforge/common/model/ITransformation;Z)Lnet/minecraft/client/renderer/block/model/IBakedModel;=|p_177578_1_,p_177578_2_,p_177578_3_ +net/minecraft/client/renderer/block/model/ModelBakery.makeBakedQuad(Lnet/minecraft/client/renderer/block/model/BlockPart;Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;Lnet/minecraftforge/common/model/ITransformation;Z)Lnet/minecraft/client/renderer/block/model/BakedQuad;=|p_177589_1_,p_177589_2_,p_177589_3_,p_177589_4_,p_177589_5_,p_177589_6_ +net/minecraft/client/renderer/block/model/FaceBakery.makeBakedQuad(Lorg/lwjgl/util/vector/Vector3f;Lorg/lwjgl/util/vector/Vector3f;Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;Lnet/minecraftforge/common/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;ZZ)Lnet/minecraft/client/renderer/block/model/BakedQuad;=|p_178414_1_,p_178414_2_,p_178414_3_,p_178414_4_,p_178414_5_,p_178414_6_,p_178414_7_,p_178414_8_,p_178414_9_ +net/minecraft/client/renderer/block/model/FaceBakery.makeQuadVertexData(Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;[FLnet/minecraftforge/common/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;Z)[I=|p_188012_1_,p_188012_2_,p_188012_3_,p_188012_4_,p_188012_5_,p_188012_6_,p_188012_7_ +net/minecraft/client/renderer/block/model/FaceBakery.fillVertexData([IILnet/minecraft/util/EnumFacing;Lnet/minecraft/client/renderer/block/model/BlockFaceUV;[FLnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraftforge/common/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;Z)V=|p_188015_1_,p_188015_2_,p_188015_3_,p_188015_4_,p_188015_5_,p_188015_6_,p_188015_7_,p_188015_8_,p_188015_9_ +net/minecraft/client/renderer/block/model/FaceBakery.rotateVertex(Lorg/lwjgl/util/vector/Vector3f;Lnet/minecraft/util/EnumFacing;ILnet/minecraftforge/common/model/ITransformation)I=|p_188011_1_,p_188011_2_,p_188011_3_,p_188011_4_ net/minecraft/item/ItemBlock.setTileEntityNBT(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/EntityPlayer;)Z=|p_179224_0_,p_179224_1_,p_179224_2_,player diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index 07c248117d..3cf9a6a768 100644 --- a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -29,16 +29,17 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.client.model.animation.Animation; import net.minecraftforge.client.model.animation.AnimationTESR; -import net.minecraftforge.client.model.animation.CapabilityAnimation; -import net.minecraftforge.client.model.animation.Event; -import net.minecraftforge.client.model.animation.ITimeValue; -import net.minecraftforge.client.model.animation.TimeValues.VariableValue; import net.minecraftforge.client.model.b3d.B3DLoader; import net.minecraftforge.client.model.pipeline.VertexLighterSmoothAo; +import net.minecraftforge.common.animation.Event; +import net.minecraftforge.common.animation.ITimeValue; +import net.minecraftforge.common.animation.TimeValues.VariableValue; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.common.model.animation.CapabilityAnimation; import net.minecraftforge.common.model.animation.IAnimationStateMachine; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; @@ -225,7 +226,7 @@ public class ModelAnimationDebug public IAnimationStateMachine load(ResourceLocation location, ImmutableMap parameters) { - return Animation.INSTANCE.load(location, parameters); + return ModelLoaderRegistry.loadASM(location, parameters); } } diff --git a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java index 68488aa299..94bfd23413 100644 --- a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java @@ -40,11 +40,11 @@ import net.minecraft.world.World; import net.minecraftforge.client.model.IModel; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.ModelLoaderRegistry; -import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.client.model.b3d.B3DLoader; import net.minecraftforge.client.model.obj.OBJLoader; import net.minecraftforge.client.model.obj.OBJModel; import net.minecraftforge.client.model.obj.OBJModel.OBJBakedModel; +import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; From 4b53f0716b3b33a70f51fabe8a0c72cedded2087 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Mon, 21 Mar 2016 10:23:27 +0300 Subject: [PATCH 122/243] instance -> INSTANCE --- .../client/ForgeHooksClient.java | 2 +- .../client/model/ItemLayerModel.java | 6 +- .../client/model/ModelDynBucket.java | 2 +- .../client/model/ModelFluid.java | 10 ++-- .../client/model/ModelLoader.java | 30 +++++----- .../client/model/ModelLoaderRegistry.java | 28 ++++----- .../client/model/MultiLayerModel.java | 8 +-- .../model/animation/ModelBlockAnimation.java | 2 +- .../client/model/b3d/B3DClip.java | 4 +- .../client/model/b3d/B3DLoader.java | 14 ++--- .../client/model/obj/OBJLoader.java | 5 +- .../client/model/obj/OBJModel.java | 8 +-- .../common/animation/TimeValues.java | 4 +- .../animation/AnimationStateMachine.java | 2 +- .../common/model/animation/Clips.java | 8 +-- .../common/model/animation/JointClips.java | 2 +- .../debug/ModelAnimationDebug.java | 2 +- .../debug/ModelLoaderRegistryDebug.java | 57 +++++++++---------- 18 files changed, 95 insertions(+), 99 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 80f7942bd9..de9c86ddef 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -135,7 +135,7 @@ public class ForgeHooksClient public static void onTextureStitchedPre(TextureMap map) { MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Pre(map)); - ModelLoader.White.instance.register(map); + ModelLoader.White.INSTANCE.register(map); } public static void onTextureStitchedPost(TextureMap map) diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index a1f9bce91c..7483baa75f 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -34,7 +34,7 @@ import com.google.common.collect.ImmutableMap; public final class ItemLayerModel implements IRetexturableModel { - public static final ItemLayerModel instance = new ItemLayerModel(ImmutableList.of()); + public static final ItemLayerModel INSTANCE = new ItemLayerModel(ImmutableList.of()); private final ImmutableList textures; private final ItemOverrideList overrides; @@ -400,7 +400,7 @@ public final class ItemLayerModel implements IRetexturableModel public static enum Loader implements ICustomModelLoader { - instance; + INSTANCE; public void onResourceManagerReload(IResourceManager resourceManager) {} @@ -414,7 +414,7 @@ public final class ItemLayerModel implements IRetexturableModel public IModel loadModel(ResourceLocation modelLocation) { - return ItemLayerModel.instance; + return ItemLayerModel.INSTANCE; } } } diff --git a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java index 5e035d7947..90037fc109 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java +++ b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java @@ -205,7 +205,7 @@ public final class ModelDynBucket implements IModel, IModelCustomData, IRetextur public enum LoaderDynBucket implements ICustomModelLoader { - instance; + INSTANCE; @Override public boolean accepts(ResourceLocation modelLocation) diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index 5faa872584..6767265ac8 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -48,8 +48,8 @@ import com.google.gson.JsonParser; public final class ModelFluid implements IModelCustomData { - public static final ModelFluid waterModel = new ModelFluid(FluidRegistry.WATER); - public static final ModelFluid lavaModel = new ModelFluid(FluidRegistry.LAVA); + public static final ModelFluid WATER = new ModelFluid(FluidRegistry.WATER); + public static final ModelFluid LAVA = new ModelFluid(FluidRegistry.LAVA); private final Fluid fluid; public ModelFluid(Fluid fluid) @@ -80,7 +80,7 @@ public final class ModelFluid implements IModelCustomData public static enum FluidLoader implements ICustomModelLoader { - instance; + INSTANCE; public void onResourceManagerReload(IResourceManager resourceManager) {} @@ -94,7 +94,7 @@ public final class ModelFluid implements IModelCustomData public IModel loadModel(ResourceLocation modelLocation) { - return waterModel; + return WATER; } } @@ -393,7 +393,7 @@ public final class ModelFluid implements IModelCustomData if(!FluidRegistry.isFluidRegistered(fluid)) { FMLLog.severe("fluid '%s' not found", fluid); - return waterModel; + return WATER; } return new ModelFluid(FluidRegistry.getFluid(fluid)); } diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 3b4a706ef3..6f0e62bf86 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -110,8 +110,8 @@ public final class ModelLoader extends ModelBakery public ModelLoader(IResourceManager manager, TextureMap map, BlockModelShapes shapes) { super(manager, map, shapes); - VanillaLoader.instance.setLoader(this); - VariantLoader.instance.setLoader(this); + VanillaLoader.INSTANCE.setLoader(this); + VariantLoader.INSTANCE.setLoader(this); ModelLoaderRegistry.clearModelCache(manager); } @@ -139,7 +139,7 @@ public final class ModelLoader extends ModelBakery } }); - IBakedModel missingBaked = missingModel.bake(missingModel.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.instance); + IBakedModel missingBaked = missingModel.bake(missingModel.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.INSTANCE); Map bakedModels = Maps.newHashMap(); HashMultimap models = HashMultimap.create(); Multimaps.invertFrom(Multimaps.forMap(stateModels), models); @@ -155,7 +155,7 @@ public final class ModelLoader extends ModelBakery } else { - bakedModels.put(model, model.bake(model.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.instance)); + bakedModels.put(model, model.bake(model.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.INSTANCE)); } } @@ -771,7 +771,7 @@ public final class ModelLoader extends ModelBakery { try { - missingModel = VanillaLoader.instance.loadModel(new ResourceLocation(MODEL_MISSING.getResourceDomain(), MODEL_MISSING.getResourcePath())); + missingModel = VanillaLoader.INSTANCE.loadModel(new ResourceLocation(MODEL_MISSING.getResourceDomain(), MODEL_MISSING.getResourcePath())); } catch(Exception e) { @@ -783,7 +783,7 @@ public final class ModelLoader extends ModelBakery protected static enum VanillaLoader implements ICustomModelLoader { - instance; + INSTANCE; private ModelLoader loader; @@ -821,7 +821,7 @@ public final class ModelLoader extends ModelBakery @Override public String toString() { - return "VanillaLoader.instance"; + return "VanillaLoader.INSTANCE"; } } @@ -830,12 +830,12 @@ public final class ModelLoader extends ModelBakery */ public static final class White extends TextureAtlasSprite { - public static ResourceLocation loc = new ResourceLocation("white"); - public static White instance = new White(); + public static ResourceLocation LOCATION = new ResourceLocation("white"); + public static White INSTANCE = new White(); private White() { - super(loc.toString()); + super(LOCATION.toString()); } @Override @@ -861,7 +861,7 @@ public final class ModelLoader extends ModelBakery public void register(TextureMap map) { - map.setTextureEntry(White.loc.toString(), White.instance); + map.setTextureEntry(White.LOCATION.toString(), White.INSTANCE); } } @@ -1051,7 +1051,7 @@ public final class ModelLoader extends ModelBakery private static enum DefaultTextureGetter implements Function { - instance; + INSTANCE; public TextureAtlasSprite apply(ResourceLocation location) { @@ -1064,12 +1064,12 @@ public final class ModelLoader extends ModelBakery */ public static Function defaultTextureGetter() { - return DefaultTextureGetter.instance; + return DefaultTextureGetter.INSTANCE; } protected static enum VariantLoader implements ICustomModelLoader { - instance; + INSTANCE; private ModelLoader loader; @@ -1111,7 +1111,7 @@ public final class ModelLoader extends ModelBakery @Override public String toString() { - return "VariantLoader.instance"; + return "VariantLoader.INSTANCE"; } } diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index 4d0e6e33aa..664fb48933 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -38,12 +38,12 @@ public class ModelLoaderRegistry // Forge built-in loaders static { - registerLoader(B3DLoader.instance); - registerLoader(OBJLoader.instance); - registerLoader(ModelFluid.FluidLoader.instance); - registerLoader(ItemLayerModel.Loader.instance); - registerLoader(MultiLayerModel.Loader.instance); - registerLoader(ModelDynBucket.LoaderDynBucket.instance); + registerLoader(B3DLoader.INSTANCE); + registerLoader(OBJLoader.INSTANCE); + registerLoader(ModelFluid.FluidLoader.INSTANCE); + registerLoader(ItemLayerModel.Loader.INSTANCE); + registerLoader(MultiLayerModel.Loader.INSTANCE); + registerLoader(ModelDynBucket.LoaderDynBucket.INSTANCE); } /* @@ -111,13 +111,13 @@ public class ModelLoaderRegistry // no custom loaders found, try vanilla ones if(accepted == null) { - if(VariantLoader.instance.accepts(actual)) + if(VariantLoader.INSTANCE.accepts(actual)) { - accepted = VariantLoader.instance; + accepted = VariantLoader.INSTANCE; } - else if(VanillaLoader.instance.accepts(actual)) + else if(VanillaLoader.INSTANCE.accepts(actual)) { - accepted = VanillaLoader.instance; + accepted = VanillaLoader.INSTANCE; } } @@ -192,7 +192,7 @@ public class ModelLoaderRegistry public static IModel getMissingModel() { - return ModelLoader.VanillaLoader.instance.getLoader().getMissingModel(); + return ModelLoader.VanillaLoader.INSTANCE.getLoader().getMissingModel(); } public static void clearModelCache(IResourceManager manager) @@ -200,9 +200,9 @@ public class ModelLoaderRegistry ModelLoaderRegistry.manager = manager; cache.clear(); // putting the builtin models in - cache.put(new ResourceLocation("minecraft:builtin/generated"), ItemLayerModel.instance); - cache.put(new ResourceLocation("minecraft:block/builtin/generated"), ItemLayerModel.instance); - cache.put(new ResourceLocation("minecraft:item/builtin/generated"), ItemLayerModel.instance); + cache.put(new ResourceLocation("minecraft:builtin/generated"), ItemLayerModel.INSTANCE); + cache.put(new ResourceLocation("minecraft:block/builtin/generated"), ItemLayerModel.INSTANCE); + cache.put(new ResourceLocation("minecraft:item/builtin/generated"), ItemLayerModel.INSTANCE); } static Iterable getTextures() diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index d82f5fb892..80e0d4caf7 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -34,7 +34,7 @@ import com.google.gson.JsonParser; public final class MultiLayerModel implements IModelCustomData { - public static final MultiLayerModel instance = new MultiLayerModel(ImmutableMap., ModelResourceLocation>of()); + public static final MultiLayerModel INSTANCE = new MultiLayerModel(ImmutableMap., ModelResourceLocation>of()); private final ImmutableMap, ModelResourceLocation> models; @@ -102,7 +102,7 @@ public final class MultiLayerModel implements IModelCustomData } } ImmutableMap, ModelResourceLocation> models = builder.build(); - if(models.isEmpty()) return instance; + if(models.isEmpty()) return INSTANCE; return new MultiLayerModel(models); } @@ -223,7 +223,7 @@ public final class MultiLayerModel implements IModelCustomData public static enum Loader implements ICustomModelLoader { - instance; + INSTANCE; public void onResourceManagerReload(IResourceManager resourceManager) {} @@ -237,7 +237,7 @@ public final class MultiLayerModel implements IModelCustomData public IModel loadModel(ResourceLocation modelLocation) { - return MultiLayerModel.instance; + return MultiLayerModel.INSTANCE; } } } diff --git a/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java b/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java index 792d83eaa4..8ecae39062 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java +++ b/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java @@ -170,7 +170,7 @@ public class ModelBlockAnimation MBJointClip clip = jointClips.get(mbJoint.getName()); if(clip != null) return clip; } - return JointClips.IdentityJointClip.instance; + return JointClips.IdentityJointClip.INSTANCE; } @Override diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java index dc667ee0ad..a8b640e5df 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java @@ -15,13 +15,13 @@ import com.google.common.collect.ImmutableSet; // FIXME: is this fast enough? public enum B3DClip implements IClip { - instance; + INSTANCE; public IJointClip apply(final IJoint joint) { if(!(joint instanceof NodeJoint)) { - return JointClips.IdentityJointClip.instance; + return JointClips.IdentityJointClip.INSTANCE; } return new NodeClip(((NodeJoint)joint).getNode()); } diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 4eeefef5a0..bd499275d7 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -77,9 +77,9 @@ import com.google.gson.JsonParser; * To enable for your mod call instance.addDomain(modid). * If you need more control over accepted resources - extend the class, and register a new instance with ModelLoaderRegistry. */ -public final class B3DLoader implements ICustomModelLoader +public enum B3DLoader implements ICustomModelLoader { - public static final B3DLoader instance = new B3DLoader(); + INSTANCE; private IResourceManager manager; @@ -366,7 +366,7 @@ public final class B3DLoader implements ICustomModelLoader public static enum B3DFrameProperty implements IUnlistedProperty { - instance; + INSTANCE; public String getName() { return "B3DFrame"; @@ -548,7 +548,7 @@ public final class B3DLoader implements ICustomModelLoader { if(name.equals("main")) { - return Optional.of(B3DClip.instance); + return Optional.of(B3DClip.INSTANCE); } return Optional.absent(); } @@ -633,9 +633,9 @@ public final class B3DLoader implements ICustomModelLoader if(state instanceof IExtendedBlockState) { IExtendedBlockState exState = (IExtendedBlockState)state; - if(exState.getUnlistedNames().contains(B3DFrameProperty.instance)) + if(exState.getUnlistedNames().contains(B3DFrameProperty.INSTANCE)) { - B3DState s = exState.getValue(B3DFrameProperty.instance); + B3DState s = exState.getValue(B3DFrameProperty.INSTANCE); if(s != null) { //return getCachedModel(s.getFrame()); @@ -727,7 +727,7 @@ public final class B3DLoader implements ICustomModelLoader if(f.getBrush() != null) textures = f.getBrush().getTextures(); TextureAtlasSprite sprite; if(textures == null || textures.isEmpty()) sprite = this.textures.get("missingno"); - else if(textures.get(0) == B3DModel.Texture.White) sprite = ModelLoader.White.instance; + else if(textures.get(0) == B3DModel.Texture.White) sprite = ModelLoader.White.INSTANCE; else sprite = this.textures.get(textures.get(0).getPath()); quadBuilder.setTexture(sprite); putVertexData(quadBuilder, f.getV1(), f.getNormal(), sprite); diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java b/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java index a84b680f6b..b398fbaeea 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java @@ -21,8 +21,9 @@ import org.apache.logging.log4j.Level; * To enable your mod call instance.addDomain(modid). * If you need more control over accepted resources - extend the class, and register a new instance with ModelLoaderRegistry. */ -public final class OBJLoader implements ICustomModelLoader { - public static final OBJLoader instance = new OBJLoader(); +public enum OBJLoader implements ICustomModelLoader { + INSTANCE; + private IResourceManager manager; private final Set enabledDomains = new HashSet(); private final Map cache = new HashMap(); diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index 0d6186fed6..86b3fd44f8 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -101,7 +101,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { ImmutableMap.Builder builder = ImmutableMap.builder(); - builder.put(ModelLoader.White.loc.toString(), ModelLoader.White.instance); + builder.put(ModelLoader.White.LOCATION.toString(), ModelLoader.White.INSTANCE); TextureAtlasSprite missing = bakedTextureGetter.apply(new ResourceLocation("missingno")); for (Map.Entry e : matLib.materials.entrySet()) { @@ -1278,7 +1278,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData public enum OBJProperty implements IUnlistedProperty { - instance; + INSTANCE; public String getName() { return "OBJPropery"; @@ -1310,7 +1310,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData private final VertexFormat format; private Set quads; private ImmutableMap textures; - private TextureAtlasSprite sprite = ModelLoader.White.instance; + private TextureAtlasSprite sprite = ModelLoader.White.INSTANCE; public OBJBakedModel(OBJModel model, IModelState state, VertexFormat format, ImmutableMap textures) { @@ -1399,7 +1399,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData v.setMaterial(this.model.getMatLib().getMaterial(v.getMaterial().getName())); } } - sprite = ModelLoader.White.instance; + sprite = ModelLoader.White.INSTANCE; } else sprite = this.textures.get(f.getMaterialName()); UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); builder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z)); diff --git a/src/main/java/net/minecraftforge/common/animation/TimeValues.java b/src/main/java/net/minecraftforge/common/animation/TimeValues.java index d289cc744b..74811384be 100644 --- a/src/main/java/net/minecraftforge/common/animation/TimeValues.java +++ b/src/main/java/net/minecraftforge/common/animation/TimeValues.java @@ -23,7 +23,7 @@ public final class TimeValues { public static enum IdentityValue implements ITimeValue, IStringSerializable { - instance; + INSTANCE; public float apply(float input) { @@ -352,7 +352,7 @@ public final class TimeValues String string = in.nextString(); if(string.equals("#identity")) { - return IdentityValue.instance; + return IdentityValue.INSTANCE; } if(!string.startsWith("#")) { diff --git a/src/main/java/net/minecraftforge/common/model/animation/AnimationStateMachine.java b/src/main/java/net/minecraftforge/common/model/animation/AnimationStateMachine.java index 29b8d964dd..6418b0c5c3 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/AnimationStateMachine.java +++ b/src/main/java/net/minecraftforge/common/model/animation/AnimationStateMachine.java @@ -206,7 +206,7 @@ public final class AnimationStateMachine implements IAnimationStateMachine private static final AnimationStateMachine missing = new AnimationStateMachine( ImmutableMap.of(), - ImmutableMap.of("missingno", (IClip)Clips.IdentityClip.instance), + ImmutableMap.of("missingno", (IClip)Clips.IdentityClip.INSTANCE), ImmutableList.of("missingno"), ImmutableMap.of(), "missingno"); diff --git a/src/main/java/net/minecraftforge/common/model/animation/Clips.java b/src/main/java/net/minecraftforge/common/model/animation/Clips.java index 4fab7d4e12..7f588db040 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/Clips.java +++ b/src/main/java/net/minecraftforge/common/model/animation/Clips.java @@ -44,11 +44,11 @@ public final class Clips */ public static enum IdentityClip implements IClip, IStringSerializable { - instance; + INSTANCE; public IJointClip apply(IJoint joint) { - return JointClips.IdentityJointClip.instance; + return JointClips.IdentityJointClip.INSTANCE; } public Iterable pastEvents(float lastPollTime, float time) @@ -79,7 +79,7 @@ public final class Clips FMLLog.getLogger().error("Unable to find clip " + clipName + " in the model " + modelLocation); } // FIXME: missing clip? - return new ModelClip(IdentityClip.instance, modelLocation, clipName); + return new ModelClip(IdentityClip.INSTANCE, modelLocation, clipName); } /** @@ -502,7 +502,7 @@ public final class Clips // IdentityClip if(string.equals("#identity")) { - return IdentityClip.instance; + return IdentityClip.INSTANCE; } // Clip reference if(string.startsWith("#")) diff --git a/src/main/java/net/minecraftforge/common/model/animation/JointClips.java b/src/main/java/net/minecraftforge/common/model/animation/JointClips.java index 8e449a4fd5..df64bec1e5 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/JointClips.java +++ b/src/main/java/net/minecraftforge/common/model/animation/JointClips.java @@ -9,7 +9,7 @@ public final class JointClips { public static enum IdentityJointClip implements IJointClip { - instance; + INSTANCE; public TRSRTransformation apply(float time) { diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index 3cf9a6a768..727e1e9b96 100644 --- a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -178,7 +178,7 @@ public class ModelAnimationDebug public void preInit(FMLPreInitializationEvent event) { super.preInit(event); - B3DLoader.instance.addDomain(MODID); + B3DLoader.INSTANCE.addDomain(MODID); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GameRegistry.findBlock(MODID, blockName)), 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + blockName, "inventory")); ClientRegistry.bindTileEntitySpecialRenderer(Chest.class, new AnimationTESR() { diff --git a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java index 94bfd23413..e59bea46fb 100644 --- a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java @@ -1,6 +1,5 @@ package net.minecraftforge.debug; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -20,7 +19,6 @@ import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; @@ -28,13 +26,13 @@ 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.math.MathHelper; -import net.minecraft.util.text.TextComponentString; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.ITickable; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.model.IModel; @@ -43,7 +41,6 @@ import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.client.model.b3d.B3DLoader; import net.minecraftforge.client.model.obj.OBJLoader; import net.minecraftforge.client.model.obj.OBJModel; -import net.minecraftforge.client.model.obj.OBJModel.OBJBakedModel; import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; @@ -54,9 +51,7 @@ import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; @Mod(modid = ModelLoaderRegistryDebug.MODID, version = ModelLoaderRegistryDebug.VERSION) @@ -71,33 +66,33 @@ public class ModelLoaderRegistryDebug GameRegistry.registerBlock(CustomModelBlock.instance, CustomModelBlock.name); GameRegistry.registerBlock(OBJTesseractBlock.instance, OBJTesseractBlock.name); GameRegistry.registerBlock(OBJVertexColoring1.instance, OBJVertexColoring1.name); - GameRegistry.registerBlock(OBJDirectionEye.instance, OBJDirectionEye.name); + //GameRegistry.registerBlock(OBJDirectionEye.instance, OBJDirectionEye.name); GameRegistry.registerBlock(OBJVertexColoring2.instance, OBJVertexColoring2.name); GameRegistry.registerBlock(OBJDirectionBlock.instance, OBJDirectionBlock.name); GameRegistry.registerBlock(OBJCustomDataBlock.instance, OBJCustomDataBlock.name); - GameRegistry.registerBlock(OBJDynamicEye.instance, OBJDynamicEye.name); + //GameRegistry.registerBlock(OBJDynamicEye.instance, OBJDynamicEye.name); GameRegistry.registerTileEntity(OBJTesseractTileEntity.class, OBJTesseractBlock.name); GameRegistry.registerTileEntity(OBJVertexColoring2TileEntity.class, OBJVertexColoring2.name); - GameRegistry.registerTileEntity(OBJDynamicEyeTileEntity.class, OBJDynamicEye.name); + //GameRegistry.registerTileEntity(OBJDynamicEyeTileEntity.class, OBJDynamicEye.name); if (event.getSide() == Side.CLIENT) clientPreInit(); } private void clientPreInit() { - B3DLoader.instance.addDomain(MODID.toLowerCase()); + B3DLoader.INSTANCE.addDomain(MODID.toLowerCase()); Item item = Item.getItemFromBlock(CustomModelBlock.instance); ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + CustomModelBlock.name, "inventory")); - OBJLoader.instance.addDomain(MODID.toLowerCase()); + OBJLoader.INSTANCE.addDomain(MODID.toLowerCase()); Item item2 = Item.getItemFromBlock(OBJTesseractBlock.instance); ModelLoader.setCustomModelResourceLocation(item2, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJTesseractBlock.name, "inventory")); Item item3 = Item.getItemFromBlock(OBJVertexColoring1.instance); ModelLoader.setCustomModelResourceLocation(item3, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJVertexColoring1.name, "inventory")); - Item item4 = Item.getItemFromBlock(OBJDirectionEye.instance); - ModelLoader.setCustomModelResourceLocation(item4, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJDirectionEye.name, "inventory")); + //Item item4 = Item.getItemFromBlock(OBJDirectionEye.instance); + //ModelLoader.setCustomModelResourceLocation(item4, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJDirectionEye.name, "inventory")); Item item5 = Item.getItemFromBlock(OBJVertexColoring2.instance); ModelLoader.setCustomModelResourceLocation(item5, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJVertexColoring2.name, "inventory")); @@ -108,8 +103,8 @@ public class ModelLoaderRegistryDebug Item item7 = Item.getItemFromBlock(OBJCustomDataBlock.instance); ModelLoader.setCustomModelResourceLocation(item7, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJCustomDataBlock.name, "inventory")); - Item item8 = Item.getItemFromBlock(OBJDynamicEye.instance); - ModelLoader.setCustomModelResourceLocation(item8, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJDynamicEye.name, "inventory")); + //Item item8 = Item.getItemFromBlock(OBJDynamicEye.instance); + //ModelLoader.setCustomModelResourceLocation(item8, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJDynamicEye.name, "inventory")); } public static class CustomModelBlock extends Block @@ -118,7 +113,7 @@ public class ModelLoaderRegistryDebug public static final CustomModelBlock instance = new CustomModelBlock(); public static final String name = "CustomModelBlock"; private int counter = 1; - public ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{B3DLoader.B3DFrameProperty.instance}); + public ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{B3DLoader.B3DFrameProperty.INSTANCE}); private CustomModelBlock() { @@ -160,7 +155,7 @@ public class ModelLoaderRegistryDebug { //Only return an IExtendedBlockState from this method and createState(), otherwise block placement might break! B3DLoader.B3DState newState = new B3DLoader.B3DState(null, counter); - return ((IExtendedBlockState) state).withProperty(B3DLoader.B3DFrameProperty.instance, newState); + return ((IExtendedBlockState) state).withProperty(B3DLoader.B3DFrameProperty.INSTANCE, newState); } @Override @@ -180,7 +175,7 @@ public class ModelLoaderRegistryDebug @Override public BlockStateContainer createBlockState() { - return new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{B3DLoader.B3DFrameProperty.instance}); + return new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{B3DLoader.B3DFrameProperty.INSTANCE}); } public static EnumFacing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLivingBase entityIn) @@ -218,7 +213,7 @@ public class ModelLoaderRegistryDebug { public static final OBJTesseractBlock instance = new OBJTesseractBlock(); public static final String name = "OBJTesseractBlock"; - private ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{OBJModel.OBJProperty.instance}); + private ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{OBJModel.OBJProperty.INSTANCE}); private OBJTesseractBlock() { @@ -247,7 +242,7 @@ public class ModelLoaderRegistryDebug { OBJTesseractTileEntity tileEntity = (OBJTesseractTileEntity) world.getTileEntity(pos); OBJModel.OBJState retState = new OBJModel.OBJState(tileEntity == null ? Lists.newArrayList(OBJModel.Group.ALL) : tileEntity.visible, true); - return ((IExtendedBlockState) this.state.getBaseState()).withProperty(OBJModel.OBJProperty.instance, retState); + return ((IExtendedBlockState) this.state.getBaseState()).withProperty(OBJModel.OBJProperty.INSTANCE, retState); } @Override @@ -395,7 +390,7 @@ public class ModelLoaderRegistryDebug public static final PropertyDirection FACING = PropertyDirection.create("facing"); public static final OBJDirectionEye instance = new OBJDirectionEye(); public static final String name = "OBJDirectionEye"; - private ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[] {FACING}, new IUnlistedProperty[]{OBJModel.OBJProperty.instance}); + private ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[] {FACING}, new IUnlistedProperty[]{OBJModel.OBJProperty.INSTANCE}); private OBJDirectionEye() { @@ -426,7 +421,7 @@ public class ModelLoaderRegistryDebug @Override public BlockStateContainer createBlockState() { - return new ExtendedBlockState(this, new IProperty[] {FACING}, new IUnlistedProperty[] {OBJModel.OBJProperty.instance}); + return new ExtendedBlockState(this, new IProperty[] {FACING}, new IUnlistedProperty[] {OBJModel.OBJProperty.INSTANCE}); } @Override @@ -444,7 +439,7 @@ public class ModelLoaderRegistryDebug EnumFacing facing = (EnumFacing) state.getValue(FACING); TRSRTransformation transform = new TRSRTransformation(facing); OBJModel.OBJState retState = new OBJModel.OBJState(Arrays.asList(new String[]{OBJModel.Group.ALL}), true, transform); - return ((IExtendedBlockState) state).withProperty(OBJModel.OBJProperty.instance, retState); + return ((IExtendedBlockState) state).withProperty(OBJModel.OBJProperty.INSTANCE, retState); } public static EnumFacing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLivingBase entityIn) @@ -579,7 +574,7 @@ public class ModelLoaderRegistryDebug public static final PropertyDirection FACING = PropertyDirection.create("facing"); public static final OBJDirectionBlock instance = new OBJDirectionBlock(); public static final String name = "OBJDirectionBlock"; - public ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{OBJModel.OBJProperty.instance}); + public ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{OBJModel.OBJProperty.INSTANCE}); private OBJDirectionBlock() { @@ -623,13 +618,13 @@ public class ModelLoaderRegistryDebug EnumFacing facing = (EnumFacing) state.getValue(FACING); TRSRTransformation transform = new TRSRTransformation(facing); OBJModel.OBJState newState = new OBJModel.OBJState(Lists.newArrayList(OBJModel.Group.ALL), true, transform); - return ((IExtendedBlockState) state).withProperty(OBJModel.OBJProperty.instance, newState); + return ((IExtendedBlockState) state).withProperty(OBJModel.OBJProperty.INSTANCE, newState); } @Override public BlockStateContainer createBlockState() { - return new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{OBJModel.OBJProperty.instance}); + return new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{OBJModel.OBJProperty.INSTANCE}); } public static EnumFacing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLivingBase entityIn) @@ -723,7 +718,7 @@ public class ModelLoaderRegistryDebug { public static final OBJDynamicEye instance = new OBJDynamicEye(); public static final String name = "OBJDynamicEye"; - public ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] {OBJModel.OBJProperty.instance}); + public ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] {OBJModel.OBJProperty.INSTANCE}); private OBJDynamicEye() { super(Material.iron); @@ -763,7 +758,7 @@ public class ModelLoaderRegistryDebug OBJDynamicEyeTileEntity te = (OBJDynamicEyeTileEntity) world.getTileEntity(pos); if (te.state != null) { - return ((IExtendedBlockState) this.state.getBaseState()).withProperty(OBJModel.OBJProperty.instance, te.state); + return ((IExtendedBlockState) this.state.getBaseState()).withProperty(OBJModel.OBJProperty.INSTANCE, te.state); } } return state; @@ -772,7 +767,7 @@ public class ModelLoaderRegistryDebug @Override public BlockStateContainer createBlockState() { - return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] {OBJModel.OBJProperty.instance}); + return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] {OBJModel.OBJProperty.INSTANCE}); } } From 30db41be9ab3401afb7d627613b7d7c69acfa6aa Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Mon, 21 Mar 2016 09:24:36 -0500 Subject: [PATCH 123/243] Expose IItemHandler on vanilla entities --- .../entity/EntityLivingBase.java.patch | 35 +++++++++++++ .../entity/passive/EntityHorse.java.patch | 36 +++++++++++++- .../entity/player/EntityPlayer.java.patch | 35 ++++++++++++- .../items/ItemStackHandler.java | 5 ++ .../items/wrapper/PlayerArmorInvWrapper.java | 2 +- .../items/wrapper/PlayerInvWrapper.java | 2 +- .../items/wrapper/PlayerMainInvWrapper.java | 9 ++-- .../wrapper/PlayerOffhandInvWrapper.java | 49 +++++++++++++++++++ 8 files changed, 164 insertions(+), 9 deletions(-) create mode 100644 src/main/java/net/minecraftforge/items/wrapper/PlayerOffhandInvWrapper.java diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 2ddf22c6d7..4c463a58a9 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -285,3 +285,38 @@ } this.func_184602_cy(); +@@ -2626,4 +2707,34 @@ + { + return true; + } ++ ++ // FORGE ++ private final net.minecraftforge.items.IItemHandlerModifiable handHandler = new net.minecraftforge.items.ItemStackHandler(field_184630_bs); ++ private final net.minecraftforge.items.IItemHandlerModifiable armorHandler = new net.minecraftforge.items.ItemStackHandler(field_184631_bt); ++ private final net.minecraftforge.items.IItemHandler joinedHandler = new net.minecraftforge.items.wrapper.CombinedInvWrapper(armorHandler, handHandler); ++ ++ @Override ++ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) ++ { ++ if (facing == net.minecraft.util.EnumFacing.UP) ++ { ++ return (T) armorHandler; ++ } else if (facing.func_176740_k().func_176722_c()) ++ { ++ return (T) handHandler; ++ } else ++ { ++ return (T) joinedHandler; ++ } ++ } ++ return super.getCapability(capability, facing); ++ } ++ ++ @Override ++ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); ++ } + } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch index fabe725b9e..4c14f0c217 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch @@ -1,6 +1,14 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityHorse.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityHorse.java -@@ -1200,6 +1200,7 @@ +@@ -433,6 +433,7 @@ + + this.field_110296_bG.func_110134_a(this); + this.func_110232_cE(); ++ this.itemHandler = new net.minecraftforge.items.wrapper.InvWrapper(this.field_110296_bG); + } + + private void func_110232_cE() +@@ -1200,6 +1201,7 @@ } this.field_110277_bt = 0.0F; @@ -8,3 +16,29 @@ } this.field_70138_W = 1.0F; +@@ -1793,4 +1795,25 @@ + this.field_188477_b = p_i46589_2_; + } + } ++ ++ // FORGE ++ private net.minecraftforge.items.IItemHandler itemHandler = null; // Initialized by initHorseChest above. ++ ++ @Override ++ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ++ && itemHandler != null) ++ { ++ return (T) itemHandler; ++ } ++ return super.getCapability(capability, facing); ++ } ++ ++ @Override ++ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && itemHandler != null ++ || super.hasCapability(capability, facing); ++ } + } diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index 946c86cfda..ffdccb23e7 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -401,7 +401,7 @@ if (this.func_70608_bn()) { -@@ -2340,6 +2447,136 @@ +@@ -2340,6 +2447,169 @@ return (float)this.func_110148_a(SharedMonsterAttributes.field_188792_h).func_111126_e(); } @@ -533,6 +533,39 @@ + public java.util.Collection getPrefixes() { return this.prefixes; } + public java.util.Collection getSuffixes() { return this.suffixes; } + ++ private final net.minecraftforge.items.IItemHandler playerMainHandler = new net.minecraftforge.items.wrapper.PlayerMainInvWrapper(field_71071_by); ++ private final net.minecraftforge.items.IItemHandler playerArmorHandler = new net.minecraftforge.items.wrapper.PlayerArmorInvWrapper(field_71071_by); ++ private final net.minecraftforge.items.IItemHandler playerOffhandHandler = new net.minecraftforge.items.wrapper.PlayerOffhandInvWrapper(field_71071_by); ++ private final net.minecraftforge.items.IItemHandler playerJoinedHandler = new net.minecraftforge.items.wrapper.PlayerInvWrapper(field_71071_by); ++ ++ @Override ++ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) ++ { ++ if (facing == net.minecraft.util.EnumFacing.UP) ++ { ++ return (T) playerArmorHandler; ++ } else if (facing == net.minecraft.util.EnumFacing.DOWN) ++ { ++ return (T) playerMainHandler; ++ } else if (facing.func_176740_k().func_176722_c()) ++ { ++ return (T) playerOffhandHandler; ++ } else ++ { ++ return (T) playerJoinedHandler; ++ } ++ } ++ return super.getCapability(capability, facing); ++ } ++ ++ @Override ++ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) ++ { ++ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); ++ } ++ + /* ======================================== FORGE END =====================================*/ + public static enum EnumChatVisibility diff --git a/src/main/java/net/minecraftforge/items/ItemStackHandler.java b/src/main/java/net/minecraftforge/items/ItemStackHandler.java index 5ffc6bc648..fcd05022ad 100644 --- a/src/main/java/net/minecraftforge/items/ItemStackHandler.java +++ b/src/main/java/net/minecraftforge/items/ItemStackHandler.java @@ -20,6 +20,11 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I stacks = new ItemStack[size]; } + public ItemStackHandler(ItemStack[] stacks) + { + this.stacks = stacks; + } + public void setSize(int size) { stacks = new ItemStack[size]; diff --git a/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java index 9da886216d..f8c70dd560 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java @@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack; public class PlayerArmorInvWrapper extends InvWrapper { public final InventoryPlayer inventoryPlayer; - public final int offset; + private final int offset; public PlayerArmorInvWrapper(InventoryPlayer inv) { diff --git a/src/main/java/net/minecraftforge/items/wrapper/PlayerInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/PlayerInvWrapper.java index b5654705a6..b0c99d5e2f 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/PlayerInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/PlayerInvWrapper.java @@ -6,6 +6,6 @@ public class PlayerInvWrapper extends CombinedInvWrapper { public PlayerInvWrapper(InventoryPlayer inv) { - super(new PlayerMainInvWrapper(inv), new PlayerArmorInvWrapper(inv)); + super(new PlayerMainInvWrapper(inv), new PlayerArmorInvWrapper(inv), new PlayerOffhandInvWrapper(inv)); } } diff --git a/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java index a2d996d954..2893486895 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java @@ -10,7 +10,6 @@ import net.minecraft.item.ItemStack; */ public class PlayerMainInvWrapper extends InvWrapper { - public final InventoryPlayer inventoryPlayer; public PlayerMainInvWrapper(InventoryPlayer inv) @@ -29,7 +28,7 @@ public class PlayerMainInvWrapper extends InvWrapper @Override public void setStackInSlot(int slot, ItemStack stack) { - // prevent setting of armor inventory + // prevent setting of armor and offhand if (slot > getSlots()) { return; @@ -40,7 +39,7 @@ public class PlayerMainInvWrapper extends InvWrapper @Override public ItemStack getStackInSlot(int slot) { - // prevent getting of armor inventory + // prevent getting of armor and offhand if (slot > getSlots()) { return null; @@ -51,7 +50,7 @@ public class PlayerMainInvWrapper extends InvWrapper @Override public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { - // prevent inserting into armor inventory + // prevent inserting into armor and offhand if (slot > getSlots()) { return stack; @@ -79,7 +78,7 @@ public class PlayerMainInvWrapper extends InvWrapper @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { - // prevent extraction from armor inventory + // prevent extraction from armor and offhand if (slot > getSlots()) { return null; diff --git a/src/main/java/net/minecraftforge/items/wrapper/PlayerOffhandInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/PlayerOffhandInvWrapper.java new file mode 100644 index 0000000000..5272a3ec39 --- /dev/null +++ b/src/main/java/net/minecraftforge/items/wrapper/PlayerOffhandInvWrapper.java @@ -0,0 +1,49 @@ +package net.minecraftforge.items.wrapper; + +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; + +public class PlayerOffhandInvWrapper extends InvWrapper +{ + public final InventoryPlayer inventoryPlayer; + private final int offset; + + public PlayerOffhandInvWrapper(InventoryPlayer inv) + { + super(inv); + + inventoryPlayer = inv; + offset = inventoryPlayer.mainInventory.length + inventoryPlayer.armorInventory.length; + } + + @Override + public int getSlots() + { + return inventoryPlayer.offHandInventory.length; + } + + @Override + public ItemStack getStackInSlot(int slot) + { + return super.getStackInSlot(slot + offset); + } + + @Override + public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) + { + return super.insertItem(slot + offset, stack, simulate); + } + + @Override + public void setStackInSlot(int slot, ItemStack stack) + { + super.setStackInSlot(slot + offset, stack); + } + + @Override + public ItemStack extractItem(int slot, int amount, boolean simulate) + { + return super.extractItem(slot + offset, amount, simulate); + } + +} From c589a3a2993403b6f451ed1d6e223f9e89a060d7 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Mon, 21 Mar 2016 18:06:31 +0300 Subject: [PATCH 124/243] Implemented slightly more generic version of UVLock, re-enabled it for json models. Closes #2607. --- .../block/model/FaceBakery.java.patch | 13 ++-- .../renderer/block/model/Variant.java.patch | 19 ++++++ .../client/ForgeHooksClient.java | 55 +++++++++++++++-- .../client/model/ForgeBlockStateV1.java | 2 +- .../common/model/TRSRTransformation.java | 61 ++++++++++++++++++- 5 files changed, 135 insertions(+), 15 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch index 3d8f0f3597..8e298ade1d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java -@@ -48,14 +48,20 @@ +@@ -48,14 +48,19 @@ public BakedQuad func_178414_a(Vector3f p_178414_1_, Vector3f p_178414_2_, BlockPartFace p_178414_3_, TextureAtlasSprite p_178414_4_, EnumFacing p_178414_5_, ModelRotation p_178414_6_, BlockPartRotation p_178414_7_, boolean p_178414_8_, boolean p_178414_9_) { @@ -14,8 +14,7 @@ if (p_178414_8_) { - blockfaceuv = this.func_188010_a(p_178414_3_.field_178243_e, p_178414_5_, p_178414_6_); -+ // TODO fix uvlock for custom rotations -+ //blockfaceuv = this.applyUVLock(face.blockFaceUV, facing, modelRotationIn); ++ blockfaceuv = net.minecraftforge.client.ForgeHooksClient.applyUVLock(p_178414_3_.field_178243_e, p_178414_5_, p_178414_6_); } - int[] aint = this.func_188012_a(blockfaceuv, p_178414_4_, p_178414_5_, this.func_178403_a(p_178414_1_, p_178414_2_), p_178414_6_, p_178414_7_, p_178414_9_); @@ -23,7 +22,7 @@ EnumFacing enumfacing = func_178410_a(aint); if (p_178414_7_ == null) -@@ -63,7 +69,8 @@ +@@ -63,7 +68,8 @@ this.func_178408_a(aint, enumfacing); } @@ -33,7 +32,7 @@ } private BlockFaceUV func_188010_a(BlockFaceUV p_188010_1_, EnumFacing p_188010_2_, ModelRotation p_188010_3_) -@@ -73,11 +80,16 @@ +@@ -73,11 +79,16 @@ private int[] func_188012_a(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, ModelRotation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) { @@ -51,7 +50,7 @@ } return aint; -@@ -123,12 +135,17 @@ +@@ -123,12 +134,17 @@ private void func_188015_a(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, ModelRotation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_) { @@ -71,7 +70,7 @@ this.func_178404_a(p_188015_1_, j, p_188015_2_, vector3f, i, p_188015_6_, p_188015_4_); } -@@ -189,14 +206,19 @@ +@@ -189,14 +205,19 @@ public int func_188011_a(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, ModelRotation p_188011_4_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch index 2a57fbefe1..d176aa5f9d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch @@ -1,5 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/Variant.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/Variant.java +@@ -12,7 +12,7 @@ + import net.minecraftforge.fml.relauncher.SideOnly; + + @SideOnly(Side.CLIENT) +-public class Variant ++public class Variant implements net.minecraftforge.client.model.ISmartVariant + { + private final ResourceLocation field_188050_a; + private final ModelRotation field_188051_b; @@ -32,11 +32,17 @@ return this.field_188050_a; } @@ -18,3 +27,13 @@ public boolean func_188049_c() { return this.field_188052_c; +@@ -138,4 +144,9 @@ + } + } + } ++ ++ public net.minecraftforge.client.model.IModel process(net.minecraftforge.client.model.IModel base) ++ { ++ return net.minecraftforge.client.model.ModelProcessingHelper.uvlock(base, func_188049_c()); ++ } + } diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index de9c86ddef..6e6f59c591 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -9,6 +9,7 @@ import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.util.Map; +import javax.vecmath.Matrix3f; import javax.vecmath.Matrix4f; import javax.vecmath.Vector3f; import javax.vecmath.Vector4f; @@ -28,9 +29,9 @@ import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.BlockFaceUV; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemTransformVec3f; import net.minecraft.client.renderer.block.model.ModelManager; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.model.ModelRotation; @@ -52,8 +53,11 @@ import net.minecraft.inventory.EntityEquipmentSlot; 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.ResourceLocation; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.registry.IRegistry; import net.minecraft.util.text.TextFormatting; @@ -75,9 +79,10 @@ import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.ForgeModContainer; import net.minecraftforge.common.ForgeVersion; import net.minecraftforge.common.ForgeVersion.Status; -import net.minecraftforge.common.model.IModelPart; -import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.ITransformation; +import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.FMLLog; @@ -353,7 +358,7 @@ public class ForgeHooksClient } @SuppressWarnings("deprecation") - public static Matrix4f getMatrix(ItemTransformVec3f transform) + public static Matrix4f getMatrix(net.minecraft.client.renderer.block.model.ItemTransformVec3f transform) { javax.vecmath.Matrix4f m = new javax.vecmath.Matrix4f(), t = new javax.vecmath.Matrix4f(); m.setIdentity(); @@ -589,7 +594,7 @@ public class ForgeHooksClient } @SuppressWarnings("deprecation") - public static Optional applyTransform(ItemTransformVec3f transform, Optional part) + public static Optional applyTransform(net.minecraft.client.renderer.block.model.ItemTransformVec3f transform, Optional part) { if(part.isPresent()) return Optional.absent(); return Optional.of(new TRSRTransformation(transform)); @@ -636,4 +641,42 @@ public class ForgeHooksClient } return !from.getItem().shouldCauseReequipAnimation(from, to, changed); } + + public static BlockFaceUV applyUVLock(BlockFaceUV blockFaceUV, EnumFacing originalSide, ITransformation rotation) + { + TRSRTransformation global = new TRSRTransformation(rotation.getMatrix()); + Matrix4f uv = global.getUVLockTransform(originalSide).getMatrix(); + Vector4f vec = new Vector4f(0, 0, 0, 1); + vec.x = blockFaceUV.getVertexU(blockFaceUV.getVertexRotatedRev(0)) / 16; + vec.y = blockFaceUV.getVertexV(blockFaceUV.getVertexRotatedRev(0)) / 16; + uv.transform(vec); + float uMin = 16 * vec.x; // / vec.w; + float vMin = 16 * vec.y; // / vec.w; + vec.x = blockFaceUV.getVertexU(blockFaceUV.getVertexRotatedRev(2)) / 16; + vec.y = blockFaceUV.getVertexV(blockFaceUV.getVertexRotatedRev(2)) / 16; + vec.z = 0; + vec.w = 1; + uv.transform(vec); + float uMax = 16 * vec.x; // / vec.w; + float vMax = 16 * vec.y; // / vec.w; + if(uMin > uMax) + { + float t = uMin; + uMin = uMax; + uMax = t; + } + if(vMin > vMax) + { + float t = vMin; + vMin = vMax; + vMax = t; + } + float a = (float)Math.toRadians(blockFaceUV.rotation); + Vector3f rv = new Vector3f(MathHelper.cos(a), MathHelper.sin(a), 0); + Matrix3f rot = new Matrix3f(); + uv.getRotationScale(rot); + rot.transform(rv); + int angle = MathHelper.normalizeAngle(-(int)Math.round(Math.toDegrees(Math.atan2(rv.y, rv.x)) / 90) * 90, 360); + return new BlockFaceUV(new float[]{ uMin, vMin, uMax, vMax }, angle); + } } diff --git a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java index 93433bb023..028e94119d 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java @@ -373,7 +373,7 @@ public class ForgeBlockStateV1 extends Marker protected SubModel asGenericSubModel() { - return new SubModel(state.or(TRSRTransformation.identity()), smooth.or(true), gui3d.or(true), uvLock.or(false), getTextures(), model, getCustomData()); + return new SubModel(state.or(TRSRTransformation.identity()), uvLock.or(false), smooth.or(true), gui3d.or(true), getTextures(), model, getCustomData()); } /** diff --git a/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java b/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java index 3c84d27aa5..91ddf6c052 100644 --- a/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java +++ b/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java @@ -1,8 +1,12 @@ package net.minecraftforge.common.model; +import java.util.EnumMap; + +import javax.vecmath.AxisAngle4f; import javax.vecmath.Matrix3f; import javax.vecmath.Matrix4f; import javax.vecmath.Quat4f; +import javax.vecmath.SingularMatrixException; import javax.vecmath.Tuple3f; import javax.vecmath.Tuple4f; import javax.vecmath.Vector3f; @@ -19,6 +23,7 @@ import org.apache.commons.lang3.tuple.Triple; import com.google.common.base.Objects; import com.google.common.base.Optional; +import com.google.common.collect.Maps; /* * Interpolation-friendly affine transformation. @@ -128,6 +133,14 @@ public final class TRSRTransformation implements IModelState, ITransformation return new TRSRTransformation(m); } + public TRSRTransformation inverse() + { + if(this == identity) return this; + Matrix4f m = getMatrix(); + m.invert(); + return new TRSRTransformation(m); + } + private void genCheck() { if(!full) @@ -212,7 +225,6 @@ public final class TRSRTransformation implements IModelState, ITransformation return new Vector3f((float)Math.toDegrees(xyz.x), (float)Math.toDegrees(xyz.y), (float)Math.toDegrees(xyz.z)); } - // TODO check if correct public static Vector3f toXYZ(Quat4f q) { float w2 = q.w * q.w; @@ -731,4 +743,51 @@ public final class TRSRTransformation implements IModelState, ITransformation slerp(this.getRightRot(), that.getRightRot(), progress) ); } + + private static final EnumMap vanillaUvTransformLocalToGlobal = Maps.newEnumMap(EnumFacing.class); + private static final EnumMap vanillaUvTransformGlobalToLocal = Maps.newEnumMap(EnumFacing.class); + + static + { + vanillaUvTransformLocalToGlobal.put(EnumFacing.SOUTH, identity); + Quat4f tmp = new Quat4f(); + tmp.set(new AxisAngle4f(0, 1, 0, (float)Math.toRadians(90))); + vanillaUvTransformLocalToGlobal.put(EnumFacing.EAST, new TRSRTransformation(null, new Quat4f(tmp), null, null)); + tmp.set(new AxisAngle4f(0, 1, 0, (float)Math.toRadians(-90))); + vanillaUvTransformLocalToGlobal.put(EnumFacing.WEST, new TRSRTransformation(null, new Quat4f(tmp), null, null)); + tmp.set(new AxisAngle4f(0, 1, 0, (float)Math.toRadians(180))); + vanillaUvTransformLocalToGlobal.put(EnumFacing.NORTH, new TRSRTransformation(null, new Quat4f(tmp), null, null)); + tmp.set(new AxisAngle4f(1, 0, 0, (float)Math.toRadians(-90))); + vanillaUvTransformLocalToGlobal.put(EnumFacing.UP, new TRSRTransformation(null, new Quat4f(tmp), null, null)); + tmp.set(new AxisAngle4f(1, 0, 0, (float)Math.toRadians(90))); + vanillaUvTransformLocalToGlobal.put(EnumFacing.DOWN, new TRSRTransformation(null, new Quat4f(tmp), null, null)); + + for(EnumFacing side : EnumFacing.values()) + { + vanillaUvTransformGlobalToLocal.put(side, vanillaUvTransformLocalToGlobal.get(side).inverse()); + } + } + + public static TRSRTransformation getVanillaUvTransformLocalToGlobal(EnumFacing side) + { + return vanillaUvTransformLocalToGlobal.get(side); + } + + public static TRSRTransformation getVanillaUvTransformGlobalToLocal(EnumFacing side) + { + return vanillaUvTransformGlobalToLocal.get(side); + } + + public TRSRTransformation getUVLockTransform(EnumFacing originalSide) + { + EnumFacing newSide = rotate(originalSide); + try + { + return blockCenterToCorner(vanillaUvTransformGlobalToLocal.get(originalSide).compose(blockCornerToCenter(this.inverse())).compose(vanillaUvTransformLocalToGlobal.get(newSide))); + } + catch(SingularMatrixException e) + { + return new TRSRTransformation(null, null, new Vector3f(0, 0, 0), null); + } + } } From 4e6ad80370fd9d165da34a155278cae5a7b9b573 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Mon, 21 Mar 2016 18:23:27 +0300 Subject: [PATCH 125/243] Removed blockCenterToCorner from TRSRTransformation constructor. Closes #2461. --- .../net/minecraftforge/client/ForgeHooksClient.java | 2 +- .../client/model/IPerspectiveAwareModel.java | 2 +- .../common/model/TRSRTransformation.java | 10 +--------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 6e6f59c591..45ef4d46c3 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -597,7 +597,7 @@ public class ForgeHooksClient public static Optional applyTransform(net.minecraft.client.renderer.block.model.ItemTransformVec3f transform, Optional part) { if(part.isPresent()) return Optional.absent(); - return Optional.of(new TRSRTransformation(transform)); + return Optional.of(TRSRTransformation.blockCenterToCorner(new TRSRTransformation(transform))); } public static Optional applyTransform(Matrix4f matrix, Optional part) diff --git a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java index 2c529f9b86..fae295981f 100644 --- a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java +++ b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java @@ -68,7 +68,7 @@ public interface IPerspectiveAwareModel extends IBakedModel ImmutableMap.Builder builder = ImmutableMap.builder(); for(TransformType type : TransformType.values()) { - builder.put(type, new TRSRTransformation(transforms.getTransform(type))); + builder.put(type, TRSRTransformation.blockCenterToCorner(new TRSRTransformation(transforms.getTransform(type)))); } return builder.build(); } diff --git a/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java b/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java index 91ddf6c052..77ecb62256 100644 --- a/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java +++ b/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java @@ -73,15 +73,7 @@ public final class TRSRTransformation implements IModelState, ITransformation @SideOnly(Side.CLIENT) public TRSRTransformation(net.minecraft.client.renderer.block.model.ItemTransformVec3f transform) { - this(getMatrix(transform)); - } - - @Deprecated - @SideOnly(Side.CLIENT) - public static Matrix4f getMatrix(net.minecraft.client.renderer.block.model.ItemTransformVec3f transform) - { - TRSRTransformation ret = new TRSRTransformation(toVecmath(transform.translation), quatFromXYZDegrees(toVecmath(transform.rotation)), toVecmath(transform.scale), null); - return blockCenterToCorner(ret).getMatrix(); + this(toVecmath(transform.translation), quatFromXYZDegrees(toVecmath(transform.rotation)), toVecmath(transform.scale), null); } @SideOnly(Side.CLIENT) From 438145995c36829f581f179bc8da90a397283ade Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Mon, 21 Mar 2016 18:29:45 +0300 Subject: [PATCH 126/243] Ignore blocks/items with null registry name during model loading. Fixes NPE during resource reloading in worlds with removed blocks/items. --- .../client/model/ModelLoader.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 6f0e62bf86..4014840672 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -82,10 +82,12 @@ import org.apache.commons.lang3.tuple.Pair; import com.google.common.base.Function; import com.google.common.base.Joiner; import com.google.common.base.Optional; +import com.google.common.base.Predicate; import com.google.common.collect.HashMultimap; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Multimap; @@ -179,7 +181,13 @@ public final class ModelLoader extends ModelBakery @Override protected void loadBlocks() { - List blocks = Lists.newArrayList(Block.blockRegistry); + List blocks = Lists.newArrayList(Iterables.filter(Block.blockRegistry, new Predicate() + { + public boolean apply(Block block) + { + return block.getRegistryName() != null; + } + })); Collections.sort(blocks, new Comparator() { public int compare(Block b1, Block b2) @@ -257,7 +265,13 @@ public final class ModelLoader extends ModelBakery registerVariantNames(); - List items = Lists.newArrayList(GameData.getItemRegistry().typeSafeIterable()); + List items = Lists.newArrayList(Iterables.filter(Item.itemRegistry, new Predicate() + { + public boolean apply(Item item) + { + return item.getRegistryName() != null; + } + })); Collections.sort(items, new Comparator() { public int compare(Item i1, Item i2) From 9eb04ce1ef4e5bb6cd15e2b5d4bfd9571159b96f Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Mon, 21 Mar 2016 18:54:25 +0300 Subject: [PATCH 127/243] Made VertexBuffer.sortVertexData cleanup pointers after it's done. Closes #2528. --- .../client/renderer/VertexBuffer.java.patch | 13 +++++++++++-- .../TileEntityRendererDispatcher.java.patch | 9 ++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch b/patches/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch index 8f240c8a4a..fbf7ce9417 100644 --- a/patches/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch @@ -1,6 +1,15 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/VertexBuffer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/VertexBuffer.java -@@ -510,15 +510,15 @@ +@@ -126,6 +126,8 @@ + + bitset.set(l1); + } ++ this.field_178999_b.limit(this.field_178999_b.capacity()); ++ this.field_178999_b.position(this.func_181664_j()); + } + + public VertexBuffer.State func_181672_a() +@@ -510,15 +512,15 @@ break; case USHORT: case SHORT: @@ -22,7 +31,7 @@ } this.func_181667_k(); -@@ -609,4 +609,9 @@ +@@ -609,4 +611,9 @@ return this.field_179018_e; } } diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch index d1fbb80f33..f5f95ca273 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch @@ -4,7 +4,7 @@ { if (p_180546_1_.func_145835_a(this.field_147560_j, this.field_147561_k, this.field_147558_l) < p_180546_1_.func_145833_n()) { -+ if(!p_180546_1_.hasFastRenderer()) ++ if(!drawingBatch || !p_180546_1_.hasFastRenderer()) + { int i = this.field_147550_f.func_175626_b(p_180546_1_.func_174877_v(), 0); int j = i % 65536; @@ -19,7 +19,7 @@ { try { -+ if(p_178469_1_.hasFastRenderer()) ++ if(drawingBatch && p_178469_1_.hasFastRenderer()) + { + tileentityspecialrenderer.renderTileEntityFast(p_178469_1_, p_178469_2_, p_178469_4_, p_178469_6_, p_178469_8_, p_178469_9_, batchBuffer.func_178180_c()); + } @@ -27,7 +27,7 @@ tileentityspecialrenderer.func_180535_a(p_178469_1_, p_178469_2_, p_178469_4_, p_178469_6_, p_178469_8_, p_178469_9_); } catch (Throwable throwable) -@@ -155,4 +163,49 @@ +@@ -155,4 +163,52 @@ { return this.field_147557_n; } @@ -37,6 +37,7 @@ + * Buffer used for batched TESRs + */ + private net.minecraft.client.renderer.Tessellator batchBuffer = new net.minecraft.client.renderer.Tessellator(0x200000); ++ private boolean drawingBatch = false; + + /** + * Prepare for a batched TESR rendering. @@ -45,6 +46,7 @@ + public void preDrawBatch() + { + batchBuffer.func_178180_c().func_181668_a(org.lwjgl.opengl.GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176600_a); ++ drawingBatch = true; + } + + /** @@ -75,5 +77,6 @@ + batchBuffer.func_78381_a(); + + net.minecraft.client.renderer.RenderHelper.func_74519_b(); ++ drawingBatch = false; + } } From bebf22c0b0294e687adc0ffc7cee4d7d648432d0 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Mon, 21 Mar 2016 18:55:22 +0300 Subject: [PATCH 128/243] Added default left hand transforms for forge transform strings. Closes #2615. --- .../client/model/ForgeBlockStateV1.java | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java index 028e94119d..2d6095eb96 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java @@ -437,7 +437,7 @@ public class ForgeBlockStateV1 extends Marker throw new UnsupportedOperationException("Forge BlockStateLoader V1 does not support nested submodels."); } - private TRSRTransformation get(float tx, float ty, float tz, float ax, float ay, float az, float s) + private static TRSRTransformation get(float tx, float ty, float tz, float ax, float ay, float az, float s) { return TRSRTransformation.blockCenterToCorner(new TRSRTransformation( new Vector3f(tx / 16, ty / 16, tz / 16), @@ -446,6 +446,13 @@ public class ForgeBlockStateV1 extends Marker null)); } + private static final TRSRTransformation flipX = new TRSRTransformation(null, null, new Vector3f(-1, 1, 1), null); + + private static TRSRTransformation leftify(TRSRTransformation transform) + { + return TRSRTransformation.blockCenterToCorner(flipX.compose(TRSRTransformation.blockCornerToCenter(transform)).compose(flipX)); + } + @Override public ForgeBlockStateV1.Variant deserialize(JsonElement element, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { @@ -495,23 +502,30 @@ public class ForgeBlockStateV1 extends Marker // block/block else if (transform.equals("forge:default-block")) { + TRSRTransformation thirdperson = get(0, 2.5f, 0, 75, 45, 0, 0.375f); ImmutableMap.Builder builder = ImmutableMap.builder(); builder.put(TransformType.GUI, get(0, 0, 0, 30, 225, 0, 0.625f)); - builder.put( TransformType.GROUND, get(0, 3, 0, 0, 0, 0, 0.25f)); + builder.put(TransformType.GROUND, get(0, 3, 0, 0, 0, 0, 0.25f)); builder.put(TransformType.FIXED, get(0, 0, 0, 0, 0, 0, 0.5f)); - builder.put(TransformType.THIRD_PERSON_RIGHT_HAND, get(0, 2.5f, 0, 75, 45, 0, 0.375f)); - builder.put( TransformType.FIRST_PERSON_RIGHT_HAND, get(0, 0, 0, 0, 45, 0, 0.4f)); + builder.put(TransformType.THIRD_PERSON_RIGHT_HAND, thirdperson); + builder.put(TransformType.THIRD_PERSON_LEFT_HAND, leftify(thirdperson)); + builder.put(TransformType.FIRST_PERSON_RIGHT_HAND, get(0, 0, 0, 0, 45, 0, 0.4f)); builder.put(TransformType.FIRST_PERSON_LEFT_HAND, get(0, 0, 0, 0, 255, 0, 0.4f)); ret.state = Optional.of(new SimpleModelState(builder.build())); } // item/generated else if (transform.equals("forge:default-item")) { - ret.state = Optional.of(new SimpleModelState(ImmutableMap.of( - TransformType.GROUND, get(0, 2, 0, 0, 0, 0, 0.5f), - TransformType.HEAD, get(0, 13, 7, 0, 180, 0, 1), - TransformType.THIRD_PERSON_RIGHT_HAND, get(0, 3, 1, 0, 0, 0, 0.55f), - TransformType.FIRST_PERSON_RIGHT_HAND, get(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f)))); + TRSRTransformation thirdperson = get(0, 3, 1, 0, 0, 0, 0.55f); + TRSRTransformation firstperson = get(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f); + ImmutableMap.Builder builder = ImmutableMap.builder(); + builder.put(TransformType.GROUND, get(0, 2, 0, 0, 0, 0, 0.5f)); + builder.put(TransformType.HEAD, get(0, 13, 7, 0, 180, 0, 1)); + builder.put(TransformType.THIRD_PERSON_RIGHT_HAND, thirdperson); + builder.put(TransformType.THIRD_PERSON_LEFT_HAND, leftify(thirdperson)); + builder.put(TransformType.FIRST_PERSON_RIGHT_HAND, firstperson); + builder.put(TransformType.FIRST_PERSON_LEFT_HAND, leftify(firstperson)); + ret.state = Optional.of(new SimpleModelState(builder.build())); } // item/handheld else if (transform.equals("forge:default-tool")) From ba294d48dc0f305b99a1bfd0f2ae60993e88075c Mon Sep 17 00:00:00 2001 From: Thutmose Date: Mon, 21 Mar 2016 18:31:25 -0400 Subject: [PATCH 129/243] Allow players sized smaller than 1 block to walk into small spaces Same as #2605 but for 1.9 branch --- .../client/entity/EntityPlayerSP.java.patch | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch index df0c1af3d2..2388405186 100644 --- a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -8,7 +8,7 @@ + { + for (int y = 0; y < height; y++) + { -+ if (func_175162_d(pos.func_177982_a(0, y, 0))) return false; ++ if (!func_175162_d(pos.func_177982_a(0, y, 0))) return false; + } + return true; + } @@ -21,7 +21,7 @@ double d1 = p_145771_5_ - (double)blockpos.func_177952_p(); - if (!this.func_175162_d(blockpos)) -+ int entHeight = Math.max(Math.round(this.field_70131_O), 1); ++ int entHeight = Math.max((int)Math.ceil(this.field_70131_O), 1); + + boolean inTranslucentBlock = this.isHeadspaceFree(blockpos, entHeight); + @@ -56,6 +56,15 @@ { d2 = 1.0D - d1; i = 5; +@@ -470,7 +483,7 @@ + + private boolean func_175162_d(BlockPos p_175162_1_) + { +- return !this.field_70170_p.func_180495_p(p_175162_1_).func_185915_l() && !this.field_70170_p.func_180495_p(p_175162_1_.func_177984_a()).func_185915_l(); ++ return !this.field_70170_p.func_180495_p(p_175162_1_).func_185915_l(); + } + + public void func_70031_b(boolean p_70031_1_) @@ -515,7 +528,13 @@ public void func_184185_a(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_) From 6fd9a2c00e8f938bbc7b2b7d28c8e8b8b310fb22 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 21 Mar 2016 17:12:34 -0700 Subject: [PATCH 130/243] Rework DimensionManager for new DimensionType enum, replaces the old provider registry. Also fixed save folder issues with dimensions. Closes #2570 --- .../minecraft/world/DimensionType.java.patch | 37 ++++++++ .../world/WorldProviderSurface.java.patch | 2 +- .../minecraft/world/WorldServer.java.patch | 3 +- .../world/gen/ChunkProviderServer.java.patch | 2 +- .../common/DimensionManager.java | 75 ++++------------ .../common/WorldSpecificSaveHandler.java | 35 +++++--- .../network/DimensionMessageHandler.java | 3 +- .../common/network/ForgeMessage.java | 13 ++- .../common/util/EnumHelper.java | 88 +++++++++++++++++-- 9 files changed, 174 insertions(+), 84 deletions(-) create mode 100644 patches/minecraft/net/minecraft/world/DimensionType.java.patch diff --git a/patches/minecraft/net/minecraft/world/DimensionType.java.patch b/patches/minecraft/net/minecraft/world/DimensionType.java.patch new file mode 100644 index 0000000000..b7c257354a --- /dev/null +++ b/patches/minecraft/net/minecraft/world/DimensionType.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/world/DimensionType.java ++++ ../src-work/minecraft/net/minecraft/world/DimensionType.java +@@ -13,6 +13,7 @@ + private final String field_186075_e; + private final String field_186076_f; + private final Class field_186077_g; ++ private boolean shouldLoadSpawn = false; + + private DimensionType(int p_i46672_3_, String p_i46672_4_, String p_i46672_5_, Class p_i46672_6_) + { +@@ -20,6 +21,7 @@ + this.field_186075_e = p_i46672_4_; + this.field_186076_f = p_i46672_5_; + this.field_186077_g = p_i46672_6_; ++ this.shouldLoadSpawn = p_i46672_3_ == 0; + } + + public int func_186068_a() +@@ -74,4 +76,18 @@ + + throw new IllegalArgumentException("Invalid dimension id " + p_186069_0_); + } ++ ++ public boolean shouldLoadSpawn(){ return this.shouldLoadSpawn; } ++ public DimensionType setLoadSpawn(boolean value) { this.shouldLoadSpawn = value; return this; } ++ ++ private static Class[] ENUM_ARGS = {int.class, String.class, String.class, Class.class}; ++ static { net.minecraftforge.common.util.EnumHelper.testEnum(DimensionType.class, ENUM_ARGS); } ++ public static DimensionType register(String name, String suffix, int id, Class provider, boolean keepLoaded) ++ { ++ String enum_name = name.replace(" ", "_").toLowerCase(); ++ DimensionType ret = net.minecraftforge.common.util.EnumHelper.addEnum(DimensionType.class, enum_name, ENUM_ARGS, ++ id, name, suffix, provider); ++ return ret.setLoadSpawn(keepLoaded); ++ } ++ //TODO: Unregister? There is no way to really delete a enum value... + } diff --git a/patches/minecraft/net/minecraft/world/WorldProviderSurface.java.patch b/patches/minecraft/net/minecraft/world/WorldProviderSurface.java.patch index 97526ec7e0..1b588e11e8 100644 --- a/patches/minecraft/net/minecraft/world/WorldProviderSurface.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldProviderSurface.java.patch @@ -5,6 +5,6 @@ public boolean func_186056_c(int p_186056_1_, int p_186056_2_) { - return !this.field_76579_a.func_72916_c(p_186056_1_, p_186056_2_); -+ return !this.field_76579_a.func_72916_c(p_186056_1_, p_186056_2_) || !net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.field_76579_a.field_73011_w.getDimension()); ++ return !this.field_76579_a.func_72916_c(p_186056_1_, p_186056_2_) || !this.field_76579_a.field_73011_w.func_186058_p().shouldLoadSpawn(); } } diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch index e18196b2ec..26182ee574 100644 --- a/patches/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServer.java.patch @@ -10,7 +10,8 @@ + public WorldServer(MinecraftServer p_i45921_1_, ISaveHandler p_i45921_2_, WorldInfo p_i45921_3_, int p_i45921_4_, Profiler p_i45921_5_) { - super(p_i45921_2_, p_i45921_3_, DimensionType.func_186069_a(p_i45921_4_).func_186070_d(), p_i45921_5_, false); +- super(p_i45921_2_, p_i45921_3_, DimensionType.func_186069_a(p_i45921_4_).func_186070_d(), p_i45921_5_, false); ++ super(p_i45921_2_, p_i45921_3_, net.minecraftforge.common.DimensionManager.createProviderFor(p_i45921_4_), p_i45921_5_, false); this.field_73061_a = p_i45921_1_; this.field_73062_L = new EntityTracker(this); this.field_73063_M = new PlayerManager(this); diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch index 0b75b82690..6234904639 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch @@ -100,7 +100,7 @@ this.field_73244_f.func_76159_d(olong.longValue()); this.field_73245_g.remove(chunk); + net.minecraftforge.common.ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.func_77272_a(chunk.field_76635_g, chunk.field_76647_h), chunk); -+ if(field_73245_g.size() == 0 && net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this.field_73251_h).size() == 0 && !net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.field_73251_h.field_73011_w.getDimension())){ ++ if(field_73245_g.size() == 0 && net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this.field_73251_h).size() == 0 && !this.field_73251_h.field_73011_w.func_186058_p().shouldLoadSpawn()){ + net.minecraftforge.common.DimensionManager.unloadWorld(this.field_73251_h.field_73011_w.getDimension()); + return false; + } diff --git a/src/main/java/net/minecraftforge/common/DimensionManager.java b/src/main/java/net/minecraftforge/common/DimensionManager.java index 4cfb66638c..b329436cb0 100644 --- a/src/main/java/net/minecraftforge/common/DimensionManager.java +++ b/src/main/java/net/minecraftforge/common/DimensionManager.java @@ -20,13 +20,11 @@ import com.google.common.collect.Multiset; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; +import net.minecraft.world.DimensionType; import net.minecraft.world.MinecraftException; import net.minecraft.world.World; import net.minecraft.world.WorldManager; import net.minecraft.world.WorldProvider; -import net.minecraft.world.WorldProviderEnd; -import net.minecraft.world.WorldProviderHell; -import net.minecraft.world.WorldProviderSurface; import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServerMulti; import net.minecraft.world.storage.ISaveHandler; @@ -37,51 +35,24 @@ import net.minecraftforge.fml.common.FMLLog; public class DimensionManager { - private static Hashtable> providers = new Hashtable>(); - private static Hashtable spawnSettings = new Hashtable(); private static Hashtable worlds = new Hashtable(); private static boolean hasInit = false; - private static Hashtable dimensions = new Hashtable(); + private static Hashtable dimensions = new Hashtable(); private static ArrayList unloadQueue = new ArrayList(); private static BitSet dimensionMap = new BitSet(Long.SIZE << 4); private static ConcurrentMap weakWorldMap = new MapMaker().weakKeys().weakValues().makeMap(); private static Multiset leakedWorlds = HashMultiset.create(); - public static boolean registerProviderType(int id, Class provider, boolean keepLoaded) - { - if (providers.containsKey(id)) - { - return false; - } - providers.put(id, provider); - spawnSettings.put(id, keepLoaded); - return true; - } - /** - * Unregisters a Provider type, and returns a array of all dimensions that are - * registered to this provider type. - * If the return size is greater then 0, it is required that the caller either - * change those dimensions's registered type, or replace this type before the - * world is attempted to load, else the loader will throw an exception. - * - * @param id The provider type ID to unreigster - * @return An array containing all dimension IDs still registered to this provider type. + * Returns a list of dimensions associated with this DimensionType. */ - public static int[] unregisterProviderType(int id) + public static int[] getDimensions(DimensionType type) { - if (!providers.containsKey(id)) - { - return new int[0]; - } - providers.remove(id); - spawnSettings.remove(id); - int[] ret = new int[dimensions.size()]; int x = 0; - for (Map.Entry ent : dimensions.entrySet()) + for (Map.Entry ent : dimensions.entrySet()) { - if (ent.getValue() == id) + if (ent.getValue() == type) { ret[x++] = ent.getKey(); } @@ -99,25 +70,19 @@ public class DimensionManager hasInit = true; - registerProviderType( 0, WorldProviderSurface.class, true); - registerProviderType(-1, WorldProviderHell.class, true); - registerProviderType( 1, WorldProviderEnd.class, false); - registerDimension( 0, 0); - registerDimension(-1, -1); - registerDimension( 1, 1); + registerDimension( 0, DimensionType.OVERWORLD); + registerDimension(-1, DimensionType.NETHER); + registerDimension( 1, DimensionType.THE_END); } - public static void registerDimension(int id, int providerType) + public static void registerDimension(int id, DimensionType type) { - if (!providers.containsKey(providerType)) - { - throw new IllegalArgumentException(String.format("Failed to register dimension for id %d, provider type %d does not exist", id, providerType)); - } + DimensionType.getById(type.getId()); //Check if type is invalid {will throw an error} No clue how it would be invalid tho... if (dimensions.containsKey(id)) { throw new IllegalArgumentException(String.format("Failed to register dimension for id %d, One is already registered", id)); } - dimensions.put(id, providerType); + dimensions.put(id, type); if (id >= 0) { dimensionMap.set(id); @@ -141,7 +106,7 @@ public class DimensionManager return dimensions.containsKey(dim); } - public static int getProviderType(int dim) + public static DimensionType getProviderType(int dim) { if (!dimensions.containsKey(dim)) { @@ -264,12 +229,6 @@ public class DimensionManager return worlds.values().toArray(new WorldServer[worlds.size()]); } - public static boolean shouldLoadSpawn(int dim) - { - int id = getProviderType(dim); - return spawnSettings.containsKey(id) && spawnSettings.get(id); - } - static { init(); @@ -289,9 +248,9 @@ public class DimensionManager { if (dimensions.containsKey(dim)) { - WorldProvider provider = providers.get(getProviderType(dim)).newInstance(); - provider.setDimension(dim); - return provider; + WorldProvider ret = getProviderType(dim).createDimension(); + ret.setDimension(dim); + return ret; } else { @@ -301,7 +260,7 @@ public class DimensionManager catch (Exception e) { FMLCommonHandler.instance().getFMLLogger().log(Level.ERROR, String.format("An error occured trying to create an instance of WorldProvider %d (%s)", - dim, providers.get(getProviderType(dim)).getSimpleName()),e); + dim, getProviderType(dim)),e); throw new RuntimeException(e); } } diff --git a/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java b/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java index 579853bec6..c2249355ad 100644 --- a/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java +++ b/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java @@ -50,24 +50,37 @@ public class WorldSpecificSaveHandler implements ISaveHandler dataDir.mkdirs(); } File file = new File(dataDir, name + ".dat"); - if (!file.exists() && name.equalsIgnoreCase("FORTRESS") && world.provider.getDimension() == -1) //Only copy over the fortress.dat for the vanilla nether. + if (!file.exists()) { - File parentFile = parent.getMapFileFromName(name); - if (parentFile.exists()) + switch (world.provider.getDimension()) { - try - { - Files.copy(parentFile, file); - } - catch (IOException e) - { - FMLLog.log(Level.ERROR, e, "A critical error occured copying fortress.dat to world specific dat folder - new file will be created."); - } + case -1: + if (name.equalsIgnoreCase("FORTRESS")) copyFile(name, file); + break; + case 1: + if (name.equalsIgnoreCase("VILLAGES_END")) copyFile(name, file); + break; } } return file; } + private void copyFile(String name, File to) + { + File parentFile = parent.getMapFileFromName(name); + if (parentFile.exists()) + { + try + { + Files.copy(parentFile, to); + } + catch (IOException e) + { + FMLLog.log(Level.ERROR, e, "A critical error occured copying %s to world specific dat folder - new file will be created.", parentFile.getName()); + } + } + } + @Override public TemplateManager getStructureTemplateManager() { diff --git a/src/main/java/net/minecraftforge/common/network/DimensionMessageHandler.java b/src/main/java/net/minecraftforge/common/network/DimensionMessageHandler.java index 010f6ee9d6..232d39a558 100644 --- a/src/main/java/net/minecraftforge/common/network/DimensionMessageHandler.java +++ b/src/main/java/net/minecraftforge/common/network/DimensionMessageHandler.java @@ -2,6 +2,7 @@ package net.minecraftforge.common.network; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; +import net.minecraft.world.DimensionType; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.network.ForgeMessage.DimensionRegisterMessage; import org.apache.logging.log4j.Level; @@ -13,7 +14,7 @@ public class DimensionMessageHandler extends SimpleChannelInboundHandler> T addEnum(Class enumType, String enumName, Class[] paramTypes, Object[] paramValues) + //Tests an enum is compatible with these args, throws an error if not. + public static void testEnum(Class> enumType, Class[] paramTypes) + { + addEnum(true, enumType, null, paramTypes, (Object[])null); + } + + public static > T addEnum(Class enumType, String enumName, Class[] paramTypes, Object... paramValues) + { + return addEnum(false, enumType, enumName, paramTypes, paramValues); + } + + @SuppressWarnings({ "unchecked", "serial" }) + private static > T addEnum(boolean test, final Class enumType, String enumName, final Class[] paramTypes, Object[] paramValues) { if (!isSetup) { @@ -243,14 +257,74 @@ public class EnumHelper if (valuesField == null) { - FMLLog.severe("Could not find $VALUES field for enum: %s", enumType.getName()); - FMLLog.severe("Runtime Deobf: %s", FMLForgePlugin.RUNTIME_DEOBF); - FMLLog.severe("Flags: %s", String.format("%16s", Integer.toBinaryString(flags)).replace(' ', '0')); - FMLLog.severe("Fields:"); + final List lines = Lists.newArrayList(); + lines.add(String.format("Could not find $VALUES field for enum: %s", enumType.getName())); + lines.add(String.format("Runtime Deobf: %s", FMLForgePlugin.RUNTIME_DEOBF)); + lines.add(String.format("Flags: %s", String.format("%16s", Integer.toBinaryString(flags)).replace(' ', '0'))); + lines.add( "Fields:"); for (Field field : fields) { String mods = String.format("%16s", Integer.toBinaryString(field.getModifiers())).replace(' ', '0'); - FMLLog.severe(" %s %s: %s", mods, field.getName(), field.getType().getName()); + lines.add(String.format(" %s %s: %s", mods, field.getName(), field.getType().getName())); + } + + for (String line : lines) + FMLLog.severe(line); + + if (test) + { + throw new EnhancedRuntimeException("Could not find $VALUES field for enum: " + enumType.getName()) + { + @Override + protected void printStackTrace(WrappedPrintStream stream) + { + for (String line : lines) + stream.println(line); + } + }; + } + return null; + } + + if (test) + { + Object ctr = null; + Exception ex = null; + try + { + ctr = getConstructorAccessor(enumType, paramTypes); + } + catch (Exception e) + { + ex = e; + } + if (ctr == null || ex != null) + { + throw new EnhancedRuntimeException(String.format("Could not find constructor for Enum %s", enumType.getName()), ex) + { + private String toString(Class[] cls) + { + StringBuilder b = new StringBuilder(); + for (int x = 0; x < cls.length; x++) + { + b.append(cls[x].getName()); + if (x != cls.length - 1) + b.append(", "); + } + return b.toString(); + } + @Override + protected void printStackTrace(WrappedPrintStream stream) + { + stream.println("Target Arguments:"); + stream.println(" java.lang.String, int, " + toString(paramTypes)); + stream.println("Found Constructors:"); + for (Constructor ctr : enumType.getDeclaredConstructors()) + { + stream.println(" " + toString(ctr.getParameterTypes())); + } + } + }; } return null; } From 2ca7cff075e333e1e1b19a9c7925d683934d068b Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 21 Mar 2016 17:56:33 -0700 Subject: [PATCH 131/243] Fix Chests not opening correctly with semi-solid blocks on top. --- patches/minecraft/net/minecraft/block/Block.java.patch | 2 +- patches/minecraft/net/minecraft/block/BlockChest.java.patch | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 603fb92489..e180526660 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -277,7 +277,7 @@ + */ + public boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side) + { -+ if (base_state.func_185896_q()) // Short circuit to vanilla function if its true ++ if (base_state.func_185896_q() && side == EnumFacing.UP) // Short circuit to vanilla function if its true + return true; + + IBlockState state = this.func_176221_a(base_state, world, pos); diff --git a/patches/minecraft/net/minecraft/block/BlockChest.java.patch b/patches/minecraft/net/minecraft/block/BlockChest.java.patch index 08fcab8974..4141d144f0 100644 --- a/patches/minecraft/net/minecraft/block/BlockChest.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockChest.java.patch @@ -5,7 +5,7 @@ private boolean func_176456_n(World p_176456_1_, BlockPos p_176456_2_) { - return p_176456_1_.func_180495_p(p_176456_2_.func_177984_a()).func_185915_l(); -+ return p_176456_1_.func_180495_p(p_176456_2_.func_177984_a()).isSideSolid(p_176456_1_, p_176456_2_, EnumFacing.DOWN); ++ return p_176456_1_.func_180495_p(p_176456_2_.func_177984_a()).isSideSolid(p_176456_1_, p_176456_2_.func_177984_a(), EnumFacing.DOWN); } private boolean func_176453_o(World p_176453_1_, BlockPos p_176453_2_) From cc5dea0df6e7be4eac57b5345c81eda27475a895 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 21 Mar 2016 17:56:48 -0700 Subject: [PATCH 132/243] Fixed Item.shouldCauseReequipAnimation hook. --- src/main/java/net/minecraftforge/client/ForgeHooksClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 45ef4d46c3..56eddd0923 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -639,7 +639,7 @@ public class ForgeHooksClient changed = slot != slotMainHand; slotMainHand = slot; } - return !from.getItem().shouldCauseReequipAnimation(from, to, changed); + return from.getItem().shouldCauseReequipAnimation(from, to, changed); } public static BlockFaceUV applyUVLock(BlockFaceUV blockFaceUV, EnumFacing originalSide, ITransformation rotation) From 08a3b654b992ac707080f3b01e49e3241a1ae16a Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 21 Mar 2016 18:20:15 -0700 Subject: [PATCH 133/243] Add ShieldDecoration and Tipped arrows to recipe sorter. Closes #2613 --- src/main/java/net/minecraftforge/oredict/RecipeSorter.java | 4 ++++ src/main/resources/forge_at.cfg | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/main/java/net/minecraftforge/oredict/RecipeSorter.java b/src/main/java/net/minecraftforge/oredict/RecipeSorter.java index 4ef622f883..341bb047c0 100644 --- a/src/main/java/net/minecraftforge/oredict/RecipeSorter.java +++ b/src/main/java/net/minecraftforge/oredict/RecipeSorter.java @@ -19,11 +19,13 @@ import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.RecipeBookCloning; import net.minecraft.item.crafting.RecipeFireworks; import net.minecraft.item.crafting.RecipeRepairItem; +import net.minecraft.item.crafting.RecipeTippedArrow; import net.minecraft.item.crafting.RecipesArmorDyes; import net.minecraft.item.crafting.RecipesMapCloning; import net.minecraft.item.crafting.RecipesMapExtending; import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.item.crafting.ShapelessRecipes; +import net.minecraft.item.crafting.ShieldRecipes; import net.minecraft.item.crafting.RecipesBanners.RecipeAddPattern; import net.minecraft.item.crafting.RecipesBanners.RecipeDuplicatePattern; import static net.minecraftforge.oredict.RecipeSorter.Category.*; @@ -118,8 +120,10 @@ public class RecipeSorter implements Comparator register("minecraft:shaped", ShapedRecipes.class, SHAPED, "before:minecraft:shapeless"); register("minecraft:mapextending", RecipesMapExtending.class, SHAPED, "after:minecraft:shaped before:minecraft:shapeless"); register("minecraft:shapeless", ShapelessRecipes.class, SHAPELESS, "after:minecraft:shaped"); + register("minecraft:shield_deco", ShieldRecipes.Decoration.class, SHAPELESS, "after:minecraft:shapeless"); //Size 2 register("minecraft:repair", RecipeRepairItem.class, SHAPELESS, "after:minecraft:shapeless"); //Size 4 register("minecraft:bookcloning", RecipeBookCloning.class, SHAPELESS, "after:minecraft:shapeless"); //Size 9 + register("minecraft:tippedarrow", RecipeTippedArrow.class, SHAPELESS, "after:minecraft:shapeless"); //Size 9 register("minecraft:fireworks", RecipeFireworks.class, SHAPELESS, "after:minecraft:shapeless"); //Size 10 register("minecraft:armordyes", RecipesArmorDyes.class, SHAPELESS, "after:minecraft:shapeless"); //Size 10 register("minecraft:mapcloning", RecipesMapCloning.class, SHAPELESS, "after:minecraft:shapeless"); //Size 10 diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index da08226c1a..0aab4689c6 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -110,6 +110,8 @@ public net.minecraft.world.gen.ChunkProviderServer field_73251_h # worldObj # RenderEntityItem protected net.minecraft.client.renderer.entity.RenderEntityItem func_177078_a(Lnet/minecraft/item/ItemStack;)I # getMiniItemCount +public net.minecraft.item.crafting.RecipeTippedArrow +public net.minecraft.item.crafting.ShieldRecipes$Decoration public net.minecraft.item.crafting.RecipesBanners$RecipeAddPattern public net.minecraft.item.crafting.RecipesBanners$RecipeDuplicatePattern public net.minecraft.block.state.BlockStateContainer$StateImplementation From c7b80202795785ca537d9188738e59fe1e7724d1 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 21 Mar 2016 18:20:30 -0700 Subject: [PATCH 134/243] Exclude jna from termal tansformer. --- .../fml/common/asm/transformers/TerminalTransformer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/fml/common/asm/transformers/TerminalTransformer.java b/src/main/java/net/minecraftforge/fml/common/asm/transformers/TerminalTransformer.java index 4b468c80c0..684edf1168 100644 --- a/src/main/java/net/minecraftforge/fml/common/asm/transformers/TerminalTransformer.java +++ b/src/main/java/net/minecraftforge/fml/common/asm/transformers/TerminalTransformer.java @@ -49,7 +49,8 @@ public class TerminalTransformer implements IClassTransformer clsName.equals("net/minecraftforge/fml/common/FMLCommonHandler") || clsName.startsWith("com/jcraft/jogg/") || clsName.startsWith("scala/sys/") || - clsName.startsWith("net/minecraft/server/gui/MinecraftServerGui") + clsName.startsWith("net/minecraft/server/gui/MinecraftServerGui") || + clsName.startsWith("com/sun/jna/") ); return new MethodVisitor(Opcodes.ASM5, super.visitMethod(mAccess, mName, mDesc, mSignature, mExceptions)) From dabb17f869a07ca2c506deb5848f05f79e774854 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Mon, 21 Mar 2016 20:31:33 -0500 Subject: [PATCH 135/243] Update according to suggestions --- .../entity/EntityLivingBase.java.patch | 15 +--- .../entity/passive/EntityHorse.java.patch | 11 +-- .../entity/player/EntityPlayer.java.patch | 23 ++---- .../items/wrapper/PlayerArmorInvWrapper.java | 33 +------- .../items/wrapper/PlayerMainInvWrapper.java | 50 +----------- .../wrapper/PlayerOffhandInvWrapper.java | 42 +--------- .../items/wrapper/RangedWrapper.java | 78 +++++++++++++++++++ 7 files changed, 100 insertions(+), 152 deletions(-) create mode 100644 src/main/java/net/minecraftforge/items/wrapper/RangedWrapper.java diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 4c463a58a9..5c4973476c 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -285,7 +285,7 @@ } this.func_184602_cy(); -@@ -2626,4 +2707,34 @@ +@@ -2626,4 +2707,27 @@ { return true; } @@ -300,16 +300,9 @@ + { + if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + { -+ if (facing == net.minecraft.util.EnumFacing.UP) -+ { -+ return (T) armorHandler; -+ } else if (facing.func_176740_k().func_176722_c()) -+ { -+ return (T) handHandler; -+ } else -+ { -+ return (T) joinedHandler; -+ } ++ if (facing == null) return (T) joinedHandler; ++ else if (facing.func_176740_k().func_176720_b()) return (T) handHandler; ++ else if (facing.func_176740_k().func_176722_c()) return (T) armorHandler; + } + return super.getCapability(capability, facing); + } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch index 4c14f0c217..5f4ea94e7a 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch @@ -16,7 +16,7 @@ } this.field_70138_W = 1.0F; -@@ -1793,4 +1795,25 @@ +@@ -1793,4 +1795,20 @@ this.field_188477_b = p_i46589_2_; } } @@ -27,18 +27,13 @@ + @Override + public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) + { -+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY -+ && itemHandler != null) -+ { -+ return (T) itemHandler; -+ } ++ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return (T) itemHandler; + return super.getCapability(capability, facing); + } + + @Override + public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) + { -+ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && itemHandler != null -+ || super.hasCapability(capability, facing); ++ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); + } } diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index ffdccb23e7..f0c090d776 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -401,7 +401,7 @@ if (this.func_70608_bn()) { -@@ -2340,6 +2447,169 @@ +@@ -2340,6 +2447,160 @@ return (float)this.func_110148_a(SharedMonsterAttributes.field_188792_h).func_111126_e(); } @@ -534,8 +534,9 @@ + public java.util.Collection getSuffixes() { return this.suffixes; } + + private final net.minecraftforge.items.IItemHandler playerMainHandler = new net.minecraftforge.items.wrapper.PlayerMainInvWrapper(field_71071_by); -+ private final net.minecraftforge.items.IItemHandler playerArmorHandler = new net.minecraftforge.items.wrapper.PlayerArmorInvWrapper(field_71071_by); -+ private final net.minecraftforge.items.IItemHandler playerOffhandHandler = new net.minecraftforge.items.wrapper.PlayerOffhandInvWrapper(field_71071_by); ++ private final net.minecraftforge.items.IItemHandler playerEquipmentHandler = new net.minecraftforge.items.wrapper.CombinedInvWrapper( ++ new net.minecraftforge.items.wrapper.PlayerArmorInvWrapper(field_71071_by), ++ new net.minecraftforge.items.wrapper.PlayerOffhandInvWrapper(field_71071_by)); + private final net.minecraftforge.items.IItemHandler playerJoinedHandler = new net.minecraftforge.items.wrapper.PlayerInvWrapper(field_71071_by); + + @Override @@ -543,19 +544,9 @@ + { + if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + { -+ if (facing == net.minecraft.util.EnumFacing.UP) -+ { -+ return (T) playerArmorHandler; -+ } else if (facing == net.minecraft.util.EnumFacing.DOWN) -+ { -+ return (T) playerMainHandler; -+ } else if (facing.func_176740_k().func_176722_c()) -+ { -+ return (T) playerOffhandHandler; -+ } else -+ { -+ return (T) playerJoinedHandler; -+ } ++ if (facing == null) return (T) playerJoinedHandler; ++ else if (facing.func_176740_k().func_176720_b()) return (T) playerMainHandler; ++ else if (facing.func_176740_k().func_176722_c()) return (T) playerEquipmentHandler; + } + return super.getCapability(capability, facing); + } diff --git a/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java index f8c70dd560..063bec7e1e 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java @@ -4,29 +4,14 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; -public class PlayerArmorInvWrapper extends InvWrapper +public class PlayerArmorInvWrapper extends RangedWrapper { public final InventoryPlayer inventoryPlayer; - private final int offset; public PlayerArmorInvWrapper(InventoryPlayer inv) { - super(inv); - + super(new InvWrapper(inv), inv.mainInventory.length, inv.mainInventory.length + inv.armorInventory.length); inventoryPlayer = inv; - offset = inventoryPlayer.mainInventory.length; - } - - @Override - public int getSlots() - { - return inventoryPlayer.armorInventory.length; - } - - @Override - public ItemStack getStackInSlot(int slot) - { - return super.getStackInSlot(slot + offset); } @Override @@ -44,20 +29,8 @@ public class PlayerArmorInvWrapper extends InvWrapper // check if it's valid for the armor slot if (slot < 4 && stack != null && stack.getItem().isValidArmor(stack, equ, inventoryPlayer.player)) { - return super.insertItem(slot + offset, stack, simulate); + return super.insertItem(slot, stack, simulate); } return stack; } - - @Override - public void setStackInSlot(int slot, ItemStack stack) - { - super.setStackInSlot(slot + offset, stack); - } - - @Override - public ItemStack extractItem(int slot, int amount, boolean simulate) - { - return super.extractItem(slot + offset, amount, simulate); - } } diff --git a/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java index 2893486895..421f654120 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java @@ -8,54 +8,19 @@ import net.minecraft.item.ItemStack; * Exposes the player inventory WITHOUT the armor inventory as IItemHandler. * Also takes core of inserting/extracting having the same logic as picking up items. */ -public class PlayerMainInvWrapper extends InvWrapper +public class PlayerMainInvWrapper extends RangedWrapper { public final InventoryPlayer inventoryPlayer; public PlayerMainInvWrapper(InventoryPlayer inv) { - super(inv); - + super(new InvWrapper(inv), 0, inv.mainInventory.length); inventoryPlayer = inv; } - @Override - public int getSlots() - { - return inventoryPlayer.mainInventory.length; - } - - @Override - public void setStackInSlot(int slot, ItemStack stack) - { - // prevent setting of armor and offhand - if (slot > getSlots()) - { - return; - } - super.setStackInSlot(slot, stack); - } - - @Override - public ItemStack getStackInSlot(int slot) - { - // prevent getting of armor and offhand - if (slot > getSlots()) - { - return null; - } - return super.getStackInSlot(slot); - } - @Override public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { - // prevent inserting into armor and offhand - if (slot > getSlots()) - { - return stack; - } - ItemStack rest = super.insertItem(slot, stack, simulate); if (rest == null || rest.stackSize != stack.stackSize) { @@ -74,15 +39,4 @@ public class PlayerMainInvWrapper extends InvWrapper } return rest; } - - @Override - public ItemStack extractItem(int slot, int amount, boolean simulate) - { - // prevent extraction from armor and offhand - if (slot > getSlots()) - { - return null; - } - return super.extractItem(slot, amount, simulate); - } } diff --git a/src/main/java/net/minecraftforge/items/wrapper/PlayerOffhandInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/PlayerOffhandInvWrapper.java index 5272a3ec39..0d3af4e8d9 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/PlayerOffhandInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/PlayerOffhandInvWrapper.java @@ -3,47 +3,11 @@ package net.minecraftforge.items.wrapper; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -public class PlayerOffhandInvWrapper extends InvWrapper +public class PlayerOffhandInvWrapper extends RangedWrapper { - public final InventoryPlayer inventoryPlayer; - private final int offset; - public PlayerOffhandInvWrapper(InventoryPlayer inv) { - super(inv); - - inventoryPlayer = inv; - offset = inventoryPlayer.mainInventory.length + inventoryPlayer.armorInventory.length; + super(new InvWrapper(inv), inv.mainInventory.length + inv.armorInventory.length, + inv.mainInventory.length + inv.armorInventory.length + inv.offHandInventory.length); } - - @Override - public int getSlots() - { - return inventoryPlayer.offHandInventory.length; - } - - @Override - public ItemStack getStackInSlot(int slot) - { - return super.getStackInSlot(slot + offset); - } - - @Override - public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) - { - return super.insertItem(slot + offset, stack, simulate); - } - - @Override - public void setStackInSlot(int slot, ItemStack stack) - { - super.setStackInSlot(slot + offset, stack); - } - - @Override - public ItemStack extractItem(int slot, int amount, boolean simulate) - { - return super.extractItem(slot + offset, amount, simulate); - } - } diff --git a/src/main/java/net/minecraftforge/items/wrapper/RangedWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/RangedWrapper.java new file mode 100644 index 0000000000..00b218eb68 --- /dev/null +++ b/src/main/java/net/minecraftforge/items/wrapper/RangedWrapper.java @@ -0,0 +1,78 @@ +package net.minecraftforge.items.wrapper; + +import com.google.common.base.Preconditions; +import net.minecraft.item.ItemStack; +import net.minecraftforge.items.IItemHandlerModifiable; + +/** + * A wrapper that composes another IItemHandlerModifiable, exposing only a range of the composed slots. + * Shifting of slot indices is handled automatically for you. + */ +public class RangedWrapper implements IItemHandlerModifiable { + + private final IItemHandlerModifiable compose; + private final int minSlot; + private final int maxSlot; + + public RangedWrapper(IItemHandlerModifiable compose, int minSlot, int maxSlotExclusive) + { + Preconditions.checkArgument(maxSlotExclusive > minSlot, "Max slot must be greater than min slot"); + this.compose = compose; + this.minSlot = minSlot; + this.maxSlot = maxSlotExclusive; + } + + @Override + public int getSlots() + { + return maxSlot - minSlot; + } + + @Override + public ItemStack getStackInSlot(int slot) + { + if (checkSlot(slot)) + { + return compose.getStackInSlot(slot + minSlot); + } + + return null; + } + + @Override + public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) + { + if (checkSlot(slot)) + { + return compose.insertItem(slot + minSlot, stack, simulate); + } + + return stack; + } + + @Override + public ItemStack extractItem(int slot, int amount, boolean simulate) + { + if (checkSlot(slot)) + { + return compose.extractItem(slot + minSlot, amount, simulate); + } + + return null; + } + + @Override + public void setStackInSlot(int slot, ItemStack stack) + { + if (checkSlot(slot)) + { + compose.setStackInSlot(slot + minSlot, stack); + } + } + + private boolean checkSlot(int localSlot) + { + return localSlot + minSlot < maxSlot; + } + +} From f14f77d44551fb25e9f55d823b78d872744fee97 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 21 Mar 2016 18:42:37 -0700 Subject: [PATCH 136/243] Fix pushing players inside blocks. --- .../minecraft/client/entity/EntityPlayerSP.java.patch | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch index 2388405186..107cb5f350 100644 --- a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -23,7 +23,7 @@ - if (!this.func_175162_d(blockpos)) + int entHeight = Math.max((int)Math.ceil(this.field_70131_O), 1); + -+ boolean inTranslucentBlock = this.isHeadspaceFree(blockpos, entHeight); ++ boolean inTranslucentBlock = !this.isHeadspaceFree(blockpos, entHeight); + + if (inTranslucentBlock) { @@ -31,28 +31,28 @@ double d2 = 9999.0D; - if (this.func_175162_d(blockpos.func_177976_e()) && d0 < d2) -+ if (!this.isHeadspaceFree(blockpos.func_177976_e(), entHeight) && d0 < d2) ++ if (this.isHeadspaceFree(blockpos.func_177976_e(), entHeight) && d0 < d2) { d2 = d0; i = 0; } - if (this.func_175162_d(blockpos.func_177974_f()) && 1.0D - d0 < d2) -+ if (!this.isHeadspaceFree(blockpos.func_177974_f(), entHeight) && 1.0D - d0 < d2) ++ if (this.isHeadspaceFree(blockpos.func_177974_f(), entHeight) && 1.0D - d0 < d2) { d2 = 1.0D - d0; i = 1; } - if (this.func_175162_d(blockpos.func_177978_c()) && d1 < d2) -+ if (!this.isHeadspaceFree(blockpos.func_177978_c(), entHeight) && d1 < d2) ++ if (this.isHeadspaceFree(blockpos.func_177978_c(), entHeight) && d1 < d2) { d2 = d1; i = 4; } - if (this.func_175162_d(blockpos.func_177968_d()) && 1.0D - d1 < d2) -+ if (!this.isHeadspaceFree(blockpos.func_177968_d(), entHeight) && 1.0D - d1 < d2) ++ if (this.isHeadspaceFree(blockpos.func_177968_d(), entHeight) && 1.0D - d1 < d2) { d2 = 1.0D - d1; i = 5; From caf3d01586a09a8a07656fa5913253342b9ca81a Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 21 Mar 2016 19:23:30 -0700 Subject: [PATCH 137/243] Make RenderLivingBase.add/remvoeLayer, Closes #2573 --- src/main/resources/forge_at.cfg | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index 0aab4689c6..fced62791a 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -283,4 +283,8 @@ private-f net.minecraft.world.gen.ChunkProviderHell field_185939_I #netherCaveGe private-f net.minecraft.world.gen.ChunkProviderHell field_73172_c #netherBridgeGenerator # PlayerManager -private-f net.minecraft.server.management.PlayerManager$PlayerInstance field_187285_e # field_187285_e \ No newline at end of file +private-f net.minecraft.server.management.PlayerManager$PlayerInstance field_187285_e # field_187285_e + +# RenderLivingBase +public net.minecraft.client.renderer.entity.RenderLivingBase func_177094_a(Lnet/minecraft/client/renderer/entity/layers/LayerRenderer;)Z # addLayer +public net.minecraft.client.renderer.entity.RenderLivingBase func_177089_b(Lnet/minecraft/client/renderer/entity/layers/LayerRenderer;)Z # removeLayer \ No newline at end of file From a365582b58ce98dba658261945684c8c9f423540 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 21 Mar 2016 19:24:12 -0700 Subject: [PATCH 138/243] Added support for custom dyes with Banners. Closes #2596 --- .../item/crafting/RecipesBanners.java.patch | 74 ++++++++++++++++++- 1 file changed, 72 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch index bddf21f35e..d5afab9c37 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch @@ -1,6 +1,19 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/RecipesBanners.java +++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesBanners.java -@@ -135,11 +135,7 @@ +@@ -89,9 +89,10 @@ + { + ItemStack itemstack2 = p_77572_1_.func_70301_a(j); + +- if (itemstack2 != null && itemstack2.func_77973_b() == Items.field_151100_aR) ++ int color = getColor(itemstack2); ++ if (color != -1) + { +- k = itemstack2.func_77960_j(); ++ k = color; + break; + } + } +@@ -135,11 +136,7 @@ for (int i = 0; i < aitemstack.length; ++i) { ItemStack itemstack = p_179532_1_.func_70301_a(i); @@ -13,7 +26,64 @@ } return aitemstack; -@@ -356,9 +352,9 @@ +@@ -164,7 +161,7 @@ + + if (itemstack != null && itemstack.func_77973_b() != Items.field_179564_cE) + { +- if (itemstack.func_77973_b() == Items.field_151100_aR) ++ if (isDye(itemstack)) + { + if (flag2) + { +@@ -204,7 +201,7 @@ + + if (itemstack1 != null && itemstack1.func_77973_b() != Items.field_179564_cE) + { +- if (itemstack1.func_77973_b() != Items.field_151100_aR) ++ if (!isDye(itemstack1)) + { + flag = false; + break; +@@ -245,6 +242,38 @@ + + return null; + } ++ ++ private static String[] colors = { "Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "LightGray", "Gray", "Pink", "Lime", "Yellow", "LightBlue", "Magenta", "Orange", "White" }; ++ @SuppressWarnings("unchecked") //Why java... ++ private static java.util.List[] colored = new java.util.List[colors.length]; ++ private static java.util.List dyes; ++ private static boolean hasInit = false; ++ private static void init() ++ { ++ if (hasInit) return; ++ for (int x = 0; x < colors.length; x++) ++ colored[x] = net.minecraftforge.oredict.OreDictionary.getOres("dye" + colors[x]); ++ dyes = net.minecraftforge.oredict.OreDictionary.getOres("dye"); ++ hasInit = true; ++ } ++ private boolean isDye(ItemStack stack) ++ { ++ init(); ++ for (ItemStack ore : dyes) ++ if (net.minecraftforge.oredict.OreDictionary.itemMatches(ore, stack, false)) ++ return true; ++ return false; ++ } ++ private int getColor(ItemStack stack) ++ { ++ init(); ++ if (stack == null) return -1; ++ for (int x = 0; x < colored.length; x++) ++ for (ItemStack ore : colored[x]) ++ if (net.minecraftforge.oredict.OreDictionary.itemMatches(ore, stack, true)) ++ return x; ++ return -1; ++ } + } + + public static class RecipeDuplicatePattern implements IRecipe +@@ -356,9 +385,9 @@ if (itemstack != null) { From d878c866b3b32ce0cc0462508b5ff5eeb4c57e66 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 21 Mar 2016 19:56:31 -0700 Subject: [PATCH 139/243] Allow finite fluids to be drained correctly --- .../java/net/minecraftforge/fluids/BlockFluidFinite.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java b/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java index af0b81035a..477f543f98 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java @@ -226,13 +226,14 @@ public class BlockFluidFinite extends BlockFluidBase @Override public FluidStack drain(World world, BlockPos pos, boolean doDrain) { + final FluidStack fluidStack = new FluidStack(getFluid(), MathHelper.floor_float(getQuantaPercentage(world, pos) * FluidContainerRegistry.BUCKET_VOLUME)); + if (doDrain) { world.setBlockToAir(pos); } - return new FluidStack(getFluid(), - MathHelper.floor_float(getQuantaPercentage(world, pos) * FluidContainerRegistry.BUCKET_VOLUME)); + return fluidStack; } @Override From 3ce53a7ee02e20faa6fe5a5322ec613581062ec3 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 21 Mar 2016 19:57:59 -0700 Subject: [PATCH 140/243] Make OreDictionary.initVanillaEntries() private so that dumb modders will stop calling it. --- src/main/java/net/minecraftforge/oredict/OreDictionary.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/oredict/OreDictionary.java b/src/main/java/net/minecraftforge/oredict/OreDictionary.java index 5202172444..05c1472c1c 100644 --- a/src/main/java/net/minecraftforge/oredict/OreDictionary.java +++ b/src/main/java/net/minecraftforge/oredict/OreDictionary.java @@ -51,7 +51,7 @@ public class OreDictionary initVanillaEntries(); } - public static void initVanillaEntries() + private static void initVanillaEntries() { if (!hasInit) { From b38cfc17694f69eb6fa605673efaf34fe6f14a77 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Mon, 21 Mar 2016 22:39:48 -0500 Subject: [PATCH 141/243] Actually fix dupe drop --- src/main/java/net/minecraftforge/common/ForgeHooks.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index ef548d4334..89a4607569 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -556,7 +556,7 @@ public class ForgeHooks return null; } - if (player.isServerWorld()) + if (!player.worldObj.isRemote) { player.getEntityWorld().spawnEntityInWorld(event.entityItem); } From a4d5760539d3b4d72b9989f0606d3e17a137b16f Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 21 Mar 2016 20:43:22 -0700 Subject: [PATCH 142/243] Fix swap animations for sure this time. --- .../net/minecraft/client/renderer/ItemRenderer.java.patch | 4 ++-- .../java/net/minecraftforge/client/ForgeHooksClient.java | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index 0bbb0a806c..d0f3d8a146 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -51,8 +51,8 @@ float f = entityplayersp.func_184825_o(1.0F); - this.field_187469_f += MathHelper.func_76131_a((Objects.equal(this.field_187467_d, itemstack) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); - this.field_187471_h += MathHelper.func_76131_a((float)(Objects.equal(this.field_187468_e, itemstack1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); -+ this.field_187469_f += MathHelper.func_76131_a((net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187467_d, itemstack, entityplayersp.field_71071_by.field_70461_c) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); -+ this.field_187471_h += MathHelper.func_76131_a((float)(net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187468_e, itemstack1, -1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); ++ this.field_187469_f += MathHelper.func_76131_a((!net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187467_d, itemstack, entityplayersp.field_71071_by.field_70461_c) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); ++ this.field_187471_h += MathHelper.func_76131_a((float)(!net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187468_e, itemstack1, -1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); } if (this.field_187469_f < 0.1F) diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 56eddd0923..972d696e90 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -629,10 +629,9 @@ public class ForgeHooksClient // FIXME public static boolean shouldCauseReequipAnimation(ItemStack from, ItemStack to, int slot) { - if(!Objects.equal(from, to) || from == null) - { - return Objects.equal(from, to); - } + if (from == null && to != null) return true; + if (from == null && to == null) return false; + if (from != null && to == null) return true; boolean changed = false; if (slot != -1) { From 08663587d4844999ee34ce298f0f27f50d3ba8e2 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 22 Mar 2016 09:01:00 +0300 Subject: [PATCH 143/243] Added Capability.cast, to allow avoiding unchecked casts in ICapabilityProvider.getCapability --- .../net/minecraft/entity/EntityLivingBase.java.patch | 3 ++- .../entity/item/EntityMinecartContainer.java.patch | 3 ++- .../minecraft/entity/passive/EntityHorse.java.patch | 3 ++- .../minecraft/entity/player/EntityPlayer.java.patch | 3 ++- .../tileentity/TileEntityBrewingStand.java.patch | 3 ++- .../minecraft/tileentity/TileEntityChest.java.patch | 3 ++- .../minecraft/tileentity/TileEntityFurnace.java.patch | 3 ++- .../tileentity/TileEntityLockable.java.patch | 3 ++- .../common/capabilities/Capability.java | 11 +++++++++++ .../common/model/animation/CapabilityAnimation.java | 3 +-- .../net/minecraftforge/debug/ModelAnimationDebug.java | 9 +++------ .../net/minecraftforge/test/NoBedSleepingTest.java | 3 +-- .../net/minecraftforge/test/TestCapabilityMod.java | 3 +-- 13 files changed, 33 insertions(+), 20 deletions(-) diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 5c4973476c..d616b61129 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -285,7 +285,7 @@ } this.func_184602_cy(); -@@ -2626,4 +2707,27 @@ +@@ -2626,4 +2707,28 @@ { return true; } @@ -295,6 +295,7 @@ + private final net.minecraftforge.items.IItemHandlerModifiable armorHandler = new net.minecraftforge.items.ItemStackHandler(field_184631_bt); + private final net.minecraftforge.items.IItemHandler joinedHandler = new net.minecraftforge.items.wrapper.CombinedInvWrapper(armorHandler, handHandler); + ++ @SuppressWarnings("unchecked") + @Override + public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) + { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch index ecc5f6bf95..5fa7ee0d0b 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch @@ -8,12 +8,13 @@ if (!this.field_70170_p.field_72995_K) { p_184230_1_.func_71007_a(this); -@@ -279,6 +280,24 @@ +@@ -279,6 +280,25 @@ } } + public net.minecraftforge.items.IItemHandler itemHandler = new net.minecraftforge.items.wrapper.InvWrapper(this); + ++ @SuppressWarnings("unchecked") + @Override + public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) + { diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch index 5f4ea94e7a..5c100f3b41 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch @@ -16,7 +16,7 @@ } this.field_70138_W = 1.0F; -@@ -1793,4 +1795,20 @@ +@@ -1793,4 +1795,21 @@ this.field_188477_b = p_i46589_2_; } } @@ -24,6 +24,7 @@ + // FORGE + private net.minecraftforge.items.IItemHandler itemHandler = null; // Initialized by initHorseChest above. + ++ @SuppressWarnings("unchecked") + @Override + public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) + { diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index f0c090d776..c39a9c7d75 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -401,7 +401,7 @@ if (this.func_70608_bn()) { -@@ -2340,6 +2447,160 @@ +@@ -2340,6 +2447,161 @@ return (float)this.func_110148_a(SharedMonsterAttributes.field_188792_h).func_111126_e(); } @@ -539,6 +539,7 @@ + new net.minecraftforge.items.wrapper.PlayerOffhandInvWrapper(field_71071_by)); + private final net.minecraftforge.items.IItemHandler playerJoinedHandler = new net.minecraftforge.items.wrapper.PlayerInvWrapper(field_71071_by); + ++ @SuppressWarnings("unchecked") + @Override + public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) + { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch index 0350d0b0b3..f70e7a8b87 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -63,13 +63,14 @@ } } -@@ -362,6 +361,20 @@ +@@ -362,6 +361,21 @@ } } + net.minecraftforge.items.IItemHandler handlerInput = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.UP); + net.minecraftforge.items.IItemHandler handlerOutput = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.DOWN); + ++ @SuppressWarnings("unchecked") + @Override + public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) + { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch index 41197c4dc5..d7766de5e6 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch @@ -8,12 +8,13 @@ } @SuppressWarnings("incomplete-switch") -@@ -457,6 +458,26 @@ +@@ -457,6 +458,27 @@ } } + public net.minecraftforge.items.VanillaDoubleChestItemHandler doubleChestHandler; + ++ @SuppressWarnings("unchecked") + @Override + public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) + { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch index abef4b007f..41e782be4f 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch @@ -75,7 +75,7 @@ } } -@@ -432,4 +443,21 @@ +@@ -432,4 +443,22 @@ this.field_145957_n[i] = null; } } @@ -84,6 +84,7 @@ + net.minecraftforge.items.IItemHandler handlerBottom = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.DOWN); + net.minecraftforge.items.IItemHandler handlerSide = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.WEST); + ++ @SuppressWarnings("unchecked") + @Override + public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) + { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch index 116d03a6be..6c31d0dcdd 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityLockable.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityLockable.java -@@ -47,4 +47,25 @@ +@@ -47,4 +47,26 @@ { return (ITextComponent)(this.func_145818_k_() ? new TextComponentString(this.func_70005_c_()) : new TextComponentTranslation(this.func_70005_c_(), new Object[0])); } @@ -12,6 +12,7 @@ + return new net.minecraftforge.items.wrapper.InvWrapper(this); + } + ++ @SuppressWarnings("unchecked") + @Override + public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) + { diff --git a/src/main/java/net/minecraftforge/common/capabilities/Capability.java b/src/main/java/net/minecraftforge/common/capabilities/Capability.java index 94627012a0..aecde88394 100644 --- a/src/main/java/net/minecraftforge/common/capabilities/Capability.java +++ b/src/main/java/net/minecraftforge/common/capabilities/Capability.java @@ -92,6 +92,17 @@ public class Capability return null; } + /** + * Use this inside ICapabilityProvider.getCapability to avoid unchecked cast warnings. + * Example: return SOME_CAPABILITY.cast(instance); + * Use with caution; + */ + @SuppressWarnings("unchecked") + public R cast(T instance) + { + return (R)instance; + } + // INTERNAL private final String name; private final IStorage storage; diff --git a/src/main/java/net/minecraftforge/common/model/animation/CapabilityAnimation.java b/src/main/java/net/minecraftforge/common/model/animation/CapabilityAnimation.java index 093afafb9c..9dde0aa0c4 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/CapabilityAnimation.java +++ b/src/main/java/net/minecraftforge/common/model/animation/CapabilityAnimation.java @@ -47,12 +47,11 @@ public class CapabilityAnimation return capability == ANIMATION_CAPABILITY; } - @SuppressWarnings("unchecked") public T getCapability(Capability capability, EnumFacing facing) { if(capability == ANIMATION_CAPABILITY) { - return (T)asm; + return ANIMATION_CAPABILITY.cast(asm); } return null; } diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index 727e1e9b96..05bb4b3c04 100644 --- a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -244,12 +244,11 @@ public class ModelAnimationDebug return capability == CapabilityAnimation.ANIMATION_CAPABILITY; } - @SuppressWarnings("unchecked") public T getCapability(Capability capability, EnumFacing facing) { if(capability == CapabilityAnimation.ANIMATION_CAPABILITY) { - return (T)asm; + return CapabilityAnimation.ANIMATION_CAPABILITY.cast(asm); } return null; } @@ -338,13 +337,12 @@ public class ModelAnimationDebug return super.hasCapability(capability, side); } - @SuppressWarnings("unchecked") @Override public T getCapability(Capability capability, EnumFacing side) { if(capability == CapabilityAnimation.ANIMATION_CAPABILITY) { - return (T)asm; + return CapabilityAnimation.ANIMATION_CAPABILITY.cast(asm); } return super.getCapability(capability, side); } @@ -396,13 +394,12 @@ public class ModelAnimationDebug return super.hasCapability(capability, side); } - @SuppressWarnings("unchecked") @Override public T getCapability(Capability capability, EnumFacing side) { if(capability == CapabilityAnimation.ANIMATION_CAPABILITY) { - return (T)asm; + return CapabilityAnimation.ANIMATION_CAPABILITY.cast(asm); } return super.getCapability(capability, side); } diff --git a/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java b/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java index 6b5d702f42..1dc9979a65 100644 --- a/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java +++ b/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java @@ -84,10 +84,9 @@ public class NoBedSleepingTest return capability == SLEEP_CAP; } - @SuppressWarnings("unchecked") @Override public T getCapability(Capability capability, EnumFacing facing) { - return capability == SLEEP_CAP ? (T)inst : null; + return capability == SLEEP_CAP ? SLEEP_CAP.cast(inst) : null; } @Override diff --git a/src/test/java/net/minecraftforge/test/TestCapabilityMod.java b/src/test/java/net/minecraftforge/test/TestCapabilityMod.java index 2e8ba82cec..8705900479 100644 --- a/src/test/java/net/minecraftforge/test/TestCapabilityMod.java +++ b/src/test/java/net/minecraftforge/test/TestCapabilityMod.java @@ -97,11 +97,10 @@ public class TestCapabilityMod { return TEST_CAP != null && capability == TEST_CAP; } - @SuppressWarnings("unchecked") //There isnt anything sane we can do about this. @Override public T getCapability(Capability capability, EnumFacing facing) { - if (TEST_CAP != null && capability == TEST_CAP) return (T)this; + if (TEST_CAP != null && capability == TEST_CAP) return TEST_CAP.cast(this); return null; } @Override From 25cd7cc3e1d8eb06c5db48d6ef735d8db0b1c1c9 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 22 Mar 2016 13:35:45 -0700 Subject: [PATCH 144/243] Update FML Entity Spawn packet for 1.9's location change. Closes #2567 --- .../network/internal/EntitySpawnHandler.java | 12 ++++---- .../common/network/internal/FMLMessage.java | 29 +++++++++---------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java b/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java index 2cf6b6e05b..dff8d30c06 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java @@ -9,6 +9,7 @@ import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityTracker; import net.minecraft.util.IThreadListener; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; @@ -61,7 +62,7 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler cls = er.getEntityClass(); @@ -77,7 +78,8 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler Date: Tue, 22 Mar 2016 15:29:42 -0700 Subject: [PATCH 145/243] Fixed custom entities unique ids. --- .../fml/common/network/internal/FMLMessage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java index 8dd01e97e1..30a552d078 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java @@ -140,8 +140,8 @@ public abstract class FMLMessage { super.toBytes(buf); ByteBufUtils.writeUTF8String(buf, modId); buf.writeInt(modEntityTypeId); - buf.writeLong(entityUUID.getMostSignificantBits()); - buf.writeLong(entityUUID.getLeastSignificantBits()); + buf.writeLong(entity.getUniqueID().getMostSignificantBits()); + buf.writeLong(entity.getUniqueID().getLeastSignificantBits()); // posX, posY, posZ buf.writeDouble(entity.posX); buf.writeDouble(entity.posY); From 9edd056f55a32a23addc7b2012f520d876d6fb23 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 22 Mar 2016 18:59:37 -0700 Subject: [PATCH 146/243] Fix typo causing biomes to be generated in wrong chunks. Closes #2632 --- .../net/minecraft/world/gen/layer/GenLayerBiome.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch index e0009992d4..61d673a2f7 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch @@ -50,7 +50,7 @@ else { - aint1[j + i * p_75904_3_] = BiomeGenBase.func_185362_a(this.field_151623_c[this.func_75902_a(this.field_151623_c.length)]); -+ aint1[k + i * p_75904_3_] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome); ++ aint1[j + i * p_75904_3_] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome); } } else if (k == 2) From 884cc690eab2bada93dbd6688942d41c10d998d4 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 23 Mar 2016 08:08:15 +0300 Subject: [PATCH 147/243] Show meaningful error if ModelLoaderRegistry is used before the missing model is initialized. --- .../net/minecraftforge/client/model/ModelLoaderRegistry.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index 664fb48933..46ae29dd22 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -192,6 +192,10 @@ public class ModelLoaderRegistry public static IModel getMissingModel() { + if(ModelLoader.VanillaLoader.INSTANCE.getLoader() == null) + { + throw new IllegalStateException("Using ModelLoaderRegistry too early."); + } return ModelLoader.VanillaLoader.INSTANCE.getLoader().getMissingModel(); } From 1d608c6fe479fbdf7c2029b8f56e8d8425c4608f Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 23 Mar 2016 08:19:02 +0300 Subject: [PATCH 148/243] Register the animation Capability. No idea how it worked before at some point. --- src/main/java/net/minecraftforge/common/ForgeModContainer.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/net/minecraftforge/common/ForgeModContainer.java b/src/main/java/net/minecraftforge/common/ForgeModContainer.java index 3ef4c7c7ba..e5f97310e1 100644 --- a/src/main/java/net/minecraftforge/common/ForgeModContainer.java +++ b/src/main/java/net/minecraftforge/common/ForgeModContainer.java @@ -24,6 +24,7 @@ import net.minecraft.world.storage.WorldInfo; import net.minecraftforge.classloading.FMLForgePlugin; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; +import net.minecraftforge.common.model.animation.CapabilityAnimation; import net.minecraftforge.common.network.ForgeNetworkHandler; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.items.CapabilityItemHandler; @@ -315,6 +316,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC public void preInit(FMLPreInitializationEvent evt) { CapabilityItemHandler.register(); + CapabilityAnimation.register(); MinecraftForge.EVENT_BUS.register(MinecraftForge.INTERNAL_HANDLER); ForgeChunkManager.captureConfig(evt.getModConfigurationDirectory()); MinecraftForge.EVENT_BUS.register(this); From ecd6f4c1d24bfc6640d9866af7ac63dac11369f1 Mon Sep 17 00:00:00 2001 From: iTitus Date: Wed, 23 Mar 2016 14:48:29 +0100 Subject: [PATCH 149/243] Add flashing update notification icon made by @gigaherz, closes #2582 It is added to the "Mods" button in the main menu and to out-of-date mods in the mod list (there it replaces the "U"). Also fixes a little typo. --- .../client/gui/GuiMainMenu.java.patch | 32 ++++++- .../gui/NotificationModUpdateScreen.java | 83 ++++++++++++++++++ .../minecraftforge/common/ForgeVersion.java | 55 ++++++++++-- .../minecraftforge/fml/client/GuiModList.java | 7 +- .../fml/client/GuiSlotModList.java | 33 +++---- .../textures/gui/version_check_icons.png | Bin 0 -> 463 bytes 6 files changed, 181 insertions(+), 29 deletions(-) create mode 100644 src/main/java/net/minecraftforge/client/gui/NotificationModUpdateScreen.java create mode 100644 src/main/resources/assets/forge/textures/gui/version_check_icons.png diff --git a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch index 08c531721a..4ffa6d84a8 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch @@ -1,16 +1,32 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java -@@ -216,7 +216,8 @@ +@@ -67,6 +67,8 @@ + private GuiButton field_175372_K; + private boolean field_183502_L; + private GuiScreen field_183503_M; ++ private GuiButton modButton; ++ private net.minecraftforge.client.gui.NotificationModUpdateScreen modUpdateNotification; + + public GuiMainMenu() + { +@@ -210,13 +212,15 @@ + this.field_183503_M.func_183500_a(this.field_146294_l, this.field_146295_m); + this.field_183503_M.func_73866_w_(); + } ++ modUpdateNotification = net.minecraftforge.client.gui.NotificationModUpdateScreen.init(this, modButton); + } + + private void func_73969_a(int p_73969_1_, int p_73969_2_) { this.field_146292_n.add(new GuiButton(1, this.field_146294_l / 2 - 100, p_73969_1_, I18n.func_135052_a("menu.singleplayer", new Object[0]))); this.field_146292_n.add(new GuiButton(2, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.func_135052_a("menu.multiplayer", new Object[0]))); - this.field_146292_n.add(this.field_175372_K = new GuiButton(14, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.func_135052_a("menu.online", new Object[0]))); + this.field_146292_n.add(this.field_175372_K = new GuiButton(14, this.field_146294_l / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.func_135052_a("menu.online", new Object[0]).replace("Minecraft", "").trim())); -+ this.field_146292_n.add(new GuiButton(6, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.func_135052_a("fml.menu.mods"))); ++ this.field_146292_n.add(modButton = new GuiButton(6, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.func_135052_a("fml.menu.mods"))); } private void func_73972_b(int p_73972_1_, int p_73972_2_) -@@ -264,6 +265,11 @@ +@@ -264,6 +268,11 @@ this.field_146297_k.func_71400_g(); } @@ -22,7 +38,7 @@ if (p_146284_1_.field_146127_k == 11) { this.field_146297_k.func_71371_a("Demo_World", "Demo_World", DemoWorldServer.field_73071_a); -@@ -512,7 +518,16 @@ +@@ -512,7 +521,16 @@ s = s + ("release".equalsIgnoreCase(this.field_146297_k.func_184123_d()) ? "" : "/" + this.field_146297_k.func_184123_d()); } @@ -40,3 +56,11 @@ String s1 = "Copyright Mojang AB. Do not distribute!"; this.func_73731_b(this.field_146289_q, s1, this.field_146294_l - this.field_146289_q.func_78256_a(s1) - 2, this.field_146295_m - 10, -1); +@@ -529,6 +547,7 @@ + { + this.field_183503_M.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_); + } ++ modUpdateNotification.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_); + } + + protected void func_73864_a(int p_73864_1_, int p_73864_2_, int p_73864_3_) throws IOException diff --git a/src/main/java/net/minecraftforge/client/gui/NotificationModUpdateScreen.java b/src/main/java/net/minecraftforge/client/gui/NotificationModUpdateScreen.java new file mode 100644 index 0000000000..33f533c6cd --- /dev/null +++ b/src/main/java/net/minecraftforge/client/gui/NotificationModUpdateScreen.java @@ -0,0 +1,83 @@ +package net.minecraftforge.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiMainMenu; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.ForgeModContainer; +import net.minecraftforge.common.ForgeVersion; +import net.minecraftforge.common.ForgeVersion.Status; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModContainer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class NotificationModUpdateScreen extends GuiScreen +{ + + private static final ResourceLocation VERSION_CHECK_ICONS = new ResourceLocation("forge", "textures/gui/version_check_icons.png"); + + private final GuiButton modButton; + private Status showNotification = null; + private boolean hasCheckedForUpdates = false; + + public NotificationModUpdateScreen(GuiButton modButton) + { + this.modButton = modButton; + } + + @Override + public void initGui() + { + if (!hasCheckedForUpdates) + { + if (modButton != null) + { + for (ModContainer mod : Loader.instance().getModList()) + { + Status status = ForgeVersion.getResult(mod).status; + if (status == Status.OUTDATED || status == Status.BETA_OUTDATED) + { + // TODO: Needs better visualization, maybe stacked icons + // drawn in a terrace-like pattern? + showNotification = Status.OUTDATED; + } + } + } + hasCheckedForUpdates = true; + } + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + if (showNotification == null || !showNotification.shouldDraw() || ForgeModContainer.disableVersionCheck) + { + return; + } + + Minecraft.getMinecraft().getTextureManager().bindTexture(VERSION_CHECK_ICONS); + GlStateManager.color(1, 1, 1, 1); + GlStateManager.pushMatrix(); + + int x = modButton.xPosition; + int y = modButton.yPosition; + int w = modButton.width; + int h = modButton.height; + + drawModalRectWithCustomSizedTexture(x + w - (h / 2 + 4), y + (h / 2 - 4), showNotification.getSheetOffset() * 8, (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, 8, 8, 64, 16); + GlStateManager.popMatrix(); + } + + public static NotificationModUpdateScreen init(GuiMainMenu guiMainMenu, GuiButton modButton) + { + NotificationModUpdateScreen notificationModUpdateScreen = new NotificationModUpdateScreen(modButton); + notificationModUpdateScreen.setGuiSize(guiMainMenu.width, guiMainMenu.height); + notificationModUpdateScreen.initGui(); + return notificationModUpdateScreen; + } + +} diff --git a/src/main/java/net/minecraftforge/common/ForgeVersion.java b/src/main/java/net/minecraftforge/common/ForgeVersion.java index 9660989000..13137562f9 100644 --- a/src/main/java/net/minecraftforge/common/ForgeVersion.java +++ b/src/main/java/net/minecraftforge/common/ForgeVersion.java @@ -85,13 +85,54 @@ public class ForgeVersion public static enum Status { - PENDING, - FAILED, - UP_TO_DATE, - OUTDATED, - AHEAD, - BETA, - BETA_OUTDATED + PENDING(), + FAILED(), + UP_TO_DATE(), + OUTDATED(3, true), + AHEAD(), + BETA(), + BETA_OUTDATED(6, true); + + final int sheetOffset; + final boolean draw, animated; + + Status() + { + this(0, false, false); + } + + Status(int sheetOffset) + { + this(sheetOffset, true, false); + } + + Status(int sheetOffset, boolean animated) + { + this(sheetOffset, true, animated); + } + + Status(int sheetOffset, boolean draw, boolean animated) + { + this.sheetOffset = sheetOffset; + this.draw = draw; + this.animated = animated; + } + + public int getSheetOffset() + { + return sheetOffset; + } + + public boolean shouldDraw() + { + return draw; + } + + public boolean isAnimated() + { + return animated; + } + } public static class CheckResult diff --git a/src/main/java/net/minecraftforge/fml/client/GuiModList.java b/src/main/java/net/minecraftforge/fml/client/GuiModList.java index 0f67480e66..e8f6d2c6d4 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiModList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiModList.java @@ -153,13 +153,14 @@ public class GuiModList extends GuiScreen @Override public void initGui() { + int slotHeight = 35; for (ModContainer mod : mods) { listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(mod.getName()) + 10); - listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(mod.getVersion()) + 10); + listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(mod.getVersion()) + 5 + slotHeight); } listWidth = Math.min(listWidth, 150); - this.modList = new GuiSlotModList(this, mods, listWidth); + this.modList = new GuiSlotModList(this, mods, listWidth, slotHeight); this.buttonList.add(new GuiButton(6, ((modList.right + this.width) / 2) - 100, this.height - 38, I18n.format("gui.done"))); configModButton = new GuiButton(20, 10, this.height - 49, this.listWidth, 20, "Config"); @@ -414,7 +415,7 @@ public class GuiModList extends GuiScreen lines.add("Child mods: " + selectedMod.getMetadata().getChildModList()); if (vercheck.status == Status.OUTDATED || vercheck.status == Status.BETA_OUTDATED) - lines.add("Update Avalible: " + (vercheck.url == null ? "" : vercheck.url)); + lines.add("Update Available: " + (vercheck.url == null ? "" : vercheck.url)); lines.add(null); lines.add(selectedMod.getMetadata().description); diff --git a/src/main/java/net/minecraftforge/fml/client/GuiSlotModList.java b/src/main/java/net/minecraftforge/fml/client/GuiSlotModList.java index 90198e1d21..45bbb2e4f7 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiSlotModList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiSlotModList.java @@ -14,8 +14,12 @@ package net.minecraftforge.fml.client; import java.util.ArrayList; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.StringUtils; import net.minecraftforge.common.ForgeVersion; import net.minecraftforge.common.ForgeVersion.CheckResult; @@ -29,12 +33,15 @@ import net.minecraftforge.fml.common.ModContainer; */ public class GuiSlotModList extends GuiScrollingList { + + private static final ResourceLocation VERSION_CHECK_ICONS = new ResourceLocation("forge", "textures/gui/version_check_icons.png"); + private GuiModList parent; private ArrayList mods; - public GuiSlotModList(GuiModList parent, ArrayList mods, int listWidth) + public GuiSlotModList(GuiModList parent, ArrayList mods, int listWidth, int slotHeight) { - super(parent.getMinecraftInstance(), listWidth, parent.height, 32, parent.height - 88 + 4, 10, 35, parent.width, parent.height); + super(parent.getMinecraftInstance(), listWidth, parent.height, 32, parent.height - 88 + 4, 10, slotHeight, parent.width, parent.height); this.parent = parent; this.mods = mods; } @@ -86,27 +93,23 @@ public class GuiSlotModList extends GuiScrollingList if (Loader.instance().getModState(mc) == ModState.DISABLED) { font.drawString(font.trimStringToWidth(name, listWidth - 10), this.left + 3 , top + 2, 0xFF2222); - font.drawString(font.trimStringToWidth(version, listWidth - 10), this.left + 3 , top + 12, 0xFF2222); + font.drawString(font.trimStringToWidth(version, listWidth - (5 + height)), this.left + 3 , top + 12, 0xFF2222); font.drawString(font.trimStringToWidth("DISABLED", listWidth - 10), this.left + 3 , top + 22, 0xFF2222); } else { font.drawString(font.trimStringToWidth(name, listWidth - 10), this.left + 3 , top + 2, 0xFFFFFF); - font.drawString(font.trimStringToWidth(version, listWidth - 10), this.left + 3 , top + 12, 0xCCCCCC); + font.drawString(font.trimStringToWidth(version, listWidth - (5 + height)), this.left + 3 , top + 12, 0xCCCCCC); font.drawString(font.trimStringToWidth(mc.getMetadata() != null ? mc.getMetadata().getChildModCountString() : "Metadata not found", listWidth - 10), this.left + 3 , top + 22, 0xCCCCCC); - switch(vercheck.status) //TODO: Change to icons? + if (vercheck.status.shouldDraw()) { - case BETA_OUTDATED: - case OUTDATED: - font.drawString("U", right - font.getCharWidth('U') - 1, top+height-font.FONT_HEIGHT+2, 0x22FF22); - break; - case AHEAD: - case BETA: - case FAILED: - case PENDING: - case UP_TO_DATE: - break; + //TODO: Consider adding more icons for visualization + Minecraft.getMinecraft().getTextureManager().bindTexture(VERSION_CHECK_ICONS); + GlStateManager.color(1, 1, 1, 1); + GlStateManager.pushMatrix(); + Gui.drawModalRectWithCustomSizedTexture(right - (height / 2 + 4), top + (height / 2 - 4), vercheck.status.getSheetOffset() * 8, (vercheck.status.isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16); + GlStateManager.popMatrix(); } } } diff --git a/src/main/resources/assets/forge/textures/gui/version_check_icons.png b/src/main/resources/assets/forge/textures/gui/version_check_icons.png new file mode 100644 index 0000000000000000000000000000000000000000..5d5f0fa294faae8783568e467e6123e5ad40b859 GIT binary patch literal 463 zcmV;=0WkiFP)vp|DPy ze?afP+q>}AADoYS-}!_jOdVMk0sym=!1yGMe29aOZ1RF7A`S+{Hx@qsdB@dyhB%!j zcE*VreM9i#hfG}ir)(4F-4YVR^GMDmfJi^EI0}gg|Jx6lc>A_9q zojqRhp2_wuaX7)~_LP<(c=e6!0SE4_uX}(O-}eDn3ziHP8*tx0dOaO=!bp#7z*@58 zzkOphXy Date: Wed, 23 Mar 2016 19:51:15 +0100 Subject: [PATCH 150/243] Fix BlockCrops.getDrops not respecting new age methods (for beetroots) --- patches/minecraft/net/minecraft/block/BlockCrops.java.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch index 05b445d3c9..bd8c469962 100644 --- a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch @@ -32,16 +32,16 @@ + public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { + java.util.List ret = super.getDrops(world, pos, state, fortune); -+ int age = ((Integer)state.func_177229_b(func_185524_e())).intValue(); ++ int age = func_185527_x(state); + Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); + -+ if (age >= 7) ++ if (age >= func_185526_g()) + { + int k = 3 + fortune; + + for (int i = 0; i < 3 + fortune; ++i) + { -+ if (rand.nextInt(15) <= age) ++ if (rand.nextInt(2 * func_185526_g()) <= age) + { + ret.add(new ItemStack(this.func_149866_i(), 1, 0)); + } From bc5313c67b1c064ad6e0d749ffd563bc5cc76fcf Mon Sep 17 00:00:00 2001 From: Take Weiland Date: Thu, 24 Mar 2016 02:17:32 +0100 Subject: [PATCH 151/243] Fix PopulateChunkEvent.Post not firing --- src/main/java/net/minecraftforge/event/ForgeEventFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index f8d41684e7..cdbac5b1d1 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -550,7 +550,7 @@ public class ForgeEventFactory public static void onChunkPopulate(boolean pre, IChunkGenerator gen, World world, int x, int z, boolean hasVillageGenerated) { - MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(gen, world, world.rand, x, z, hasVillageGenerated)); + MinecraftForge.EVENT_BUS.post(pre ? new PopulateChunkEvent.Pre(gen, world, world.rand, x, z, hasVillageGenerated) : new PopulateChunkEvent.Post(gen, world, world.rand, x, z, hasVillageGenerated)); } } From 7e4d7077a582b09c94d19893adac512508bf941f Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 23 Mar 2016 19:09:49 -0700 Subject: [PATCH 152/243] New Builder class in BlockStateContainer. Makes building containers with both listed and unlisted properties cleaner. Make all methods of BiomeGenBase$BiomeProperties public so that modders can use that class outside subclasses. --- .../state/BlockStateContainer.java.patch | 54 ++++++++++++++++++- src/main/resources/forge_at.cfg | 9 ++-- 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch b/patches/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch index 8b119b7e21..fa321efa14 100644 --- a/patches/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch +++ b/patches/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch @@ -49,7 +49,7 @@ public Collection < IProperty> func_177227_a() { return Collections. < IProperty> unmodifiableCollection(this.field_177237_b.keySet()); -@@ -414,5 +431,34 @@ +@@ -414,5 +431,86 @@ { return this.field_177239_a.func_185481_k(this); } @@ -83,4 +83,56 @@ + return this.field_177239_a.doesSideBlockRendering(this, world, pos, side); + } } ++ ++ /** ++ * Forge added class to make building things easier. ++ * Will return an instance of BlockStateContainer appropriate for ++ * the list of properties passed in. ++ * ++ * Example usage: ++ * ++ * protected BlockStateContainer createBlockState() ++ * { ++ * return (new BlockStateContainer.Builder(this)).add(FACING).add(SOME_UNLISTED).build(); ++ * } ++ * ++ */ ++ public static class Builder ++ { ++ private final Block block; ++ private final List> listed = Lists.newArrayList(); ++ private final List> unlisted = Lists.newArrayList(); ++ ++ public Builder(Block block) ++ { ++ this.block = block; ++ } ++ ++ public Builder add(IProperty... props) ++ { ++ for (IProperty prop : props) ++ this.listed.add(prop); ++ return this; ++ } ++ ++ public Builder add(net.minecraftforge.common.property.IUnlistedProperty... props) ++ { ++ for (net.minecraftforge.common.property.IUnlistedProperty prop : props) ++ this.unlisted.add(prop); ++ return this; ++ } ++ ++ public BlockStateContainer build() ++ { ++ IProperty[] listed = new IProperty[this.listed.size()]; ++ listed = this.listed.toArray(listed); ++ if (this.unlisted.size() == 0) ++ return new BlockStateContainer(this.block, listed); ++ ++ net.minecraftforge.common.property.IUnlistedProperty[] unlisted = new net.minecraftforge.common.property.IUnlistedProperty[this.unlisted.size()]; ++ unlisted = this.unlisted.toArray(unlisted); ++ ++ return new net.minecraftforge.common.property.ExtendedBlockState(this.block, listed, unlisted); ++ } ++ } } diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index fced62791a..316062b14f 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -51,6 +51,7 @@ public net.minecraft.world.biome.BiomeGenPlains *() public net.minecraft.world.biome.BiomeGenSavanna *() public net.minecraft.world.biome.BiomeGenSnow *() public net.minecraft.world.biome.BiomeGenTaiga *() +public net.minecraft.world.biome.BiomeGenBase$BiomeProperties *() # Map Gen Biome Lists public+f net.minecraft.world.gen.structure.MapGenStronghold field_151546_e # MapGenVillage @@ -94,7 +95,7 @@ public net.minecraft.network.play.server.SPacketBlockChange field_148883_d # blo public-f net.minecraft.world.WorldType field_77139_a #worldTypes # DamageSource public net.minecraft.util.DamageSource *() #All methods public, most are already -# EntityAITasks +# EntityAITasks public net.minecraft.entity.ai.EntityAITasks field_75782_a # taskEntries # EntityXPOrb public net.minecraft.entity.item.EntityXPOrb field_70530_e # xpValue @@ -102,7 +103,7 @@ public net.minecraft.entity.item.EntityXPOrb field_70530_e # xpValue public net.minecraft.world.gen.structure.StructureVillagePieces$Village # RenderPlayer public net.minecraft.client.renderer.entity.RenderBiped field_77071_a #modelBipedMain -# ChunkProviderServer +# ChunkProviderServer public net.minecraft.world.gen.ChunkProviderServer field_186029_c # chunkGenerator public net.minecraft.world.gen.ChunkProviderServer field_73244_f # loadedChunkHashMap public net.minecraft.world.gen.ChunkProviderServer field_73245_g # loadedChunks @@ -159,7 +160,7 @@ public net.minecraft.client.renderer.VertexBuffer func_178972_a(IIIII)V # putCol #public net.minecraft.client.renderer.block.model.ModelBlock (Lnet/minecraft/util/ResourceLocation;Ljava/util/List;Ljava/util/Map;ZZLnet/minecraft/client/renderer/block/model/ItemCameraTransforms;)V # RenderLivingEntity #public net.minecraft.client.renderer.entity.RenderLivingBase func_177094_a(Lnet/minecraft/client/renderer/entity/layers/LayerRenderer;)Z # addLayer - + # S00PacketServerInfo public net.minecraft.network.status.server.SPacketServerInfo field_149297_a # GSON @@ -287,4 +288,4 @@ private-f net.minecraft.server.management.PlayerManager$PlayerInstance field_187 # RenderLivingBase public net.minecraft.client.renderer.entity.RenderLivingBase func_177094_a(Lnet/minecraft/client/renderer/entity/layers/LayerRenderer;)Z # addLayer -public net.minecraft.client.renderer.entity.RenderLivingBase func_177089_b(Lnet/minecraft/client/renderer/entity/layers/LayerRenderer;)Z # removeLayer \ No newline at end of file +public net.minecraft.client.renderer.entity.RenderLivingBase func_177089_b(Lnet/minecraft/client/renderer/entity/layers/LayerRenderer;)Z # removeLayer From a9d23f5e781ccddb2860bc90eec28f72944681b9 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 23 Mar 2016 17:34:48 +0300 Subject: [PATCH 153/243] Cleanup: removed IEEP, removed redundant casts, fixed imports, fixed typos. --- .../TileEntityBrewingStand.java.patch | 2 +- .../client/ClientCommandHandler.java | 2 +- .../client/EnumHelperClient.java | 5 +- .../client/ForgeHooksClient.java | 3 +- .../minecraftforge/client/GuiIngameForge.java | 12 ++-- .../client/event/EntityViewRenderEvent.java | 1 - .../client/model/Attributes.java | 2 +- .../client/model/BlockStateLoader.java | 7 +- .../client/model/ForgeBlockStateV1.java | 2 +- .../client/model/IModelWithSubmodels.java | 12 ---- .../client/model/MapModelState.java | 2 +- .../client/model/ModelFluid.java | 5 +- .../client/model/ModelLoader.java | 13 ++-- .../client/model/animation/Animation.java | 2 +- .../model/animation/ModelBlockAnimation.java | 4 +- .../client/model/b3d/B3DClip.java | 2 +- .../client/model/b3d/B3DLoader.java | 8 +-- .../client/model/b3d/B3DModel.java | 4 +- .../client/model/obj/OBJModel.java | 13 ++-- .../common/BiomeDictionary.java | 8 +-- .../common/DimensionManager.java | 6 +- .../minecraftforge/common/DungeonHooks.java | 2 +- .../common/ForgeChunkManager.java | 63 +++++++++-------- .../net/minecraftforge/common/ForgeHooks.java | 27 ++------ .../common/ForgeInternalHandler.java | 10 ++- .../common/ForgeModContainer.java | 6 +- .../minecraftforge/common/ForgeVersion.java | 2 +- .../common/IExtendedEntityProperties.java | 39 ----------- .../common/IMinecartCollisionHandler.java | 2 +- .../minecraftforge/common/ISpecialArmor.java | 2 +- .../common/WorldSpecificSaveHandler.java | 4 +- .../common/brewing/BrewingRecipeRegistry.java | 4 +- .../capabilities/CapabilityManager.java | 2 +- .../common/config/ConfigElement.java | 26 +++---- .../common/config/Configuration.java | 24 +++---- .../common/model/TRSRTransformation.java | 2 +- .../common/property/ExtendedBlockState.java | 36 +++++----- .../common/util/AsynchronousExecutor.java | 67 +++++++++---------- .../common/util/BlockSnapshot.java | 4 +- .../common/util/EnumHelper.java | 23 +++---- .../minecraftforge/common/util/JsonUtils.java | 8 +-- .../event/AttachCapabilitiesEvent.java | 2 +- .../event/ForgeEventFactory.java | 10 ++- .../event/entity/item/ItemExpireEvent.java | 2 +- .../entity/living/LivingAttackEvent.java | 11 +-- .../living/LivingEntityUseItemEvent.java | 3 +- .../event/entity/living/LivingHurtEvent.java | 13 ++-- .../event/entity/player/ArrowLooseEvent.java | 1 + .../event/entity/player/ArrowNockEvent.java | 1 + .../event/entity/player/BonemealEvent.java | 2 +- .../event/entity/player/FillBucketEvent.java | 2 +- .../entity/player/PlayerDestroyItemEvent.java | 2 +- .../entity/player/PlayerFlyableFallEvent.java | 11 ++- .../entity/player/PlayerInteractEvent.java | 2 +- .../entity/player/PlayerWakeUpEvent.java | 28 +++++--- .../event/entity/player/UseHoeEvent.java | 2 +- .../event/terraingen/PopulateChunkEvent.java | 6 +- .../event/terraingen/TerrainGen.java | 13 ++-- .../event/world/BlockEvent.java | 2 +- .../event/world/NoteBlockEvent.java | 9 +-- .../event/world/WorldEvent.java | 2 +- .../minecraftforge/fluids/BlockFluidBase.java | 10 ++- .../fluids/BlockFluidFinite.java | 16 ++--- .../fluids/FluidContainerRegistry.java | 2 +- .../net/minecraftforge/fluids/FluidUtil.java | 12 ++-- ...CustomModLoadingErrorDisplayException.java | 2 +- .../fml/client/FMLClientHandler.java | 8 +-- .../minecraftforge/fml/client/GuiModList.java | 6 +- .../fml/client/GuiOldSaveLoadConfirm.java | 8 +-- .../fml/client/GuiScrollingList.java | 3 +- .../fml/client/SplashProgress.java | 64 ++---------------- .../fml/client/config/DummyConfigElement.java | 44 ++++++------ .../fml/client/config/GuiConfig.java | 6 +- .../fml/client/config/GuiConfigEntries.java | 2 +- .../client/config/GuiEditArrayEntries.java | 4 +- .../fml/client/config/GuiMessageDialog.java | 2 +- .../client/config/GuiUnicodeGlyphButton.java | 6 +- .../fml/client/registry/ClientRegistry.java | 2 +- .../fml/common/FMLCommonHandler.java | 4 +- .../fml/common/FMLContainer.java | 1 - .../fml/common/FMLModContainer.java | 12 ++-- .../fml/common/ILanguageAdapter.java | 6 +- .../fml/common/LoadController.java | 4 +- .../net/minecraftforge/fml/common/Loader.java | 2 +- .../net/minecraftforge/fml/common/Mod.java | 2 +- .../fml/common/ProxyInjector.java | 2 +- .../asm/transformers/AccessTransformer.java | 8 +-- .../DeobfuscationTransformer.java | 2 +- .../EventSubscriberTransformer.java | 2 +- .../EventSubscriptionTransformer.java | 8 +-- .../asm/transformers/MarkerTransformer.java | 2 +- .../asm/transformers/ModAPITransformer.java | 2 +- .../asm/transformers/SideTransformer.java | 6 +- .../asm/transformers/TerminalTransformer.java | 4 +- .../deobf/FMLDeobfuscatingRemapper.java | 12 ++-- .../fml/common/discovery/ASMDataTable.java | 2 +- .../fml/common/event/FMLInterModComms.java | 2 +- .../fml/common/eventhandler/Event.java | 4 +- .../eventhandler/IEventExceptionHandler.java | 2 +- .../functions/CollectionWrapperFactory.java | 8 +-- .../fml/common/launcher/FMLDeobfTweaker.java | 2 +- .../fml/common/launcher/Yggdrasil.java | 2 +- .../fml/common/network/ByteBufUtils.java | 2 +- .../FMLIndexedMessageToMessageCodec.java | 5 +- .../common/network/FMLOutboundHandler.java | 12 ++-- .../common/network/PacketLoggingHandler.java | 11 ++- .../network/handshake/NetworkDispatcher.java | 19 +++--- .../network/internal/EntitySpawnHandler.java | 2 +- .../common/network/internal/FMLMessage.java | 13 ++-- .../network/internal/FMLNetworkHandler.java | 2 +- .../network/internal/FMLProxyPacket.java | 2 +- .../network/simpleimpl/MessageContext.java | 2 +- .../fml/common/patcher/ClassPatchManager.java | 2 +- .../fml/common/registry/EntityRegistry.java | 21 +++--- .../FMLControlledNamespacedRegistry.java | 19 +++--- .../fml/common/registry/GameData.java | 3 +- .../registry/PersistentRegistryManager.java | 30 ++++----- .../fml/common/registry/RegistryDelegate.java | 10 +-- .../common/toposort/ModSortingException.java | 4 -- .../fml/common/toposort/TopologicalSort.java | 2 +- .../fml/relauncher/CoreModManager.java | 4 +- .../com/nothome/delta/DebugDiffWriter.java | 2 +- .../com/nothome/delta/GDiffWriter.java | 2 +- .../items/wrapper/CombinedInvWrapper.java | 2 +- .../wrapper/PlayerOffhandInvWrapper.java | 1 - .../minecraftforge/oredict/OreDictionary.java | 8 +-- .../minecraftforge/oredict/RecipeSorter.java | 23 +++---- .../oredict/ShapedOreRecipe.java | 6 +- .../oredict/ShapelessOreRecipe.java | 6 +- .../server/ForgeTimeTracker.java | 2 +- .../server/command/ForgeCommand.java | 1 - .../debug/ModelLoaderRegistryDebug.java | 2 +- .../test/NoBedSleepingTest.java | 2 +- 133 files changed, 489 insertions(+), 623 deletions(-) delete mode 100644 src/main/java/net/minecraftforge/client/model/IModelWithSubmodels.java delete mode 100644 src/main/java/net/minecraftforge/common/IExtendedEntityProperties.java diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch index f70e7a8b87..bba76fd606 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -20,7 +20,7 @@ private void func_145940_l() { -+ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBreaw(field_145945_j)) return; ++ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBrew(field_145945_j)) return; ItemStack itemstack = this.field_145945_j[3]; - for (int i = 0; i < 3; ++i) diff --git a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java index be724ebfe5..6a91caa0b6 100644 --- a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java +++ b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java @@ -49,7 +49,7 @@ public class ClientCommandHandler extends CommandHandler String[] args = new String[temp.length - 1]; String commandName = temp[0]; System.arraycopy(temp, 1, args, 0, args.length); - ICommand icommand = (ICommand) getCommands().get(commandName); + ICommand icommand = getCommands().get(commandName); try { diff --git a/src/main/java/net/minecraftforge/client/EnumHelperClient.java b/src/main/java/net/minecraftforge/client/EnumHelperClient.java index 95a3f9997d..62604d9e78 100644 --- a/src/main/java/net/minecraftforge/client/EnumHelperClient.java +++ b/src/main/java/net/minecraftforge/client/EnumHelperClient.java @@ -7,8 +7,7 @@ import net.minecraftforge.common.util.EnumHelper; public class EnumHelperClient extends EnumHelper { - @SuppressWarnings("rawtypes") - private static Class[][] clentTypes = + private static Class[][] clientTypes = { {GameType.class, int.class, String.class}, {Options.class, String.class, boolean.class, boolean.class}, @@ -32,6 +31,6 @@ public class EnumHelperClient extends EnumHelper public static > T addEnum(Class enumType, String enumName, Object... paramValues) { - return addEnum(clentTypes, enumType, enumName, paramValues); + return addEnum(clientTypes, enumType, enumName, paramValues); } } diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 972d696e90..20e279275d 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -90,7 +90,6 @@ import net.minecraftforge.fml.common.FMLLog; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.BufferUtils; -import com.google.common.base.Objects; import com.google.common.base.Optional; import com.google.common.collect.Maps; @@ -110,7 +109,7 @@ public class ForgeHooksClient } //Optifine Helper Functions u.u, these are here specifically for Optifine - //Note: When using Optfine, these methods are invoked using reflection, which + //Note: When using Optifine, these methods are invoked using reflection, which //incurs a major performance penalty. public static void orientBedCamera(IBlockAccess world, BlockPos pos, IBlockState state, Entity entity) { diff --git a/src/main/java/net/minecraftforge/client/GuiIngameForge.java b/src/main/java/net/minecraftforge/client/GuiIngameForge.java index 267356b943..6fff3a25ca 100644 --- a/src/main/java/net/minecraftforge/client/GuiIngameForge.java +++ b/src/main/java/net/minecraftforge/client/GuiIngameForge.java @@ -148,7 +148,7 @@ public class GuiIngameForge extends GuiIngame renderExperience(width, height); } - renderToolHightlight(res); + renderToolHighlight(res); renderHUDText(width, height); renderPotionIcons(res); renderRecordOverlay(width, height, partialTicks); @@ -466,21 +466,21 @@ public class GuiIngameForge extends GuiIngame int x = left - i * 8 - 9; int y = top; int icon = 16; - byte backgound = 0; + byte background = 0; if (mc.thePlayer.isPotionActive(MobEffects.hunger)) { icon += 36; - backgound = 13; + background = 13; } - if (unused) backgound = 1; //Probably should be a += 1 but vanilla never uses this + if (unused) background = 1; //Probably should be a += 1 but vanilla never uses this if (player.getFoodStats().getSaturationLevel() <= 0.0F && updateCounter % (level * 3 + 1) == 0) { y = top + (rand.nextInt(3) - 1); } - drawTexturedModalRect(x, y, 16 + backgound * 9, 27, 9, 9); + drawTexturedModalRect(x, y, 16 + background * 9, 27, 9, 9); if (unused) { @@ -602,7 +602,7 @@ public class GuiIngameForge extends GuiIngame post(JUMPBAR); } - protected void renderToolHightlight(ScaledResolution res) + protected void renderToolHighlight(ScaledResolution res) { if (this.mc.gameSettings.heldItemTooltips && !this.mc.playerController.isSpectator()) { diff --git a/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java b/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java index 90e73e3fc2..9d046fa417 100644 --- a/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java +++ b/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java @@ -1,6 +1,5 @@ package net.minecraftforge.client.event; -import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.entity.Entity; diff --git a/src/main/java/net/minecraftforge/client/model/Attributes.java b/src/main/java/net/minecraftforge/client/model/Attributes.java index df3581fd4d..c84d24f5ba 100644 --- a/src/main/java/net/minecraftforge/client/model/Attributes.java +++ b/src/main/java/net/minecraftforge/client/model/Attributes.java @@ -33,7 +33,7 @@ public class Attributes int padding = 0; int j = 0; - for(VertexFormatElement firstAttr : (List)first.getElements()) + for(VertexFormatElement firstAttr : first.getElements()) { while(j < second.getElementCount() && second.getElement(j).getUsage() == EnumUsage.PADDING) { diff --git a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java index 8497735ce8..6657f7a6aa 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java +++ b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java @@ -16,7 +16,6 @@ import net.minecraft.client.renderer.block.model.VariantList; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.model.IModelState; import net.minecraftforge.common.model.TRSRTransformation; -import net.minecraftforge.fml.common.FMLLog; import org.apache.commons.io.Charsets; import org.apache.commons.io.IOUtils; @@ -159,7 +158,7 @@ public class BlockStateLoader } /** - * Used to replace the base model with a retextured model containing submodels. + * Used to replace the base model with a re-textured model containing sub-models. */ @Override public IModel process(IModel base) @@ -176,9 +175,9 @@ public class BlockStateLoader return base; } - // Apply rotation of base model to submodels. + // Apply rotation of base model to sub-models. // If baseRot is non-null, then that rotation will be applied instead of the base model's rotation. - // This is used to allow replacing base model with a submodel when there is no base model for a variant. + // This is used to allow replacing base model with a sub-model when there is no base model for a variant. IModelState baseTr = getState(); ImmutableMap.Builder> models = ImmutableMap.builder(); for (Entry entry : parts.entrySet()) diff --git a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java index 2d6095eb96..ea7b56446b 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java @@ -473,7 +473,7 @@ public class ForgeBlockStateV1 extends Marker for (Entry e : json.get("textures").getAsJsonObject().entrySet()) { if (e.getValue().isJsonNull()) - ret.textures.put(e.getKey(), ""); // We have to use "" because ImmutibleMaps don't allow nulls -.- + ret.textures.put(e.getKey(), ""); // We have to use "" because ImmutableMaps don't allow nulls -.- else ret.textures.put(e.getKey(), e.getValue().getAsString()); } diff --git a/src/main/java/net/minecraftforge/client/model/IModelWithSubmodels.java b/src/main/java/net/minecraftforge/client/model/IModelWithSubmodels.java deleted file mode 100644 index f259f9e94a..0000000000 --- a/src/main/java/net/minecraftforge/client/model/IModelWithSubmodels.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.minecraftforge.client.model; - -import com.google.common.collect.ImmutableSet; - -/** - * Created by rainwarrior on 2/2/16. - */ -public interface IModelWithSubmodels> extends IModel -{ - M setDefaultSubmodelEnabled (boolean value); - M setSubmodelsEnabled(ImmutableSet submodelNames, boolean show); -} diff --git a/src/main/java/net/minecraftforge/client/model/MapModelState.java b/src/main/java/net/minecraftforge/client/model/MapModelState.java index 831404ebc1..5f5dbc9ad4 100644 --- a/src/main/java/net/minecraftforge/client/model/MapModelState.java +++ b/src/main/java/net/minecraftforge/client/model/MapModelState.java @@ -31,7 +31,7 @@ public class MapModelState implements IModelState public MapModelState(Map map, IModelState def) { - this.map = ImmutableMap.copyOf(map); + this.map = ImmutableMap.copyOf(map); this.def = def; } diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index 6767265ac8..dc39944064 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -10,18 +10,17 @@ import javax.vecmath.Vector4f; 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.block.model.ModelRotation; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ModelRotation; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; -import net.minecraftforge.client.model.pipeline.LightUtil; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; import net.minecraftforge.common.model.IModelPart; import net.minecraftforge.common.model.IModelState; diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 4014840672..e0c2d064d2 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -717,16 +717,13 @@ public final class ModelLoader extends ModelBakery IModel model = ModelLoaderRegistry.getModel(loc); // FIXME: is this the place? messes up dependency and texture resolution - if (v instanceof ISmartVariant) + model = v.process(model); + for(ResourceLocation location : model.getDependencies()) { - model = ((ISmartVariant)v).process(model); - for(ResourceLocation location : model.getDependencies()) - { - ModelLoaderRegistry.getModelOrMissing(location); - } - //FMLLog.getLogger().error("Exception resolving indirect dependencies for model" + loc, e); - textures.addAll(model.getTextures()); // Kick this, just in case. + ModelLoaderRegistry.getModelOrMissing(location); } + //FMLLog.getLogger().error("Exception resolving indirect dependencies for model" + loc, e); + textures.addAll(model.getTextures()); // Kick this, just in case. models.add(model); builder.add(Pair.of(model, v.getState())); diff --git a/src/main/java/net/minecraftforge/client/model/animation/Animation.java b/src/main/java/net/minecraftforge/client/model/animation/Animation.java index 953bbafae3..59c3700364 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/Animation.java +++ b/src/main/java/net/minecraftforge/client/model/animation/Animation.java @@ -33,7 +33,7 @@ public enum Animation } /** - * Iternal hook, do not use. + * Internal hook, do not use. */ public static void setClientPartialTickTime(float clientPartialTickTime) { Animation.INSTANCE.clientPartialTickTime = clientPartialTickTime; diff --git a/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java b/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java index 8ecae39062..42e5818d5f 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java +++ b/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java @@ -551,12 +551,12 @@ public class ModelBlockAnimation } catch(IOException e) { - FMLLog.log(Level.ERROR, e, "Exception loading vanilla model aniamtion %s, skipping", armatureLocation); + FMLLog.log(Level.ERROR, e, "Exception loading vanilla model animation %s, skipping", armatureLocation); return defaultModelBlockAnimation; } catch(JsonParseException e) { - FMLLog.log(Level.ERROR, e, "Exception loading vanilla model aniamtion %s, skipping", armatureLocation); + FMLLog.log(Level.ERROR, e, "Exception loading vanilla model animation %s, skipping", armatureLocation); return defaultModelBlockAnimation; } } diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java index a8b640e5df..50b1407fd5 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java @@ -60,7 +60,7 @@ public enum B3DClip implements IClip { ret = ret.compose(new TRSRTransformation(node.getPos(), node.getRot(), node.getScale(), null)); } - // TODO animated TRSR for speed? + // TODO animated TRSRTransformation for speed? else { ret = ret.compose(endTr); diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index bd499275d7..4b8095dd05 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -74,7 +74,7 @@ import com.google.gson.JsonParser; /* * Loader for Blitz3D models. - * To enable for your mod call instance.addDomain(modid). + * To enable for your mod call instance.addDomain(modId). * If you need more control over accepted resources - extend the class, and register a new instance with ModelLoaderRegistry. */ public enum B3DLoader implements ICustomModelLoader @@ -139,7 +139,7 @@ public enum B3DLoader implements ICustomModelLoader { return new ModelWrapper(modelLocation, model, ImmutableSet.of(), true, true, 1); } - return new ModelWrapper(modelLocation, model, ImmutableSet.of(((Node)model.getRoot()).getName()), true, true, 1); + return new ModelWrapper(modelLocation, model, ImmutableSet.of(model.getRoot().getName()), true, true, 1); } public static final class B3DState implements IModelState @@ -208,7 +208,7 @@ public enum B3DLoader implements ICustomModelLoader public Optional apply(Optional part) { - // TODO optionify better + // TODO make more use of Optional if(!part.isPresent()) return parent.apply(part); if(!(part.get() instanceof NodeJoint)) { @@ -277,7 +277,7 @@ public enum B3DLoader implements ICustomModelLoader // current node local pose ret = ret.compose(new TRSRTransformation(key.getPos(), key.getRot(), key.getScale(), null)); // this part moved inside the model - // inverse bind of the curent node + // inverse bind of the current node /*Matrix4f rm = new TRSRTransformation(node.getPos(), node.getRot(), node.getScale(), null).getMatrix(); rm.invert(); ret = ret.compose(new TRSRTransformation(rm)); diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java index 3cc123107b..e8cde42cd2 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java @@ -60,7 +60,7 @@ public class B3DModel public static class Parser { - private static final int version = 0001; + private static final int version = 1; private final ByteBuffer buf; private byte[] tag = new byte[4]; @@ -204,7 +204,7 @@ public class B3DModel if(version / 100 > Parser.version / 100) throw new IOException("Unsupported major model version: " + ((float)version / 100)); if(version % 100 > Parser.version % 100) - logger.warn(String.format("Minor version differnce in model: ", ((float)version / 100))); + logger.warn(String.format("Minor version difference in model: ", ((float)version / 100))); List textures = Collections.emptyList(); List brushes = Collections.emptyList(); Node root = null; diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index 86b3fd44f8..3efab8d738 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -22,6 +22,7 @@ import javax.vecmath.Vector4f; 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; @@ -29,17 +30,17 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.IResource; import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.*; -import net.minecraftforge.client.model.pipeline.LightUtil; +import net.minecraftforge.client.model.IModel; +import net.minecraftforge.client.model.IModelCustomData; +import net.minecraftforge.client.model.IPerspectiveAwareModel; +import net.minecraftforge.client.model.IRetexturableModel; +import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; import net.minecraftforge.common.model.IModelPart; import net.minecraftforge.common.model.IModelState; import net.minecraftforge.common.model.TRSRTransformation; -import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; import net.minecraftforge.fml.common.FMLLog; @@ -1281,7 +1282,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData INSTANCE; public String getName() { - return "OBJPropery"; + return "OBJProperty"; } @Override diff --git a/src/main/java/net/minecraftforge/common/BiomeDictionary.java b/src/main/java/net/minecraftforge/common/BiomeDictionary.java index 2d430055b6..786aa1584d 100644 --- a/src/main/java/net/minecraftforge/common/BiomeDictionary.java +++ b/src/main/java/net/minecraftforge/common/BiomeDictionary.java @@ -71,8 +71,8 @@ public class BiomeDictionary /** * Retrieves a Type value by name, * if one does not exist already it creates one. - * This can be used as interm measure for modders to - * add there own category of Biome. + * This can be used as intermediate measure for modders to + * add their own category of Biome. * * There are NO naming conventions besides: * MUST be all upper case (enforced by name.toUpper()) @@ -187,7 +187,7 @@ public class BiomeDictionary { if(typeInfoList[type.ordinal()] != null) { - return (BiomeGenBase[])typeInfoList[type.ordinal()].toArray(new BiomeGenBase[0]); + return typeInfoList[type.ordinal()].toArray(new BiomeGenBase[0]); } return new BiomeGenBase[0]; @@ -202,7 +202,7 @@ public class BiomeDictionary public static Type[] getTypesForBiome(BiomeGenBase biome) { checkRegistration(biome); - return (Type[])getBiomeInfo(biome).typeList.toArray(new Type[0]); + return getBiomeInfo(biome).typeList.toArray(new Type[0]); } /** diff --git a/src/main/java/net/minecraftforge/common/DimensionManager.java b/src/main/java/net/minecraftforge/common/DimensionManager.java index b329436cb0..4d788ef5d6 100644 --- a/src/main/java/net/minecraftforge/common/DimensionManager.java +++ b/src/main/java/net/minecraftforge/common/DimensionManager.java @@ -136,7 +136,7 @@ public class DimensionManager int leakCount = leakedWorlds.count(System.identityHashCode(w)); if (leakCount == 5) { - FMLLog.fine("The world %x (%s) may have leaked: first encounter (5 occurences).\n", System.identityHashCode(w), w.getWorldInfo().getWorldName()); + FMLLog.fine("The world %x (%s) may have leaked: first encounter (5 occurrences).\n", System.identityHashCode(w), w.getWorldInfo().getWorldName()); } else if (leakCount % 5 == 0) { @@ -259,7 +259,7 @@ public class DimensionManager } catch (Exception e) { - FMLCommonHandler.instance().getFMLLogger().log(Level.ERROR, String.format("An error occured trying to create an instance of WorldProvider %d (%s)", + FMLCommonHandler.instance().getFMLLogger().log(Level.ERROR, String.format("An error occurred trying to create an instance of WorldProvider %d (%s)", dim, getProviderType(dim)),e); throw new RuntimeException(e); } @@ -372,7 +372,7 @@ public class DimensionManager { if (DimensionManager.getWorld(0) != null) { - return ((SaveHandler)DimensionManager.getWorld(0).getSaveHandler()).getWorldDirectory(); + return DimensionManager.getWorld(0).getSaveHandler().getWorldDirectory(); }/* else if (MinecraftServer.getServer() != null) { diff --git a/src/main/java/net/minecraftforge/common/DungeonHooks.java b/src/main/java/net/minecraftforge/common/DungeonHooks.java index 211ff296b3..2a2f178b2a 100644 --- a/src/main/java/net/minecraftforge/common/DungeonHooks.java +++ b/src/main/java/net/minecraftforge/common/DungeonHooks.java @@ -68,7 +68,7 @@ public class DungeonHooks */ public static String getRandomDungeonMob(Random rand) { - DungeonMob mob = (DungeonMob)WeightedRandom.getRandomItem(rand, dungeonMobs); + DungeonMob mob = WeightedRandom.getRandomItem(rand, dungeonMobs); if (mob == null) { return ""; diff --git a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java index c5eb772a96..bf17bc1dc8 100644 --- a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java +++ b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java @@ -15,10 +15,31 @@ import java.util.Map; import java.util.Set; import java.util.UUID; -import com.google.common.base.Function; -import com.google.common.collect.Iterables; -import com.google.common.collect.Iterators; +import javax.annotation.Nullable; + +import net.minecraft.entity.Entity; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.ClassInheritanceMultiMap; +import net.minecraft.util.math.MathHelper; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.common.config.ConfigCategory; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; +import net.minecraftforge.common.util.Constants; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModContainer; +import net.minecraftforge.fml.common.eventhandler.Event; + import org.apache.logging.log4j.Level; + +import com.google.common.base.Function; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.google.common.collect.ArrayListMultimap; @@ -29,6 +50,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSetMultimap; +import com.google.common.collect.Iterators; import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.ListMultimap; import com.google.common.collect.MapMaker; @@ -37,29 +59,6 @@ import com.google.common.collect.Multimap; import com.google.common.collect.SetMultimap; import com.google.common.collect.Sets; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.common.eventhandler.Event; -import net.minecraft.server.MinecraftServer; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.ChunkCoordIntPair; -import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.entity.Entity; -import net.minecraft.util.ClassInheritanceMultiMap; -import net.minecraft.util.math.MathHelper; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.world.World; -import net.minecraft.world.WorldServer; -import net.minecraftforge.common.config.ConfigCategory; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Property; -import net.minecraftforge.common.util.Constants; - -import javax.annotation.Nullable; - /** * Manages chunkloading for mods. * @@ -422,7 +421,7 @@ public class ForgeChunkManager static void loadWorld(World world) { - ArrayListMultimap newTickets = ArrayListMultimap.create(); + ArrayListMultimap newTickets = ArrayListMultimap.create(); tickets.put(world, newTickets); forcedChunks.put(world, ImmutableSetMultimap.of()); @@ -439,7 +438,7 @@ public class ForgeChunkManager if (chunkLoaderData.exists() && chunkLoaderData.isFile()) { - ArrayListMultimap loadedTickets = ArrayListMultimap.create(); + ArrayListMultimap loadedTickets = ArrayListMultimap.create(); Map> playerLoadedTickets = Maps.newHashMap(); NBTTagCompound forcedChunkData; try @@ -454,7 +453,7 @@ public class ForgeChunkManager NBTTagList ticketList = forcedChunkData.getTagList("TicketList", Constants.NBT.TAG_COMPOUND); for (int i = 0; i < ticketList.tagCount(); i++) { - NBTTagCompound ticketHolder = (NBTTagCompound)ticketList.getCompoundTagAt(i); + NBTTagCompound ticketHolder = ticketList.getCompoundTagAt(i); String modId = ticketHolder.getString("Owner"); boolean isPlayer = "Forge".equals(modId); @@ -473,7 +472,7 @@ public class ForgeChunkManager NBTTagList tickets = ticketHolder.getTagList("Tickets", Constants.NBT.TAG_COMPOUND); for (int j = 0; j < tickets.tagCount(); j++) { - NBTTagCompound ticket = (NBTTagCompound) tickets.getCompoundTagAt(j); + NBTTagCompound ticket = tickets.getCompoundTagAt(j); modId = ticket.hasKey("ModId") ? ticket.getString("ModId") : modId; Type type = Type.values()[ticket.getByte("Type")]; //byte ticketChunkDepth = ticket.getByte("ChunkListDepth"); @@ -940,7 +939,7 @@ public class ForgeChunkManager { for (ClassInheritanceMultiMap eList : chunk.getEntityLists()) { - Iterator itr = (Iterator)eList.iterator(); + Iterator itr = eList.iterator(); while (itr.hasNext()) { (itr.next()).resetEntityId(); @@ -966,7 +965,7 @@ public class ForgeChunkManager dest.delete(); } cfgFile.renameTo(dest); - FMLLog.log(Level.ERROR, e, "A critical error occured reading the forgeChunkLoading.cfg file, defaults will be used - the invalid file is backed up at forgeChunkLoading.cfg.bak"); + FMLLog.log(Level.ERROR, e, "A critical error occurred reading the forgeChunkLoading.cfg file, defaults will be used - the invalid file is backed up at forgeChunkLoading.cfg.bak"); } syncConfigDefaults(); } diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 89a4607569..c7fd9f66ef 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -20,23 +20,15 @@ import java.util.regex.Pattern; import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; -import net.minecraft.block.BlockTrapDoor; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLeashKnot; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.entity.item.EntityBoat; -import net.minecraft.entity.item.EntityEnderCrystal; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.item.EntityItemFrame; -import net.minecraft.entity.item.EntityMinecart; import net.minecraft.entity.item.EntityMinecartContainer; -import net.minecraft.entity.item.EntityPainting; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; @@ -46,18 +38,14 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerRepair; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemBucket; -import net.minecraft.item.ItemMonsterPlacer; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagString; import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.Packet; import net.minecraft.network.play.server.SPacketBlockChange; @@ -83,7 +71,6 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraft.world.WorldSettings; import net.minecraft.world.WorldSettings.GameType; -import net.minecraft.world.gen.feature.WorldGeneratorBonusChest; import net.minecraftforge.common.util.BlockSnapshot; import net.minecraftforge.event.AnvilUpdateEvent; import net.minecraftforge.event.ForgeEventFactory; @@ -100,7 +87,6 @@ import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent; import net.minecraftforge.event.entity.player.AnvilRepairEvent; import net.minecraftforge.event.entity.player.AttackEntityEvent; -import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; import net.minecraftforge.event.entity.player.PlayerOpenContainerEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.NoteBlockEvent; @@ -129,7 +115,7 @@ public class ForgeHooks public static ItemStack getGrassSeed(Random rand, int fortune) { - SeedEntry entry = (SeedEntry)WeightedRandom.getRandomItem(rand, seedList); + SeedEntry entry = WeightedRandom.getRandomItem(rand, seedList); if (entry == null || entry.seed == null) { return null; @@ -426,7 +412,7 @@ public class ForgeHooks if (target.typeOfHit == RayTraceResult.Type.BLOCK) { - s1 = ((ResourceLocation)Block.blockRegistry.getNameForObject(world.getBlockState(target.getBlockPos()).getBlock())).toString(); + s1 = Block.blockRegistry.getNameForObject(world.getBlockState(target.getBlockPos()).getBlock()).toString(); } else if (target.typeOfHit == RayTraceResult.Type.ENTITY) { @@ -461,7 +447,7 @@ public class ForgeHooks } //Optifine Helper Functions u.u, these are here specifically for Optifine - //Note: When using Optfine, these methods are invoked using reflection, which + //Note: When using Optifine, these methods are invoked using reflection, which //incurs a major performance penalty. public static void onLivingSetAttackTarget(EntityLivingBase entity, EntityLivingBase target) { @@ -481,7 +467,7 @@ public class ForgeHooks public static float onLivingHurt(EntityLivingBase entity, DamageSource src, float amount) { LivingHurtEvent event = new LivingHurtEvent(entity, src, amount); - return (MinecraftForge.EVENT_BUS.post(event) ? 0 : event.ammount); + return (MinecraftForge.EVENT_BUS.post(event) ? 0 : event.getAmount()); } public static boolean onLivingDeath(EntityLivingBase entity, DamageSource src) @@ -568,7 +554,6 @@ public class ForgeHooks return world.getBlockState(pos).getBlock().getEnchantPowerBonus(world, pos); } - @SuppressWarnings("deprecation") public static ITextComponent onServerChatEvent(NetHandlerPlayServer net, String raw, ITextComponent comp) { ServerChatEvent event = new ServerChatEvent(net.playerEntity, raw, comp); @@ -907,11 +892,11 @@ public class ForgeHooks { filled *= -1; //filled -= 0.11111111F; //Why this is needed.. not sure... - return eyes > (double)(pos.getY() + 1 + (1 - filled)); + return eyes > pos.getY() + 1 + (1 - filled); } else { - return eyes < (double)(pos.getY() + 1 + filled); + return eyes < pos.getY() + 1 + filled; } } diff --git a/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java b/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java index a7eb78d02f..43295be8e2 100644 --- a/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java +++ b/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java @@ -1,18 +1,16 @@ package net.minecraftforge.common; -import com.google.common.base.Optional; -import net.minecraft.network.datasync.DataSerializers; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.eventhandler.EventPriority; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.WorldServer; import net.minecraftforge.common.util.FakePlayerFactory; -import net.minecraftforge.event.entity.*; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class ForgeInternalHandler { diff --git a/src/main/java/net/minecraftforge/common/ForgeModContainer.java b/src/main/java/net/minecraftforge/common/ForgeModContainer.java index e5f97310e1..cf4dd7722e 100644 --- a/src/main/java/net/minecraftforge/common/ForgeModContainer.java +++ b/src/main/java/net/minecraftforge/common/ForgeModContainer.java @@ -170,7 +170,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC propOrder.add(prop.getName()); prop = config.get(CATEGORY_GENERAL, "sortRecipies", true); - prop.comment = "Set to true to enable the post initialization sorting of crafting recipes using Forge's sorter. May cause desyncing on conflicting recipies. MUST RESTART MINECRAFT IF CHANGED FROM THE CONFIG GUI."; + prop.comment = "Set to true to enable the post initialization sorting of crafting recipes using Forge's sorter. May cause desyncing on conflicting recipes. MUST RESTART MINECRAFT IF CHANGED FROM THE CONFIG GUI."; prop.setLanguageKey("forge.configgui.sortRecipies").setRequiresMcRestart(true); shouldSortRecipies = prop.getBoolean(shouldSortRecipies); propOrder.add(prop.getName()); @@ -202,7 +202,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC disableStitchedFileSaving = prop.getBoolean(true); prop = config.get(Configuration.CATEGORY_GENERAL, "fullBoundingBoxLadders", false); - prop.comment = "Set this to true to check the entire entity's collision bounding box for ladders instead of just the block they are in. Causes noticable differences in mechanics so default is vanilla behavior. Default: false"; + prop.comment = "Set this to true to check the entire entity's collision bounding box for ladders instead of just the block they are in. Causes noticeable differences in mechanics so default is vanilla behavior. Default: false"; prop.setLanguageKey("forge.configgui.fullBoundingBoxLadders").setRequiresWorldRestart(true); fullBoundingBoxLadders = prop.getBoolean(false); propOrder.add(prop.getName()); @@ -226,7 +226,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC propOrder.add(prop.getName()); prop = config.get(Configuration.CATEGORY_GENERAL, "defaultSpawnFuzz", 20, - "The spawn fuzz when a player respawns in the world, this is controlable by WorldType, this config option is for the default overworld.", + "The spawn fuzz when a player respawns in the world, this is controllable by WorldType, this config option is for the default overworld.", 1, Integer.MAX_VALUE); prop.setLanguageKey("forge.configgui.spawnfuzz").setRequiresWorldRestart(false); defaultSpawnFuzz = prop.getInt(20); diff --git a/src/main/java/net/minecraftforge/common/ForgeVersion.java b/src/main/java/net/minecraftforge/common/ForgeVersion.java index 9660989000..4b9063fce3 100644 --- a/src/main/java/net/minecraftforge/common/ForgeVersion.java +++ b/src/main/java/net/minecraftforge/common/ForgeVersion.java @@ -119,7 +119,7 @@ public class ForgeVersion { if (!ForgeModContainer.getConfig().get(ForgeModContainer.VERSION_CHECK_CAT, "Global", true).getBoolean()) { - FMLLog.log("ForgeVersionCheck", Level.INFO, "Global Forge version check system disabeld, no futher processing."); + FMLLog.log("ForgeVersionCheck", Level.INFO, "Global Forge version check system disabled, no further processing."); return; } diff --git a/src/main/java/net/minecraftforge/common/IExtendedEntityProperties.java b/src/main/java/net/minecraftforge/common/IExtendedEntityProperties.java deleted file mode 100644 index 87ea4da8ce..0000000000 --- a/src/main/java/net/minecraftforge/common/IExtendedEntityProperties.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.minecraftforge.common; - -import net.minecraft.entity.Entity; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; - -/** - * Allows for custom entity data and logic to be hooked to existing entity classes. - * - * @author cpw, mithion - * - */ -public interface IExtendedEntityProperties { - /** - * Called when the entity that this class is attached to is saved. - * Any custom entity data that needs saving should be saved here. - * @param compound The compound to save to. - */ - public void saveNBTData(NBTTagCompound compound); - - /** - * Called when the entity that this class is attached to is loaded. - * In order to hook into this, you will need to subscribe to the EntityConstructing event. - * Otherwise, you will need to initialize manually. - * @param compound The compound to load from. - */ - public void loadNBTData(NBTTagCompound compound); - - /** - * Used to initialize the extended properties with the entity that this is attached to, as well - * as the world object. - * Called automatically if you register with the EntityConstructing event. - * May be called multiple times if the extended properties is moved over to a new entity. - * Such as when a player switches dimension {Minecraft re-creates the player entity} - * @param entity The entity that this extended properties is attached to - * @param world The world in which the entity exists - */ - public void init(Entity entity, World world); -} diff --git a/src/main/java/net/minecraftforge/common/IMinecartCollisionHandler.java b/src/main/java/net/minecraftforge/common/IMinecartCollisionHandler.java index b0251dcfe7..35b99d39af 100644 --- a/src/main/java/net/minecraftforge/common/IMinecartCollisionHandler.java +++ b/src/main/java/net/minecraftforge/common/IMinecartCollisionHandler.java @@ -14,7 +14,7 @@ public interface IMinecartCollisionHandler { /** - * This basically replaces the function of the same name in EnityMinecart. + * This basically replaces the function of the same name in EntityMinecart. * Code in IMinecartHooks.applyEntityCollisionHook is still run. * @param cart The cart that called the collision. * @param other The object it collided with. diff --git a/src/main/java/net/minecraftforge/common/ISpecialArmor.java b/src/main/java/net/minecraftforge/common/ISpecialArmor.java index 27bf880369..9b1fbdef99 100644 --- a/src/main/java/net/minecraftforge/common/ISpecialArmor.java +++ b/src/main/java/net/minecraftforge/common/ISpecialArmor.java @@ -71,7 +71,7 @@ public interface ISpecialArmor public int AbsorbMax = Integer.MAX_VALUE; public double AbsorbRatio = 0; public int Slot = 0; - private static final boolean DEBUG = false; //Only enable this if you wish to be spamed with debugging information. + private static final boolean DEBUG = false; //Only enable this if you wish to be spammed with debugging information. //Left it in because I figured it'd be useful for modders developing custom armor. public ArmorProperties(int priority, double ratio, int max) diff --git a/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java b/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java index c2249355ad..d71840509b 100644 --- a/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java +++ b/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java @@ -44,7 +44,7 @@ public class WorldSpecificSaveHandler implements ISaveHandler @Override public File getMapFileFromName(String name) { - if (dataDir == null) //Delayed down here do that world has time to be initalized first. + if (dataDir == null) //Delayed down here do that world has time to be initialized first. { dataDir = new File(world.getChunkSaveLocation(), "data"); dataDir.mkdirs(); @@ -76,7 +76,7 @@ public class WorldSpecificSaveHandler implements ISaveHandler } catch (IOException e) { - FMLLog.log(Level.ERROR, e, "A critical error occured copying %s to world specific dat folder - new file will be created.", parentFile.getName()); + FMLLog.log(Level.ERROR, e, "A critical error occurred copying %s to world specific dat folder - new file will be created.", parentFile.getName()); } } } diff --git a/src/main/java/net/minecraftforge/common/brewing/BrewingRecipeRegistry.java b/src/main/java/net/minecraftforge/common/brewing/BrewingRecipeRegistry.java index af55434bc0..7905ff03a9 100644 --- a/src/main/java/net/minecraftforge/common/brewing/BrewingRecipeRegistry.java +++ b/src/main/java/net/minecraftforge/common/brewing/BrewingRecipeRegistry.java @@ -84,7 +84,7 @@ public class BrewingRecipeRegistry { /** * Returns true if the passed input and ingredient have an output */ - public static boolean hasOuput(ItemStack input, ItemStack ingredient) + public static boolean hasOutput(ItemStack input, ItemStack ingredient) { return getOutput(input, ingredient) != null; } @@ -100,7 +100,7 @@ public class BrewingRecipeRegistry { for (int i : inputIndexes) { - if (hasOuput(inputs[i], ingredient)) + if (hasOutput(inputs[i], ingredient)) { return true; } diff --git a/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java b/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java index 5e319e1734..9c9f08ade8 100644 --- a/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java +++ b/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java @@ -42,7 +42,7 @@ public enum CapabilityManager public T call() throws Exception { try { - return (T)implementation.newInstance(); + return implementation.newInstance(); } catch (InstantiationException e) { Throwables.propagate(e); } catch (IllegalAccessException e) { diff --git a/src/main/java/net/minecraftforge/common/config/ConfigElement.java b/src/main/java/net/minecraftforge/common/config/ConfigElement.java index 77b4155ff8..a6a196be53 100644 --- a/src/main/java/net/minecraftforge/common/config/ConfigElement.java +++ b/src/main/java/net/minecraftforge/common/config/ConfigElement.java @@ -23,12 +23,12 @@ public class ConfigElement implements IConfigElement private Property prop; private Property.Type type; private boolean isProperty; - private ConfigCategory ctgy; + private ConfigCategory category; private boolean categoriesFirst = true; - public ConfigElement(ConfigCategory ctgy) + public ConfigElement(ConfigCategory category) { - this.ctgy = ctgy; + this.category = category; isProperty = false; } @@ -51,8 +51,8 @@ public class ConfigElement implements IConfigElement if (!isProperty) { List elements = new ArrayList(); - Iterator ccI = ctgy.getChildren().iterator(); - Iterator pI = ctgy.getOrderedValues().iterator(); + Iterator ccI = category.getChildren().iterator(); + Iterator pI = category.getOrderedValues().iterator(); @SuppressWarnings("unused") int index = 0; @@ -87,7 +87,7 @@ public class ConfigElement implements IConfigElement @Override public String getName() { - return isProperty ? prop.getName() : ctgy.getName(); + return isProperty ? prop.getName() : category.getName(); } @Override @@ -99,7 +99,7 @@ public class ConfigElement implements IConfigElement @Override public Class getConfigEntryClass() { - return isProperty ? prop.getConfigEntryClass() : ctgy.getConfigEntryClass(); + return isProperty ? prop.getConfigEntryClass() : category.getConfigEntryClass(); } @Override @@ -111,7 +111,7 @@ public class ConfigElement implements IConfigElement @Override public String getQualifiedName() { - return isProperty ? prop.getName() : ctgy.getQualifiedName(); + return isProperty ? prop.getName() : category.getQualifiedName(); } @Override @@ -148,7 +148,7 @@ public class ConfigElement implements IConfigElement @Override public String getComment() { - return isProperty ? prop.comment : ctgy.getComment(); + return isProperty ? prop.comment : category.getComment(); } @Override @@ -167,19 +167,19 @@ public class ConfigElement implements IConfigElement @Override public boolean requiresWorldRestart() { - return isProperty ? prop.requiresWorldRestart() : ctgy.requiresWorldRestart(); + return isProperty ? prop.requiresWorldRestart() : category.requiresWorldRestart(); } @Override public boolean showInGui() { - return isProperty ? prop.showInGui() : ctgy.showInGui(); + return isProperty ? prop.showInGui() : category.showInGui(); } @Override public boolean requiresMcRestart() { - return isProperty ? prop.requiresMcRestart() : ctgy.requiresMcRestart(); + return isProperty ? prop.requiresMcRestart() : category.requiresMcRestart(); } @Override @@ -191,7 +191,7 @@ public class ConfigElement implements IConfigElement @Override public String getLanguageKey() { - return isProperty ? prop.getLanguageKey() : ctgy.getLanguagekey(); + return isProperty ? prop.getLanguageKey() : category.getLanguagekey(); } @Override diff --git a/src/main/java/net/minecraftforge/common/config/Configuration.java b/src/main/java/net/minecraftforge/common/config/Configuration.java index 16aac45b5e..573c21a89e 100644 --- a/src/main/java/net/minecraftforge/common/config/Configuration.java +++ b/src/main/java/net/minecraftforge/common/config/Configuration.java @@ -166,7 +166,7 @@ public class Configuration */ public Property get(String category, String key, boolean defaultValue) { - return get(category, key, defaultValue, (String) null); + return get(category, key, defaultValue, null); } /** @@ -201,7 +201,7 @@ public class Configuration */ public Property get(String category, String key, boolean[] defaultValues) { - return get(category, key, defaultValues, (String) null); + return get(category, key, defaultValues, null); } /** @@ -268,7 +268,7 @@ public class Configuration */ public Property get(String category, String key, int defaultValue) { - return get(category, key, defaultValue, (String) null, Integer.MIN_VALUE, Integer.MAX_VALUE); + return get(category, key, defaultValue, null, Integer.MIN_VALUE, Integer.MAX_VALUE); } /** @@ -321,7 +321,7 @@ public class Configuration */ public Property get(String category, String key, int[] defaultValues) { - return get(category, key, defaultValues, (String) null); + return get(category, key, defaultValues, null); } /** @@ -410,7 +410,7 @@ public class Configuration */ public Property get(String category, String key, double defaultValue) { - return get(category, key, defaultValue, (String) null); + return get(category, key, defaultValue, null); } /** @@ -553,7 +553,7 @@ public class Configuration */ public Property get(String category, String key, String defaultValue) { - return get(category, key, defaultValue, (String) null); + return get(category, key, defaultValue, null); } /** @@ -615,7 +615,7 @@ public class Configuration */ public Property get(String category, String key, String[] defaultValues) { - return get(category, key, defaultValues, (String) null, false, -1, (Pattern) null); + return get(category, key, defaultValues, null, false, -1, null); } /** @@ -629,7 +629,7 @@ public class Configuration */ public Property get(String category, String key, String[] defaultValues, String comment) { - return get(category, key, defaultValues, comment, false, -1, (Pattern) null); + return get(category, key, defaultValues, comment, false, -1, null); } /** @@ -877,7 +877,7 @@ public class Configuration } else if (Character.isWhitespace(line.charAt(i))) { - // ignore space charaters + // ignore space characters } else { @@ -927,7 +927,7 @@ public class Configuration break; if (currentCat == null) { - throw new RuntimeException(String.format("Config file corrupt, attepted to close to many categories '%s:%d'", fileName, lineNum)); + throw new RuntimeException(String.format("Config file corrupt, attempted to close to many categories '%s:%d'", fileName, lineNum)); } currentCat = currentCat.parent; break; @@ -1330,7 +1330,7 @@ public class Configuration size = 4; } else if (bom32 == 0xFFFE0000) //This will never happen as it'll be caught by UTF-16LE, - { //but if anyone ever runs across a 32LE file, i'd like to disect it. + { //but if anyone ever runs across a 32LE file, i'd like to dissect it. enc = "UTF-32LE"; size = 4; } @@ -1567,7 +1567,7 @@ public class Configuration */ public String[] getStringList(String name, String category, String[] defaultValues, String comment) { - return getStringList(name, category, defaultValues, comment, (String[]) null, name); + return getStringList(name, category, defaultValues, comment, null, name); } /** diff --git a/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java b/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java index 77ecb62256..6e77ce716d 100644 --- a/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java +++ b/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java @@ -30,7 +30,7 @@ import com.google.common.collect.Maps; * If created with matrix, should successfully decompose it to a composition * of easily interpolatable transformations (translation, first rotation, scale * (with generally speaking different factors for each axis) and second rotation. - * If the inpit matrix is a composition of translation, rotation and scale (in + * If the input matrix is a composition of translation, rotation and scale (in * any order), then the interpolation of the derived primitive transformations * should result in the same transformation as the interpolation of the originals. * Decomposition happens lazily (and is hopefully fast enough), so performance diff --git a/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java b/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java index a18af6cc87..7127f7c493 100644 --- a/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java +++ b/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java @@ -25,7 +25,7 @@ public class ExtendedBlockState extends BlockStateContainer public ExtendedBlockState(Block blockIn, IProperty[] properties, IUnlistedProperty[] unlistedProperties) { super(blockIn, properties, buildUnlistedMap(unlistedProperties)); - ImmutableSet.Builder> builder = ImmutableSet.>builder(); + ImmutableSet.Builder> builder = ImmutableSet.builder(); for(IUnlistedProperty property : unlistedProperties) { builder.add(property); @@ -40,7 +40,7 @@ public class ExtendedBlockState extends BlockStateContainer private static ImmutableMap, Optional> buildUnlistedMap(IUnlistedProperty[] unlistedProperties) { - ImmutableMap.Builder, Optional> builder = ImmutableMap., Optional>builder(); + ImmutableMap.Builder, Optional> builder = ImmutableMap.builder(); for(IUnlistedProperty p : unlistedProperties) { builder.put(p, Optional.absent()); @@ -74,25 +74,27 @@ public class ExtendedBlockState extends BlockStateContainer { throw new IllegalArgumentException("Cannot set property " + property + " as it does not exist in " + getBlock().getBlockState()); } - else if (!property.getAllowedValues().contains(value)) - { - throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on block " + Block.blockRegistry.getNameForObject(getBlock()) + ", it is not an allowed value"); - } else { - if(this.getProperties().get(property) == value) + if (!property.getAllowedValues().contains(value)) { - return this; + throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on block " + Block.blockRegistry.getNameForObject(getBlock()) + ", it is not an allowed value"); + } else + { + if (this.getProperties().get(property) == value) + { + return this; + } + Map, Comparable> map = Maps.newHashMap(getProperties()); + map.put(property, value); + if (Iterables.all(unlistedProperties.values(), Predicates.>equalTo(Optional.absent()))) + { // no dynamic properties present, looking up in the normal table + return normalMap.get(map); + } + ImmutableTable, Comparable, IBlockState> table = propertyValueTable; + table = ((StateImplementation) table.get(property, value)).getPropertyValueTable(); + return new ExtendedStateImplementation(getBlock(), ImmutableMap.copyOf(map), unlistedProperties, table).setMap(this.normalMap); } - Map, Comparable> map = Maps.newHashMap(getProperties()); - map.put(property, value); - if(Iterables.all(unlistedProperties.values(), Predicates.>equalTo(Optional.absent()))) - { // no dynamic properties present, looking up in the normal table - return (IExtendedBlockState) normalMap.get(map); - } - ImmutableTable, Comparable, IBlockState> table = propertyValueTable; - table = ((StateImplementation)table.get(property, value)).getPropertyValueTable(); - return new ExtendedStateImplementation(getBlock(), ImmutableMap.copyOf(map), unlistedProperties, table).setMap(this.normalMap); } } diff --git a/src/main/java/net/minecraftforge/common/util/AsynchronousExecutor.java b/src/main/java/net/minecraftforge/common/util/AsynchronousExecutor.java index 9fa2656ecc..9457c55765 100644 --- a/src/main/java/net/minecraftforge/common/util/AsynchronousExecutor.java +++ b/src/main/java/net/minecraftforge/common/util/AsynchronousExecutor.java @@ -57,28 +57,27 @@ public final class AsynchronousExecutor { void callStage3(P parameter, T object, C callback) throws E; } - @SuppressWarnings("rawtypes") - static final AtomicIntegerFieldUpdater STATE_FIELD = AtomicIntegerFieldUpdater.newUpdater(AsynchronousExecutor.Task.class, "state"); + private static class StateHolder { - @SuppressWarnings({ "unchecked", "rawtypes" }) - private static boolean set(AsynchronousExecutor.Task $this, int expected, int value) { - return STATE_FIELD.compareAndSet($this, expected, value); + protected static final int PENDING = 0x0; + protected static final int STAGE_1_ASYNC = PENDING + 1; + protected static final int STAGE_1_SYNC = STAGE_1_ASYNC + 1; + protected static final int STAGE_1_COMPLETE = STAGE_1_SYNC + 1; + protected static final int FINISHED = STAGE_1_COMPLETE + 1; + + protected volatile int state = PENDING; + + protected static final AtomicIntegerFieldUpdater STATE = AtomicIntegerFieldUpdater.newUpdater(StateHolder.class, "state"); } - class Task implements Runnable { - static final int PENDING = 0x0; - static final int STAGE_1_ASYNC = PENDING + 1; - static final int STAGE_1_SYNC = STAGE_1_ASYNC + 1; - static final int STAGE_1_COMPLETE = STAGE_1_SYNC + 1; - static final int FINISHED = STAGE_1_COMPLETE + 1; + private class Task extends StateHolder implements Runnable { - volatile int state = PENDING; - final P parameter; - T object; - final List callbacks = new LinkedList(); - E t = null; + private final P parameter; + private T object; + private final List callbacks = new LinkedList(); + private E t = null; - Task(final P parameter) { + private Task(final P parameter) { this.parameter = parameter; } @@ -88,14 +87,14 @@ public final class AsynchronousExecutor { } } - boolean initAsync() { - if (set(this, PENDING, STAGE_1_ASYNC)) { + private boolean initAsync() { + if (STATE.compareAndSet(this, PENDING, STAGE_1_ASYNC)) { boolean ret = true; try { init(); } finally { - if (set(this, STAGE_1_ASYNC, STAGE_1_COMPLETE)) { + if (STATE.compareAndSet(this, STAGE_1_ASYNC, STAGE_1_COMPLETE)) { // No one is/will be waiting } else { // We know that the sync thread will be waiting @@ -119,14 +118,14 @@ public final class AsynchronousExecutor { } } - void initSync() { - if (set(this, PENDING, STAGE_1_COMPLETE)) { + private void initSync() { + if (STATE.compareAndSet(this, PENDING, STAGE_1_COMPLETE)) { // If we succeed that variable switch, good as done init(); - } else if (set(this, STAGE_1_ASYNC, STAGE_1_SYNC)) { + } else if (STATE.compareAndSet(this, STAGE_1_ASYNC, STAGE_1_SYNC)) { // Async thread is running, but this shouldn't be likely; we need to sync to wait on them because of it. synchronized (this) { - if (set(this, STAGE_1_SYNC, PENDING)) { // They might NOT synchronized yet, atomic lock IS needed + if (STATE.compareAndSet(this, STAGE_1_SYNC, PENDING)) { // They might NOT synchronized yet, atomic lock IS needed // We are the first into the lock while (state != STAGE_1_COMPLETE) { try { @@ -146,7 +145,7 @@ public final class AsynchronousExecutor { } @SuppressWarnings("unchecked") - void init() { + private void init() { try { object = provider.callStage1(parameter); } catch (final Throwable t) { @@ -155,7 +154,7 @@ public final class AsynchronousExecutor { } @SuppressWarnings("unchecked") - T get() throws E { + private T get() throws E { initSync(); if (callbacks.isEmpty()) { // 'this' is a placeholder to prevent callbacks from being empty during finish call @@ -166,7 +165,7 @@ public final class AsynchronousExecutor { return object; } - void finish() throws E { + private void finish() throws E { switch (state) { default: case PENDING: @@ -203,8 +202,8 @@ public final class AsynchronousExecutor { } } - boolean drop() { - if (set(this, PENDING, FINISHED)) { + private boolean drop() { + if (STATE.compareAndSet(this, PENDING, FINISHED)) { // If we succeed that variable switch, good as forgotten tasks.remove(parameter); return true; @@ -215,10 +214,10 @@ public final class AsynchronousExecutor { } } - final CallBackProvider provider; - final Queue finished = new ConcurrentLinkedQueue(); - final Map tasks = new HashMap(); - final ThreadPoolExecutor pool; + private final CallBackProvider provider; + private final Queue finished = new ConcurrentLinkedQueue(); + private final Map tasks = new HashMap(); + private final ThreadPoolExecutor pool; /** * Uses a thread pool to pass executions to the provider. @@ -314,7 +313,7 @@ public final class AsynchronousExecutor { /** * Processes a parameter as if it was in the queue, without ever passing to another thread. */ - public T getSkipQueue(P parameter, @SuppressWarnings("unchecked")C... callbacks) throws E { + public T getSkipQueue(P parameter, C... callbacks) throws E { final CallBackProvider provider = this.provider; final T object = skipQueue(parameter); for (C callback : callbacks) { diff --git a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java index f2642aa4b6..c1de2a376f 100644 --- a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java +++ b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java @@ -79,12 +79,12 @@ public class BlockSnapshot implements Serializable /** * Raw constructor designed for serialization usages. */ - public BlockSnapshot(int dimension, BlockPos pos, String modid, String blockName, int meta, int flag, NBTTagCompound nbt) + public BlockSnapshot(int dimension, BlockPos pos, String modId, String blockName, int meta, int flag, NBTTagCompound nbt) { this.dimId = dimension; this.pos = pos.getImmutable(); this.flag = flag; - this.blockIdentifier = new UniqueIdentifier(modid + ":" + blockName); + this.blockIdentifier = new UniqueIdentifier(modId + ":" + blockName); this.meta = meta; this.nbt = nbt; } diff --git a/src/main/java/net/minecraftforge/common/util/EnumHelper.java b/src/main/java/net/minecraftforge/common/util/EnumHelper.java index 99f7bd14b3..147377690e 100644 --- a/src/main/java/net/minecraftforge/common/util/EnumHelper.java +++ b/src/main/java/net/minecraftforge/common/util/EnumHelper.java @@ -35,8 +35,7 @@ public class EnumHelper private static boolean isSetup = false; //Some enums are decompiled with extra arguments, so lets check for that - @SuppressWarnings("rawtypes") - private static Class[][] commonTypes = + private static Class[][] commonTypes = { {EnumAction.class}, {ArmorMaterial.class, String.class, int.class, int[].class, int.class, SoundEvent.class}, @@ -69,8 +68,7 @@ public class EnumHelper { return addEnum(EnumCreatureAttribute.class, name); } - @SuppressWarnings("rawtypes") - public static EnumCreatureType addCreatureType(String name, Class typeClass, int maxNumber, Material material, boolean peaceful, boolean animal) + public static EnumCreatureType addCreatureType(String name, Class typeClass, int maxNumber, Material material, boolean peaceful, boolean animal) { return addEnum(EnumCreatureType.class, name, typeClass, maxNumber, material, peaceful, animal); } @@ -147,11 +145,11 @@ public class EnumHelper private static < T extends Enum> T makeEnum(Class enumClass, String value, int ordinal, Class[] additionalTypes, Object[] additionalValues) throws Exception { - Object[] parms = new Object[additionalValues.length + 2]; - parms[0] = value; - parms[1] = Integer.valueOf(ordinal); - System.arraycopy(additionalValues, 0, parms, 2, additionalValues.length); - return enumClass.cast(newInstance.invoke(getConstructorAccessor(enumClass, additionalTypes), new Object[] {parms})); + Object[] params = new Object[additionalValues.length + 2]; + params[0] = value; + params[1] = ordinal; + System.arraycopy(additionalValues, 0, params, 2, additionalValues.length); + return enumClass.cast(newInstance.invoke(getConstructorAccessor(enumClass, additionalTypes), new Object[] {params})); } public static void setFailsafeFieldValue(Field field, Object target, Object value) throws Exception @@ -189,10 +187,9 @@ public class EnumHelper return addEnum(commonTypes, enumType, enumName, paramValues); } - @SuppressWarnings("rawtypes") - public static > T addEnum(Class[][] map, Class enumType, String enumName, Object... paramValues) + public static > T addEnum(Class[][] map, Class enumType, String enumName, Object... paramValues) { - for (Class[] lookup : map) + for (Class[] lookup : map) { if (lookup[0] == enumType) { @@ -335,7 +332,7 @@ public class EnumHelper { T[] previousValues = (T[])valuesField.get(enumType); List values = new ArrayList(Arrays.asList(previousValues)); - T newValue = (T)makeEnum(enumType, enumName, values.size(), paramTypes, paramValues); + T newValue = makeEnum(enumType, enumName, values.size(), paramTypes, paramValues); values.add(newValue); setFailsafeFieldValue(valuesField, null, values.toArray((T[]) Array.newInstance(enumType, 0))); cleanEnumCache(enumType); diff --git a/src/main/java/net/minecraftforge/common/util/JsonUtils.java b/src/main/java/net/minecraftforge/common/util/JsonUtils.java index 68d2d34eef..bae684ea2c 100644 --- a/src/main/java/net/minecraftforge/common/util/JsonUtils.java +++ b/src/main/java/net/minecraftforge/common/util/JsonUtils.java @@ -26,16 +26,16 @@ public class JsonUtils public ImmutableList deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException { final Type[] typeArguments = ((ParameterizedType) type).getActualTypeArguments(); - final Type parameterizedType = listOf(typeArguments[0]).getType(); - final List list = context.deserialize(json, parameterizedType); + final Type parametrizedType = listOf(typeArguments[0]).getType(); + final List list = context.deserialize(json, parametrizedType); return ImmutableList.copyOf(list); } public JsonElement serialize(ImmutableList src, Type type, JsonSerializationContext context) { final Type[] typeArguments = ((ParameterizedType) type).getActualTypeArguments(); - final Type parameterizedType = listOf(typeArguments[0]).getType(); - return context.serialize(src, parameterizedType); + final Type parametrizedType = listOf(typeArguments[0]).getType(); + return context.serialize(src, parametrizedType); } } diff --git a/src/main/java/net/minecraftforge/event/AttachCapabilitiesEvent.java b/src/main/java/net/minecraftforge/event/AttachCapabilitiesEvent.java index a05b6780cb..fe13a88edb 100644 --- a/src/main/java/net/minecraftforge/event/AttachCapabilitiesEvent.java +++ b/src/main/java/net/minecraftforge/event/AttachCapabilitiesEvent.java @@ -37,7 +37,7 @@ public class AttachCapabilitiesEvent extends Event /** * Adds a capability to be attached to this object. * Keys MUST be unique, it is suggested that you set the domain to your mod ID. - * If the capability is an instance of INBTSerializeable, this key will be used when serializing this capability. + * If the capability is an instance of INBTSerializable, this key will be used when serializing this capability. * * @param key The name of owner of this capability provider. * @param cap The capability provider diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index f8d41684e7..55c16f8cbc 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -4,7 +4,6 @@ import java.io.File; import java.util.EnumSet; import java.util.List; -import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; @@ -16,7 +15,6 @@ import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer.EnumStatus; import net.minecraft.init.Blocks; -import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -81,8 +79,8 @@ import net.minecraftforge.event.entity.player.UseHoeEvent; import net.minecraftforge.event.terraingen.ChunkGeneratorEvent; import net.minecraftforge.event.terraingen.PopulateChunkEvent; import net.minecraftforge.event.world.BlockEvent; -import net.minecraftforge.event.world.BlockEvent.NeighborNotifyEvent; import net.minecraftforge.event.world.BlockEvent.MultiPlaceEvent; +import net.minecraftforge.event.world.BlockEvent.NeighborNotifyEvent; import net.minecraftforge.event.world.BlockEvent.PlaceEvent; import net.minecraftforge.event.world.ExplosionEvent; import net.minecraftforge.event.world.WorldEvent; @@ -396,9 +394,9 @@ public class ForgeEventFactory return event.result; } - public static void onPlayerWakeup(EntityPlayer player, boolean wakeImmediatly, boolean updateWorldFlag, boolean setSpawn) + public static void onPlayerWakeup(EntityPlayer player, boolean wakeImmediately, boolean updateWorldFlag, boolean setSpawn) { - MinecraftForge.EVENT_BUS.post(new PlayerWakeUpEvent(player, wakeImmediatly, updateWorldFlag, setSpawn)); + MinecraftForge.EVENT_BUS.post(new PlayerWakeUpEvent(player, wakeImmediately, updateWorldFlag, setSpawn)); } public static void onPlayerFall(EntityPlayer player, float distance, float multiplier) @@ -447,7 +445,7 @@ public class ForgeEventFactory return (MinecraftForge.EVENT_BUS.post(event) ? 0 : event.amount); } - public static boolean onPotionAttemptBreaw(ItemStack[] stacks) + public static boolean onPotionAttemptBrew(ItemStack[] stacks) { ItemStack[] tmp = new ItemStack[stacks.length]; for (int x = 0; x < tmp.length; x++) diff --git a/src/main/java/net/minecraftforge/event/entity/item/ItemExpireEvent.java b/src/main/java/net/minecraftforge/event/entity/item/ItemExpireEvent.java index db7b79db10..01acaf4d46 100644 --- a/src/main/java/net/minecraftforge/event/entity/item/ItemExpireEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/item/ItemExpireEvent.java @@ -7,7 +7,7 @@ import net.minecraft.entity.item.EntityItem; * Event that is fired when an EntityItem's age has reached its maximum * lifespan. Canceling this event will prevent the EntityItem from being * flagged as dead, thus staying it's removal from the world. If canceled - * it will add more time to the entitie's life equal to extraLife. + * it will add more time to the entities life equal to extraLife. */ @Cancelable public class ItemExpireEvent extends ItemEvent diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingAttackEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingAttackEvent.java index 5e4ae66a27..ec99b75a64 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingAttackEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingAttackEvent.java @@ -25,12 +25,15 @@ import net.minecraft.entity.EntityLivingBase; @Cancelable public class LivingAttackEvent extends LivingEvent { - public final DamageSource source; - public final float ammount; - public LivingAttackEvent(EntityLivingBase entity, DamageSource source, float ammount) + private final DamageSource source; + private final float amount; + public LivingAttackEvent(EntityLivingBase entity, DamageSource source, float amount) { super(entity); this.source = source; - this.ammount = ammount; + this.amount = amount; } + + public DamageSource getSource() { return source; } + public float getAmount() { return amount; } } diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingEntityUseItemEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingEntityUseItemEvent.java index 735ade5d2e..95f01ee29e 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingEntityUseItemEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingEntityUseItemEvent.java @@ -1,9 +1,8 @@ package net.minecraftforge.event.entity.living; -import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.eventhandler.Cancelable; public abstract class LivingEntityUseItemEvent extends LivingEvent { diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingHurtEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingHurtEvent.java index 4bdea7c8a4..0c17934cf8 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingHurtEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingHurtEvent.java @@ -25,13 +25,18 @@ import net.minecraft.entity.EntityLivingBase; @Cancelable public class LivingHurtEvent extends LivingEvent { - public final DamageSource source; - public float ammount; - public LivingHurtEvent(EntityLivingBase entity, DamageSource source, float ammount) + private final DamageSource source; + private float amount; + public LivingHurtEvent(EntityLivingBase entity, DamageSource source, float amount) { super(entity); this.source = source; - this.ammount = ammount; + this.amount = amount; } + public DamageSource getSource() { return source; } + + public float getAmount() { return amount; } + + public void setAmount(float amount) { this.amount = amount; } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/ArrowLooseEvent.java b/src/main/java/net/minecraftforge/event/entity/player/ArrowLooseEvent.java index 1e8a01cd94..6250e3d7a8 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/ArrowLooseEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/ArrowLooseEvent.java @@ -38,6 +38,7 @@ public class ArrowLooseEvent extends PlayerEvent } public ItemStack getBow() { return this.bow; } + public World getWorld() { return this.world; } public boolean hasAmmo() { return this.hasAmmo; } public int getCharge() { return this.charge; } public void setCharge(int charge) { this.charge = charge; } diff --git a/src/main/java/net/minecraftforge/event/entity/player/ArrowNockEvent.java b/src/main/java/net/minecraftforge/event/entity/player/ArrowNockEvent.java index 4e73c4fc83..888f0e3dba 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/ArrowNockEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/ArrowNockEvent.java @@ -31,6 +31,7 @@ public class ArrowNockEvent extends PlayerEvent } public ItemStack getBow() { return this.bow; } + public World getWorld() { return this.world; } public EnumHand getHand() { return this.hand; } public boolean hasAmmo() { return this.hasAmmo; } public ActionResult getAction() diff --git a/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java b/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java index d849c4ce68..d95e68fd15 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java @@ -18,7 +18,7 @@ public class BonemealEvent extends PlayerEvent * You can also set the result to ALLOW to mark the event as processed * and use up a bonemeal from the stack but do no further processing. * - * setResult(ALLOW) is the same as the old setHandeled() + * setResult(ALLOW) is the same as the old setHandled() */ public final World world; diff --git a/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java b/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java index faf549d85b..e452d5320e 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java @@ -18,7 +18,7 @@ public class FillBucketEvent extends PlayerEvent * If you set the result to 'ALLOW', it means that you have processed * the event and wants the basic functionality of adding the new * ItemStack to your inventory and reducing the stack size to process. - * setResult(ALLOW) is the same as the old setHandeled(); + * setResult(ALLOW) is the same as the old setHandled(); */ private final ItemStack current; diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java index 69de7e6194..35d2d3357b 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java @@ -27,7 +27,7 @@ import net.minecraft.util.EnumHand; public class PlayerDestroyItemEvent extends PlayerEvent { private final ItemStack original; - private final EnumHand hand; // May be null if this player destroies the item by any use besides holding it. + private final EnumHand hand; // May be null if this player destroys the item by any use besides holding it. public PlayerDestroyItemEvent(EntityPlayer player, ItemStack original, EnumHand hand) { super(player); diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerFlyableFallEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerFlyableFallEvent.java index 931e84d888..8a469f0dd2 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerFlyableFallEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerFlyableFallEvent.java @@ -9,13 +9,18 @@ import net.minecraft.entity.player.EntityPlayer; */ public class PlayerFlyableFallEvent extends PlayerEvent { - public float distance; - public float multipler; + private float distance; + private float multiplier; public PlayerFlyableFallEvent(EntityPlayer player, float distance, float multiplier) { super(player); this.distance = distance; - this.multipler = multiplier; + this.multiplier = multiplier; } + + public float getDistance() { return distance;} + public void setDistance(float distance) { this.distance = distance; } + public float getMultiplier() { return multiplier; } + public void setMultiplier(float multiplier) { this.multiplier = multiplier; } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java index 76fa00d5c6..be81de27df 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java @@ -20,7 +20,7 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable; *
* This event is fired via the {@link ForgeEventFactory#onPlayerInteract(EntityPlayer, Action, BlockPos, EnumFacing)}. *
- * {@link #action} contains the Action the player performed durin this interaction.
+ * {@link #action} contains the Action the player performed during this interaction.
* {@link #pos} contains the coordinate of where this event occurred.
* {@link #face} contains the face of the block that was interacted with. May be null if unknown.
* {@link #world} contains the world in which this event is occurring.
diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerWakeUpEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerWakeUpEvent.java index e278c90adb..6b161fdb8a 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerWakeUpEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerWakeUpEvent.java @@ -9,29 +9,35 @@ import net.minecraft.entity.player.EntityPlayer; */ public class PlayerWakeUpEvent extends PlayerEvent { + private final boolean wakeImmediately; + + private final boolean updateWorld; + + private final boolean setSpawn; + + public PlayerWakeUpEvent(EntityPlayer player, boolean wakeImmediately, boolean updateWorld, boolean setSpawn) + { + super(player); + this.wakeImmediately = wakeImmediately; + this.updateWorld = updateWorld; + this.setSpawn = setSpawn; + } + /** * Used for the 'wake up animation'. * This is false if the player is considered 'sleepy' and the overlay should slowly fade away. */ - public final boolean wakeImmediatly; + public boolean wakeImmediately() { return wakeImmediately; } /** * Indicates if the server should be notified of sleeping changes. * This will only be false if the server is considered 'up to date' already, because, for example, it initiated the call. */ - public final boolean updateWorld; + public boolean updateWorld() { return updateWorld; } /** * Indicates if the player's sleep was considered successful. * In vanilla, this is used to determine if the spawn chunk is to be set to the bed's position. */ - public final boolean setSpawn; - - public PlayerWakeUpEvent(EntityPlayer player, boolean wakeImmediatly, boolean updateWorld, boolean setSpawn) - { - super(player); - this.wakeImmediatly = wakeImmediatly; - this.updateWorld = updateWorld; - this.setSpawn = setSpawn; - } + public boolean shouldSetSpawn() { return setSpawn; } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java b/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java index 5db0b54f41..c9dad848e0 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java @@ -18,7 +18,7 @@ public class UseHoeEvent extends PlayerEvent * You can also set the result to ALLOW to mark the event as processed * and damage the hoe. * - * setResult(ALLOW) is the same as the old setHandeled(); + * setResult(ALLOW) is the same as the old setHandled(); */ public final ItemStack current; diff --git a/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java b/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java index 78a183639e..dda1712641 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java @@ -2,11 +2,11 @@ package net.minecraftforge.event.terraingen; import java.util.Random; -import net.minecraftforge.fml.common.eventhandler.Event; -import net.minecraftforge.fml.common.eventhandler.Event.HasResult; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkGenerator; -import net.minecraft.world.chunk.IChunkProvider; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; /** * PopulateChunkEvent is fired when an event involving chunk terrain feature population occurs.
diff --git a/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java b/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java index a61d29537a..cbec1f7841 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java +++ b/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java @@ -1,18 +1,17 @@ package net.minecraftforge.event.terraingen; import java.util.Random; -import net.minecraftforge.fml.common.eventhandler.Event.*; + import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkGenerator; -import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.MapGenBase; -import net.minecraft.world.gen.NoiseGenerator; import net.minecraft.world.gen.feature.WorldGenerator; -import net.minecraftforge.common.*; -import net.minecraftforge.event.terraingen.DecorateBiomeEvent.*; -import net.minecraftforge.event.terraingen.OreGenEvent.*; -import net.minecraftforge.event.terraingen.PopulateChunkEvent.*; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate; +import net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable; +import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate; +import net.minecraftforge.fml.common.eventhandler.Event.Result; public abstract class TerrainGen { diff --git a/src/main/java/net/minecraftforge/event/world/BlockEvent.java b/src/main/java/net/minecraftforge/event/world/BlockEvent.java index 14d91f078c..ed37229e80 100644 --- a/src/main/java/net/minecraftforge/event/world/BlockEvent.java +++ b/src/main/java/net/minecraftforge/event/world/BlockEvent.java @@ -168,7 +168,7 @@ public class BlockEvent extends Event } /** - * Gets a list of blocksnapshots for all blocks which were replaced by the + * Gets a list of BlockSnapshots for all blocks which were replaced by the * placement of the new blocks. Most of these blocks will just be of type AIR. * * @return immutable list of replaced BlockSnapshots diff --git a/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java b/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java index 3253f8a53e..58ef7c0e61 100644 --- a/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java +++ b/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java @@ -1,21 +1,16 @@ package net.minecraftforge.event.world; -import com.google.common.base.Preconditions; - -import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.fml.common.eventhandler.Cancelable; -import net.minecraftforge.fml.common.eventhandler.Event; + +import com.google.common.base.Preconditions; /** * Base class for Noteblock Events * */ -@SuppressWarnings("unused") public class NoteBlockEvent extends BlockEvent { private int noteId; diff --git a/src/main/java/net/minecraftforge/event/world/WorldEvent.java b/src/main/java/net/minecraftforge/event/world/WorldEvent.java index 23779dc153..72f94ade91 100644 --- a/src/main/java/net/minecraftforge/event/world/WorldEvent.java +++ b/src/main/java/net/minecraftforge/event/world/WorldEvent.java @@ -16,7 +16,7 @@ import net.minecraftforge.fml.common.eventhandler.Event; * If a method utilizes this {@link Event} as its parameter, the method will * receive every child event of this class.
*
- * {@link #world} contains the World this event is occuring in.
+ * {@link #world} contains the World this event is occurring in.
*
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.
**/ diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java b/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java index 018b872e35..5c8c3a0651 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java @@ -34,7 +34,6 @@ import com.google.common.collect.Maps; * It is highly recommended that you extend this class or one of the Forge-provided child classes. * */ -@SuppressWarnings("unchecked") public abstract class BlockFluidBase extends Block implements IFluidBlock { protected final static Map defaultDisplacements = Maps.newHashMap(); @@ -88,19 +87,18 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock public static final PropertyInteger LEVEL = PropertyInteger.create("level", 0, 15); public static final PropertyFloat[] LEVEL_CORNERS = new PropertyFloat[4]; public static final PropertyFloat FLOW_DIRECTION = new PropertyFloat("flow_direction"); - public static final IUnlistedProperty[] FLUID_RENDER_PROPS; + public static final ImmutableList> FLUID_RENDER_PROPS; static { - @SuppressWarnings("rawtypes") - ImmutableList.Builder builder = ImmutableList.builder(); + ImmutableList.Builder> builder = ImmutableList.builder(); builder.add(FLOW_DIRECTION); for(int i = 0; i < 4; i++) { LEVEL_CORNERS[i] = new PropertyFloat("level_corner_" + i); builder.add(LEVEL_CORNERS[i]); } - FLUID_RENDER_PROPS = builder.build().toArray(new IUnlistedProperty[0]); + FLUID_RENDER_PROPS = builder.build(); } protected int quantaPerBlock = 8; @@ -144,7 +142,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock @Override protected BlockStateContainer createBlockState() { - return new ExtendedBlockState(this, new IProperty[] { LEVEL }, FLUID_RENDER_PROPS); + return new ExtendedBlockState(this, new IProperty[] { LEVEL }, FLUID_RENDER_PROPS.toArray(new IUnlistedProperty[0])); } @Override diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java b/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java index 477f543f98..285899e9b8 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java @@ -81,7 +81,7 @@ public class BlockFluidFinite extends BlockFluidBase } // Flow out if possible - int lowerthan = quantaRemaining - 1; + int lowerThan = quantaRemaining - 1; int total = quantaRemaining; int count = 1; @@ -91,7 +91,7 @@ public class BlockFluidFinite extends BlockFluidBase if (displaceIfPossible(world, off)) world.setBlockToAir(off); - int quanta = getQuantaValueBelow(world, off, lowerthan); + int quanta = getQuantaValueBelow(world, off, lowerThan); if (quanta >= 0) { count++; @@ -114,25 +114,25 @@ public class BlockFluidFinite extends BlockFluidBase for (EnumFacing side : EnumFacing.Plane.HORIZONTAL) { BlockPos off = pos.offset(side); - int quanta = getQuantaValueBelow(world, off, lowerthan); + int quanta = getQuantaValueBelow(world, off, lowerThan); if (quanta >= 0) { - int newquanta = each; + int newQuanta = each; if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) { - ++newquanta; + ++newQuanta; --rem; } - if (newquanta != quanta) + if (newQuanta != quanta) { - if (newquanta == 0) + if (newQuanta == 0) { world.setBlockToAir(off); } else { - world.setBlockState(off, getDefaultState().withProperty(LEVEL, newquanta - 1), 2); + world.setBlockState(off, getDefaultState().withProperty(LEVEL, newQuanta - 1), 2); } world.scheduleUpdate(off, this, tickRate); } diff --git a/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java index ce0f2adbb5..5810582726 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java @@ -20,7 +20,7 @@ import net.minecraftforge.common.MinecraftForge; * For more complex items, use {@link IFluidContainerItem} instead. * * Deprecated: We will eventually be moving this ALL away from a registry and instead EVERYTHING will use IFluidContainerItem. - * We need to decide a way of swaping Items/Stacks. + * We need to decide a way of swapping Items/Stacks. */ @Deprecated public abstract class FluidContainerRegistry diff --git a/src/main/java/net/minecraftforge/fluids/FluidUtil.java b/src/main/java/net/minecraftforge/fluids/FluidUtil.java index 9b7f6bc540..7a374b091a 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidUtil.java +++ b/src/main/java/net/minecraftforge/fluids/FluidUtil.java @@ -28,7 +28,7 @@ public class FluidUtil { } - /** Returns true if intercation was successful. */ + /** Returns true if interaction was successful. */ public static boolean interactWithTank(ItemStack stack, EntityPlayer player, IFluidHandler tank, EnumFacing side) { if (stack == null || player.worldObj.isRemote) @@ -193,7 +193,7 @@ public class FluidUtil * @param tank The tank to fill from * @param side Side to access the tank from * @param player The player that tries to fill the bucket. Needed if the input itemstack has a stacksize > 1 to determine where the filled container goes. - * @return True if the IFluidContainerItem was filled successfully, false otherwise. The passed container will have been modified to accomodate for anything done in this method. New Itemstacks might have been added to the players inventory. + * @return True if the IFluidContainerItem was filled successfully, false otherwise. The passed container will have been modified to accommodate for anything done in this method. New Itemstacks might have been added to the players inventory. */ public static boolean tryFillFluidContainerItem(ItemStack container, IFluidHandler tank, EnumFacing side, EntityPlayer player) { @@ -219,7 +219,7 @@ public class FluidUtil * @param inventory An inventory where any additionally created item (filled container if multiple empty are present) are put * @param max Maximum amount to take from the tank. Uses IFluidContainerItem capacity if <= 0 * @param player The player that gets the items the inventory can't take. Can be null, only used if the inventory cannot take the filled stack. - * @return True if the IFluidContainerItem was filled successfully, false otherwise. The passed container will have been modified to accomodate for anything done in this method. New Itemstacks might have been added to the players inventory. + * @return True if the IFluidContainerItem was filled successfully, false otherwise. The passed container will have been modified to accommodate for anything done in this method. New Itemstacks might have been added to the players inventory. */ public static boolean tryFillFluidContainerItem(ItemStack container, IFluidHandler tank, EnumFacing side, IItemHandler inventory, int max, EntityPlayer player) { @@ -392,7 +392,7 @@ public class FluidUtil return false; } - private static boolean insertItemIntoo(ItemStack stack, IInventory inventory, World world, BlockPos pos, boolean isCreative) + private static boolean insertItemInto(ItemStack stack, IInventory inventory, World world, BlockPos pos, boolean isCreative) { if (stack == null) { @@ -545,8 +545,8 @@ public class FluidUtil { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Adding item to inventory"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Item being added"); - crashreportcategory.addCrashSection("Item ID", Integer.valueOf(Item.getIdFromItem(itemstack.getItem()))); - crashreportcategory.addCrashSection("Item data", Integer.valueOf(itemstack.getMetadata())); + crashreportcategory.addCrashSection("Item ID", Item.getIdFromItem(itemstack.getItem())); + crashreportcategory.addCrashSection("Item data", itemstack.getMetadata()); crashreportcategory.addCrashSectionCallable("Item name", new Callable() { public String call() throws Exception diff --git a/src/main/java/net/minecraftforge/fml/client/CustomModLoadingErrorDisplayException.java b/src/main/java/net/minecraftforge/fml/client/CustomModLoadingErrorDisplayException.java index 607c3c51d1..fe8d5db8c9 100644 --- a/src/main/java/net/minecraftforge/fml/client/CustomModLoadingErrorDisplayException.java +++ b/src/main/java/net/minecraftforge/fml/client/CustomModLoadingErrorDisplayException.java @@ -43,7 +43,7 @@ public abstract class CustomModLoadingErrorDisplayException extends EnhancedRunt private static final long serialVersionUID = 1L; /** - * Called after the GUI is inited by the parent code. You can do extra stuff here, maybe? + * Called after the GUI is initialized by the parent code. You can do extra stuff here, maybe? * * @param errorScreen The error screen we're painting * @param fontRenderer A font renderer for you diff --git a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java index f1f1200fa0..5fa74621ed 100644 --- a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java +++ b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java @@ -186,7 +186,7 @@ public class FMLClientHandler implements IFMLSidedHandler * @param resourceManager The resource manager */ @SuppressWarnings("unchecked") - public void beginMinecraftLoading(Minecraft minecraft, @SuppressWarnings("rawtypes") List resourcePackList, IReloadableResourceManager resourceManager) + public void beginMinecraftLoading(Minecraft minecraft, List resourcePackList, IReloadableResourceManager resourceManager) { detectOptifine(); SplashProgress.start(); @@ -626,7 +626,7 @@ public class FMLClientHandler implements IFMLSidedHandler @Override public void serverStopped() { - // If the server crashes during startup, it might hang the client- reset the client so it can abend properly. + // If the server crashes during startup, it might hang the client - reset the client so it can abend properly. MinecraftServer server = getServer(); if (server != null && !server.serverIsInRunLoop()) @@ -693,7 +693,7 @@ public class FMLClientHandler implements IFMLSidedHandler { try { - client.launchIntegratedServer(comparator.getFileName(), comparator.getDisplayName(), (WorldSettings)null); + client.launchIntegratedServer(comparator.getFileName(), comparator.getDisplayName(), null); } catch (StartupQuery.AbortedException e) { @@ -735,7 +735,7 @@ public class FMLClientHandler implements IFMLSidedHandler String type = jsonData.get("type").getAsString(); JsonArray modDataArray = jsonData.get("modList").getAsJsonArray(); boolean moddedClientAllowed = jsonData.has("clientModsAllowed") ? jsonData.get("clientModsAllowed").getAsBoolean() : true; - Builder modListBldr = ImmutableMap.builder(); + Builder modListBldr = ImmutableMap.builder(); for (JsonElement obj : modDataArray) { JsonObject modObj = obj.getAsJsonObject(); diff --git a/src/main/java/net/minecraftforge/fml/client/GuiModList.java b/src/main/java/net/minecraftforge/fml/client/GuiModList.java index 0f67480e66..9ab9150c3e 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiModList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiModList.java @@ -247,7 +247,7 @@ public class GuiModList extends GuiScreen if (type != null) { - for (GuiButton b : (List)buttonList) + for (GuiButton b : buttonList) { if (SortType.getTypeForButton(b) != null) { @@ -414,7 +414,7 @@ public class GuiModList extends GuiScreen lines.add("Child mods: " + selectedMod.getMetadata().getChildModList()); if (vercheck.status == Status.OUTDATED || vercheck.status == Status.BETA_OUTDATED) - lines.add("Update Avalible: " + (vercheck.url == null ? "" : vercheck.url)); + lines.add("Update Available: " + (vercheck.url == null ? "" : vercheck.url)); lines.add(null); lines.add(selectedMod.getMetadata().description); @@ -567,7 +567,7 @@ public class GuiModList extends GuiScreen if (line != null) { int k = -4; - for (ITextComponent part : (Iterable)line) { + for (ITextComponent part : line) { if (!(part instanceof TextComponentString)) continue; k += GuiModList.this.fontRendererObj.getStringWidth(((TextComponentString)part).getChatComponentText_TextValue()); diff --git a/src/main/java/net/minecraftforge/fml/client/GuiOldSaveLoadConfirm.java b/src/main/java/net/minecraftforge/fml/client/GuiOldSaveLoadConfirm.java index 9244883935..0160ccfe38 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiOldSaveLoadConfirm.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiOldSaveLoadConfirm.java @@ -6,12 +6,10 @@ import java.io.IOException; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiLabel; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.GuiWorldSelection; import net.minecraft.client.gui.GuiYesNo; import net.minecraft.client.gui.GuiYesNoCallback; import net.minecraft.world.WorldSettings; import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import net.minecraftforge.fml.common.StartupQuery; import net.minecraftforge.fml.common.ZipperUtil; @@ -44,12 +42,12 @@ public class GuiOldSaveLoadConfirm extends GuiYesNo implements GuiYesNoCallback for (k = 0; k < this.buttonList.size(); ++k) { - ((GuiButton)this.buttonList.get(k)).drawButton(this.mc, mouseX, mouseY); + this.buttonList.get(k).drawButton(this.mc, mouseX, mouseY); } for (k = 0; k < this.labelList.size(); ++k) { - ((GuiLabel)this.labelList.get(k)).drawLabel(this.mc, mouseX, mouseY); + this.labelList.get(k).drawLabel(this.mc, mouseX, mouseY); } } @Override @@ -84,7 +82,7 @@ public class GuiOldSaveLoadConfirm extends GuiYesNo implements GuiYesNoCallback try { - mc.launchIntegratedServer(dirName, saveName, (WorldSettings)null); + mc.launchIntegratedServer(dirName, saveName, null); } catch (StartupQuery.AbortedException e) { diff --git a/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java b/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java index 2d3a2650a5..eb210724a4 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java @@ -129,7 +129,8 @@ public abstract class GuiScrollingList return x >= left && x <= right && entryIndex >= 0 && relativeY >= 0 && entryIndex < this.getSize() ? entryIndex : -1; } - public void registerScrollButtons(@SuppressWarnings("rawtypes") List buttons, int upActionID, int downActionID) + // FIXME: is this correct/still needed? + public void registerScrollButtons(List buttons, int upActionID, int downActionID) { this.scrollUpActionId = upActionID; this.scrollDownActionId = downActionID; diff --git a/src/main/java/net/minecraftforge/fml/client/SplashProgress.java b/src/main/java/net/minecraftforge/fml/client/SplashProgress.java index 3f8fb469fd..4882ea1103 100644 --- a/src/main/java/net/minecraftforge/fml/client/SplashProgress.java +++ b/src/main/java/net/minecraftforge/fml/client/SplashProgress.java @@ -1,55 +1,7 @@ package net.minecraftforge.fml.client; -import static org.lwjgl.opengl.GL11.GL_ALPHA_TEST; -import static org.lwjgl.opengl.GL11.GL_BLEND; -import static org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT; -import static org.lwjgl.opengl.GL11.GL_DEPTH_TEST; -import static org.lwjgl.opengl.GL11.GL_GREATER; -import static org.lwjgl.opengl.GL11.GL_LEQUAL; -import static org.lwjgl.opengl.GL11.GL_LIGHTING; -import static org.lwjgl.opengl.GL11.GL_MODELVIEW; -import static org.lwjgl.opengl.GL11.GL_NEAREST; -import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA; -import static org.lwjgl.opengl.GL11.GL_PROJECTION; -import static org.lwjgl.opengl.GL11.GL_QUADS; -import static org.lwjgl.opengl.GL11.GL_RENDERER; -import static org.lwjgl.opengl.GL11.GL_RGBA; -import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA; -import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D; -import static org.lwjgl.opengl.GL11.GL_TEXTURE_MAG_FILTER; -import static org.lwjgl.opengl.GL11.GL_TEXTURE_MIN_FILTER; -import static org.lwjgl.opengl.GL11.GL_VENDOR; -import static org.lwjgl.opengl.GL11.GL_VERSION; -import static org.lwjgl.opengl.GL11.glAlphaFunc; -import static org.lwjgl.opengl.GL11.glBegin; -import static org.lwjgl.opengl.GL11.glBindTexture; -import static org.lwjgl.opengl.GL11.glBlendFunc; -import static org.lwjgl.opengl.GL11.glClear; -import static org.lwjgl.opengl.GL11.glClearColor; -import static org.lwjgl.opengl.GL11.glColor3ub; -import static org.lwjgl.opengl.GL11.glDeleteTextures; -import static org.lwjgl.opengl.GL11.glDepthFunc; -import static org.lwjgl.opengl.GL11.glDisable; -import static org.lwjgl.opengl.GL11.glEnable; -import static org.lwjgl.opengl.GL11.glEnd; -import static org.lwjgl.opengl.GL11.glGenTextures; -import static org.lwjgl.opengl.GL11.glGetString; -import static org.lwjgl.opengl.GL11.glLoadIdentity; -import static org.lwjgl.opengl.GL11.glMatrixMode; -import static org.lwjgl.opengl.GL11.glOrtho; -import static org.lwjgl.opengl.GL11.glPopMatrix; -import static org.lwjgl.opengl.GL11.glPushMatrix; -import static org.lwjgl.opengl.GL11.glRotatef; -import static org.lwjgl.opengl.GL11.glScalef; -import static org.lwjgl.opengl.GL11.glTexCoord2f; -import static org.lwjgl.opengl.GL11.glTexImage2D; -import static org.lwjgl.opengl.GL11.glTexParameteri; -import static org.lwjgl.opengl.GL11.glTexSubImage2D; -import static org.lwjgl.opengl.GL11.glTranslatef; -import static org.lwjgl.opengl.GL11.glVertex2f; -import static org.lwjgl.opengl.GL11.glViewport; -import static org.lwjgl.opengl.GL12.GL_BGRA; -import static org.lwjgl.opengl.GL12.GL_UNSIGNED_INT_8_8_8_8_REV; +import static org.lwjgl.opengl.GL11.*; +import static org.lwjgl.opengl.GL12.*; import java.awt.image.BufferedImage; import java.io.File; @@ -60,7 +12,6 @@ import java.io.InputStream; import java.io.PrintStream; import java.io.PrintWriter; import java.lang.Thread.UncaughtExceptionHandler; -import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.Iterator; import java.util.Properties; @@ -99,7 +50,6 @@ import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.Drawable; -import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.SharedDrawable; import org.lwjgl.util.glu.GLU; @@ -503,8 +453,8 @@ public class SplashProgress if (max_texture_size != -1) return max_texture_size; for (int i = 0x4000; i > 0; i >>= 1) { - GlStateManager.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (IntBuffer)null); - if (GlStateManager.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH) != 0) + GlStateManager.glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, i, i, 0, GL_RGBA, GL_UNSIGNED_BYTE, null); + if (GlStateManager.glGetTexLevelParameteri(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH) != 0) { max_texture_size = i; return i; @@ -599,7 +549,7 @@ public class SplashProgress { stream.println("SplashProgress has detected a error loading Minecraft."); stream.println("This can sometimes be caused by bad video drivers."); - stream.println("We have automatically disabeled the new Splash Screen in config/splash.properties."); + stream.println("We have automatically disabled the new Splash Screen in config/splash.properties."); stream.println("Try reloading minecraft before reporting any errors."); } }; @@ -613,7 +563,7 @@ public class SplashProgress { stream.println("SplashProgress has detected a error loading Minecraft."); stream.println("This can sometimes be caused by bad video drivers."); - stream.println("Please try disabeling the new Splash Screen in config/splash.properties."); + stream.println("Please try disabling the new Splash Screen in config/splash.properties."); stream.println("After doing so, try reloading minecraft before reporting any errors."); } }; @@ -835,7 +785,7 @@ public class SplashProgress public static void checkGLError(String where) { - int err = GL11.glGetError(); + int err = glGetError(); if (err != 0) { throw new IllegalStateException(where + ": " + GLU.gluErrorString(err)); diff --git a/src/main/java/net/minecraftforge/fml/client/config/DummyConfigElement.java b/src/main/java/net/minecraftforge/fml/client/config/DummyConfigElement.java index 320fbf0aaa..77a5efbedc 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/DummyConfigElement.java +++ b/src/main/java/net/minecraftforge/fml/client/config/DummyConfigElement.java @@ -54,13 +54,13 @@ public class DummyConfigElement implements IConfigElement /** * This class provides a Dummy Category IConfigElement. It can be used to define a custom list of GUI entries that will - * appear on the child screen or to specify a custom IGuiConfigListEntryfor a special category. + * appear on the child screen or to specify a custom IGuiConfigListEntry for a special category. */ public static class DummyCategoryElement extends DummyConfigElement { public DummyCategoryElement(String name, String langKey, List childElements) { - this(name, langKey, childElements, (Class) null); + this(name, langKey, childElements, null); } public DummyCategoryElement(String name, String langKey, Class customListEntryClass) @@ -70,7 +70,7 @@ public class DummyConfigElement implements IConfigElement public DummyCategoryElement(String name, String langKey, List childElements, Class customListEntryClass) { - super(name, (Object) null, ConfigGuiType.CONFIG_CATEGORY, langKey); + super(name, null, ConfigGuiType.CONFIG_CATEGORY, langKey); this.childElements = childElements; this.configEntryClass = customListEntryClass; isProperty = false; @@ -84,7 +84,7 @@ public class DummyConfigElement implements IConfigElement { public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, boolean isListFixedLength, int maxListLength, Pattern validStringPattern, Object minValue, Object maxValue) { - super(name, (Object) null, type, langKey, minValue, maxValue); + super(name, null, type, langKey, minValue, maxValue); this.defaultValues = defaultValues; this.values = defaultValues; this.isListFixedLength = isListFixedLength; @@ -95,52 +95,52 @@ public class DummyConfigElement implements IConfigElement public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey) { - this(name, defaultValues, type, langKey, false, -1, (Pattern) null, (Object) null, (Object) null); + this(name, defaultValues, type, langKey, false, -1, null, null, null); } public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, boolean isListFixedLength) { - this(name, defaultValues, type, langKey, isListFixedLength, -1, (Pattern) null, (Object) null, (Object) null); + this(name, defaultValues, type, langKey, isListFixedLength, -1, null, null, null); } public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, int maxListLength) { - this(name, defaultValues, type, langKey, false, maxListLength, (Pattern) null, (Object) null, (Object) null); + this(name, defaultValues, type, langKey, false, maxListLength, null, null, null); } public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, Object minValue, Object maxValue) { - this(name, defaultValues, type, langKey, false, -1, (Pattern) null, minValue, maxValue); + this(name, defaultValues, type, langKey, false, -1, null, minValue, maxValue); } public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, boolean isListFixedLength, Object minValue, Object maxValue) { - this(name, defaultValues, type, langKey, isListFixedLength, -1, (Pattern) null, minValue, maxValue); + this(name, defaultValues, type, langKey, isListFixedLength, -1, null, minValue, maxValue); } public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, int maxListLength, Object minValue, Object maxValue) { - this(name, defaultValues, type, langKey, false, maxListLength, (Pattern) null, minValue, maxValue); + this(name, defaultValues, type, langKey, false, maxListLength, null, minValue, maxValue); } public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, boolean isListFixedLength, int maxListLength, Object minValue, Object maxValue) { - this(name, defaultValues, type, langKey, isListFixedLength, maxListLength, (Pattern) null, minValue, maxValue); + this(name, defaultValues, type, langKey, isListFixedLength, maxListLength, null, minValue, maxValue); } public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, Pattern validStringPattern) { - this(name, defaultValues, type, langKey, false, -1, validStringPattern, (Object) null, (Object) null); + this(name, defaultValues, type, langKey, false, -1, validStringPattern, null, null); } public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, boolean isListFixedLength, Pattern validStringPattern) { - this(name, defaultValues, type, langKey, isListFixedLength, -1, validStringPattern, (Object) null, (Object) null); + this(name, defaultValues, type, langKey, isListFixedLength, -1, validStringPattern, null, null); } public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, int maxListLength, Pattern validStringPattern) { - this(name, defaultValues, type, langKey, false, maxListLength, validStringPattern, (Object) null, (Object) null); + this(name, defaultValues, type, langKey, false, maxListLength, validStringPattern, null, null); } public DummyListElement setCustomEditListEntryClass(Class clazz) @@ -168,18 +168,18 @@ public class DummyConfigElement implements IConfigElement if (minValue == null) { if (type == ConfigGuiType.INTEGER) - this.minValue = (Integer) Integer.MIN_VALUE; + this.minValue = Integer.MIN_VALUE; else if (type == ConfigGuiType.DOUBLE) - this.minValue = (Double) (-Double.MAX_VALUE); + this.minValue = -Double.MAX_VALUE; } else this.minValue = minValue; if (maxValue == null) { if (type == ConfigGuiType.INTEGER) - this.maxValue = (Integer) Integer.MAX_VALUE; + this.maxValue = Integer.MAX_VALUE; else if (type == ConfigGuiType.DOUBLE) - this.maxValue = (Double) Double.MAX_VALUE; + this.maxValue = Double.MAX_VALUE; } else this.maxValue = maxValue; @@ -187,22 +187,22 @@ public class DummyConfigElement implements IConfigElement public DummyConfigElement(String name, Object defaultValue, ConfigGuiType type, String langKey, Pattern validStringPattern) { - this(name, defaultValue, type, langKey, (String[]) null, validStringPattern, (Object) null, (Object) null); + this(name, defaultValue, type, langKey, null, validStringPattern, null, null); } public DummyConfigElement(String name, Object defaultValue, ConfigGuiType type, String langKey, String[] validValues) { - this(name, defaultValue, type, langKey, validValues, (Pattern) null, (Object) null, (Object) null); + this(name, defaultValue, type, langKey, validValues, null, null, null); } public DummyConfigElement(String name, Object defaultValue, ConfigGuiType type, String langKey) { - this(name, defaultValue, type, langKey, (String[]) null, (Pattern) null, (Object) null, (Object) null); + this(name, defaultValue, type, langKey, null, null, null, null); } public DummyConfigElement(String name, Object defaultValue, ConfigGuiType type, String langKey, Object minValue, Object maxValue) { - this(name, defaultValue, type, langKey, (String[]) null, (Pattern) null, minValue, maxValue); + this(name, defaultValue, type, langKey, null, null, minValue, maxValue); } public DummyConfigElement setCustomListEntryClass(Class clazz) diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java b/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java index b8ff0e06e1..40585a3470 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java @@ -325,9 +325,9 @@ public class GuiConfig extends GuiScreen if (title2 != null) { int strWidth = mc.fontRendererObj.getStringWidth(title2); - int elipsisWidth = mc.fontRendererObj.getStringWidth("..."); - if (strWidth > width - 6 && strWidth > elipsisWidth) - title2 = mc.fontRendererObj.trimStringToWidth(title2, width - 6 - elipsisWidth).trim() + "..."; + int ellipsisWidth = mc.fontRendererObj.getStringWidth("..."); + if (strWidth > width - 6 && strWidth > ellipsisWidth) + title2 = mc.fontRendererObj.trimStringToWidth(title2, width - 6 - ellipsisWidth).trim() + "..."; this.drawCenteredString(this.fontRendererObj, title2, this.width / 2, 18, 16777215); } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java b/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java index dd9355323a..53ede6229b 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java @@ -114,7 +114,7 @@ public class GuiConfigEntries extends GuiListExtended if (configElement.getConfigEntryClass() != null) try { - this.listEntries.add((IConfigEntry) configElement.getConfigEntryClass() + this.listEntries.add(configElement.getConfigEntryClass() .getConstructor(GuiConfig.class, GuiConfigEntries.class, IConfigElement.class) .newInstance(this.owningScreen, this, configElement)); } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiEditArrayEntries.java b/src/main/java/net/minecraftforge/fml/client/config/GuiEditArrayEntries.java index ac86dcbe63..f96069c647 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiEditArrayEntries.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiEditArrayEntries.java @@ -128,7 +128,7 @@ public class GuiEditArrayEntries extends GuiListExtended public void addNewEntry(int index) { if (configElement.isList() && configElement.getType() == ConfigGuiType.BOOLEAN) - listEntries.add(index, new BooleanEntry(this.owningGui, this, this.configElement, Boolean.valueOf(true))); + listEntries.add(index, new BooleanEntry(this.owningGui, this, this.configElement, true)); else if (configElement.isList() && configElement.getType() == ConfigGuiType.INTEGER) listEntries.add(index, new IntegerEntry(this.owningGui, this, this.configElement, 0)); else if (configElement.isList() && configElement.getType() == ConfigGuiType.DOUBLE) @@ -519,7 +519,7 @@ public class GuiEditArrayEntries extends GuiListExtended @Override public Object getValue() { - return Boolean.valueOf(value); + return value; } } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiMessageDialog.java b/src/main/java/net/minecraftforge/fml/client/config/GuiMessageDialog.java index bb34783706..041ab11c0c 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiMessageDialog.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiMessageDialog.java @@ -20,6 +20,6 @@ public class GuiMessageDialog extends GuiDisconnected public void initGui() { super.initGui(); - ((GuiButton) buttonList.get(0)).displayString = I18n.format(buttonText); + buttonList.get(0).displayString = I18n.format(buttonText); } } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiUnicodeGlyphButton.java b/src/main/java/net/minecraftforge/fml/client/config/GuiUnicodeGlyphButton.java index d11289868b..c5986016be 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiUnicodeGlyphButton.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiUnicodeGlyphButton.java @@ -59,11 +59,11 @@ public class GuiUnicodeGlyphButton extends GuiButtonExt String buttonText = this.displayString; int glyphWidth = (int) (mc.fontRendererObj.getStringWidth(glyph) * glyphScale); int strWidth = mc.fontRendererObj.getStringWidth(buttonText); - int elipsisWidth = mc.fontRendererObj.getStringWidth("..."); + int ellipsisWidth = mc.fontRendererObj.getStringWidth("..."); int totalWidth = strWidth + glyphWidth; - if (totalWidth > width - 6 && totalWidth > elipsisWidth) - buttonText = mc.fontRendererObj.trimStringToWidth(buttonText, width - 6 - elipsisWidth).trim() + "..."; + if (totalWidth > width - 6 && totalWidth > ellipsisWidth) + buttonText = mc.fontRendererObj.trimStringToWidth(buttonText, width - 6 - ellipsisWidth).trim() + "..."; strWidth = mc.fontRendererObj.getStringWidth(buttonText); totalWidth = glyphWidth + strWidth; diff --git a/src/main/java/net/minecraftforge/fml/client/registry/ClientRegistry.java b/src/main/java/net/minecraftforge/fml/client/registry/ClientRegistry.java index 94490d3579..fce21b3621 100644 --- a/src/main/java/net/minecraftforge/fml/client/registry/ClientRegistry.java +++ b/src/main/java/net/minecraftforge/fml/client/registry/ClientRegistry.java @@ -57,7 +57,7 @@ public class ClientRegistry /** * Register a shader for an entity. This shader gets activated when a spectator begins spectating an entity. - * Vanilla examples of this are the green effect for creepers and the invert effect for endermans. + * Vanilla examples of this are the green effect for creepers and the invert effect for endermen. * * @param entityClass * @param shader diff --git a/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java b/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java index e7aadf6a84..d963e0b7a3 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java @@ -215,7 +215,7 @@ public class FMLCommonHandler { if (brandings == null) { - Builder brd = ImmutableList.builder(); + Builder brd = ImmutableList.builder(); brd.add(Loader.instance().getMCVersionString()); brd.add(Loader.instance().getMCPVersionString()); brd.add("Powered by Forge " + ForgeVersion.getVersion()); @@ -691,7 +691,7 @@ public class FMLCommonHandler } /** - * Loads a lang file, first searching for a marker to enable the 'extended' format {escape charaters} + * Loads a lang file, first searching for a marker to enable the 'extended' format {escape characters} * If the marker is not found it simply returns and let the vanilla code load things. * The Marker is 'PARSE_ESCAPES' by itself on a line starting with '#' as such: * #PARSE_ESCAPES diff --git a/src/main/java/net/minecraftforge/fml/common/FMLContainer.java b/src/main/java/net/minecraftforge/fml/common/FMLContainer.java index 6808f1c2bf..3af70ae254 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLContainer.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLContainer.java @@ -35,7 +35,6 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.network.NetworkCheckHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; -import net.minecraftforge.fml.common.registry.GameData; import net.minecraftforge.fml.common.registry.PersistentRegistryManager; import net.minecraftforge.fml.common.registry.VillagerRegistry; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/net/minecraftforge/fml/common/FMLModContainer.java b/src/main/java/net/minecraftforge/fml/common/FMLModContainer.java index abc5753f1c..8452fdc8b0 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLModContainer.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLModContainer.java @@ -167,7 +167,7 @@ public class FMLModContainer implements ModContainer if (descriptor.containsKey("useMetadata")) { - overridesMetadata = !((Boolean)descriptor.get("useMetadata")).booleanValue(); + overridesMetadata = !((Boolean)descriptor.get("useMetadata")); } if (overridesMetadata || !modMetadata.useDependencyInformation) @@ -400,7 +400,7 @@ public class FMLModContainer implements ModContainer }); } - private void parseSimpleFieldAnnotation(SetMultimap annotations, String annotationClassName, Function retreiver) throws IllegalAccessException + private void parseSimpleFieldAnnotation(SetMultimap annotations, String annotationClassName, Function retriever) throws IllegalAccessException { String[] annName = annotationClassName.split("\\."); String annotationName = annName[annName.length - 1]; @@ -431,7 +431,7 @@ public class FMLModContainer implements ModContainer f = clz.getDeclaredField(targets.getObjectName()); f.setAccessible(true); isStatic = Modifier.isStatic(f.getModifiers()); - injectedMod = retreiver.apply(mc); + injectedMod = retriever.apply(mc); } catch (Exception e) { @@ -473,7 +473,7 @@ public class FMLModContainer implements ModContainer { len = certificates.length; } - Builder certBuilder = ImmutableList.builder(); + Builder certBuilder = ImmutableList.builder(); for (int i = 0; i < len; i++) { certBuilder.add(CertificateHelper.getFingerprint(certificates[i])); @@ -508,7 +508,7 @@ public class FMLModContainer implements ModContainer List> props = (List>)descriptor.get("customProperties"); if (props != null) { - com.google.common.collect.ImmutableMap.Builder builder = ImmutableMap.builder(); + com.google.common.collect.ImmutableMap.Builder builder = ImmutableMap.builder(); for (Map p : props) { builder.put((String)p.get("k"), (String)p.get("v")); @@ -663,7 +663,7 @@ public class FMLModContainer implements ModContainer { return false; } - return value.booleanValue(); + return value; } @Override diff --git a/src/main/java/net/minecraftforge/fml/common/ILanguageAdapter.java b/src/main/java/net/minecraftforge/fml/common/ILanguageAdapter.java index 9b14eff253..50415e2bef 100644 --- a/src/main/java/net/minecraftforge/fml/common/ILanguageAdapter.java +++ b/src/main/java/net/minecraftforge/fml/common/ILanguageAdapter.java @@ -55,7 +55,7 @@ public interface ILanguageAdapter { catch (ClassNotFoundException e) { // Not a singleton, look for @Instance field as a fallback. - FMLLog.log(Level.INFO, e, "An error occured trying to load a proxy into %s.%s. Did you declare your mod as 'class' instead of 'object'?", proxyTarget.getSimpleName(), target.getName()); + FMLLog.log(Level.INFO, e, "An error occurred trying to load a proxy into %s.%s. Did you declare your mod as 'class' instead of 'object'?", proxyTarget.getSimpleName(), target.getName()); return; } @@ -91,7 +91,7 @@ public interface ILanguageAdapter { } catch (InvocationTargetException e) { - FMLLog.log(Level.ERROR, e, "An error occured trying to load a proxy into %s.%s", proxyTarget.getSimpleName(), target.getName()); + FMLLog.log(Level.ERROR, e, "An error occurred trying to load a proxy into %s.%s", proxyTarget.getSimpleName(), target.getName()); throw new LoaderException(e); } @@ -148,7 +148,7 @@ public interface ILanguageAdapter { setProxy(target, proxyTarget, proxy); } catch (Exception e) { - FMLLog.log(Level.ERROR, e, "An error occured trying to load a proxy into %s.%s", proxyTarget.getSimpleName(), target.getName()); + FMLLog.log(Level.ERROR, e, "An error occurred trying to load a proxy into %s.%s", proxyTarget.getSimpleName(), target.getName()); throw new LoaderException(e); } } diff --git a/src/main/java/net/minecraftforge/fml/common/LoadController.java b/src/main/java/net/minecraftforge/fml/common/LoadController.java index 59429b69c1..ec990c52e2 100644 --- a/src/main/java/net/minecraftforge/fml/common/LoadController.java +++ b/src/main/java/net/minecraftforge/fml/common/LoadController.java @@ -237,7 +237,7 @@ public class LoadController public ImmutableBiMap buildModObjectList() { - ImmutableBiMap.Builder builder = ImmutableBiMap.builder(); + ImmutableBiMap.Builder builder = ImmutableBiMap.builder(); for (ModContainer mc : activeModList) { if (!mc.isImmutable() && mc.getMod()!=null) @@ -265,7 +265,7 @@ public class LoadController { if (exception instanceof InvocationTargetException) { - errors.put(modContainer.getModId(), ((InvocationTargetException)exception).getCause()); + errors.put(modContainer.getModId(), exception.getCause()); } else { diff --git a/src/main/java/net/minecraftforge/fml/common/Loader.java b/src/main/java/net/minecraftforge/fml/common/Loader.java index 157b27d3af..8759e1fdb6 100644 --- a/src/main/java/net/minecraftforge/fml/common/Loader.java +++ b/src/main/java/net/minecraftforge/fml/common/Loader.java @@ -340,7 +340,7 @@ public class Loader } catch (Exception e) { - FMLLog.log(Level.ERROR, e, "A problem occured instantiating the injected mod container %s", cont); + FMLLog.log(Level.ERROR, e, "A problem occurred instantiating the injected mod container %s", cont); throw new LoaderException(e); } mods.add(new InjectedModContainer(mc,mc.getSource())); diff --git a/src/main/java/net/minecraftforge/fml/common/Mod.java b/src/main/java/net/minecraftforge/fml/common/Mod.java index 0460ffb43d..33ab006aaf 100644 --- a/src/main/java/net/minecraftforge/fml/common/Mod.java +++ b/src/main/java/net/minecraftforge/fml/common/Mod.java @@ -104,7 +104,7 @@ public @interface Mod /** * The acceptable range of minecraft versions that this mod will load and run in * The default ("empty string") indicates that the currently RUNNING minecraft version is acceptable. - * This means ANY version that the end user adds the mod to. Modders PLEASS set this. + * This means ANY version that the end user adds the mod to. Modders PLEASE set this. * FML will refuse to run with an error if the minecraft version is not in this range across all mods. * @return A version range as specified by the maven version range specification or the empty string */ diff --git a/src/main/java/net/minecraftforge/fml/common/ProxyInjector.java b/src/main/java/net/minecraftforge/fml/common/ProxyInjector.java index c44bca64dc..b1a22fc991 100644 --- a/src/main/java/net/minecraftforge/fml/common/ProxyInjector.java +++ b/src/main/java/net/minecraftforge/fml/common/ProxyInjector.java @@ -77,7 +77,7 @@ public class ProxyInjector } catch (Exception e) { - FMLLog.log(Level.ERROR, e, "An error occured trying to load a proxy into %s.%s", targ.getAnnotationInfo(), targ.getClassName(), targ.getObjectName()); + FMLLog.log(Level.ERROR, e, "An error occurred trying to load a proxy into %s.%s", targ.getAnnotationInfo(), targ.getClassName(), targ.getObjectName()); throw new LoaderException(e); } } diff --git a/src/main/java/net/minecraftforge/fml/common/asm/transformers/AccessTransformer.java b/src/main/java/net/minecraftforge/fml/common/asm/transformers/AccessTransformer.java index 6b60ace8e7..a744891375 100644 --- a/src/main/java/net/minecraftforge/fml/common/asm/transformers/AccessTransformer.java +++ b/src/main/java/net/minecraftforge/fml/common/asm/transformers/AccessTransformer.java @@ -219,7 +219,7 @@ public class AccessTransformer implements IClassTransformer } else { - List nowOverridable = Lists.newArrayList(); + List nowOverrideable = Lists.newArrayList(); for (MethodNode n : classNode.methods) { if ((n.name.equals(m.name) && n.desc.equals(m.desc)) || m.name.equals("*")) @@ -236,7 +236,7 @@ public class AccessTransformer implements IClassTransformer if (wasPrivate && !isNowPrivate) { - nowOverridable.add(n); + nowOverrideable.add(n); } } @@ -253,7 +253,7 @@ public class AccessTransformer implements IClassTransformer } } - replaceInvokeSpecial(classNode, nowOverridable); + replaceInvokeSpecial(classNode, nowOverrideable); } } @@ -356,7 +356,7 @@ public class AccessTransformer implements IClassTransformer if (!hasTransformer) { - System.out.println("Culd not find a valid transformer to perform"); + System.out.println("Could not find a valid transformer to perform"); System.exit(1); } diff --git a/src/main/java/net/minecraftforge/fml/common/asm/transformers/DeobfuscationTransformer.java b/src/main/java/net/minecraftforge/fml/common/asm/transformers/DeobfuscationTransformer.java index e88fabfa1d..236df95778 100644 --- a/src/main/java/net/minecraftforge/fml/common/asm/transformers/DeobfuscationTransformer.java +++ b/src/main/java/net/minecraftforge/fml/common/asm/transformers/DeobfuscationTransformer.java @@ -27,7 +27,7 @@ public class DeobfuscationTransformer implements IClassTransformer, IClassNameTr private static final int WRITER_FLAGS = ClassWriter.COMPUTE_MAXS | (RECALC_FRAMES ? ClassWriter.COMPUTE_FRAMES : 0); private static final int READER_FLAGS = RECALC_FRAMES ? ClassReader.SKIP_FRAMES : ClassReader.EXPAND_FRAMES; // COMPUTE_FRAMES causes classes to be loaded, which could cause issues if the classes do not exist. - // However in testing this has not happened. {As we run post SideTransfromer} + // However in testing this has not happened. {As we run post SideTransformer} // If reported we need to add a custom implementation of ClassWriter.getCommonSuperClass // that does not cause class loading. diff --git a/src/main/java/net/minecraftforge/fml/common/asm/transformers/EventSubscriberTransformer.java b/src/main/java/net/minecraftforge/fml/common/asm/transformers/EventSubscriberTransformer.java index c910b2402e..a080d4237e 100644 --- a/src/main/java/net/minecraftforge/fml/common/asm/transformers/EventSubscriberTransformer.java +++ b/src/main/java/net/minecraftforge/fml/common/asm/transformers/EventSubscriberTransformer.java @@ -35,7 +35,7 @@ public class EventSubscriberTransformer implements IClassTransformer { if (Modifier.isPrivate(methodNode.access)) { - String msg = "Cannot apply @SubsribeEvent to private method %s/%s%s"; + String msg = "Cannot apply @SubscribeEvent to private method %s/%s%s"; throw new RuntimeException(String.format(msg, classNode.name, methodNode.name, methodNode.desc)); } diff --git a/src/main/java/net/minecraftforge/fml/common/asm/transformers/EventSubscriptionTransformer.java b/src/main/java/net/minecraftforge/fml/common/asm/transformers/EventSubscriptionTransformer.java index 7013cb630b..5b54550045 100644 --- a/src/main/java/net/minecraftforge/fml/common/asm/transformers/EventSubscriptionTransformer.java +++ b/src/main/java/net/minecraftforge/fml/common/asm/transformers/EventSubscriptionTransformer.java @@ -105,7 +105,7 @@ public class EventSubscriptionTransformer implements IClassTransformer String listDesc = tList.getDescriptor(); String listDescM = Type.getMethodDescriptor(tList); - for (MethodNode method : (List)classNode.methods) + for (MethodNode method : classNode.methods) { if (method.name.equals("setup") && method.desc.equals(voidDesc) && (method.access & ACC_PROTECTED) == ACC_PROTECTED) hasSetup = true; if ((method.access & ACC_PUBLIC) == ACC_PUBLIC) @@ -195,10 +195,10 @@ public class EventSubscriptionTransformer implements IClassTransformer method.instructions.add(new VarInsnNode(ALOAD, 0)); method.instructions.add(new MethodInsnNode(INVOKESPECIAL, tSuper.getInternalName(), "setup", voidDesc, false)); method.instructions.add(new FieldInsnNode(GETSTATIC, classNode.name, "LISTENER_LIST", listDesc)); - LabelNode initLisitener = new LabelNode(); - method.instructions.add(new JumpInsnNode(IFNULL, initLisitener)); + LabelNode initListener = new LabelNode(); + method.instructions.add(new JumpInsnNode(IFNULL, initListener)); method.instructions.add(new InsnNode(RETURN)); - method.instructions.add(initLisitener); + method.instructions.add(initListener); method.instructions.add(new FrameNode(F_SAME, 0, null, 0, null)); method.instructions.add(new TypeInsnNode(NEW, tList.getInternalName())); method.instructions.add(new InsnNode(DUP)); diff --git a/src/main/java/net/minecraftforge/fml/common/asm/transformers/MarkerTransformer.java b/src/main/java/net/minecraftforge/fml/common/asm/transformers/MarkerTransformer.java index 1ee32d23ce..1774ca4677 100644 --- a/src/main/java/net/minecraftforge/fml/common/asm/transformers/MarkerTransformer.java +++ b/src/main/java/net/minecraftforge/fml/common/asm/transformers/MarkerTransformer.java @@ -143,7 +143,7 @@ public class MarkerTransformer implements IClassTransformer if (!hasTransformer) { - System.out.println("Culd not find a valid transformer to perform"); + System.out.println("Could not find a valid transformer to perform"); return; } diff --git a/src/main/java/net/minecraftforge/fml/common/asm/transformers/ModAPITransformer.java b/src/main/java/net/minecraftforge/fml/common/asm/transformers/ModAPITransformer.java index 849e73b4ba..e76c1b7cbc 100644 --- a/src/main/java/net/minecraftforge/fml/common/asm/transformers/ModAPITransformer.java +++ b/src/main/java/net/minecraftforge/fml/common/asm/transformers/ModAPITransformer.java @@ -63,7 +63,7 @@ public class ModAPITransformer implements IClassTransformer { } else { - stripMethod(classNode, (String)optional.getObjectName()); + stripMethod(classNode, optional.getObjectName()); } } diff --git a/src/main/java/net/minecraftforge/fml/common/asm/transformers/SideTransformer.java b/src/main/java/net/minecraftforge/fml/common/asm/transformers/SideTransformer.java index db1ae089c6..17535aa7a3 100644 --- a/src/main/java/net/minecraftforge/fml/common/asm/transformers/SideTransformer.java +++ b/src/main/java/net/minecraftforge/fml/common/asm/transformers/SideTransformer.java @@ -40,7 +40,7 @@ public class SideTransformer implements IClassTransformer ClassReader classReader = new ClassReader(bytes); classReader.accept(classNode, 0); - if (remove((List)classNode.visibleAnnotations, SIDE)) + if (remove(classNode.visibleAnnotations, SIDE)) { if (DEBUG) { @@ -53,7 +53,7 @@ public class SideTransformer implements IClassTransformer while(fields.hasNext()) { FieldNode field = fields.next(); - if (remove((List)field.visibleAnnotations, SIDE)) + if (remove(field.visibleAnnotations, SIDE)) { if (DEBUG) { @@ -66,7 +66,7 @@ public class SideTransformer implements IClassTransformer while(methods.hasNext()) { MethodNode method = methods.next(); - if (remove((List)method.visibleAnnotations, SIDE)) + if (remove(method.visibleAnnotations, SIDE)) { if (DEBUG) { diff --git a/src/main/java/net/minecraftforge/fml/common/asm/transformers/TerminalTransformer.java b/src/main/java/net/minecraftforge/fml/common/asm/transformers/TerminalTransformer.java index 684edf1168..a1d75d7ec7 100644 --- a/src/main/java/net/minecraftforge/fml/common/asm/transformers/TerminalTransformer.java +++ b/src/main/java/net/minecraftforge/fml/common/asm/transformers/TerminalTransformer.java @@ -64,7 +64,7 @@ public class TerminalTransformer implements IClassTransformer { FMLRelaunchLog.warning("============================================================="); FMLRelaunchLog.warning("MOD HAS DIRECT REFERENCE System.exit() THIS IS NOT ALLOWED REROUTING TO FML!"); - FMLRelaunchLog.warning("Offendor: %s.%s%s", ExitVisitor.this.clsName, mName, mDesc); + FMLRelaunchLog.warning("Offender: %s.%s%s", ExitVisitor.this.clsName, mName, mDesc); FMLRelaunchLog.warning("Use FMLCommonHandler.exitJava instead"); FMLRelaunchLog.warning("============================================================="); } @@ -77,7 +77,7 @@ public class TerminalTransformer implements IClassTransformer { FMLRelaunchLog.warning("============================================================="); FMLRelaunchLog.warning("MOD HAS DIRECT REFERENCE Runtime.exit() THIS IS NOT ALLOWED REROUTING TO FML!"); - FMLRelaunchLog.warning("Offendor: %s.%s%s", ExitVisitor.this.clsName, mName, mDesc); + FMLRelaunchLog.warning("Offender: %s.%s%s", ExitVisitor.this.clsName, mName, mDesc); FMLRelaunchLog.warning("Use FMLCommonHandler.exitJava instead"); FMLRelaunchLog.warning("============================================================="); } diff --git a/src/main/java/net/minecraftforge/fml/common/asm/transformers/deobf/FMLDeobfuscatingRemapper.java b/src/main/java/net/minecraftforge/fml/common/asm/transformers/deobf/FMLDeobfuscatingRemapper.java index fcf04f4ca6..8f4f5d0a58 100644 --- a/src/main/java/net/minecraftforge/fml/common/asm/transformers/deobf/FMLDeobfuscatingRemapper.java +++ b/src/main/java/net/minecraftforge/fml/common/asm/transformers/deobf/FMLDeobfuscatingRemapper.java @@ -80,7 +80,7 @@ public class FMLDeobfuscatingRemapper extends Remapper { List srgList = srgSource.readLines(); rawMethodMaps = Maps.newHashMap(); rawFieldMaps = Maps.newHashMap(); - Builder builder = ImmutableBiMap.builder(); + Builder builder = ImmutableBiMap.builder(); Splitter splitter = Splitter.on(CharMatcher.anyOf(": ")).omitEmptyStrings().trimResults(); for (String line : srgList) { @@ -134,7 +134,7 @@ public class FMLDeobfuscatingRemapper extends Remapper { rawMethodMaps = Maps.newHashMap(); rawFieldMaps = Maps.newHashMap(); - Builder builder = ImmutableBiMap.builder(); + Builder builder = ImmutableBiMap.builder(); Splitter splitter = Splitter.on(CharMatcher.anyOf(": ")).omitEmptyStrings().trimResults(); for (String line : srgList) { @@ -216,7 +216,7 @@ public class FMLDeobfuscatingRemapper extends Remapper { ClassNode classNode = new ClassNode(); cr.accept(classNode, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES); Map resMap = Maps.newHashMap(); - for (FieldNode fieldNode : (List) classNode.fields) { + for (FieldNode fieldNode : classNode.fields) { resMap.put(fieldNode.name, fieldNode.desc); } fieldDescriptions.put(owner, resMap); @@ -224,7 +224,7 @@ public class FMLDeobfuscatingRemapper extends Remapper { } catch (IOException e) { - FMLRelaunchLog.log(Level.ERROR,e, "A critical exception occured reading a class file %s", owner); + FMLRelaunchLog.log(Level.ERROR,e, "A critical exception occurred reading a class file %s", owner); } return null; } @@ -403,8 +403,8 @@ public class FMLDeobfuscatingRemapper extends Remapper { findAndMergeSuperMaps(parentThing); } } - Map methodMap = Maps.newHashMap(); - Map fieldMap = Maps.newHashMap(); + Map methodMap = Maps.newHashMap(); + Map fieldMap = Maps.newHashMap(); for (String parentThing : allParents) { if (methodNameMaps.containsKey(parentThing)) diff --git a/src/main/java/net/minecraftforge/fml/common/discovery/ASMDataTable.java b/src/main/java/net/minecraftforge/fml/common/discovery/ASMDataTable.java index aa82dd0b6a..6eb8dec441 100644 --- a/src/main/java/net/minecraftforge/fml/common/discovery/ASMDataTable.java +++ b/src/main/java/net/minecraftforge/fml/common/discovery/ASMDataTable.java @@ -103,7 +103,7 @@ public class ASMDataTable { if (containerAnnotationData == null) { - ImmutableMap.Builder> mapBuilder = ImmutableMap.>builder(); + ImmutableMap.Builder> mapBuilder = ImmutableMap.builder(); for (ModContainer cont : containers) { Multimap values = Multimaps.filterValues(globalAnnotationData, new ModContainerPredicate(cont)); diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLInterModComms.java b/src/main/java/net/minecraftforge/fml/common/event/FMLInterModComms.java index 5db8c1409a..0be1af0350 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLInterModComms.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLInterModComms.java @@ -35,7 +35,7 @@ import org.apache.logging.log4j.Level; * */ public class FMLInterModComms { - private static final ImmutableList emptyIMCList = ImmutableList.of(); + private static final ImmutableList emptyIMCList = ImmutableList.of(); private static ArrayListMultimap modMessages = ArrayListMultimap.create(); /** diff --git a/src/main/java/net/minecraftforge/fml/common/eventhandler/Event.java b/src/main/java/net/minecraftforge/fml/common/eventhandler/Event.java index 2a1b1d1009..cf32be2d0f 100644 --- a/src/main/java/net/minecraftforge/fml/common/eventhandler/Event.java +++ b/src/main/java/net/minecraftforge/fml/common/eventhandler/Event.java @@ -71,7 +71,7 @@ public class Event { if (!isCancelable()) { - throw new IllegalArgumentException("Attempted to cancel a uncancelable event"); + throw new IllegalArgumentException("Attempted to cancel a non cancellable event"); } isCanceled = cancel; } @@ -109,7 +109,7 @@ public class Event } /** * Called by the base constructor, this is used by ASM generated - * event classes to setup various functionality such as the listenerlist. + * event classes to setup various functionality such as the listener list. */ protected void setup() { diff --git a/src/main/java/net/minecraftforge/fml/common/eventhandler/IEventExceptionHandler.java b/src/main/java/net/minecraftforge/fml/common/eventhandler/IEventExceptionHandler.java index 749128b43f..b7285593de 100644 --- a/src/main/java/net/minecraftforge/fml/common/eventhandler/IEventExceptionHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/eventhandler/IEventExceptionHandler.java @@ -4,7 +4,7 @@ public interface IEventExceptionHandler { /** * Fired when a EventListener throws an exception for the specified event on the event bus. - * After this function returns, the original Throwable will be propogated upwards. + * After this function returns, the original Throwable will be propagated upwards. * * @param bus The bus the event is being fired on * @param event The event that is being fired diff --git a/src/main/java/net/minecraftforge/fml/common/functions/CollectionWrapperFactory.java b/src/main/java/net/minecraftforge/fml/common/functions/CollectionWrapperFactory.java index aed3a8af6f..be6ff3949b 100644 --- a/src/main/java/net/minecraftforge/fml/common/functions/CollectionWrapperFactory.java +++ b/src/main/java/net/minecraftforge/fml/common/functions/CollectionWrapperFactory.java @@ -7,9 +7,9 @@ import com.google.common.collect.Lists; public class CollectionWrapperFactory { /** - * Return a read only cast view of the supplied ungeneric collection, based on the element type given + * Return a read only cast view of the supplied raw collection, based on the element type given * @param coll The collection to cast - * @param elementType the supertype contained in the collection + * @param elementType the super type contained in the collection * @return a collection asserting that type relationship */ public static Collection wrap(@SuppressWarnings("rawtypes") Collection coll, Class elementType) @@ -19,9 +19,9 @@ public class CollectionWrapperFactory { } /** - * Return a read only cast view of the supplied ungeneric list, based on the element type given + * Return a read only cast view of the supplied raw list, based on the element type given * @param list The list to cast - * @param elementType the supertype contained in the list + * @param elementType the super type contained in the list * @return a list asserting that type relationship */ public static List wrap(@SuppressWarnings("rawtypes") List list, Class elementType) diff --git a/src/main/java/net/minecraftforge/fml/common/launcher/FMLDeobfTweaker.java b/src/main/java/net/minecraftforge/fml/common/launcher/FMLDeobfTweaker.java index 09dc9ee523..43baa1a294 100644 --- a/src/main/java/net/minecraftforge/fml/common/launcher/FMLDeobfTweaker.java +++ b/src/main/java/net/minecraftforge/fml/common/launcher/FMLDeobfTweaker.java @@ -41,7 +41,7 @@ public class FMLDeobfTweaker implements ITweaker { catch (Exception e) { // Load in the Loader, make sure he's ready to roll - this will initialize most of the rest of minecraft here - System.out.println("A CRITICAL PROBLEM OCCURED INITIALIZING MINECRAFT - LIKELY YOU HAVE AN INCORRECT VERSION FOR THIS FML"); + System.out.println("A CRITICAL PROBLEM OCCURRED INITIALIZING MINECRAFT - LIKELY YOU HAVE AN INCORRECT VERSION FOR THIS FML"); throw new RuntimeException(e); } } diff --git a/src/main/java/net/minecraftforge/fml/common/launcher/Yggdrasil.java b/src/main/java/net/minecraftforge/fml/common/launcher/Yggdrasil.java index d7cfae1917..1da0c50911 100644 --- a/src/main/java/net/minecraftforge/fml/common/launcher/Yggdrasil.java +++ b/src/main/java/net/minecraftforge/fml/common/launcher/Yggdrasil.java @@ -32,7 +32,7 @@ public class Yggdrasil { LogManager.getLogger("FMLTWEAK").error("-- Login failed! " + e.getMessage()); Throwables.propagate(e); - return; // dont set other variables + return; // don't set other variables } args.put("--username", auth.getSelectedProfile().getName()); diff --git a/src/main/java/net/minecraftforge/fml/common/network/ByteBufUtils.java b/src/main/java/net/minecraftforge/fml/common/network/ByteBufUtils.java index 266d3f17ec..c1843cc9d2 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/ByteBufUtils.java +++ b/src/main/java/net/minecraftforge/fml/common/network/ByteBufUtils.java @@ -240,7 +240,7 @@ public class ByteBufUtils { // Add the tab for alignment returnString.append('\t'); - // Add final chararacters at right, after padding + // Add final characters at right, after padding // If it was at the end of a line, print out the full line if (i > 0 && (i % 16) == 0) diff --git a/src/main/java/net/minecraftforge/fml/common/network/FMLIndexedMessageToMessageCodec.java b/src/main/java/net/minecraftforge/fml/common/network/FMLIndexedMessageToMessageCodec.java index c168081f16..dd9888ca6b 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/FMLIndexedMessageToMessageCodec.java +++ b/src/main/java/net/minecraftforge/fml/common/network/FMLIndexedMessageToMessageCodec.java @@ -44,13 +44,12 @@ public abstract class FMLIndexedMessageToMessageCodec extends MessageToMessag } public abstract void encodeInto(ChannelHandlerContext ctx, A msg, ByteBuf target) throws Exception; + @Override protected final void encode(ChannelHandlerContext ctx, A msg, List out) throws Exception { PacketBuffer buffer = new PacketBuffer(Unpooled.buffer()); - @SuppressWarnings("unchecked") // Stupid unnecessary cast I can't seem to kill - Class clazz = (Class) msg.getClass(); - byte discriminator = types.get(clazz); + byte discriminator = types.get(msg.getClass()); buffer.writeByte(discriminator); encodeInto(ctx, msg, buffer); FMLProxyPacket proxy = new FMLProxyPacket(buffer/*.copy()*/, ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get()); diff --git a/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java b/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java index 4153af858a..36a366f34d 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java @@ -127,8 +127,8 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter { @Override public List selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet) { - ImmutableList.Builder builder = ImmutableList.builder(); - for (EntityPlayerMP player : (List)FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList()) + ImmutableList.Builder builder = ImmutableList.builder(); + for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList()) { NetworkDispatcher dispatcher = player.playerNetServerHandler.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get(); if (dispatcher != null) builder.add(dispatcher); @@ -155,8 +155,8 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter { public List selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet) { int dimension = (Integer)args; - ImmutableList.Builder builder = ImmutableList.builder(); - for (EntityPlayerMP player : (List)FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList()) + ImmutableList.Builder builder = ImmutableList.builder(); + for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList()) { if (dimension == player.dimension) { @@ -189,8 +189,8 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter { public List selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet) { TargetPoint tp = (TargetPoint)args; - ImmutableList.Builder builder = ImmutableList.builder(); - for (EntityPlayerMP player : (List)FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList()) + ImmutableList.Builder builder = ImmutableList.builder(); + for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList()) { if (player.dimension == tp.dimension) { diff --git a/src/main/java/net/minecraftforge/fml/common/network/PacketLoggingHandler.java b/src/main/java/net/minecraftforge/fml/common/network/PacketLoggingHandler.java index 54b5fecf0f..a098c150f2 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/PacketLoggingHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/PacketLoggingHandler.java @@ -23,18 +23,17 @@ import net.minecraftforge.fml.common.FMLLog; public class PacketLoggingHandler { - @SuppressWarnings("rawtypes") - public static void register(NetworkManager manager) + public static void register(NetworkManager manager) { ChannelPipeline pipeline = manager.channel().pipeline(); final EnumPacketDirection direction = manager.getDirection(); if (manager.isLocalChannel()) { - pipeline.addBefore("packet_handler", "splitter", new SimpleChannelInboundHandler() + pipeline.addBefore("packet_handler", "splitter", new SimpleChannelInboundHandler>() { String prefix = (direction == EnumPacketDirection.SERVERBOUND ? "SERVER: C->S" : "CLIENT: S->C"); @Override - protected void channelRead0(ChannelHandlerContext ctx, Packet msg) throws Exception + protected void channelRead0(ChannelHandlerContext ctx, Packet msg) throws Exception { PacketBuffer buf = new PacketBuffer(Unpooled.buffer()); msg.writePacketData(buf); @@ -48,10 +47,10 @@ public class PacketLoggingHandler @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { - if (msg instanceof Packet) + if (msg instanceof Packet) { PacketBuffer buf = new PacketBuffer(Unpooled.buffer()); - ((Packet)msg).writePacketData(buf); + ((Packet)msg).writePacketData(buf); FMLLog.log(Level.DEBUG, "%s %s:\n%s", prefix, msg.getClass().getSimpleName(), ByteBufUtils.getContentDump(buf)); } ctx.write(msg, promise); diff --git a/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java b/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java index 86c135f755..083995b63c 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java +++ b/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java @@ -50,8 +50,7 @@ import net.minecraftforge.fml.relauncher.Side; import org.apache.logging.log4j.Level; -@SuppressWarnings("rawtypes") -public class NetworkDispatcher extends SimpleChannelInboundHandler implements ChannelOutboundHandler { +public class NetworkDispatcher extends SimpleChannelInboundHandler> implements ChannelOutboundHandler { private static boolean DEBUG_HANDSHAKE = Boolean.parseBoolean(System.getProperty("fml.debugNetworkHandshake", "false")); private static enum ConnectionState { OPENING, AWAITING_HANDSHAKE, HANDSHAKING, HANDSHAKECOMPLETE, FINALIZING, CONNECTED; @@ -97,7 +96,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple public NetworkDispatcher(NetworkManager manager) { - super(Packet.class, false); + super(false); this.manager = manager; this.scm = null; this.side = Side.CLIENT; @@ -112,7 +111,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple public NetworkDispatcher(NetworkManager manager, PlayerList scm) { - super(Packet.class, false); + super(false); this.manager = manager; this.scm = scm; this.side = Side.SERVER; @@ -130,7 +129,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple this.player = player; insertIntoChannel(); Boolean fml = this.manager.channel().attr(NetworkRegistry.FML_MARKER).get(); - if (fml != null && fml.booleanValue()) + if (fml != null && fml) { //FML on client, send server hello //TODO: Make this cleaner as it uses netty magic 0.o @@ -189,7 +188,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple { completeServerSideConnection(ConnectionType.MODDED); } - // FORGE: sometimes the netqueue will tick while login is occuring, causing an NPE. We shouldn't tick until the connection is complete + // FORGE: sometimes the netqueue will tick while login is occurring, causing an NPE. We shouldn't tick until the connection is complete if (this.playerEntity.playerNetServerHandler != this) return; super.update(); } @@ -242,7 +241,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple } @Override - protected void channelRead0(ChannelHandlerContext ctx, Packet msg) throws Exception + protected void channelRead0(ChannelHandlerContext ctx, Packet msg) throws Exception { boolean handled = false; if (msg instanceof CPacketCustomPayload) @@ -305,7 +304,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple { kickWithMessage("This is modded. No modded response received. Bye!"); } - @SuppressWarnings("unchecked") + private void kickWithMessage(String message) { final TextComponentString TextComponentString = new TextComponentString(message); @@ -322,7 +321,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple { manager.closeChannel(TextComponentString); } - }, new GenericFutureListener[0]); + }, (GenericFutureListener>[])null); } manager.channel().config().setAutoRead(false); } @@ -613,7 +612,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple public void processPart(PacketBuffer input) throws IOException { - int part = (int)(input.readByte() & 0xFF); + int part = input.readByte() & 0xFF; if (part != part_expected) { throw new IOException("Received FML MultiPart packet out of order, Expected " + part_expected + " Got " + part); diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java b/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java index dff8d30c06..b144f5161c 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java @@ -74,7 +74,7 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler { catch (Throwable t) { FMLLog.log(Level.ERROR, t, "There was a critical exception handling a packet on channel %s", channel); - dispatcher.rejectHandshake("A fatal error has occured, this connection is terminated"); + dispatcher.rejectHandshake("A fatal error has occurred, this connection is terminated"); } } } diff --git a/src/main/java/net/minecraftforge/fml/common/network/simpleimpl/MessageContext.java b/src/main/java/net/minecraftforge/fml/common/network/simpleimpl/MessageContext.java index 6b4c1f436f..20b1624709 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/simpleimpl/MessageContext.java +++ b/src/main/java/net/minecraftforge/fml/common/network/simpleimpl/MessageContext.java @@ -14,7 +14,7 @@ import net.minecraftforge.fml.relauncher.Side; public class MessageContext { /** * The {@link INetHandler} for this message. It could be a client or server handler, depending - * on the {@link #side} recieved. + * on the {@link #side} received. */ public final INetHandler netHandler; diff --git a/src/main/java/net/minecraftforge/fml/common/patcher/ClassPatchManager.java b/src/main/java/net/minecraftforge/fml/common/patcher/ClassPatchManager.java index b95186f15c..299e4c6612 100644 --- a/src/main/java/net/minecraftforge/fml/common/patcher/ClassPatchManager.java +++ b/src/main/java/net/minecraftforge/fml/common/patcher/ClassPatchManager.java @@ -99,7 +99,7 @@ public class ClassPatchManager { int inputChecksum = Hashing.adler32().hashBytes(inputData).asInt(); if (patch.inputChecksum != inputChecksum) { - FMLRelaunchLog.severe("There is a binary discrepency between the expected input class %s (%s) and the actual class. Checksum on disk is %x, in patch %x. Things are probably about to go very wrong. Did you put something into the jar file?", mappedName, name, inputChecksum, patch.inputChecksum); + FMLRelaunchLog.severe("There is a binary discrepancy between the expected input class %s (%s) and the actual class. Checksum on disk is %x, in patch %x. Things are probably about to go very wrong. Did you put something into the jar file?", mappedName, name, inputChecksum, patch.inputChecksum); if (!Boolean.parseBoolean(System.getProperty("fml.ignorePatchDiscrepancies","false"))) { FMLRelaunchLog.severe("The game is going to exit, because this is a critical error, and it is very improbable that the modded game will work, please obtain clean jar files."); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java index 51fb8e02a0..36667aad06 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java @@ -13,13 +13,10 @@ package net.minecraftforge.fml.common.registry; import java.util.BitSet; -import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; -import org.apache.logging.log4j.Level; - import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLiving; @@ -33,6 +30,8 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.common.network.internal.FMLMessage.EntitySpawnMessage; +import org.apache.logging.log4j.Level; + import com.google.common.base.Function; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.BiMap; @@ -114,7 +113,7 @@ public class EntityRegistry private static final EntityRegistry INSTANCE = new EntityRegistry(); - private BitSet availableIndicies; + private BitSet availableIndices; private ListMultimap entityRegistrations = ArrayListMultimap.create(); private Map entityNames = Maps.newHashMap(); private BiMap, EntityRegistration> entityClassRegistrations = HashBiMap.create(); @@ -126,11 +125,11 @@ public class EntityRegistry private EntityRegistry() { - availableIndicies = new BitSet(256); - availableIndicies.set(1,255); + availableIndices = new BitSet(256); + availableIndices.set(1,255); for (Object id : EntityList.idToClassMapping.keySet()) { - availableIndicies.clear((Integer)id); + availableIndices.clear((Integer)id); } } @@ -310,11 +309,11 @@ public class EntityRegistry FMLLog.log(Level.ERROR, "The entity ID %d for mod %s is not an unsigned byte and may not work", id, Loader.instance().activeModContainer().getModId()); } - if (!availableIndicies.get(realId)) + if (!availableIndices.get(realId)) { FMLLog.severe("The mod %s has attempted to register an entity ID %d which is already reserved. This could cause severe problems", Loader.instance().activeModContainer().getModId(), id); } - availableIndicies.clear(realId); + availableIndices.clear(realId); return realId; } @@ -418,10 +417,10 @@ public class EntityRegistry @Deprecated public static int findGlobalUniqueEntityId() { - int res = instance().availableIndicies.nextSetBit(0); + int res = instance().availableIndices.nextSetBit(0); if (res < 0) { - throw new RuntimeException("No more entity indicies left"); + throw new RuntimeException("No more entity indices left"); } return res; } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index 21b942a659..ad9e2fd9c0 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -10,6 +10,15 @@ import java.util.List; import java.util.Map; import java.util.Set; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.RegistryNamespacedDefaultedByKey; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.functions.GenericIterableFactory; +import net.minecraftforge.fml.common.registry.RegistryDelegate.Delegate; + +import org.apache.commons.lang3.Validate; +import org.apache.logging.log4j.Level; + import com.google.common.base.Joiner; import com.google.common.base.Throwables; import com.google.common.collect.BiMap; @@ -17,16 +26,6 @@ import com.google.common.collect.HashBiMap; import com.google.common.collect.Iterators; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import net.minecraft.util.IntIdentityHashBiMap; -import org.apache.commons.lang3.Validate; -import org.apache.logging.log4j.Level; - -import net.minecraft.util.ObjectIntIdentityMap; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.registry.RegistryNamespacedDefaultedByKey; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.functions.GenericIterableFactory; -import net.minecraftforge.fml.common.registry.RegistryDelegate.Delegate; public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaultedByKey { diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index 54715ed988..3acf7ce18f 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -21,7 +21,6 @@ import net.minecraft.item.ItemBlock; import net.minecraft.potion.Potion; import net.minecraft.util.ObjectIntIdentityMap; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.registry.RegistryNamespaced; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Loader; @@ -91,6 +90,7 @@ public class GameData return getMain().iBlockRegistry.getObject(new ResourceLocation(modId, name)); } + @Deprecated static GameRegistry.UniqueIdentifier getUniqueName(Block block) { if (block == null) @@ -101,6 +101,7 @@ public class GameData return new GameRegistry.UniqueIdentifier(name); } + @Deprecated static GameRegistry.UniqueIdentifier getUniqueName(Item item) { if (item == null) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index c87476d030..2e57d44d84 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -1,7 +1,6 @@ package net.minecraftforge.fml.common.registry; import java.io.IOException; -import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; @@ -9,6 +8,20 @@ import java.util.List; import java.util.Map; import java.util.Set; +import net.minecraft.block.Block; +import net.minecraft.block.BlockAir; +import net.minecraft.item.Item; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.EnhancedRuntimeException; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.StartupQuery; +import net.minecraftforge.fml.common.ZipperUtil; +import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent; + +import org.apache.logging.log4j.Level; + import com.google.common.base.Function; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; @@ -19,21 +32,6 @@ import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.google.common.collect.Sets.SetView; -import org.apache.logging.log4j.Level; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockAir; -import net.minecraft.item.Item; -import net.minecraft.potion.Potion; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.common.EnhancedRuntimeException; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.StartupQuery; -import net.minecraftforge.fml.common.ZipperUtil; -import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent; - /** * Persistent registry manager. Manages the registries loading from disk, and from network. Handles staging * registry data before loading uniformly into the active registry, and keeps a frozen registry instance diff --git a/src/main/java/net/minecraftforge/fml/common/registry/RegistryDelegate.java b/src/main/java/net/minecraftforge/fml/common/registry/RegistryDelegate.java index 2e255f25e5..993542eb34 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/RegistryDelegate.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/RegistryDelegate.java @@ -52,18 +52,18 @@ public interface RegistryDelegate { */ final class Delegate implements RegistryDelegate { - private T referant; + private T referent; private ResourceLocation name; private final Class type; - public Delegate(T referant, Class type) { - this.referant = referant; + public Delegate(T referent, Class type) { + this.referent = referent; this.type = type; } @Override public T get() { - return referant; + return referent; } @Override @@ -82,7 +82,7 @@ public interface RegistryDelegate { void changeReference(T newTarget) { - this.referant = newTarget; + this.referent = newTarget; } void setResourceName(ResourceLocation name) { this.name = name; } diff --git a/src/main/java/net/minecraftforge/fml/common/toposort/ModSortingException.java b/src/main/java/net/minecraftforge/fml/common/toposort/ModSortingException.java index 1ee799ef70..5fdedff13c 100644 --- a/src/main/java/net/minecraftforge/fml/common/toposort/ModSortingException.java +++ b/src/main/java/net/minecraftforge/fml/common/toposort/ModSortingException.java @@ -14,12 +14,8 @@ package net.minecraftforge.fml.common.toposort; import java.util.Set; -import org.apache.logging.log4j.Level; - import net.minecraftforge.fml.common.EnhancedRuntimeException; -import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.common.toposort.ModSortingException.SortingExceptionData; public class ModSortingException extends EnhancedRuntimeException { diff --git a/src/main/java/net/minecraftforge/fml/common/toposort/TopologicalSort.java b/src/main/java/net/minecraftforge/fml/common/toposort/TopologicalSort.java index bfaca5b849..6dc0e28955 100644 --- a/src/main/java/net/minecraftforge/fml/common/toposort/TopologicalSort.java +++ b/src/main/java/net/minecraftforge/fml/common/toposort/TopologicalSort.java @@ -181,7 +181,7 @@ public class TopologicalSort } FMLLog.severe("Mod Sorting failed."); - FMLLog.severe("Visting node %s", node); + FMLLog.severe("Visiting node %s", node); FMLLog.severe("Current sorted list : %s", sortedResult); FMLLog.severe("Visited set for this node : %s", visitedNodes); FMLLog.severe("Explored node set : %s", expandedNodes); diff --git a/src/main/java/net/minecraftforge/fml/relauncher/CoreModManager.java b/src/main/java/net/minecraftforge/fml/relauncher/CoreModManager.java index e54c0285b8..2af87a659d 100644 --- a/src/main/java/net/minecraftforge/fml/relauncher/CoreModManager.java +++ b/src/main/java/net/minecraftforge/fml/relauncher/CoreModManager.java @@ -227,7 +227,7 @@ public class CoreModManager { if (loadPlugins.isEmpty()) { - throw new RuntimeException("A fatal error has occured - no valid fml load plugin was found - this is a completely corrupt FML installation."); + throw new RuntimeException("A fatal error has occurred - no valid fml load plugin was found - this is a completely corrupt FML installation."); } FMLRelaunchLog.fine("All fundamental core mods are successfully located"); @@ -613,7 +613,7 @@ public class CoreModManager { Launch.blackboard.put("fml.deobfuscatedEnvironment", deobfuscatedEnvironment); tweaker.injectCascadingTweak("net.minecraftforge.fml.common.launcher.FMLDeobfTweaker"); - tweakSorting.put("net.minecraftforge.fml.common.launcher.FMLDeobfTweaker", Integer.valueOf(1000)); + tweakSorting.put("net.minecraftforge.fml.common.launcher.FMLDeobfTweaker", 1000); } public static void injectCoreModTweaks(FMLInjectionAndSortingTweaker fmlInjectionAndSortingTweaker) diff --git a/src/main/java/net/minecraftforge/fml/repackage/com/nothome/delta/DebugDiffWriter.java b/src/main/java/net/minecraftforge/fml/repackage/com/nothome/delta/DebugDiffWriter.java index 0dff4d4538..26d879d040 100644 --- a/src/main/java/net/minecraftforge/fml/repackage/com/nothome/delta/DebugDiffWriter.java +++ b/src/main/java/net/minecraftforge/fml/repackage/com/nothome/delta/DebugDiffWriter.java @@ -59,7 +59,7 @@ public class DebugDiffWriter implements DiffWriter { if (ba[ix] == '\n') System.err.print("\\n"); else - System.err.print(String.valueOf((char)((char) ba[ix]))); + System.err.print(String.valueOf((char) ba[ix])); //System.err.print("0x" + Integer.toHexString(buf[ix]) + " "); // hex output } System.err.println(""); diff --git a/src/main/java/net/minecraftforge/fml/repackage/com/nothome/delta/GDiffWriter.java b/src/main/java/net/minecraftforge/fml/repackage/com/nothome/delta/GDiffWriter.java index cd47bf1b59..8f8dfa2db3 100644 --- a/src/main/java/net/minecraftforge/fml/repackage/com/nothome/delta/GDiffWriter.java +++ b/src/main/java/net/minecraftforge/fml/repackage/com/nothome/delta/GDiffWriter.java @@ -170,7 +170,7 @@ public class GDiffWriter implements DiffWriter { @Override public void close() throws IOException { this.flush(); - output.write((byte)EOF); + output.write(EOF); output.close(); } diff --git a/src/main/java/net/minecraftforge/items/wrapper/CombinedInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/CombinedInvWrapper.java index 11e9596166..6339550961 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/CombinedInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/CombinedInvWrapper.java @@ -9,7 +9,7 @@ public class CombinedInvWrapper implements IItemHandlerModifiable protected final IItemHandlerModifiable[] itemHandler; // the handlers protected final int[] baseIndex; // index-offsets of the different handlers - protected final int slotCount; // numeber of total slots + protected final int slotCount; // number of total slots public CombinedInvWrapper(IItemHandlerModifiable... itemHandler) { diff --git a/src/main/java/net/minecraftforge/items/wrapper/PlayerOffhandInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/PlayerOffhandInvWrapper.java index 0d3af4e8d9..7bdbae2b65 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/PlayerOffhandInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/PlayerOffhandInvWrapper.java @@ -1,7 +1,6 @@ package net.minecraftforge.items.wrapper; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; public class PlayerOffhandInvWrapper extends RangedWrapper { diff --git a/src/main/java/net/minecraftforge/oredict/OreDictionary.java b/src/main/java/net/minecraftforge/oredict/OreDictionary.java index 05c1472c1c..f5bb9af470 100644 --- a/src/main/java/net/minecraftforge/oredict/OreDictionary.java +++ b/src/main/java/net/minecraftforge/oredict/OreDictionary.java @@ -260,7 +260,7 @@ public class OreDictionary continue; } - if(containsMatch(true, (ItemStack[])recipe.recipeItems.toArray(new ItemStack[recipe.recipeItems.size()]), replaceStacks)) + if(containsMatch(true, recipe.recipeItems.toArray(new ItemStack[recipe.recipeItems.size()]), replaceStacks)) { recipesToRemove.add((IRecipe)obj); IRecipe newRecipe = new ShapelessOreRecipe(recipe, replacements); @@ -273,7 +273,7 @@ public class OreDictionary recipes.addAll(recipesToAdd); if (recipesToRemove.size() > 0) { - FMLLog.info("Replaced %d ore recipies", recipesToRemove.size()); + FMLLog.info("Replaced %d ore recipes", recipesToRemove.size()); } } @@ -311,11 +311,11 @@ public class OreDictionary } /** - * Gets all the integer ID for the ores that the specified item stakc is registered to. + * Gets all the integer ID for the ores that the specified item stack is registered to. * If the item stack is not linked to any ore, this will return an empty array and no new entry will be created. * * @param stack The item stack of the ore. - * @return An array of ids that this ore is registerd as. + * @return An array of ids that this ore is registered as. */ public static int[] getOreIDs(ItemStack stack) { diff --git a/src/main/java/net/minecraftforge/oredict/RecipeSorter.java b/src/main/java/net/minecraftforge/oredict/RecipeSorter.java index 341bb047c0..8902c84a6b 100644 --- a/src/main/java/net/minecraftforge/oredict/RecipeSorter.java +++ b/src/main/java/net/minecraftforge/oredict/RecipeSorter.java @@ -30,7 +30,6 @@ import net.minecraft.item.crafting.RecipesBanners.RecipeAddPattern; import net.minecraft.item.crafting.RecipesBanners.RecipeDuplicatePattern; import static net.minecraftforge.oredict.RecipeSorter.Category.*; -@SuppressWarnings("rawtypes") public class RecipeSorter implements Comparator { public enum Category @@ -71,7 +70,7 @@ public class RecipeSorter implements Comparator } else { - throw new IllegalArgumentException("Invalid dependancy: " + dep); + throw new IllegalArgumentException("Invalid dependency: " + dep); } } } @@ -104,10 +103,10 @@ public class RecipeSorter implements Comparator } }; - private static Map categories = Maps.newHashMap(); - //private static Map types = Maps.newHashMap(); + private static Map, Category> categories = Maps.newHashMap(); + //private static Map> types = Maps.newHashMap(); private static Map entries = Maps.newHashMap(); - private static Map priorities = Maps.newHashMap(); + private static Map, Integer> priorities = Maps.newHashMap(); public static RecipeSorter INSTANCE = new RecipeSorter(); private static boolean isDirty = true; @@ -146,21 +145,21 @@ public class RecipeSorter implements Comparator return getPriority(r2) - getPriority(r1); // high priority value first! } - private static Set warned = Sets.newHashSet(); + private static Set> warned = Sets.newHashSet(); public static void sortCraftManager() { bake(); - FMLLog.fine("Sorting recipies"); + FMLLog.fine("Sorting recipes"); warned.clear(); Collections.sort(CraftingManager.getInstance().getRecipeList(), INSTANCE); } - public static void register(String name, Class recipe, Category category, String dependancies) + public static void register(String name, Class recipe, Category category, String dependencies) { assert(category != UNKNOWN) : "Category must not be unknown!"; isDirty = true; - SortEntry entry = new SortEntry(name, recipe, category, dependancies); + SortEntry entry = new SortEntry(name, recipe, category, dependencies); entries.put(name, entry); setCategory(recipe, category); } @@ -217,13 +216,13 @@ public class RecipeSorter implements Comparator if (ret != null) { priorities.put(recipe.getClass(), ret); - FMLLog.fine(" Parent Found: %d - %s", ret.intValue(), cls.getName()); - return ret.intValue(); + FMLLog.fine(" Parent Found: %d - %s", ret, cls.getName()); + return ret; } } } - return ret == null ? 0 : ret.intValue(); + return ret == null ? 0 : ret; } private static void bake() diff --git a/src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java b/src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java index 2794e8af85..d2531a38c3 100644 --- a/src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java +++ b/src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java @@ -135,15 +135,15 @@ public class ShapedOreRecipe implements IRecipe for(int i = 0; i < input.length; i++) { - ItemStack ingred = recipe.recipeItems[i]; + ItemStack ingredient = recipe.recipeItems[i]; - if(ingred == null) continue; + if(ingredient == null) continue; input[i] = recipe.recipeItems[i]; for(Entry replace : replacements.entrySet()) { - if(OreDictionary.itemMatches(replace.getKey(), ingred, true)) + if(OreDictionary.itemMatches(replace.getKey(), ingredient, true)) { input[i] = OreDictionary.getOres(replace.getValue()); break; diff --git a/src/main/java/net/minecraftforge/oredict/ShapelessOreRecipe.java b/src/main/java/net/minecraftforge/oredict/ShapelessOreRecipe.java index cb235c3c26..8c4b07dc8f 100644 --- a/src/main/java/net/minecraftforge/oredict/ShapelessOreRecipe.java +++ b/src/main/java/net/minecraftforge/oredict/ShapelessOreRecipe.java @@ -60,12 +60,12 @@ public class ShapelessOreRecipe implements IRecipe { output = recipe.getRecipeOutput(); - for(ItemStack ingred : ((List)recipe.recipeItems)) + for(ItemStack ingredient : recipe.recipeItems) { - Object finalObj = ingred; + Object finalObj = ingredient; for(Entry replace : replacements.entrySet()) { - if(OreDictionary.itemMatches(replace.getKey(), ingred, false)) + if(OreDictionary.itemMatches(replace.getKey(), ingredient, false)) { finalObj = OreDictionary.getOres(replace.getValue()); break; diff --git a/src/main/java/net/minecraftforge/server/ForgeTimeTracker.java b/src/main/java/net/minecraftforge/server/ForgeTimeTracker.java index 7265ee268f..4912c7bdd2 100644 --- a/src/main/java/net/minecraftforge/server/ForgeTimeTracker.java +++ b/src/main/java/net/minecraftforge/server/ForgeTimeTracker.java @@ -81,7 +81,7 @@ public class ForgeTimeTracker { private ImmutableMap buildImmutableTileEntityTimingMap() { - Builder builder = ImmutableMap.builder(); + Builder builder = ImmutableMap.builder(); for (Entry entry : tileEntityTimings.entrySet()) { builder.put(entry.getKey(), Arrays.copyOfRange(entry.getValue(), 0, 100)); diff --git a/src/main/java/net/minecraftforge/server/command/ForgeCommand.java b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java index 89c9949c93..a3c7148e8f 100644 --- a/src/main/java/net/minecraftforge/server/command/ForgeCommand.java +++ b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java @@ -1,6 +1,5 @@ package net.minecraftforge.server.command; -import java.lang.ref.WeakReference; import java.text.DecimalFormat; import java.util.List; diff --git a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java index e59bea46fb..809f70b2a2 100644 --- a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java @@ -390,7 +390,6 @@ public class ModelLoaderRegistryDebug public static final PropertyDirection FACING = PropertyDirection.create("facing"); public static final OBJDirectionEye instance = new OBJDirectionEye(); public static final String name = "OBJDirectionEye"; - private ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[] {FACING}, new IUnlistedProperty[]{OBJModel.OBJProperty.INSTANCE}); private OBJDirectionEye() { @@ -499,6 +498,7 @@ public class ModelLoaderRegistryDebug } } + @SuppressWarnings("unused") public static class OBJVertexColoring2TileEntity extends TileEntity { private int index = 0; diff --git a/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java b/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java index 1dc9979a65..f50bf57f8d 100644 --- a/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java +++ b/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java @@ -86,7 +86,7 @@ public class NoBedSleepingTest @Override public T getCapability(Capability capability, EnumFacing facing) { - return capability == SLEEP_CAP ? SLEEP_CAP.cast(inst) : null; + return capability == SLEEP_CAP ? SLEEP_CAP.cast(inst) : null; } @Override From 1d25d9ff493c926735f7aa9016c8eb8676e82900 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 23 Mar 2016 21:41:31 +0300 Subject: [PATCH 154/243] Fixed isSideSolid causing infinite loops due to the call to getActualState. --- patches/minecraft/net/minecraft/block/Block.java.patch | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index e180526660..d99e75e9da 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -196,7 +196,7 @@ public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) { return new ItemStack(Item.func_150898_a(this), 1, this.func_180651_a(p_185473_3_)); -@@ -844,6 +865,1167 @@ +@@ -844,6 +865,1168 @@ return "Block{" + field_149771_c.func_177774_c(this) + "}"; } @@ -280,10 +280,9 @@ + if (base_state.func_185896_q() && side == EnumFacing.UP) // Short circuit to vanilla function if its true + return true; + -+ IBlockState state = this.func_176221_a(base_state, world, pos); -+ + if (this instanceof BlockSlab) + { ++ IBlockState state = this.func_176221_a(base_state, world, pos); + return base_state.func_185913_b() + || (state.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP ) + || (state.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.BOTTOM && side == EnumFacing.DOWN); @@ -294,6 +293,7 @@ + } + else if (this instanceof BlockStairs) + { ++ IBlockState state = this.func_176221_a(base_state, world, pos); + boolean flipped = state.func_177229_b(BlockStairs.field_176308_b) == BlockStairs.EnumHalf.TOP; + BlockStairs.EnumShape shape = (BlockStairs.EnumShape)state.func_177229_b(BlockStairs.field_176310_M); + EnumFacing facing = (EnumFacing)state.func_177229_b(BlockStairs.field_176309_a); @@ -314,6 +314,7 @@ + } + else if (this instanceof BlockSnow) + { ++ IBlockState state = this.func_176221_a(base_state, world, pos); + return ((Integer)state.func_177229_b(BlockSnow.field_176315_a)) >= 8; + } + else if (this instanceof BlockHopper && side == EnumFacing.UP) @@ -324,7 +325,7 @@ + { + return true; + } -+ return isNormalCube(state, world, pos); ++ return isNormalCube(base_state, world, pos); + } + + /** From 08c00662a0c236e80a9938621efd516d52f72b0d Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 24 Mar 2016 08:43:48 +0300 Subject: [PATCH 155/243] Removed LanguageRegistry and CollectionWrapperFactory. --- .../fml/client/FMLClientHandler.java | 2 - .../functions/CollectionWrapperFactory.java | 32 -- .../fml/common/registry/LanguageRegistry.java | 324 ------------------ .../fml/server/FMLServerHandler.java | 4 +- 4 files changed, 2 insertions(+), 360 deletions(-) delete mode 100644 src/main/java/net/minecraftforge/fml/common/functions/CollectionWrapperFactory.java delete mode 100644 src/main/java/net/minecraftforge/fml/common/registry/LanguageRegistry.java diff --git a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java index 5fa74621ed..19e8d0b062 100644 --- a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java +++ b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java @@ -88,7 +88,6 @@ import net.minecraftforge.fml.common.WrongMinecraftVersionException; import net.minecraftforge.fml.common.eventhandler.EventBus; import net.minecraftforge.fml.common.network.FMLNetworkEvent; import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; -import net.minecraftforge.fml.common.registry.LanguageRegistry; import net.minecraftforge.fml.common.registry.PersistentRegistryManager; import net.minecraftforge.fml.common.toposort.ModSortingException; import net.minecraftforge.fml.relauncher.Side; @@ -589,7 +588,6 @@ public class FMLClientHandler implements IFMLSidedHandler @Override public void addModAsResource(ModContainer container) { - LanguageRegistry.instance().loadLanguagesFor(container, Side.CLIENT); Class resourcePackType = container.getCustomResourcePackClass(); if (resourcePackType != null) { diff --git a/src/main/java/net/minecraftforge/fml/common/functions/CollectionWrapperFactory.java b/src/main/java/net/minecraftforge/fml/common/functions/CollectionWrapperFactory.java deleted file mode 100644 index be6ff3949b..0000000000 --- a/src/main/java/net/minecraftforge/fml/common/functions/CollectionWrapperFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.minecraftforge.fml.common.functions; - -import java.util.Collection; -import java.util.List; -import com.google.common.collect.Collections2; -import com.google.common.collect.Lists; - -public class CollectionWrapperFactory { - /** - * Return a read only cast view of the supplied raw collection, based on the element type given - * @param coll The collection to cast - * @param elementType the super type contained in the collection - * @return a collection asserting that type relationship - */ - public static Collection wrap(@SuppressWarnings("rawtypes") Collection coll, Class elementType) - { - Collection asGeneric = coll; - return Collections2.transform(asGeneric, new TypeCastFunction(elementType)); - } - - /** - * Return a read only cast view of the supplied raw list, based on the element type given - * @param list The list to cast - * @param elementType the super type contained in the list - * @return a list asserting that type relationship - */ - public static List wrap(@SuppressWarnings("rawtypes") List list, Class elementType) - { - List asGeneric = list; - return Lists.transform(asGeneric, new TypeCastFunction(elementType)); - } -} diff --git a/src/main/java/net/minecraftforge/fml/common/registry/LanguageRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/LanguageRegistry.java deleted file mode 100644 index 3b2a369f80..0000000000 --- a/src/main/java/net/minecraftforge/fml/common/registry/LanguageRegistry.java +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Forge Mod Loader - * Copyright (c) 2012-2013 cpw. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser Public License v2.1 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * - * Contributors: - * cpw - implementation - */ - -package net.minecraftforge.fml.common.registry; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.URL; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Properties; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -import org.apache.logging.log4j.Level; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.translation.LanguageMap; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.relauncher.Side; - -import com.google.common.base.Charsets; -import com.google.common.base.Joiner; -import com.google.common.collect.Lists; - -public class LanguageRegistry -{ - private static final LanguageRegistry INSTANCE = new LanguageRegistry(); - - private Map modLanguageData=new HashMap(); - - private static final Pattern assetENUSLang = Pattern.compile("assets/(.*)/lang/(?:.+/|)([\\w_-]+).lang"); - - public static LanguageRegistry instance() - { - return INSTANCE; - } - - public String getStringLocalization(String key) - { - return getStringLocalization(key, FMLCommonHandler.instance().getCurrentLanguage()); - } - - public String getStringLocalization(String key, String lang) - { - String localizedString = ""; - Properties langPack = modLanguageData.get(lang); - - if (langPack != null) { - if (langPack.getProperty(key) != null) { - localizedString = langPack.getProperty(key); - } - } - - return localizedString; - } - - /** - * Deprecated for removal in 1.8. Use the assets lang system - */ - @Deprecated - public void addStringLocalization(String key, String value) - { - addStringLocalization(key, "en_US", value); - } - - /** - * Deprecated for removal in 1.8. Use the assets lang system - */ - @Deprecated - public void addStringLocalization(String key, String lang, String value) - { - Properties langPack=modLanguageData.get(lang); - if (langPack==null) { - langPack=new Properties(); - modLanguageData.put(lang, langPack); - } - langPack.put(key,value); - } - - /** - * Deprecated for removal in 1.8. Use the assets lang system - */ - @Deprecated - public void addStringLocalization(Properties langPackAdditions) { - addStringLocalization(langPackAdditions, "en_US"); - } - - /** - * Deprecated for removal in 1.8. Use the assets lang system - */ - @Deprecated - public void addStringLocalization(Properties langPackAdditions, String lang) { - Properties langPack = modLanguageData.get(lang); - if (langPack == null) { - langPack = new Properties(); - modLanguageData.put(lang, langPack); - } - if (langPackAdditions != null) { - langPack.putAll(langPackAdditions); - } - } - - /** - * Deprecated for removal in 1.8. Use the assets lang system - */ - @Deprecated - public void addNameForObject(Object objectToName, String lang, String name) - { - String objectName; - if (objectToName instanceof Item) { - objectName=((Item)objectToName).getUnlocalizedName(); - } else if (objectToName instanceof Block) { - objectName=((Block)objectToName).getUnlocalizedName(); - } else if (objectToName instanceof ItemStack) { - objectName=((ItemStack)objectToName).getItem().getUnlocalizedName((ItemStack)objectToName); - } else { - throw new IllegalArgumentException(String.format("Illegal object for naming %s",objectToName)); - } - objectName+=".name"; - addStringLocalization(objectName, lang, name); - } - - /** - * Deprecated for removal in 1.8. Use the assets lang system - */ - @Deprecated - public static void addName(Object objectToName, String name) - { - instance().addNameForObject(objectToName, "en_US", name); - } - - /** - * Deprecated for removal in 1.8. Use the assets lang system - */ - @SuppressWarnings("unchecked") - @Deprecated - public void mergeLanguageTable(@SuppressWarnings("rawtypes") Map properties, String lang) - { - Properties langPack=modLanguageData.get(lang); - if (langPack!=null) { - mergeWithoutOverwrite(langPack, properties); - } - Properties usPack=modLanguageData.get("en_US"); - if (usPack!=null) { - mergeWithoutOverwrite(usPack, properties); - } - } - - @Deprecated - private void mergeWithoutOverwrite(Map from, Map to) - { - for (Entry e : from.entrySet()) - { - if (!to.containsKey(e.getKey())) - { - to.put(e.getKey(),e.getValue()); - } - } - } - /** - * Deprecated for removal in 1.8. Use the assets lang system - */ - @Deprecated - public void loadLocalization(String localizationFile, String lang, boolean isXML) - { - URL urlResource = this.getClass().getResource(localizationFile); - if (urlResource != null) - { - loadLocalization(urlResource, lang, isXML); - } - else - { - ModContainer activeModContainer = Loader.instance().activeModContainer(); - if (activeModContainer!=null) - { - FMLLog.log(activeModContainer.getModId(), Level.ERROR, "The language resource %s cannot be located on the classpath. This is a programming error.", localizationFile); - } - else - { - FMLLog.log(Level.ERROR, "The language resource %s cannot be located on the classpath. This is a programming error.", localizationFile); - } - } - } - - /** - * Deprecated for removal in 1.8. Use the assets lang system - */ - @Deprecated - public void loadLocalization(URL localizationFile, String lang, boolean isXML) - { - InputStream langStream = null; - Properties langPack = new Properties(); - - try { - langStream = localizationFile.openStream(); - - if (isXML) { - langPack.loadFromXML(langStream); - } - else { - langPack.load(new InputStreamReader(langStream,Charsets.UTF_8)); - } - - addStringLocalization(langPack, lang); - } - catch (IOException e) { - FMLLog.log(Level.ERROR, e, "Unable to load localization from file %s", localizationFile); - } - finally { - try { - if (langStream != null) { - langStream.close(); - } - } - catch (IOException ex) { - // HUSH - } - } - } - - public void injectLanguage(String language, Map parsedLangFile) - { - - Properties p = modLanguageData.get(language); - if (p == null) - { - p = new Properties(); - modLanguageData.put(language, p); - } - p.putAll(parsedLangFile); - } - - public void loadLanguagesFor(ModContainer container, Side side) - { - File source = container.getSource(); - try - { - if (source.isDirectory()) - { - searchDirForLanguages(source, "", side); - } - else - { - searchZipForLanguages(source, side); - } - } - catch (IOException ioe) - { - - } - } - - private void searchZipForLanguages(File source, Side side) throws IOException - { - ZipFile zf = new ZipFile(source); - List added = Lists.newArrayList(); - for (ZipEntry ze : Collections.list(zf.entries())) - { - Matcher matcher = assetENUSLang.matcher(ze.getName()); - if (matcher.matches()) - { - String lang = matcher.group(2); - //FMLLog.fine("Injecting found translation data for lang %s in zip file %s at %s into language system", lang, source.getName(), ze.getName()); - added.add(lang); - LanguageRegistry.instance().injectLanguage(lang, LanguageMap.parseLangFile(zf.getInputStream(ze))); - // Ensure en_US is available to StringTranslate on the server - if ("en_US".equals(lang) && side == Side.SERVER) - { - LanguageMap.inject(zf.getInputStream(ze)); - } - } - } - if (added.size() > 0) - FMLLog.fine("Found translations in %s [%s]", source.getName(), Joiner.on(", ").join(added)); - zf.close(); - } - - private void searchDirForLanguages(File source, String path, Side side) throws IOException - { - for (File file : source.listFiles()) - { - String currPath = path+file.getName(); - if (file.isDirectory()) - { - searchDirForLanguages(file, currPath+'/', side); - } - Matcher matcher = assetENUSLang.matcher(currPath); - if (matcher.matches()) - { - String lang = matcher.group(2); - FMLLog.fine("Injecting found translation assets for lang %s at %s into language system", lang, currPath); - LanguageRegistry.instance().injectLanguage(lang, LanguageMap.parseLangFile(new FileInputStream(file))); - // Ensure en_US is available to StringTranslate on the server - if ("en_US".equals(lang) && side == Side.SERVER) - { - LanguageMap.inject(new FileInputStream(file)); - } - } - } - } -} diff --git a/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java b/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java index 252e94dc30..b80bf1e342 100644 --- a/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java +++ b/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java @@ -34,7 +34,6 @@ import net.minecraftforge.fml.common.StartupQuery; import net.minecraftforge.fml.common.eventhandler.EventBus; import net.minecraftforge.fml.common.functions.GenericIterableFactory; import net.minecraftforge.fml.common.network.FMLNetworkEvent; -import net.minecraftforge.fml.common.registry.LanguageRegistry; import net.minecraftforge.fml.relauncher.Side; import com.google.common.collect.ImmutableList; @@ -215,10 +214,11 @@ public class FMLServerHandler implements IFMLSidedHandler { return false; } + @Override public void addModAsResource(ModContainer container) { - LanguageRegistry.instance().loadLanguagesFor(container, Side.SERVER); + // NOOP } @Override From 756c58d5cb01ed33e9bbc165ab62cc62244d6bb1 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 24 Mar 2016 11:44:52 +0300 Subject: [PATCH 156/243] Removed RenderWorldEvent, encapsulated all public event fields. --- .../net/minecraft/block/BlockNote.java.patch | 2 +- .../net/minecraft/client/Minecraft.java.patch | 2 +- .../minecraft/client/gui/GuiScreen.java.patch | 4 +- .../client/renderer/EntityRenderer.java.patch | 12 +- .../resources/LanguageManager.java.patch | 10 -- .../command/CommandHandler.java.patch | 4 +- .../entity/item/EntityEnderPearl.java.patch | 4 +- .../entity/monster/EntityEnderman.java.patch | 2 +- .../entity/monster/EntityZombie.java.patch | 4 +- .../PlayerInteractionManager.java.patch | 4 +- .../world/biome/BiomeGenBase.java.patch | 6 +- .../world/biome/BiomeProvider.java.patch | 2 +- .../world/gen/ChunkProviderEnd.java.patch | 2 +- .../world/gen/ChunkProviderHell.java.patch | 2 +- .../world/gen/layer/GenLayer.java.patch | 2 +- .../StructureVillagePieces.java.patch | 2 +- .../client/ClientCommandHandler.java | 4 +- .../client/ForgeHooksClient.java | 31 +--- .../minecraftforge/client/GuiIngameForge.java | 2 +- .../client/event/ClientChatReceivedEvent.java | 25 ++- .../client/event/DrawBlockHighlightEvent.java | 15 +- .../client/event/EntityViewRenderEvent.java | 64 +++++-- .../client/event/FOVUpdateEvent.java | 28 ++- .../client/event/GuiOpenEvent.java | 12 +- .../client/event/GuiScreenEvent.java | 116 +++++++++---- .../client/event/MouseEvent.java | 25 ++- .../client/event/RenderBlockOverlayEvent.java | 35 ++-- .../client/event/RenderGameOverlayEvent.java | 63 ++++++- .../client/event/RenderHandEvent.java | 21 ++- .../client/event/RenderItemInFrameEvent.java | 21 ++- .../client/event/RenderLivingEvent.java | 18 +- .../client/event/RenderPlayerEvent.java | 63 +++++-- .../client/event/RenderWorldEvent.java | 39 ----- .../client/event/RenderWorldLastEvent.java | 14 +- .../client/event/TextureStitchEvent.java | 7 +- .../client/event/sound/PlaySoundEvent.java | 28 ++- .../client/event/sound/SoundEvent.java | 7 +- .../common/ForgeChunkManager.java | 28 ++- .../net/minecraftforge/common/ForgeHooks.java | 19 +-- .../common/ForgeInternalHandler.java | 20 +-- .../event/AnvilUpdateEvent.java | 26 ++- .../minecraftforge/event/CommandEvent.java | 17 +- .../event/ForgeEventFactory.java | 26 +-- .../event/brewing/PotionBrewEvent.java | 3 +- .../event/brewing/PotionBrewedEvent.java | 32 ---- .../event/entity/EntityEvent.java | 46 +++-- .../event/entity/EntityJoinWorldEvent.java | 7 +- .../event/entity/EntityMountEvent.java | 20 ++- .../entity/EntityStruckByLightningEvent.java | 7 +- .../entity/EntityTravelToDimensionEvent.java | 7 +- .../event/entity/item/ItemEvent.java | 13 +- .../event/entity/item/ItemExpireEvent.java | 12 +- .../event/entity/item/ItemTossEvent.java | 13 +- .../entity/living/EnderTeleportEvent.java | 25 ++- .../event/entity/living/LivingDeathEvent.java | 7 +- .../event/entity/living/LivingDropsEvent.java | 28 ++- .../living/LivingEntityUseItemEvent.java | 31 +++- .../event/entity/living/LivingEvent.java | 9 +- .../living/LivingExperienceDropEvent.java | 6 +- .../event/entity/living/LivingFallEvent.java | 13 +- .../event/entity/living/LivingHealEvent.java | 12 +- .../entity/living/LivingPackSizeEvent.java | 28 ++- .../living/LivingSetAttackTargetEvent.java | 6 +- .../event/entity/living/LivingSpawnEvent.java | 12 +- .../event/entity/living/ZombieEvent.java | 33 ++-- .../minecart/MinecartCollisionEvent.java | 7 +- .../event/entity/minecart/MinecartEvent.java | 7 +- .../entity/minecart/MinecartUpdateEvent.java | 7 +- .../event/entity/player/AchievementEvent.java | 7 +- .../event/entity/player/AnvilRepairEvent.java | 32 ++-- .../entity/player/AttackEntityEvent.java | 7 +- .../event/entity/player/BonemealEvent.java | 39 +++-- .../entity/player/EntityItemPickupEvent.java | 27 +-- .../event/entity/player/FillBucketEvent.java | 18 +- .../event/entity/player/ItemTooltipEvent.java | 39 +++-- .../event/entity/player/PlayerDropsEvent.java | 7 +- .../event/entity/player/PlayerEvent.java | 160 ++++++++++++------ .../entity/player/PlayerInteractEvent.java | 30 ++-- .../player/PlayerOpenContainerEvent.java | 28 +-- .../entity/player/PlayerPickupXpEvent.java | 7 +- .../entity/player/PlayerSetSpawnEvent.java | 21 ++- .../entity/player/PlayerSleepInBedEvent.java | 18 +- .../player/SleepingLocationCheckEvent.java | 6 +- .../event/entity/player/UseHoeEvent.java | 39 +++-- .../event/terraingen/BiomeEvent.java | 69 ++++++-- .../event/terraingen/ChunkGeneratorEvent.java | 43 +++-- .../event/terraingen/DecorateBiomeEvent.java | 28 ++- .../terraingen/DeferredBiomeDecorator.java | 2 +- .../event/terraingen/InitMapGenEvent.java | 12 +- .../event/terraingen/OreGenEvent.java | 35 +++- .../event/terraingen/PopulateChunkEvent.java | 22 ++- .../terraingen/SaplingGrowTreeEvent.java | 14 +- .../event/terraingen/TerrainGen.java | 2 +- .../event/terraingen/WorldTypeEvent.java | 56 +++++- .../event/world/BlockEvent.java | 60 +++++-- .../event/world/ChunkWatchEvent.java | 16 +- .../event/world/ExplosionEvent.java | 16 +- .../event/world/NoteBlockEvent.java | 28 ++- .../event/world/WorldEvent.java | 35 +++- .../fluids/FluidContainerRegistry.java | 7 +- .../minecraftforge/fluids/FluidRegistry.java | 14 +- .../fml/common/network/FMLEventChannel.java | 4 +- .../fml/common/network/FMLNetworkEvent.java | 101 +++++++++-- .../minecraftforge/oredict/OreDictionary.java | 14 +- .../EntityTravelToDimensionEventTest.java | 2 +- .../test/NeighborNotifyEventTest.java | 2 +- .../test/NoBedSleepingTest.java | 4 +- .../test/PlayerInteractEventLocalTest.java | 4 +- .../test/PlayerSetSpawnTest.java | 2 +- .../test/TestCapabilityMod.java | 16 +- 110 files changed, 1642 insertions(+), 680 deletions(-) delete mode 100644 patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch delete mode 100644 src/main/java/net/minecraftforge/client/event/RenderWorldEvent.java delete mode 100644 src/main/java/net/minecraftforge/event/brewing/PotionBrewedEvent.java diff --git a/patches/minecraft/net/minecraft/block/BlockNote.java.patch b/patches/minecraft/net/minecraft/block/BlockNote.java.patch index d3ec274fc1..68bc8aa6d5 100644 --- a/patches/minecraft/net/minecraft/block/BlockNote.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNote.java.patch @@ -16,7 +16,7 @@ { + net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_180648_1_, p_180648_2_, p_180648_3_, p_180648_5_, p_180648_4_); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false; -+ p_180648_4_ = e.instrument.ordinal(); ++ p_180648_4_ = e.getInstrument().ordinal(); + p_180648_5_ = e.getVanillaNoteId(); float f = (float)Math.pow(2.0D, (double)(p_180648_5_ - 12) / 12.0D); p_180648_1_.func_184133_a((EntityPlayer)null, p_180648_2_, this.func_185576_e(p_180648_4_), SoundCategory.BLOCKS, 3.0F, f); diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index f718dfd55a..7ceb60ead1 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -133,7 +133,7 @@ + + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; + -+ p_147108_1_ = event.gui; ++ p_147108_1_ = event.getGui(); + if (old != null && p_147108_1_ != old) + { + old.func_146281_b(); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch index 329f40f342..8f6fd8340d 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch @@ -55,12 +55,12 @@ + net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre event = new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre(this, guibutton, this.field_146292_n); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) + break; -+ guibutton = event.button; ++ guibutton = event.getButton(); this.field_146290_a = guibutton; guibutton.func_146113_a(this.field_146297_k.func_147118_V()); this.func_146284_a(guibutton); + if (this.equals(this.field_146297_k.field_71462_r)) -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Post(this, event.button, this.field_146292_n)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Post(this, event.getButton(), this.field_146292_n)); } } } diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index 6559dc9601..eec1cf045f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -64,9 +64,9 @@ + IBlockState state = ActiveRenderInfo.func_186703_a(this.field_78531_r.field_71441_e, entity, p_78467_1_); + net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, state, p_78467_1_, yaw, pitch, roll); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ GlStateManager.func_179114_b(event.roll, 0.0F, 0.0F, 1.0F); -+ GlStateManager.func_179114_b(event.pitch, 1.0F, 0.0F, 0.0F); -+ GlStateManager.func_179114_b(event.yaw, 0.0F, 1.0F, 0.0F); ++ GlStateManager.func_179114_b(event.getRoll(), 0.0F, 0.0F, 1.0F); ++ GlStateManager.func_179114_b(event.getPitch(), 1.0F, 0.0F, 0.0F); ++ GlStateManager.func_179114_b(event.getYaw(), 0.0F, 1.0F, 0.0F); } GlStateManager.func_179109_b(0.0F, -f, 0.0F); @@ -163,9 +163,9 @@ + net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, iblockstate, p_78466_1_, this.field_175080_Q, this.field_175082_R, this.field_175081_S); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + -+ this.field_175080_Q = event.red; -+ this.field_175082_R = event.green; -+ this.field_175081_S = event.blue; ++ this.field_175080_Q = event.getRed(); ++ this.field_175082_R = event.getGreen(); ++ this.field_175081_S = event.getBlue(); + GlStateManager.func_179082_a(this.field_175080_Q, this.field_175082_R, this.field_175081_S, 0.0F); } diff --git a/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch b/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch deleted file mode 100644 index 07b5cb7797..0000000000 --- a/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/LanguageManager.java -+++ ../src-work/minecraft/net/minecraft/client/resources/LanguageManager.java -@@ -73,6 +73,7 @@ - } - - field_135049_a.func_135022_a(p_110549_1_, list); -+ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(field_135049_a.field_135032_a, this.field_135048_c); - LanguageMap.func_135063_a(field_135049_a.field_135032_a); - } - diff --git a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch index cc10323801..0b22b88a0d 100644 --- a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch +++ b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch @@ -7,9 +7,9 @@ + net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(icommand, p_71556_1_, astring); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) + { -+ if (event.exception != null) ++ if (event.getException() != null) + { -+ com.google.common.base.Throwables.propagateIfPossible(event.exception); ++ com.google.common.base.Throwables.propagateIfPossible(event.getException()); + } + return 1; + } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch index d3e4db9d7a..2e5a3e8f95 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch @@ -15,10 +15,10 @@ } - entitylivingbase.func_70634_a(this.field_70165_t, this.field_70163_u, this.field_70161_v); -+ entitylivingbase.func_70634_a(event.targetX, event.targetY, event.targetZ); ++ entitylivingbase.func_70634_a(event.getTargetX(), event.getTargetY(), event.getTargetZ()); entitylivingbase.field_70143_R = 0.0F; - entitylivingbase.func_70097_a(DamageSource.field_76379_h, 5.0F); -+ entitylivingbase.func_70097_a(DamageSource.field_76379_h, event.attackDamage); ++ entitylivingbase.func_70097_a(DamageSource.field_76379_h, event.getAttackDamage()); + } } } diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch index c4ef14e35b..e085803348 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch @@ -7,7 +7,7 @@ - boolean flag = this.func_184595_k(p_70825_1_, p_70825_3_, p_70825_5_); + net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; -+ boolean flag = this.func_184595_k(event.targetX, event.targetY, event.targetZ); ++ boolean flag = this.func_184595_k(event.getTargetX(), event.getTargetY(), event.getTargetZ()); if (flag) { diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch index 6fe306eb02..f40c0b6316 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch @@ -28,9 +28,9 @@ - int k = MathHelper.func_76128_c(this.field_70161_v); - EntityZombie entityzombie = new EntityZombie(this.field_70170_p); + EntityZombie entityzombie; -+ if (summonAid.customSummonedAid != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) ++ if (summonAid.getCustomSummonedAid() != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) + { -+ entityzombie = summonAid.customSummonedAid; ++ entityzombie = summonAid.getCustomSummonedAid(); + } + else + { diff --git a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch index 18927e74a0..8f01382c92 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch @@ -63,7 +63,7 @@ + if (!iblockstate.func_177230_c().isAir(iblockstate, field_73092_a, p_180784_1_)) { - block.func_180649_a(this.field_73092_a, p_180784_1_, this.field_73090_b); -+ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ if (event.getUseBlock() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { + block.func_180649_a(this.field_73092_a, p_180784_1_, this.field_73090_b); + this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); @@ -74,7 +74,7 @@ + } f = iblockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180784_1_); } -+ if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ if (event.getUseItem() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { + if (f >= 1.0F) + { diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch index 62e355ccee..a7c0f1850d 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch @@ -57,21 +57,21 @@ + { + net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor(this, field_76759_H); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; ++ return event.getNewColor(); + } + + public int getModdedBiomeGrassColor(int original) + { + net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor(this, original); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; ++ return event.getNewColor(); + } + + public int getModdedBiomeFoliageColor(int original) + { + net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor(this, original); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; ++ return event.getNewColor(); + } + + /** diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch index f66ae2e413..2b6f415c31 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch @@ -33,6 +33,6 @@ + { + net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens event = new net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens(worldType, seed, original); + net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ return event.newBiomeGens; ++ return event.getNewBiomeGens(); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch index 370b21be01..27625d41d5 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch @@ -49,7 +49,7 @@ { + net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField(this, p_185963_1_, p_185963_2_, p_185963_3_, p_185963_4_, p_185963_5_, p_185963_6_, p_185963_7_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.getNoisefield(); + if (p_185963_1_ == null) { diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch index f54b2aa4a0..f4704abe85 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch @@ -34,7 +34,7 @@ + net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField(this, p_185938_1_, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, p_185938_6_, p_185938_7_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.getNoisefield(); + double d0 = 684.412D; double d1 = 2053.236D; diff --git a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch index e48365a9f5..3a9a317099 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch @@ -50,7 +50,7 @@ + { + 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 ======================================*/ } diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch index 4af3d40bf4..b63848da22 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch @@ -57,7 +57,7 @@ { + net.minecraftforge.event.terraingen.BiomeEvent.GetVillageBlockID event = new net.minecraftforge.event.terraingen.BiomeEvent.GetVillageBlockID(startPiece == null ? null : startPiece.biome, p_175847_1_); + net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.replacement; ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.getReplacement(); if (this.field_143014_b) { if (p_175847_1_.func_177230_c() == Blocks.field_150364_r || p_175847_1_.func_177230_c() == Blocks.field_150363_s) diff --git a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java index 6a91caa0b6..0bad50d6a6 100644 --- a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java +++ b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java @@ -63,9 +63,9 @@ public class ClientCommandHandler extends CommandHandler CommandEvent event = new CommandEvent(icommand, sender, args); if (MinecraftForge.EVENT_BUS.post(event)) { - if (event.exception != null) + if (event.getException() != null) { - throw event.exception; + throw event.getException(); } return 0; } diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 20e279275d..892d49b59b 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -196,7 +196,7 @@ public class ForgeHooksClient { FOVUpdateEvent fovUpdateEvent = new FOVUpdateEvent(entity, fov); MinecraftForge.EVENT_BUS.post(fovUpdateEvent); - return fovUpdateEvent.newfov; + return fovUpdateEvent.getNewfov(); } public static float getFOVModifier(EntityRenderer renderer, Entity entity, IBlockState state, double renderPartialTicks, float fov) { @@ -295,7 +295,7 @@ public class ForgeHooksClient { PlaySoundEvent e = new PlaySoundEvent(manager, sound); MinecraftForge.EVENT_BUS.post(e); - return e.result; + return e.getResultSound(); } //static RenderBlocks VertexBufferRB; @@ -316,7 +316,7 @@ public class ForgeHooksClient public static float getFogDensity(EntityRenderer renderer, Entity entity, IBlockState state, float partial, float density) { EntityViewRenderEvent.FogDensity event = new EntityViewRenderEvent.FogDensity(renderer, entity, state, partial, density); - if (MinecraftForge.EVENT_BUS.post(event)) return event.density; + if (MinecraftForge.EVENT_BUS.post(event)) return event.getDensity(); return -1; } @@ -325,31 +325,6 @@ public class ForgeHooksClient MinecraftForge.EVENT_BUS.post(new EntityViewRenderEvent.RenderFogEvent(renderer, entity, state, partial, mode, distance)); } - /* - public static void setVertexBufferRB(RenderBlocks renderBlocks) - { - VertexBufferRB = renderBlocks; - } - - public static void onPreRenderWorld(VertexBuffer VertexBuffer, int pass) - { - if(VertexBufferRB != null) - { - worldRenderPass = pass; - MinecraftForge.EVENT_BUS.post(new RenderWorldEvent.Pre(VertexBuffer, (ChunkCache)VertexBufferRB.blockAccess, VertexBufferRB, pass)); - } - } - - public static void onPostRenderWorld(VertexBuffer VertexBuffer, int pass) - { - if(VertexBufferRB != null) - { - MinecraftForge.EVENT_BUS.post(new RenderWorldEvent.Post(VertexBuffer, (ChunkCache)VertexBufferRB.blockAccess, VertexBufferRB, pass)); - worldRenderPass = -1; - } - } - */ - public static void onModelBake(ModelManager modelManager, IRegistry modelRegistry, ModelLoader modelLoader) { MinecraftForge.EVENT_BUS.post(new ModelBakeEvent(modelManager, modelRegistry, modelLoader)); diff --git a/src/main/java/net/minecraftforge/client/GuiIngameForge.java b/src/main/java/net/minecraftforge/client/GuiIngameForge.java index 6fff3a25ca..0cbcb9ec9e 100644 --- a/src/main/java/net/minecraftforge/client/GuiIngameForge.java +++ b/src/main/java/net/minecraftforge/client/GuiIngameForge.java @@ -779,7 +779,7 @@ public class GuiIngameForge extends GuiIngame if (MinecraftForge.EVENT_BUS.post(event)) return; GlStateManager.pushMatrix(); - GlStateManager.translate((float)event.posX, (float)event.posY, 0.0F); + GlStateManager.translate((float) event.getPosX(), (float) event.getPosY(), 0.0F); persistantChatGUI.drawChat(updateCounter); GlStateManager.popMatrix(); diff --git a/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java b/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java index 36d67987a9..4639fae3af 100644 --- a/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java @@ -7,17 +7,32 @@ import net.minecraftforge.fml.common.eventhandler.Event; @Cancelable public class ClientChatReceivedEvent extends Event { - public ITextComponent message; + private ITextComponent message; + private final byte type; + public ClientChatReceivedEvent(byte type, ITextComponent message) + { + this.type = type; + this.setMessage(message); + } + + public ITextComponent getMessage() + { + return message; + } + + public void setMessage(ITextComponent message) + { + this.message = message; + } + /** * Introduced in 1.8: * 0 : Standard Text Message * 1 : 'System' message, displayed as standard text. * 2 : 'Status' message, displayed above action bar, where song notifications are. */ - public final byte type; - public ClientChatReceivedEvent(byte type, ITextComponent message) + public byte getType() { - this.type = type; - this.message = message; + return type; } } diff --git a/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java b/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java index 0108901947..047c2ce486 100644 --- a/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java +++ b/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java @@ -9,11 +9,11 @@ import net.minecraft.client.renderer.RenderGlobal; @Cancelable public class DrawBlockHighlightEvent extends Event { - public final RenderGlobal context; - public final EntityPlayer player; - public final RayTraceResult target; - public final int subID; - public final float partialTicks; + private final RenderGlobal context; + private final EntityPlayer player; + private final RayTraceResult target; + private final int subID; + private final float partialTicks; public DrawBlockHighlightEvent(RenderGlobal context, EntityPlayer player, RayTraceResult target, int subID, float partialTicks) { @@ -24,4 +24,9 @@ public class DrawBlockHighlightEvent extends Event this.partialTicks= partialTicks; } + public RenderGlobal getContext() { return context; } + public EntityPlayer getPlayer() { return player; } + public RayTraceResult getTarget() { return target; } + public int getSubID() { return subID; } + public float getPartialTicks() { return partialTicks; } } diff --git a/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java b/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java index 9d046fa417..4f9a93aa12 100644 --- a/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java +++ b/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java @@ -52,11 +52,21 @@ public abstract class EntityViewRenderEvent extends Event @Cancelable public static class FogDensity extends EntityViewRenderEvent { - public float density; + private float density; public FogDensity(EntityRenderer renderer, Entity entity, IBlockState state, double renderPartialTicks, float density) { super(renderer, entity, state, renderPartialTicks); + this.setDensity(density); + } + + public float getDensity() + { + return density; + } + + public void setDensity(float density) + { this.density = density; } } @@ -67,8 +77,8 @@ public abstract class EntityViewRenderEvent extends Event @HasResult public static class RenderFogEvent extends EntityViewRenderEvent { - public final int fogMode; - public final float farPlaneDistance; + private final int fogMode; + private final float farPlaneDistance; public RenderFogEvent(EntityRenderer renderer, Entity entity, IBlockState state, double renderPartialTicks, int fogMode, float farPlaneDistance) { @@ -76,6 +86,16 @@ public abstract class EntityViewRenderEvent extends Event this.fogMode = fogMode; this.farPlaneDistance = farPlaneDistance; } + + public int getFogMode() + { + return fogMode; + } + + public float getFarPlaneDistance() + { + return farPlaneDistance; + } } /** @@ -84,17 +104,24 @@ public abstract class EntityViewRenderEvent extends Event */ public static class FogColors extends EntityViewRenderEvent { - public float red; - public float green; - public float blue; + private float red; + private float green; + private float blue; public FogColors(EntityRenderer renderer, Entity entity, IBlockState state, double renderPartialTicks, float red, float green, float blue) { super(renderer, entity, state, renderPartialTicks); - this.red = red; - this.green = green; - this.blue = blue; + this.setRed(red); + this.setGreen(green); + this.setBlue(blue); } + + public float getRed() { return red; } + public void setRed(float red) { this.red = red; } + public float getGreen() { return green; } + public void setGreen(float green) { this.green = green; } + public float getBlue() { return blue; } + public void setBlue(float blue) { this.blue = blue; } } /** @@ -102,17 +129,24 @@ public abstract class EntityViewRenderEvent extends Event */ public static class CameraSetup extends EntityViewRenderEvent { - public float yaw; - public float pitch; - public float roll; + private float yaw; + private float pitch; + private float roll; public CameraSetup(EntityRenderer renderer, Entity entity, IBlockState state, double renderPartialTicks, float yaw, float pitch, float roll) { super(renderer, entity, state, renderPartialTicks); - this.yaw = yaw; - this.pitch = pitch; - this.roll = roll; + this.setYaw(yaw); + this.setPitch(pitch); + this.setRoll(roll); } + + public float getYaw() { return yaw; } + public void setYaw(float yaw) { this.yaw = yaw; } + public float getPitch() { return pitch; } + public void setPitch(float pitch) { this.pitch = pitch; } + public float getRoll() { return roll; } + public void setRoll(float roll) { this.roll = roll; } } /** diff --git a/src/main/java/net/minecraftforge/client/event/FOVUpdateEvent.java b/src/main/java/net/minecraftforge/client/event/FOVUpdateEvent.java index 91863999ce..1c7bb60ffe 100644 --- a/src/main/java/net/minecraftforge/client/event/FOVUpdateEvent.java +++ b/src/main/java/net/minecraftforge/client/event/FOVUpdateEvent.java @@ -9,14 +9,34 @@ import net.minecraftforge.fml.common.eventhandler.Event; */ public class FOVUpdateEvent extends Event { - public final EntityPlayer entity; - public final float fov; - public float newfov; + private final EntityPlayer entity; + private final float fov; + private float newfov; public FOVUpdateEvent(EntityPlayer entity, float fov) { this.entity = entity; this.fov = fov; - this.newfov = fov; + this.setNewfov(fov); + } + + public EntityPlayer getEntity() + { + return entity; + } + + public float getFov() + { + return fov; + } + + public float getNewfov() + { + return newfov; + } + + public void setNewfov(float newfov) + { + this.newfov = newfov; } } diff --git a/src/main/java/net/minecraftforge/client/event/GuiOpenEvent.java b/src/main/java/net/minecraftforge/client/event/GuiOpenEvent.java index 85e2d247a4..362acfd2d5 100644 --- a/src/main/java/net/minecraftforge/client/event/GuiOpenEvent.java +++ b/src/main/java/net/minecraftforge/client/event/GuiOpenEvent.java @@ -14,8 +14,18 @@ import net.minecraft.client.gui.GuiScreen; @Cancelable public class GuiOpenEvent extends Event { - public GuiScreen gui; + private GuiScreen gui; public GuiOpenEvent(GuiScreen gui) + { + this.setGui(gui); + } + + public GuiScreen getGui() + { + return gui; + } + + public void setGui(GuiScreen gui) { this.gui = gui; } diff --git a/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java b/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java index b38feff7d0..2809ffa5f8 100644 --- a/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java +++ b/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java @@ -22,29 +22,44 @@ import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class GuiScreenEvent extends Event { - /** - * The GuiScreen object generating this event. - */ - public final GuiScreen gui; + private final GuiScreen gui; public GuiScreenEvent(GuiScreen gui) { this.gui = gui; } + /** + * The GuiScreen object generating this event. + */ + public GuiScreen getGui() + { + return gui; + } + public static class InitGuiEvent extends GuiScreenEvent { - /** - * The {@code buttonList} field from the GuiScreen object referenced by {@code gui}. - */ - public List buttonList; + private List buttonList; public InitGuiEvent(GuiScreen gui, List buttonList) { super(gui); + this.setButtonList(buttonList); + } + + /** + * The {@code buttonList} field from the GuiScreen object referenced by {@code gui}. + */ + public List getButtonList() + { + return buttonList; + } + + public void setButtonList(List buttonList) + { this.buttonList = buttonList; } - + /** * This event fires just after initializing {@code GuiScreen.mc}, {@code GuiScreen.fontRendererObj}, * {@code GuiScreen.width}, and {@code GuiScreen.height}, and just before calling {@code GuiScreen.buttonList.clear()} @@ -78,18 +93,9 @@ public class GuiScreenEvent extends Event public static class DrawScreenEvent extends GuiScreenEvent { - /** - * The x coordinate of the mouse pointer on the screen. - */ - public final int mouseX; - /** - * The y coordinate of the mouse pointer on the screen. - */ - public final int mouseY; - /** - * Partial render ticks elapsed. - */ - public final float renderPartialTicks; + private final int mouseX; + private final int mouseY; + private final float renderPartialTicks; public DrawScreenEvent(GuiScreen gui, int mouseX, int mouseY, float renderPartialTicks) { @@ -98,7 +104,31 @@ public class GuiScreenEvent extends Event this.mouseY = mouseY; this.renderPartialTicks = renderPartialTicks; } - + + /** + * The x coordinate of the mouse pointer on the screen. + */ + public int getMouseX() + { + return mouseX; + } + + /** + * The y coordinate of the mouse pointer on the screen. + */ + public int getMouseY() + { + return mouseY; + } + + /** + * Partial render ticks elapsed. + */ + public float getRenderPartialTicks() + { + return renderPartialTicks; + } + /** * This event fires just before {@code GuiScreen.drawScreen()} is called. * Cancel this event to skip {@code GuiScreen.drawScreen()}. @@ -162,22 +192,42 @@ public class GuiScreenEvent extends Event public static class ActionPerformedEvent extends GuiScreenEvent { - /** - * The button that was clicked. - */ - public GuiButton button; - /** - * A COPY of the {@code buttonList} field from the GuiScreen referenced by {@code gui}. - */ - public List buttonList; + private GuiButton button; + private List buttonList; public ActionPerformedEvent(GuiScreen gui, GuiButton button, List buttonList) { super(gui); - this.button = button; - this.buttonList = new ArrayList(buttonList); + this.setButton(button); + this.setButtonList(new ArrayList(buttonList)); } - + + /** + * The button that was clicked. + */ + public GuiButton getButton() + { + return button; + } + + public void setButton(GuiButton button) + { + this.button = button; + } + + /** + * A COPY of the {@code buttonList} field from the GuiScreen referenced by {@code gui}. + */ + public List getButtonList() + { + return buttonList; + } + + public void setButtonList(List buttonList) + { + this.buttonList = buttonList; + } + /** * This event fires once it has been determined that a GuiButton object has been clicked. * Cancel this event to bypass {@code GuiScreen.actionPerformed()}. diff --git a/src/main/java/net/minecraftforge/client/event/MouseEvent.java b/src/main/java/net/minecraftforge/client/event/MouseEvent.java index b4e5782bf9..3652bcf2ee 100644 --- a/src/main/java/net/minecraftforge/client/event/MouseEvent.java +++ b/src/main/java/net/minecraftforge/client/event/MouseEvent.java @@ -12,14 +12,14 @@ import net.minecraftforge.fml.common.eventhandler.Event; @Cancelable public class MouseEvent extends Event { - public final int x; - public final int y; - public final int dx; - public final int dy; - public final int dwheel; - public final int button; - public final boolean buttonstate; - public final long nanoseconds; + private final int x; + private final int y; + private final int dx; + private final int dy; + private final int dwheel; + private final int button; + private final boolean buttonstate; + private final long nanoseconds; public MouseEvent() { @@ -32,4 +32,13 @@ public class MouseEvent extends Event this.buttonstate = Mouse.getEventButtonState(); this.nanoseconds = Mouse.getEventNanoseconds(); } + + public int getX() { return x; } + public int getY() { return y; } + public int getDx() { return dx; } + public int getDy() { return dy; } + public int getDwheel() { return dwheel; } + public int getButton() { return button; } + public boolean isButtonstate() { return buttonstate; } + public long getNanoseconds() { return nanoseconds; } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java b/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java index 7a192802da..12cc88c534 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java @@ -12,25 +12,16 @@ import net.minecraftforge.fml.common.eventhandler.Event; */ @Cancelable public class RenderBlockOverlayEvent extends Event { - + public static enum OverlayType { FIRE, BLOCK, WATER } - /** - * The player which the overlay will apply to - */ - public final EntityPlayer player; - public final float renderPartialTicks; - /** - * The type of overlay to occur - */ - public final OverlayType overlayType; - /** - * If the overlay type is BLOCK, then this is the block which the overlay is getting it's icon from - */ - public final IBlockState blockForOverlay; - public final BlockPos blockPos; + private final EntityPlayer player; + private final float renderPartialTicks; + private final OverlayType overlayType; + private final IBlockState blockForOverlay; + private final BlockPos blockPos; @Deprecated public RenderBlockOverlayEvent(EntityPlayer player, float renderPartialTicks, OverlayType type, Block block, int x, int y, int z) @@ -48,4 +39,18 @@ public class RenderBlockOverlayEvent extends Event { } + /** + * The player which the overlay will apply to + */ + public EntityPlayer getPlayer() { return player; } + public float getRenderPartialTicks() { return renderPartialTicks; } + /** + * The type of overlay to occur + */ + public OverlayType getOverlayType() { return overlayType; } + /** + * If the overlay type is BLOCK, then this is the block which the overlay is getting it's icon from + */ + public IBlockState getBlockForOverlay() { return blockForOverlay; } + public BlockPos getBlockPos() { return blockPos; } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java b/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java index f70b0f577d..a9187ff057 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java @@ -10,6 +10,21 @@ import net.minecraft.client.gui.ScaledResolution; @Cancelable public class RenderGameOverlayEvent extends Event { + public float getPartialTicks() + { + return partialTicks; + } + + public ScaledResolution getResolution() + { + return resolution; + } + + public ElementType getType() + { + return type; + } + public static enum ElementType { ALL, @@ -33,9 +48,9 @@ public class RenderGameOverlayEvent extends Event SUBTITLES } - public final float partialTicks; - public final ScaledResolution resolution; - public final ElementType type; + private final float partialTicks; + private final ScaledResolution resolution; + private final ElementType type; public RenderGameOverlayEvent(float partialTicks, ScaledResolution resolution) { @@ -46,8 +61,8 @@ public class RenderGameOverlayEvent extends Event private RenderGameOverlayEvent(RenderGameOverlayEvent parent, ElementType type) { - this.partialTicks = parent.partialTicks; - this.resolution = parent.resolution; + this.partialTicks = parent.getPartialTicks(); + this.resolution = parent.getResolution(); this.type = type; } @@ -70,25 +85,55 @@ public class RenderGameOverlayEvent extends Event public static class Text extends Pre { - public final ArrayList left; - public final ArrayList right; + private final ArrayList left; + private final ArrayList right; public Text(RenderGameOverlayEvent parent, ArrayList left, ArrayList right) { super(parent, ElementType.TEXT); this.left = left; this.right = right; } + + public ArrayList getLeft() + { + return left; + } + + public ArrayList getRight() + { + return right; + } } public static class Chat extends Pre { - public int posX; - public int posY; + private int posX; + private int posY; public Chat(RenderGameOverlayEvent parent, int posX, int posY) { super(parent, ElementType.CHAT); + this.setPosX(posX); + this.setPosY(posY); + } + + public int getPosX() + { + return posX; + } + + public void setPosX(int posX) + { this.posX = posX; + } + + public int getPosY() + { + return posY; + } + + public void setPosY(int posY) + { this.posY = posY; } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java b/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java index 0743f8db09..9af3b47581 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java @@ -7,13 +7,28 @@ import net.minecraft.client.renderer.RenderGlobal; @Cancelable public class RenderHandEvent extends Event { - public final RenderGlobal context; - public final float partialTicks; - public final int renderPass; + private final RenderGlobal context; + private final float partialTicks; + private final int renderPass; public RenderHandEvent(RenderGlobal context, float partialTicks, int renderPass) { this.context = context; this.partialTicks = partialTicks; this.renderPass = renderPass; } + + public RenderGlobal getContext() + { + return context; + } + + public float getPartialTicks() + { + return partialTicks; + } + + public int getRenderPass() + { + return renderPass; + } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java b/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java index f394ae5f46..2efabac14c 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java @@ -14,9 +14,9 @@ import net.minecraftforge.fml.common.eventhandler.Event; @Cancelable public class RenderItemInFrameEvent extends Event { - public final ItemStack item; - public final EntityItemFrame entityItemFrame; - public final RenderItemFrame renderer; + private final ItemStack item; + private final EntityItemFrame entityItemFrame; + private final RenderItemFrame renderer; public RenderItemInFrameEvent(EntityItemFrame itemFrame, RenderItemFrame renderItemFrame) { @@ -24,4 +24,19 @@ public class RenderItemInFrameEvent extends Event entityItemFrame = itemFrame; renderer = renderItemFrame; } + + public ItemStack getItem() + { + return item; + } + + public EntityItemFrame getEntityItemFrame() + { + return entityItemFrame; + } + + public RenderItemFrame getRenderer() + { + return renderer; + } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java index 409917da94..9c9bc51d22 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java @@ -7,11 +7,11 @@ import net.minecraft.entity.EntityLivingBase; public abstract class RenderLivingEvent extends Event { - public final EntityLivingBase entity; - public final RenderLivingBase renderer; - public final double x; - public final double y; - public final double z; + private final EntityLivingBase entity; + private final RenderLivingBase renderer; + private final double x; + private final double y; + private final double z; public RenderLivingEvent(EntityLivingBase entity, RenderLivingBase renderer, double x, double y, double z) { @@ -21,7 +21,13 @@ public abstract class RenderLivingEvent extends Even this.y = y; this.z = z; } - + + public EntityLivingBase getEntity() { return entity; } + public RenderLivingBase getRenderer() { return renderer; } + public double getX() { return x; } + public double getY() { return y; } + public double getZ() { return z; } + @Cancelable public static class Pre extends RenderLivingEvent { diff --git a/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java b/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java index 30ec16ccec..088ac8de3c 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java @@ -8,11 +8,11 @@ import net.minecraftforge.event.entity.player.PlayerEvent; public abstract class RenderPlayerEvent extends PlayerEvent { - public final RenderPlayer renderer; - public final float partialRenderTick; - public final double x; - public final double y; - public final double z; + private final RenderPlayer renderer; + private final float partialRenderTick; + private final double x; + private final double y; + private final double z; public RenderPlayerEvent(EntityPlayer player, RenderPlayer renderer, float partialRenderTick, double x, double y, double z) { @@ -24,6 +24,12 @@ public abstract class RenderPlayerEvent extends PlayerEvent this.z = z; } + public RenderPlayer getRenderer() { return renderer; } + public float getPartialRenderTick() { return partialRenderTick; } + public double getX() { return x; } + public double getY() { return y; } + public double getZ() { return z; } + @Cancelable public static class Pre extends RenderPlayerEvent { @@ -50,10 +56,17 @@ public abstract class RenderPlayerEvent extends PlayerEvent @Cancelable public static class Pre extends Specials { - public boolean renderHelmet = true; - public boolean renderCape = true; - public boolean renderItem = true; + private boolean renderHelmet = true; + private boolean renderCape = true; + private boolean renderItem = true; public Pre(EntityPlayer player, RenderPlayer renderer, float partialTicks){ super(player, renderer, partialTicks); } + + public boolean shouldRenderHelmet() { return renderHelmet; } + public void setRenderHelmet(boolean renderHelmet) { this.renderHelmet = renderHelmet; } + public boolean shouldRenderCape() { return renderCape; } + public void setRenderCape(boolean renderCape) { this.renderCape = renderCape; } + public boolean shouldRenderItem() { return renderItem; } + public void setRenderItem(boolean renderItem) { this.renderItem = renderItem; } } public static class Post extends Specials @@ -65,18 +78,38 @@ public abstract class RenderPlayerEvent extends PlayerEvent @Deprecated public static class SetArmorModel extends RenderPlayerEvent { - /** - * Setting this to any value besides -1 will result in the function being - * Immediately exited with the return value specified. - */ - public int result = -1; - public final int slot; - public final ItemStack stack; + private int result = -1; + private final int slot; + private final ItemStack stack; public SetArmorModel(EntityPlayer player, RenderPlayer renderer, int slot, float partialTick, ItemStack stack) { super(player, renderer, partialTick, 0D, 0D, 0D); this.slot = slot; this.stack = stack; } + + /** + * Setting this to any value besides -1 will result in the function being + * Immediately exited with the return value specified. + */ + public int getResultValue() + { + return result; + } + + public void setResult(int result) + { + this.result = result; + } + + public int getSlot() + { + return slot; + } + + public ItemStack getStack() + { + return stack; + } } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/event/RenderWorldEvent.java b/src/main/java/net/minecraftforge/client/event/RenderWorldEvent.java deleted file mode 100644 index dbe60ff67b..0000000000 --- a/src/main/java/net/minecraftforge/client/event/RenderWorldEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.minecraftforge.client.event; - -import net.minecraftforge.fml.common.eventhandler.Event; -//import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.VertexBuffer; -import net.minecraft.world.ChunkCache; - -public abstract class RenderWorldEvent extends Event -{ - public final VertexBuffer renderer; - public final ChunkCache chunkCache; - //public final RenderBlocks renderBlocks; - public final int pass; - - public RenderWorldEvent(VertexBuffer renderer, ChunkCache chunkCache, /*RenderBlocks renderBlocks,*/ int pass) - { - this.renderer = renderer; - this.chunkCache = chunkCache; - //this.renderBlocks = renderBlocks; - this.pass = pass; - } - - /** - * Fired when 16x16x16 chunk area is being redrawn. - * Fired after GL state is setup, before tessellator is started. - */ - public static class Pre extends RenderWorldEvent - { - public Pre(VertexBuffer renderer, ChunkCache chunkCache, /*RenderBlocks renderBlocks,*/ int pass){ super(renderer, chunkCache, /*renderBlocks,*/ pass); } - } - - /** - * Fired after the tessellator is stopped, before the display list is ended. - */ - public static class Post extends RenderWorldEvent - { - public Post(VertexBuffer renderer, ChunkCache chunkCache, /*RenderBlocks renderBlocks,*/ int pass){ super(renderer, chunkCache, /*renderBlocks,*/ pass); } - } -} diff --git a/src/main/java/net/minecraftforge/client/event/RenderWorldLastEvent.java b/src/main/java/net/minecraftforge/client/event/RenderWorldLastEvent.java index 0d92024e12..646fd23fbf 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderWorldLastEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderWorldLastEvent.java @@ -5,11 +5,21 @@ import net.minecraft.client.renderer.RenderGlobal; public class RenderWorldLastEvent extends Event { - public final RenderGlobal context; - public final float partialTicks; + private final RenderGlobal context; + private final float partialTicks; public RenderWorldLastEvent(RenderGlobal context, float partialTicks) { this.context = context; this.partialTicks = partialTicks; } + + public RenderGlobal getContext() + { + return context; + } + + public float getPartialTicks() + { + return partialTicks; + } } diff --git a/src/main/java/net/minecraftforge/client/event/TextureStitchEvent.java b/src/main/java/net/minecraftforge/client/event/TextureStitchEvent.java index 21af9e192d..b943b7b8d1 100644 --- a/src/main/java/net/minecraftforge/client/event/TextureStitchEvent.java +++ b/src/main/java/net/minecraftforge/client/event/TextureStitchEvent.java @@ -6,13 +6,18 @@ import net.minecraft.client.renderer.texture.TextureMap; public class TextureStitchEvent extends Event { - public final TextureMap map; + private final TextureMap map; public TextureStitchEvent(TextureMap map) { this.map = map; } + public TextureMap getMap() + { + return map; + } + /** * Fired when the TextureMap is told to refresh it's stitched texture. * Called after the Stitched list is cleared, but before any blocks or items diff --git a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java index b7fa7d7c4c..8338d25f66 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java @@ -11,15 +11,35 @@ import net.minecraft.client.audio.SoundManager; */ public class PlaySoundEvent extends SoundEvent { - public final String name; - public final ISound sound; - public ISound result; + private final String name; + private final ISound sound; + private ISound result; public PlaySoundEvent(SoundManager manager, ISound sound) { super(manager); this.sound = sound; this.name = sound.getSoundLocation().getResourcePath(); - this.result = sound; + this.setResultSound(sound); + } + + public String getName() + { + return name; + } + + public ISound getSound() + { + return sound; + } + + public ISound getResultSound() + { + return result; + } + + public void setResultSound(ISound result) + { + this.result = result; } } diff --git a/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java b/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java index dbfecd03a7..e8b450a106 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java @@ -6,12 +6,17 @@ import net.minecraft.client.audio.SoundManager; public class SoundEvent extends Event { - public final SoundManager manager; + private final SoundManager manager; public SoundEvent(SoundManager manager) { this.manager = manager; } + public SoundManager getManager() + { + return manager; + } + public static class SoundSourceEvent extends SoundEvent { public final ISound sound; diff --git a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java index bf17bc1dc8..66d7f7d113 100644 --- a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java +++ b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java @@ -370,25 +370,45 @@ public class ForgeChunkManager } public static class ForceChunkEvent extends Event { - public final Ticket ticket; - public final ChunkCoordIntPair location; + private final Ticket ticket; + private final ChunkCoordIntPair location; public ForceChunkEvent(Ticket ticket, ChunkCoordIntPair location) { this.ticket = ticket; this.location = location; } + + public Ticket getTicket() + { + return ticket; + } + + public ChunkCoordIntPair getLocation() + { + return location; + } } public static class UnforceChunkEvent extends Event { - public final Ticket ticket; - public final ChunkCoordIntPair location; + private final Ticket ticket; + private final ChunkCoordIntPair location; public UnforceChunkEvent(Ticket ticket, ChunkCoordIntPair location) { this.ticket = ticket; this.location = location; } + + public Ticket getTicket() + { + return ticket; + } + + public ChunkCoordIntPair getLocation() + { + return location; + } } diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index c7fd9f66ef..1a475e0544 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -56,7 +56,6 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; -import net.minecraft.util.ResourceLocation; import net.minecraft.util.WeightedRandom; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -483,7 +482,7 @@ public class ForgeHooks public static float[] onLivingFall(EntityLivingBase entity, float distance, float damageMultiplier) { LivingFallEvent event = new LivingFallEvent(entity, distance, damageMultiplier); - return (MinecraftForge.EVENT_BUS.post(event) ? null : new float[]{event.distance, event.damageMultiplier}); + return (MinecraftForge.EVENT_BUS.post(event) ? null : new float[]{event.getDistance(), event.getDamageMultiplier()}); } public static boolean isLivingOnLadder(IBlockState state, World world, BlockPos pos, EntityLivingBase entity) @@ -544,9 +543,9 @@ public class ForgeHooks if (!player.worldObj.isRemote) { - player.getEntityWorld().spawnEntityInWorld(event.entityItem); + player.getEntityWorld().spawnEntityInWorld(event.getEntityItem()); } - return event.entityItem; + return event.getEntityItem(); } public static float getEnchantPower(World world, BlockPos pos) @@ -648,7 +647,7 @@ public class ForgeHooks { PlayerOpenContainerEvent event = new PlayerOpenContainerEvent(player, openContainer); MinecraftForge.EVENT_BUS.post(event); - return event.getResult() == Event.Result.DEFAULT ? event.canInteractWith : event.getResult() == Event.Result.ALLOW ? true : false; + return event.getResult() == Event.Result.DEFAULT ? event.isCanInteractWith() : event.getResult() == Event.Result.ALLOW ? true : false; } public static int onBlockBreakEvent(World world, GameType gameType, EntityPlayerMP entityPlayer, BlockPos pos) @@ -800,11 +799,11 @@ public class ForgeHooks { AnvilUpdateEvent e = new AnvilUpdateEvent(left, right, name, baseCost); if (MinecraftForge.EVENT_BUS.post(e)) return false; - if (e.output == null) return true; + if (e.getOutput() == null) return true; - outputSlot.setInventorySlotContents(0, e.output); - container.maximumCost = e.cost; - container.materialCost = e.materialCost; + outputSlot.setInventorySlotContents(0, e.getOutput()); + container.maximumCost = e.getCost(); + container.materialCost = e.getMaterialCost(); return false; } @@ -812,7 +811,7 @@ public class ForgeHooks { AnvilRepairEvent e = new AnvilRepairEvent(player, left, right, output); MinecraftForge.EVENT_BUS.post(e); - return e.breakChance; + return e.getBreakChance(); } public static boolean onNoteChange(TileEntityNote te, byte old) diff --git a/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java b/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java index 43295be8e2..7d5d5ad209 100644 --- a/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java +++ b/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java @@ -17,12 +17,12 @@ public class ForgeInternalHandler @SubscribeEvent(priority = EventPriority.HIGHEST) public void onEntityJoinWorld(EntityJoinWorldEvent event) { - if (!event.world.isRemote) + if (!event.getWorld().isRemote) { - ForgeChunkManager.loadEntity(event.entity); + ForgeChunkManager.loadEntity(event.getEntity()); } - Entity entity = event.entity; + Entity entity = event.getEntity(); if (entity.getClass().equals(EntityItem.class)) { ItemStack stack = ((EntityItem)entity).getEntityItem(); @@ -47,12 +47,12 @@ public class ForgeInternalHandler if (item.hasCustomEntity(stack)) { - Entity newEntity = item.createEntity(event.world, entity, stack); + Entity newEntity = item.createEntity(event.getWorld(), entity, stack); if (newEntity != null) { entity.setDead(); event.setCanceled(true); - event.world.spawnEntityInWorld(newEntity); + event.getWorld().spawnEntityInWorld(newEntity); } } } @@ -61,20 +61,20 @@ public class ForgeInternalHandler @SubscribeEvent(priority = EventPriority.HIGHEST) public void onDimensionLoad(WorldEvent.Load event) { - ForgeChunkManager.loadWorld(event.world); + ForgeChunkManager.loadWorld(event.getWorld()); } @SubscribeEvent(priority = EventPriority.HIGHEST) public void onDimensionSave(WorldEvent.Save event) { - ForgeChunkManager.saveWorld(event.world); + ForgeChunkManager.saveWorld(event.getWorld()); } @SubscribeEvent(priority = EventPriority.HIGHEST) public void onDimensionUnload(WorldEvent.Unload event) { - ForgeChunkManager.unloadWorld(event.world); - if (event.world instanceof WorldServer) - FakePlayerFactory.unloadWorld((WorldServer)event.world); + ForgeChunkManager.unloadWorld(event.getWorld()); + if (event.getWorld() instanceof WorldServer) + FakePlayerFactory.unloadWorld((WorldServer) event.getWorld()); } } diff --git a/src/main/java/net/minecraftforge/event/AnvilUpdateEvent.java b/src/main/java/net/minecraftforge/event/AnvilUpdateEvent.java index 585c5a715d..94baabc085 100644 --- a/src/main/java/net/minecraftforge/event/AnvilUpdateEvent.java +++ b/src/main/java/net/minecraftforge/event/AnvilUpdateEvent.java @@ -14,19 +14,29 @@ import net.minecraft.item.ItemStack; @Cancelable public class AnvilUpdateEvent extends Event { - public final ItemStack left; // The left side of the input - public final ItemStack right; // The right side of the input - public final String name; // The name to set the item, if the user specified one. - public ItemStack output; // Set this to set the output stack - public int cost; // The base cost, set this to change it if output != null - public int materialCost; // The number of items from the right slot to be consumed during the repair. Leave as 0 to consume the entire stack. + private final ItemStack left; // The left side of the input + private final ItemStack right; // The right side of the input + private final String name; // The name to set the item, if the user specified one. + private ItemStack output; // Set this to set the output stack + private int cost; // The base cost, set this to change it if output != null + private int materialCost; // The number of items from the right slot to be consumed during the repair. Leave as 0 to consume the entire stack. public AnvilUpdateEvent(ItemStack left, ItemStack right, String name, int cost) { this.left = left; this.right = right; this.name = name; - this.cost = cost; - this.materialCost = 0; + this.setCost(cost); + this.setMaterialCost(0); } + + public ItemStack getLeft() { return left; } + public ItemStack getRight() { return right; } + public String getName() { return name; } + public ItemStack getOutput() { return output; } + public void setOutput(ItemStack output) { this.output = output; } + public int getCost() { return cost; } + public void setCost(int cost) { this.cost = cost; } + public int getMaterialCost() { return materialCost; } + public void setMaterialCost(int materialCost) { this.materialCost = materialCost; } } diff --git a/src/main/java/net/minecraftforge/event/CommandEvent.java b/src/main/java/net/minecraftforge/event/CommandEvent.java index 5c316b5148..58f2943082 100644 --- a/src/main/java/net/minecraftforge/event/CommandEvent.java +++ b/src/main/java/net/minecraftforge/event/CommandEvent.java @@ -26,15 +26,22 @@ import net.minecraft.command.ICommandSender; public class CommandEvent extends Event { - public final ICommand command; - public final ICommandSender sender; - public String[] parameters; - public Throwable exception; + private final ICommand command; + private final ICommandSender sender; + private String[] parameters; + private Throwable exception; public CommandEvent(ICommand command, ICommandSender sender, String[] parameters) { this.command = command; this.sender = sender; - this.parameters = parameters; + this.setParameters(parameters); } + + public ICommand getCommand() { return command; } + public ICommandSender getSender() { return sender; } + public String[] getParameters() { return parameters; } + public void setParameters(String[] parameters) { this.parameters = parameters; } + public Throwable getException() { return exception; } + public void setException(Throwable exception) { this.exception = exception; } } diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index 55c16f8cbc..99f18e3fba 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -125,7 +125,7 @@ public class ForgeEventFactory public static float getBreakSpeed(EntityPlayer player, IBlockState state, float original, BlockPos pos) { PlayerEvent.BreakSpeed event = new PlayerEvent.BreakSpeed(player, state, original, pos); - return (MinecraftForge.EVENT_BUS.post(event) ? -1 : event.newSpeed); + return (MinecraftForge.EVENT_BUS.post(event) ? -1 : event.getNewSpeed()); } @Deprecated @@ -182,28 +182,28 @@ public class ForgeEventFactory { return null; } - return event.list; + return event.getList(); } public static int getMaxSpawnPackSize(EntityLiving entity) { LivingPackSizeEvent maxCanSpawnEvent = new LivingPackSizeEvent(entity); MinecraftForge.EVENT_BUS.post(maxCanSpawnEvent); - return maxCanSpawnEvent.getResult() == Result.ALLOW ? maxCanSpawnEvent.maxPackSize : entity.getMaxSpawnedInChunk(); + return maxCanSpawnEvent.getResult() == Result.ALLOW ? maxCanSpawnEvent.getMaxPackSize() : entity.getMaxSpawnedInChunk(); } public static String getPlayerDisplayName(EntityPlayer player, String username) { PlayerEvent.NameFormat event = new PlayerEvent.NameFormat(player, username); MinecraftForge.EVENT_BUS.post(event); - return event.displayname; + return event.getDisplayname(); } public static float fireBlockHarvesting(List drops, World world, BlockPos pos, IBlockState state, int fortune, float dropChance, boolean silkTouch, EntityPlayer player) { BlockEvent.HarvestDropsEvent event = new BlockEvent.HarvestDropsEvent(world, pos, state, fortune, dropChance, drops, player, silkTouch); MinecraftForge.EVENT_BUS.post(event); - return event.dropChance; + return event.getDropChance(); } public static ItemTooltipEvent onItemTooltip(ItemStack itemStack, EntityPlayer entityPlayer, List toolTip, boolean showAdvancedItemTooltips) @@ -228,13 +228,13 @@ public class ForgeEventFactory public static int onItemUseStart(EntityLivingBase entity, ItemStack item, int duration) { LivingEntityUseItemEvent event = new LivingEntityUseItemEvent.Start(entity, item, duration); - return MinecraftForge.EVENT_BUS.post(event) ? -1 : event.duration; + return MinecraftForge.EVENT_BUS.post(event) ? -1 : event.getDuration(); } public static int onItemUseTick(EntityLivingBase entity, ItemStack item, int duration) { LivingEntityUseItemEvent event = new LivingEntityUseItemEvent.Tick(entity, item, duration); - return MinecraftForge.EVENT_BUS.post(event) ? -1 : event.duration; + return MinecraftForge.EVENT_BUS.post(event) ? -1 : event.getDuration(); } public static boolean onUseItemStop(EntityLivingBase entity, ItemStack item, int duration) @@ -246,7 +246,7 @@ public class ForgeEventFactory { LivingEntityUseItemEvent.Finish event = new LivingEntityUseItemEvent.Finish(entity, item, duration, result); MinecraftForge.EVENT_BUS.post(event); - return event.result; + return event.getResultStack(); } public static void onStartEntityTracking(Entity entity, EntityPlayer player) @@ -279,7 +279,7 @@ public class ForgeEventFactory public static ITextComponent onClientChat(byte type, ITextComponent message) { ClientChatReceivedEvent event = new ClientChatReceivedEvent(type, message); - return MinecraftForge.EVENT_BUS.post(event) ? null : event.message; + return MinecraftForge.EVENT_BUS.post(event) ? null : event.getMessage(); } public static int onHoeUse(ItemStack stack, EntityPlayer player, World worldIn, BlockPos pos) @@ -332,7 +332,7 @@ public class ForgeEventFactory { EntityEvent.CanUpdate event = new EntityEvent.CanUpdate(entity); MinecraftForge.EVENT_BUS.post(event); - return event.canUpdate; + return event.getCanUpdate(); } public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, SoundEvent name, SoundCategory category, float volume, float pitch) @@ -347,7 +347,7 @@ public class ForgeEventFactory if (item == null) return -1; ItemExpireEvent event = new ItemExpireEvent(entity, (item.getItem() == null ? 6000 : item.getItem().getEntityLifespan(item, entity.worldObj))); if (!MinecraftForge.EVENT_BUS.post(event)) return -1; - return event.extraLife; + return event.getExtraLife(); } public static int onItemPickup(EntityItem entityItem, EntityPlayer entityIn, ItemStack itemstack) @@ -391,7 +391,7 @@ public class ForgeEventFactory { PlayerSleepInBedEvent event = new PlayerSleepInBedEvent(player, pos); MinecraftForge.EVENT_BUS.post(event); - return event.result; + return event.getResultStatus(); } public static void onPlayerWakeup(EntityPlayer player, boolean wakeImmediately, boolean updateWorldFlag, boolean setSpawn) @@ -442,7 +442,7 @@ public class ForgeEventFactory public static float onLivingHeal(EntityLivingBase entity, float amount) { LivingHealEvent event = new LivingHealEvent(entity, amount); - return (MinecraftForge.EVENT_BUS.post(event) ? 0 : event.amount); + return (MinecraftForge.EVENT_BUS.post(event) ? 0 : event.getAmount()); } public static boolean onPotionAttemptBrew(ItemStack[] stacks) diff --git a/src/main/java/net/minecraftforge/event/brewing/PotionBrewEvent.java b/src/main/java/net/minecraftforge/event/brewing/PotionBrewEvent.java index 8ec9d6724c..b3c194d80c 100644 --- a/src/main/java/net/minecraftforge/event/brewing/PotionBrewEvent.java +++ b/src/main/java/net/minecraftforge/event/brewing/PotionBrewEvent.java @@ -73,8 +73,7 @@ public class PotionBrewEvent extends Event *
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/ - @SuppressWarnings("deprecation") - public static class Post extends PotionBrewedEvent + public static class Post extends PotionBrewEvent { public Post(ItemStack[] stacks) { diff --git a/src/main/java/net/minecraftforge/event/brewing/PotionBrewedEvent.java b/src/main/java/net/minecraftforge/event/brewing/PotionBrewedEvent.java deleted file mode 100644 index 59bf94d614..0000000000 --- a/src/main/java/net/minecraftforge/event/brewing/PotionBrewedEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.minecraftforge.event.brewing; - -import net.minecraft.item.ItemStack; - -/** - * PotionBrewedEvent is fired when a potion is brewed in the brewing stand. - *
- * The event is fired during the TileEntityBrewingStand#brewPotions() method invocation.
- *
- * {@link #brewingStacks} contains the itemstack array from the TileEntityBrewer holding all items in Brewer.
- *
- * This event is not {@link Cancelable}.
- *
- * This event does not have a result. {@link HasResult}
- *
- * This event is fired on the {@link MinecraftForge#EVENT_BUS}.
- **/ -@Deprecated // remove in 1.9 -public class PotionBrewedEvent extends PotionBrewEvent -{ - /** - * The brewing stacks in the brewing stand. Each index has the possibility to be null, so make sure you check. - * Changing this array to another one has no effect. - */ - @Deprecated - public ItemStack[] brewingStacks; - public PotionBrewedEvent(ItemStack[] brewingStacks) - { - super(brewingStacks); - this.brewingStacks = brewingStacks; - } -} diff --git a/src/main/java/net/minecraftforge/event/entity/EntityEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityEvent.java index 76c0415818..462de61a3d 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityEvent.java @@ -14,13 +14,18 @@ import net.minecraft.entity.Entity; **/ public class EntityEvent extends Event { - public final Entity entity; + private final Entity entity; public EntityEvent(Entity entity) { this.entity = entity; } - + + public Entity getEntity() + { + return entity; + } + /** * EntityConstructing is fired when an Entity is being created.
* This event is fired within the constructor of the Entity.
@@ -54,11 +59,21 @@ public class EntityEvent extends Event **/ public static class CanUpdate extends EntityEvent { - public boolean canUpdate = false; + private boolean canUpdate = false; public CanUpdate(Entity entity) { super(entity); } + + public boolean getCanUpdate() + { + return canUpdate; + } + + public void setCanUpdate(boolean canUpdate) + { + this.canUpdate = canUpdate; + } } /** @@ -74,18 +89,27 @@ public class EntityEvent extends Event **/ public static class EnteringChunk extends EntityEvent { - public int newChunkX; - public int newChunkZ; - public int oldChunkX; - public int oldChunkZ; + private int newChunkX; + private int newChunkZ; + private int oldChunkX; + private int oldChunkZ; public EnteringChunk(Entity entity, int newChunkX, int newChunkZ, int oldChunkX, int oldChunkZ) { super(entity); - this.newChunkX = newChunkX; - this.newChunkZ = newChunkZ; - this.oldChunkX = oldChunkX; - this.oldChunkZ = oldChunkZ; + this.setNewChunkX(newChunkX); + this.setNewChunkZ(newChunkZ); + this.setOldChunkX(oldChunkX); + this.setOldChunkZ(oldChunkZ); } + + public int getNewChunkX() { return newChunkX; } + public void setNewChunkX(int newChunkX) { this.newChunkX = newChunkX; } + public int getNewChunkZ() { return newChunkZ; } + public void setNewChunkZ(int newChunkZ) { this.newChunkZ = newChunkZ; } + public int getOldChunkX() { return oldChunkX; } + public void setOldChunkX(int oldChunkX) { this.oldChunkX = oldChunkX; } + public int getOldChunkZ() { return oldChunkZ; } + public void setOldChunkZ(int oldChunkZ) { this.oldChunkZ = oldChunkZ; } } } diff --git a/src/main/java/net/minecraftforge/event/entity/EntityJoinWorldEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityJoinWorldEvent.java index 9882373b17..a7ac552448 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityJoinWorldEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityJoinWorldEvent.java @@ -22,11 +22,16 @@ import net.minecraft.world.World; public class EntityJoinWorldEvent extends EntityEvent { - public final World world; + private final World world; public EntityJoinWorldEvent(Entity entity, World world) { super(entity); this.world = world; } + + public World getWorld() + { + return world; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/EntityMountEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityMountEvent.java index c849e4792c..921917eb69 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityMountEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityMountEvent.java @@ -23,9 +23,9 @@ import net.minecraftforge.fml.common.eventhandler.Event.HasResult; public class EntityMountEvent extends EntityEvent { - public final Entity entityMounting; - public final Entity entityBeingMounted; - public final World worldObj; + private final Entity entityMounting; + private final Entity entityBeingMounted; + private final World worldObj; private final boolean isMounting; @@ -48,4 +48,18 @@ public class EntityMountEvent extends EntityEvent return !isMounting; } + public Entity getEntityMounting() + { + return entityMounting; + } + + public Entity getEntityBeingMounted() + { + return entityBeingMounted; + } + + public World getWorldObj() + { + return worldObj; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/EntityStruckByLightningEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityStruckByLightningEvent.java index b9fdd3f02a..24e3cc2f17 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityStruckByLightningEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityStruckByLightningEvent.java @@ -21,11 +21,16 @@ import net.minecraft.entity.effect.EntityLightningBolt; @Cancelable public class EntityStruckByLightningEvent extends EntityEvent { - public final EntityLightningBolt lightning; + private final EntityLightningBolt lightning; public EntityStruckByLightningEvent(Entity entity, EntityLightningBolt lightning) { super(entity); this.lightning = lightning; } + + public EntityLightningBolt getLightning() + { + return lightning; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/EntityTravelToDimensionEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityTravelToDimensionEvent.java index d62c2765bd..ebfc21a153 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityTravelToDimensionEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityTravelToDimensionEvent.java @@ -19,11 +19,16 @@ import net.minecraftforge.fml.common.eventhandler.Event.HasResult; @Cancelable public class EntityTravelToDimensionEvent extends EntityEvent { - public final int dimension; + private final int dimension; public EntityTravelToDimensionEvent(Entity entity, int dimension) { super(entity); this.dimension = dimension; } + + public int getDimension() + { + return dimension; + } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/event/entity/item/ItemEvent.java b/src/main/java/net/minecraftforge/event/entity/item/ItemEvent.java index e9667a2e98..c41a247187 100644 --- a/src/main/java/net/minecraftforge/event/entity/item/ItemEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/item/ItemEvent.java @@ -11,10 +11,7 @@ import net.minecraftforge.event.entity.EntityEvent; */ public class ItemEvent extends EntityEvent { - /** - * The relevant EntityItem for this event, already cast for you. - */ - public final EntityItem entityItem; + private final EntityItem entityItem; /** * Creates a new event for an EntityItem. @@ -26,4 +23,12 @@ public class ItemEvent extends EntityEvent super(itemEntity); this.entityItem = itemEntity; } + + /** + * The relevant EntityItem for this event, already cast for you. + */ + public EntityItem getEntityItem() + { + return entityItem; + } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/event/entity/item/ItemExpireEvent.java b/src/main/java/net/minecraftforge/event/entity/item/ItemExpireEvent.java index 01acaf4d46..8d4de1e9e9 100644 --- a/src/main/java/net/minecraftforge/event/entity/item/ItemExpireEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/item/ItemExpireEvent.java @@ -13,7 +13,7 @@ import net.minecraft.entity.item.EntityItem; public class ItemExpireEvent extends ItemEvent { - public int extraLife; + private int extraLife; /** * Creates a new event for an expiring EntityItem. @@ -24,6 +24,16 @@ public class ItemExpireEvent extends ItemEvent public ItemExpireEvent(EntityItem entityItem, int extraLife) { super(entityItem); + this.setExtraLife(extraLife); + } + + public int getExtraLife() + { + return extraLife; + } + + public void setExtraLife(int extraLife) + { this.extraLife = extraLife; } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/event/entity/item/ItemTossEvent.java b/src/main/java/net/minecraftforge/event/entity/item/ItemTossEvent.java index c167ce8d0b..090a7140e4 100644 --- a/src/main/java/net/minecraftforge/event/entity/item/ItemTossEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/item/ItemTossEvent.java @@ -14,10 +14,7 @@ import net.minecraft.entity.player.EntityPlayer; public class ItemTossEvent extends ItemEvent { - /** - * The player tossing the item. - */ - public final EntityPlayer player; + private final EntityPlayer player; /** * Creates a new event for EntityItems tossed by a player. @@ -30,4 +27,12 @@ public class ItemTossEvent extends ItemEvent super(entityItem); this.player = player; } + + /** + * The player tossing the item. + */ + public EntityPlayer getPlayer() + { + return player; + } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/event/entity/living/EnderTeleportEvent.java b/src/main/java/net/minecraftforge/event/entity/living/EnderTeleportEvent.java index d03b071a44..bc9190f4c1 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/EnderTeleportEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/EnderTeleportEvent.java @@ -12,17 +12,26 @@ import net.minecraft.entity.EntityLivingBase; public class EnderTeleportEvent extends LivingEvent { - public double targetX; - public double targetY; - public double targetZ; - public float attackDamage; + private double targetX; + private double targetY; + private double targetZ; + private float attackDamage; public EnderTeleportEvent(EntityLivingBase entity, double targetX, double targetY, double targetZ, float attackDamage) { super(entity); - this.targetX = targetX; - this.targetY = targetY; - this.targetZ = targetZ; - this.attackDamage = attackDamage; + this.setTargetX(targetX); + this.setTargetY(targetY); + this.setTargetZ(targetZ); + this.setAttackDamage(attackDamage); } + + public double getTargetX() { return targetX; } + public void setTargetX(double targetX) { this.targetX = targetX; } + public double getTargetY() { return targetY; } + public void setTargetY(double targetY) { this.targetY = targetY; } + public double getTargetZ() { return targetZ; } + public void setTargetZ(double targetZ) { this.targetZ = targetZ; } + public float getAttackDamage() { return attackDamage; } + public void setAttackDamage(float attackDamage) { this.attackDamage = attackDamage; } } diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingDeathEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingDeathEvent.java index 307434232a..3287374798 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingDeathEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingDeathEvent.java @@ -25,10 +25,15 @@ import net.minecraft.entity.EntityLivingBase; @Cancelable public class LivingDeathEvent extends LivingEvent { - public final DamageSource source; + private final DamageSource source; public LivingDeathEvent(EntityLivingBase entity, DamageSource source) { super(entity); this.source = source; } + + public DamageSource getSource() + { + return source; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingDropsEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingDropsEvent.java index 787e51192b..4f2a82a29b 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingDropsEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingDropsEvent.java @@ -29,10 +29,10 @@ import net.minecraft.entity.EntityLivingBase; @Cancelable public class LivingDropsEvent extends LivingEvent { - public final DamageSource source; - public final List drops; - public final int lootingLevel; - public final boolean recentlyHit; + private final DamageSource source; + private final List drops; + private final int lootingLevel; + private final boolean recentlyHit; public LivingDropsEvent(EntityLivingBase entity, DamageSource source, List drops, int lootingLevel, boolean recentlyHit) { @@ -42,4 +42,24 @@ public class LivingDropsEvent extends LivingEvent this.lootingLevel = lootingLevel; this.recentlyHit = recentlyHit; } + + public DamageSource getSource() + { + return source; + } + + public List getDrops() + { + return drops; + } + + public int getLootingLevel() + { + return lootingLevel; + } + + public boolean isRecentlyHit() + { + return recentlyHit; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingEntityUseItemEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingEntityUseItemEvent.java index 95f01ee29e..6047e79d7b 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingEntityUseItemEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingEntityUseItemEvent.java @@ -6,13 +6,28 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable; public abstract class LivingEntityUseItemEvent extends LivingEvent { - public final ItemStack item; - public int duration; + private final ItemStack item; + private int duration; private LivingEntityUseItemEvent(EntityLivingBase entity, ItemStack item, int duration) { super(entity); this.item = item; + this.setDuration(duration); + } + + public ItemStack getItem() + { + return item; + } + + public int getDuration() + { + return duration; + } + + public void setDuration(int duration) + { this.duration = duration; } @@ -84,10 +99,20 @@ public abstract class LivingEntityUseItemEvent extends LivingEvent */ public static class Finish extends LivingEntityUseItemEvent { - public ItemStack result; + private ItemStack result; public Finish(EntityLivingBase entity, ItemStack item, int duration, ItemStack result) { super(entity, item, duration); + this.setResultStack(result); + } + + public ItemStack getResultStack() + { + return result; + } + + public void setResultStack(ItemStack result) + { this.result = result; } } diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingEvent.java index b0002ce22e..0f899e6392 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingEvent.java @@ -13,13 +13,18 @@ import net.minecraftforge.event.entity.EntityEvent; **/ public class LivingEvent extends EntityEvent { - public final EntityLivingBase entityLiving; + private final EntityLivingBase entityLiving; public LivingEvent(EntityLivingBase entity) { super(entity); entityLiving = entity; } - + + public EntityLivingBase getEntityLiving() + { + return entityLiving; + } + /** * LivingUpdateEvent is fired when an Entity is updated.
* This event is fired whenever an Entity is updated in diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingExperienceDropEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingExperienceDropEvent.java index 8c96c0cbc5..a65cd6fdd2 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingExperienceDropEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingExperienceDropEvent.java @@ -12,10 +12,10 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable; @Cancelable public class LivingExperienceDropEvent extends LivingEvent { - final EntityPlayer attackingPlayer; - final int originalExperiencePoints; + private final EntityPlayer attackingPlayer; + private final int originalExperiencePoints; - int droppedExperiencePoints; + private int droppedExperiencePoints; public LivingExperienceDropEvent(EntityLivingBase entity, EntityPlayer attackingPlayer, int originalExperience) { diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingFallEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingFallEvent.java index 322325292b..0cc1d0e826 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingFallEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingFallEvent.java @@ -22,12 +22,17 @@ import net.minecraft.entity.EntityLivingBase; @Cancelable public class LivingFallEvent extends LivingEvent { - public float distance; - public float damageMultiplier; + private float distance; + private float damageMultiplier; public LivingFallEvent(EntityLivingBase entity, float distance, float damageMultiplier) { super(entity); - this.distance = distance; - this.damageMultiplier = damageMultiplier; + this.setDistance(distance); + this.setDamageMultiplier(damageMultiplier); } + + public float getDistance() { return distance; } + public void setDistance(float distance) { this.distance = distance; } + public float getDamageMultiplier() { return damageMultiplier; } + public void setDamageMultiplier(float damageMultiplier) { this.damageMultiplier = damageMultiplier; } } diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingHealEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingHealEvent.java index 516f708b06..04be4cc15a 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingHealEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingHealEvent.java @@ -21,10 +21,20 @@ import net.minecraft.entity.EntityLivingBase; @Cancelable public class LivingHealEvent extends LivingEvent { - public float amount; + private float amount; public LivingHealEvent(EntityLivingBase entity, float amount) { super(entity); + this.setAmount(amount); + } + + public float getAmount() + { + return amount; + } + + public void setAmount(float amount) + { this.amount = amount; } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingPackSizeEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingPackSizeEvent.java index cd196a87ce..b4219a6dfd 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingPackSizeEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingPackSizeEvent.java @@ -6,18 +6,28 @@ import net.minecraft.entity.EntityLiving; @HasResult public class LivingPackSizeEvent extends LivingEvent { - /** - * This event is fired when the spawning system determines the - * maximum amount of the selected entity that can spawn at the same - * time. - * - * If you set the result to 'ALLOW', it means that you want to return - * the value of maxPackSize as the maximum pack size for current entity. - */ - public int maxPackSize; + private int maxPackSize; public LivingPackSizeEvent(EntityLiving entity) { super(entity); } + + /** + * This event is fired when the spawning system determines the + * maximum amount of the selected entity that can spawn at the same + * time. + * + * If you set the result to 'ALLOW', it means that you want to return + * the value of maxPackSize as the maximum pack size for current entity. + */ + public int getMaxPackSize() + { + return maxPackSize; + } + + public void setMaxPackSize(int maxPackSize) + { + this.maxPackSize = maxPackSize; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingSetAttackTargetEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingSetAttackTargetEvent.java index ec73c406e3..ef1a29458e 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingSetAttackTargetEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingSetAttackTargetEvent.java @@ -21,11 +21,15 @@ import net.minecraft.entity.EntityLivingBase; public class LivingSetAttackTargetEvent extends LivingEvent { - public final EntityLivingBase target; + private final EntityLivingBase target; public LivingSetAttackTargetEvent(EntityLivingBase entity, EntityLivingBase target) { super(entity); this.target = target; } + public EntityLivingBase getTarget() + { + return target; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingSpawnEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingSpawnEvent.java index 2979e4341b..6a538b21b0 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingSpawnEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingSpawnEvent.java @@ -19,10 +19,10 @@ import net.minecraft.world.World; **/ public class LivingSpawnEvent extends LivingEvent { - public final World world; - public final float x; - public final float y; - public final float z; + private final World world; + private final float x; + private final float y; + private final float z; public LivingSpawnEvent(EntityLiving entity, World world, float x, float y, float z) { @@ -33,6 +33,10 @@ public class LivingSpawnEvent extends LivingEvent this.z = z; } + public World getWorld() { return world; } + public float getX() { return x; } + public float getY() { return y; } + public float getZ() { return z; } /** * Fires before mob spawn events. * diff --git a/src/main/java/net/minecraftforge/event/entity/living/ZombieEvent.java b/src/main/java/net/minecraftforge/event/entity/living/ZombieEvent.java index 07002ddd25..f5d2ec9b76 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/ZombieEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/ZombieEvent.java @@ -1,6 +1,5 @@ package net.minecraftforge.event.entity.living; -import net.minecraftforge.fml.common.eventhandler.Event.HasResult; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.world.World; @@ -22,7 +21,7 @@ public class ZombieEvent extends EntityEvent { public EntityZombie getSummoner() { - return (EntityZombie) entity; + return (EntityZombie) getEntity(); } /** @@ -50,17 +49,14 @@ public class ZombieEvent extends EntityEvent { **/ @HasResult public static class SummonAidEvent extends ZombieEvent { - /** - * Populate this field to have a custom zombie instead of a normal zombie summoned - */ - public EntityZombie customSummonedAid; + private EntityZombie customSummonedAid; - public final World world; - public final int x; - public final int y; - public final int z; - public final EntityLivingBase attacker; - public final double summonChance; + private final World world; + private final int x; + private final int y; + private final int z; + private final EntityLivingBase attacker; + private final double summonChance; public SummonAidEvent(EntityZombie entity, World world, int x, int y, int z, EntityLivingBase attacker, double summonChance) { @@ -72,6 +68,17 @@ public class ZombieEvent extends EntityEvent { this.attacker = attacker; this.summonChance = summonChance; } - + + /** + * Populate this field to have a custom zombie instead of a normal zombie summoned + */ + public EntityZombie getCustomSummonedAid() { return customSummonedAid; } + public void setCustomSummonedAid(EntityZombie customSummonedAid) { this.customSummonedAid = customSummonedAid; } + public World getWorld() { return world; } + public int getX() { return x; } + public int getY() { return y; } + public int getZ() { return z; } + public EntityLivingBase getAttacker() { return attacker; } + public double getSummonChance() { return summonChance; } } } diff --git a/src/main/java/net/minecraftforge/event/entity/minecart/MinecartCollisionEvent.java b/src/main/java/net/minecraftforge/event/entity/minecart/MinecartCollisionEvent.java index 76e7cbfb58..94664fe117 100644 --- a/src/main/java/net/minecraftforge/event/entity/minecart/MinecartCollisionEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/minecart/MinecartCollisionEvent.java @@ -18,11 +18,16 @@ import net.minecraft.entity.item.EntityMinecart; **/ public class MinecartCollisionEvent extends MinecartEvent { - public final Entity collider; + private final Entity collider; public MinecartCollisionEvent(EntityMinecart minecart, Entity collider) { super(minecart); this.collider = collider; } + + public Entity getCollider() + { + return collider; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/minecart/MinecartEvent.java b/src/main/java/net/minecraftforge/event/entity/minecart/MinecartEvent.java index 7d445fcde5..0479a067cb 100644 --- a/src/main/java/net/minecraftforge/event/entity/minecart/MinecartEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/minecart/MinecartEvent.java @@ -14,11 +14,16 @@ import net.minecraftforge.event.entity.EntityEvent; **/ public class MinecartEvent extends EntityEvent { - public final EntityMinecart minecart; + private final EntityMinecart minecart; public MinecartEvent(EntityMinecart minecart) { super(minecart); this.minecart = minecart; } + + public EntityMinecart getMinecart() + { + return minecart; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/minecart/MinecartUpdateEvent.java b/src/main/java/net/minecraftforge/event/entity/minecart/MinecartUpdateEvent.java index 7b458958c8..6ba3f4bdf2 100644 --- a/src/main/java/net/minecraftforge/event/entity/minecart/MinecartUpdateEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/minecart/MinecartUpdateEvent.java @@ -18,11 +18,16 @@ import net.minecraft.util.math.BlockPos; **/ public class MinecartUpdateEvent extends MinecartEvent { - public final BlockPos pos; + private final BlockPos pos; public MinecartUpdateEvent(EntityMinecart minecart, BlockPos pos) { super(minecart); this.pos = pos; } + + public BlockPos getPos() + { + return pos; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/AchievementEvent.java b/src/main/java/net/minecraftforge/event/entity/player/AchievementEvent.java index 5a8e5c15d0..7fee0f4a42 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/AchievementEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/AchievementEvent.java @@ -10,10 +10,15 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable; @Cancelable public class AchievementEvent extends PlayerEvent { - public final Achievement achievement; + private final Achievement achievement; public AchievementEvent(EntityPlayer player, Achievement achievement) { super(player); this.achievement = achievement; } + + public Achievement getAchievement() + { + return achievement; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/AnvilRepairEvent.java b/src/main/java/net/minecraftforge/event/entity/player/AnvilRepairEvent.java index c158a5b69d..360f2e5bc5 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/AnvilRepairEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/AnvilRepairEvent.java @@ -5,18 +5,11 @@ import net.minecraft.item.ItemStack; public class AnvilRepairEvent extends PlayerEvent { - /** - * Fired when the player removes a "repaired" item from the Anvil's Output slot. - * - * breakChance specifies as a percentage the chance that the anvil will be "damaged" when used. - * - * ItemStacks are the inputs/output from the anvil. They cannot be edited. - */ - - public final ItemStack left; // The left side of the input - public final ItemStack right; // The right side of the input - public final ItemStack output; // Set this to set the output stack - public float breakChance; // Anvil's chance to break (reduced by 1 durability) when this is complete. Default is 12% (0.12f) + + private final ItemStack left; // The left side of the input + private final ItemStack right; // The right side of the input + private final ItemStack output; // Set this to set the output stack + private float breakChance; // Anvil's chance to break (reduced by 1 durability) when this is complete. Default is 12% (0.12f) public AnvilRepairEvent(EntityPlayer player, ItemStack output, ItemStack left, ItemStack right) { @@ -24,6 +17,19 @@ public class AnvilRepairEvent extends PlayerEvent this.output = output; this.left = left; this.right = right; - this.breakChance = 0.12f; + this.setBreakChance(0.12f); } + + /** + * Fired when the player removes a "repaired" item from the Anvil's Output slot. + * + * breakChance specifies as a percentage the chance that the anvil will be "damaged" when used. + * + * ItemStacks are the inputs/output from the anvil. They cannot be edited. + */ + public ItemStack getLeft() { return left; } + public ItemStack getRight() { return right; } + public ItemStack getOutput() { return output; } + public float getBreakChance() { return breakChance; } + public void setBreakChance(float breakChance) { this.breakChance = breakChance; } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/AttackEntityEvent.java b/src/main/java/net/minecraftforge/event/entity/player/AttackEntityEvent.java index f053ed9b41..f81f10cd7d 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/AttackEntityEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/AttackEntityEvent.java @@ -21,10 +21,15 @@ import net.minecraft.entity.player.EntityPlayer; @Cancelable public class AttackEntityEvent extends PlayerEvent { - public final Entity target; + private final Entity target; public AttackEntityEvent(EntityPlayer player, Entity target) { super(player); this.target = target; } + + public Entity getTarget() + { + return target; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java b/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java index d95e68fd15..bdfe08ef4a 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java @@ -7,23 +7,23 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +/** + * This event is called when a player attempts to use Bonemeal on a block. + * It can be canceled to completely prevent any further processing. + * + * You can also set the result to ALLOW to mark the event as processed + * and use up a bonemeal from the stack but do no further processing. + * + * setResult(ALLOW) is the same as the old setHandled() + */ @Cancelable @Event.HasResult public class BonemealEvent extends PlayerEvent { - /** - * This event is called when a player attempts to use Bonemeal on a block. - * It can be canceled to completely prevent any further processing. - * - * You can also set the result to ALLOW to mark the event as processed - * and use up a bonemeal from the stack but do no further processing. - * - * setResult(ALLOW) is the same as the old setHandled() - */ - public final World world; - public final BlockPos pos; - public final IBlockState block; + private final World world; + private final BlockPos pos; + private final IBlockState block; public BonemealEvent(EntityPlayer player, World world, BlockPos pos, IBlockState block) { @@ -32,4 +32,19 @@ public class BonemealEvent extends PlayerEvent this.pos = pos; this.block = block; } + + public World getWorld() + { + return world; + } + + public BlockPos getPos() + { + return pos; + } + + public IBlockState getBlock() + { + return block; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/EntityItemPickupEvent.java b/src/main/java/net/minecraftforge/event/entity/player/EntityItemPickupEvent.java index b22f7d56ca..0e9ed47346 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/EntityItemPickupEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/EntityItemPickupEvent.java @@ -5,25 +5,30 @@ import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +/** + * This event is called when a player collides with a EntityItem on the ground. + * The event can be canceled, and no further processing will be done. + * + * You can set the result of this event to ALLOW which will trigger the + * processing of achievements, FML's event, play the sound, and kill the + * entity if all the items are picked up. + * + * setResult(ALLOW) is the same as the old setHandled() + */ @Cancelable @Event.HasResult public class EntityItemPickupEvent extends PlayerEvent { - /** - * This event is called when a player collides with a EntityItem on the ground. - * The event can be canceled, and no further processing will be done. - * - * You can set the result of this event to ALLOW which will trigger the - * processing of achievements, FML's event, play the sound, and kill the - * entity if all the items are picked up. - * - * setResult(ALLOW) is the same as the old setHandled() - */ - public final EntityItem item; + private final EntityItem item; public EntityItemPickupEvent(EntityPlayer player, EntityItem item) { super(player); this.item = item; } + + public EntityItem getItem() + { + return item; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java b/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java index e452d5320e..77819d7ba2 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java @@ -7,19 +7,19 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; +/** + * This event is fired when a player attempts to use a Empty bucket, it + * can be canceled to completely prevent any further processing. + * + * If you set the result to 'ALLOW', it means that you have processed + * the event and wants the basic functionality of adding the new + * ItemStack to your inventory and reducing the stack size to process. + * setResult(ALLOW) is the same as the old setHandled(); + */ @Cancelable @Event.HasResult public class FillBucketEvent extends PlayerEvent { - /** - * This event is fired when a player attempts to use a Empty bucket, it - * can be canceled to completely prevent any further processing. - * - * If you set the result to 'ALLOW', it means that you have processed - * the event and wants the basic functionality of adding the new - * ItemStack to your inventory and reducing the stack size to process. - * setResult(ALLOW) is the same as the old setHandled(); - */ private final ItemStack current; private final World world; diff --git a/src/main/java/net/minecraftforge/event/entity/player/ItemTooltipEvent.java b/src/main/java/net/minecraftforge/event/entity/player/ItemTooltipEvent.java index 7194abad51..f9fd61ca27 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/ItemTooltipEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/ItemTooltipEvent.java @@ -6,18 +6,9 @@ import net.minecraft.item.ItemStack; public class ItemTooltipEvent extends PlayerEvent { - /** - * Whether the advanced information on item tooltips is being shown, toggled by F3+H. - */ - public final boolean showAdvancedItemTooltips; - /** - * The {@link ItemStack} with the tooltip. - */ - public final ItemStack itemStack; - /** - * The {@link ItemStack} tooltip. - */ - public final List toolTip; + private final boolean showAdvancedItemTooltips; + private final ItemStack itemStack; + private final List toolTip; /** * This event is fired in {@link ItemStack#getTooltip(EntityPlayer, boolean)}, which in turn is called from it's respective GUIContainer. @@ -29,4 +20,28 @@ public class ItemTooltipEvent extends PlayerEvent this.toolTip = toolTip; this.showAdvancedItemTooltips = showAdvancedItemTooltips; } + + /** + * Whether the advanced information on item tooltips is being shown, toggled by F3+H. + */ + public boolean isShowAdvancedItemTooltips() + { + return showAdvancedItemTooltips; + } + + /** + * The {@link ItemStack} with the tooltip. + */ + public ItemStack getItemStack() + { + return itemStack; + } + + /** + * The {@link ItemStack} tooltip. + */ + public List getToolTip() + { + return toolTip; + } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerDropsEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerDropsEvent.java index d3f5246806..9fb1a4a590 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerDropsEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerDropsEvent.java @@ -18,7 +18,7 @@ import net.minecraftforge.event.entity.living.LivingDropsEvent; @Cancelable public class PlayerDropsEvent extends LivingDropsEvent { - public final EntityPlayer entityPlayer; + private final EntityPlayer entityPlayer; /** * Creates a new event containing all the items that will drop into the @@ -36,4 +36,9 @@ public class PlayerDropsEvent extends LivingDropsEvent this.entityPlayer = entity; } + + public EntityPlayer getEntityPlayer() + { + return entityPlayer; + } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java index f460b1d165..864242dd9c 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java @@ -18,13 +18,18 @@ import net.minecraftforge.event.entity.living.LivingEvent; **/ public class PlayerEvent extends LivingEvent { - public final EntityPlayer entityPlayer; + private final EntityPlayer entityPlayer; public PlayerEvent(EntityPlayer player) { super(player); entityPlayer = player; } + public EntityPlayer getEntityPlayer() + { + return entityPlayer; + } + /** * HarvestCheck is fired when a player attempts to harvest a block.
* This event is fired whenever a player attempts to harvest a block in @@ -80,19 +85,25 @@ public class PlayerEvent extends LivingEvent @Cancelable public static class BreakSpeed extends PlayerEvent { - public final IBlockState state; - public final float originalSpeed; - public float newSpeed = 0.0f; - public final BlockPos pos; // Y position of -1 notes unknown location + private final IBlockState state; + private final float originalSpeed; + private float newSpeed = 0.0f; + private final BlockPos pos; // Y position of -1 notes unknown location public BreakSpeed(EntityPlayer player, IBlockState state, float original, BlockPos pos) { super(player); this.state = state; this.originalSpeed = original; - this.newSpeed = original; + this.setNewSpeed(original); this.pos = pos; } + + public IBlockState getState() { return state; } + public float getOriginalSpeed() { return originalSpeed; } + public float getNewSpeed() { return newSpeed; } + public void setNewSpeed(float newSpeed) { this.newSpeed = newSpeed; } + public BlockPos getPos() { return pos; } } /** @@ -113,13 +124,28 @@ public class PlayerEvent extends LivingEvent **/ public static class NameFormat extends PlayerEvent { - public final String username; - public String displayname; + private final String username; + private String displayname; public NameFormat(EntityPlayer player, String username) { super(player); this.username = username; - this.displayname = username; + this.setDisplayname(username); + } + + public String getUsername() + { + return username; + } + + public String getDisplayname() + { + return displayname; + } + + public void setDisplayname(String displayname) + { + this.displayname = displayname; } } @@ -129,15 +155,8 @@ public class PlayerEvent extends LivingEvent */ public static class Clone extends PlayerEvent { - /** - * The old EntityPlayer that this new entity is a clone of. - */ - public final EntityPlayer original; - /** - * True if this event was fired because the player died. - * False if it was fired because the entity switched dimensions. - */ - public final boolean wasDeath; + private final EntityPlayer original; + private final boolean wasDeath; public Clone(EntityPlayer _new, EntityPlayer oldPlayer, boolean wasDeath) { @@ -145,6 +164,23 @@ public class PlayerEvent extends LivingEvent this.original = oldPlayer; this.wasDeath = wasDeath; } + + /** + * The old EntityPlayer that this new entity is a clone of. + */ + public EntityPlayer getOriginal() + { + return original; + } + + /** + * True if this event was fired because the player died. + * False if it was fired because the entity switched dimensions. + */ + public boolean isWasDeath() + { + return wasDeath; + } } /** @@ -153,10 +189,7 @@ public class PlayerEvent extends LivingEvent */ public static class StartTracking extends PlayerEvent { - /** - * The Entity now being tracked. - */ - public final Entity target; + private final Entity target; public StartTracking(EntityPlayer player, Entity target) { @@ -164,6 +197,13 @@ public class PlayerEvent extends LivingEvent this.target = target; } + /** + * The Entity now being tracked. + */ + public Entity getTarget() + { + return target; + } } /** @@ -172,10 +212,7 @@ public class PlayerEvent extends LivingEvent */ public static class StopTracking extends PlayerEvent { - /** - * The Entity no longer being tracked. - */ - public final Entity target; + private final Entity target; public StopTracking(EntityPlayer player, Entity target) { @@ -183,6 +220,13 @@ public class PlayerEvent extends LivingEvent this.target = target; } + /** + * The Entity no longer being tracked. + */ + public Entity getTarget() + { + return target; + } } /** @@ -192,16 +236,8 @@ public class PlayerEvent extends LivingEvent * containing additional mod related player data. */ public static class LoadFromFile extends PlayerEvent { - /** - * The directory where player data is being stored. Use this - * to locate your mod additional file. - */ - public final File playerDirectory; - /** - * The UUID is the standard for player related file storage. - * It is broken out here for convenience for quick file generation. - */ - public final String playerUUID; + private final File playerDirectory; + private final String playerUUID; public LoadFromFile(EntityPlayer player, File originDirectory, String playerUUID) { @@ -218,7 +254,25 @@ public class PlayerEvent extends LivingEvent public File getPlayerFile(String suffix) { if ("dat".equals(suffix)) throw new IllegalArgumentException("The suffix 'dat' is reserved"); - return new File(this.playerDirectory, this.playerUUID+"."+suffix); + return new File(this.getPlayerDirectory(), this.getPlayerUUID() +"."+suffix); + } + + /** + * The directory where player data is being stored. Use this + * to locate your mod additional file. + */ + public File getPlayerDirectory() + { + return playerDirectory; + } + + /** + * The UUID is the standard for player related file storage. + * It is broken out here for convenience for quick file generation. + */ + public String getPlayerUUID() + { + return playerUUID; } } /** @@ -235,16 +289,8 @@ public class PlayerEvent extends LivingEvent * corrupt the world state. */ public static class SaveToFile extends PlayerEvent { - /** - * The directory where player data is being stored. Use this - * to locate your mod additional file. - */ - public final File playerDirectory; - /** - * The UUID is the standard for player related file storage. - * It is broken out here for convenience for quick file generation. - */ - public final String playerUUID; + private final File playerDirectory; + private final String playerUUID; public SaveToFile(EntityPlayer player, File originDirectory, String playerUUID) { @@ -261,7 +307,25 @@ public class PlayerEvent extends LivingEvent public File getPlayerFile(String suffix) { if ("dat".equals(suffix)) throw new IllegalArgumentException("The suffix 'dat' is reserved"); - return new File(this.playerDirectory, this.playerUUID+"."+suffix); + return new File(this.getPlayerDirectory(), this.getPlayerUUID() +"."+suffix); + } + + /** + * The directory where player data is being stored. Use this + * to locate your mod additional file. + */ + public File getPlayerDirectory() + { + return playerDirectory; + } + + /** + * The UUID is the standard for player related file storage. + * It is broken out here for convenience for quick file generation. + */ + public String getPlayerUUID() + { + return playerUUID; } } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java index be81de27df..1f48512897 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java @@ -42,14 +42,14 @@ public class PlayerInteractEvent extends PlayerEvent LEFT_CLICK_BLOCK } - public final Action action; - public final World world; - public final BlockPos pos; - public final EnumFacing face; // Can be null if unknown - public final Vec3d localPos; // Can be null if unknown + private final Action action; + private final World world; + private final BlockPos pos; + private final EnumFacing face; // Can be null if unknown + private final Vec3d localPos; // Can be null if unknown - public Result useBlock = DEFAULT; - public Result useItem = DEFAULT; + private Result useBlock = DEFAULT; + private Result useItem = DEFAULT; @Deprecated public PlayerInteractEvent(EntityPlayer player, Action action, BlockPos pos, EnumFacing face, World world) @@ -63,7 +63,7 @@ public class PlayerInteractEvent extends PlayerEvent this.action = action; this.pos = pos; this.face = face; - if (face == null) useBlock = DENY; + if (face == null) setUseBlock(DENY); this.world = world; this.localPos = localPos; } @@ -72,7 +72,17 @@ public class PlayerInteractEvent extends PlayerEvent public void setCanceled(boolean cancel) { super.setCanceled(cancel); - useBlock = (cancel ? DENY : useBlock == DENY ? DEFAULT : useBlock); - useItem = (cancel ? DENY : useItem == DENY ? DEFAULT : useItem); + setUseBlock((cancel ? DENY : getUseBlock() == DENY ? DEFAULT : getUseBlock())); + setUseItem((cancel ? DENY : getUseItem() == DENY ? DEFAULT : getUseItem())); } + + public Action getAction() { return action; } + public World getWorld() { return world; } + public BlockPos getPos() { return pos; } + public EnumFacing getFace() { return face; } + public Vec3d getLocalPos() { return localPos; } + public Result getUseBlock() { return useBlock; } + public void setUseBlock(Result useBlock) { this.useBlock = useBlock; } + public Result getUseItem() { return useItem; } + public void setUseItem(Result useItem) { this.useItem = useItem; } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerOpenContainerEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerOpenContainerEvent.java index 52358ace7c..0f39360d3b 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerOpenContainerEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerOpenContainerEvent.java @@ -4,26 +4,30 @@ import net.minecraftforge.fml.common.eventhandler.Event.HasResult; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; +/** + * This event is fired when a player attempts to view a container during + * player tick. + * + * setResult ALLOW to allow the container to stay open + * setResult DENY to force close the container (denying access) + * + * DEFAULT is vanilla behavior + * + */ @HasResult public class PlayerOpenContainerEvent extends PlayerEvent { - public final boolean canInteractWith; - - /** - * This event is fired when a player attempts to view a container during - * player tick. - * - * setResult ALLOW to allow the container to stay open - * setResult DENY to force close the container (denying access) - * - * DEFAULT is vanilla behavior - * - */ + private final boolean canInteractWith; public PlayerOpenContainerEvent(EntityPlayer player, Container openContainer) { super(player); this.canInteractWith = openContainer.canInteractWith(player); } + + public boolean isCanInteractWith() + { + return canInteractWith; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerPickupXpEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerPickupXpEvent.java index fedb6c038e..44755c4cba 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerPickupXpEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerPickupXpEvent.java @@ -11,11 +11,16 @@ import net.minecraft.entity.player.EntityPlayer; @Cancelable public class PlayerPickupXpEvent extends PlayerEvent { - public final EntityXPOrb orb; + private final EntityXPOrb orb; public PlayerPickupXpEvent(EntityPlayer player, EntityXPOrb orb) { super(player); this.orb = orb; } + + public EntityXPOrb getOrb() + { + return orb; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerSetSpawnEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerSetSpawnEvent.java index b2e047eac7..bca18deca6 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerSetSpawnEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerSetSpawnEvent.java @@ -7,12 +7,8 @@ import net.minecraft.util.math.BlockPos; @Cancelable public class PlayerSetSpawnEvent extends PlayerEvent { - /** - * This event is called before a player's spawn point is changed. - * The event can be canceled, and no further processing will be done. - */ - public final boolean forced; - public final BlockPos newSpawn; + private final boolean forced; + private final BlockPos newSpawn; public PlayerSetSpawnEvent(EntityPlayer player, BlockPos newSpawn, boolean forced) { super(player); @@ -20,4 +16,17 @@ public class PlayerSetSpawnEvent extends PlayerEvent this.forced = forced; } + /** + * This event is called before a player's spawn point is changed. + * The event can be canceled, and no further processing will be done. + */ + public boolean isForced() + { + return forced; + } + + public BlockPos getNewSpawn() + { + return newSpawn; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerSleepInBedEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerSleepInBedEvent.java index d41d5abeaf..29aa31a4ad 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerSleepInBedEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerSleepInBedEvent.java @@ -20,8 +20,8 @@ import net.minecraft.util.math.BlockPos; **/ public class PlayerSleepInBedEvent extends PlayerEvent { - public EnumStatus result = null; - public final BlockPos pos; + private EnumStatus result = null; + private final BlockPos pos; public PlayerSleepInBedEvent(EntityPlayer player, BlockPos pos) { @@ -29,4 +29,18 @@ public class PlayerSleepInBedEvent extends PlayerEvent this.pos = pos; } + public EnumStatus getResultStatus() + { + return result; + } + + public void setResult(EnumStatus result) + { + this.result = result; + } + + public BlockPos getPos() + { + return pos; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/SleepingLocationCheckEvent.java b/src/main/java/net/minecraftforge/event/entity/player/SleepingLocationCheckEvent.java index c7ffaecc56..148a5f2765 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/SleepingLocationCheckEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/SleepingLocationCheckEvent.java @@ -17,7 +17,7 @@ import net.minecraftforge.fml.common.eventhandler.Event.HasResult; public class SleepingLocationCheckEvent extends PlayerEvent { - public final BlockPos sleepingLocation; + private final BlockPos sleepingLocation; public SleepingLocationCheckEvent(EntityPlayer player, BlockPos sleepingLocation) { @@ -25,4 +25,8 @@ public class SleepingLocationCheckEvent extends PlayerEvent this.sleepingLocation = sleepingLocation; } + public BlockPos getSleepingLocation() + { + return sleepingLocation; + } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java b/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java index c9dad848e0..55fba10aac 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java @@ -7,23 +7,23 @@ import net.minecraft.world.World; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; +/** + * This event is fired when a player attempts to use a Hoe on a block, it + * can be canceled to completely prevent any further processing. + * + * You can also set the result to ALLOW to mark the event as processed + * and damage the hoe. + * + * setResult(ALLOW) is the same as the old setHandled(); + */ @Cancelable @Event.HasResult public class UseHoeEvent extends PlayerEvent { - /** - * This event is fired when a player attempts to use a Hoe on a block, it - * can be canceled to completely prevent any further processing. - * - * You can also set the result to ALLOW to mark the event as processed - * and damage the hoe. - * - * setResult(ALLOW) is the same as the old setHandled(); - */ - public final ItemStack current; - public final World world; - public final BlockPos pos; + private final ItemStack current; + private final World world; + private final BlockPos pos; public UseHoeEvent(EntityPlayer player, ItemStack current, World world, BlockPos pos) { @@ -32,4 +32,19 @@ public class UseHoeEvent extends PlayerEvent this.world = world; this.pos = pos; } + + public ItemStack getCurrent() + { + return current; + } + + public World getWorld() + { + return world; + } + + public BlockPos getPos() + { + return pos; + } } diff --git a/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java b/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java index 5ee2cc5973..acf68c04a5 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java @@ -1,7 +1,6 @@ package net.minecraftforge.event.terraingen; import net.minecraftforge.fml.common.eventhandler.Event; -import net.minecraftforge.fml.common.eventhandler.Event.HasResult; import net.minecraft.block.state.IBlockState; import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.BiomeGenBase; @@ -15,13 +14,18 @@ import net.minecraft.world.biome.BiomeGenBase; **/ public class BiomeEvent extends Event { - public final BiomeGenBase biome; + private final BiomeGenBase biome; public BiomeEvent(BiomeGenBase biome) { this.biome = biome; } + public BiomeGenBase getBiome() + { + return biome; + } + /** * CreateDecorator is fired when a BiomeDecorator is created.
* This event is fired whenever a BiomeDecorator is created in @@ -38,14 +42,29 @@ public class BiomeEvent extends Event **/ public static class CreateDecorator extends BiomeEvent { - public final BiomeDecorator originalBiomeDecorator; - public BiomeDecorator newBiomeDecorator; + private final BiomeDecorator originalBiomeDecorator; + private BiomeDecorator newBiomeDecorator; public CreateDecorator(BiomeGenBase biome, BiomeDecorator original) { super(biome); originalBiomeDecorator = original; - newBiomeDecorator = original; + setNewBiomeDecorator(original); + } + + public BiomeDecorator getOriginalBiomeDecorator() + { + return originalBiomeDecorator; + } + + public BiomeDecorator getNewBiomeDecorator() + { + return newBiomeDecorator; + } + + public void setNewBiomeDecorator(BiomeDecorator newBiomeDecorator) + { + this.newBiomeDecorator = newBiomeDecorator; } } @@ -58,14 +77,29 @@ public class BiomeEvent extends Event **/ public static class BiomeColor extends BiomeEvent { - public final int originalColor; - public int newColor; + private final int originalColor; + private int newColor; public BiomeColor(BiomeGenBase biome, int original) { super(biome); originalColor = original; - newColor = original; + setNewColor(original); + } + + public int getOriginalColor() + { + return originalColor; + } + + public int getNewColor() + { + return newColor; + } + + public void setNewColor(int newColor) + { + this.newColor = newColor; } } @@ -78,14 +112,29 @@ public class BiomeEvent extends Event @HasResult public static class GetVillageBlockID extends BiomeEvent { - public final IBlockState original; - public IBlockState replacement; + private final IBlockState original; + private IBlockState replacement; public GetVillageBlockID(BiomeGenBase biome, IBlockState original) { super(biome); this.original = original; } + + public IBlockState getOriginal() + { + return original; + } + + public IBlockState getReplacement() + { + return replacement; + } + + public void setReplacement(IBlockState replacement) + { + this.replacement = replacement; + } } /** diff --git a/src/main/java/net/minecraftforge/event/terraingen/ChunkGeneratorEvent.java b/src/main/java/net/minecraftforge/event/terraingen/ChunkGeneratorEvent.java index a4e13d4e1a..96551ebbec 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/ChunkGeneratorEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/ChunkGeneratorEvent.java @@ -14,7 +14,12 @@ public class ChunkGeneratorEvent extends Event this.gen = gen; } - public IChunkGenerator getGenerator() { return this.gen; } + public IChunkGenerator getGenerator() { return this.getGen(); } + + public IChunkGenerator getGen() + { + return gen; + } /** * This event is fired when a chunks blocks are replaced by a biomes top and @@ -25,10 +30,10 @@ public class ChunkGeneratorEvent extends Event @HasResult public static class ReplaceBiomeBlocks extends ChunkGeneratorEvent { - public final int x; - public final int z; - public final ChunkPrimer primer; - public final World world; // CAN BE NULL + private final int x; + private final int z; + private final ChunkPrimer primer; + private final World world; // CAN BE NULL public ReplaceBiomeBlocks(IChunkGenerator chunkProvider, int x, int z, ChunkPrimer primer, World world) { @@ -39,6 +44,10 @@ public class ChunkGeneratorEvent extends Event this.world = world; } + public int getX() { return x; } + public int getZ() { return z; } + public ChunkPrimer getPrimer() { return primer; } + public World getWorld() { return world; } } /** @@ -49,18 +58,18 @@ public class ChunkGeneratorEvent extends Event @HasResult public static class InitNoiseField extends ChunkGeneratorEvent { - public double[] noisefield; - public final int posX; - public final int posY; - public final int posZ; - public final int sizeX; - public final int sizeY; - public final int sizeZ; + private double[] noisefield; + private final int posX; + private final int posY; + private final int posZ; + private final int sizeX; + private final int sizeY; + private final int sizeZ; public InitNoiseField(IChunkGenerator chunkProvider, double[] noisefield, int posX, int posY, int posZ, int sizeX, int sizeY, int sizeZ) { super(chunkProvider); - this.noisefield = noisefield; + this.setNoisefield(noisefield); this.posX = posX; this.posY = posY; this.posZ = posZ; @@ -69,5 +78,13 @@ public class ChunkGeneratorEvent extends Event this.sizeZ = sizeZ; } + public double[] getNoisefield() { return noisefield; } + public void setNoisefield(double[] noisefield) { this.noisefield = noisefield; } + public int getPosX() { return posX; } + public int getPosY() { return posY; } + public int getPosZ() { return posZ; } + public int getSizeX() { return sizeX; } + public int getSizeY() { return sizeY; } + public int getSizeZ() { return sizeZ; } } } diff --git a/src/main/java/net/minecraftforge/event/terraingen/DecorateBiomeEvent.java b/src/main/java/net/minecraftforge/event/terraingen/DecorateBiomeEvent.java index f284e21e35..ff4c0c6b75 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/DecorateBiomeEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/DecorateBiomeEvent.java @@ -23,9 +23,9 @@ import net.minecraft.world.World; **/ public class DecorateBiomeEvent extends Event { - public final World world; - public final Random rand; - public final BlockPos pos; + private final World world; + private final Random rand; + private final BlockPos pos; public DecorateBiomeEvent(World world, Random rand, BlockPos pos) { @@ -34,6 +34,21 @@ public class DecorateBiomeEvent extends Event this.pos = pos; } + public World getWorld() + { + return world; + } + + public Random getRand() + { + return rand; + } + + public BlockPos getPos() + { + return pos; + } + /** * This event is fired before a chunk is decorated with a biome feature. */ @@ -64,11 +79,16 @@ public class DecorateBiomeEvent extends Event @HasResult public static class Decorate extends DecorateBiomeEvent { + public EventType getType() + { + return type; + } + /** Use CUSTOM to filter custom event types */ public static enum EventType { BIG_SHROOM, CACTUS, CLAY, DEAD_BUSH, LILYPAD, FLOWERS, GRASS, LAKE_WATER, LAKE_LAVA, PUMPKIN, REED, SAND, SAND_PASS2, SHROOM, TREE, CUSTOM } - public final EventType type; + private final EventType type; public Decorate(World world, Random rand, BlockPos pos, EventType type) { diff --git a/src/main/java/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java b/src/main/java/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java index 05c43e4b6a..d41dde420a 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java +++ b/src/main/java/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java @@ -41,6 +41,6 @@ public class DeferredBiomeDecorator extends BiomeDecorator { BiomeEvent.CreateDecorator event = new BiomeEvent.CreateDecorator(biome, wrapped); MinecraftForge.TERRAIN_GEN_BUS.post(event); - biome.theBiomeDecorator = event.newBiomeDecorator; + biome.theBiomeDecorator = event.getNewBiomeDecorator(); } } diff --git a/src/main/java/net/minecraftforge/event/terraingen/InitMapGenEvent.java b/src/main/java/net/minecraftforge/event/terraingen/InitMapGenEvent.java index 914ffe208e..9113db4059 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/InitMapGenEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/InitMapGenEvent.java @@ -9,14 +9,18 @@ public class InitMapGenEvent extends Event */ public static enum EventType { CAVE, MINESHAFT, NETHER_BRIDGE, NETHER_CAVE, RAVINE, SCATTERED_FEATURE, STRONGHOLD, VILLAGE, OCEAN_MONUMENT, CUSTOM } - public final EventType type; - public final MapGenBase originalGen; - public MapGenBase newGen; + private final EventType type; + private final MapGenBase originalGen; + private MapGenBase newGen; InitMapGenEvent(EventType type, MapGenBase original) { this.type = type; this.originalGen = original; - this.newGen = original; + this.setNewGen(original); } + public EventType getType() { return type; } + public MapGenBase getOriginalGen() { return originalGen; } + public MapGenBase getNewGen() { return newGen; } + public void setNewGen(MapGenBase newGen) { this.newGen = newGen; } } diff --git a/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java b/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java index 32b6d5c4c7..0977129f14 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java @@ -20,9 +20,9 @@ import net.minecraft.world.gen.feature.WorldGenerator; **/ public class OreGenEvent extends Event { - public final World world; - public final Random rand; - public final BlockPos pos; + private final World world; + private final Random rand; + private final BlockPos pos; public OreGenEvent(World world, Random rand, BlockPos pos) { @@ -31,6 +31,21 @@ public class OreGenEvent extends Event this.pos = pos; } + public World getWorld() + { + return world; + } + + public Random getRand() + { + return rand; + } + + public BlockPos getPos() + { + return pos; + } + /** * OreGenEvent.Pre is fired just before a chunk is populated with ores.
* This event is fired just before ore generation in @@ -89,8 +104,8 @@ public class OreGenEvent extends Event { public static enum EventType { COAL, DIAMOND, DIRT, GOLD, GRAVEL, IRON, LAPIS, REDSTONE, QUARTZ, DIORITE, GRANITE, ANDESITE, EMERALD, SILVERFISH, CUSTOM } - public final EventType type; - public final WorldGenerator generator; + private final EventType type; + private final WorldGenerator generator; public GenerateMinable(World world, Random rand, WorldGenerator generator, BlockPos pos, EventType type) { @@ -98,5 +113,15 @@ public class OreGenEvent extends Event this.generator = generator; this.type = type; } + + public EventType getType() + { + return type; + } + + public WorldGenerator getGenerator() + { + return generator; + } } } diff --git a/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java b/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java index dda1712641..08ece413bf 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java @@ -23,11 +23,11 @@ import net.minecraftforge.fml.common.eventhandler.Event; **/ public class PopulateChunkEvent extends ChunkGeneratorEvent { - public final World world; - public final Random rand; - public final int chunkX; - public final int chunkZ; - public final boolean hasVillageGenerated; + private final World world; + private final Random rand; + private final int chunkX; + private final int chunkZ; + private final boolean hasVillageGenerated; public PopulateChunkEvent(IChunkGenerator gen, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) { @@ -39,6 +39,11 @@ public class PopulateChunkEvent extends ChunkGeneratorEvent this.hasVillageGenerated = hasVillageGenerated; } + public World getWorld() { return world; } + public Random getRand() { return rand; } + public int getChunkX() { return chunkX; } + public int getChunkZ() { return chunkZ; } + public boolean isHasVillageGenerated() { return hasVillageGenerated; } /** * PopulateChunkEvent.Pre is fired just before a chunk is populated a terrain feature.
* This event is fired just before terrain feature generation in @@ -100,11 +105,16 @@ public class PopulateChunkEvent extends ChunkGeneratorEvent @HasResult public static class Populate extends PopulateChunkEvent { + public EventType getType() + { + return type; + } + /** Use CUSTOM to filter custom event types */ public static enum EventType { DUNGEON, FIRE, GLOWSTONE, ICE, LAKE, LAVA, NETHER_LAVA, NETHER_LAVA2, ANIMALS, CUSTOM } - public final EventType type; + private final EventType type; public Populate(IChunkGenerator gen, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated, EventType type) { diff --git a/src/main/java/net/minecraftforge/event/terraingen/SaplingGrowTreeEvent.java b/src/main/java/net/minecraftforge/event/terraingen/SaplingGrowTreeEvent.java index af7b458d6b..e12002b250 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/SaplingGrowTreeEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/SaplingGrowTreeEvent.java @@ -24,8 +24,8 @@ import net.minecraftforge.event.world.WorldEvent; @HasResult public class SaplingGrowTreeEvent extends WorldEvent { - public final BlockPos pos; - public final Random rand; + private final BlockPos pos; + private final Random rand; public SaplingGrowTreeEvent(World world, Random rand, BlockPos pos) { @@ -33,4 +33,14 @@ public class SaplingGrowTreeEvent extends WorldEvent this.rand = rand; this.pos = pos; } + + public BlockPos getPos() + { + return pos; + } + + public Random getRand() + { + return rand; + } } diff --git a/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java b/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java index cbec1f7841..c6f4aa2d4a 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java +++ b/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java @@ -26,7 +26,7 @@ public abstract class TerrainGen { InitMapGenEvent event = new InitMapGenEvent(type, original); MinecraftForge.TERRAIN_GEN_BUS.post(event); - return event.newGen; + return event.getNewGen(); } public static boolean populate(IChunkGenerator chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated, Populate.EventType type) diff --git a/src/main/java/net/minecraftforge/event/terraingen/WorldTypeEvent.java b/src/main/java/net/minecraftforge/event/terraingen/WorldTypeEvent.java index 463f644cb6..cb3f21daca 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/WorldTypeEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/WorldTypeEvent.java @@ -15,13 +15,18 @@ import net.minecraft.world.WorldType; **/ public class WorldTypeEvent extends Event { - public final WorldType worldType; + private final WorldType worldType; public WorldTypeEvent(WorldType worldType) { this.worldType = worldType; } + public WorldType getWorldType() + { + return worldType; + } + /** * BiomeSize is fired when vanilla Minecraft attempts to generate biomes.
* This event is fired during biome generation in @@ -39,14 +44,29 @@ public class WorldTypeEvent extends Event **/ public static class BiomeSize extends WorldTypeEvent { - public final int originalSize; - public int newSize; + private final int originalSize; + private int newSize; public BiomeSize(WorldType worldType, int original) { super(worldType); originalSize = original; - newSize = original; + setNewSize(original); + } + + public int getOriginalSize() + { + return originalSize; + } + + public int getNewSize() + { + return newSize; + } + + public void setNewSize(int newSize) + { + this.newSize = newSize; } } @@ -68,16 +88,36 @@ public class WorldTypeEvent extends Event **/ public static class InitBiomeGens extends WorldTypeEvent { - public final long seed; - public final GenLayer[] originalBiomeGens; - public GenLayer[] newBiomeGens; + private final long seed; + private final GenLayer[] originalBiomeGens; + private GenLayer[] newBiomeGens; public InitBiomeGens(WorldType worldType, long seed, GenLayer[] original) { super(worldType); this.seed = seed; originalBiomeGens = original; - newBiomeGens = original.clone(); + setNewBiomeGens(original.clone()); + } + + public long getSeed() + { + return seed; + } + + public GenLayer[] getOriginalBiomeGens() + { + return originalBiomeGens; + } + + public GenLayer[] getNewBiomeGens() + { + return newBiomeGens; + } + + public void setNewBiomeGens(GenLayer[] newBiomeGens) + { + this.newBiomeGens = newBiomeGens; } } } diff --git a/src/main/java/net/minecraftforge/event/world/BlockEvent.java b/src/main/java/net/minecraftforge/event/world/BlockEvent.java index ed37229e80..47d620bd86 100644 --- a/src/main/java/net/minecraftforge/event/world/BlockEvent.java +++ b/src/main/java/net/minecraftforge/event/world/BlockEvent.java @@ -22,9 +22,9 @@ public class BlockEvent extends Event { private static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("forge.debugBlockEvent", "false")); - public final World world; - public final BlockPos pos; - public final IBlockState state; + private final World world; + private final BlockPos pos; + private final IBlockState state; public BlockEvent(World world, BlockPos pos, IBlockState state) { this.pos = pos; @@ -32,6 +32,21 @@ public class BlockEvent extends Event this.state = state; } + public World getWorld() + { + return world; + } + + public BlockPos getPos() + { + return pos; + } + + public IBlockState getState() + { + return state; + } + /** * Fired when a block is about to drop it's harvested items. The {@link #drops} array can be amended, as can the {@link #dropChance}. * Note well: the {@link #harvester} player field is null in a variety of scenarios. Code expecting null. @@ -45,21 +60,28 @@ public class BlockEvent extends Event */ public static class HarvestDropsEvent extends BlockEvent { - public final int fortuneLevel; - public final List drops; - public final boolean isSilkTouching; - public float dropChance; // Change to e.g. 1.0f, if you manipulate the list and want to guarantee it always drops - public final EntityPlayer harvester; // May be null for non-player harvesting such as explosions or machines + private final int fortuneLevel; + private final List drops; + private final boolean isSilkTouching; + private float dropChance; // Change to e.g. 1.0f, if you manipulate the list and want to guarantee it always drops + private final EntityPlayer harvester; // May be null for non-player harvesting such as explosions or machines public HarvestDropsEvent(World world, BlockPos pos, IBlockState state, int fortuneLevel, float dropChance, List drops, EntityPlayer harvester, boolean isSilkTouching) { super(world, pos, state); this.fortuneLevel = fortuneLevel; - this.dropChance = dropChance; + this.setDropChance(dropChance); this.drops = drops; this.isSilkTouching = isSilkTouching; this.harvester = harvester; } + + public int getFortuneLevel() { return fortuneLevel; } + public List getDrops() { return drops; } + public boolean isSilkTouching() { return isSilkTouching; } + public float getDropChance() { return dropChance; } + public void setDropChance(float dropChance) { this.dropChance = dropChance; } + public EntityPlayer getHarvester() { return harvester; } } /** @@ -124,11 +146,11 @@ public class BlockEvent extends Event @Cancelable public static class PlaceEvent extends BlockEvent { - public final EntityPlayer player; - public final ItemStack itemInHand; - public final BlockSnapshot blockSnapshot; - public final IBlockState placedBlock; - public final IBlockState placedAgainst; + private final EntityPlayer player; + private final ItemStack itemInHand; + private final BlockSnapshot blockSnapshot; + private final IBlockState placedBlock; + private final IBlockState placedAgainst; public PlaceEvent(BlockSnapshot blockSnapshot, IBlockState placedAgainst, EntityPlayer player) { @@ -140,9 +162,15 @@ public class BlockEvent extends Event this.placedAgainst = placedAgainst; if (DEBUG) { - System.out.printf("Created PlaceEvent - [PlacedBlock: %s ][PlacedAgainst: %s ][ItemStack: %s ][Player: %s ]\n", placedBlock, placedAgainst, itemInHand, player); + System.out.printf("Created PlaceEvent - [PlacedBlock: %s ][PlacedAgainst: %s ][ItemStack: %s ][Player: %s ]\n", getPlacedBlock(), placedAgainst, getItemInHand(), player); } } + + public EntityPlayer getPlayer() { return player; } + public ItemStack getItemInHand() { return itemInHand; } + public BlockSnapshot getBlockSnapshot() { return blockSnapshot; } + public IBlockState getPlacedBlock() { return placedBlock; } + public IBlockState getPlacedAgainst() { return placedAgainst; } } /** @@ -163,7 +191,7 @@ public class BlockEvent extends Event this.blockSnapshots = ImmutableList.copyOf(blockSnapshots); if (DEBUG) { - System.out.printf("Created MultiPlaceEvent - [PlacedAgainst: %s ][ItemInHand: %s ][Player: %s ]\n", placedAgainst, this.itemInHand, player); + System.out.printf("Created MultiPlaceEvent - [PlacedAgainst: %s ][ItemInHand: %s ][Player: %s ]\n", placedAgainst, this.getItemInHand(), player); } } diff --git a/src/main/java/net/minecraftforge/event/world/ChunkWatchEvent.java b/src/main/java/net/minecraftforge/event/world/ChunkWatchEvent.java index e94c57cc32..bc33653b06 100644 --- a/src/main/java/net/minecraftforge/event/world/ChunkWatchEvent.java +++ b/src/main/java/net/minecraftforge/event/world/ChunkWatchEvent.java @@ -16,15 +16,25 @@ import net.minecraft.entity.player.EntityPlayerMP; **/ public class ChunkWatchEvent extends Event { - public final ChunkCoordIntPair chunk; - public final EntityPlayerMP player; + private final ChunkCoordIntPair chunk; + private final EntityPlayerMP player; public ChunkWatchEvent(ChunkCoordIntPair chunk, EntityPlayerMP player) { this.chunk = chunk; this.player = player; } - + + public ChunkCoordIntPair getChunk() + { + return chunk; + } + + public EntityPlayerMP getPlayer() + { + return player; + } + /** * ChunkWatchEvent.Watch is fired when an EntityPlayer begins watching a chunk.
* This event is fired when a chunk is added to the watched chunks of an EntityPlayer in diff --git a/src/main/java/net/minecraftforge/event/world/ExplosionEvent.java b/src/main/java/net/minecraftforge/event/world/ExplosionEvent.java index 03751b0124..5a93fdb3d9 100644 --- a/src/main/java/net/minecraftforge/event/world/ExplosionEvent.java +++ b/src/main/java/net/minecraftforge/event/world/ExplosionEvent.java @@ -21,8 +21,8 @@ import net.minecraft.world.World; */ public class ExplosionEvent extends Event { - public final World world; - public final Explosion explosion; + private final World world; + private final Explosion explosion; public ExplosionEvent(World world, Explosion explosion) { @@ -30,6 +30,16 @@ public class ExplosionEvent extends Event this.explosion = explosion; } + public World getWorld() + { + return world; + } + + public Explosion getExplosion() + { + return explosion; + } + /** ExplosionEvent.Start is fired before the explosion actually occurs. Canceling this event will stop the explosion.
*
* This event is {@link Cancelable}.
@@ -64,7 +74,7 @@ public class ExplosionEvent extends Event /** return the list of blocks affected by the explosion. */ public List getAffectedBlocks() { - return explosion.getAffectedBlockPositions(); + return getExplosion().getAffectedBlockPositions(); } /** return the list of entities affected by the explosion. */ diff --git a/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java b/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java index 58ef7c0e61..6ed656285f 100644 --- a/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java +++ b/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java @@ -67,12 +67,22 @@ public class NoteBlockEvent extends BlockEvent @Cancelable public static class Play extends NoteBlockEvent { - public Instrument instrument; + private Instrument instrument; public Play(World world, BlockPos pos, IBlockState state, int note, int instrument) { super(world, pos, state, note); - this.instrument = Instrument.fromId(instrument); + this.setInstrument(Instrument.fromId(instrument)); + } + + public Instrument getInstrument() + { + return instrument; + } + + public void setInstrument(Instrument instrument) + { + this.instrument = instrument; } } @@ -83,8 +93,8 @@ public class NoteBlockEvent extends BlockEvent @Cancelable public static class Change extends NoteBlockEvent { - public final Note oldNote; - public final Octave oldOctave; + private final Note oldNote; + private final Octave oldOctave; public Change(World world, BlockPos pos, IBlockState state, int oldNote, int newNote) { @@ -92,6 +102,16 @@ public class NoteBlockEvent extends BlockEvent this.oldNote = Note.fromId(oldNote); this.oldOctave = Octave.fromId(oldNote); } + + public Note getOldNote() + { + return oldNote; + } + + public Octave getOldOctave() + { + return oldOctave; + } } /** diff --git a/src/main/java/net/minecraftforge/event/world/WorldEvent.java b/src/main/java/net/minecraftforge/event/world/WorldEvent.java index 72f94ade91..d54bd3b77b 100644 --- a/src/main/java/net/minecraftforge/event/world/WorldEvent.java +++ b/src/main/java/net/minecraftforge/event/world/WorldEvent.java @@ -22,13 +22,18 @@ import net.minecraftforge.fml.common.eventhandler.Event; **/ public class WorldEvent extends Event { - public final World world; + private final World world; public WorldEvent(World world) { this.world = world; } + public World getWorld() + { + return world; + } + /** * WorldEvent.Load is fired when Minecraft loads a world.
* This event is fired when a world is loaded in @@ -96,9 +101,9 @@ public class WorldEvent extends Event @Cancelable public static class PotentialSpawns extends WorldEvent { - public final EnumCreatureType type; - public final BlockPos pos; - public final List list; + private final EnumCreatureType type; + private final BlockPos pos; + private final List list; public PotentialSpawns(World world, EnumCreatureType type, BlockPos pos, List oldList) { @@ -114,6 +119,21 @@ public class WorldEvent extends Event this.list = new ArrayList(); } } + + public EnumCreatureType getType() + { + return type; + } + + public BlockPos getPos() + { + return pos; + } + + public List getList() + { + return list; + } } /** @@ -123,11 +143,16 @@ public class WorldEvent extends Event @Cancelable public static class CreateSpawnPosition extends WorldEvent { - public final WorldSettings settings; + private final WorldSettings settings; public CreateSpawnPosition(World world, WorldSettings settings) { super(world); this.settings = settings; } + + public WorldSettings getSettings() + { + return settings; + } } } diff --git a/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java index 5810582726..0b2c3d49cf 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java @@ -389,11 +389,16 @@ public abstract class FluidContainerRegistry public static class FluidContainerRegisterEvent extends Event { - public final FluidContainerData data; + private final FluidContainerData data; public FluidContainerRegisterEvent(FluidContainerData data) { this.data = data.copy(); } + + public FluidContainerData getData() + { + return data; + } } } diff --git a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java index ba32b29e34..b2a752f06b 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java @@ -319,14 +319,24 @@ public abstract class FluidRegistry public static class FluidRegisterEvent extends Event { - public final String fluidName; - public final int fluidID; + private final String fluidName; + private final int fluidID; public FluidRegisterEvent(String fluidName, int fluidID) { this.fluidName = fluidName; this.fluidID = fluidID; } + + public String getFluidName() + { + return fluidName; + } + + public int getFluidID() + { + return fluidID; + } } public static int getMaxID() diff --git a/src/main/java/net/minecraftforge/fml/common/network/FMLEventChannel.java b/src/main/java/net/minecraftforge/fml/common/network/FMLEventChannel.java index 4b424dccb7..615185ccdf 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/FMLEventChannel.java +++ b/src/main/java/net/minecraftforge/fml/common/network/FMLEventChannel.java @@ -103,10 +103,10 @@ public class FMLEventChannel { if (event != null) { this.eventBus.post(event); - if (event.reply != null) + if (event.getReply() != null) { ctx.channel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.REPLY); - ctx.writeAndFlush(event.reply).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); + ctx.writeAndFlush(event.getReply()).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); } } } diff --git a/src/main/java/net/minecraftforge/fml/common/network/FMLNetworkEvent.java b/src/main/java/net/minecraftforge/fml/common/network/FMLNetworkEvent.java index a6e9129ec4..141462441d 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/FMLNetworkEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/network/FMLNetworkEvent.java @@ -13,8 +13,8 @@ import net.minecraftforge.fml.common.network.internal.FMLProxyPacket; import net.minecraftforge.fml.relauncher.Side; public class FMLNetworkEvent extends Event { - public final T handler; - public final NetworkManager manager; + private final T handler; + private final NetworkManager manager; private final Class type; FMLNetworkEvent(T thing, Class type, NetworkManager manager) @@ -25,22 +25,47 @@ public class FMLNetworkEvent extends Event { } public Class getHandlerType() + { + return getType(); + } + + public T getHandler() + { + return handler; + } + + public NetworkManager getManager() + { + return manager; + } + + public Class getType() { return type; } - + /** * Fired at the client when a client connects to a server */ public static class ClientConnectedToServerEvent extends FMLNetworkEvent { - public final boolean isLocal; - public final String connectionType; + private final boolean isLocal; + private final String connectionType; public ClientConnectedToServerEvent(NetworkManager manager, String connectionType) { super((INetHandlerPlayClient) manager.getNetHandler(), INetHandlerPlayClient.class, manager); this.isLocal = manager.isLocalChannel(); this.connectionType = connectionType; } + + public boolean isLocal() + { + return isLocal; + } + + public String getConnectionType() + { + return connectionType; + } } /** @@ -50,12 +75,17 @@ public class FMLNetworkEvent extends Event { * */ public static class ServerConnectionFromClientEvent extends FMLNetworkEvent { - public final boolean isLocal; + private final boolean isLocal; public ServerConnectionFromClientEvent(NetworkManager manager) { super((INetHandlerPlayServer) manager.getNetHandler(), INetHandlerPlayServer.class, manager); this.isLocal = manager.isLocalChannel(); } + + public boolean isLocal() + { + return isLocal; + } } /** * Fired at the server when a client disconnects. @@ -90,9 +120,9 @@ public class FMLNetworkEvent extends Event { * @param The side */ public static class CustomPacketRegistrationEvent extends FMLNetworkEvent { - public final ImmutableSet registrations; - public final String operation; - public final Side side; + private final ImmutableSet registrations; + private final String operation; + private final Side side; public CustomPacketRegistrationEvent(NetworkManager manager, Set registrations, String operation, Side side, Class type) { super(type.cast(manager.getNetHandler()), type, manager); @@ -100,18 +130,27 @@ public class FMLNetworkEvent extends Event { this.side = side; this.operation = operation; } + + public ImmutableSet getRegistrations() + { + return registrations; + } + + public String getOperation() + { + return operation; + } + + public Side getSide() + { + return side; + } } public static abstract class CustomPacketEvent extends FMLNetworkEvent { - /** - * The packet that generated the event - */ - public final FMLProxyPacket packet; + private final FMLProxyPacket packet; - /** - * Set this packet to reply to the originator - */ - public FMLProxyPacket reply; + private FMLProxyPacket reply; CustomPacketEvent(S thing, Class type, NetworkManager manager, FMLProxyPacket packet) { super(thing, type, manager); @@ -119,6 +158,27 @@ public class FMLNetworkEvent extends Event { } public abstract Side side(); + + /** + * The packet that generated the event + */ + public FMLProxyPacket getPacket() + { + return packet; + } + + /** + * Set this packet to reply to the originator + */ + public FMLProxyPacket getReply() + { + return reply; + } + + public void setReply(FMLProxyPacket reply) + { + this.reply = reply; + } } /** @@ -164,10 +224,15 @@ public class FMLNetworkEvent extends Event { * */ public static class CustomNetworkEvent extends Event { - public final Object wrappedEvent; + private final Object wrappedEvent; public CustomNetworkEvent(Object wrappedEvent) { this.wrappedEvent = wrappedEvent; } + + public Object getWrappedEvent() + { + return wrappedEvent; + } } } diff --git a/src/main/java/net/minecraftforge/oredict/OreDictionary.java b/src/main/java/net/minecraftforge/oredict/OreDictionary.java index f5bb9af470..806e382173 100644 --- a/src/main/java/net/minecraftforge/oredict/OreDictionary.java +++ b/src/main/java/net/minecraftforge/oredict/OreDictionary.java @@ -524,14 +524,24 @@ public class OreDictionary public static class OreRegisterEvent extends Event { - public final String Name; - public final ItemStack Ore; + private final String Name; + private final ItemStack Ore; public OreRegisterEvent(String name, ItemStack ore) { this.Name = name; this.Ore = ore; } + + public String getName() + { + return Name; + } + + public ItemStack getOre() + { + return Ore; + } } public static void rebakeMap() diff --git a/src/test/java/net/minecraftforge/test/EntityTravelToDimensionEventTest.java b/src/test/java/net/minecraftforge/test/EntityTravelToDimensionEventTest.java index a95b22dd1f..5b1380b42f 100644 --- a/src/test/java/net/minecraftforge/test/EntityTravelToDimensionEventTest.java +++ b/src/test/java/net/minecraftforge/test/EntityTravelToDimensionEventTest.java @@ -22,7 +22,7 @@ public class EntityTravelToDimensionEventTest public void onDimensionTravel(EntityTravelToDimensionEvent event) { if(ENABLE) { - System.out.println("Travelling to Dimension " + event.dimension); + System.out.println("Travelling to Dimension " + event.getDimension()); event.setCanceled(true); } } diff --git a/src/test/java/net/minecraftforge/test/NeighborNotifyEventTest.java b/src/test/java/net/minecraftforge/test/NeighborNotifyEventTest.java index 9be69bf6a0..af23523fbc 100644 --- a/src/test/java/net/minecraftforge/test/NeighborNotifyEventTest.java +++ b/src/test/java/net/minecraftforge/test/NeighborNotifyEventTest.java @@ -23,7 +23,7 @@ public class NeighborNotifyEventTest public void onNeighborNotify(NeighborNotifyEvent event) { if(ENABLE) { - System.out.println(event.pos.toString()); + System.out.println(event.getPos().toString()); event.setCanceled(true); } } diff --git a/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java b/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java index f50bf57f8d..b4f728a440 100644 --- a/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java +++ b/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java @@ -104,7 +104,7 @@ public class NoBedSleepingTest @SubscribeEvent public void onBedCheck(SleepingLocationCheckEvent evt) { - final IExtraSleeping sleep = evt.entityPlayer.getCapability(SLEEP_CAP, null); + final IExtraSleeping sleep = evt.getEntityPlayer().getCapability(SLEEP_CAP, null); if (sleep != null && sleep.isSleeping()) evt.setResult(Result.ALLOW); } @@ -112,7 +112,7 @@ public class NoBedSleepingTest @SubscribeEvent public void onWakeUp(PlayerWakeUpEvent evt) { - final IExtraSleeping sleep = evt.entityPlayer.getCapability(SLEEP_CAP, null); + final IExtraSleeping sleep = evt.getEntityPlayer().getCapability(SLEEP_CAP, null); if (sleep != null) sleep.setSleeping(false); } diff --git a/src/test/java/net/minecraftforge/test/PlayerInteractEventLocalTest.java b/src/test/java/net/minecraftforge/test/PlayerInteractEventLocalTest.java index 9e8d1031f7..16da5af0b1 100644 --- a/src/test/java/net/minecraftforge/test/PlayerInteractEventLocalTest.java +++ b/src/test/java/net/minecraftforge/test/PlayerInteractEventLocalTest.java @@ -22,8 +22,8 @@ public class PlayerInteractEventLocalTest @SubscribeEvent public void onPlayerInteract(PlayerInteractEvent event) { - if(ENABLE && event.localPos != null) { - System.out.println(event.localPos.toString()); + if(ENABLE && event.getLocalPos() != null) { + System.out.println(event.getLocalPos().toString()); } } } diff --git a/src/test/java/net/minecraftforge/test/PlayerSetSpawnTest.java b/src/test/java/net/minecraftforge/test/PlayerSetSpawnTest.java index 78875dbcee..65b9b41c17 100644 --- a/src/test/java/net/minecraftforge/test/PlayerSetSpawnTest.java +++ b/src/test/java/net/minecraftforge/test/PlayerSetSpawnTest.java @@ -19,7 +19,7 @@ public class PlayerSetSpawnTest { @SubscribeEvent public void onPlayerSetSpawn(PlayerSetSpawnEvent event) { - System.out.println(event.forced + " " + event.newSpawn.toString()); + System.out.println(event.isForced() + " " + event.getNewSpawn().toString()); event.setCanceled(true); } } diff --git a/src/test/java/net/minecraftforge/test/TestCapabilityMod.java b/src/test/java/net/minecraftforge/test/TestCapabilityMod.java index 8705900479..d6babd4b35 100644 --- a/src/test/java/net/minecraftforge/test/TestCapabilityMod.java +++ b/src/test/java/net/minecraftforge/test/TestCapabilityMod.java @@ -44,21 +44,21 @@ public class TestCapabilityMod @SubscribeEvent public void onInteract(PlayerInteractEvent event) { - if (event.action != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) return; - if (event.entityPlayer.inventory.getCurrentItem() == null) return; - if (event.entityPlayer.inventory.getCurrentItem().getItem() != Items.stick) return; + if (event.getAction() != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) return; + if (event.getEntityPlayer().inventory.getCurrentItem() == null) return; + if (event.getEntityPlayer().inventory.getCurrentItem().getItem() != Items.stick) return; // This is just a example of how to interact with the TE, note the strong type binding that getCapability has - TileEntity te = event.world.getTileEntity(event.pos); - if (te != null && te.hasCapability(TEST_CAP, event.face)) + TileEntity te = event.getWorld().getTileEntity(event.getPos()); + if (te != null && te.hasCapability(TEST_CAP, event.getFace())) { event.setCanceled(true); - IExampleCapability inv = te.getCapability(TEST_CAP, event.face); + IExampleCapability inv = te.getCapability(TEST_CAP, event.getFace()); System.out.println("Hi I'm a " + inv.getOwnerType()); } - if (event.world.getBlockState(event.pos).getBlock() == Blocks.dirt) + if (event.getWorld().getBlockState(event.getPos()).getBlock() == Blocks.dirt) { - event.entityPlayer.addChatMessage(new TextComponentString(TextFormatting.RED + "" + TextFormatting.ITALIC + "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST")); + event.getEntityPlayer().addChatMessage(new TextComponentString(TextFormatting.RED + "" + TextFormatting.ITALIC + "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST")); event.setCanceled(true); } } From 75032ebf9ce21ff2dfbc1be33a5e065a46c0e3b9 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 24 Mar 2016 13:14:39 +0300 Subject: [PATCH 157/243] Made some more public fields either private or final. --- .../client/event/sound/SoundEvent.java | 21 ++- .../client/model/ForgeBlockStateV1.java | 2 +- .../client/model/ModelLoader.java | 4 +- .../client/model/b3d/B3DModel.java | 2 +- .../common/ForgeChunkManager.java | 20 +-- .../net/minecraftforge/common/ForgeHooks.java | 10 +- .../common/ForgeModContainer.java | 22 +-- .../common/brewing/AbstractBrewingRecipe.java | 29 +++- .../common/brewing/BrewingOreRecipe.java | 2 +- .../common/brewing/BrewingRecipe.java | 2 +- .../common/config/ConfigCategory.java | 4 +- .../common/config/ConfigElement.java | 2 +- .../common/config/Configuration.java | 20 +-- .../common/config/Property.java | 16 ++- .../common/util/BlockSnapshot.java | 132 ++++++++++-------- .../event/ForgeEventFactory.java | 4 +- .../event/world/BlockEvent.java | 2 +- .../net/minecraftforge/fluids/FluidEvent.java | 49 ++++++- .../fluids/UniversalBucket.java | 53 ++++--- .../fml/client/event/ConfigChangedEvent.java | 56 +++++--- .../event/FMLFingerprintViolationEvent.java | 13 +- .../network/internal/FMLProxyPacket.java | 1 + .../fml/common/registry/GameData.java | 22 --- .../fml/common/registry/GameRegistry.java | 100 ------------- .../fml/relauncher/FMLInjectionData.java | 2 +- .../fml/relauncher/FMLRelaunchLog.java | 2 +- .../minecraftforge/items/SlotItemHandler.java | 21 +-- .../items/wrapper/EmptyHandler.java | 2 +- .../items/wrapper/InvWrapper.java | 47 ++++--- .../items/wrapper/PlayerArmorInvWrapper.java | 9 +- .../items/wrapper/PlayerMainInvWrapper.java | 13 +- .../minecraftforge/oredict/RecipeSorter.java | 2 +- 32 files changed, 355 insertions(+), 331 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java b/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java index e8b450a106..fa0d258a25 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java @@ -19,9 +19,9 @@ public class SoundEvent extends Event public static class SoundSourceEvent extends SoundEvent { - public final ISound sound; - public final String uuid; - public final String name; + private final ISound sound; + private final String uuid; + private final String name; public SoundSourceEvent(SoundManager manager, ISound sound, String uuid) { @@ -30,5 +30,20 @@ public class SoundEvent extends Event this.sound = sound; this.uuid = uuid; } + + public ISound getSound() + { + return sound; + } + + public String getUuid() + { + return uuid; + } + + public String getName() + { + return name; + } } } diff --git a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java index ea7b56446b..7acae47952 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java @@ -749,7 +749,7 @@ public class ForgeBlockStateV1 extends Marker public static class TRSRDeserializer implements JsonDeserializer { - public static TRSRDeserializer INSTANCE = new TRSRDeserializer(); + public static final TRSRDeserializer INSTANCE = new TRSRDeserializer(); public TRSRTransformation deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index e0c2d064d2..1800dda33b 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -841,8 +841,8 @@ public final class ModelLoader extends ModelBakery */ public static final class White extends TextureAtlasSprite { - public static ResourceLocation LOCATION = new ResourceLocation("white"); - public static White INSTANCE = new White(); + public static final ResourceLocation LOCATION = new ResourceLocation("white"); + public static final White INSTANCE = new White(); private White() { diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java index e8cde42cd2..d65b4f2085 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java @@ -511,7 +511,7 @@ public class B3DModel public static class Texture { - public static Texture White = new Texture("builtin/white", 0, 0, new Vector2f(0, 0), new Vector2f(1, 1), 0); + public static final Texture White = new Texture("builtin/white", 0, 0, new Vector2f(0, 0), new Vector2f(1, 1), 0); private final String path; private final int flags; private final int blend; diff --git a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java index 66d7f7d113..c402b1eaa4 100644 --- a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java +++ b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java @@ -1003,37 +1003,37 @@ public class ForgeChunkManager .setCategoryRequiresWorldRestart("defaults", true); Property temp = config.get("defaults", "enabled", true); - temp.comment = "Are mod overrides enabled?"; + temp.setComment("Are mod overrides enabled?"); temp.setLanguageKey("forge.configgui.enableModOverrides"); overridesEnabled = temp.getBoolean(true); propOrder.add("enabled"); temp = config.get("defaults", "maximumChunksPerTicket", 25); - temp.comment = "The default maximum number of chunks a mod can force, per ticket, \n" + - "for a mod without an override. This is the maximum number of chunks a single ticket can force."; + temp.setComment("The default maximum number of chunks a mod can force, per ticket, \n" + + "for a mod without an override. This is the maximum number of chunks a single ticket can force."); temp.setLanguageKey("forge.configgui.maximumChunksPerTicket"); temp.setMinValue(0); defaultMaxChunks = temp.getInt(25); propOrder.add("maximumChunksPerTicket"); temp = config.get("defaults", "maximumTicketCount", 200); - temp.comment = "The default maximum ticket count for a mod which does not have an override\n" + - "in this file. This is the number of chunk loading requests a mod is allowed to make."; + temp.setComment("The default maximum ticket count for a mod which does not have an override\n" + + "in this file. This is the number of chunk loading requests a mod is allowed to make."); temp.setLanguageKey("forge.configgui.maximumTicketCount"); temp.setMinValue(0); defaultMaxCount = temp.getInt(200); propOrder.add("maximumTicketCount"); temp = config.get("defaults", "playerTicketCount", 500); - temp.comment = "The number of tickets a player can be assigned instead of a mod. This is shared across all mods and it is up to the mods to use it."; + temp.setComment("The number of tickets a player can be assigned instead of a mod. This is shared across all mods and it is up to the mods to use it."); temp.setLanguageKey("forge.configgui.playerTicketCount"); temp.setMinValue(0); playerTicketLength = temp.getInt(500); propOrder.add("playerTicketCount"); temp = config.get("defaults", "dormantChunkCacheSize", 0); - temp.comment = "Unloaded chunks can first be kept in a dormant cache for quicker\n" + - "loading times. Specify the size (in chunks) of that cache here"; + temp.setComment("Unloaded chunks can first be kept in a dormant cache for quicker\n" + + "loading times. Specify the size (in chunks) of that cache here"); temp.setLanguageKey("forge.configgui.dormantChunkCacheSize"); temp.setMinValue(0); dormantChunkCacheSize = temp.getInt(0); @@ -1048,9 +1048,9 @@ public class ForgeChunkManager "for that mod"); temp = config.get("Forge", "maximumTicketCount", 200); - temp.comment = "Maximum ticket count for the mod. Zero disables chunkloading capabilities."; + temp.setComment("Maximum ticket count for the mod. Zero disables chunkloading capabilities."); temp = config.get("Forge", "maximumChunksPerTicket", 25); - temp.comment = "Maximum chunks per ticket for the mod."; + temp.setComment("Maximum chunks per ticket for the mod."); for (String mod : config.getCategoryNames()) { if (mod.equals("Forge") || mod.equals("defaults")) diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 1a475e0544..a58281933e 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -777,15 +777,15 @@ public class ForgeHooks for (BlockSnapshot snap : blockSnapshots) { - int updateFlag = snap.flag; - IBlockState oldBlock = snap.replacedBlock; - IBlockState newBlock = world.getBlockState(snap.pos); + int updateFlag = snap.getFlag(); + IBlockState oldBlock = snap.getReplacedBlock(); + IBlockState newBlock = world.getBlockState(snap.getPos()); if (newBlock != null && !(newBlock.getBlock().hasTileEntity(newBlock))) // Containers get placed automatically { - newBlock.getBlock().onBlockAdded(world, snap.pos, newBlock); + newBlock.getBlock().onBlockAdded(world, snap.getPos(), newBlock); } - world.markAndNotifyBlock(snap.pos, null, oldBlock, newBlock, updateFlag); + world.markAndNotifyBlock(snap.getPos(), null, oldBlock, newBlock, updateFlag); } player.addStat(StatList.func_188060_a(itemstack.getItem())); } diff --git a/src/main/java/net/minecraftforge/common/ForgeModContainer.java b/src/main/java/net/minecraftforge/common/ForgeModContainer.java index cf4dd7722e..d4a61a4ad5 100644 --- a/src/main/java/net/minecraftforge/common/ForgeModContainer.java +++ b/src/main/java/net/minecraftforge/common/ForgeModContainer.java @@ -149,7 +149,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC Property prop; prop = config.get(CATEGORY_GENERAL, "disableVersionCheck", false); - prop.comment = "Set to true to disable Forge's version check mechanics. Forge queries a small json file on our server for version information. For more details see the ForgeVersion class in our github."; + prop.setComment("Set to true to disable Forge's version check mechanics. Forge queries a small json file on our server for version information. For more details see the ForgeVersion class in our github."); // Language keys are a good idea to implement if you are using config GUIs. This allows you to use a .lang file that will hold the // "pretty" version of the property name as well as allow others to provide their own localizations. // This language key is also used to get the tooltip for a property. The tooltip language key is langKey + ".tooltip". @@ -170,13 +170,13 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC propOrder.add(prop.getName()); prop = config.get(CATEGORY_GENERAL, "sortRecipies", true); - prop.comment = "Set to true to enable the post initialization sorting of crafting recipes using Forge's sorter. May cause desyncing on conflicting recipes. MUST RESTART MINECRAFT IF CHANGED FROM THE CONFIG GUI."; + prop.setComment("Set to true to enable the post initialization sorting of crafting recipes using Forge's sorter. May cause desyncing on conflicting recipes. MUST RESTART MINECRAFT IF CHANGED FROM THE CONFIG GUI."); prop.setLanguageKey("forge.configgui.sortRecipies").setRequiresMcRestart(true); shouldSortRecipies = prop.getBoolean(shouldSortRecipies); propOrder.add(prop.getName()); prop = config.get(Configuration.CATEGORY_GENERAL, "removeErroringEntities", false); - prop.comment = "Set this to true to remove any Entity that throws an error in its update method instead of closing the server and reporting a crash log. BE WARNED THIS COULD SCREW UP EVERYTHING USE SPARINGLY WE ARE NOT RESPONSIBLE FOR DAMAGES."; + prop.setComment("Set this to true to remove any Entity that throws an error in its update method instead of closing the server and reporting a crash log. BE WARNED THIS COULD SCREW UP EVERYTHING USE SPARINGLY WE ARE NOT RESPONSIBLE FOR DAMAGES."); prop.setLanguageKey("forge.configgui.removeErroringEntities").setRequiresWorldRestart(true); removeErroringEntities = prop.getBoolean(false); propOrder.add(prop.getName()); @@ -187,7 +187,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC } prop = config.get(Configuration.CATEGORY_GENERAL, "removeErroringTileEntities", false); - prop.comment = "Set this to true to remove any TileEntity that throws an error in its update method instead of closing the server and reporting a crash log. BE WARNED THIS COULD SCREW UP EVERYTHING USE SPARINGLY WE ARE NOT RESPONSIBLE FOR DAMAGES."; + prop.setComment("Set this to true to remove any TileEntity that throws an error in its update method instead of closing the server and reporting a crash log. BE WARNED THIS COULD SCREW UP EVERYTHING USE SPARINGLY WE ARE NOT RESPONSIBLE FOR DAMAGES."); prop.setLanguageKey("forge.configgui.removeErroringTileEntities").setRequiresWorldRestart(true); removeErroringTileEntities = prop.getBoolean(false); propOrder.add(prop.getName()); @@ -198,17 +198,17 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC } prop = config.get(Configuration.CATEGORY_GENERAL, "disableStitchedFileSaving", true); - prop.comment = "Set this to just disable the texture stitcher from writing the '{name}_{mipmap}.png files to disc. Just a small performance tweak. Default: true"; + prop.setComment("Set this to just disable the texture stitcher from writing the '{name}_{mipmap}.png files to disc. Just a small performance tweak. Default: true"); disableStitchedFileSaving = prop.getBoolean(true); prop = config.get(Configuration.CATEGORY_GENERAL, "fullBoundingBoxLadders", false); - prop.comment = "Set this to true to check the entire entity's collision bounding box for ladders instead of just the block they are in. Causes noticeable differences in mechanics so default is vanilla behavior. Default: false"; + prop.setComment("Set this to true to check the entire entity's collision bounding box for ladders instead of just the block they are in. Causes noticeable differences in mechanics so default is vanilla behavior. Default: false"); prop.setLanguageKey("forge.configgui.fullBoundingBoxLadders").setRequiresWorldRestart(true); fullBoundingBoxLadders = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Configuration.CATEGORY_GENERAL, "biomeSkyBlendRange", new int[] { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34 }); - prop.comment = "Control the range of sky blending for colored skies in biomes."; + prop.setComment("Control the range of sky blending for colored skies in biomes."); prop.setLanguageKey("forge.configgui.biomeSkyBlendRange"); blendRanges = prop.getIntList(); propOrder.add(prop.getName()); @@ -274,18 +274,18 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC @SubscribeEvent public void onConfigChanged(OnConfigChangedEvent event) { - if (getMetadata().modId.equals(event.modID) && !event.isWorldRunning) + if (getMetadata().modId.equals(event.getModID()) && !event.isWorldRunning()) { - if (Configuration.CATEGORY_GENERAL.equals(event.configID)) + if (Configuration.CATEGORY_GENERAL.equals(event.getConfigID())) { syncConfig(false); } - else if ("chunkLoader".equals(event.configID)) + else if ("chunkLoader".equals(event.getConfigID())) { ForgeChunkManager.syncConfigDefaults(); ForgeChunkManager.loadConfiguration(); } - else if (VERSION_CHECK_CAT.equals(event.configID)) + else if (VERSION_CHECK_CAT.equals(event.getConfigID())) { syncConfig(false); } diff --git a/src/main/java/net/minecraftforge/common/brewing/AbstractBrewingRecipe.java b/src/main/java/net/minecraftforge/common/brewing/AbstractBrewingRecipe.java index ceb3dd15af..278abffbbb 100644 --- a/src/main/java/net/minecraftforge/common/brewing/AbstractBrewingRecipe.java +++ b/src/main/java/net/minecraftforge/common/brewing/AbstractBrewingRecipe.java @@ -5,9 +5,9 @@ import net.minecraftforge.oredict.OreDictionary; public abstract class AbstractBrewingRecipe implements IBrewingRecipe { - public final ItemStack input; - public final T ingredient; - public final ItemStack output; + private final ItemStack input; + private final T ingredient; + private final ItemStack output; protected AbstractBrewingRecipe(ItemStack input, T ingredient, ItemStack output) { @@ -15,12 +15,12 @@ public abstract class AbstractBrewingRecipe implements IBrewingRecipe { this.ingredient = ingredient; this.output = output; - if (this.input == null || this.ingredient == null || this.output == null) + if (this.getInput() == null || this.getIngredient() == null || this.getOutput() == null) { throw new IllegalArgumentException("A brewing recipe cannot have a null parameter."); } - if (this.input.getMaxStackSize() != 1) + if (this.getInput().getMaxStackSize() != 1) { throw new IllegalArgumentException("Inputs must have a max size of 1 just like water bottles. Brewing Stands override the input with the output when the brewing is done, items that stack would end up getting lost."); } @@ -29,12 +29,27 @@ public abstract class AbstractBrewingRecipe implements IBrewingRecipe { @Override public boolean isInput(ItemStack stack) { - return OreDictionary.itemMatches(this.input, stack, false); + return OreDictionary.itemMatches(this.getInput(), stack, false); } @Override public ItemStack getOutput(ItemStack input, ItemStack ingredient) { - return isInput(input) && isIngredient(ingredient) ? ItemStack.copyItemStack(output) : null; + return isInput(input) && isIngredient(ingredient) ? ItemStack.copyItemStack(getOutput()) : null; + } + + public ItemStack getInput() + { + return input; + } + + public T getIngredient() + { + return ingredient; + } + + public ItemStack getOutput() + { + return output; } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/common/brewing/BrewingOreRecipe.java b/src/main/java/net/minecraftforge/common/brewing/BrewingOreRecipe.java index 8ac625cb94..57bd51128d 100644 --- a/src/main/java/net/minecraftforge/common/brewing/BrewingOreRecipe.java +++ b/src/main/java/net/minecraftforge/common/brewing/BrewingOreRecipe.java @@ -19,7 +19,7 @@ public class BrewingOreRecipe extends AbstractBrewingRecipe> { @Override public boolean isIngredient(ItemStack stack) { - for (ItemStack target : this.ingredient) + for (ItemStack target : this.getIngredient()) { if (OreDictionary.itemMatches(target, stack, false)) { diff --git a/src/main/java/net/minecraftforge/common/brewing/BrewingRecipe.java b/src/main/java/net/minecraftforge/common/brewing/BrewingRecipe.java index e2b6ce9068..1ce78812ad 100644 --- a/src/main/java/net/minecraftforge/common/brewing/BrewingRecipe.java +++ b/src/main/java/net/minecraftforge/common/brewing/BrewingRecipe.java @@ -13,6 +13,6 @@ public class BrewingRecipe extends AbstractBrewingRecipe { @Override public boolean isIngredient(ItemStack stack) { - return OreDictionary.itemMatches(this.ingredient, stack, false); + return OreDictionary.itemMatches(this.getIngredient(), stack, false); } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/common/config/ConfigCategory.java b/src/main/java/net/minecraftforge/common/config/ConfigCategory.java index f90938a10d..a98b194afd 100644 --- a/src/main/java/net/minecraftforge/common/config/ConfigCategory.java +++ b/src/main/java/net/minecraftforge/common/config/ConfigCategory.java @@ -286,7 +286,7 @@ public class ConfigCategory implements Map { Property prop = props[x]; - if (prop.comment != null && !prop.comment.isEmpty()) + if (prop.getComment() != null && !prop.getComment().isEmpty()) { if (x != 0) { @@ -294,7 +294,7 @@ public class ConfigCategory implements Map } Splitter splitter = Splitter.onPattern("\r?\n"); - for (String commentLine : splitter.split(prop.comment)) + for (String commentLine : splitter.split(prop.getComment())) { write(out, pad1, "# ", commentLine); } diff --git a/src/main/java/net/minecraftforge/common/config/ConfigElement.java b/src/main/java/net/minecraftforge/common/config/ConfigElement.java index a6a196be53..d09689d05d 100644 --- a/src/main/java/net/minecraftforge/common/config/ConfigElement.java +++ b/src/main/java/net/minecraftforge/common/config/ConfigElement.java @@ -148,7 +148,7 @@ public class ConfigElement implements IConfigElement @Override public String getComment() { - return isProperty ? prop.comment : category.getComment(); + return isProperty ? prop.getComment() : category.getComment(); } @Override diff --git a/src/main/java/net/minecraftforge/common/config/Configuration.java b/src/main/java/net/minecraftforge/common/config/Configuration.java index 573c21a89e..13c34e06c8 100644 --- a/src/main/java/net/minecraftforge/common/config/Configuration.java +++ b/src/main/java/net/minecraftforge/common/config/Configuration.java @@ -706,7 +706,7 @@ public class Configuration } prop.setDefaultValue(defaultValue); - prop.comment = comment; + prop.setComment(comment); return prop; } else if (defaultValue != null) @@ -715,7 +715,7 @@ public class Configuration prop.setValue(defaultValue); //Set and mark as dirty to signify it should save cat.put(key, prop); prop.setDefaultValue(defaultValue); - prop.comment = comment; + prop.setComment(comment); return prop; } else @@ -754,7 +754,7 @@ public class Configuration } prop.setDefaultValues(defaultValues); - prop.comment = comment; + prop.setComment(comment); return prop; } @@ -762,7 +762,7 @@ public class Configuration { Property prop = new Property(key, defaultValues, type); prop.setDefaultValues(defaultValues); - prop.comment = comment; + prop.setComment(comment); cat.put(key, prop); return prop; } @@ -1517,7 +1517,7 @@ public class Configuration Property prop = this.get(category, name, defaultValue); prop.setLanguageKey(langKey); prop.setValidationPattern(pattern); - prop.comment = comment + " [default: " + defaultValue + "]"; + prop.setComment(comment + " [default: " + defaultValue + "]"); return prop.getString(); } @@ -1552,7 +1552,7 @@ public class Configuration Property prop = this.get(category, name, defaultValue); prop.setValidValues(validValues); prop.setLanguageKey(langKey); - prop.comment = comment + " [default: " + defaultValue + "]"; + prop.setComment(comment + " [default: " + defaultValue + "]"); return prop.getString(); } @@ -1598,7 +1598,7 @@ public class Configuration Property prop = this.get(category, name, defaultValue); prop.setLanguageKey(langKey); prop.setValidValues(validValues); - prop.comment = comment + " [default: " + prop.getDefault() + "]"; + prop.setComment(comment + " [default: " + prop.getDefault() + "]"); return prop.getStringList(); } @@ -1630,7 +1630,7 @@ public class Configuration { Property prop = this.get(category, name, defaultValue); prop.setLanguageKey(langKey); - prop.comment = comment + " [default: " + defaultValue + "]"; + prop.setComment(comment + " [default: " + defaultValue + "]"); return prop.getBoolean(defaultValue); } @@ -1666,7 +1666,7 @@ public class Configuration { Property prop = this.get(category, name, defaultValue); prop.setLanguageKey(langKey); - prop.comment = comment + " [range: " + minValue + " ~ " + maxValue + ", default: " + defaultValue + "]"; + prop.setComment(comment + " [range: " + minValue + " ~ " + maxValue + ", default: " + defaultValue + "]"); prop.setMinValue(minValue); prop.setMaxValue(maxValue); return prop.getInt(defaultValue) < minValue ? minValue : (prop.getInt(defaultValue) > maxValue ? maxValue : prop.getInt(defaultValue)); @@ -1704,7 +1704,7 @@ public class Configuration { Property prop = this.get(category, name, Float.toString(defaultValue), name); prop.setLanguageKey(langKey); - prop.comment = comment + " [range: " + minValue + " ~ " + maxValue + ", default: " + defaultValue + "]"; + prop.setComment(comment + " [range: " + minValue + " ~ " + maxValue + ", default: " + defaultValue + "]"); prop.setMinValue(minValue); prop.setMaxValue(maxValue); try diff --git a/src/main/java/net/minecraftforge/common/config/Property.java b/src/main/java/net/minecraftforge/common/config/Property.java index 094ad0c49a..db85afed2b 100644 --- a/src/main/java/net/minecraftforge/common/config/Property.java +++ b/src/main/java/net/minecraftforge/common/config/Property.java @@ -14,6 +14,16 @@ import net.minecraftforge.fml.client.config.GuiEditArrayEntries.IArrayEntry; public class Property { + public String getComment() + { + return comment; + } + + public void setComment(String comment) + { + this.comment = comment; + } + public enum Type { STRING, @@ -45,7 +55,7 @@ public class Property private String name; private String value; private String defaultValue; - public String comment; + private String comment; private String[] values; private String[] defaultValues; private String[] validValues; @@ -113,7 +123,7 @@ public class Property this.minValue = String.valueOf(Integer.MIN_VALUE); this.maxValue = String.valueOf(Integer.MAX_VALUE); this.langKey = langKey; - this.comment = ""; + this.setComment(""); } public Property(String name, String[] values, Type type) @@ -155,7 +165,7 @@ public class Property this.minValue = String.valueOf(Integer.MIN_VALUE); this.maxValue = String.valueOf(Integer.MAX_VALUE); this.langKey = langKey; - this.comment = ""; + this.setComment(""); } /** diff --git a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java index c1de2a376f..1e29527a7d 100644 --- a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java +++ b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java @@ -5,11 +5,11 @@ import java.io.Serializable; import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.fml.common.registry.GameRegistry.UniqueIdentifier; /** * Represents a captured snapshot of a block which will not change @@ -23,57 +23,57 @@ public class BlockSnapshot implements Serializable { private static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("forge.debugBlockSnapshot", "false")); - public final BlockPos pos; - public final int dimId; - public transient IBlockState replacedBlock; - public int flag; + private final BlockPos pos; + private final int dimId; + private transient IBlockState replacedBlock; + private int flag; private final NBTTagCompound nbt; - public transient World world; - public final UniqueIdentifier blockIdentifier; - public final int meta; + private transient World world; + private final ResourceLocation registryName; + private final int meta; public BlockSnapshot(World world, BlockPos pos, IBlockState state) { - this.world = world; + this.setWorld(world); this.dimId = world.provider.getDimension(); this.pos = pos; - this.replacedBlock = state; - this.blockIdentifier = GameRegistry.findUniqueIdentifierFor(state.getBlock()); + this.setReplacedBlock(state); + this.registryName = new ResourceLocation(state.getBlock().getRegistryName()); this.meta = state.getBlock().getMetaFromState(state); - this.flag = 3; + this.setFlag(3); TileEntity te = world.getTileEntity(pos); if (te != null) { nbt = new NBTTagCompound(); - te.writeToNBT(nbt); + te.writeToNBT(getNbt()); } else nbt = null; if (DEBUG) { - System.out.printf("Created BlockSnapshot - [World: %s ][Location: %d,%d,%d ][Block: %s ][Meta: %d ]", world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ(), blockIdentifier, meta); + System.out.printf("Created BlockSnapshot - [World: %s ][Location: %d,%d,%d ][Block: %s ][Meta: %d ]", world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ(), getRegistryName(), getMeta()); } } public BlockSnapshot(World world, BlockPos pos, IBlockState state, NBTTagCompound nbt) { - this.world = world; + this.setWorld(world); this.dimId = world.provider.getDimension(); this.pos = pos.getImmutable(); - this.replacedBlock = state; - this.blockIdentifier = GameRegistry.findUniqueIdentifierFor(state.getBlock()); + this.setReplacedBlock(state); + this.registryName = new ResourceLocation(state.getBlock().getRegistryName()); this.meta = state.getBlock().getMetaFromState(state); - this.flag = 3; + this.setFlag(3); this.nbt = nbt; if (DEBUG) { - System.out.printf("Created BlockSnapshot - [World: %s ][Location: %d,%d,%d ][Block: %s ][Meta: %d ]", world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ(), blockIdentifier, meta); + System.out.printf("Created BlockSnapshot - [World: %s ][Location: %d,%d,%d ][Block: %s ][Meta: %d ]", world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ(), getRegistryName(), getMeta()); } } public BlockSnapshot(World world, BlockPos pos, IBlockState state, int flag) { this(world, pos, state); - this.flag = flag; + this.setFlag(flag); } /** @@ -83,8 +83,8 @@ public class BlockSnapshot implements Serializable { this.dimId = dimension; this.pos = pos.getImmutable(); - this.flag = flag; - this.blockIdentifier = new UniqueIdentifier(modId + ":" + blockName); + this.setFlag(flag); + this.registryName = new ResourceLocation(modId, blockName); this.meta = meta; this.nbt = nbt; } @@ -115,14 +115,14 @@ public class BlockSnapshot implements Serializable public IBlockState getCurrentBlock() { - return world.getBlockState(pos); + return getWorld().getBlockState(getPos()); } public World getWorld() { if (this.world == null) { - this.world = DimensionManager.getWorld(dimId); + this.world = DimensionManager.getWorld(getDimId()); } return this.world; } @@ -131,15 +131,15 @@ public class BlockSnapshot implements Serializable { if (this.replacedBlock == null) { - this.replacedBlock = GameRegistry.findBlock(this.blockIdentifier.modId, this.blockIdentifier.name).getStateFromMeta(meta); + this.replacedBlock = GameRegistry.findBlock(this.getRegistryName().getResourceDomain(), this.getRegistryName().getResourcePath()).getStateFromMeta(getMeta()); } return this.replacedBlock; } public TileEntity getTileEntity() { - if (nbt != null) - return TileEntity.createTileEntity(getWorld().getMinecraftServer(), nbt); + if (getNbt() != null) + return TileEntity.createTileEntity(getWorld().getMinecraftServer(), getNbt()); else return null; } @@ -161,7 +161,7 @@ public class BlockSnapshot implements Serializable { if (force) { - world.setBlockState(pos, replaced, applyPhysics ? 3 : 2); + getWorld().setBlockState(getPos(), replaced, applyPhysics ? 3 : 2); } else { @@ -169,21 +169,21 @@ public class BlockSnapshot implements Serializable } } - world.setBlockState(pos, replaced, applyPhysics ? 3 : 2); - world.notifyBlockUpdate(pos, current, replaced, applyPhysics ? 3 : 2); + getWorld().setBlockState(getPos(), replaced, applyPhysics ? 3 : 2); + getWorld().notifyBlockUpdate(getPos(), current, replaced, applyPhysics ? 3 : 2); TileEntity te = null; - if (nbt != null) + if (getNbt() != null) { - te = world.getTileEntity(pos); + te = getWorld().getTileEntity(getPos()); if (te != null) { - te.readFromNBT(nbt); + te.readFromNBT(getNbt()); } } if (DEBUG) { - System.out.printf("Restored BlockSnapshot with data [World: %s ][Location: %d,%d,%d ][Meta: %d ][Block: %s ][TileEntity: %s ][force: %s ][applyPhysics: %s]", world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ(), replaced.getBlock().getMetaFromState(replaced), replaced.getBlock().delegate.name(), te, force, applyPhysics); + System.out.printf("Restored BlockSnapshot with data [World: %s ][Location: %d,%d,%d ][Meta: %d ][Block: %s ][TileEntity: %s ][force: %s ][applyPhysics: %s]", getWorld().getWorldInfo().getWorldName(), getPos().getX(), getPos().getY(), getPos().getZ(), replaced.getBlock().getMetaFromState(replaced), replaced.getBlock().delegate.name(), te, force, applyPhysics); } return true; } @@ -207,12 +207,12 @@ public class BlockSnapshot implements Serializable world.setBlockState(pos, replaced, applyPhysics ? 3 : 2); world.notifyBlockUpdate(pos, current, replaced, applyPhysics ? 3 : 2); TileEntity te = null; - if (nbt != null) + if (getNbt() != null) { te = world.getTileEntity(pos); if (te != null) { - te.readFromNBT(nbt); + te.readFromNBT(getNbt()); } } @@ -225,20 +225,20 @@ public class BlockSnapshot implements Serializable public void writeToNBT(NBTTagCompound compound) { - compound.setString("blockMod", blockIdentifier.modId); - compound.setString("blockName", blockIdentifier.name); - compound.setInteger("posX", pos.getX()); - compound.setInteger("posY", pos.getY()); - compound.setInteger("posZ", pos.getZ()); - compound.setInteger("flag", flag); - compound.setInteger("dimension", dimId); - compound.setInteger("metadata", meta); + compound.setString("blockMod", getRegistryName().getResourceDomain()); + compound.setString("blockName", getRegistryName().getResourcePath()); + compound.setInteger("posX", getPos().getX()); + compound.setInteger("posY", getPos().getY()); + compound.setInteger("posZ", getPos().getZ()); + compound.setInteger("flag", getFlag()); + compound.setInteger("dimension", getDimId()); + compound.setInteger("metadata", getMeta()); - compound.setBoolean("hasTE", nbt != null); + compound.setBoolean("hasTE", getNbt() != null); - if (nbt != null) + if (getNbt() != null) { - compound.setTag("tileEntity", nbt); + compound.setTag("tileEntity", getNbt()); } } @@ -254,27 +254,27 @@ public class BlockSnapshot implements Serializable return false; } final BlockSnapshot other = (BlockSnapshot) obj; - if (!this.pos.equals(other.pos)) + if (!this.getPos().equals(other.getPos())) { return false; } - if (this.meta != other.meta) + if (this.getMeta() != other.getMeta()) { return false; } - if (this.dimId != other.dimId) + if (this.getDimId() != other.getDimId()) { return false; } - if (this.nbt != other.nbt && (this.nbt == null || !this.nbt.equals(other.nbt))) + if (this.getNbt() != other.getNbt() && (this.getNbt() == null || !this.getNbt().equals(other.getNbt()))) { return false; } - if (this.world != other.world && (this.world == null || !this.world.equals(other.world))) + if (this.getWorld() != other.getWorld() && (this.getWorld() == null || !this.getWorld().equals(other.getWorld()))) { return false; } - if (this.blockIdentifier != other.blockIdentifier && (this.blockIdentifier == null || !this.blockIdentifier.equals(other.blockIdentifier))) + if (this.getRegistryName() != other.getRegistryName() && (this.getRegistryName() == null || !this.getRegistryName().equals(other.getRegistryName()))) { return false; } @@ -285,14 +285,24 @@ public class BlockSnapshot implements Serializable public int hashCode() { int hash = 7; - hash = 73 * hash + this.pos.getX(); - hash = 73 * hash + this.pos.getY(); - hash = 73 * hash + this.pos.getZ(); - hash = 73 * hash + this.meta; - hash = 73 * hash + this.dimId; - hash = 73 * hash + (this.nbt != null ? this.nbt.hashCode() : 0); - hash = 73 * hash + (this.world != null ? this.world.hashCode() : 0); - hash = 73 * hash + (this.blockIdentifier != null ? this.blockIdentifier.hashCode() : 0); + hash = 73 * hash + this.getPos().getX(); + hash = 73 * hash + this.getPos().getY(); + hash = 73 * hash + this.getPos().getZ(); + hash = 73 * hash + this.getMeta(); + hash = 73 * hash + this.getDimId(); + hash = 73 * hash + (this.getNbt() != null ? this.getNbt().hashCode() : 0); + hash = 73 * hash + (this.getWorld() != null ? this.getWorld().hashCode() : 0); + hash = 73 * hash + (this.getRegistryName() != null ? this.getRegistryName().hashCode() : 0); return hash; } + + public BlockPos getPos() { return pos; } + public int getDimId() { return dimId; } + public void setReplacedBlock(IBlockState replacedBlock) { this.replacedBlock = replacedBlock; } + public int getFlag() { return flag; } + public void setFlag(int flag) { this.flag = flag; } + public NBTTagCompound getNbt() { return nbt; } + public void setWorld(World world) { this.world = world; } + public ResourceLocation getRegistryName() { return registryName; } + public int getMeta() { return meta; } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index 99f18e3fba..14ce1536ee 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -94,7 +94,7 @@ public class ForgeEventFactory public static MultiPlaceEvent onPlayerMultiBlockPlace(EntityPlayer player, List blockSnapshots, EnumFacing direction) { BlockSnapshot snap = blockSnapshots.get(0); - IBlockState placedAgainst = snap.world.getBlockState(snap.pos.offset(direction.getOpposite())); + IBlockState placedAgainst = snap.getWorld().getBlockState(snap.getPos().offset(direction.getOpposite())); MultiPlaceEvent event = new MultiPlaceEvent(blockSnapshots, placedAgainst, player); MinecraftForge.EVENT_BUS.post(event); return event; @@ -102,7 +102,7 @@ public class ForgeEventFactory public static PlaceEvent onPlayerBlockPlace(EntityPlayer player, BlockSnapshot blockSnapshot, EnumFacing direction) { - IBlockState placedAgainst = blockSnapshot.world.getBlockState(blockSnapshot.pos.offset(direction.getOpposite())); + IBlockState placedAgainst = blockSnapshot.getWorld().getBlockState(blockSnapshot.getPos().offset(direction.getOpposite())); PlaceEvent event = new PlaceEvent(blockSnapshot, placedAgainst, player); MinecraftForge.EVENT_BUS.post(event); return event; diff --git a/src/main/java/net/minecraftforge/event/world/BlockEvent.java b/src/main/java/net/minecraftforge/event/world/BlockEvent.java index 47d620bd86..01b90398f3 100644 --- a/src/main/java/net/minecraftforge/event/world/BlockEvent.java +++ b/src/main/java/net/minecraftforge/event/world/BlockEvent.java @@ -154,7 +154,7 @@ public class BlockEvent extends Event public PlaceEvent(BlockSnapshot blockSnapshot, IBlockState placedAgainst, EntityPlayer player) { - super(blockSnapshot.world, blockSnapshot.pos, blockSnapshot.getCurrentBlock()); + super(blockSnapshot.getWorld(), blockSnapshot.getPos(), blockSnapshot.getCurrentBlock()); this.player = player; this.itemInHand = player.getHeldItemMainhand(); this.blockSnapshot = blockSnapshot; diff --git a/src/main/java/net/minecraftforge/fluids/FluidEvent.java b/src/main/java/net/minecraftforge/fluids/FluidEvent.java index 7bb34f14ea..73427962c3 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidEvent.java +++ b/src/main/java/net/minecraftforge/fluids/FluidEvent.java @@ -8,9 +8,9 @@ import net.minecraftforge.fml.common.eventhandler.Event; public class FluidEvent extends Event { - public final FluidStack fluid; - public final World world; - public final BlockPos pos; + private final FluidStack fluid; + private final World world; + private final BlockPos pos; public FluidEvent(FluidStack fluid, World world, BlockPos pos) { @@ -19,6 +19,21 @@ public class FluidEvent extends Event this.pos = pos; } + public FluidStack getFluid() + { + return fluid; + } + + public World getWorld() + { + return world; + } + + public BlockPos getPos() + { + return pos; + } + /** * Mods should fire this event when they move fluids around. * @@ -38,8 +53,8 @@ public class FluidEvent extends Event */ public static class FluidFillingEvent extends FluidEvent { - public final IFluidTank tank; - public final int amount; + private final IFluidTank tank; + private final int amount; public FluidFillingEvent(FluidStack fluid, World world, BlockPos pos, IFluidTank tank, int amount) { @@ -47,6 +62,16 @@ public class FluidEvent extends Event this.tank = tank; this.amount = amount; } + + public IFluidTank getTank() + { + return tank; + } + + public int getAmount() + { + return amount; + } } /** @@ -56,8 +81,8 @@ public class FluidEvent extends Event */ public static class FluidDrainingEvent extends FluidEvent { - public final IFluidTank tank; - public final int amount; + private final IFluidTank tank; + private final int amount; public FluidDrainingEvent(FluidStack fluid, World world, BlockPos pos, IFluidTank tank, int amount) { @@ -65,6 +90,16 @@ public class FluidEvent extends Event this.amount = amount; this.tank = tank; } + + public IFluidTank getTank() + { + return tank; + } + + public int getAmount() + { + return amount; + } } /** diff --git a/src/main/java/net/minecraftforge/fluids/UniversalBucket.java b/src/main/java/net/minecraftforge/fluids/UniversalBucket.java index 0c612204ca..751b99b36c 100644 --- a/src/main/java/net/minecraftforge/fluids/UniversalBucket.java +++ b/src/main/java/net/minecraftforge/fluids/UniversalBucket.java @@ -36,9 +36,9 @@ import java.util.List; public class UniversalBucket extends Item implements IFluidContainerItem { - public final int capacity; // how much the bucket holds - public final ItemStack empty; // empty item to return and recognize when filling - public final boolean nbtSensitive; + private final int capacity; // how much the bucket holds + private final ItemStack empty; // empty item to return and recognize when filling + private final boolean nbtSensitive; public UniversalBucket() { @@ -68,7 +68,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) { // add all fluids that the bucket can be filled with - FluidStack fs = new FluidStack(fluid, capacity); + FluidStack fs = new FluidStack(fluid, getCapacity()); ItemStack stack = new ItemStack(this); if (fill(stack, fs, true) == fs.amount) { @@ -83,9 +83,9 @@ public class UniversalBucket extends Item implements IFluidContainerItem FluidStack fluidStack = getFluid(stack); if (fluidStack == null) { - if(empty != null) + if(getEmpty() != null) { - return empty.getDisplayName(); + return getEmpty().getDisplayName(); } return super.getItemStackDisplayName(stack); } @@ -132,7 +132,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem player.addStat(StatList.func_188057_b(this)); itemstack.stackSize--; - ItemStack emptyStack = empty != null ? empty.copy() : new ItemStack(this); + ItemStack emptyStack = getEmpty() != null ? getEmpty().copy() : new ItemStack(this); // check whether we replace the item or add the empty one to the inventory if (itemstack.stackSize <= 0) @@ -210,8 +210,8 @@ public class UniversalBucket extends Item implements IFluidContainerItem // not for us to handle if (event.getEmptyBucket() == null || - !event.getEmptyBucket().isItemEqual(empty) || - (nbtSensitive && ItemStack.areItemStackTagsEqual(event.getEmptyBucket(), empty))) + !event.getEmptyBucket().isItemEqual(getEmpty()) || + (isNbtSensitive() && ItemStack.areItemStackTagsEqual(event.getEmptyBucket(), getEmpty()))) { return; } @@ -233,7 +233,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem { FluidStack drained = fluidBlock.drain(world, pos, false); // check if it fits exactly - if (drained != null && drained.amount == capacity) + if (drained != null && drained.amount == getCapacity()) { // check if the container accepts it ItemStack filledBucket = new ItemStack(this); @@ -262,7 +262,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem public static ItemStack getFilledBucket(UniversalBucket item, Fluid fluid) { ItemStack stack = new ItemStack(item); - item.fill(stack, new FluidStack(fluid, item.capacity), true); + item.fill(stack, new FluidStack(fluid, item.getCapacity()), true); return stack; } @@ -277,7 +277,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem @Override public int getCapacity(ItemStack container) { - return capacity; + return getCapacity(); } @Override @@ -290,7 +290,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem } // can only fill exact capacity - if (resource == null || resource.amount != capacity) + if (resource == null || resource.amount != getCapacity()) { return 0; } @@ -310,14 +310,14 @@ public class UniversalBucket extends Item implements IFluidContainerItem resource.writeToNBT(tag); container.setTagCompound(tag); } - return capacity; + return getCapacity(); } @Override public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) { // can only drain everything at once - if (maxDrain < capacity) + if (maxDrain < getCapacity()) { return null; } @@ -325,11 +325,11 @@ public class UniversalBucket extends Item implements IFluidContainerItem FluidStack fluidStack = getFluid(container); if (doDrain && fluidStack != null) { - if(empty != null) + if(getEmpty() != null) { - container.setItem(empty.getItem()); - container.setTagCompound(empty.getTagCompound()); - container.setItemDamage(empty.getItemDamage()); + container.setItem(getEmpty().getItem()); + container.setTagCompound(getEmpty().getTagCompound()); + container.setItemDamage(getEmpty().getItemDamage()); } else { container.stackSize = 0; @@ -338,4 +338,19 @@ public class UniversalBucket extends Item implements IFluidContainerItem return fluidStack; } + + public int getCapacity() + { + return capacity; + } + + public ItemStack getEmpty() + { + return empty; + } + + public boolean isNbtSensitive() + { + return nbtSensitive; + } } diff --git a/src/main/java/net/minecraftforge/fml/client/event/ConfigChangedEvent.java b/src/main/java/net/minecraftforge/fml/client/event/ConfigChangedEvent.java index 1eaaf89106..f7c78344c2 100644 --- a/src/main/java/net/minecraftforge/fml/client/event/ConfigChangedEvent.java +++ b/src/main/java/net/minecraftforge/fml/client/event/ConfigChangedEvent.java @@ -29,23 +29,11 @@ import net.minecraftforge.fml.common.eventhandler.Event.HasResult; @HasResult public class ConfigChangedEvent extends Event { - /** - * The Mod ID of the mod whose configuration just changed. - */ - public final String modID; - /** - * Whether or not a world is currently running. - */ - public final boolean isWorldRunning; - /** - * Will be set to true if any elements were changed that require a restart of Minecraft. - */ - public final boolean requiresMcRestart; - /** - * A String identifier for this ConfigChangedEvent. - */ - public final String configID; - + private final String modID; + private final boolean isWorldRunning; + private final boolean requiresMcRestart; + private final String configID; + public ConfigChangedEvent(String modID, String configID, boolean isWorldRunning, boolean requiresMcRestart) { this.modID = modID; @@ -53,7 +41,39 @@ public class ConfigChangedEvent extends Event this.isWorldRunning = isWorldRunning; this.requiresMcRestart = requiresMcRestart; } - + + /** + * The Mod ID of the mod whose configuration just changed. + */ + public String getModID() + { + return modID; + } + + /** + * Whether or not a world is currently running. + */ + public boolean isWorldRunning() + { + return isWorldRunning; + } + + /** + * Will be set to true if any elements were changed that require a restart of Minecraft. + */ + public boolean isRequiresMcRestart() + { + return requiresMcRestart; + } + + /** + * A String identifier for this ConfigChangedEvent. + */ + public String getConfigID() + { + return configID; + } + /** * This event is intended to be consumed by the mod whose config has been changed. It fires when the Done button * has been clicked on a GuiConfig screen and the following conditions are met:
diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLFingerprintViolationEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLFingerprintViolationEvent.java index 3f351563f2..d8ffc28916 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLFingerprintViolationEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLFingerprintViolationEvent.java @@ -25,10 +25,10 @@ import net.minecraftforge.fml.common.Mod; */ public class FMLFingerprintViolationEvent extends FMLEvent { - public final boolean isDirectory; - public final Set fingerprints; - public final File source; - public final String expectedFingerprint; + private final boolean isDirectory; + private final Set fingerprints; + private final File source; + private final String expectedFingerprint; public FMLFingerprintViolationEvent(boolean isDirectory, File source, ImmutableSet fingerprints, String expectedFingerprint) { @@ -38,4 +38,9 @@ public class FMLFingerprintViolationEvent extends FMLEvent { this.fingerprints = fingerprints; this.expectedFingerprint = expectedFingerprint; } + + public boolean isDirectory() { return isDirectory; } + public Set getFingerprints() { return fingerprints; } + public File getSource() { return source; } + public String getExpectedFingerprint() { return expectedFingerprint; } } diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLProxyPacket.java b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLProxyPacket.java index 77dfa716d3..ba3c4b3360 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLProxyPacket.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLProxyPacket.java @@ -125,6 +125,7 @@ public class FMLProxyPacket implements Packet { } static final int PART_SIZE = 0x1000000 - 0x50; // Make it a constant so that it gets inlined below. + // FIXME int overflow public static final int MAX_LENGTH = PART_SIZE * 255; public List> toS3FPackets() throws IOException { diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index 3acf7ce18f..b1e50740c6 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -90,28 +90,6 @@ public class GameData return getMain().iBlockRegistry.getObject(new ResourceLocation(modId, name)); } - @Deprecated - static GameRegistry.UniqueIdentifier getUniqueName(Block block) - { - if (block == null) - { - return null; - } - Object name = getMain().iBlockRegistry.getNameForObject(block); - return new GameRegistry.UniqueIdentifier(name); - } - - @Deprecated - static GameRegistry.UniqueIdentifier getUniqueName(Item item) - { - if (item == null) - { - return null; - } - Object name = getMain().iItemRegistry.getNameForObject(item); - return new GameRegistry.UniqueIdentifier(name); - } - protected static GameData getMain() { return mainData; diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java index dd9d7feea3..ee11a01ec9 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java @@ -388,112 +388,12 @@ public class GameRegistry return GameData.findItem(modId, name); } - /** - * Will be switching to using ResourceLocation, since it's used widely elsewhere - */ - @Deprecated - public static final class UniqueIdentifier - { - public final String modId; - public final String name; - - UniqueIdentifier(String modId, String name) - { - this.modId = modId; - this.name = name; - } - - public UniqueIdentifier(String string) - { - String[] parts = string.split(":"); - this.modId = parts[0]; - this.name = parts[1]; - } - - public UniqueIdentifier(Object obj) - { - if (obj instanceof String) - { - String[] parts = ((String)obj).split(":"); - this.modId = parts[0]; - this.name = parts[1]; - } - else if (obj instanceof ResourceLocation) - { - this.modId = ((ResourceLocation)obj).getResourceDomain(); - this.name = ((ResourceLocation)obj).getResourcePath(); - } - else - { - throw new IllegalArgumentException("UniqueIdentifier must be a String or ResourceLocation, was " + obj.getClass()); - } - } - - @Override - public boolean equals(Object obj) - { - if (obj == null) - { - return false; - } - if (obj.getClass() != this.getClass()) - { - return false; - } - final UniqueIdentifier other = (UniqueIdentifier)obj; - return Objects.equal(modId, other.modId) && Objects.equal(name, other.name); - } - - @Override - public int hashCode() - { - return Objects.hashCode(modId, name); - } - - @Override - public String toString() - { - return String.format("%s:%s", modId, name); - } - } - public enum Type { BLOCK, ITEM; } - /** - * Look up the mod identifier data for a block. - *

- * Note: uniqueness and persistence is only guaranteed by mods using the game registry - * correctly. - * - * @param block to lookup - * @return a {@link UniqueIdentifier} for the block or null - */ - @Deprecated - public static UniqueIdentifier findUniqueIdentifierFor(Block block) - { - return GameData.getUniqueName(block); - } - - /** - * Look up the mod identifier data for an item. - *

- * Note: uniqueness and persistence is only guaranteed by mods using the game registry - * correctly. - * - * @param item to lookup - * @return a {@link UniqueIdentifier} for the item or null - */ - @Deprecated - public static UniqueIdentifier findUniqueIdentifierFor(Item item) - { - return GameData.getUniqueName(item); - } - - /** * ObjectHolder can be used to automatically populate public static final fields with entries * from the registry. These values can then be referred within mod code directly. diff --git a/src/main/java/net/minecraftforge/fml/relauncher/FMLInjectionData.java b/src/main/java/net/minecraftforge/fml/relauncher/FMLInjectionData.java index 6a9cf9b72a..10a2116df0 100644 --- a/src/main/java/net/minecraftforge/fml/relauncher/FMLInjectionData.java +++ b/src/main/java/net/minecraftforge/fml/relauncher/FMLInjectionData.java @@ -29,7 +29,7 @@ public class FMLInjectionData static String mccversion; static String mcpversion; - public static List containers = new ArrayList(); + public static final List containers = new ArrayList(); static void build(File mcHome, LaunchClassLoader classLoader) { diff --git a/src/main/java/net/minecraftforge/fml/relauncher/FMLRelaunchLog.java b/src/main/java/net/minecraftforge/fml/relauncher/FMLRelaunchLog.java index b2d8604a57..9acd7e01d2 100644 --- a/src/main/java/net/minecraftforge/fml/relauncher/FMLRelaunchLog.java +++ b/src/main/java/net/minecraftforge/fml/relauncher/FMLRelaunchLog.java @@ -28,7 +28,7 @@ public class FMLRelaunchLog { * Our special logger for logging issues to. We copy various assets from the * Minecraft logger to achieve a similar appearance. */ - public static FMLRelaunchLog log = new FMLRelaunchLog(); + public static final FMLRelaunchLog log = new FMLRelaunchLog(); static File minecraftHome; private static boolean configured; diff --git a/src/main/java/net/minecraftforge/items/SlotItemHandler.java b/src/main/java/net/minecraftforge/items/SlotItemHandler.java index aa04c33be5..e5571ebed1 100644 --- a/src/main/java/net/minecraftforge/items/SlotItemHandler.java +++ b/src/main/java/net/minecraftforge/items/SlotItemHandler.java @@ -9,7 +9,7 @@ import net.minecraft.item.ItemStack; public class SlotItemHandler extends Slot { private static IInventory emptyInventory = new InventoryBasic("[Null]", true, 0); - public final IItemHandler itemHandler; + private final IItemHandler itemHandler; private final int index; public SlotItemHandler(IItemHandler itemHandler, int index, int xPosition, int yPosition) @@ -24,21 +24,21 @@ public class SlotItemHandler extends Slot { if (stack == null) return false; - ItemStack remainder = this.itemHandler.insertItem(index, stack, true); + ItemStack remainder = this.getItemHandler().insertItem(index, stack, true); return remainder == null || remainder.stackSize < stack.stackSize; } @Override public ItemStack getStack() { - return this.itemHandler.getStackInSlot(index); + return this.getItemHandler().getStackInSlot(index); } // Override if your IItemHandler does not implement IItemHandlerModifiable @Override public void putStack(ItemStack stack) { - ((IItemHandlerModifiable) this.itemHandler).setStackInSlot(index, stack); + ((IItemHandlerModifiable) this.getItemHandler()).setStackInSlot(index, stack); this.onSlotChanged(); } @@ -53,8 +53,8 @@ public class SlotItemHandler extends Slot { ItemStack maxAdd = stack.copy(); maxAdd.stackSize = maxAdd.getMaxStackSize(); - ItemStack currentStack = this.itemHandler.getStackInSlot(index); - ItemStack remainder = this.itemHandler.insertItem(index, maxAdd, true); + ItemStack currentStack = this.getItemHandler().getStackInSlot(index); + ItemStack remainder = this.getItemHandler().insertItem(index, maxAdd, true); int current = currentStack == null ? 0 : currentStack.stackSize; int added = maxAdd.stackSize - (remainder != null ? remainder.stackSize : 0); @@ -64,12 +64,17 @@ public class SlotItemHandler extends Slot @Override public boolean canTakeStack(EntityPlayer playerIn) { - return this.itemHandler.extractItem(index, 1, true) != null; + return this.getItemHandler().extractItem(index, 1, true) != null; } @Override public ItemStack decrStackSize(int amount) { - return this.itemHandler.extractItem(index, amount, false); + return this.getItemHandler().extractItem(index, amount, false); + } + + public IItemHandler getItemHandler() + { + return itemHandler; } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/items/wrapper/EmptyHandler.java b/src/main/java/net/minecraftforge/items/wrapper/EmptyHandler.java index e99314c97e..15288927f7 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/EmptyHandler.java +++ b/src/main/java/net/minecraftforge/items/wrapper/EmptyHandler.java @@ -6,7 +6,7 @@ import net.minecraftforge.items.IItemHandlerModifiable; public class EmptyHandler implements IItemHandlerModifiable { - public static IItemHandler INSTANCE = new EmptyHandler(); + public static final IItemHandler INSTANCE = new EmptyHandler(); @Override public int getSlots() diff --git a/src/main/java/net/minecraftforge/items/wrapper/InvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/InvWrapper.java index 6b722dc30b..b86e934a55 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/InvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/InvWrapper.java @@ -7,7 +7,7 @@ import net.minecraftforge.items.ItemHandlerHelper; public class InvWrapper implements IItemHandlerModifiable { - public final IInventory inv; + private final IInventory inv; public InvWrapper(IInventory inv) { @@ -24,26 +24,26 @@ public class InvWrapper implements IItemHandlerModifiable InvWrapper that = (InvWrapper) o; - return inv.equals(that.inv); + return getInv().equals(that.getInv()); } @Override public int hashCode() { - return inv.hashCode(); + return getInv().hashCode(); } @Override public int getSlots() { - return inv.getSizeInventory(); + return getInv().getSizeInventory(); } @Override public ItemStack getStackInSlot(int slot) { - return inv.getStackInSlot(slot); + return getInv().getStackInSlot(slot); } @Override @@ -52,10 +52,10 @@ public class InvWrapper implements IItemHandlerModifiable if (stack == null) return null; - if (!inv.isItemValidForSlot(slot, stack)) + if (!getInv().isItemValidForSlot(slot, stack)) return stack; - ItemStack stackInSlot = inv.getStackInSlot(slot); + ItemStack stackInSlot = getInv().getStackInSlot(slot); int m; if (stackInSlot != null) @@ -63,7 +63,7 @@ public class InvWrapper implements IItemHandlerModifiable if (!ItemHandlerHelper.canItemStacksStack(stack, stackInSlot)) return stack; - m = Math.min(stack.getMaxStackSize(), inv.getInventoryStackLimit()) - stackInSlot.stackSize; + m = Math.min(stack.getMaxStackSize(), getInv().getInventoryStackLimit()) - stackInSlot.stackSize; if (stack.stackSize <= m) { @@ -71,8 +71,8 @@ public class InvWrapper implements IItemHandlerModifiable { ItemStack copy = stack.copy(); copy.stackSize += stackInSlot.stackSize; - inv.setInventorySlotContents(slot, copy); - inv.markDirty(); + getInv().setInventorySlotContents(slot, copy); + getInv().markDirty(); } return null; @@ -85,8 +85,8 @@ public class InvWrapper implements IItemHandlerModifiable { ItemStack copy = stack.splitStack(m); copy.stackSize += stackInSlot.stackSize; - inv.setInventorySlotContents(slot, copy); - inv.markDirty(); + getInv().setInventorySlotContents(slot, copy); + getInv().markDirty(); return stack; } else @@ -98,15 +98,15 @@ public class InvWrapper implements IItemHandlerModifiable } else { - m = Math.min(stack.getMaxStackSize(), inv.getInventoryStackLimit()); + m = Math.min(stack.getMaxStackSize(), getInv().getInventoryStackLimit()); if (m < stack.stackSize) { // copy the stack to not modify the original one stack = stack.copy(); if (!simulate) { - inv.setInventorySlotContents(slot, stack.splitStack(m)); - inv.markDirty(); + getInv().setInventorySlotContents(slot, stack.splitStack(m)); + getInv().markDirty(); return stack; } else @@ -119,8 +119,8 @@ public class InvWrapper implements IItemHandlerModifiable { if (!simulate) { - inv.setInventorySlotContents(slot, stack); - inv.markDirty(); + getInv().setInventorySlotContents(slot, stack); + getInv().markDirty(); } return null; } @@ -134,7 +134,7 @@ public class InvWrapper implements IItemHandlerModifiable if (amount == 0) return null; - ItemStack stackInSlot = inv.getStackInSlot(slot); + ItemStack stackInSlot = getInv().getStackInSlot(slot); if (stackInSlot == null) return null; @@ -156,8 +156,8 @@ public class InvWrapper implements IItemHandlerModifiable { int m = Math.min(stackInSlot.stackSize, amount); - ItemStack decrStackSize = inv.decrStackSize(slot, m); - inv.markDirty(); + ItemStack decrStackSize = getInv().decrStackSize(slot, m); + getInv().markDirty(); return decrStackSize; } } @@ -165,6 +165,11 @@ public class InvWrapper implements IItemHandlerModifiable @Override public void setStackInSlot(int slot, ItemStack stack) { - inv.setInventorySlotContents(slot, stack); + getInv().setInventorySlotContents(slot, stack); + } + + public IInventory getInv() + { + return inv; } } diff --git a/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java index 063bec7e1e..b63a82b875 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java @@ -6,7 +6,7 @@ import net.minecraft.item.ItemStack; public class PlayerArmorInvWrapper extends RangedWrapper { - public final InventoryPlayer inventoryPlayer; + private final InventoryPlayer inventoryPlayer; public PlayerArmorInvWrapper(InventoryPlayer inv) { @@ -27,10 +27,15 @@ public class PlayerArmorInvWrapper extends RangedWrapper } } // check if it's valid for the armor slot - if (slot < 4 && stack != null && stack.getItem().isValidArmor(stack, equ, inventoryPlayer.player)) + if (slot < 4 && stack != null && stack.getItem().isValidArmor(stack, equ, getInventoryPlayer().player)) { return super.insertItem(slot, stack, simulate); } return stack; } + + public InventoryPlayer getInventoryPlayer() + { + return inventoryPlayer; + } } diff --git a/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java index 421f654120..ec2a04f82d 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java @@ -10,7 +10,7 @@ import net.minecraft.item.ItemStack; */ public class PlayerMainInvWrapper extends RangedWrapper { - public final InventoryPlayer inventoryPlayer; + private final InventoryPlayer inventoryPlayer; public PlayerMainInvWrapper(InventoryPlayer inv) { @@ -28,15 +28,20 @@ public class PlayerMainInvWrapper extends RangedWrapper ItemStack inSlot = getStackInSlot(slot); if(inSlot != null) { - if (inventoryPlayer.player.worldObj.isRemote) + if (getInventoryPlayer().player.worldObj.isRemote) { inSlot.animationsToGo = 5; } - else if(inventoryPlayer.player instanceof EntityPlayerMP) { - inventoryPlayer.player.openContainer.detectAndSendChanges(); + else if(getInventoryPlayer().player instanceof EntityPlayerMP) { + getInventoryPlayer().player.openContainer.detectAndSendChanges(); } } } return rest; } + + public InventoryPlayer getInventoryPlayer() + { + return inventoryPlayer; + } } diff --git a/src/main/java/net/minecraftforge/oredict/RecipeSorter.java b/src/main/java/net/minecraftforge/oredict/RecipeSorter.java index 8902c84a6b..056fba7bbd 100644 --- a/src/main/java/net/minecraftforge/oredict/RecipeSorter.java +++ b/src/main/java/net/minecraftforge/oredict/RecipeSorter.java @@ -108,7 +108,7 @@ public class RecipeSorter implements Comparator private static Map entries = Maps.newHashMap(); private static Map, Integer> priorities = Maps.newHashMap(); - public static RecipeSorter INSTANCE = new RecipeSorter(); + public static final RecipeSorter INSTANCE = new RecipeSorter(); private static boolean isDirty = true; private static SortEntry before = new SortEntry("Before", null, UNKNOWN, ""); From c891d9fe168062763aa37d5000e1b3150cb67a84 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Fri, 25 Mar 2016 00:49:12 +0300 Subject: [PATCH 158/243] Disabled erroring block, fixed DynBucketTest.TestItem model. --- .../net/minecraftforge/debug/DynBucketTest.java | 1 + .../debug/ForgeBlockStatesLoaderDebug.java | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/test/java/net/minecraftforge/debug/DynBucketTest.java b/src/test/java/net/minecraftforge/debug/DynBucketTest.java index 360d8021b2..167acd67d9 100644 --- a/src/test/java/net/minecraftforge/debug/DynBucketTest.java +++ b/src/test/java/net/minecraftforge/debug/DynBucketTest.java @@ -87,6 +87,7 @@ public class DynBucketTest }); ModelBakery.registerItemVariants(dynBottle, bottle); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GameRegistry.findBlock(MODID, "simpletank")), 0, new ModelResourceLocation(new ResourceLocation(MODID, "simpletank"), "normal")); + ModelLoader.setCustomModelResourceLocation(GameRegistry.findItem(MODID, "testitem"), 0, new ModelResourceLocation(new ResourceLocation("minecraft", "stick"), "inventory")); } } diff --git a/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java b/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java index f8de9ec2fb..492b9cb807 100644 --- a/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java +++ b/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java @@ -35,7 +35,7 @@ public class ForgeBlockStatesLoaderDebug { public static final String MODID = "ForgeBlockStatesLoader"; public static final String ASSETS = "forgeblockstatesloader:"; - public static final Block blockCustom = new CustomMappedBlock(); + //public static final Block blockCustom = new CustomMappedBlock(); public static final String nameCustomWall = "custom_wall"; public static final BlockWall blockCustomWall = new BlockWall(Blocks.cobblestone); public static final ItemMultiTexture itemCustomWall = (ItemMultiTexture)new ItemMultiTexture(blockCustomWall, blockCustomWall, new Function() @@ -50,8 +50,8 @@ public class ForgeBlockStatesLoaderDebug { @EventHandler public void preInit(FMLPreInitializationEvent event) { - blockCustom.setUnlocalizedName(MODID + ".customBlock").setRegistryName("customBlock"); - GameRegistry.registerBlock(blockCustom); + //blockCustom.setUnlocalizedName(MODID + ".customBlock").setRegistryName("customBlock"); + //GameRegistry.registerBlock(blockCustom); blockCustomWall.setUnlocalizedName(MODID + ".customWall").setRegistryName(nameCustomWall); GameRegistry.registerBlock(blockCustomWall, (Class)null); @@ -65,7 +65,7 @@ public class ForgeBlockStatesLoaderDebug { @SideOnly(Side.CLIENT) public void preInitClient(FMLPreInitializationEvent event) { - ModelLoader.setCustomStateMapper(blockCustom, new StateMap.Builder().withName(CustomMappedBlock.VARIANT).build()); + //ModelLoader.setCustomStateMapper(blockCustom, new StateMap.Builder().withName(CustomMappedBlock.VARIANT).build()); ModelLoader.setCustomStateMapper(blockCustomWall, new IStateMapper() { @@ -91,7 +91,8 @@ public class ForgeBlockStatesLoaderDebug { } // this block is never actually used, it's only needed for the error message on load to see the variant it maps to - public static class CustomMappedBlock extends Block + // disabling until we can make it a proper test + /*public static class CustomMappedBlock extends Block { public static final PropertyEnum VARIANT = PropertyEnum.create("type", CustomVariant.class); @@ -127,5 +128,5 @@ public class ForgeBlockStatesLoaderDebug { public String getName() { return this.toString(); }; } - } + }*/ } From da2964fbd38a13884fe4f4bf26dbfef6456932e0 Mon Sep 17 00:00:00 2001 From: mezz Date: Thu, 24 Mar 2016 20:39:08 -0700 Subject: [PATCH 159/243] Make tooltips layout in the right direction, wrap if there is no room Same as #2649, but for Minecraft 1.9 --- .../minecraft/client/gui/GuiScreen.java.patch | 37 ++-- .../fml/client/config/GuiConfig.java | 9 +- .../fml/client/config/GuiConfigEntries.java | 16 +- .../fml/client/config/GuiEditArray.java | 12 +- .../fml/client/config/GuiSelectString.java | 12 +- .../fml/client/config/GuiUtils.java | 184 ++++++++++++++++++ 6 files changed, 217 insertions(+), 53 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch index 8f6fd8340d..3110c8976f 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch @@ -10,37 +10,22 @@ } protected void func_146279_a(String p_146279_1_, int p_146279_2_, int p_146279_3_) -@@ -151,6 +152,11 @@ +@@ -151,7 +152,13 @@ protected void func_146283_a(List p_146283_1_, int p_146283_2_, int p_146283_3_) { +- if (!p_146283_1_.isEmpty()) + drawHoveringText(p_146283_1_, p_146283_2_, p_146283_3_, field_146289_q); + } + + protected void drawHoveringText(List p_146283_1_, int p_146283_2_, int p_146283_3_, FontRenderer font) + { - if (!p_146283_1_.isEmpty()) ++ net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(p_146283_1_, p_146283_2_, p_146283_3_, field_146294_l, field_146295_m, -1, font); ++ if (false && !p_146283_1_.isEmpty()) { GlStateManager.func_179101_C(); -@@ -161,7 +167,7 @@ - - for (String s : p_146283_1_) - { -- int j = this.field_146289_q.func_78256_a(s); -+ int j = font.func_78256_a(s); - - if (j > i) - { -@@ -206,7 +212,7 @@ - for (int k1 = 0; k1 < p_146283_1_.size(); ++k1) - { - String s1 = (String)p_146283_1_.get(k1); -- this.field_146289_q.func_175063_a(s1, (float)l1, (float)i2, -1); -+ font.func_175063_a(s1, (float)l1, (float)i2, -1); - - if (k1 == 0) - { -@@ -421,6 +427,7 @@ + RenderHelper.func_74518_a(); +@@ -421,6 +428,7 @@ { this.field_146297_k.field_71456_v.func_146158_b().func_146239_a(p_175281_1_); } @@ -48,7 +33,7 @@ this.field_146297_k.field_71439_g.func_71165_d(p_175281_1_); } -@@ -435,9 +442,15 @@ +@@ -435,9 +443,15 @@ if (guibutton.func_146116_c(this.field_146297_k, p_73864_1_, p_73864_2_)) { @@ -64,7 +49,7 @@ } } } -@@ -467,8 +480,12 @@ +@@ -467,8 +481,12 @@ this.field_146289_q = p_146280_1_.field_71466_p; this.field_146294_l = p_146280_2_; this.field_146295_m = p_146280_3_; @@ -77,7 +62,7 @@ } public void func_183500_a(int p_183500_1_, int p_183500_2_) -@@ -487,7 +504,9 @@ +@@ -487,7 +505,9 @@ { while (Mouse.next()) { @@ -87,7 +72,7 @@ } } -@@ -495,7 +514,9 @@ +@@ -495,7 +515,9 @@ { while (Keyboard.next()) { @@ -97,7 +82,7 @@ } } } -@@ -557,6 +578,7 @@ +@@ -557,6 +579,7 @@ public void func_146276_q_() { this.func_146270_b(0); diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java b/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java index 40585a3470..068a84ddf3 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java @@ -17,6 +17,7 @@ import static net.minecraftforge.fml.client.config.GuiUtils.UNDO_CHAR; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import net.minecraft.client.Minecraft; @@ -336,15 +337,15 @@ public class GuiConfig extends GuiScreen super.drawScreen(mouseX, mouseY, partialTicks); this.entryList.drawScreenPost(mouseX, mouseY, partialTicks); if (this.undoHoverChecker.checkHover(mouseX, mouseY)) - this.drawToolTip(this.mc.fontRendererObj.listFormattedStringToWidth(I18n.format("fml.configgui.tooltip.undoAll"), 300), mouseX, mouseY); + this.drawToolTip(Arrays.asList(I18n.format("fml.configgui.tooltip.undoAll").split("\n")), mouseX, mouseY); if (this.resetHoverChecker.checkHover(mouseX, mouseY)) - this.drawToolTip(this.mc.fontRendererObj.listFormattedStringToWidth(I18n.format("fml.configgui.tooltip.resetAll"), 300), mouseX, mouseY); + this.drawToolTip(Arrays.asList(I18n.format("fml.configgui.tooltip.resetAll").split("\n")), mouseX, mouseY); if (this.checkBoxHoverChecker.checkHover(mouseX, mouseY)) - this.drawToolTip(this.mc.fontRendererObj.listFormattedStringToWidth(I18n.format("fml.configgui.tooltip.applyGlobally"), 300), mouseX, mouseY); + this.drawToolTip(Arrays.asList(I18n.format("fml.configgui.tooltip.applyGlobally").split("\n")), mouseX, mouseY); } public void drawToolTip(List stringList, int x, int y) { - this.drawHoveringText(stringList, x, y); + GuiUtils.drawHoveringText(stringList, x, y, width, height, 300, fontRendererObj); } } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java b/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java index 53ede6229b..e4780b3e60 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java @@ -16,6 +16,7 @@ import static net.minecraftforge.fml.client.config.GuiUtils.UNDO_CHAR; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -1490,6 +1491,7 @@ public class GuiConfigEntries extends GuiListExtended this.defaultHoverChecker = new HoverChecker(this.btnDefault, 800); this.undoToolTip = Arrays.asList(new String[] { I18n.format("fml.configgui.tooltip.undoChanges") }); this.defaultToolTip = Arrays.asList(new String[] { I18n.format("fml.configgui.tooltip.resetToDefault") }); + this.toolTip = new ArrayList(); this.drawLabel = true; @@ -1498,23 +1500,19 @@ public class GuiConfigEntries extends GuiListExtended comment = I18n.format(configElement.getLanguageKey() + ".tooltip").replace("\\n", "\n"); if (!comment.equals(configElement.getLanguageKey() + ".tooltip")) - toolTip = new ArrayList(this.mc.fontRendererObj.listFormattedStringToWidth( - TextFormatting.GREEN + name + "\n" + TextFormatting.YELLOW + comment, 300)); + Collections.addAll(toolTip, (TextFormatting.GREEN + name + "\n" + TextFormatting.YELLOW + comment).split("\n")); else if (configElement.getComment() != null && !configElement.getComment().trim().isEmpty()) - toolTip = new ArrayList(this.mc.fontRendererObj.listFormattedStringToWidth( - TextFormatting.GREEN + name + "\n" + TextFormatting.YELLOW + configElement.getComment(), 300)); + Collections.addAll(toolTip, (TextFormatting.GREEN + name + "\n" + TextFormatting.YELLOW + configElement.getComment()).split("\n")); else - toolTip = new ArrayList(this.mc.fontRendererObj.listFormattedStringToWidth( - TextFormatting.GREEN + name + "\n" + TextFormatting.RED + "No tooltip defined.", 300)); + Collections.addAll(toolTip, (TextFormatting.GREEN + name + "\n" + TextFormatting.RED + "No tooltip defined.").split("\n")); if ((configElement.getType() == ConfigGuiType.INTEGER && (Integer.valueOf(configElement.getMinValue().toString()) != Integer.MIN_VALUE || Integer.valueOf(configElement.getMaxValue().toString()) != Integer.MAX_VALUE)) || (configElement.getType() == ConfigGuiType.DOUBLE && (Double.valueOf(configElement.getMinValue().toString()) != -Double.MAX_VALUE || Double.valueOf(configElement.getMaxValue().toString()) != Double.MAX_VALUE))) - toolTip.addAll(this.mc.fontRendererObj.listFormattedStringToWidth( - TextFormatting.AQUA + I18n.format("fml.configgui.tooltip.defaultNumeric", configElement.getMinValue(), configElement.getMaxValue(), configElement.getDefault()), 300)); + Collections.addAll(toolTip, (TextFormatting.AQUA + I18n.format("fml.configgui.tooltip.defaultNumeric", configElement.getMinValue(), configElement.getMaxValue(), configElement.getDefault())).split("\n")); else if (configElement.getType() != ConfigGuiType.CONFIG_CATEGORY) - toolTip.addAll(this.mc.fontRendererObj.listFormattedStringToWidth(TextFormatting.AQUA + I18n.format("fml.configgui.tooltip.default", configElement.getDefault()),300)); + Collections.addAll(toolTip, (TextFormatting.AQUA + I18n.format("fml.configgui.tooltip.default", configElement.getDefault())).split("\n")); if (configElement.requiresMcRestart() || owningScreen.allRequireMcRestart) toolTip.add(TextFormatting.RED + "[" + I18n.format("fml.configgui.gameRestartTitle") + "]"); diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiEditArray.java b/src/main/java/net/minecraftforge/fml/client/config/GuiEditArray.java index 13e4cc95b9..403e07d26b 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiEditArray.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiEditArray.java @@ -15,6 +15,7 @@ package net.minecraftforge.fml.client.config; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import net.minecraft.client.Minecraft; @@ -66,14 +67,11 @@ public class GuiEditArray extends GuiScreen "\n" + TextFormatting.AQUA, configElement.getDefault(), configElement.getMinValue(), configElement.getMaxValue()); if (!comment.equals(configElement.getLanguageKey() + ".tooltip")) - toolTip = mc.fontRendererObj.listFormattedStringToWidth( - TextFormatting.GREEN + propName + "\n" + TextFormatting.YELLOW + comment, 300); + Collections.addAll(toolTip, (TextFormatting.GREEN + propName + "\n" + TextFormatting.YELLOW + comment).split("\n")); else if (configElement.getComment() != null && !configElement.getComment().trim().isEmpty()) - toolTip = mc.fontRendererObj.listFormattedStringToWidth( - TextFormatting.GREEN + propName + "\n" + TextFormatting.YELLOW + configElement.getComment(), 300); + Collections.addAll(toolTip, (TextFormatting.GREEN + propName + "\n" + TextFormatting.YELLOW + configElement.getComment()).split("\n")); else - toolTip = mc.fontRendererObj.listFormattedStringToWidth( - TextFormatting.GREEN + propName + "\n" + TextFormatting.RED + "No tooltip defined.", 300); + Collections.addAll(toolTip, (TextFormatting.GREEN + propName + "\n" + TextFormatting.RED + "No tooltip defined.").split("\n")); if (parentScreen instanceof GuiConfig) { @@ -205,6 +203,6 @@ public class GuiEditArray extends GuiScreen public void drawToolTip(List stringList, int x, int y) { - this.drawHoveringText(stringList, x, y); + GuiUtils.drawHoveringText(stringList, x, y, width, height, 300, fontRendererObj); } } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiSelectString.java b/src/main/java/net/minecraftforge/fml/client/config/GuiSelectString.java index df245bdbae..afcc062363 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiSelectString.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiSelectString.java @@ -14,6 +14,7 @@ package net.minecraftforge.fml.client.config; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -66,14 +67,11 @@ public class GuiSelectString extends GuiScreen "\n" + TextFormatting.AQUA, configElement.getDefault(), configElement.getMinValue(), configElement.getMaxValue()); if (!comment.equals(configElement.getLanguageKey() + ".tooltip")) - toolTip = mc.fontRendererObj.listFormattedStringToWidth( - TextFormatting.GREEN + propName + "\n" + TextFormatting.YELLOW + comment, 300); + Collections.addAll(toolTip, (TextFormatting.GREEN + propName + "\n" + TextFormatting.YELLOW + comment).split("\n")); else if (configElement.getComment() != null && !configElement.getComment().trim().isEmpty()) - toolTip = mc.fontRendererObj.listFormattedStringToWidth( - TextFormatting.GREEN + propName + "\n" + TextFormatting.YELLOW + configElement.getComment(), 300); + Collections.addAll(toolTip, (TextFormatting.GREEN + propName + "\n" + TextFormatting.YELLOW + configElement.getComment()).split("\n")); else - toolTip = mc.fontRendererObj.listFormattedStringToWidth( - TextFormatting.GREEN + propName + "\n" + TextFormatting.RED + "No tooltip defined.", 300); + Collections.addAll(toolTip, (TextFormatting.GREEN + propName + "\n" + TextFormatting.RED + "No tooltip defined.").split("\n")); if (parentScreen instanceof GuiConfig) { @@ -178,6 +176,6 @@ public class GuiSelectString extends GuiScreen public void drawToolTip(List stringList, int x, int y) { - this.drawHoveringText(stringList, x, y); + GuiUtils.drawHoveringText(stringList, x, y, width, height, 300, fontRendererObj); } } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java b/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java index b76587a143..3d3ae26c99 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java @@ -13,7 +13,9 @@ package net.minecraftforge.fml.client.config; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; 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.vertex.DefaultVertexFormats; @@ -21,6 +23,9 @@ import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; +import java.util.ArrayList; +import java.util.List; + /** * This class provides several methods and constants used by the Config GUI classes. * @@ -193,4 +198,183 @@ public class GuiUtils tessellator.draw(); } + /** + * Draws a tooltip box on the screen with text in it. + * Automatically positions the box relative to the mouse to match Mojang's implementation. + * Automatically wraps text when there is not enough space on the screen to display the text without wrapping. + * Can have a maximum width set to avoid creating very wide tooltips. + * + * @param textLines the lines of text to be drawn in a hovering tooltip box. + * @param mouseX the mouse X position + * @param mouseY the mouse Y position + * @param screenWidth the available screen width for the tooltip to drawn in + * @param screenHeight the available screen height for the tooltip to drawn in + * @param maxTextWidth the maximum width of the text in the tooltip box. + * Set to a negative number to have no max width. + * @param font the font for drawing the text in the tooltip box + */ + public static void drawHoveringText(List textLines, final int mouseX, final int mouseY, final int screenWidth, final int screenHeight, final int maxTextWidth, FontRenderer font) + { + if (!textLines.isEmpty()) + { + GlStateManager.disableRescaleNormal(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + int tooltipTextWidth = 0; + + for (String textLine : textLines) + { + int textLineWidth = font.getStringWidth(textLine); + + if (textLineWidth > tooltipTextWidth) + { + tooltipTextWidth = textLineWidth; + } + } + + boolean needsWrap = false; + + int titleLinesCount = 1; + int tooltipX = mouseX + 12; + if (tooltipX + tooltipTextWidth + 4 > screenWidth) + { + tooltipX = mouseX - 16 - tooltipTextWidth; + if (tooltipX < 4) // if the tooltip doesn't fit on the screen + { + if (mouseX > screenWidth / 2) + { + tooltipTextWidth = mouseX - 12 - 8; + } + else + { + tooltipTextWidth = screenWidth - 16 - mouseX; + } + 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 < textLines.size(); i++) + { + String textLine = textLines.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; + textLines = wrappedTextLines; + + if (mouseX > screenWidth / 2) + { + tooltipX = mouseX - 16 - tooltipTextWidth; + } + else + { + tooltipX = mouseX + 12; + } + } + + int tooltipY = mouseY - 12; + int tooltipHeight = 8; + + if (textLines.size() > 1) + { + tooltipHeight += (textLines.size() - 1) * 10; + if (textLines.size() > titleLinesCount) { + tooltipHeight += 2; // gap between title lines and next lines + } + } + + if (tooltipY + tooltipHeight + 6 > screenHeight) + { + tooltipY = screenHeight - tooltipHeight - 6; + } + + final int zLevel = 300; + final int backgroundColor = 0xF0100010; + drawGradientRect(zLevel, tooltipX - 3, tooltipY - 4, tooltipX + tooltipTextWidth + 3, tooltipY - 3, backgroundColor, backgroundColor); + drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 4, backgroundColor, backgroundColor); + drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); + drawGradientRect(zLevel, tooltipX - 4, tooltipY - 3, tooltipX - 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); + drawGradientRect(zLevel, tooltipX + tooltipTextWidth + 3, tooltipY - 3, tooltipX + tooltipTextWidth + 4, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); + final int borderColorStart = 0x505000FF; + final int borderColorEnd = (borderColorStart & 0xFEFEFE) >> 1 | borderColorStart & 0xFF000000; + drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3 + 1, tooltipX - 3 + 1, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); + drawGradientRect(zLevel, tooltipX + tooltipTextWidth + 2, tooltipY - 3 + 1, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); + drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY - 3 + 1, borderColorStart, borderColorStart); + drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 2, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, borderColorEnd, borderColorEnd); + + for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) + { + String line = textLines.get(lineNumber); + font.drawStringWithShadow(line, (float)tooltipX, (float)tooltipY, -1); + + if (lineNumber + 1 == titleLinesCount) + { + tooltipY += 2; + } + + tooltipY += 10; + } + + GlStateManager.enableLighting(); + GlStateManager.enableDepth(); + RenderHelper.enableStandardItemLighting(); + GlStateManager.enableRescaleNormal(); + } + } + + public static void drawGradientRect(int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) + { + float startAlpha = (float)(startColor >> 24 & 255) / 255.0F; + float startRed = (float)(startColor >> 16 & 255) / 255.0F; + float startGreen = (float)(startColor >> 8 & 255) / 255.0F; + float startBlue = (float)(startColor & 255) / 255.0F; + float endAlpha = (float)(endColor >> 24 & 255) / 255.0F; + float endRed = (float)(endColor >> 16 & 255) / 255.0F; + float endGreen = (float)(endColor >> 8 & 255) / 255.0F; + float endBlue = (float)(endColor & 255) / 255.0F; + + GlStateManager.disableTexture2D(); + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.shadeModel(7425); + + Tessellator tessellator = Tessellator.getInstance(); + VertexBuffer vertexbuffer = tessellator.getBuffer(); + vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR); + vertexbuffer.pos(right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex(); + vertexbuffer.pos(left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex(); + vertexbuffer.pos(left, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex(); + vertexbuffer.pos(right, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex(); + tessellator.draw(); + + GlStateManager.shadeModel(7424); + GlStateManager.disableBlend(); + GlStateManager.enableAlpha(); + GlStateManager.enableTexture2D(); + } } From 6385d7cc9fa2fdfdc2da33cb29a087d19976a23f Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sat, 26 Mar 2016 09:28:57 +0300 Subject: [PATCH 160/243] Fixed diffuse lighting not being applied if forge lighting pipeline is disabled, closes #2651 --- .../renderer/BlockModelRenderer.java.patch | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch new file mode 100644 index 0000000000..be9bcb78fb --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch @@ -0,0 +1,45 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java +@@ -140,7 +140,14 @@ + p_187492_8_.func_187491_a(p_187492_1_, p_187492_2_, p_187492_3_, bakedquad.func_178210_d(), p_187492_6_, p_187492_7_); + p_187492_4_.func_178981_a(bakedquad.func_178209_a()); + p_187492_4_.func_178962_a(p_187492_8_.field_178207_c[0], p_187492_8_.field_178207_c[1], p_187492_8_.field_178207_c[2], p_187492_8_.field_178207_c[3]); +- ++ if(bakedquad.shouldApplyDiffuseLighting()) ++ { ++ float diffuse = net.minecraftforge.client.model.pipeline.LightUtil.diffuseLight(bakedquad.func_178210_d()); ++ p_187492_8_.field_178206_b[0] *= diffuse; ++ p_187492_8_.field_178206_b[1] *= diffuse; ++ p_187492_8_.field_178206_b[2] *= diffuse; ++ p_187492_8_.field_178206_b[3] *= diffuse; ++ } + if (bakedquad.func_178212_b()) + { + int k = this.field_187499_a.func_186724_a(p_187492_2_, p_187492_1_, p_187492_3_, bakedquad.func_178211_c()); +@@ -289,11 +296,26 @@ + float f = (float)(l >> 16 & 255) / 255.0F; + float f1 = (float)(l >> 8 & 255) / 255.0F; + float f2 = (float)(l & 255) / 255.0F; ++ if(bakedquad.shouldApplyDiffuseLighting()) ++ { ++ float diffuse = net.minecraftforge.client.model.pipeline.LightUtil.diffuseLight(bakedquad.func_178210_d()); ++ f *= diffuse; ++ f1 *= diffuse; ++ f2 *= diffuse; ++ } + p_187496_6_.func_178978_a(f, f1, f2, 4); + p_187496_6_.func_178978_a(f, f1, f2, 3); + p_187496_6_.func_178978_a(f, f1, f2, 2); + p_187496_6_.func_178978_a(f, f1, f2, 1); + } ++ else if(bakedquad.shouldApplyDiffuseLighting()) ++ { ++ float diffuse = net.minecraftforge.client.model.pipeline.LightUtil.diffuseLight(bakedquad.func_178210_d()); ++ p_187496_6_.func_178978_a(diffuse, diffuse, diffuse, 4); ++ p_187496_6_.func_178978_a(diffuse, diffuse, diffuse, 3); ++ p_187496_6_.func_178978_a(diffuse, diffuse, diffuse, 2); ++ p_187496_6_.func_178978_a(diffuse, diffuse, diffuse, 1); ++ } + + p_187496_6_.func_178987_a(d0, d1, d2); + } From 6e68aa410639883e22f87a80970f877314e28fa6 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sat, 26 Mar 2016 09:41:05 +0300 Subject: [PATCH 161/243] Enabled diffuse lighting by default in UnpackedBakedQuad.Builder. --- .../minecraftforge/client/model/pipeline/UnpackedBakedQuad.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java b/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java index cecb447789..ac888e12a9 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java @@ -70,7 +70,7 @@ public class UnpackedBakedQuad extends BakedQuad private int tint = -1; private EnumFacing orientation; private TextureAtlasSprite texture; - private boolean applyDiffuseLighting; + private boolean applyDiffuseLighting = true; private int vertices = 0; private int elements = 0; From efa7fd4dfed3608293ed77dc8e672f6bd92437a7 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sat, 26 Mar 2016 09:45:20 +0300 Subject: [PATCH 162/243] Fixed crosshair always being white, closes #2653. --- src/main/java/net/minecraftforge/client/GuiIngameForge.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/net/minecraftforge/client/GuiIngameForge.java b/src/main/java/net/minecraftforge/client/GuiIngameForge.java index 0cbcb9ec9e..9cfc6c2c9b 100644 --- a/src/main/java/net/minecraftforge/client/GuiIngameForge.java +++ b/src/main/java/net/minecraftforge/client/GuiIngameForge.java @@ -194,6 +194,7 @@ public class GuiIngameForge extends GuiIngame { if (pre(CROSSHAIRS)) return; bind(Gui.icons); + GlStateManager.enableBlend(); super.renderAttackIndicator(partialTicks, res); post(CROSSHAIRS); } From 45881d1c902a9a4fedd80beb67a43f50d673a1b1 Mon Sep 17 00:00:00 2001 From: kashike Date: Sun, 27 Mar 2016 09:09:36 -0700 Subject: [PATCH 163/243] Replace Forge's `BlockPos#getImmutable` method with the included `BlockPos#toImmutable` (func_185334_h), while keeping the override in PooledMutableBlockPos to prevent mutable leaks. Also prevent a mutable blockpos leak in World#setTileEntity --- .../minecraft/util/math/BlockPos.java.patch | 36 +----------- .../net/minecraft/world/World.java.patch | 58 +++++++++++-------- .../minecraft/world/chunk/Chunk.java.patch | 2 +- .../common/util/BlockSnapshot.java | 4 +- 4 files changed, 39 insertions(+), 61 deletions(-) diff --git a/patches/minecraft/net/minecraft/util/math/BlockPos.java.patch b/patches/minecraft/net/minecraft/util/math/BlockPos.java.patch index 70319c0787..33fca8b2b9 100644 --- a/patches/minecraft/net/minecraft/util/math/BlockPos.java.patch +++ b/patches/minecraft/net/minecraft/util/math/BlockPos.java.patch @@ -1,41 +1,11 @@ --- ../src-base/minecraft/net/minecraft/util/math/BlockPos.java +++ ../src-work/minecraft/net/minecraft/util/math/BlockPos.java -@@ -270,6 +270,21 @@ - }; - } - -+ /** -+ * Returns a version of this BlockPos that is guaranteed to be Immutable. -+ * In most cases this will return 'this', but if 'this' is an instance of -+ * MutableBlockPos it will return a new instance of BlockPos with the same values. -+ * -+ * When storing a parameter given to you for an extended period of time, make sure you -+ * use this in case the value is changed internally. -+ * -+ * @return An immutable BlockPos. -+ */ -+ public BlockPos getImmutable() -+ { -+ return this; -+ } -+ - public static final class MutableBlockPos extends BlockPos - { - private int field_177997_b; -@@ -333,6 +348,8 @@ - { - return new BlockPos(this); - } -+ -+ @Override public BlockPos getImmutable() { return new BlockPos(this); } - } - - public static final class PooledMutableBlockPos extends BlockPos -@@ -443,5 +460,7 @@ +@@ -443,5 +443,8 @@ { return this.func_185343_d(this.field_185347_c + p_185341_1_.func_82601_c(), this.field_185348_d + p_185341_1_.func_96559_d(), this.field_185349_e + p_185341_1_.func_82599_e()); } + -+ @Override public BlockPos getImmutable() { return new BlockPos(this); } ++ // This method can safely be removed once vanilla adds it - MC-100165 ++ @Override public BlockPos func_185334_h() { return new BlockPos(this); } } } diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index 9164dab330..cae7214a06 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -550,7 +550,15 @@ explosion.func_77278_a(); explosion.func_77279_a(true); return explosion; -@@ -2276,19 +2423,27 @@ +@@ -2253,6 +2400,7 @@ + + public void func_175690_a(BlockPos p_175690_1_, TileEntity p_175690_2_) + { ++ p_175690_1_ = p_175690_1_.func_185334_h(); // Forge - prevent mutable BlockPos leaks + if (p_175690_2_ != null && !p_175690_2_.func_145837_r()) + { + if (this.field_147481_N) +@@ -2276,19 +2424,27 @@ else { this.func_175700_a(p_175690_2_); @@ -579,7 +587,7 @@ } else { -@@ -2301,6 +2456,7 @@ +@@ -2301,6 +2457,7 @@ this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_); } @@ -587,7 +595,7 @@ } public void func_147457_a(TileEntity p_147457_1_) -@@ -2327,7 +2483,7 @@ +@@ -2327,7 +2484,7 @@ if (chunk != null && !chunk.func_76621_g()) { IBlockState iblockstate = this.func_180495_p(p_175677_1_); @@ -596,7 +604,7 @@ } else { -@@ -2350,6 +2506,7 @@ +@@ -2350,6 +2507,7 @@ { this.field_72985_G = p_72891_1_; this.field_72992_H = p_72891_2_; @@ -604,7 +612,7 @@ } public void func_72835_b() -@@ -2359,6 +2516,11 @@ +@@ -2359,6 +2517,11 @@ protected void func_72947_a() { @@ -616,7 +624,7 @@ if (this.field_72986_A.func_76059_o()) { this.field_73004_o = 1.0F; -@@ -2372,6 +2534,11 @@ +@@ -2372,6 +2535,11 @@ protected void func_72979_l() { @@ -628,7 +636,7 @@ if (!this.field_73011_w.func_177495_o()) { if (!this.field_72995_K) -@@ -2491,28 +2658,33 @@ +@@ -2491,28 +2659,33 @@ public boolean func_175670_e(BlockPos p_175670_1_, boolean p_175670_2_) { @@ -668,7 +676,7 @@ if (!flag) { -@@ -2532,24 +2704,29 @@ +@@ -2532,24 +2705,29 @@ public boolean func_175708_f(BlockPos p_175708_1_, boolean p_175708_2_) { @@ -704,7 +712,7 @@ { return true; } -@@ -2581,10 +2758,11 @@ +@@ -2581,10 +2759,11 @@ else { IBlockState iblockstate = this.func_180495_p(p_175638_1_); @@ -719,7 +727,7 @@ { j = 1; } -@@ -2683,7 +2861,7 @@ +@@ -2683,7 +2862,7 @@ int j4 = j2 + enumfacing.func_96559_d(); int k4 = k2 + enumfacing.func_82599_e(); blockpos$pooledmutableblockpos.func_185343_d(i4, j4, k4); @@ -728,7 +736,7 @@ i3 = this.func_175642_b(p_180500_1_, blockpos$pooledmutableblockpos); if (i3 == l2 - l4 && j < this.field_72994_J.length) -@@ -2789,10 +2967,10 @@ +@@ -2789,10 +2968,10 @@ public List func_175674_a(Entity p_175674_1_, AxisAlignedBB p_175674_2_, Predicate p_175674_3_) { List list = Lists.newArrayList(); @@ -743,7 +751,7 @@ for (int i1 = i; i1 <= j; ++i1) { -@@ -2845,10 +3023,10 @@ +@@ -2845,10 +3024,10 @@ public List func_175647_a(Class p_175647_1_, AxisAlignedBB p_175647_2_, Predicate p_175647_3_) { @@ -758,7 +766,7 @@ List list = Lists.newArrayList(); for (int i1 = i; i1 < j; ++i1) -@@ -2926,11 +3104,13 @@ +@@ -2926,11 +3105,13 @@ public void func_175650_b(Collection p_175650_1_) { @@ -775,7 +783,7 @@ } } -@@ -2943,7 +3123,7 @@ +@@ -2943,7 +3124,7 @@ { IBlockState iblockstate = this.func_180495_p(p_175716_2_); AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.func_176223_P().func_185890_d(this, p_175716_2_); @@ -784,7 +792,7 @@ } public int func_181545_F() -@@ -3026,7 +3206,7 @@ +@@ -3026,7 +3207,7 @@ public int func_175651_c(BlockPos p_175651_1_, EnumFacing p_175651_2_) { IBlockState iblockstate = this.func_180495_p(p_175651_1_); @@ -793,7 +801,7 @@ } public boolean func_175640_z(BlockPos p_175640_1_) -@@ -3215,7 +3395,7 @@ +@@ -3215,7 +3396,7 @@ public long func_72905_C() { @@ -802,7 +810,7 @@ } public long func_82737_E() -@@ -3225,17 +3405,17 @@ +@@ -3225,17 +3406,17 @@ public long func_72820_D() { @@ -823,7 +831,7 @@ if (!this.func_175723_af().func_177746_a(blockpos)) { -@@ -3247,7 +3427,7 @@ +@@ -3247,7 +3428,7 @@ public void func_175652_B(BlockPos p_175652_1_) { @@ -832,7 +840,7 @@ } @SideOnly(Side.CLIENT) -@@ -3267,12 +3447,18 @@ +@@ -3267,12 +3448,18 @@ if (!this.field_72996_f.contains(p_72897_1_)) { @@ -851,7 +859,7 @@ return true; } -@@ -3366,8 +3552,7 @@ +@@ -3366,8 +3553,7 @@ public boolean func_180502_D(BlockPos p_180502_1_) { @@ -861,7 +869,7 @@ } public MapStorage func_175693_T() -@@ -3426,12 +3611,12 @@ +@@ -3426,12 +3612,12 @@ public int func_72800_K() { @@ -876,7 +884,7 @@ } public Random func_72843_D(int p_72843_1_, int p_72843_2_, int p_72843_3_) -@@ -3481,7 +3666,7 @@ +@@ -3481,7 +3667,7 @@ @SideOnly(Side.CLIENT) public double func_72919_O() { @@ -885,7 +893,7 @@ } public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_) -@@ -3515,7 +3700,7 @@ +@@ -3515,7 +3701,7 @@ public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) { @@ -894,7 +902,7 @@ { BlockPos blockpos = p_175666_1_.func_177972_a(enumfacing); -@@ -3523,18 +3708,14 @@ +@@ -3523,18 +3709,14 @@ { IBlockState iblockstate = this.func_180495_p(blockpos); @@ -917,7 +925,7 @@ } } } -@@ -3600,6 +3781,87 @@ +@@ -3600,6 +3782,87 @@ return i >= -k && i <= k && j >= -k && j <= k; } diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index 7db81e41cd..71b1adeee5 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -129,7 +129,7 @@ else if (p_177424_2_ == Chunk.EnumCreateEntityType.QUEUED) { - this.field_177447_w.add(p_177424_1_); -+ this.field_177447_w.add(p_177424_1_.getImmutable()); ++ this.field_177447_w.add(p_177424_1_.func_185334_h()); } } - else if (tileentity.func_145837_r()) diff --git a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java index 1e29527a7d..d1a2618c2b 100644 --- a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java +++ b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java @@ -58,7 +58,7 @@ public class BlockSnapshot implements Serializable { this.setWorld(world); this.dimId = world.provider.getDimension(); - this.pos = pos.getImmutable(); + this.pos = pos.toImmutable(); this.setReplacedBlock(state); this.registryName = new ResourceLocation(state.getBlock().getRegistryName()); this.meta = state.getBlock().getMetaFromState(state); @@ -82,7 +82,7 @@ public class BlockSnapshot implements Serializable public BlockSnapshot(int dimension, BlockPos pos, String modId, String blockName, int meta, int flag, NBTTagCompound nbt) { this.dimId = dimension; - this.pos = pos.getImmutable(); + this.pos = pos.toImmutable(); this.setFlag(flag); this.registryName = new ResourceLocation(modId, blockName); this.meta = meta; From 70e85b5eecbbbb27753d851985ade4c2dded0a93 Mon Sep 17 00:00:00 2001 From: gigaherz Date: Mon, 28 Mar 2016 18:22:42 +0200 Subject: [PATCH 164/243] Add wrapper methods for IStorage#readNBT/writeNBT. --- .../common/capabilities/Capability.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/java/net/minecraftforge/common/capabilities/Capability.java b/src/main/java/net/minecraftforge/common/capabilities/Capability.java index aecde88394..0e3a0fb5c2 100644 --- a/src/main/java/net/minecraftforge/common/capabilities/Capability.java +++ b/src/main/java/net/minecraftforge/common/capabilities/Capability.java @@ -65,10 +65,29 @@ public class Capability * the fully qualified class name for the target interface. */ public String getName() { return name; } + /** * @return An instance of the default storage handler. You can safely use this store your default implementation in NBT. */ public IStorage getStorage() { return storage; } + + /** + * Quick access to the IStorage's readNBT. + * See {@link IStorage#readNBT(Capability, Object, EnumFacing, NBTBase)} for documentation. + */ + public void readNBT(T instance, EnumFacing side, NBTBase nbt) + { + storage.readNBT(this, instance, side, nbt); + } + + /** + * Quick access to the IStorage's writeNBT. + * See {@link IStorage#writeNBT(Capability, Object, EnumFacing)} for documentation. + */ + public NBTBase writeNBT(T instance, EnumFacing side) + { + return storage.writeNBT(this, instance, side); + } /** * A NEW instance of the default implementation. From 0f06365e1f14fd4671b3003609585a2baa57034a Mon Sep 17 00:00:00 2001 From: mezz Date: Mon, 28 Mar 2016 16:21:35 -0700 Subject: [PATCH 165/243] Fix Block.getPickBlock returning an ItemStack with a null Item --- .../minecraft/net/minecraft/block/Block.java.patch | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index d99e75e9da..133ed0cd81 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -188,15 +188,20 @@ } protected ItemStack func_180643_i(IBlockState p_180643_1_) -@@ -747,6 +767,7 @@ +@@ -747,9 +767,11 @@ p_176216_2_.field_70181_x = 0.0D; } + @Deprecated // Forge: Use more sensitive version below: getPickBlock public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) { - return new ItemStack(Item.func_150898_a(this), 1, this.func_180651_a(p_185473_3_)); -@@ -844,6 +865,1168 @@ +- return new ItemStack(Item.func_150898_a(this), 1, this.func_180651_a(p_185473_3_)); ++ Item item = Item.func_150898_a(this); ++ return item == null ? null : new ItemStack(item, 1, this.func_180651_a(p_185473_3_)); + } + + @SideOnly(Side.CLIENT) +@@ -844,6 +866,1168 @@ return "Block{" + field_149771_c.func_177774_c(this) + "}"; } From a073b0e386d58627772f57255f6a31477b7b22d2 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 29 Mar 2016 12:05:59 +0300 Subject: [PATCH 166/243] Prevent missing model from loading multiple times. --- .../java/net/minecraftforge/client/model/ModelLoader.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 1800dda33b..097a410815 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -818,6 +818,10 @@ public final class ModelLoader extends ModelBakery public IModel loadModel(ResourceLocation modelLocation) throws Exception { + if(modelLocation.equals(MODEL_MISSING)) + { + return loader.getMissingModel(); + } String modelPath = modelLocation.getResourcePath(); if(modelLocation.getResourcePath().startsWith("models/")) { From 90758f8c968557c6495563fa31632ffd52b49648 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 29 Mar 2016 15:34:10 +0300 Subject: [PATCH 167/243] Fixed StackOverflow caused by the previous commit, closes #2669. --- .../client/model/ModelLoader.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 097a410815..3c4ac2a472 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -714,7 +714,16 @@ public final class ModelLoader extends ModelBakery * Vanilla eats this, which makes it only show variants that have models. * But that doesn't help debugging, so throw the exception */ - IModel model = ModelLoaderRegistry.getModel(loc); + IModel model; + if(loc.equals(MODEL_MISSING)) + { + // explicit missing location, happens if blockstate has "model"=null + model = ModelLoaderRegistry.getMissingModel(); + } + else + { + model = ModelLoaderRegistry.getModel(loc); + } // FIXME: is this the place? messes up dependency and texture resolution model = v.process(model); @@ -818,7 +827,7 @@ public final class ModelLoader extends ModelBakery public IModel loadModel(ResourceLocation modelLocation) throws Exception { - if(modelLocation.equals(MODEL_MISSING)) + if(modelLocation.equals(MODEL_MISSING) && loader.missingModel != null) { return loader.getMissingModel(); } @@ -830,7 +839,12 @@ public final class ModelLoader extends ModelBakery ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getResourceDomain(), "armatures/" + modelPath + ".json"); ModelBlockAnimation animation = ModelBlockAnimation.loadVanillaAnimation(loader.resourceManager, armatureLocation); ModelBlock model = loader.loadModel(modelLocation); - return loader.new VanillaModelWrapper(modelLocation, model, false, animation); + IModel iModel = loader.new VanillaModelWrapper(modelLocation, model, false, animation); + if(loader.missingModel == null && modelLocation.equals(MODEL_MISSING)) + { + loader.missingModel = iModel; + } + return iModel; } @Override From 746c07fc6c6361240f197ec852eecc1ac0cef43c Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 30 Mar 2016 14:05:27 -0700 Subject: [PATCH 168/243] Fix EntityPlayer still running old armor logic. Closes #2670 --- .../entity/player/EntityPlayer.java.patch | 35 +++++++++---------- .../minecraftforge/common/ISpecialArmor.java | 1 + 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index c39a9c7d75..68bdc3287c 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -202,20 +202,19 @@ if (enumhand == EnumHand.MAIN_HAND) { -@@ -1001,8 +1065,12 @@ +@@ -1001,7 +1065,10 @@ { if (!this.func_180431_b(p_70665_1_)) { +- p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); + p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_); + if (p_70665_2_ <= 0) return; - p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); - p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); + p_70665_2_ = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, field_71071_by.field_70460_b, p_70665_1_, p_70665_2_); + if (p_70665_2_ <= 0) return; + p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); float f = p_70665_2_; p_70665_2_ = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F); - this.func_110149_m(this.func_110139_bj() - (f - p_70665_2_)); -@@ -1067,6 +1135,7 @@ +@@ -1067,6 +1134,7 @@ } else { @@ -223,7 +222,7 @@ ItemStack itemstack = p_184822_2_ != null ? p_184822_2_.func_77946_l() : null; if (!p_184822_1_.func_184230_a(this, p_184822_2_, p_184822_3_)) -@@ -1123,6 +1192,7 @@ +@@ -1123,6 +1191,7 @@ public void func_71059_n(Entity p_71059_1_) { @@ -231,7 +230,7 @@ if (p_71059_1_.func_70075_an()) { if (!p_71059_1_.func_85031_j(this)) -@@ -1410,6 +1480,8 @@ +@@ -1410,6 +1479,8 @@ public EntityPlayer.EnumStatus func_180469_a(BlockPos p_180469_1_) { @@ -240,7 +239,7 @@ if (!this.field_70170_p.field_72995_K) { if (this.func_70608_bn() || !this.func_70089_S()) -@@ -1449,9 +1521,10 @@ +@@ -1449,9 +1520,10 @@ this.func_70105_a(0.2F, 0.2F); @@ -254,7 +253,7 @@ float f = 0.5F; float f1 = 0.5F; -@@ -1514,13 +1587,14 @@ +@@ -1514,13 +1586,14 @@ public void func_70999_a(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) { @@ -272,7 +271,7 @@ if (blockpos == null) { -@@ -1529,6 +1603,10 @@ +@@ -1529,6 +1602,10 @@ this.func_70107_b((double)((float)blockpos.func_177958_n() + 0.5F), (double)((float)blockpos.func_177956_o() + 0.1F), (double)((float)blockpos.func_177952_p() + 0.5F)); } @@ -283,7 +282,7 @@ this.field_71083_bS = false; -@@ -1547,14 +1625,15 @@ +@@ -1547,14 +1624,15 @@ private boolean func_175143_p() { @@ -302,7 +301,7 @@ { if (!p_180467_2_) { -@@ -1569,16 +1648,17 @@ +@@ -1569,16 +1647,17 @@ } else { @@ -323,7 +322,7 @@ switch (enumfacing) { -@@ -1618,16 +1698,24 @@ +@@ -1618,16 +1697,24 @@ public BlockPos func_180470_cg() { @@ -350,7 +349,7 @@ if (p_180473_1_ != null) { this.field_71077_c = p_180473_1_; -@@ -1822,6 +1910,10 @@ +@@ -1822,6 +1909,10 @@ super.func_180430_e(p_180430_1_, p_180430_2_); } @@ -361,7 +360,7 @@ } protected void func_71061_d_() -@@ -2022,6 +2114,18 @@ +@@ -2022,6 +2113,18 @@ this.field_175152_f = p_71049_1_.field_175152_f; this.field_71078_a = p_71049_1_.field_71078_a; this.func_184212_Q().func_187227_b(field_184827_bp, p_71049_1_.func_184212_Q().func_187225_a(field_184827_bp)); @@ -380,7 +379,7 @@ } protected boolean func_70041_e_() -@@ -2120,7 +2224,10 @@ +@@ -2120,7 +2223,10 @@ public ITextComponent func_145748_c_() { @@ -392,7 +391,7 @@ itextcomponent.func_150256_b().func_150241_a(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.func_70005_c_() + " ")); itextcomponent.func_150256_b().func_150209_a(this.func_174823_aP()); itextcomponent.func_150256_b().func_179989_a(this.func_70005_c_()); -@@ -2129,7 +2236,7 @@ +@@ -2129,7 +2235,7 @@ public float func_70047_e() { @@ -401,7 +400,7 @@ if (this.func_70608_bn()) { -@@ -2340,6 +2447,161 @@ +@@ -2340,6 +2446,161 @@ return (float)this.func_110148_a(SharedMonsterAttributes.field_188792_h).func_111126_e(); } diff --git a/src/main/java/net/minecraftforge/common/ISpecialArmor.java b/src/main/java/net/minecraftforge/common/ISpecialArmor.java index 9b1fbdef99..a6e08d6050 100644 --- a/src/main/java/net/minecraftforge/common/ISpecialArmor.java +++ b/src/main/java/net/minecraftforge/common/ISpecialArmor.java @@ -23,6 +23,7 @@ import net.minecraft.item.ItemStack; */ public interface ISpecialArmor { + //TODO: Change 'int slot' to EnumArmorType /** * Retrieves the modifiers to be used when calculating armor damage. * From c662810814c34145f98b448819e8a7ca77efc29b Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 30 Mar 2016 15:20:18 -0700 Subject: [PATCH 169/243] Fix shrubs not generating correctly. Closes #2663 --- .../net/minecraft/world/gen/feature/WorldGenShrub.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch index 399a3c4477..250006da96 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch @@ -10,7 +10,7 @@ + do { + IBlockState state = p_180709_1_.func_180495_p(p_180709_3_); -+ if (!state.func_177230_c().isLeaves(state, p_180709_1_, p_180709_3_) && !state.func_177230_c().isLeaves(state, p_180709_1_, p_180709_3_)) break; ++ if (!state.func_177230_c().isAir(state, p_180709_1_, p_180709_3_) && !state.func_177230_c().isLeaves(state, p_180709_1_, p_180709_3_)) break; p_180709_3_ = p_180709_3_.func_177977_b(); - } + } while (p_180709_3_.func_177956_o() > 0); From 9b9e48b3db4ea6624446038503bd2b0285434718 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 30 Mar 2016 15:21:00 -0700 Subject: [PATCH 170/243] Fix bows not animating properly when picking up ammo while using. Closes #2672 --- patches/minecraft/net/minecraft/item/Item.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index d0a84e64b9..0674d47829 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -572,7 +572,7 @@ + */ + public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) + { -+ return !ItemStack.func_77989_b(oldStack, newStack); ++ return !oldStack.equals(newStack); //!ItemStack.areItemStacksEqual(oldStack, newStack); + } + + private ResourceLocation registryName = null; From 38c57d9038a3edeaf8c9d2fcd622ac99e73a32f0 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 30 Mar 2016 15:26:48 -0700 Subject: [PATCH 171/243] Make NoteBlockEvent raw constructor protected to allow subclasses. Closes #2153 --- .../java/net/minecraftforge/event/world/NoteBlockEvent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java b/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java index 6ed656285f..1c54ff5182 100644 --- a/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java +++ b/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java @@ -15,7 +15,7 @@ public class NoteBlockEvent extends BlockEvent { private int noteId; - NoteBlockEvent(World world, BlockPos pos, IBlockState state, int note) + protected NoteBlockEvent(World world, BlockPos pos, IBlockState state, int note) { super(world, pos, state); this.noteId = note; From 7a8475df6e1fb0bb692510bf67db994047d5360b Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 30 Mar 2016 15:59:14 -0700 Subject: [PATCH 172/243] Fix landing particles not showing up. Cloes #2661 --- .../entity/EntityLivingBase.java.patch | 55 ++++++++++--------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index d616b61129..5c2909d5b2 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -1,10 +1,11 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java -@@ -190,9 +190,11 @@ +@@ -189,10 +189,11 @@ + { float f = (float)MathHelper.func_76123_f(this.field_70143_R - 3.0F); - if (p_184231_4_.func_185904_a() != Material.field_151579_a) -+ if (p_184231_4_.func_177230_c().isAir(p_184231_4_, field_70170_p, p_184231_5_)) +- if (p_184231_4_.func_185904_a() != Material.field_151579_a) ++ if (!p_184231_4_.func_177230_c().isAir(p_184231_4_, field_70170_p, p_184231_5_)) { double d0 = Math.min((double)(0.2F + f / 15.0F), 2.5D); int i = (int)(150.0D * d0); @@ -12,7 +13,7 @@ ((WorldServer)this.field_70170_p).func_175739_a(EnumParticleTypes.BLOCK_DUST, this.field_70165_t, this.field_70163_u, this.field_70161_v, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] {Block.func_176210_f(p_184231_4_)}); } } -@@ -264,7 +266,7 @@ +@@ -264,7 +265,7 @@ } } @@ -21,7 +22,7 @@ { this.func_184210_p(); } -@@ -363,7 +365,7 @@ +@@ -363,7 +364,7 @@ if (!this.field_70170_p.field_72995_K && (this.func_70684_aJ() || this.field_70718_bc > 0 && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot"))) { int i = this.func_70693_a(this.field_70717_bb); @@ -30,7 +31,7 @@ while (i > 0) { int j = EntityXPOrb.func_70527_a(i); -@@ -424,6 +426,7 @@ +@@ -424,6 +425,7 @@ { this.field_70755_b = p_70604_1_; this.field_70756_c = this.field_70173_aa; @@ -38,7 +39,7 @@ } public EntityLivingBase func_110144_aD() -@@ -775,6 +778,8 @@ +@@ -775,6 +777,8 @@ public void func_70691_i(float p_70691_1_) { @@ -47,7 +48,7 @@ float f = this.func_110143_aJ(); if (f > 0.0F) -@@ -795,6 +800,7 @@ +@@ -795,6 +799,7 @@ public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -55,7 +56,7 @@ if (this.func_180431_b(p_70097_1_)) { return false; -@@ -883,9 +889,9 @@ +@@ -883,9 +888,9 @@ this.field_70718_bc = 100; this.field_70717_bb = (EntityPlayer)entity; } @@ -67,7 +68,7 @@ if (entitywolf.func_70909_n()) { -@@ -1007,6 +1013,7 @@ +@@ -1007,6 +1012,7 @@ public void func_70645_a(DamageSource p_70645_1_) { @@ -75,7 +76,7 @@ if (!this.field_70729_aU) { Entity entity = p_70645_1_.func_76346_g(); -@@ -1034,11 +1041,24 @@ +@@ -1034,11 +1040,24 @@ i = EnchantmentHelper.func_185283_h((EntityLivingBase)entity); } @@ -100,7 +101,7 @@ } this.field_70170_p.func_72960_a(this, (byte)3); -@@ -1113,7 +1133,7 @@ +@@ -1113,7 +1132,7 @@ BlockPos blockpos = new BlockPos(i, j, k); IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); Block block = iblockstate.func_177230_c(); @@ -109,7 +110,7 @@ } } -@@ -1139,6 +1159,9 @@ +@@ -1139,6 +1158,9 @@ public void func_180430_e(float p_180430_1_, float p_180430_2_) { @@ -119,7 +120,7 @@ super.func_180430_e(p_180430_1_, p_180430_2_); PotionEffect potioneffect = this.func_70660_b(MobEffects.field_76430_j); float f = potioneffect == null ? 0.0F : (float)(potioneffect.func_76458_c() + 1); -@@ -1231,6 +1254,8 @@ +@@ -1231,6 +1253,8 @@ { if (!this.func_180431_b(p_70665_1_)) { @@ -128,7 +129,7 @@ p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); float f = p_70665_2_; -@@ -1279,6 +1304,11 @@ +@@ -1279,6 +1303,11 @@ public void func_184609_a(EnumHand p_184609_1_) { @@ -140,7 +141,7 @@ if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) { this.field_110158_av = -1; -@@ -1476,6 +1506,7 @@ +@@ -1476,6 +1505,7 @@ public void func_110145_l(Entity p_110145_1_) { @@ -148,7 +149,7 @@ if (!(p_110145_1_ instanceof EntityBoat) && !(p_110145_1_ instanceof EntityHorse)) { double d1 = p_110145_1_.field_70165_t; -@@ -1500,7 +1531,7 @@ +@@ -1500,7 +1530,7 @@ if (!this.field_70170_p.func_184143_b(axisalignedbb1)) { @@ -157,7 +158,7 @@ { this.func_70634_a(d11, this.field_70163_u + 1.0D, d12); return; -@@ -1508,14 +1539,14 @@ +@@ -1508,14 +1538,14 @@ BlockPos blockpos = new BlockPos(d11, this.field_70163_u - 1.0D, d12); @@ -174,7 +175,7 @@ { d1 = d11; d13 = this.field_70163_u + 2.0D; -@@ -1586,6 +1617,7 @@ +@@ -1586,6 +1616,7 @@ } this.field_70160_al = true; @@ -182,7 +183,7 @@ } protected void func_70629_bd() -@@ -1845,6 +1877,7 @@ +@@ -1845,6 +1876,7 @@ public void func_70071_h_() { @@ -190,7 +191,7 @@ super.func_70071_h_(); this.func_184608_ct(); -@@ -2351,6 +2384,40 @@ +@@ -2351,6 +2383,40 @@ this.field_70752_e = true; } @@ -231,7 +232,7 @@ public abstract EnumHandSide func_184591_cq(); public boolean func_184587_cr() -@@ -2371,6 +2438,14 @@ +@@ -2371,6 +2437,14 @@ if (itemstack == this.field_184627_bm) { @@ -246,7 +247,7 @@ if (this.func_184605_cv() <= 25 && this.func_184605_cv() % 4 == 0) { this.func_184584_a(this.field_184627_bm, 5); -@@ -2380,6 +2455,7 @@ +@@ -2380,6 +2454,7 @@ { this.func_71036_o(); } @@ -254,7 +255,7 @@ } else { -@@ -2394,8 +2470,10 @@ +@@ -2394,8 +2469,10 @@ if (itemstack != null && !this.func_184587_cr()) { @@ -266,7 +267,7 @@ if (!this.field_70170_p.field_72995_K) { -@@ -2478,6 +2556,8 @@ +@@ -2478,6 +2555,8 @@ this.func_184584_a(this.field_184627_bm, 16); ItemStack itemstack = this.field_184627_bm.func_77950_b(this.field_70170_p, this); @@ -275,7 +276,7 @@ if (itemstack != null && itemstack.field_77994_a == 0) { itemstack = null; -@@ -2507,7 +2587,8 @@ +@@ -2507,7 +2586,8 @@ { if (this.field_184627_bm != null) { @@ -285,7 +286,7 @@ } this.func_184602_cy(); -@@ -2626,4 +2707,28 @@ +@@ -2626,4 +2706,28 @@ { return true; } From b7327e6a351f8c4d9d4f730f7c60393ea423950d Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 31 Mar 2016 21:12:17 -0400 Subject: [PATCH 173/243] Forward ItemBlock#addInformation to Block#addInformation --- .../minecraft/net/minecraft/block/Block.java.patch | 13 ++++++++++++- .../net/minecraft/item/ItemBlock.java.patch | 8 +++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 133ed0cd81..6e5978dd0c 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -201,7 +201,7 @@ } @SideOnly(Side.CLIENT) -@@ -844,6 +866,1168 @@ +@@ -844,6 +866,1179 @@ return "Block{" + field_149771_c.func_177774_c(this) + "}"; } @@ -1365,6 +1365,17 @@ + if (delegate.getResourceName() != null) return delegate.getResourceName().toString(); + return registryName != null ? registryName.toString() : null; + } ++ ++ /** ++ * Add information to the blocks tooltip, called from the default implementation of {@link ItemBlock#addInformation(ItemStack, EntityPlayer, List, boolean)} ++ * @param stack The stack the tooltip is being retrieved for ++ * @param player The player retrieving the tooltip ++ * @param tooltip The lines to be displayed on the tooltip ++ * @param advanced If the client has advanced debug tooltips enabled ++ */ ++ public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) ++ { ++ } + /* ========================================= FORGE END ======================================*/ + public static void func_149671_p() diff --git a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch index 845906f7c8..32dc0c168c 100644 --- a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch @@ -27,7 +27,7 @@ { p_179222_3_ = EnumFacing.UP; } -@@ -159,4 +151,26 @@ +@@ -159,4 +151,32 @@ { return this.field_150939_a; } @@ -52,5 +52,11 @@ + } + + return true; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public void func_77624_a(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) ++ { ++ field_150939_a.addInformation(stack, playerIn, tooltip, advanced); + } } From 5862aaf3a06dcf79c667c51655d3eb8bef2d2d95 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 1 Apr 2016 03:12:01 -0400 Subject: [PATCH 174/243] Add state param to canRenderInLayer --- .../net/minecraft/block/Block.java.patch | 16 ++++++++++++++-- .../client/renderer/chunk/RenderChunk.java.patch | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 6e5978dd0c..7b605588ba 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -201,7 +201,7 @@ } @SideOnly(Side.CLIENT) -@@ -844,6 +866,1179 @@ +@@ -844,6 +866,1191 @@ return "Block{" + field_149771_c.func_177774_c(this) + "}"; } @@ -1286,12 +1286,24 @@ + + /** + * Queries if this block should render in a given layer. -+ * ISmartBlockModel can use MinecraftForgeClient.getRenderLayer to alter their model based on layer ++ * ISmartBlockModel can use {@link MinecraftForgeClient#getRenderLayer()} to alter their model based on layer. ++ * ++ * @deprecated New method with state sensitivity: {@link #canRenderInLayer(IBlockState, BlockRenderLayer)} + */ ++ @Deprecated + public boolean canRenderInLayer(BlockRenderLayer layer) + { + return func_180664_k() == layer; + } ++ ++ /** ++ * Queries if this block should render in a given layer. ++ * ISmartBlockModel can use {@link MinecraftForgeClient#getRenderLayer()} to alter their model based on layer. ++ */ ++ public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) ++ { ++ return canRenderInLayer(layer); ++ } + + // For Internal use only to capture droped items inside getDrops + protected static ThreadLocal captureDrops = new ThreadLocal() diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch index 00f4a4f0e0..bb29f62d10 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch @@ -26,7 +26,7 @@ - BlockRenderLayer blockrenderlayer1 = block.func_180664_k(); + for(BlockRenderLayer blockrenderlayer1 : BlockRenderLayer.values()) { -+ if(!block.canRenderInLayer(blockrenderlayer1)) continue; ++ if(!block.canRenderInLayer(iblockstate, blockrenderlayer1)) continue; + net.minecraftforge.client.ForgeHooksClient.setRenderLayer(blockrenderlayer1); int j = blockrenderlayer1.ordinal(); From b427b265839ca13c77be5ec448e060bb55c4253c Mon Sep 17 00:00:00 2001 From: Hea3veN Date: Tue, 8 Mar 2016 19:50:49 -0300 Subject: [PATCH 175/243] Fix remapped blocks being overriden with dummy air blocks. Closes #2491 --- src/main/java/net/minecraftforge/fml/common/Loader.java | 2 +- .../fml/common/registry/PersistentRegistryManager.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/Loader.java b/src/main/java/net/minecraftforge/fml/common/Loader.java index 8759e1fdb6..4bca3c0933 100644 --- a/src/main/java/net/minecraftforge/fml/common/Loader.java +++ b/src/main/java/net/minecraftforge/fml/common/Loader.java @@ -979,7 +979,7 @@ public class Loader } } - return PersistentRegistryManager.processIdRematches(missingMappings.values(), isLocalWorld, remapBlocks, remapItems); + return PersistentRegistryManager.processIdRematches(missingMappings.values(), isLocalWorld, missingBlocks, missingItems, remapBlocks, remapItems); } public void fireRemapEvent(Map remapBlocks, Map remapItems, boolean isFreezing) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index 2e57d44d84..5696d4f620 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -370,7 +370,7 @@ public class PersistentRegistryManager forAllRegistries(PersistentRegistry.FROZEN, ValidateRegistryFunction.OPERATION); } - public static List processIdRematches(Iterable missedMappings, boolean isLocalWorld, Map remapBlocks, Map remapItems) + public static List processIdRematches(Iterable missedMappings, boolean isLocalWorld, Map missingBlocks, Map missingItems, Map remapBlocks, Map remapItems) { List failed = Lists.newArrayList(); List ignored = Lists.newArrayList(); @@ -395,6 +395,7 @@ public class PersistentRegistryManager newName = active.getRegistry(BLOCKS, Block.class).getNameForObject((Block)remap.getTarget()); FMLLog.fine("The Block %s is being remapped to %s.", remap.name, newName); + missingBlocks.remove(new ResourceLocation(remap.name)); newId = staging.getRegistry(BLOCKS, Block.class).add(remap.id, newName, (Block)remap.getTarget()); staging.getRegistry(BLOCKS, Block.class).addAlias(remap.resourceLocation, newName); } @@ -404,6 +405,7 @@ public class PersistentRegistryManager newName = active.getRegistry(ITEMS, Item.class).getNameForObject((Item)remap.getTarget()); FMLLog.fine("The Item %s is being remapped to %s.", remap.name, newName); + missingItems.remove(new ResourceLocation(remap.name)); newId = staging.getRegistry(ITEMS, Item.class).add(remap.id, newName, (Item)remap.getTarget()); staging.getRegistry(ITEMS, Item.class).addAlias(remap.resourceLocation, newName); } From 6e04a6c572a6a0d14b21c62f19d6a5a9389a9def Mon Sep 17 00:00:00 2001 From: cpw Date: Fri, 1 Apr 2016 17:13:06 -0400 Subject: [PATCH 176/243] Squashed commit of the following: commit b3b290aec9d3010a134859da6001ea28a96c2fdc Merge: c6ce6a0 d803f7d Author: cpw Date: Fri Mar 25 13:28:04 2016 -0400 Merge branch 'RegistryRework' of https://github.com/LexManos/MinecraftForge into LexManos-RegistryRework Implement proper registry slaves. Should help with rollback related issues. Missing patch commit d803f7db76f65db9d27302c9804a643bc853dc22 Author: LexManos Date: Tue Mar 22 03:36:14 2016 -0700 Update VillagerRegistry and use it. Should in theory make custom villagers work now. Using string version instead of int id for networking. commit eb5e5b4b42fdca26d2a104e4dc1e6a3ea3051a7b Author: LexManos Date: Tue Mar 22 02:14:16 2016 -0700 More cleanup. commit edbc56b2ff314629d0e402709f3cf29fc79c4a3d Author: LexManos Date: Tue Mar 22 02:05:23 2016 -0700 More cleanups, removed deprecated UniqueIdentifier {ResourceLocation now} commit e2df8d1be3c97601508f83dc97b0e8853fa1e271 Author: LexManos Date: Tue Mar 22 01:29:19 2016 -0700 Stupid generics.... commit 46d57dc4677fa5ff3923e64eaccfb33d7e5aad8d Author: LexManos Date: Tue Mar 22 01:00:25 2016 -0700 Some registry tweaking to provde a non-complicated API modders can use. --- .../net/minecraft/block/Block.java.patch | 124 ++---------- .../renderer/entity/RenderVillager.java.patch | 2 +- .../entity/passive/EntityVillager.java.patch | 109 +++++++++- .../net/minecraft/item/Item.java.patch | 80 ++------ .../net/minecraft/potion/Potion.java.patch | 7 +- .../world/biome/BiomeGenBase.java.patch | 9 + .../client/model/ModelLoader.java | 10 +- .../common/util/BlockSnapshot.java | 4 +- .../minecraftforge/fluids/FluidRegistry.java | 8 +- .../fml/common/FMLContainer.java | 2 +- .../FMLControlledNamespacedRegistry.java | 187 +++++++++++++----- .../fml/common/registry/GameData.java | 155 +++++++++++---- .../fml/common/registry/GameRegistry.java | 35 ++-- .../fml/common/registry/IForgeRegistry.java | 67 +++++++ .../common/registry/IForgeRegistryEntry.java | 83 ++++++++ .../registry/PersistentRegistryManager.java | 72 ++++--- .../fml/common/registry/RegistryDelegate.java | 22 +-- .../fml/common/registry/VillagerRegistry.java | 112 ++++------- .../minecraftforge/oredict/OreDictionary.java | 6 +- 19 files changed, 659 insertions(+), 435 deletions(-) create mode 100644 src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistry.java create mode 100644 src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistryEntry.java diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 7b605588ba..5f8654e43b 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -1,7 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/Block.java +++ ../src-work/minecraft/net/minecraft/block/Block.java -@@ -46,8 +46,9 @@ - public class Block +@@ -43,11 +43,12 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class Block ++public class Block extends net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl { private static final ResourceLocation field_176230_a = new ResourceLocation("air"); - public static final RegistryNamespacedDefaultedByKey field_149771_c = new RegistryNamespacedDefaultedByKey(field_176230_a); @@ -12,17 +16,7 @@ public static final AxisAlignedBB field_185505_j = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); public static final AxisAlignedBB field_185506_k = null; private CreativeTabs field_149772_a; -@@ -70,6 +71,9 @@ - private IBlockState field_176228_M; - private String field_149770_b; - -+ public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = -+ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)field_149771_c).getDelegate(this, Block.class); -+ - public static int func_149682_b(Block p_149682_0_) - { - return field_149771_c.func_148757_b(p_149682_0_); -@@ -83,7 +87,8 @@ +@@ -83,7 +84,8 @@ public static Block func_149729_e(int p_149729_0_) { @@ -32,7 +26,7 @@ } public static IBlockState func_176220_d(int p_176220_0_) -@@ -268,7 +273,7 @@ +@@ -268,7 +270,7 @@ public boolean func_176200_f(IBlockAccess p_176200_1_, BlockPos p_176200_2_) { @@ -41,7 +35,7 @@ } public Block func_149711_c(float p_149711_1_) -@@ -305,9 +310,10 @@ +@@ -305,9 +307,10 @@ return this.field_149789_z; } @@ -53,7 +47,7 @@ } public AxisAlignedBB func_185496_a(IBlockState p_185496_1_, IBlockAccess p_185496_2_, BlockPos p_185496_3_) -@@ -346,13 +352,13 @@ +@@ -346,13 +349,13 @@ @SideOnly(Side.CLIENT) public int func_185484_c(IBlockState p_185484_1_, IBlockAccess p_185484_2_, BlockPos p_185484_3_) { @@ -69,7 +63,7 @@ } else { -@@ -415,7 +421,7 @@ +@@ -415,7 +418,7 @@ } } @@ -78,7 +72,7 @@ } @SideOnly(Side.CLIENT) -@@ -472,6 +478,10 @@ +@@ -472,6 +475,10 @@ public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) { @@ -89,7 +83,7 @@ } public int func_149745_a(Random p_149745_1_) -@@ -486,8 +496,7 @@ +@@ -486,8 +493,7 @@ public float func_180647_a(IBlockState p_180647_1_, EntityPlayer p_180647_2_, World p_180647_3_, BlockPos p_180647_4_) { @@ -99,7 +93,7 @@ } public final void func_176226_b(World p_176226_1_, BlockPos p_176226_2_, IBlockState p_176226_3_, int p_176226_4_) -@@ -497,20 +506,16 @@ +@@ -497,20 +503,16 @@ public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { @@ -125,7 +119,7 @@ } } } -@@ -518,8 +523,13 @@ +@@ -518,8 +520,13 @@ public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) { @@ -140,7 +134,7 @@ float f = 0.5F; double d0 = (double)(p_180635_0_.field_73012_v.nextFloat() * f) + (double)(1.0F - f) * 0.5D; double d1 = (double)(p_180635_0_.field_73012_v.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -@@ -588,7 +598,7 @@ +@@ -588,7 +595,7 @@ public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { @@ -149,7 +143,7 @@ } public boolean func_180639_a(World p_180639_1_, BlockPos p_180639_2_, IBlockState p_180639_3_, EntityPlayer p_180639_4_, EnumHand p_180639_5_, ItemStack p_180639_6_, EnumFacing p_180639_7_, float p_180639_8_, float p_180639_9_, float p_180639_10_) -@@ -638,25 +648,35 @@ +@@ -638,25 +645,35 @@ p_180657_2_.func_71029_a(StatList.func_188055_a(this)); p_180657_2_.func_71020_j(0.025F); @@ -188,20 +182,15 @@ } protected ItemStack func_180643_i(IBlockState p_180643_1_) -@@ -747,9 +767,11 @@ +@@ -747,6 +764,7 @@ p_176216_2_.field_70181_x = 0.0D; } + @Deprecated // Forge: Use more sensitive version below: getPickBlock public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) { -- return new ItemStack(Item.func_150898_a(this), 1, this.func_180651_a(p_185473_3_)); -+ Item item = Item.func_150898_a(this); -+ return item == null ? null : new ItemStack(item, 1, this.func_180651_a(p_185473_3_)); - } - - @SideOnly(Side.CLIENT) -@@ -844,6 +866,1191 @@ + return new ItemStack(Item.func_150898_a(this), 1, this.func_180651_a(p_185473_3_)); +@@ -844,6 +862,1120 @@ return "Block{" + field_149771_c.func_177774_c(this) + "}"; } @@ -1286,24 +1275,12 @@ + + /** + * Queries if this block should render in a given layer. -+ * ISmartBlockModel can use {@link MinecraftForgeClient#getRenderLayer()} to alter their model based on layer. -+ * -+ * @deprecated New method with state sensitivity: {@link #canRenderInLayer(IBlockState, BlockRenderLayer)} ++ * ISmartBlockModel can use MinecraftForgeClient.getRenderLayer to alter their model based on layer + */ -+ @Deprecated + public boolean canRenderInLayer(BlockRenderLayer layer) + { + return func_180664_k() == layer; + } -+ -+ /** -+ * Queries if this block should render in a given layer. -+ * ISmartBlockModel can use {@link MinecraftForgeClient#getRenderLayer()} to alter their model based on layer. -+ */ -+ public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) -+ { -+ return canRenderInLayer(layer); -+ } + + // For Internal use only to capture droped items inside getDrops + protected static ThreadLocal captureDrops = new ThreadLocal() @@ -1329,65 +1306,6 @@ + } + } + -+ private ResourceLocation registryName = null; -+ /** -+ * Sets a unique name for this Block. This should be used for uniquely identify the instance of the Block. -+ * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. -+ * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. -+ * -+ * The supplied name will be prefixed with the currently active mod's modId. -+ * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. -+ * -+ * If a name already exists, or this Block is already registered in a registry, then an IllegalStateException is thrown. -+ * -+ * Returns 'this' to allow for chaining. -+ * -+ * @param name Unique registry name -+ * @return This instance -+ */ -+ public final Block setRegistryName(String name) -+ { -+ if (getRegistryName() != null) -+ throw new IllegalStateException("Attempted to set registry name on block with exisiting registry name! New: " + name + " Old: " + getRegistryName()); -+ int index = name.lastIndexOf(':'); -+ String oldPrefix = index == -1 ? "" : name.substring(0, index); -+ name = index == -1 ? name : name.substring(index + 1); -+ net.minecraftforge.fml.common.ModContainer mc = net.minecraftforge.fml.common.Loader.instance().activeModContainer(); -+ String prefix = mc == null ? "minecraft" : mc.getModId(); -+ if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) -+ { -+ net.minecraftforge.fml.common.FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name); -+ prefix = oldPrefix; -+ } -+ this.registryName = new ResourceLocation(prefix, name); -+ return this; -+ } -+ public final Block setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); } -+ public final Block setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); } -+ -+ /** -+ * A unique identifier for this block, if this block is registered in the game registry it will return that name. -+ * Otherwise it will return the name set in setRegistryName(). -+ * If neither are valid null is returned. -+ * -+ * @return Unique identifier or null. -+ */ -+ public final String getRegistryName() -+ { -+ if (delegate.getResourceName() != null) return delegate.getResourceName().toString(); -+ return registryName != null ? registryName.toString() : null; -+ } -+ -+ /** -+ * Add information to the blocks tooltip, called from the default implementation of {@link ItemBlock#addInformation(ItemStack, EntityPlayer, List, boolean)} -+ * @param stack The stack the tooltip is being retrieved for -+ * @param player The player retrieving the tooltip -+ * @param tooltip The lines to be displayed on the tooltip -+ * @param advanced If the client has advanced debug tooltips enabled -+ */ -+ public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) -+ { -+ } + /* ========================================= FORGE END ======================================*/ + public static void func_149671_p() diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch index 75cae2f1b4..81ae5201a0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch @@ -5,7 +5,7 @@ return field_110906_m; default: - return field_110903_f; -+ return net.minecraftforge.fml.common.registry.VillagerRegistry.getVillagerSkin(p_110775_1_.func_70946_n(), field_110903_f); ++ return p_110775_1_.getProfessionForge().getSkin(); } } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch index d661dc5b20..9cd5cb3c59 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -1,6 +1,14 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java -@@ -90,6 +90,7 @@ +@@ -74,6 +74,7 @@ + public class EntityVillager extends EntityAgeable implements IMerchant, INpc + { + private static final DataParameter field_184752_bw = EntityDataManager.func_187226_a(EntityVillager.class, DataSerializers.field_187192_b); ++ private static final DataParameter PROFESSION_STR = EntityDataManager.func_187226_a(EntityVillager.class, DataSerializers.field_187194_d); + private int field_70955_e; + private boolean field_70952_f; + private boolean field_70953_g; +@@ -90,6 +91,7 @@ private boolean field_82190_bM; private boolean field_175564_by; private InventoryBasic field_175560_bz; @@ -8,7 +16,7 @@ private static final EntityVillager.ITradeList[][][][] field_175561_bA = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.field_151015_O, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.field_151174_bG, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.field_151172_bF, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.field_151025_P, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150423_aK), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.field_151158_bO, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150440_ba), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.field_151034_e, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.field_151106_aX, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.field_151105_aU, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.field_151007_F, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.field_151115_aP, new EntityVillager.PriceInfo(6, 6), Items.field_179566_aV, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151112_aM, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150325_L), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.field_151097_aZ, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L)), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.field_151007_F, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.field_151032_g, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.field_151031_f, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.func_150898_a(Blocks.field_150351_n), new EntityVillager.PriceInfo(10, 10), Items.field_151145_ak, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151121_aF, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.field_151122_aG, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.field_151111_aL, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150342_X), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.field_151164_bB, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.field_151113_aN, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150359_w), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.field_151057_cb, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151078_bh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.field_151043_k, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.field_151137_ax, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.field_151100_aR, 1, EnumDyeColor.BLUE.func_176767_b()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.field_151079_bi, new EntityVillager.PriceInfo(4, 7)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150426_aN), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.field_151062_by, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151028_Y, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.field_151030_Z, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151163_ad, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.field_151029_X, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.field_151022_W, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.field_151020_U, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.field_151023_V, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151036_c, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151040_l, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151048_u, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151056_x, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151037_a, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151035_b, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151046_w, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151147_al, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.field_151076_bf, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151157_am, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.field_151077_bg, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.field_151116_aA, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.field_151026_S, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151027_R, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.field_151141_av, new EntityVillager.PriceInfo(8, 10))}}}}; public EntityVillager(World p_i1747_1_) -@@ -221,7 +222,7 @@ +@@ -221,7 +223,7 @@ { boolean flag = p_184645_3_ != null && p_184645_3_.func_77973_b() == Items.field_151063_bx; @@ -17,23 +25,106 @@ { if (!this.field_70170_p.field_72995_K && (this.field_70963_i == null || !this.field_70963_i.isEmpty())) { -@@ -533,6 +534,7 @@ +@@ -242,12 +244,14 @@ + { + super.func_70088_a(); + this.field_70180_af.func_187214_a(field_184752_bw, Integer.valueOf(0)); ++ this.field_70180_af.func_187214_a(PROFESSION_STR, "minecraft:farmer"); + } + + public void func_70014_b(NBTTagCompound p_70014_1_) + { + super.func_70014_b(p_70014_1_); + p_70014_1_.func_74768_a("Profession", this.func_70946_n()); ++ p_70014_1_.func_74778_a("ProfessionName", this.getProfessionForge().getRegistryName().toString()); + p_70014_1_.func_74768_a("Riches", this.field_70956_bz); + p_70014_1_.func_74768_a("Career", this.field_175563_bv); + p_70014_1_.func_74768_a("CareerLevel", this.field_175562_bw); +@@ -277,6 +281,14 @@ + { + super.func_70037_a(p_70037_1_); + this.func_70938_b(p_70037_1_.func_74762_e("Profession")); ++ if (p_70037_1_.func_74764_b("ProfessionName")) ++ { ++ net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession p = ++ net.minecraftforge.fml.common.registry.VillagerRegistry.instance().getRegistry().getValue(new net.minecraft.util.ResourceLocation(p_70037_1_.func_74779_i("ProfessionName"))); ++ if (p == null) ++ p = net.minecraftforge.fml.common.registry.VillagerRegistry.instance().getRegistry().getValue(new net.minecraft.util.ResourceLocation("minecraft:farmer")); ++ this.setProfession(p); ++ } + this.field_70956_bz = p_70037_1_.func_74762_e("Riches"); + this.field_175563_bv = p_70037_1_.func_74762_e("Career"); + this.field_175562_bw = p_70037_1_.func_74762_e("CareerLevel"); +@@ -334,6 +346,26 @@ + return Math.max(((Integer)this.field_70180_af.func_187225_a(field_184752_bw)).intValue() % 5, 0); + } + ++ private net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof; ++ public void setProfession(net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof) ++ { ++ this.field_70180_af.func_187227_b(PROFESSION_STR, prof.getRegistryName().toString()); ++ this.prof = prof; ++ } ++ ++ public net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession getProfessionForge() ++ { ++ if (this.prof == null) ++ { ++ String p = this.field_70180_af.func_187225_a(PROFESSION_STR); ++ net.minecraft.util.ResourceLocation res = new net.minecraft.util.ResourceLocation(p == null ? "minecraft:farmer" : p); ++ this.prof = net.minecraftforge.fml.common.registry.VillagerRegistry.instance().getRegistry().getValue(res); ++ if (this.prof == null) ++ return net.minecraftforge.fml.common.registry.VillagerRegistry.instance().getRegistry().getValue(new net.minecraft.util.ResourceLocation("minecraft:farmer")); ++ } ++ return this.prof; ++ } ++ + public boolean func_70941_o() + { + return this.field_70952_f; +@@ -533,15 +565,13 @@ private void func_175554_cu() { -+ //TODO: Hook into VillagerRegistry - EntityVillager.ITradeList[][][] aentityvillager$itradelist = field_175561_bA[this.func_70946_n()]; - +- EntityVillager.ITradeList[][][] aentityvillager$itradelist = field_175561_bA[this.func_70946_n()]; +- if (this.field_175563_bv != 0 && this.field_175562_bw != 0) -@@ -647,6 +649,7 @@ + { + ++this.field_175562_bw; + } + else + { +- this.field_175563_bv = this.field_70146_Z.nextInt(aentityvillager$itradelist.length) + 1; ++ this.field_175563_bv = this.getProfessionForge().getRandomCareer(this.field_70146_Z) + 1; + this.field_175562_bw = 1; + } + +@@ -552,7 +582,7 @@ + + int i = this.field_175563_bv - 1; + int j = this.field_175562_bw - 1; +- EntityVillager.ITradeList[][] aentityvillager$itradelist1 = aentityvillager$itradelist[i]; ++ EntityVillager.ITradeList[][] aentityvillager$itradelist1 = this.getProfessionForge().getCareer(i).getTrades(); + + if (j >= 0 && j < aentityvillager$itradelist1.length) + { +@@ -647,9 +677,14 @@ } } ++ if (s1 == null) ++ s1 = this.getProfessionForge().getCareer(this.field_175563_bv).getName(); ++ else ++ s1 = "entity.Villager." + s1; + //TODO: Hook into VillagerRegistry to get name if (s1 != null) { - TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("entity.Villager." + s1, new Object[0]); -@@ -708,7 +711,7 @@ +- TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("entity.Villager." + s1, new Object[0]); ++ TextComponentTranslation textcomponenttranslation = new TextComponentTranslation(s1, new Object[0]); + textcomponenttranslation.func_150256_b().func_150209_a(this.func_174823_aP()); + textcomponenttranslation.func_150256_b().func_179989_a(this.func_110124_au().toString()); + +@@ -708,7 +743,7 @@ public IEntityLivingData func_180482_a(DifficultyInstance p_180482_1_, IEntityLivingData p_180482_2_) { p_180482_2_ = super.func_180482_a(p_180482_1_, p_180482_2_); diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 0674d47829..27cfd57bec 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -1,8 +1,11 @@ --- ../src-base/minecraft/net/minecraft/item/Item.java +++ ../src-work/minecraft/net/minecraft/item/Item.java -@@ -58,8 +58,8 @@ +@@ -56,10 +56,10 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; - public class Item +-public class Item ++public class Item extends net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl { - public static final RegistryNamespaced field_150901_e = new RegistryNamespaced(); - private static final Map field_179220_a = Maps.newHashMap(); @@ -11,17 +14,7 @@ private static final IItemPropertyGetter field_185046_b = new IItemPropertyGetter() { @SideOnly(Side.CLIENT) -@@ -104,6 +104,9 @@ - private Item field_77700_c; - private String field_77774_bZ; - -+ public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = -+ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)field_150901_e).getDelegate(this, Item.class); -+ - public static int func_150891_b(Item p_150891_0_) - { - return p_150891_0_ == null ? 0 : field_150901_e.func_148757_b(p_150891_0_); -@@ -192,6 +195,7 @@ +@@ -192,6 +192,7 @@ return p_77654_1_; } @@ -29,7 +22,7 @@ public int func_77639_j() { return this.field_77777_bU; -@@ -312,6 +316,7 @@ +@@ -312,6 +313,7 @@ return this.field_77700_c; } @@ -37,7 +30,7 @@ public boolean func_77634_r() { return this.field_77700_c != null; -@@ -367,7 +372,7 @@ +@@ -367,7 +369,7 @@ public boolean func_77616_k(ItemStack p_77616_1_) { @@ -46,7 +39,7 @@ } protected RayTraceResult func_77621_a(World p_77621_1_, EntityPlayer p_77621_2_, boolean p_77621_3_) -@@ -385,6 +390,10 @@ +@@ -385,6 +387,10 @@ float f6 = f3 * f4; float f7 = f2 * f4; double d3 = 5.0D; @@ -57,7 +50,7 @@ Vec3d vec3d1 = vec3d.func_72441_c((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); return p_77621_1_.func_147447_a(vec3d, vec3d1, p_77621_3_, !p_77621_3_, false); } -@@ -422,11 +431,606 @@ +@@ -422,11 +428,557 @@ return false; } @@ -575,55 +568,6 @@ + return !oldStack.equals(newStack); //!ItemStack.areItemStacksEqual(oldStack, newStack); + } + -+ private ResourceLocation registryName = null; -+ /** -+ * Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item. -+ * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. -+ * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. -+ * -+ * The supplied name will be prefixed with the currently active mod's modId. -+ * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. -+ * -+ * If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown. -+ * -+ * Returns 'this' to allow for chaining. -+ * -+ * @param name Unique registry name -+ * @return This instance -+ */ -+ public final Item setRegistryName(String name) -+ { -+ if (getRegistryName() != null) -+ throw new IllegalStateException("Attempted to set registry name on block with exisiting registry name! New: " + name + " Old: " + getRegistryName()); -+ int index = name.lastIndexOf(':'); -+ String oldPrefix = index == -1 ? "" : name.substring(0, index); -+ name = index == -1 ? name : name.substring(index + 1); -+ net.minecraftforge.fml.common.ModContainer mc = net.minecraftforge.fml.common.Loader.instance().activeModContainer(); -+ String prefix = mc == null ? "minecraft" : mc.getModId(); -+ if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) -+ { -+ net.minecraftforge.fml.common.FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name); -+ prefix = oldPrefix; -+ } -+ this.registryName = new ResourceLocation(prefix, name); -+ return this; -+ } -+ public final Item setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); } -+ public final Item setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); } -+ -+ /** -+ * A unique identifier for this block, if this block is registered in the game registry it will return that name. -+ * Otherwise it will return the name set in setRegistryName(). -+ * If neither are valid null is returned. -+ * -+ * @return Unique identifier or null. -+ */ -+ public final String getRegistryName() -+ { -+ if (delegate.getResourceName() != null) return delegate.getResourceName().toString(); -+ return registryName != null ? registryName.toString() : null; -+ } -+ + /** + * Called from ItemStack.setItem, will hold extra data for the life of this ItemStack. + * Can be retrieved from stack.getCapabilities() @@ -664,7 +608,7 @@ public static void func_150900_l() { func_179214_a(Blocks.field_150348_b, (new ItemMultiTexture(Blocks.field_150348_b, Blocks.field_150348_b, new Function() -@@ -935,6 +1539,10 @@ +@@ -935,6 +1487,10 @@ private final float field_78011_i; private final int field_78008_j; @@ -675,7 +619,7 @@ private ToolMaterial(int p_i1874_3_, int p_i1874_4_, float p_i1874_5_, float p_i1874_6_, int p_i1874_7_) { this.field_78001_f = p_i1874_3_; -@@ -969,9 +1577,36 @@ +@@ -969,9 +1525,36 @@ return this.field_78008_j; } diff --git a/patches/minecraft/net/minecraft/potion/Potion.java.patch b/patches/minecraft/net/minecraft/potion/Potion.java.patch index d8ed60afcf..9385f031ca 100644 --- a/patches/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches/minecraft/net/minecraft/potion/Potion.java.patch @@ -1,8 +1,11 @@ --- ../src-base/minecraft/net/minecraft/potion/Potion.java +++ ../src-work/minecraft/net/minecraft/potion/Potion.java -@@ -23,7 +23,7 @@ +@@ -21,9 +21,9 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; - public class Potion +-public class Potion ++public class Potion extends net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl { - public static final RegistryNamespaced field_188414_b = new RegistryNamespaced(); + public static final RegistryNamespaced field_188414_b = net.minecraftforge.fml.common.registry.GameData.getPotionRegistry(); diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch index a7c0f1850d..22c125373e 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch @@ -1,5 +1,14 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenBase.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenBase.java +@@ -51,7 +51,7 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +-public abstract class BiomeGenBase ++public abstract class BiomeGenBase extends net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl + { + private static final Logger field_150586_aC = LogManager.getLogger(); + protected static final IBlockState field_185365_a = Blocks.field_150348_b.func_176223_P(); @@ -70,7 +70,7 @@ protected static final WorldGenTrees field_76757_N = new WorldGenTrees(false); protected static final WorldGenBigTree field_76758_O = new WorldGenBigTree(false); diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 3c4ac2a472..aea9998c95 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -192,7 +192,7 @@ public final class ModelLoader extends ModelBakery { public int compare(Block b1, Block b2) { - return b1.getRegistryName().compareTo(b2.getRegistryName()); + return b1.getRegistryName().toString().compareTo(b2.getRegistryName().toString()); } }); ProgressBar blockBar = ProgressManager.push("ModelLoader: blocks", blocks.size()); @@ -201,7 +201,7 @@ public final class ModelLoader extends ModelBakery for(Block block : blocks) { - blockBar.step(block.getRegistryName()); + blockBar.step(block.getRegistryName().toString()); for(ResourceLocation location : mapper.getBlockstateLocations(block)) { loadBlock(mapper, block, location); @@ -276,14 +276,14 @@ public final class ModelLoader extends ModelBakery { public int compare(Item i1, Item i2) { - return i1.getRegistryName().compareTo(i2.getRegistryName()); + return i1.getRegistryName().toString().compareTo(i2.getRegistryName().toString()); } }); ProgressBar itemBar = ProgressManager.push("ModelLoader: items", items.size()); for(Item item : items) { - itemBar.step(item.getRegistryName()); + itemBar.step(item.getRegistryName().toString()); for(String s : getVariantNames(item)) { ResourceLocation file = getItemLocation(s); @@ -916,7 +916,7 @@ public final class ModelLoader extends ModelBakery for(String s : getVariantNames(item)) { ModelResourceLocation memory = getInventoryVariant(s); - reverseItemMap.put(memory, item.getRegistryName()); + reverseItemMap.put(memory, item.getRegistryName().toString()); } } } diff --git a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java index d1a2618c2b..dd6bbe2e01 100644 --- a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java +++ b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java @@ -38,7 +38,7 @@ public class BlockSnapshot implements Serializable this.dimId = world.provider.getDimension(); this.pos = pos; this.setReplacedBlock(state); - this.registryName = new ResourceLocation(state.getBlock().getRegistryName()); + this.registryName = state.getBlock().getRegistryName(); this.meta = state.getBlock().getMetaFromState(state); this.setFlag(3); TileEntity te = world.getTileEntity(pos); @@ -60,7 +60,7 @@ public class BlockSnapshot implements Serializable this.dimId = world.provider.getDimension(); this.pos = pos.toImmutable(); this.setReplacedBlock(state); - this.registryName = new ResourceLocation(state.getBlock().getRegistryName()); + this.registryName = state.getBlock().getRegistryName(); this.meta = state.getBlock().getMetaFromState(state); this.setFlag(3); this.nbt = nbt; diff --git a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java index b2a752f06b..ec3e6be78a 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java @@ -433,13 +433,7 @@ public abstract class FluidRegistry } @Override - public String name() - { - return name; - } - - @Override - public ResourceLocation getResourceName() { + public ResourceLocation name() { return new ResourceLocation(name); } diff --git a/src/main/java/net/minecraftforge/fml/common/FMLContainer.java b/src/main/java/net/minecraftforge/fml/common/FMLContainer.java index 3af70ae254..d92e7fc267 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLContainer.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLContainer.java @@ -48,7 +48,7 @@ import com.google.common.eventbus.Subscribe; * @author cpw * */ -public class FMLContainer extends DummyModContainer implements WorldAccessContainer +public final class FMLContainer extends DummyModContainer implements WorldAccessContainer { public FMLContainer() { diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index ad9e2fd9c0..2f83b230fb 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -8,31 +8,31 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; +import com.google.common.base.Joiner; +import com.google.common.base.Throwables; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import com.google.common.collect.Iterators; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import org.apache.commons.lang3.Validate; +import org.apache.logging.log4j.Level; + import net.minecraft.util.ResourceLocation; import net.minecraft.util.registry.RegistryNamespacedDefaultedByKey; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.functions.GenericIterableFactory; import net.minecraftforge.fml.common.registry.RegistryDelegate.Delegate; -import org.apache.commons.lang3.Validate; -import org.apache.logging.log4j.Level; - -import com.google.common.base.Joiner; -import com.google.common.base.Throwables; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; -import com.google.common.collect.Iterators; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; - -public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaultedByKey +public class FMLControlledNamespacedRegistry> extends RegistryNamespacedDefaultedByKey implements IForgeRegistry { public static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("fml.debugRegistryEntries", "false")); private final Class superType; private final boolean isDelegated; - private final Field delegateAccessor; private ResourceLocation optionalDefaultKey; private I optionalDefaultObject; private int maxId; @@ -59,43 +59,30 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul private final BitSet availabilityMap; + private final Map slaves = Maps.newHashMap(); + private final AddCallback addCallback; - public interface AddCallback - { - public void onAdd(T obj, int id); - } + private final ClearCallback clearCallback; - FMLControlledNamespacedRegistry(ResourceLocation defaultKey, int maxIdValue, int minIdValue, Class type, boolean isDelegated) - { - this(defaultKey, maxIdValue, minIdValue, type, isDelegated, null); - } + private final CreateCallback createCallback; - FMLControlledNamespacedRegistry(ResourceLocation defaultKey, int maxIdValue, int minIdValue, Class type, boolean isDelegated, AddCallback callback) + FMLControlledNamespacedRegistry(ResourceLocation defaultKey, int minIdValue, int maxIdValue, Class type, AddCallback addCallback, ClearCallback clearCallback, CreateCallback createCallback) { super(defaultKey); this.superType = type; this.optionalDefaultKey = defaultKey; - this.maxId = maxIdValue; this.minId = minIdValue; + this.maxId = maxIdValue; this.availabilityMap = new BitSet(maxIdValue + 1); - this.isDelegated = isDelegated; - if (this.isDelegated) + this.isDelegated = IForgeRegistryEntry.Impl.class.isAssignableFrom(type); + this.addCallback = addCallback; + this.clearCallback = clearCallback; + this.createCallback = createCallback; + if (createCallback != null) { - try - { - this.delegateAccessor = type.getField("delegate"); - } catch (NoSuchFieldException e) - { - FMLLog.log(Level.ERROR, e, "Delegate class identified with missing delegate field"); - throw Throwables.propagate(e); - } + createCallback.onCreate(slaves); } - else - { - this.delegateAccessor = null; - } - this.addCallback = callback; } void validateContent(ResourceLocation registryName) @@ -462,7 +449,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul addObjectRaw(idToUse, name, thing); if (isDelegated) { - getExistingDelegate(thing).setResourceName(name); + getExistingDelegate(thing).setName(name); } if (this.dummiedLocations.remove(name) && DEBUG) @@ -561,7 +548,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul availabilityMap.set(id); if (addCallback != null) { - addCallback.onAdd(thing, id); + addCallback.onAdd(thing, id, slaves); } } @@ -576,15 +563,15 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul } @SuppressWarnings("unchecked") - public Delegate getExistingDelegate(I thing) + private Delegate getExistingDelegate(I thing) { - try + if (isDelegated) { - return (Delegate)delegateAccessor.get(thing); - } catch (IllegalAccessException e) + return (Delegate)((IForgeRegistryEntry.Impl)thing).delegate; + } + else { - FMLLog.log(Level.ERROR, e, "Illegal attempt to access delegate"); - throw Throwables.propagate(e); + return null; } } @@ -655,7 +642,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul FMLControlledNamespacedRegistry makeShallowCopy() { - return new FMLControlledNamespacedRegistry(optionalDefaultKey, maxId, minId, superType, isDelegated); + return new FMLControlledNamespacedRegistry(optionalDefaultKey, minId, maxId, superType, addCallback, clearCallback, createCallback); } void resetSubstitutionDelegates() @@ -672,7 +659,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul } @SuppressWarnings("unchecked") - public FMLControlledNamespacedRegistry asType(Class type) + public > FMLControlledNamespacedRegistry asType(Class type) { return (FMLControlledNamespacedRegistry)this; } @@ -758,18 +745,118 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul for (I i : this.underlyingIntegerMap) { - addCallback.onAdd(i, this.underlyingIntegerMap.add(i)); + addCallback.onAdd(i, this.underlyingIntegerMap.add(i), slaves); } } @Override public ResourceLocation getNameForObject(I p_177774_1_) { - ResourceLocation rl = super.getNameForObject(p_177774_1_); + ResourceLocation rl = super.getNameForObjectBypass(p_177774_1_); if (rl == null) { rl = activeSubstitutions.inverse().get(p_177774_1_); } return rl; } + + @Override + public Class getRegistrySuperType() + { + return superType; + } + + + // IForgeRegistry: Modders should only interfaces with these methods + + @Override + public void register(I value) + { + ResourceLocation key = value.getRegistryName(); + if (key == null) + { + FMLLog.severe("Attempted to register a entry with a null name: %s", value); + throw new NullPointerException(String.format("Attempted to register a entry with a null name: %s", value)); + } + add(-1, key, value); + } + + @Override + public boolean containsValue(I value) + { + return getKey(value) != null; + } + + @Override + public I getValue(ResourceLocation key) + { + return getObject(key); + } + + @Override + public ResourceLocation getKey(I value) + { + return getNameForObject(value); + } + + @Override + public List getValues() + { + return Lists.newArrayList(this.iterator()); + } + + @Override + public Set> getEntries() + { + return Sets.newHashSet(new Iterator>() + { + Iterator itr = FMLControlledNamespacedRegistry.this.iterator(); + + @Override + public boolean hasNext() + { + return itr.hasNext(); + } + + @Override + public Entry next() + { + final I value = itr.next(); + final ResourceLocation key = FMLControlledNamespacedRegistry.this.getKey(value); + return new Entry() + { + @Override + public ResourceLocation getKey() + { + return key; + } + + @Override + public I getValue() + { + return value; + } + + @Override + public I setValue(I value) + { + throw new UnsupportedOperationException("Setting the value in an iterator is not allowed"); + } + }; + } + + @Override + public void remove() + { + throw new UnsupportedOperationException("This is a READ ONLY view of this registry."); + } + }); + } + + @SuppressWarnings("unchecked") + @Override + public T getSlaveMap(ResourceLocation slaveMapName, Class type) + { + return (T)slaves.get(slaveMapName); + } } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index b1e50740c6..3258b9018b 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -14,6 +14,7 @@ package net.minecraftforge.fml.common.registry; import java.util.Map; +import com.google.common.collect.HashBiMap; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; @@ -27,7 +28,6 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; public class GameData { @@ -35,12 +35,22 @@ public class GameData static final int MAX_BLOCK_ID = 4095; static final int MIN_ITEM_ID = 4096; static final int MAX_ITEM_ID = 31999; - public static final int MIN_POTION_ID = 0; // 0-~31 are vanilla, forge start at 32 - public static final int MAX_POTION_ID = 255; // S1DPacketEntityEffect sends bytes, we can only use 255 - public static final int MIN_BIOME_ID = 0; // 0-~31 are vanilla, forge start at 32 - public static final int MAX_BIOME_ID = 255; // S1DPacketEntityEffect sends bytes, we can only use 255 + static final int MIN_POTION_ID = 0; // 0-~31 are vanilla, forge start at 32 + static final int MAX_POTION_ID = 255; // S1DPacketEntityEffect sends bytes, we can only use 255 + static final int MIN_BIOME_ID = 0; // 0-~31 are vanilla, forge start at 32 + static final int MAX_BIOME_ID = 255; // S1DPacketEntityEffect sends bytes, we can only use 255 + private static final ResourceLocation BLOCK_TO_ITEM = new ResourceLocation("minecraft:blocktoitemmap"); + private static final ResourceLocation BLOCKSTATE_TO_ID = new ResourceLocation("minecraft:blockstatetoid"); private static final GameData mainData = new GameData(); + + public GameData() + { + iBlockRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BLOCKS, Block.class, new ResourceLocation("minecraft:air"), MIN_BLOCK_ID, MAX_BLOCK_ID, true, BlockCallbacks.INSTANCE, BlockCallbacks.INSTANCE, BlockCallbacks.INSTANCE); + iItemRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ITEMS, Item.class, null, MIN_ITEM_ID, MAX_ITEM_ID, true, ItemCallbacks.INSTANCE, ItemCallbacks.INSTANCE, ItemCallbacks.INSTANCE); + iPotionRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONS, Potion.class, null, MIN_POTION_ID, MAX_POTION_ID, false, PotionCallbacks.INSTANCE, PotionCallbacks.INSTANCE, PotionCallbacks.INSTANCE); + iBiomeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BIOMES, BiomeGenBase.class, null, MIN_BIOME_ID, MAX_BIOME_ID, false, BiomeCallbacks.INSTANCE, BiomeCallbacks.INSTANCE, BiomeCallbacks.INSTANCE); + } // public api /** @@ -96,10 +106,10 @@ public class GameData } // internal registry objects - private final FMLControlledNamespacedRegistry iBlockRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BLOCKS, Block.class, new ResourceLocation("minecraft:air"), MAX_BLOCK_ID, MIN_BLOCK_ID, true, BlockStateCapture.INSTANCE); - private final FMLControlledNamespacedRegistry iItemRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ITEMS, Item.class, null, MAX_ITEM_ID, MIN_ITEM_ID, true, ItemBlockCapture.INSTANCE); - private final FMLControlledNamespacedRegistry iPotionRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONS, Potion.class, null, MAX_POTION_ID, MIN_POTION_ID, false, PotionArrayCapture.INSTANCE); - private final FMLControlledNamespacedRegistry iBiomeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BIOMES, BiomeGenBase.class, null, MAX_BIOME_ID, MIN_BIOME_ID, false, BiomeCapture.INSTANCE); + private final FMLControlledNamespacedRegistry iBlockRegistry; + private final FMLControlledNamespacedRegistry iItemRegistry; + private final FMLControlledNamespacedRegistry iPotionRegistry; + private final FMLControlledNamespacedRegistry iBiomeRegistry; int registerItem(Item item, String name) // from GameRegistry { @@ -152,42 +162,45 @@ public class GameData void registerSubstitutionAlias(String name, GameRegistry.Type type, Object toReplace) throws ExistingSubstitutionException { ResourceLocation nameToSubstitute = new ResourceLocation(name); + final BiMap blockItemMap = getBlockItemMap(); if (type == GameRegistry.Type.BLOCK) { iBlockRegistry.addSubstitutionAlias(Loader.instance().activeModContainer().getModId(), nameToSubstitute, (Block)toReplace); Block orig = iBlockRegistry.activateSubstitution(nameToSubstitute); - if (BLOCK_TO_ITEM.containsKey(orig)) + if (blockItemMap.containsKey(orig)) { - Item i = BLOCK_TO_ITEM.get(orig); - BLOCK_TO_ITEM.forcePut((Block)toReplace,i); + Item i = blockItemMap.get(orig); + blockItemMap.forcePut((Block)toReplace,i); } } else if (type == GameRegistry.Type.ITEM) { iItemRegistry.addSubstitutionAlias(Loader.instance().activeModContainer().getModId(), nameToSubstitute, (Item)toReplace); Item orig = iItemRegistry.activateSubstitution(nameToSubstitute); - if (BLOCK_TO_ITEM.containsValue(orig)) + if (blockItemMap.containsValue(orig)) { - Block b = BLOCK_TO_ITEM.inverse().get(orig); - BLOCK_TO_ITEM.forcePut(b, (Item)toReplace); + Block b = blockItemMap.inverse().get(orig); + blockItemMap.forcePut(b, (Item)toReplace); } } } - private static BiMap BLOCK_TO_ITEM = HashBiMap.create(); - - //Internal: DO NOT USE, will change without warning. - public static Map getBlockItemMap() + @SuppressWarnings("unchecked") + public static BiMap getBlockItemMap() { - return BLOCK_TO_ITEM; + return (BiMap)getMain().iItemRegistry.getSlaveMap(BLOCK_TO_ITEM, BiMap.class); + } + static > K register(K object, ResourceLocation location) + { + final IForgeRegistry registry = PersistentRegistryManager.findRegistry(object); + registry.register(object); + return object; } - private static ClearableObjectIntIdentityMap BLOCKSTATE_TO_ID = new ClearableObjectIntIdentityMap(); - - //Internal: DO NOT USE, will change without warning. - public static ClearableObjectIntIdentityMap getBlockStateIDMap() + @SuppressWarnings("unchecked") + public static ObjectIntIdentityMap getBlockStateIDMap() { - return BLOCKSTATE_TO_ID; + return (ObjectIntIdentityMap)getMain().iBlockRegistry.getSlaveMap(BLOCKSTATE_TO_ID, ObjectIntIdentityMap.class); } //Lets us clear the map so we can rebuild it. @@ -200,56 +213,116 @@ public class GameData } } - public RegistryDelegate makeDelegate(T obj, Class rootClass) + public > RegistryDelegate makeDelegate(T obj, Class rootClass) { return PersistentRegistryManager.makeDelegate(obj, rootClass); } - private static class BlockStateCapture implements FMLControlledNamespacedRegistry.AddCallback + private static class BlockCallbacks implements IForgeRegistry.AddCallback,IForgeRegistry.ClearCallback,IForgeRegistry.CreateCallback { - static final BlockStateCapture INSTANCE = new BlockStateCapture(); + static final BlockCallbacks INSTANCE = new BlockCallbacks(); + @SuppressWarnings("unchecked") @Override - public void onAdd(Block block, int blockId) + public void onAdd(Block block, int blockId, Map slaves) { + ClearableObjectIntIdentityMap blockstateMap = (ClearableObjectIntIdentityMap)slaves.get(BLOCKSTATE_TO_ID); for (IBlockState state : block.getBlockState().getValidStates()) { - GameData.BLOCKSTATE_TO_ID.put(state, blockId << 4 | block.getMetaFromState(state)); + blockstateMap.put(state, blockId << 4 | block.getMetaFromState(state)); } } + + @SuppressWarnings("unchecked") + @Override + public void onClear(Map slaveset) + { + ClearableObjectIntIdentityMap blockstateMap = (ClearableObjectIntIdentityMap)slaveset.get(BLOCKSTATE_TO_ID); + blockstateMap.clear(); + } + + @SuppressWarnings("unchecked") + @Override + public void onCreate(Map slaveset) + { + final ClearableObjectIntIdentityMap idMap = new ClearableObjectIntIdentityMap(); + ((Map)slaveset).put(BLOCKSTATE_TO_ID, idMap); + + } } - private static class ItemBlockCapture implements FMLControlledNamespacedRegistry.AddCallback + private static class ItemCallbacks implements IForgeRegistry.AddCallback,IForgeRegistry.ClearCallback,IForgeRegistry.CreateCallback { - static final ItemBlockCapture INSTANCE = new ItemBlockCapture(); + static final ItemCallbacks INSTANCE = new ItemCallbacks(); @Override - public void onAdd(Item item, int blockId) + public void onAdd(Item item, int blockId, Map slaves) { if (item instanceof ItemBlock) { ItemBlock itemBlock = (ItemBlock)item; - BLOCK_TO_ITEM.forcePut(itemBlock.getBlock().delegate.get(), item); + @SuppressWarnings("unchecked") BiMap blockToItem = (BiMap)slaves.get(BLOCK_TO_ITEM); + blockToItem.forcePut(itemBlock.getBlock().delegate.get(), item); } } + + @SuppressWarnings("unchecked") + @Override + public void onClear(Map slaveset) + { + Map map = (Map)slaveset.get(BLOCK_TO_ITEM); + map.clear(); + } + + @SuppressWarnings("unchecked") + @Override + public void onCreate(Map slaveset) + { + final HashBiMap map = HashBiMap.create(); + ((Map)slaveset).put(BLOCK_TO_ITEM, map); + } } - private static class PotionArrayCapture implements FMLControlledNamespacedRegistry.AddCallback + private static class PotionCallbacks implements IForgeRegistry.AddCallback,IForgeRegistry.ClearCallback,IForgeRegistry.CreateCallback { - static final PotionArrayCapture INSTANCE = new PotionArrayCapture(); + static final PotionCallbacks INSTANCE = new PotionCallbacks(); @Override - public void onAdd(Potion potion, int id) { + public void onAdd(Potion potion, int id, Map slaves) { + // no op for the minute? + } + + @Override + public void onClear(Map slaveset) + { + // no op for the minute? + } + + @Override + public void onCreate(Map slaveset) + { // no op for the minute? } } - private static class BiomeCapture implements FMLControlledNamespacedRegistry.AddCallback + private static class BiomeCallbacks implements IForgeRegistry.AddCallback,IForgeRegistry.ClearCallback,IForgeRegistry.CreateCallback { - static final BiomeCapture INSTANCE = new BiomeCapture(); + static final BiomeCallbacks INSTANCE = new BiomeCallbacks(); @Override - public void onAdd(BiomeGenBase potion, int id) { + public void onAdd(BiomeGenBase potion, int id, Map slaves) { + // no op for the minute? + } + + @Override + public void onClear(Map slaveset) + { + // no op for the minute? + } + + @Override + public void onCreate(Map slaveset) + { // no op for the minute? } } -} \ No newline at end of file +} diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java index ee11a01ec9..873c897a30 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java @@ -51,7 +51,6 @@ import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import org.apache.logging.log4j.Level; -import com.google.common.base.Objects; import com.google.common.base.Strings; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableList; @@ -128,14 +127,19 @@ public class GameRegistry sortedGeneratorList = ImmutableList.copyOf(list); } + public static > K register(K object, ResourceLocation location) + { + return GameData.register(object, location); + } /** * Register an item with the item registry with a the name specified in Item.getRegistryName() * * @param item The item to register */ + @Deprecated public static void registerItem(Item item) { - registerItem(item, item.getRegistryName()); + registerItem(item, item.getRegistryName().toString()); } /** @@ -144,6 +148,7 @@ public class GameRegistry * @param item The item to register * @param name The mod-unique name of the item */ + @Deprecated public static void registerItem(Item item, String name) { if (Strings.isNullOrEmpty(name)) @@ -153,20 +158,6 @@ public class GameRegistry GameData.getMain().registerItem(item, name); } - /** - * Register the specified Item with a mod specific name : overrides the standard type based name - * - * @param item The item to register - * @param name The mod-unique name to register it as - null will remove a custom name - * @param modId deprecated, unused - */ - @Deprecated // See version without modID remove in 1.9 - public static Item registerItem(Item item, String name, String modId) - { - registerItem(item, name); - return item; - } - /** * Add a forced persistent substitution alias for the block or item to another block or item. This will have * the effect of using the substituted block or item instead of the original, where ever it is @@ -188,9 +179,10 @@ public class GameRegistry * * @param block The block to register */ + @Deprecated public static Block registerBlock(Block block) { - return registerBlock(block, block.getRegistryName()); + return registerBlock(block, block.getRegistryName().toString()); } /** @@ -199,6 +191,7 @@ public class GameRegistry * @param block The block to register * @param name The mod-unique name to register it as, will get prefixed by your modid. */ + @Deprecated public static Block registerBlock(Block block, String name) { return registerBlock(block, ItemBlock.class, name); @@ -210,6 +203,7 @@ public class GameRegistry * @param block The block to register * @param itemclass The item type to register with it : null registers a block without associated item. */ + @Deprecated public static Block registerBlock(Block block, Class itemclass) { return registerBlock(block, itemclass, block.getRegistryName()); @@ -222,6 +216,7 @@ public class GameRegistry * @param itemclass The item type to register with it : null registers a block without associated item. * @param name The mod-unique name to register it as, will get prefixed by your modid. */ + @Deprecated public static Block registerBlock(Block block, Class itemclass, String name) { return registerBlock(block, itemclass, name, new Object[] {}); @@ -235,9 +230,10 @@ public class GameRegistry * @param itemclass The item type to register with it : null registers a block without associated item. * @param itemCtorArgs Arguments to pass (after the required {@code Block} parameter) to the ItemBlock constructor (optional). */ + @Deprecated public static Block registerBlock(Block block, Class itemclass, Object... itemCtorArgs) { - return registerBlock(block, itemclass, block.getRegistryName(), itemCtorArgs); + return registerBlock(block, itemclass, block.getRegistryName().toString(), itemCtorArgs); } /** @@ -248,6 +244,7 @@ public class GameRegistry * @param name The mod-unique name to register it as, will get prefixed by your modid. * @param itemCtorArgs Arguments to pass (after the required {@code Block} parameter) to the ItemBlock constructor (optional). */ + @Deprecated public static Block registerBlock(Block block, Class itemclass, String name, Object... itemCtorArgs) { if (Strings.isNullOrEmpty(name)) @@ -371,6 +368,7 @@ public class GameRegistry * @param name The name of the block itself * @return The block or null if not found */ + @Deprecated public static Block findBlock(String modId, String name) { return GameData.findBlock(modId, name); @@ -383,6 +381,7 @@ public class GameRegistry * @param name The name of the item itself * @return The item or null if not found */ + @Deprecated public static Item findItem(String modId, String name) { return GameData.findItem(modId, name); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistry.java new file mode 100644 index 0000000000..17147cb190 --- /dev/null +++ b/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistry.java @@ -0,0 +1,67 @@ +package net.minecraftforge.fml.common.registry; + +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import net.minecraft.util.ResourceLocation; + +/** + * Main interface for the registry system. Use this to query the registry system. + * + * @param The top level type for the registry + */ +@SuppressWarnings("WeakerAccess") +public interface IForgeRegistry> extends Iterable +{ + public Class getRegistrySuperType(); + + void register(V value); + + boolean containsKey(ResourceLocation key); + boolean containsValue(V value); + + V getValue(ResourceLocation key); + ResourceLocation getKey(V value); + + Set getKeys(); + List getValues(); + Set> getEntries(); + + /** + * Retrieve the slave map of type T from the registry. + * Slave maps are maps which are dependent on registry content in some way. + * @param slaveMapName The name of the slavemap + * @param type The type + * @param Type to return + * @return The slavemap if present + */ + T getSlaveMap(ResourceLocation slaveMapName, Class type); + + /** + * Callback fired when objects are added to the registry. This will fire when the registry is rebuilt + * on the client side from a server side synchronization, or when a world is loaded. + */ + interface AddCallback + { + void onAdd(V obj, int id, Map slaveset); + } + + /** + * Callback fired when the registry is cleared. This is done before a registry is reloaded from client + * or server. + */ + interface ClearCallback + { + void onClear(Map slaveset); + } + + /** + * Callback fired when a registry instance is created. Populate slave maps here. + */ + interface CreateCallback + { + void onCreate(Map slaveset); + } +} diff --git a/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistryEntry.java b/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistryEntry.java new file mode 100644 index 0000000000..d24843b87b --- /dev/null +++ b/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistryEntry.java @@ -0,0 +1,83 @@ +package net.minecraftforge.fml.common.registry; + +import com.google.common.reflect.TypeToken; + +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.FMLContainer; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.InjectedModContainer; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModContainer; + +public interface IForgeRegistryEntry +{ + /** + * Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item. + * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. + * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. + * + * The supplied name will be prefixed with the currently active mod's modId. + * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. + * + * If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown. + * + * Returns 'this' to allow for chaining. + * + * @param name Unique registry name + * @return This instance + */ + V setRegistryName(ResourceLocation name); + + /** + * A unique identifier for this entry, if this entry is registered already it will return it's official registry name. + * Otherwise it will return the name set in setRegistryName(). + * If neither are valid null is returned. + * + * @return Unique identifier or null. + */ + ResourceLocation getRegistryName(); + + Class getRegistryType(); + + // Default implementation, modders who make extra items SHOULD extend this instead of Object. + // We have to do this until we get default implementations in Java 8. + @SuppressWarnings({ "serial", "unchecked" }) + public static class Impl> implements IForgeRegistryEntry + { + private TypeToken token = new TypeToken(getClass()){}; + public final RegistryDelegate delegate = PersistentRegistryManager.makeDelegate((T)this, (Class)token.getRawType()); + private ResourceLocation registryName = null; + + public final T setRegistryName(String name) + { + if (getRegistryName() != null) + throw new IllegalStateException("Attempted to set registry name with existing registry name! New: " + name + " Old: " + getRegistryName()); + + int index = name.lastIndexOf(':'); + String oldPrefix = index == -1 ? "" : name.substring(0, index); + name = index == -1 ? name : name.substring(index + 1); + ModContainer mc = Loader.instance().activeModContainer(); + String prefix = mc == null || (mc instanceof InjectedModContainer && ((InjectedModContainer)mc).wrappedContainer instanceof FMLContainer) ? "minecraft" : mc.getModId(); + if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) + { + FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name); + prefix = oldPrefix; + } + this.registryName = new ResourceLocation(prefix, name); + return (T)this; + } + + //Helper functions + public final T setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); } + public final T setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); } + + public final ResourceLocation getRegistryName() + { + if (delegate.name() != null) return delegate.name(); + return registryName != null ? registryName : null; + } + + @Override + public final Class getRegistryType() { return token.getRawType(); }; + } +} diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index 5696d4f620..294f04ff22 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -39,22 +39,29 @@ import com.google.common.collect.Sets.SetView; * * @author cpw */ +@SuppressWarnings("WeakerAccess") public class PersistentRegistryManager { private enum PersistentRegistry { - ACTIVE, FROZEN, STAGING; + ACTIVE, VANILLA, FROZEN, STAGING; private final BiMap> registries = HashBiMap.create(); - private final BiMap, ResourceLocation> registrySuperTypes = HashBiMap.create(); + private final BiMap>, ResourceLocation> registrySuperTypes = HashBiMap.create(); @SuppressWarnings("unchecked") - FMLControlledNamespacedRegistry getRegistry(ResourceLocation key, Class regType) + private > Class getRegistrySuperType(ResourceLocation key) + { + return (Class)registrySuperTypes.inverse().get(key); + } + + @SuppressWarnings("unchecked") + private > FMLControlledNamespacedRegistry getRegistry(ResourceLocation key, @SuppressWarnings("UnusedParameters") Class regType) { return (FMLControlledNamespacedRegistry)registries.get(key); } - FMLControlledNamespacedRegistry getOrShallowCopyRegistry(ResourceLocation key, Class regType, FMLControlledNamespacedRegistry other) + private > FMLControlledNamespacedRegistry getOrShallowCopyRegistry(ResourceLocation key, Class regType, FMLControlledNamespacedRegistry other) { if (!registries.containsKey(key)) { @@ -64,12 +71,7 @@ public class PersistentRegistryManager return getRegistry(key, regType); } - private FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class registryType, ResourceLocation optionalDefaultKey, int minId, int maxId, boolean hasDelegates) - { - return this.createRegistry(registryName, registryType, optionalDefaultKey, minId, maxId, hasDelegates, null); - } - - private FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class type, ResourceLocation defaultObjectKey, int minId, int maxId, boolean isDelegated, FMLControlledNamespacedRegistry.AddCallback addCallback) + private > FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class type, ResourceLocation defaultObjectKey, int minId, int maxId, IForgeRegistry.AddCallback addCallback, IForgeRegistry.ClearCallback clearCallback, IForgeRegistry.CreateCallback createCallback) { Set> parents = Sets.newHashSet(); findSuperTypes(type, parents); @@ -80,7 +82,7 @@ public class PersistentRegistryManager FMLLog.severe("Found existing registry of type %1s named %2s, you cannot create a new registry (%3s) with type %4s, as %4s has a parent of that type", foundType, registrySuperTypes.get(foundType), registryName, type); throw new IllegalArgumentException("Duplicate registry parent type found - you can only have one registry for a particular super type"); } - FMLControlledNamespacedRegistry fmlControlledNamespacedRegistry = new FMLControlledNamespacedRegistry(defaultObjectKey, maxId, minId, type, isDelegated, addCallback); + FMLControlledNamespacedRegistry fmlControlledNamespacedRegistry = new FMLControlledNamespacedRegistry(defaultObjectKey, minId, maxId, type, addCallback, clearCallback, createCallback); registries.put(registryName, fmlControlledNamespacedRegistry); registrySuperTypes.put(type, registryName); return getRegistry(registryName, type); @@ -117,7 +119,7 @@ public class PersistentRegistryManager return registries.containsValue(registry); } - public FMLControlledNamespacedRegistry getRegistry(Class rootClass) + public > FMLControlledNamespacedRegistry getRegistry(Class rootClass) { ResourceLocation rl = registrySuperTypes.get(rootClass); return getRegistry(rl, rootClass); @@ -129,16 +131,25 @@ public class PersistentRegistryManager public static final ResourceLocation POTIONS = new ResourceLocation("minecraft:potions"); public static final ResourceLocation BIOMES = new ResourceLocation("minecraft:biomes"); - public static FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class registryType, ResourceLocation optionalDefaultKey, int maxId, int minId, boolean hasDelegates, FMLControlledNamespacedRegistry.AddCallback addCallback) + public static > FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class registryType, ResourceLocation optionalDefaultKey, int minId, int maxId, boolean hasDelegates, IForgeRegistry.AddCallback addCallback, IForgeRegistry.ClearCallback clearCallback, IForgeRegistry.CreateCallback createCallback) { - return PersistentRegistry.ACTIVE.createRegistry(registryName, registryType, optionalDefaultKey, minId, maxId, hasDelegates, addCallback); + return PersistentRegistry.ACTIVE.createRegistry(registryName, registryType, optionalDefaultKey, minId, maxId, addCallback, clearCallback, createCallback); } - public static FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class registryType, ResourceLocation optionalDefaultKey, int maxId, int minId, boolean hasDelegates) + @SuppressWarnings("unchecked") + static > IForgeRegistry findRegistry(IForgeRegistryEntry entry) { - return PersistentRegistry.ACTIVE.createRegistry(registryName, registryType, optionalDefaultKey, minId, maxId, hasDelegates); + final Class registryType = (Class)entry.getRegistryType(); + final FMLControlledNamespacedRegistry registry = PersistentRegistry.ACTIVE.getRegistry(registryType); + if (registry == null) + { + FMLLog.getLogger().log(Level.ERROR, "Unable to locate registry for registered object of type {}", entry.getClass().getName()); + throw new IllegalArgumentException("Unable to locate registry for registered object"); + } + return registry; } + public static List injectSnapshot(GameDataSnapshot snapshot, boolean injectFrozenData, boolean isLocalWorld) { FMLLog.info("Injecting existing block and item data into this %s instance", FMLCommonHandler.instance().getEffectiveSide().isServer() ? "server" : "client"); @@ -149,13 +160,11 @@ public class PersistentRegistryManager forAllRegistries(PersistentRegistry.ACTIVE, DumpRegistryFunction.OPERATION); forAllRegistries(PersistentRegistry.ACTIVE, ResetDelegatesFunction.OPERATION); - // Empty the blockstate map before loading - GameData.getBlockStateIDMap().clear(); - // Load the snapshot into the "STAGING" registry for (Map.Entry snapshotEntry : snapshot.entries.entrySet()) { - loadPersistentDataToStagingRegistry(injectFrozenData, remaps, missing, snapshotEntry, PersistentRegistry.ACTIVE.registrySuperTypes.inverse().get(snapshotEntry.getKey())); + final Class registrySuperType = PersistentRegistry.ACTIVE.getRegistrySuperType(snapshotEntry.getKey()); + loadPersistentDataToStagingRegistry(injectFrozenData, remaps, missing, snapshotEntry, registrySuperType); } // Handle dummied blocks @@ -213,7 +222,8 @@ public class PersistentRegistryManager // So we load it from the frozen persistent registry for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) { - loadFrozenDataToStagingRegistry(remaps, r.getKey(), PersistentRegistry.ACTIVE.registrySuperTypes.inverse().get(r.getKey())); + final Class registrySuperType = PersistentRegistry.ACTIVE.getRegistrySuperType(r.getKey()); + loadFrozenDataToStagingRegistry(remaps, r.getKey(), registrySuperType); } } @@ -223,7 +233,8 @@ public class PersistentRegistryManager // Load the STAGING registry into the ACTIVE registry for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) { - loadRegistry(r.getKey(), PersistentRegistry.STAGING, PersistentRegistry.ACTIVE, PersistentRegistry.ACTIVE.registrySuperTypes.inverse().get(r.getKey())); + final Class registrySuperType = PersistentRegistry.ACTIVE.getRegistrySuperType(r.getKey()); + loadRegistry(r.getKey(), PersistentRegistry.STAGING, PersistentRegistry.ACTIVE, registrySuperType); } // Dump the active registry @@ -254,7 +265,7 @@ public class PersistentRegistryManager } } - private static void loadRegistry(final ResourceLocation registryName, final PersistentRegistry from, final PersistentRegistry to, Class regType) + private static > void loadRegistry(final ResourceLocation registryName, final PersistentRegistry from, final PersistentRegistry to, final Class regType) { FMLControlledNamespacedRegistry fromRegistry = from.getRegistry(registryName, regType); if (fromRegistry == null) @@ -290,14 +301,14 @@ public class PersistentRegistryManager } } - private static void loadFrozenDataToStagingRegistry(Map> remaps, ResourceLocation registryName, Class regType) + private static > void loadFrozenDataToStagingRegistry(Map> remaps, ResourceLocation registryName, Class regType) { FMLControlledNamespacedRegistry frozenRegistry = PersistentRegistry.FROZEN.getRegistry(registryName, regType); FMLControlledNamespacedRegistry newRegistry = PersistentRegistry.STAGING.getOrShallowCopyRegistry(registryName, regType, frozenRegistry); newRegistry.loadIds(frozenRegistry.getEntriesNotIn(newRegistry), Maps.newLinkedHashMap(), remaps.get(registryName), frozenRegistry, registryName); } - private static void loadPersistentDataToStagingRegistry(boolean injectFrozenData, Map> remaps, LinkedHashMap> missing, Map.Entry snapEntry, Class regType) + private static > void loadPersistentDataToStagingRegistry(boolean injectFrozenData, Map> remaps, LinkedHashMap> missing, Map.Entry snapEntry, Class regType) { ResourceLocation registryName = snapEntry.getKey(); @@ -311,6 +322,7 @@ public class PersistentRegistryManager { FMLLog.severe("An unknown persistent registry type \"%s\" has been encountered. This Forge instance cannot understand it.", registryName); StartupQuery.abort(); + return; // fake exit to shut up null analysis } FMLControlledNamespacedRegistry newRegistry = PersistentRegistry.STAGING.getOrShallowCopyRegistry(registryName, regType, currentRegistry); // Copy the persistent substitution set from the currently active one into the new registry @@ -350,7 +362,8 @@ public class PersistentRegistryManager } for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) { - loadRegistry(r.getKey(), PersistentRegistry.FROZEN, PersistentRegistry.ACTIVE, PersistentRegistry.ACTIVE.registrySuperTypes.inverse().get(r.getKey())); + final Class registrySuperType = PersistentRegistry.ACTIVE.getRegistrySuperType(r.getKey()); + loadRegistry(r.getKey(), PersistentRegistry.FROZEN, PersistentRegistry.ACTIVE, registrySuperType); } // the id mapping has reverted, fire remap events for those that care about id changes Loader.instance().fireRemapEvent(ImmutableMap.of(), ImmutableMap.of(), true); @@ -365,7 +378,9 @@ public class PersistentRegistryManager FMLLog.fine("Freezing block and item id maps"); for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) { - loadRegistry(r.getKey(), PersistentRegistry.ACTIVE, PersistentRegistry.FROZEN, PersistentRegistry.ACTIVE.registrySuperTypes.inverse().get(r.getKey())); + // This has to be performed prior to invoking the method so the compiler can precompute the type bounds for the method + final Class registrySuperType = PersistentRegistry.ACTIVE.getRegistrySuperType(r.getKey()); + loadRegistry(r.getKey(), PersistentRegistry.ACTIVE, PersistentRegistry.FROZEN, registrySuperType); } forAllRegistries(PersistentRegistry.FROZEN, ValidateRegistryFunction.OPERATION); } @@ -576,7 +591,7 @@ public class PersistentRegistryManager public final Map entries = Maps.newHashMap(); } - public static RegistryDelegate makeDelegate(T obj, Class rootClass) + public static > RegistryDelegate makeDelegate(T obj, Class rootClass) { return PersistentRegistry.ACTIVE.getRegistry(rootClass).getDelegate(obj, rootClass); } @@ -617,4 +632,5 @@ public class PersistentRegistryManager return null; } } + } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/RegistryDelegate.java b/src/main/java/net/minecraftforge/fml/common/registry/RegistryDelegate.java index 993542eb34..c0c5583dbb 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/RegistryDelegate.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/RegistryDelegate.java @@ -23,23 +23,12 @@ public interface RegistryDelegate { */ T get(); - /** - * Get the name of this delegate. This is completely static after registration has completed and will never change. - * - * Deprecated in favour of the resource location. - * - * @see #getResourceName() - * @return The name - */ - @Deprecated - String name(); - /** * Get the unique resource location for this delegate. Completely static after registration has completed, and * will never change. * @return The name */ - ResourceLocation getResourceName(); + ResourceLocation name(); /** * Get the delegate type. It will be dependent on the registry this delegate is sourced from. @@ -67,12 +56,7 @@ public interface RegistryDelegate { } @Override - public String name() { - return name.toString(); - } - - @Override - public ResourceLocation getResourceName() { return name; } + public ResourceLocation name() { return name; } @Override public Class type() @@ -85,7 +69,7 @@ public interface RegistryDelegate { this.referent = newTarget; } - void setResourceName(ResourceLocation name) { this.name = name; } + void setName(ResourceLocation name) { this.name = name; } @Override public boolean equals(Object obj) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java index 577edc2652..f0cfb52a3a 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java @@ -12,8 +12,6 @@ package net.minecraftforge.fml.common.registry; -import java.util.Collection; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Random; @@ -42,10 +40,6 @@ import net.minecraft.world.gen.structure.StructureComponent; import net.minecraft.world.gen.structure.StructureVillagePieces; import net.minecraft.world.gen.structure.StructureVillagePieces.PieceWeight; import net.minecraft.world.gen.structure.StructureVillagePieces.Village; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - /** * Registry for villager trading control * @@ -57,9 +51,6 @@ public class VillagerRegistry private static final VillagerRegistry INSTANCE = new VillagerRegistry(); private Map, IVillageCreationHandler> villageCreationHandlers = Maps.newHashMap(); - private List newVillagerIds = Lists.newArrayList(); - @SideOnly(Side.CLIENT) - private Map newVillagers; private VillagerRegistry() { @@ -110,39 +101,6 @@ public class VillagerRegistry return INSTANCE; } - /** - * Register your villager id - * - * @param id - */ - @Deprecated // Doesn't work at all. - public void registerVillagerId(int id) - { - if (newVillagerIds.contains(id)) - { - FMLLog.severe("Attempt to register duplicate villager id %d", id); - throw new RuntimeException(); - } - newVillagerIds.add(id); - } - - /** - * Register a new skin for a villager type - * - * @param villagerId - * @param villagerSkin - */ - @SideOnly(Side.CLIENT) - @Deprecated // Doesn't work at all. - public void registerVillagerSkin(int villagerId, ResourceLocation villagerSkin) - { - if (newVillagers == null) - { - newVillagers = Maps.newHashMap(); - } - newVillagers.put(villagerId, villagerSkin); - } - /** * Register a new village creation handler * @@ -153,34 +111,6 @@ public class VillagerRegistry villageCreationHandlers.put(handler.getComponentClass(), handler); } - /** - * Callback to setup new villager types - * - * @param villagerType - * @param defaultSkin - */ - @SideOnly(Side.CLIENT) - @Deprecated // Doesn't work at all. - public static ResourceLocation getVillagerSkin(int villagerType, ResourceLocation defaultSkin) - { - if (instance().newVillagers != null && instance().newVillagers.containsKey(villagerType)) - { - return instance().newVillagers.get(villagerType); - } - return defaultSkin; - } - - /** - * Returns a list of all added villager types - * - * @return newVillagerIds - */ - @Deprecated // Doesn't work at all. - public static Collection getRegisteredVillagers() - { - return Collections.unmodifiableCollection(instance().newVillagerIds); - } - public static void addExtraVillageComponents(List list, Random random, int i) { List parts = list; @@ -207,7 +137,8 @@ public class VillagerRegistry } private boolean hasInit = false; - private FMLControlledNamespacedRegistry professions = PersistentRegistryManager.createRegistry(PROFESSIONS, VillagerProfession.class, null, 1024, 0, true, null); + private FMLControlledNamespacedRegistry professions = PersistentRegistryManager.createRegistry(PROFESSIONS, VillagerProfession.class, null, 0, 1024, true, null, null, null); + public IForgeRegistry getRegistry() { return this.professions; } private void init() @@ -250,18 +181,17 @@ public class VillagerRegistry } } - public static class VillagerProfession + public static class VillagerProfession extends IForgeRegistryEntry.Impl { private ResourceLocation name; private ResourceLocation texture; private List careers = Lists.newArrayList(); - public final RegistryDelegate delegate = PersistentRegistryManager.makeDelegate(this, VillagerProfession.class); public VillagerProfession(String name, String texture) { this.name = new ResourceLocation(name); this.texture = new ResourceLocation(texture); - ((RegistryDelegate.Delegate)delegate).setResourceName(this.name); + this.setRegistryName(this.name); } private void register(VillagerCareer career) @@ -271,6 +201,22 @@ public class VillagerRegistry career.id = careers.size(); careers.add(career); } + + public ResourceLocation getSkin() { return this.texture; } + public VillagerCareer getCareer(int id) + { + for (VillagerCareer car : this.careers) + { + if (car.id == id) + return car; + } + return this.careers.get(0); + } + + public int getRandomCareer(Random rand) + { + return this.careers.get(rand.nextInt(this.careers.size())).id; + } } public static class VillagerCareer @@ -278,6 +224,7 @@ public class VillagerRegistry private VillagerProfession profession; private String name; private int id; + private ITradeList[][] trades; public VillagerCareer(VillagerProfession parent, String name) { @@ -286,8 +233,19 @@ public class VillagerRegistry parent.register(this); } - private VillagerCareer init(EntityVillager.ITradeList[][] traids) + public String getName() { + return this.name; + } + + public ITradeList[][] getTrades() + { + return this.trades; + } + + private VillagerCareer init(EntityVillager.ITradeList[][] trades) + { + this.trades = trades; return this; } @@ -316,9 +274,7 @@ public class VillagerRegistry public static void setRandomProfession(EntityVillager entity, Random rand) { Set entries = INSTANCE.professions.getKeys(); - int prof = rand.nextInt(entries.size()); - //TODO: Grab id range from internal registry - entity.setProfession(rand.nextInt(5)); + entity.setProfession(rand.nextInt(entries.size())); } //TODO: Figure out a good generic system for this. Put on hold for Patches. diff --git a/src/main/java/net/minecraftforge/oredict/OreDictionary.java b/src/main/java/net/minecraftforge/oredict/OreDictionary.java index 806e382173..8de0550e7f 100644 --- a/src/main/java/net/minecraftforge/oredict/OreDictionary.java +++ b/src/main/java/net/minecraftforge/oredict/OreDictionary.java @@ -326,7 +326,7 @@ public class OreDictionary // HACK: use the registry name's ID. It is unique and it knows about substitutions. Fallback to a -1 value (what Item.getIDForItem would have returned) in the case where the registry is not aware of the item yet // IT should be noted that -1 will fail the gate further down, if an entry already exists with value -1 for this name. This is what is broken and being warned about. // APPARENTLY it's quite common to do this. OreDictionary should be considered alongside Recipes - you can't make them properly until you've registered with the game. - ResourceLocation registryName = stack.getItem().delegate.getResourceName(); + ResourceLocation registryName = stack.getItem().delegate.name(); int id; if (registryName == null) { @@ -488,7 +488,7 @@ public class OreDictionary // HACK: use the registry name's ID. It is unique and it knows about substitutions. Fallback to a -1 value (what Item.getIDForItem would have returned) in the case where the registry is not aware of the item yet // IT should be noted that -1 will fail the gate further down, if an entry already exists with value -1 for this name. This is what is broken and being warned about. // APPARENTLY it's quite common to do this. OreDictionary should be considered alongside Recipes - you can't make them properly until you've registered with the game. - ResourceLocation registryName = ore.getItem().delegate.getResourceName(); + ResourceLocation registryName = ore.getItem().delegate.name(); int hash; if (registryName == null) { @@ -555,7 +555,7 @@ public class OreDictionary for (ItemStack ore : ores) { // HACK: use the registry name's ID. It is unique and it knows about substitutions - ResourceLocation name = ore.getItem().delegate.getResourceName(); + ResourceLocation name = ore.getItem().delegate.name(); int hash; if (name == null) { From acf8220414c5055551f11e6b79a71123746c8f9a Mon Sep 17 00:00:00 2001 From: cpw Date: Fri, 1 Apr 2016 21:28:28 -0400 Subject: [PATCH 177/243] Reconcile Block.patch --- .../net/minecraft/block/Block.java.patch | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 5f8654e43b..8e26daf20b 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -182,15 +182,20 @@ } protected ItemStack func_180643_i(IBlockState p_180643_1_) -@@ -747,6 +764,7 @@ +@@ -747,9 +764,11 @@ p_176216_2_.field_70181_x = 0.0D; } + @Deprecated // Forge: Use more sensitive version below: getPickBlock public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) { - return new ItemStack(Item.func_150898_a(this), 1, this.func_180651_a(p_185473_3_)); -@@ -844,6 +862,1120 @@ +- return new ItemStack(Item.func_150898_a(this), 1, this.func_180651_a(p_185473_3_)); ++ Item item = Item.func_150898_a(this); ++ return item == null ? null : new ItemStack(item, 1, this.func_180651_a(p_185473_3_)); + } + + @SideOnly(Side.CLIENT) +@@ -844,6 +863,1141 @@ return "Block{" + field_149771_c.func_177774_c(this) + "}"; } @@ -1275,13 +1280,24 @@ + + /** + * Queries if this block should render in a given layer. -+ * ISmartBlockModel can use MinecraftForgeClient.getRenderLayer to alter their model based on layer ++ * ISmartBlockModel can use {@link MinecraftForgeClient#getRenderLayer()} to alter their model based on layer. ++ * ++ * @deprecated New method with state sensitivity: {@link #canRenderInLayer(IBlockState, BlockRenderLayer)} + */ ++ @Deprecated + public boolean canRenderInLayer(BlockRenderLayer layer) + { + return func_180664_k() == layer; + } + ++ /** ++ * Queries if this block should render in a given layer. ++ * ISmartBlockModel can use {@link MinecraftForgeClient#getRenderLayer()} to alter their model based on layer. ++ */ ++ public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) ++ { ++ return canRenderInLayer(layer); ++ } + // For Internal use only to capture droped items inside getDrops + protected static ThreadLocal captureDrops = new ThreadLocal() + { @@ -1306,6 +1322,16 @@ + } + } + ++ /** ++ * Add information to the blocks tooltip, called from the default implementation of {@link ItemBlock#addInformation(ItemStack, EntityPlayer, List, boolean)} ++ * @param stack The stack the tooltip is being retrieved for ++ * @param player The player retrieving the tooltip ++ * @param tooltip The lines to be displayed on the tooltip ++ * @param advanced If the client has advanced debug tooltips enabled ++ */ ++ public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) ++ { ++ } + /* ========================================= FORGE END ======================================*/ + public static void func_149671_p() From e72c224294519aa80334de786710fb5e24b3fb77 Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 2 Apr 2016 00:00:38 -0400 Subject: [PATCH 178/243] Add registries for soundevents, enchantments and potiontypes MinecraftForge-2576 [1.9] SoundEvents (and Enchantments and PotionTypes) need a FML registry --- .../enchantment/Enchantment.java.patch | 12 +++ .../minecraft/potion/PotionType.java.patch | 16 ++++ .../net/minecraft/util/SoundEvent.java.patch | 14 +++ .../fml/common/registry/GameData.java | 85 ++++++++++++------- .../registry/PersistentRegistryManager.java | 3 + 5 files changed, 97 insertions(+), 33 deletions(-) create mode 100644 patches/minecraft/net/minecraft/potion/PotionType.java.patch create mode 100644 patches/minecraft/net/minecraft/util/SoundEvent.java.patch diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch index bd1ecc9102..682828fbba 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -1,5 +1,17 @@ --- ../src-base/minecraft/net/minecraft/enchantment/Enchantment.java +++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java +@@ -12,9 +12,9 @@ + import net.minecraft.util.registry.RegistryNamespaced; + import net.minecraft.util.text.translation.I18n; + +-public abstract class Enchantment ++public abstract class Enchantment extends net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl + { +- public static final RegistryNamespaced field_185264_b = new RegistryNamespaced(); ++ public static final RegistryNamespaced field_185264_b = net.minecraftforge.fml.common.registry.GameData.getEnchantmentRegistry(); + private final EntityEquipmentSlot[] field_185263_a; + private final Enchantment.Rarity field_77333_a; + public EnumEnchantmentType field_77351_y; @@ -118,7 +118,7 @@ public boolean func_92089_a(ItemStack p_92089_1_) diff --git a/patches/minecraft/net/minecraft/potion/PotionType.java.patch b/patches/minecraft/net/minecraft/potion/PotionType.java.patch new file mode 100644 index 0000000000..43c7e4b7d1 --- /dev/null +++ b/patches/minecraft/net/minecraft/potion/PotionType.java.patch @@ -0,0 +1,16 @@ +--- ../src-base/minecraft/net/minecraft/potion/PotionType.java ++++ ../src-work/minecraft/net/minecraft/potion/PotionType.java +@@ -8,10 +8,11 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class PotionType ++public class PotionType extends net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl + { ++ @Deprecated // unused + private static final ResourceLocation field_185177_b = new ResourceLocation("water"); +- public static final RegistryNamespacedDefaultedByKey field_185176_a = new RegistryNamespacedDefaultedByKey(field_185177_b); ++ public static final RegistryNamespacedDefaultedByKey field_185176_a = net.minecraftforge.fml.common.registry.GameData.getPotionTypesRegistry(); + private static int field_185178_c; + private final String field_185179_d; + private final ImmutableList field_185180_e; diff --git a/patches/minecraft/net/minecraft/util/SoundEvent.java.patch b/patches/minecraft/net/minecraft/util/SoundEvent.java.patch new file mode 100644 index 0000000000..26b5a580d3 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/SoundEvent.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/util/SoundEvent.java ++++ ../src-work/minecraft/net/minecraft/util/SoundEvent.java +@@ -4,9 +4,9 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class SoundEvent ++public class SoundEvent extends net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl + { +- public static final RegistryNamespaced field_187505_a = new RegistryNamespaced(); ++ public static final RegistryNamespaced field_187505_a = net.minecraftforge.fml.common.registry.GameData.getSoundEventRegistry(); + private final ResourceLocation field_187506_b; + private static int field_187507_c = 0; + diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index 3258b9018b..ca49d8294f 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -17,11 +17,15 @@ import java.util.Map; import com.google.common.collect.HashBiMap; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.enchantment.Enchantment; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionType; import net.minecraft.util.ObjectIntIdentityMap; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundEvent; +import net.minecraft.util.registry.RegistryNamespaced; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Loader; @@ -31,14 +35,21 @@ import com.google.common.collect.BiMap; public class GameData { - static final int MIN_BLOCK_ID = 0; - static final int MAX_BLOCK_ID = 4095; - static final int MIN_ITEM_ID = 4096; - static final int MAX_ITEM_ID = 31999; - static final int MIN_POTION_ID = 0; // 0-~31 are vanilla, forge start at 32 - static final int MAX_POTION_ID = 255; // S1DPacketEntityEffect sends bytes, we can only use 255 - static final int MIN_BIOME_ID = 0; // 0-~31 are vanilla, forge start at 32 - static final int MAX_BIOME_ID = 255; // S1DPacketEntityEffect sends bytes, we can only use 255 + private static final int MIN_BLOCK_ID = 0; + private static final int MAX_BLOCK_ID = 4095; + private static final int MIN_ITEM_ID = 4096; + private static final int MAX_ITEM_ID = 31999; + private static final int MIN_POTION_ID = 0; // 0-~31 are vanilla, forge start at 32 + private static final int MAX_POTION_ID = 255; // SPacketEntityEffect sends bytes, we can only use 255 + private static final int MIN_BIOME_ID = 0; + private static final int MAX_BIOME_ID = 255; // Maximum number in a byte in the chunk + private static final int MIN_SOUND_ID = 0; // Varint + private static final int MAX_SOUND_ID = Integer.MAX_VALUE; // Varint (SPacketSoundEffect) + private static final int MIN_POTIONTYPE_ID = 0; // Int + private static final int MAX_POTIONTYPE_ID = Integer.MAX_VALUE; // Int (SPacketEffect) + private static final int MIN_ENCHANTMENT_ID = 0; // Int + private static final int MAX_ENCHANTMENT_ID = Integer.MAX_VALUE; // Int - not serialized as an ID? + private static final ResourceLocation BLOCK_TO_ITEM = new ResourceLocation("minecraft:blocktoitemmap"); private static final ResourceLocation BLOCKSTATE_TO_ID = new ResourceLocation("minecraft:blockstatetoid"); @@ -50,51 +61,63 @@ public class GameData iItemRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ITEMS, Item.class, null, MIN_ITEM_ID, MAX_ITEM_ID, true, ItemCallbacks.INSTANCE, ItemCallbacks.INSTANCE, ItemCallbacks.INSTANCE); iPotionRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONS, Potion.class, null, MIN_POTION_ID, MAX_POTION_ID, false, PotionCallbacks.INSTANCE, PotionCallbacks.INSTANCE, PotionCallbacks.INSTANCE); iBiomeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BIOMES, BiomeGenBase.class, null, MIN_BIOME_ID, MAX_BIOME_ID, false, BiomeCallbacks.INSTANCE, BiomeCallbacks.INSTANCE, BiomeCallbacks.INSTANCE); + iSoundEventRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.SOUNDEVENTS, SoundEvent.class, null, MIN_SOUND_ID, MAX_SOUND_ID, false, null, null, null); + ResourceLocation WATER = new ResourceLocation("water"); + iPotionTypeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONTYPES, PotionType.class, WATER, MIN_POTIONTYPE_ID, MAX_POTIONTYPE_ID, false, null, null, null); + iEnchantmentRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ENCHANTMENTS, Enchantment.class, null, MIN_ENCHANTMENT_ID, MAX_ENCHANTMENT_ID, false, null, null, null); } - // public api + // internal registry objects + private final FMLControlledNamespacedRegistry iBlockRegistry; + private final FMLControlledNamespacedRegistry iItemRegistry; + private final FMLControlledNamespacedRegistry iPotionRegistry; + private final FMLControlledNamespacedRegistry iBiomeRegistry; + private final FMLControlledNamespacedRegistry iSoundEventRegistry; + private final FMLControlledNamespacedRegistry iPotionTypeRegistry; + private final FMLControlledNamespacedRegistry iEnchantmentRegistry; - /** - * Get the currently active block registry. - * - * @return Block Registry. - */ + /** INTERNAL ONLY */ + @Deprecated public static FMLControlledNamespacedRegistry getBlockRegistry() { return getMain().iBlockRegistry; } - /** - * Get the currently active item registry. - * - * @return Item Registry. - */ + /** INTERNAL ONLY */ + @Deprecated public static FMLControlledNamespacedRegistry getItemRegistry() { return getMain().iItemRegistry; } - /** - * Get the currently active potion registry. - * - * @return Potion Registry. - */ + /** INTERNAL ONLY */ + @Deprecated public static FMLControlledNamespacedRegistry getPotionRegistry() { return getMain().iPotionRegistry; } + /** INTERNAL ONLY */ + @Deprecated public static FMLControlledNamespacedRegistry getBiomeRegistry() { return getMain().iBiomeRegistry; } + /** INTERNAL ONLY */ + @Deprecated + public static FMLControlledNamespacedRegistry getSoundEventRegistry() { return getMain().iSoundEventRegistry; } - /*************************************************** - * INTERNAL CODE FROM HERE ON DO NOT USE! - ***************************************************/ + /** INTERNAL ONLY */ + @Deprecated + public static FMLControlledNamespacedRegistry getPotionTypesRegistry() { return getMain().iPotionTypeRegistry; } + /** INTERNAL ONLY */ + @Deprecated + public static FMLControlledNamespacedRegistry getEnchantmentRegistry() { return getMain().iEnchantmentRegistry; } + @Deprecated static Item findItem(String modId, String name) { return getMain().iItemRegistry.getObject(new ResourceLocation(modId, name)); } + @Deprecated static Block findBlock(String modId, String name) { return getMain().iBlockRegistry.getObject(new ResourceLocation(modId, name)); @@ -105,17 +128,13 @@ public class GameData return mainData; } - // internal registry objects - private final FMLControlledNamespacedRegistry iBlockRegistry; - private final FMLControlledNamespacedRegistry iItemRegistry; - private final FMLControlledNamespacedRegistry iPotionRegistry; - private final FMLControlledNamespacedRegistry iBiomeRegistry; - + @Deprecated int registerItem(Item item, String name) // from GameRegistry { return iItemRegistry.add(-1, addPrefix(name), item); } + @Deprecated int registerBlock(Block block, String name) // from GameRegistry { return iBlockRegistry.add(-1, addPrefix(name), block); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index 294f04ff22..04781af814 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -130,6 +130,9 @@ public class PersistentRegistryManager public static final ResourceLocation ITEMS = new ResourceLocation("minecraft:items"); public static final ResourceLocation POTIONS = new ResourceLocation("minecraft:potions"); public static final ResourceLocation BIOMES = new ResourceLocation("minecraft:biomes"); + public static final ResourceLocation SOUNDEVENTS = new ResourceLocation("minecraft:soundevents"); + public static final ResourceLocation POTIONTYPES = new ResourceLocation("minecraft:potiontypes"); + public static final ResourceLocation ENCHANTMENTS = new ResourceLocation("minecraft:enchantments"); public static > FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class registryType, ResourceLocation optionalDefaultKey, int minId, int maxId, boolean hasDelegates, IForgeRegistry.AddCallback addCallback, IForgeRegistry.ClearCallback clearCallback, IForgeRegistry.CreateCallback createCallback) { From c44ed8fbdeb867b35f04fb5a74899c5a3f965fc4 Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 2 Apr 2016 07:50:02 -0400 Subject: [PATCH 179/243] MinecraftForge-2683 InvocationTargetException for Forge 1820 for 1.9 --- .../net/minecraftforge/fml/common/registry/GameData.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index ca49d8294f..5847b7cde4 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -44,11 +44,11 @@ public class GameData private static final int MIN_BIOME_ID = 0; private static final int MAX_BIOME_ID = 255; // Maximum number in a byte in the chunk private static final int MIN_SOUND_ID = 0; // Varint - private static final int MAX_SOUND_ID = Integer.MAX_VALUE; // Varint (SPacketSoundEffect) + private static final int MAX_SOUND_ID = Integer.MAX_VALUE >> 5; // Varint (SPacketSoundEffect) private static final int MIN_POTIONTYPE_ID = 0; // Int - private static final int MAX_POTIONTYPE_ID = Integer.MAX_VALUE; // Int (SPacketEffect) + private static final int MAX_POTIONTYPE_ID = Integer.MAX_VALUE >> 5; // Int (SPacketEffect) private static final int MIN_ENCHANTMENT_ID = 0; // Int - private static final int MAX_ENCHANTMENT_ID = Integer.MAX_VALUE; // Int - not serialized as an ID? + private static final int MAX_ENCHANTMENT_ID = Integer.MAX_VALUE >> 5; // Int - not serialized as an ID? private static final ResourceLocation BLOCK_TO_ITEM = new ResourceLocation("minecraft:blocktoitemmap"); private static final ResourceLocation BLOCKSTATE_TO_ID = new ResourceLocation("minecraft:blockstatetoid"); From c74216bdf288afb5073b9cfda28e995b02e0c4f2 Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 2 Apr 2016 11:38:03 -0400 Subject: [PATCH 180/243] MinecraftForge-2684 [1.9] New Registry ignores keys --- .../fml/common/registry/GameData.java | 22 ++++++++++++++ .../fml/common/registry/GameRegistry.java | 30 +++++++++++++++++-- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index 5847b7cde4..5aad048029 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -32,6 +32,7 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; import com.google.common.collect.BiMap; +import org.apache.logging.log4j.Level; public class GameData { @@ -211,6 +212,27 @@ public class GameData } static > K register(K object, ResourceLocation location) { + if (object == null) + { + FMLLog.getLogger().log(Level.ERROR, "Attempt to register a null object"); + throw new NullPointerException("Attempt to register a null object"); + } + object.setRegistryName(location); + return register(object); + } + + static > K register(K object) + { + if (object == null) + { + FMLLog.getLogger().log(Level.ERROR, "Attempt to register a null object"); + throw new NullPointerException("Attempt to register a null object"); + } + if (object.getRegistryName() == null) + { + FMLLog.getLogger().log(Level.ERROR, "Attempt to register object without having set a registry name {} (type {})", object, object.getClass().getName()); + throw new IllegalArgumentException(String.format("No registry name set for object %s (%s)", object, object.getClass().getName())); + } final IForgeRegistry registry = PersistentRegistryManager.findRegistry(object); registry.register(object); return object; diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java index 873c897a30..41bf24b7d1 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java @@ -60,6 +60,7 @@ import com.google.common.collect.ObjectArrays; import com.google.common.collect.Sets; import com.google.common.primitives.Ints; +@SuppressWarnings({"WeakerAccess", "unused"}) public class GameRegistry { private static Set worldGenerators = Sets.newHashSet(); @@ -127,9 +128,34 @@ public class GameRegistry sortedGeneratorList = ImmutableList.copyOf(list); } - public static > K register(K object, ResourceLocation location) + /** + * Register the previously named {@link IForgeRegistry} object with the registry system. + * Always ensure the object is already named using {@link IForgeRegistryEntry#setRegistryName(ResourceLocation)} + * or another mechanism. + * + * @param object The object to register with a registry + * @param The registry supertype + * @throws IllegalArgumentException if the object is not yet named (use {@link #register(IForgeRegistryEntry, ResourceLocation)} instead) + * @return The object + */ + public static > K register(K object) { - return GameData.register(object, location); + return GameData.register(object); + } + + /** + * Register the unnamed {@link IForgeRegistry} object with the registry system. + * Always make sure you have not previously named the object. + * + * @param object The object to register + * @param name The name to register it with + * @param The registry supertype + * @throws IllegalStateException if the object already has an existing name (use {@link #register(IForgeRegistryEntry)} instead) + * @return The object + */ + public static > K register(K object, ResourceLocation name) + { + return GameData.register(object, name); } /** * Register an item with the item registry with a the name specified in Item.getRegistryName() From 4c8da35655d3947015abb4e2bd9277e52b1afac6 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sat, 2 Apr 2016 18:48:07 +0300 Subject: [PATCH 181/243] Improved UV offset hackery - should fix most visible custom model seams. --- .../block/model/FaceBakery.java.patch | 11 ++++ .../texture/TextureAtlasSprite.java.patch | 19 +++++- .../client/model/b3d/B3DLoader.java | 1 + .../client/model/obj/OBJModel.java | 1 + .../model/pipeline/UnpackedBakedQuad.java | 62 +++++++++++++++++++ 5 files changed, 93 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch index 8e298ade1d..f27905bd1c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -70,6 +70,17 @@ this.func_178404_a(p_188015_1_, j, p_188015_2_, vector3f, i, p_188015_6_, p_188015_4_); } +@@ -139,8 +155,8 @@ + p_178404_1_[i + 1] = Float.floatToRawIntBits(p_178404_4_.y); + p_178404_1_[i + 2] = Float.floatToRawIntBits(p_178404_4_.z); + p_178404_1_[i + 3] = p_178404_5_; +- p_178404_1_[i + 4] = Float.floatToRawIntBits(p_178404_6_.func_94214_a((double)p_178404_7_.func_178348_a(p_178404_3_))); +- p_178404_1_[i + 4 + 1] = Float.floatToRawIntBits(p_178404_6_.func_94207_b((double)p_178404_7_.func_178346_b(p_178404_3_))); ++ p_178404_1_[i + 4] = Float.floatToRawIntBits(p_178404_6_.func_94214_a((double)p_178404_7_.func_178348_a(p_178404_3_) * .999 + p_178404_7_.func_178348_a((p_178404_3_ + 2) % 4) * .001)); ++ p_178404_1_[i + 4 + 1] = Float.floatToRawIntBits(p_178404_6_.func_94207_b((double)p_178404_7_.func_178346_b(p_178404_3_) * .999 + p_178404_7_.func_178346_b((p_178404_3_ + 2) % 4) * .001)); + } + + private void func_178407_a(Vector3f p_178407_1_, BlockPartRotation p_178407_2_) @@ -189,14 +205,19 @@ public int func_188011_a(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, ModelRotation p_188011_4_) diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch index 5ef4028b9d..b7a16e4ae0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -1,6 +1,23 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java -@@ -398,4 +398,30 @@ +@@ -50,12 +50,10 @@ + this.field_110975_c = p_110971_3_; + this.field_110974_d = p_110971_4_; + this.field_130222_e = p_110971_5_; +- float f = (float)(0.009999999776482582D / (double)p_110971_1_); +- float f1 = (float)(0.009999999776482582D / (double)p_110971_2_); +- this.field_110979_l = (float)p_110971_3_ / (float)((double)p_110971_1_) + f; +- this.field_110980_m = (float)(p_110971_3_ + this.field_130223_c) / (float)((double)p_110971_1_) - f; +- this.field_110977_n = (float)p_110971_4_ / (float)p_110971_2_ + f1; +- this.field_110978_o = (float)(p_110971_4_ + this.field_130224_d) / (float)p_110971_2_ - f1; ++ this.field_110979_l = (float)p_110971_3_ / (float)p_110971_1_; ++ this.field_110980_m = (float)(p_110971_3_ + this.field_130223_c) / (float)p_110971_1_; ++ this.field_110977_n = (float)p_110971_4_ / (float)p_110971_2_; ++ this.field_110978_o = (float)(p_110971_4_ + this.field_130224_d) / (float)p_110971_2_; + } + + public void func_94217_a(TextureAtlasSprite p_94217_1_) +@@ -398,4 +396,30 @@ { return "TextureAtlasSprite{name=\'" + this.field_110984_i + '\'' + ", frameCount=" + this.field_110976_a.size() + ", rotated=" + this.field_130222_e + ", x=" + this.field_110975_c + ", y=" + this.field_110974_d + ", height=" + this.field_130224_d + ", width=" + this.field_130223_c + ", u0=" + this.field_110979_l + ", u1=" + this.field_110980_m + ", v0=" + this.field_110977_n + ", v1=" + this.field_110978_o + '}'; } diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 4b8095dd05..02f92be5de 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -722,6 +722,7 @@ public enum B3DLoader implements ICustomModelLoader for(Face f : faces) { UnpackedBakedQuad.Builder quadBuilder = new UnpackedBakedQuad.Builder(format); + quadBuilder.setContractUVs(true); quadBuilder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z)); List textures = null; if(f.getBrush() != null) textures = f.getBrush().getTextures(); diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index 3efab8d738..4aba8091c3 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -1403,6 +1403,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData sprite = ModelLoader.White.INSTANCE; } else sprite = this.textures.get(f.getMaterialName()); UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); + builder.setContractUVs(true); builder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z)); builder.setTexture(sprite); Normal faceNormal = f.getNormal(); diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java b/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java index ac888e12a9..fae9806e3d 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java @@ -3,6 +3,7 @@ package net.minecraftforge.client.model.pipeline; 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.EnumFacing; // advantages: non-fixed-length vertex format, no overhead of packing and unpacking attributes to transform the model @@ -75,6 +76,7 @@ public class UnpackedBakedQuad extends BakedQuad private int vertices = 0; private int elements = 0; private boolean full = false; + private boolean contractUVs = false; public Builder(VertexFormat format) { @@ -87,6 +89,10 @@ public class UnpackedBakedQuad extends BakedQuad return format; } + public void setContractUVs(boolean value) + { + this.contractUVs = value; + } public void setQuadTint(int tint) { this.tint = tint; @@ -132,12 +138,68 @@ public class UnpackedBakedQuad extends BakedQuad } } + private final float eps = 1f / 0x100; + public UnpackedBakedQuad build() { if(!full) { throw new IllegalStateException("not enough data"); } + if(contractUVs) + { + float tX = texture.getOriginX() / texture.getMinU(); + float tY = texture.getOriginY() / texture.getMinV(); + float tS = tX > tY ? tX : tY; + float ep = 1f / (tS * 0x100); + int uve = 0; + while(uve < format.getElementCount()) + { + VertexFormatElement e = format.getElement(uve); + if(e.getUsage() == VertexFormatElement.EnumUsage.UV && e.getIndex() == 0) + { + break; + } + uve++; + } + if(uve == format.getElementCount()) + { + throw new IllegalStateException("Can't contract UVs: format doesn't contain UVs"); + } + float[] uvc = new float[4]; + for(int v = 0; v < 4; v++) + { + for(int i = 0; i < 4; i++) + { + uvc[i] += unpackedData[v][uve][i] / 4; + } + } + for(int v = 0; v < 4; v++) + { + for (int i = 0; i < 4; i++) + { + float uo = unpackedData[v][uve][i]; + float un = uo * (1 - eps) + uvc[i] * eps; + float ud = uo - un; + float aud = ud; + if(aud < 0) aud = -aud; + if(aud < ep) // not moving a fraction of a pixel + { + float udc = uo - uvc[i]; + if(udc < 0) udc = -udc; + if(udc < 2 * ep) // center is closer than 2 fractions of a pixel, don't move too close + { + un = (uo + uvc[i]) / 2; + } + else // move at least by a fraction + { + un = uo + (ud < 0 ? ep : -ep); + } + } + unpackedData[v][uve][i] = un; + } + } + } return new UnpackedBakedQuad(unpackedData, tint, orientation, texture, applyDiffuseLighting, format); } } From efcb9ee570b9d5dc0c4828e487e2dbf242937075 Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 2 Apr 2016 12:19:27 -0400 Subject: [PATCH 182/243] Support ResLocations for IMC --- .../fml/common/event/FMLInterModComms.java | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLInterModComms.java b/src/main/java/net/minecraftforge/fml/common/event/FMLInterModComms.java index 0be1af0350..caf03a04fe 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLInterModComms.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLInterModComms.java @@ -16,6 +16,7 @@ import com.google.common.base.Function; import com.google.common.base.Optional; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Loader; @@ -131,6 +132,15 @@ public class FMLInterModComms { { return (String) value; } + /** + * Get the ResourceLocation value from this message. + * @throws ClassCastException if this message doesn't contain a ResourceLocation value + * @return The string value + */ + public ResourceLocation getResourceLocationValue() + { + return (ResourceLocation) value; + } /** * Get the {@link NBTTagCompound} value from this message @@ -242,6 +252,18 @@ public class FMLInterModComms { return enqueueStartupMessage(modId, new IMCMessage(key, value)); } + /** + * Send a startup time message + * @param modId The modid to send it to + * @param key The mod specific key + * @param value A ResourceLocation value + * @return if the message was enqueued successfully and will be processed during startup + */ + public static boolean sendMessage(String modId, String key, ResourceLocation value) + { + return enqueueStartupMessage(modId, new IMCMessage(key, value)); + } + /** * Send a startup time message * @param modId The modid to send it to @@ -253,7 +275,6 @@ public class FMLInterModComms { { return enqueueStartupMessage(modId, new IMCMessage(key, value)); } - /** * Send a startup time function message * @param modId The modid to send it to @@ -303,6 +324,17 @@ public class FMLInterModComms { enqueueMessage(sourceMod, modId, new IMCMessage(key, value)); } + /** + * Send a post-startup message + * @param sourceMod The mod sending the message + * @param modId The modid to send it to + * @param key The mod specific key + * @param value A string value + */ + public static void sendRuntimeMessage(Object sourceMod, String modId, String key, ResourceLocation value) + { + enqueueMessage(sourceMod, modId, new IMCMessage(key, value)); + } /** * Send a post-startup function message. * From 404995122a6d8f2082a3eae743f9d0aa38e9d6d1 Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 2 Apr 2016 14:16:17 -0400 Subject: [PATCH 183/243] Capture a vanilla freeze - will be used when FML connects to vanilla servers, soon --- .../net/minecraft/init/Bootstrap.java.patch | 10 ++++++++++ .../fml/common/registry/GameData.java | 5 +++++ .../fml/common/registry/IForgeRegistry.java | 2 +- .../common/registry/PersistentRegistryManager.java | 13 +++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 patches/minecraft/net/minecraft/init/Bootstrap.java.patch diff --git a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch new file mode 100644 index 0000000000..21ca820f97 --- /dev/null +++ b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/init/Bootstrap.java ++++ ../src-work/minecraft/net/minecraft/init/Bootstrap.java +@@ -541,6 +541,7 @@ + StatList.func_151178_a(); + BiomeGenBase.func_185358_q(); + func_151353_a(); ++ net.minecraftforge.fml.common.registry.GameData.vanillaSnapshot(); + } + } + diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index 5aad048029..a59082f183 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -244,6 +244,11 @@ public class GameData return (ObjectIntIdentityMap)getMain().iBlockRegistry.getSlaveMap(BLOCKSTATE_TO_ID, ObjectIntIdentityMap.class); } + public static void vanillaSnapshot() + { + PersistentRegistryManager.freezeVanilla(); + } + //Lets us clear the map so we can rebuild it. static class ClearableObjectIntIdentityMap extends ObjectIntIdentityMap { diff --git a/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistry.java index 17147cb190..eb00d5b571 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistry.java @@ -12,7 +12,7 @@ import net.minecraft.util.ResourceLocation; * * @param The top level type for the registry */ -@SuppressWarnings("WeakerAccess") +@SuppressWarnings({"WeakerAccess", "unused"}) public interface IForgeRegistry> extends Iterable { public Class getRegistrySuperType(); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index 04781af814..4fd8232ca5 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -388,6 +388,19 @@ public class PersistentRegistryManager forAllRegistries(PersistentRegistry.FROZEN, ValidateRegistryFunction.OPERATION); } + public static void freezeVanilla() + { + FMLLog.fine("Creating vanilla freeze snapshot"); + for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) + { + // This has to be performed prior to invoking the method so the compiler can precompute the type bounds for the method + final Class registrySuperType = PersistentRegistry.ACTIVE.getRegistrySuperType(r.getKey()); + loadRegistry(r.getKey(), PersistentRegistry.ACTIVE, PersistentRegistry.VANILLA, registrySuperType); + } + forAllRegistries(PersistentRegistry.VANILLA, ValidateRegistryFunction.OPERATION); + FMLLog.fine("Vanilla freeze snapshot created"); + } + public static List processIdRematches(Iterable missedMappings, boolean isLocalWorld, Map missingBlocks, Map missingItems, Map remapBlocks, Map remapItems) { List failed = Lists.newArrayList(); From 8058c675abf7cd617d0292fa2ee3c4daa753c2f0 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sat, 2 Apr 2016 12:01:40 -0700 Subject: [PATCH 184/243] Fixed compile error in registry code with Eclipse. --- .../fml/common/registry/PersistentRegistryManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index 4fd8232ca5..03e2257edd 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -139,10 +139,10 @@ public class PersistentRegistryManager return PersistentRegistry.ACTIVE.createRegistry(registryName, registryType, optionalDefaultKey, minId, maxId, addCallback, clearCallback, createCallback); } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) static > IForgeRegistry findRegistry(IForgeRegistryEntry entry) { - final Class registryType = (Class)entry.getRegistryType(); + final Class registryType = (Class)(Class)entry.getRegistryType(); final FMLControlledNamespacedRegistry registry = PersistentRegistry.ACTIVE.getRegistry(registryType); if (registry == null) { From 34c3af7e853d578c8e17e1f0cdf886251fad74ae Mon Sep 17 00:00:00 2001 From: mezz Date: Sat, 2 Apr 2016 21:25:44 -0700 Subject: [PATCH 185/243] Add key binding modifiers and contexts. Same as #2674, but for Minecraft 1.9 --- .../net/minecraft/client/Minecraft.java.patch | 10 +- .../client/gui/GuiControls.java.patch | 49 ++++++ .../client/gui/GuiKeyBindingList.java.patch | 53 ++++++ .../client/settings/GameSettings.java.patch | 62 ++++++- .../client/settings/KeyBinding.java.patch | 155 ++++++++++++++++++ .../client/settings/IKeyConflictContext.java | 20 +++ .../client/settings/KeyBindingMap.java | 74 +++++++++ .../client/settings/KeyConflictContext.java | 59 +++++++ .../client/settings/KeyModifier.java | 124 ++++++++++++++ .../resources/assets/forge/lang/en_US.lang | 4 + 10 files changed, 608 insertions(+), 2 deletions(-) create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch create mode 100644 patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch create mode 100644 src/main/java/net/minecraftforge/client/settings/IKeyConflictContext.java create mode 100644 src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java create mode 100644 src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java create mode 100644 src/main/java/net/minecraftforge/client/settings/KeyModifier.java diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 7ceb60ead1..3d1788e0ea 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -474,7 +474,15 @@ } public boolean func_70002_Q() -@@ -3192,4 +3084,10 @@ +@@ -3066,6 +2958,7 @@ + this.field_71456_v.func_146158_b().func_146227_a(ScreenShotHelper.func_148260_a(this.field_71412_D, this.field_71443_c, this.field_71440_d, this.field_147124_at)); + } + } ++ else if (this.field_71462_r instanceof GuiControls) ((GuiControls)this.field_71462_r).field_146491_f = null; + } + } + } +@@ -3192,4 +3085,10 @@ { return this.field_184127_aH; } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch new file mode 100644 index 0000000000..ee31589c94 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch @@ -0,0 +1,49 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiControls.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiControls.java +@@ -66,6 +66,7 @@ + for (KeyBinding keybinding : this.field_146297_k.field_71474_y.field_74324_K) + { + keybinding.func_151462_b(keybinding.func_151469_h()); ++ keybinding.setKeyModifier(keybinding.getKeyModifierDefault()); + } + + KeyBinding.func_74508_b(); +@@ -81,6 +82,7 @@ + { + if (this.field_146491_f != null) + { ++ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.getActiveModifier()); + this.field_146497_i.func_151440_a(this.field_146491_f, -100 + p_73864_3_); + this.field_146491_f = null; + KeyBinding.func_74508_b(); +@@ -105,17 +107,21 @@ + { + if (p_73869_2_ == 1) + { ++ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.NONE); + this.field_146497_i.func_151440_a(this.field_146491_f, 0); + } + else if (p_73869_2_ != 0) + { ++ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(p_73869_2_) ? net.minecraftforge.client.settings.KeyModifier.NONE : net.minecraftforge.client.settings.KeyModifier.getActiveModifier()); + this.field_146497_i.func_151440_a(this.field_146491_f, p_73869_2_); + } + else if (p_73869_1_ > 0) + { ++ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(p_73869_2_) ? net.minecraftforge.client.settings.KeyModifier.NONE : net.minecraftforge.client.settings.KeyModifier.getActiveModifier()); + this.field_146497_i.func_151440_a(this.field_146491_f, p_73869_1_ + 256); + } + ++ if (!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(p_73869_2_)) + this.field_146491_f = null; + this.field_152177_g = Minecraft.func_71386_F(); + KeyBinding.func_74508_b(); +@@ -135,7 +141,7 @@ + + for (KeyBinding keybinding : this.field_146497_i.field_74324_K) + { +- if (keybinding.func_151463_i() != keybinding.func_151469_h()) ++ if (keybinding.func_151463_i() != keybinding.func_151469_h() || keybinding.getKeyModifier() != keybinding.getKeyModifierDefault()) + { + flag = false; + break; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch new file mode 100644 index 0000000000..b3c50b3cdd --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch @@ -0,0 +1,53 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java +@@ -62,7 +62,7 @@ + + protected int func_148137_d() + { +- return super.func_148137_d() + 15; ++ return super.func_148137_d() + 35; + } + + public int func_148139_c() +@@ -113,7 +113,7 @@ + { + this.field_148282_b = p_i45029_2_; + this.field_148283_c = I18n.func_135052_a(p_i45029_2_.func_151464_g(), new Object[0]); +- this.field_148280_d = new GuiButton(0, 0, 0, 75, 20, I18n.func_135052_a(p_i45029_2_.func_151464_g(), new Object[0])); ++ this.field_148280_d = new GuiButton(0, 0, 0, 95, 20, I18n.func_135052_a(p_i45029_2_.func_151464_g(), new Object[0])); + this.field_148281_e = new GuiButton(0, 0, 0, 50, 20, I18n.func_135052_a("controls.reset", new Object[0])); + } + +@@ -121,20 +121,20 @@ + { + boolean flag = GuiKeyBindingList.this.field_148191_k.field_146491_f == this.field_148282_b; + GuiKeyBindingList.this.field_148189_l.field_71466_p.func_78276_b(this.field_148283_c, p_180790_2_ + 90 - GuiKeyBindingList.this.field_148188_n, p_180790_3_ + p_180790_5_ / 2 - GuiKeyBindingList.this.field_148189_l.field_71466_p.field_78288_b / 2, 16777215); +- this.field_148281_e.field_146128_h = p_180790_2_ + 190; ++ this.field_148281_e.field_146128_h = p_180790_2_ + 210; + this.field_148281_e.field_146129_i = p_180790_3_; +- this.field_148281_e.field_146124_l = this.field_148282_b.func_151463_i() != this.field_148282_b.func_151469_h(); ++ this.field_148281_e.field_146124_l = this.field_148282_b.func_151463_i() != this.field_148282_b.func_151469_h() || this.field_148282_b.getKeyModifier() != this.field_148282_b.getKeyModifierDefault(); + this.field_148281_e.func_146112_a(GuiKeyBindingList.this.field_148189_l, p_180790_6_, p_180790_7_); + this.field_148280_d.field_146128_h = p_180790_2_ + 105; + this.field_148280_d.field_146129_i = p_180790_3_; +- this.field_148280_d.field_146126_j = GameSettings.func_74298_c(this.field_148282_b.func_151463_i()); ++ this.field_148280_d.field_146126_j = this.field_148282_b.getKeyModifier().getLocalizedComboName(GameSettings.func_74298_c(this.field_148282_b.func_151463_i())); + boolean flag1 = false; + + if (this.field_148282_b.func_151463_i() != 0) + { + for (KeyBinding keybinding : GuiKeyBindingList.this.field_148189_l.field_71474_y.field_74324_K) + { +- if (keybinding != this.field_148282_b && keybinding.func_151463_i() == this.field_148282_b.func_151463_i()) ++ if (keybinding != this.field_148282_b && keybinding.conflicts(this.field_148282_b)) + { + flag1 = true; + break; +@@ -163,6 +163,7 @@ + } + else if (this.field_148281_e.func_146116_c(GuiKeyBindingList.this.field_148189_l, p_148278_2_, p_148278_3_)) + { ++ this.field_148282_b.setKeyModifier(this.field_148282_b.getKeyModifierDefault()); + GuiKeyBindingList.this.field_148189_l.field_71474_y.func_151440_a(this.field_148282_b, this.field_148282_b.func_151469_h()); + KeyBinding.func_74508_b(); + return true; diff --git a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch index 5a85b1f679..a62941dc5e 100644 --- a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch +++ b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch @@ -1,6 +1,30 @@ --- ../src-base/minecraft/net/minecraft/client/settings/GameSettings.java +++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java -@@ -887,6 +887,7 @@ +@@ -147,6 +147,7 @@ + + public GameSettings(Minecraft p_i46326_1_, File p_i46326_2_) + { ++ setForgeKeybindProperties(); + this.field_74324_K = (KeyBinding[])ArrayUtils.addAll(new KeyBinding[] {this.field_74312_F, this.field_74313_G, this.field_74351_w, this.field_74370_x, this.field_74368_y, this.field_74366_z, this.field_74314_A, this.field_74311_E, this.field_151444_V, this.field_74316_C, this.field_151445_Q, this.field_74310_D, this.field_74321_H, this.field_74322_I, this.field_74323_J, this.field_151447_Z, this.field_151457_aa, this.field_151458_ab, this.field_152395_am, this.field_178883_an, this.field_186718_X}, this.field_151456_ac); + this.field_74318_M = EnumDifficulty.NORMAL; + this.field_74332_R = ""; +@@ -171,6 +172,7 @@ + + public GameSettings() + { ++ setForgeKeybindProperties(); + this.field_74324_K = (KeyBinding[])ArrayUtils.addAll(new KeyBinding[] {this.field_74312_F, this.field_74313_G, this.field_74351_w, this.field_74370_x, this.field_74368_y, this.field_74366_z, this.field_74314_A, this.field_74311_E, this.field_151444_V, this.field_74316_C, this.field_151445_Q, this.field_74310_D, this.field_74321_H, this.field_74322_I, this.field_74323_J, this.field_151447_Z, this.field_151457_aa, this.field_151458_ab, this.field_152395_am, this.field_178883_an, this.field_186718_X}, this.field_151456_ac); + this.field_74318_M = EnumDifficulty.NORMAL; + this.field_74332_R = ""; +@@ -846,6 +848,7 @@ + if (astring[0].equals("key_" + keybinding.func_151464_g())) + { + keybinding.func_151462_b(Integer.parseInt(astring[1])); ++ if (astring.length == 3) keybinding.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.valueOf(astring[2])); + } + } + +@@ -887,6 +890,7 @@ public void func_74303_b() { @@ -8,3 +32,39 @@ try { PrintWriter printwriter = new PrintWriter(new FileWriter(this.field_74354_ai)); +@@ -955,7 +959,8 @@ + + for (KeyBinding keybinding : this.field_74324_K) + { +- printwriter.println("key_" + keybinding.func_151464_g() + ":" + keybinding.func_151463_i()); ++ String keyString = "key_" + keybinding.func_151464_g() + ":" + keybinding.func_151463_i(); ++ printwriter.println(keybinding.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? keyString + ":" + keybinding.getKeyModifier() : keyString); + } + + for (SoundCategory soundcategory : SoundCategory.values()) +@@ -1184,4 +1189,25 @@ + return p_148264_1_; + } + } ++ ++ /******* Forge Start ***********/ ++ private void setForgeKeybindProperties() { ++ net.minecraftforge.client.settings.KeyConflictContext inGame = net.minecraftforge.client.settings.KeyConflictContext.IN_GAME; ++ field_74351_w.setKeyConflictContext(inGame); ++ field_74370_x.setKeyConflictContext(inGame); ++ field_74368_y.setKeyConflictContext(inGame); ++ field_74366_z.setKeyConflictContext(inGame); ++ field_74314_A.setKeyConflictContext(inGame); ++ field_74311_E.setKeyConflictContext(inGame); ++ field_151444_V.setKeyConflictContext(inGame); ++ field_74312_F.setKeyConflictContext(inGame); ++ field_74322_I.setKeyConflictContext(inGame); ++ field_74310_D.setKeyConflictContext(inGame); ++ field_74321_H.setKeyConflictContext(inGame); ++ field_74323_J.setKeyConflictContext(inGame); ++ field_151457_aa.setKeyConflictContext(inGame); ++ field_151458_ab.setKeyConflictContext(inGame); ++ field_186718_X.setKeyConflictContext(inGame); ++ } ++ /******* Forge End ***********/ + } diff --git a/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch b/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch new file mode 100644 index 0000000000..4f61d2e0db --- /dev/null +++ b/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch @@ -0,0 +1,155 @@ +--- ../src-base/minecraft/net/minecraft/client/settings/KeyBinding.java ++++ ../src-work/minecraft/net/minecraft/client/settings/KeyBinding.java +@@ -14,7 +14,7 @@ + public class KeyBinding implements Comparable + { + private static final List field_74516_a = Lists.newArrayList(); +- private static final IntHashMap field_74514_b = new IntHashMap(); ++ private static final net.minecraftforge.client.settings.KeyBindingMap field_74514_b = new net.minecraftforge.client.settings.KeyBindingMap(); + private static final Set field_151473_c = Sets.newHashSet(); + private final String field_74515_c; + private final int field_151472_e; +@@ -27,7 +27,7 @@ + { + if (p_74507_0_ != 0) + { +- KeyBinding keybinding = (KeyBinding)field_74514_b.func_76041_a(p_74507_0_); ++ KeyBinding keybinding = (KeyBinding)field_74514_b.lookup(p_74507_0_); + + if (keybinding != null) + { +@@ -40,7 +40,7 @@ + { + if (p_74510_0_ != 0) + { +- KeyBinding keybinding = (KeyBinding)field_74514_b.func_76041_a(p_74510_0_); ++ KeyBinding keybinding = (KeyBinding)field_74514_b.lookup(p_74510_0_); + + if (keybinding != null) + { +@@ -74,11 +74,11 @@ + + public static void func_74508_b() + { +- field_74514_b.func_76046_c(); ++ field_74514_b.clearMap(); + + for (KeyBinding keybinding : field_74516_a) + { +- field_74514_b.func_76038_a(keybinding.field_74512_d, keybinding); ++ field_74514_b.addKey(keybinding.field_74512_d, keybinding); + } + } + +@@ -94,7 +94,7 @@ + this.field_151472_e = p_i45001_2_; + this.field_151471_f = p_i45001_3_; + field_74516_a.add(this); +- field_74514_b.func_76038_a(p_i45001_2_, this); ++ field_74514_b.addKey(p_i45001_2_, this); + field_151473_c.add(p_i45001_3_); + } + +@@ -158,4 +158,102 @@ + + return i; + } ++ ++ /****************** Forge Start *****************************/ ++ private net.minecraftforge.client.settings.KeyModifier keyModifierDefault = net.minecraftforge.client.settings.KeyModifier.NONE; ++ private net.minecraftforge.client.settings.KeyModifier keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE; ++ private net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext = net.minecraftforge.client.settings.KeyConflictContext.UNIVERSAL; ++ private boolean allowsKeyModifiers = false; ++ ++ /** ++ * Convenience constructor for creating KeyBindings with keyConflictContext set. ++ */ ++ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, int keyCode, String category) ++ { ++ this(description, keyConflictContext, net.minecraftforge.client.settings.KeyModifier.NONE, keyCode, category); ++ } ++ ++ /** ++ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set. ++ */ ++ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, int keyCode, String category) ++ { ++ this.field_74515_c = description; ++ this.field_74512_d = keyCode; ++ this.field_151472_e = keyCode; ++ this.field_151471_f = category; ++ this.keyConflictContext = keyConflictContext; ++ this.keyModifier = keyModifier; ++ this.keyModifierDefault = keyModifier; ++ if (keyModifier != net.minecraftforge.client.settings.KeyModifier.NONE) ++ setAllowsKeyModifiers(); ++ field_74516_a.add(this); ++ field_74514_b.addKey(keyCode, this); ++ field_151473_c.add(category); ++ } ++ ++ /** ++ * Call this method to let Forge know that your KeyBinding and code can handle players setting modifiers. ++ * Handling modifiers is made easy by using {@link KeyBinding#isActiveAndMatches(int)} or {@link KeyBinding#isPressed()} ++ * Vanilla code does not handle modifiers, so vanilla keyBinds do not have this set. ++ */ ++ public void setAllowsKeyModifiers() ++ { ++ this.allowsKeyModifiers = true; ++ } ++ ++ /** ++ * Checks that the key conflict context and modifier are active, and that the keyCode matches this binding. ++ */ ++ public boolean isActiveAndMatches(int keyCode) ++ { ++ return keyCode == this.func_151463_i() && getKeyConflictContext().isActive() && getKeyModifier().isActive(); ++ } ++ ++ public void setKeyConflictContext(net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext) ++ { ++ this.keyConflictContext = keyConflictContext; ++ } ++ ++ public net.minecraftforge.client.settings.IKeyConflictContext getKeyConflictContext() ++ { ++ return keyConflictContext; ++ } ++ ++ public net.minecraftforge.client.settings.KeyModifier getKeyModifierDefault() ++ { ++ return keyModifierDefault; ++ } ++ ++ public net.minecraftforge.client.settings.KeyModifier getKeyModifier() ++ { ++ if (allowsKeyModifiers) ++ { ++ return keyModifier; ++ } ++ else ++ { ++ return net.minecraftforge.client.settings.KeyModifier.NONE; ++ } ++ } ++ ++ public void setKeyModifier(net.minecraftforge.client.settings.KeyModifier keyModifier) ++ { ++ field_74514_b.removeKey(this); ++ this.keyModifier = keyModifier; ++ field_74514_b.addKey(field_74512_d, this); ++ } ++ ++ public boolean conflicts(KeyBinding other) ++ { ++ if (getKeyConflictContext().conflicts(other.getKeyConflictContext()) || other.getKeyConflictContext().conflicts(getKeyConflictContext())) ++ { ++ if (!allowsKeyModifiers || !other.allowsKeyModifiers || getKeyModifier() == other.getKeyModifier()) ++ { ++ return func_151463_i() == other.func_151463_i(); ++ } ++ } ++ return false; ++ } ++ /****************** Forge End *****************************/ + } diff --git a/src/main/java/net/minecraftforge/client/settings/IKeyConflictContext.java b/src/main/java/net/minecraftforge/client/settings/IKeyConflictContext.java new file mode 100644 index 0000000000..00297211aa --- /dev/null +++ b/src/main/java/net/minecraftforge/client/settings/IKeyConflictContext.java @@ -0,0 +1,20 @@ +package net.minecraftforge.client.settings; + +import net.minecraft.client.settings.KeyBinding; + +/** + * Defines the context that a {@link KeyBinding} is used. + * Key conflicts occur when a {@link KeyBinding} has the same {@link IKeyConflictContext} and has conflicting modifiers and keyCodes. + */ +public interface IKeyConflictContext { + /** + * @return true if conditions are met to activate {@link KeyBinding}s with this context + */ + boolean isActive(); + + /** + * @return true if the other context can have {@link KeyBinding} conflicts with this one. + * This will be called on both contexts to check for conflicts. + */ + boolean conflicts(IKeyConflictContext other); +} diff --git a/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java b/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java new file mode 100644 index 0000000000..729893e38a --- /dev/null +++ b/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java @@ -0,0 +1,74 @@ +package net.minecraftforge.client.settings; + +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.util.IntHashMap; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.EnumMap; + +public class KeyBindingMap +{ + private static final EnumMap>> map = new java.util.EnumMap>>(KeyModifier.class); + static + { + for (KeyModifier modifier : KeyModifier.values()) + { + map.put(modifier, new IntHashMap>()); + } + } + + public KeyBinding lookup(int keyCode) + { + KeyModifier activeModifier = KeyModifier.getActiveModifier(); + Collection bindings = map.get(activeModifier).lookup(keyCode); + if (bindings != null) + { + for (KeyBinding binding : bindings) + { + if (binding.isActiveAndMatches(keyCode)) + { + return binding; + } + } + } + return null; + } + + public void addKey(int keyCode, KeyBinding keyBinding) + { + KeyModifier keyModifier = keyBinding.getKeyModifier(); + IntHashMap> bindingsMap = map.get(keyModifier); + Collection bindingsForKey = bindingsMap.lookup(keyCode); + if (bindingsForKey == null) + { + bindingsForKey = new ArrayList(); + bindingsMap.addKey(keyCode, bindingsForKey); + } + bindingsForKey.add(keyBinding); + } + + public void removeKey(KeyBinding keyBinding) + { + KeyModifier keyModifier = keyBinding.getKeyModifier(); + int keyCode = keyBinding.getKeyCode(); + IntHashMap> bindingsMap = map.get(keyModifier); + Collection bindingsForKey = bindingsMap.lookup(keyCode); + if (bindingsForKey != null) + { + bindingsForKey.remove(keyBinding); + if (bindingsForKey.isEmpty()) + { + bindingsMap.removeObject(keyCode); + } + } + } + + public void clearMap() + { + for (IntHashMap> bindings : map.values()) + { + bindings.clearMap(); + } + } +} diff --git a/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java b/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java new file mode 100644 index 0000000000..964dadd0c6 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java @@ -0,0 +1,59 @@ +package net.minecraftforge.client.settings; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; + +public enum KeyConflictContext implements IKeyConflictContext +{ + /** + * Universal key bindings are used in every context and will conflict with any other context. + * Key Bindings are universal by default. + */ + UNIVERSAL { + @Override + public boolean isActive() + { + return true; + } + + @Override + public boolean conflicts(IKeyConflictContext other) + { + return true; + } + }, + + /** + * Gui key bindings are only used when a {@link GuiScreen} is open. + */ + GUI { + @Override + public boolean isActive() + { + return Minecraft.getMinecraft().currentScreen != null; + } + + @Override + public boolean conflicts(IKeyConflictContext other) + { + return this == other; + } + }, + + /** + * In-game key bindings are only used when a {@link GuiScreen} is not open. + */ + IN_GAME { + @Override + public boolean isActive() + { + return !GUI.isActive(); + } + + @Override + public boolean conflicts(IKeyConflictContext other) + { + return this == other; + } + } +} diff --git a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java new file mode 100644 index 0000000000..6eb699fe33 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java @@ -0,0 +1,124 @@ +package net.minecraftforge.client.settings; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; +import org.lwjgl.input.Keyboard; + +public enum KeyModifier { + CONTROL { + @Override + protected boolean matches(int keyCode) + { + if (Minecraft.isRunningOnMac) + { + return keyCode == Keyboard.KEY_LMETA || keyCode == Keyboard.KEY_RMETA; + } + else + { + return keyCode == Keyboard.KEY_LCONTROL || keyCode == Keyboard.KEY_RCONTROL; + } + } + + @Override + public boolean isActive() + { + return GuiScreen.isCtrlKeyDown(); + } + + @Override + public String getLocalizedComboName(String keyName) + { + return I18n.format("forge.controlsgui.control", keyName); + } + }, + SHIFT { + @Override + protected boolean matches(int keyCode) + { + return keyCode == Keyboard.KEY_LSHIFT || keyCode == Keyboard.KEY_RSHIFT; + } + + @Override + public boolean isActive() + { + return GuiScreen.isShiftKeyDown(); + } + + @Override + public String getLocalizedComboName(String keyName) + { + return I18n.format("forge.controlsgui.shift", keyName); + } + }, + ALT { + @Override + protected boolean matches(int keyCode) + { + return keyCode == Keyboard.KEY_LMENU || keyCode == Keyboard.KEY_RMENU; + } + + @Override + public boolean isActive() + { + return GuiScreen.isAltKeyDown(); + } + + @Override + public String getLocalizedComboName(String keyName) + { + return I18n.format("forge.controlsgui.alt", keyName); + } + }, + NONE { + @Override + protected boolean matches(int keyCode) + { + return true; + } + + @Override + public boolean isActive() + { + return !SHIFT.isActive() && !CONTROL.isActive() && !ALT.isActive(); + } + + @Override + public String getLocalizedComboName(String keyName) + { + return keyName; + } + }; + + public static final KeyModifier[] MODIFIER_VALUES = {SHIFT, CONTROL, ALT}; + + public static KeyModifier getActiveModifier() + { + for (KeyModifier keyModifier : MODIFIER_VALUES) + { + if (keyModifier.isActive()) + { + return keyModifier; + } + } + return NONE; + } + + public static boolean isKeyCodeModifier(int keyCode) + { + for (KeyModifier keyModifier : MODIFIER_VALUES) + { + if (keyModifier.matches(keyCode)) + { + return true; + } + } + return false; + } + + protected abstract boolean matches(int keyCode); + + public abstract boolean isActive(); + + public abstract String getLocalizedComboName(String keyName); +} diff --git a/src/main/resources/assets/forge/lang/en_US.lang b/src/main/resources/assets/forge/lang/en_US.lang index 507a84a68f..4155a94a00 100644 --- a/src/main/resources/assets/forge/lang/en_US.lang +++ b/src/main/resources/assets/forge/lang/en_US.lang @@ -143,6 +143,10 @@ fml.configgui.tooltip.undoChanges=Undo Changes fml.configgui.tooltip.default=[default: %s] fml.configgui.tooltip.defaultNumeric=[range: %s ~ %s, default: %s] +forge.controlsgui.shift=SHIFT + %s +forge.controlsgui.control=CTRL + %s +forge.controlsgui.alt=ALT + %s + fml.menu.mods=Mods fml.menu.mods.normal=Normal fml.menu.mods.search=Search: From 8374a8028336a32ec90b25ba48d2db5a85477046 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Sun, 3 Apr 2016 15:13:25 +1000 Subject: [PATCH 186/243] Fixed mismatch registry names and mod ids --- .../minecraftforge/fml/common/registry/IForgeRegistryEntry.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistryEntry.java b/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistryEntry.java index d24843b87b..fd3e332350 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistryEntry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistryEntry.java @@ -57,7 +57,7 @@ public interface IForgeRegistryEntry String oldPrefix = index == -1 ? "" : name.substring(0, index); name = index == -1 ? name : name.substring(index + 1); ModContainer mc = Loader.instance().activeModContainer(); - String prefix = mc == null || (mc instanceof InjectedModContainer && ((InjectedModContainer)mc).wrappedContainer instanceof FMLContainer) ? "minecraft" : mc.getModId(); + String prefix = mc == null || (mc instanceof InjectedModContainer && ((InjectedModContainer)mc).wrappedContainer instanceof FMLContainer) ? "minecraft" : mc.getModId().toLowerCase(); if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) { FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name); From 087a7d8c596e9e4c40517dcb94022c4c6eb57deb Mon Sep 17 00:00:00 2001 From: LexManos Date: Sat, 2 Apr 2016 22:16:22 -0700 Subject: [PATCH 187/243] Properly deprecate and link the replacement methods in GameRegistry. Add helper method for registering a block with default ItemBlock because people keep complaining -.- --- .../fml/common/registry/GameRegistry.java | 303 +++++++++--------- 1 file changed, 146 insertions(+), 157 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java index 41bf24b7d1..290b225785 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java @@ -133,6 +133,8 @@ public class GameRegistry * Always ensure the object is already named using {@link IForgeRegistryEntry#setRegistryName(ResourceLocation)} * or another mechanism. * + * Note: That DOES NOT create the ItemBlock for you if this is a Block, you should register that item separately. + * * @param object The object to register with a registry * @param The registry supertype * @throws IllegalArgumentException if the object is not yet named (use {@link #register(IForgeRegistryEntry, ResourceLocation)} instead) @@ -147,6 +149,10 @@ public class GameRegistry * Register the unnamed {@link IForgeRegistry} object with the registry system. * Always make sure you have not previously named the object. * + * It is advised that you set the object's registry name and use {@link #register(IForgeRegistryEntry)} instead. + * + * Note: That DOES NOT create the ItemBlock for you if this is a Block, you should register that item separately. + * * @param object The object to register * @param name The name to register it with * @param The registry supertype @@ -157,31 +163,23 @@ public class GameRegistry { return GameData.register(object, name); } - /** - * Register an item with the item registry with a the name specified in Item.getRegistryName() - * - * @param item The item to register - */ - @Deprecated - public static void registerItem(Item item) - { - registerItem(item, item.getRegistryName().toString()); - } + /** - * Register an item with the item registry with a custom name : this allows for easier server->client resolution + * Registers a named block with the Block registry. This WILL create a new ItemBlock for you with the + * same name and register it with the ItemRegistry. This method is created as a convince method for + * modder and SHOULD NOT be used. Modders should create and register their ItemBlocks like normal items. * - * @param item The item to register - * @param name The mod-unique name of the item + * @param block The block to register with a registry + * @throws IllegalArgumentException if the object is not yet named + * @return The block */ - @Deprecated - public static void registerItem(Item item, String name) + @Deprecated //Modders SHOULD NOT use this, so it'll stay deprecated. Purely added to make lazy modders happy -.- + public static Block registerWithItem(Block block) { - if (Strings.isNullOrEmpty(name)) - { - throw new IllegalArgumentException("Attempted to register a block with no name: " + item); - } - GameData.getMain().registerItem(item, name); + register(block); + register(new ItemBlock(block).setRegistryName(block.getRegistryName())); + return block; } /** @@ -200,117 +198,6 @@ public class GameRegistry GameData.getMain().registerSubstitutionAlias(nameToSubstitute, type, object); } - /** - * Register a block with the name that Block.getRegistryName returns. - * - * @param block The block to register - */ - @Deprecated - public static Block registerBlock(Block block) - { - return registerBlock(block, block.getRegistryName().toString()); - } - - /** - * Register a block with the specified mod specific name - * - * @param block The block to register - * @param name The mod-unique name to register it as, will get prefixed by your modid. - */ - @Deprecated - public static Block registerBlock(Block block, String name) - { - return registerBlock(block, ItemBlock.class, name); - } - - /** - * Register a block with the world, with the specified item class using Block.getRegistryName's name - * - * @param block The block to register - * @param itemclass The item type to register with it : null registers a block without associated item. - */ - @Deprecated - public static Block registerBlock(Block block, Class itemclass) - { - return registerBlock(block, itemclass, block.getRegistryName()); - } - - /** - * Register a block with the world, with the specified item class and block name - * - * @param block The block to register - * @param itemclass The item type to register with it : null registers a block without associated item. - * @param name The mod-unique name to register it as, will get prefixed by your modid. - */ - @Deprecated - public static Block registerBlock(Block block, Class itemclass, String name) - { - return registerBlock(block, itemclass, name, new Object[] {}); - } - - - /** - * Register a block with the world, with the specified item class using Block.getRegistryName's name - * - * @param block The block to register - * @param itemclass The item type to register with it : null registers a block without associated item. - * @param itemCtorArgs Arguments to pass (after the required {@code Block} parameter) to the ItemBlock constructor (optional). - */ - @Deprecated - public static Block registerBlock(Block block, Class itemclass, Object... itemCtorArgs) - { - return registerBlock(block, itemclass, block.getRegistryName().toString(), itemCtorArgs); - } - - /** - * Register a block with the world, with the specified item class, block name and owning modId - * - * @param block The block to register - * @param itemclass The item type to register with it : null registers a block without associated item. - * @param name The mod-unique name to register it as, will get prefixed by your modid. - * @param itemCtorArgs Arguments to pass (after the required {@code Block} parameter) to the ItemBlock constructor (optional). - */ - @Deprecated - public static Block registerBlock(Block block, Class itemclass, String name, Object... itemCtorArgs) - { - if (Strings.isNullOrEmpty(name)) - { - throw new IllegalArgumentException("Attempted to register a block with no name: " + block); - } - if (Loader.instance().isInState(LoaderState.CONSTRUCTING)) - { - FMLLog.warning("The mod %s is attempting to register a block whilst it it being constructed. This is bad modding practice - please use a proper mod lifecycle event.", Loader.instance().activeModContainer()); - } - try - { - assert block != null : "registerBlock: block cannot be null"; - ItemBlock i = null; - if (itemclass != null) - { - Class[] ctorArgClasses = new Class[itemCtorArgs.length + 1]; - ctorArgClasses[0] = Block.class; - for (int idx = 1; idx < ctorArgClasses.length; idx++) - { - ctorArgClasses[idx] = itemCtorArgs[idx - 1].getClass(); - } - Constructor itemCtor = itemclass.getConstructor(ctorArgClasses); - i = itemCtor.newInstance(ObjectArrays.concat(block, itemCtorArgs)); - } - // block registration has to happen first - GameData.getMain().registerBlock(block, name); - if (i != null) - { - GameData.getMain().registerItem(i, name); - GameData.getBlockItemMap().put(block, i); - } - return block; - } catch (Exception e) - { - FMLLog.log(Level.ERROR, e, "Caught an exception during block registration"); - throw new LoaderException(e); - } - } - public static void addRecipe(ItemStack output, Object... params) { addShapedRecipe(output, params); @@ -387,32 +274,6 @@ public class GameRegistry return fuelValue; } - /** - * Look up a mod block in the global "named item list" - * - * @param modId The modid owning the block - * @param name The name of the block itself - * @return The block or null if not found - */ - @Deprecated - public static Block findBlock(String modId, String name) - { - return GameData.findBlock(modId, name); - } - - /** - * Look up a mod item in the global "named item list" - * - * @param modId The modid owning the item - * @param name The name of the item itself - * @return The item or null if not found - */ - @Deprecated - public static Item findItem(String modId, String name) - { - return GameData.findItem(modId, name); - } - public enum Type { BLOCK, @@ -520,4 +381,132 @@ public class GameRegistry return is; } + + + + // ============================= DEPRECATED/INTERNAL MODDERS DO NOT USE ================================= + /** + * Use {@link #register(IForgeRegistryEntry)} instead + */ + @Deprecated public static void registerItem(Item item){ register(item); } + /** + * Use {@link #register(IForgeRegistryEntry)} instead + */ + @Deprecated + public static void registerItem(Item item, String name) + { + if (item.getRegistryName() == null && Strings.isNullOrEmpty(name)) + throw new IllegalArgumentException("Attempted to register a item with no name: " + item); + if (item.getRegistryName() != null && !item.getRegistryName().toString().equals(name)) + throw new IllegalArgumentException("Attempted to register a item with conflicting names. Old: " + item.getRegistryName() + " New: " + name); + register(item.getRegistryName() == null ? item.setRegistryName(name) : item); + } + /** + * Use {@link #register(IForgeRegistryEntry)} instead + */ + @Deprecated + public static Block registerBlock(Block block) + { + register(block); + register(new ItemBlock(block).setRegistryName(block.getRegistryName())); + return block; + } + /** + * Use {@link #register(IForgeRegistryEntry)} instead + */ + @Deprecated + public static Block registerBlock(Block block, String name) + { + if (block.getRegistryName() == null && Strings.isNullOrEmpty(name)) + throw new IllegalArgumentException("Attempted to register a Block with no name: " + block); + if (block.getRegistryName() != null && !block.getRegistryName().toString().equals(name)) + throw new IllegalArgumentException("Attempted to register a Block with conflicting names. Old: " + block.getRegistryName() + " New: " + name); + return registerBlock(block.getRegistryName() != null ? block : block.setRegistryName(name)); + } + /** + * Use {@link #register(IForgeRegistryEntry)} instead + */ + @Deprecated public static Block registerBlock(Block block, Class itemclass){ return registerBlock(block, itemclass, block.getRegistryName()); } + /** + * Use {@link #register(IForgeRegistryEntry)} instead + */ + @Deprecated public static Block registerBlock(Block block, Class itemclass, String name){ return registerBlock(block, itemclass, name, new Object[] {}); } + /** + * Use {@link #register(IForgeRegistryEntry)} instead + */ + @Deprecated public static Block registerBlock(Block block, Class itemclass, Object... itemCtorArgs){ return registerBlock(block, itemclass, block.getRegistryName().toString(), itemCtorArgs); } + /** + * Use {@link #register(IForgeRegistryEntry)} instead + */ + @Deprecated + public static Block registerBlock(Block block, Class itemclass, String name, Object... itemCtorArgs) + { + if (Strings.isNullOrEmpty(name)) + { + throw new IllegalArgumentException("Attempted to register a block with no name: " + block); + } + if (Loader.instance().isInState(LoaderState.CONSTRUCTING)) + { + FMLLog.warning("The mod %s is attempting to register a block whilst it it being constructed. This is bad modding practice - please use a proper mod lifecycle event.", Loader.instance().activeModContainer()); + } + try + { + assert block != null : "registerBlock: block cannot be null"; + if (block.getRegistryName() != null && !block.getRegistryName().toString().equals(name)) + throw new IllegalArgumentException("Attempted to register a Block with conflicting names. Old: " + block.getRegistryName() + " New: " + name); + ItemBlock i = null; + if (itemclass != null) + { + Class[] ctorArgClasses = new Class[itemCtorArgs.length + 1]; + ctorArgClasses[0] = Block.class; + for (int idx = 1; idx < ctorArgClasses.length; idx++) + { + ctorArgClasses[idx] = itemCtorArgs[idx - 1].getClass(); + } + Constructor itemCtor = itemclass.getConstructor(ctorArgClasses); + i = itemCtor.newInstance(ObjectArrays.concat(block, itemCtorArgs)); + } + // block registration has to happen first + register(block.getRegistryName() == null ? block.setRegistryName(name) : block); + if (i != null) + register(i.setRegistryName(name)); + return block; + } catch (Exception e) + { + FMLLog.log(Level.ERROR, e, "Caught an exception during block registration"); + throw new LoaderException(e); + } + } + + /** + * + * Use Block.REGISTRY.getValue(ResourceLocation) instead! + * + * + * Look up a mod block in the global "named item list" + * + * @param modId The modid owning the block + * @param name The name of the block itself + * @return The block or null if not found + */ + @Deprecated + public static Block findBlock(String modId, String name) + { + return GameData.findBlock(modId, name); + } + + /** + * Use Item.REGISTRY.getValue(ResourceLocation) instead! + * + * Look up a mod item in the global "named item list" + * + * @param modId The modid owning the item + * @param name The name of the item itself + * @return The item or null if not found + */ + @Deprecated + public static Item findItem(String modId, String name) + { + return GameData.findItem(modId, name); + } } From 77772ac3f5c68b164752b039f8277bc433cc3705 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sun, 3 Apr 2016 10:13:50 +0300 Subject: [PATCH 188/243] Changed generic signature of GameRegistry.register methods to work around the type inference bug; updated all example mods to the new block/item registration method. --- .../fml/common/registry/GameData.java | 22 ++++++++----- .../fml/common/registry/GameRegistry.java | 10 +++--- .../minecraftforge/debug/DynBucketTest.java | 17 +++++++--- .../debug/ForgeBlockStatesLoaderDebug.java | 4 +-- .../debug/ItemLayerModelDebug.java | 4 ++- .../minecraftforge/debug/ItemTileDebug.java | 6 +++- .../debug/ModelAnimationDebug.java | 12 ++++--- .../debug/ModelBakeEventDebug.java | 8 +++-- .../minecraftforge/debug/ModelFluidDebug.java | 13 ++++++-- .../debug/ModelLoaderRegistryDebug.java | 31 ++++++++++++++----- .../debug/MultiLayerModelDebug.java | 13 +++++--- .../test/NoBedSleepingTest.java | 3 +- 12 files changed, 99 insertions(+), 44 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index a59082f183..15a937f2a6 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -210,32 +210,38 @@ public class GameData { return (BiMap)getMain().iItemRegistry.getSlaveMap(BLOCK_TO_ITEM, BiMap.class); } - static > K register(K object, ResourceLocation location) + + @SuppressWarnings("unchecked") + static > K register_impl(Object object, ResourceLocation location) { if (object == null) { FMLLog.getLogger().log(Level.ERROR, "Attempt to register a null object"); throw new NullPointerException("Attempt to register a null object"); } - object.setRegistryName(location); - return register(object); + ((K)object).setRegistryName(location); + // explicit type is needed for some reason + return GameData.register_impl(object); } - static > K register(K object) + // argument is Object due to incorrect inferrence of the type if source level = 6, probably related to https://bugs.openjdk.java.net/browse/JDK-8026527 + @SuppressWarnings("unchecked") + static > K register_impl(Object object) { + K castedObj = (K)object; if (object == null) { FMLLog.getLogger().log(Level.ERROR, "Attempt to register a null object"); throw new NullPointerException("Attempt to register a null object"); } - if (object.getRegistryName() == null) + if (castedObj.getRegistryName() == null) { FMLLog.getLogger().log(Level.ERROR, "Attempt to register object without having set a registry name {} (type {})", object, object.getClass().getName()); throw new IllegalArgumentException(String.format("No registry name set for object %s (%s)", object, object.getClass().getName())); } - final IForgeRegistry registry = PersistentRegistryManager.findRegistry(object); - registry.register(object); - return object; + final IForgeRegistry registry = PersistentRegistryManager.findRegistry(castedObj); + registry.register(castedObj); + return castedObj; } @SuppressWarnings("unchecked") diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java index 290b225785..ab0d43eb26 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java @@ -140,9 +140,10 @@ public class GameRegistry * @throws IllegalArgumentException if the object is not yet named (use {@link #register(IForgeRegistryEntry, ResourceLocation)} instead) * @return The object */ - public static > K register(K object) + @SuppressWarnings("unchecked") + public static > K register(K object) { - return GameData.register(object); + return (K)GameData.register_impl(object); } /** @@ -159,9 +160,10 @@ public class GameRegistry * @throws IllegalStateException if the object already has an existing name (use {@link #register(IForgeRegistryEntry)} instead) * @return The object */ - public static > K register(K object, ResourceLocation name) + @SuppressWarnings("unchecked") + public static > K register(K object, ResourceLocation name) { - return GameData.register(object, name); + return (K)GameData.register_impl(object, name); } diff --git a/src/test/java/net/minecraftforge/debug/DynBucketTest.java b/src/test/java/net/minecraftforge/debug/DynBucketTest.java index 167acd67d9..1846a92c2e 100644 --- a/src/test/java/net/minecraftforge/debug/DynBucketTest.java +++ b/src/test/java/net/minecraftforge/debug/DynBucketTest.java @@ -1,5 +1,6 @@ package net.minecraftforge.debug; +import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -11,6 +12,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; @@ -49,6 +51,8 @@ public class DynBucketTest public static final String MODID = "DynBucketTest"; public static final Item dynBucket = new DynBucket(); public static final Item dynBottle = new DynBottle(); + private static final ResourceLocation simpleTankName = new ResourceLocation(MODID, "simpletank"); + private static final ResourceLocation testItemName = new ResourceLocation(MODID, "testitem"); static { @@ -86,8 +90,8 @@ public class DynBucketTest } }); ModelBakery.registerItemVariants(dynBottle, bottle); - ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GameRegistry.findBlock(MODID, "simpletank")), 0, new ModelResourceLocation(new ResourceLocation(MODID, "simpletank"), "normal")); - ModelLoader.setCustomModelResourceLocation(GameRegistry.findItem(MODID, "testitem"), 0, new ModelResourceLocation(new ResourceLocation("minecraft", "stick"), "inventory")); + ModelLoader.setCustomModelResourceLocation(Item.itemRegistry.getObject(simpleTankName), 0, new ModelResourceLocation(simpleTankName, "normal")); + ModelLoader.setCustomModelResourceLocation(Item.itemRegistry.getObject(testItemName), 0, new ModelResourceLocation(new ResourceLocation("minecraft", "stick"), "inventory")); } } @@ -95,15 +99,17 @@ public class DynBucketTest @EventHandler public void preInit(FMLPreInitializationEvent event) { - GameRegistry.registerItem(new TestItem(), "testitem"); - GameRegistry.registerBlock(new BlockSimpleTank(), "simpletank"); + GameRegistry.register(new TestItem(), testItemName); + Block tank = new BlockSimpleTank(); + GameRegistry.register(tank, simpleTankName); + GameRegistry.register(new ItemBlock(tank), simpleTankName); GameRegistry.registerTileEntity(TileSimpleTank.class, "simpletank"); FluidRegistry.addBucketForFluid(FluidRegistry.getFluid(TestFluid.name)); FluidRegistry.addBucketForFluid(FluidRegistry.getFluid(TestGas.name)); //GameRegistry.registerItem(dynBucket, "dynbucket"); - GameRegistry.registerItem(dynBottle, "dynbottle"); + GameRegistry.register(dynBottle); // register fluid containers int i = 0; @@ -232,6 +238,7 @@ public class DynBucketTest { super(250, new ItemStack(Items.glass_bottle), true); setUnlocalizedName("dynbottle"); + setRegistryName(new ResourceLocation(MODID, "dynbottle")); setMaxStackSize(16); setHasSubtypes(true); setCreativeTab(CreativeTabs.tabMisc); diff --git a/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java b/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java index 492b9cb807..fcd979faf6 100644 --- a/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java +++ b/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java @@ -54,8 +54,8 @@ public class ForgeBlockStatesLoaderDebug { //GameRegistry.registerBlock(blockCustom); blockCustomWall.setUnlocalizedName(MODID + ".customWall").setRegistryName(nameCustomWall); - GameRegistry.registerBlock(blockCustomWall, (Class)null); - GameRegistry.registerItem(itemCustomWall); + GameRegistry.register(blockCustomWall); + GameRegistry.register(itemCustomWall); GameData.getBlockItemMap().put(blockCustomWall, itemCustomWall); if (event.getSide() == Side.CLIENT) diff --git a/src/test/java/net/minecraftforge/debug/ItemLayerModelDebug.java b/src/test/java/net/minecraftforge/debug/ItemLayerModelDebug.java index 296ba40668..1e827bb0c3 100644 --- a/src/test/java/net/minecraftforge/debug/ItemLayerModelDebug.java +++ b/src/test/java/net/minecraftforge/debug/ItemLayerModelDebug.java @@ -3,6 +3,7 @@ package net.minecraftforge.debug; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; @@ -26,7 +27,7 @@ public class ItemLayerModelDebug { public void preInit(FMLPreInitializationEvent event) { - GameRegistry.registerItem(TestItem.instance, TestItem.name); + GameRegistry.register(TestItem.instance); } } @@ -52,6 +53,7 @@ public class ItemLayerModelDebug { setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); + setRegistryName(new ResourceLocation(MODID, name)); } } } diff --git a/src/test/java/net/minecraftforge/debug/ItemTileDebug.java b/src/test/java/net/minecraftforge/debug/ItemTileDebug.java index 309a4ea6c5..8cd2b7a84b 100644 --- a/src/test/java/net/minecraftforge/debug/ItemTileDebug.java +++ b/src/test/java/net/minecraftforge/debug/ItemTileDebug.java @@ -8,7 +8,9 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.event.ModelBakeEvent; @@ -44,7 +46,8 @@ public class ItemTileDebug { public void preInit(FMLPreInitializationEvent event) { - GameRegistry.registerBlock(TestBlock.instance, TestBlock.name); + GameRegistry.register(TestBlock.instance); + GameRegistry.register(new ItemBlock(TestBlock.instance).setRegistryName(TestBlock.instance.getRegistryName())); GameRegistry.registerTileEntity(CustomTileEntity.class, MODID.toLowerCase() + ":custom_tile_entity"); } @@ -123,6 +126,7 @@ public class ItemTileDebug super(Material.iron); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); + setRegistryName(new ResourceLocation(MODID, name)); } @Override diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index 05bb4b3c04..f546b01f8c 100644 --- a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -64,6 +64,7 @@ public class ModelAnimationDebug public static final String VERSION = "0.0"; public static String blockName = "test_animation_block"; + public static ResourceLocation blockId = new ResourceLocation(MODID, blockName); public static final PropertyDirection FACING = PropertyDirection.create("facing"); @Instance(MODID) @@ -76,11 +77,12 @@ public class ModelAnimationDebug { public void preInit(FMLPreInitializationEvent event) { - GameRegistry.registerBlock(new Block(Material.wood) + GameRegistry.register(new Block(Material.wood) { { setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + "." + blockName); + setRegistryName(blockId); } @Override @@ -149,15 +151,15 @@ public class ModelAnimationDebug } return true; } - }, null, blockName); - GameRegistry.registerItem(new ItemBlock(GameRegistry.findBlock(MODID, blockName)) + }); + GameRegistry.register(new ItemBlock(Block.blockRegistry.getObject(blockId)) { @Override public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) { return new ItemAnimationHolder(); } - }, blockName); + }.setRegistryName(blockId)); GameRegistry.registerTileEntity(Chest.class, MODID + ":" + "tile_" + blockName); } @@ -179,7 +181,7 @@ public class ModelAnimationDebug { super.preInit(event); B3DLoader.INSTANCE.addDomain(MODID); - ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GameRegistry.findBlock(MODID, blockName)), 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + blockName, "inventory")); + ModelLoader.setCustomModelResourceLocation(Item.itemRegistry.getObject(blockId), 0, new ModelResourceLocation(blockId, "inventory")); ClientRegistry.bindTileEntitySpecialRenderer(Chest.class, new AnimationTESR() { @Override diff --git a/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java b/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java index ace5cdec09..478b140a86 100644 --- a/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java @@ -21,11 +21,13 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; @@ -54,7 +56,7 @@ public class ModelBakeEventDebug public static final String VERSION = "1.0"; public static final int cubeSize = 3; - private static String blockName = MODID.toLowerCase() + ":" + CustomModelBlock.name; + private static ResourceLocation blockName = new ResourceLocation(MODID, CustomModelBlock.name); @SuppressWarnings("unchecked") public static final IUnlistedProperty[] properties = new IUnlistedProperty[6]; @@ -77,7 +79,8 @@ public class ModelBakeEventDebug { public void preInit(FMLPreInitializationEvent event) { - GameRegistry.registerBlock(CustomModelBlock.instance, CustomModelBlock.name); + GameRegistry.register(CustomModelBlock.instance); + GameRegistry.register(new ItemBlock(CustomModelBlock.instance).setRegistryName(CustomModelBlock.instance.getRegistryName())); GameRegistry.registerTileEntity(CustomTileEntity.class, MODID.toLowerCase() + ":custom_tile_entity"); } } @@ -132,6 +135,7 @@ public class ModelBakeEventDebug super(Material.iron); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); + setRegistryName(blockName); } @Override diff --git a/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java b/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java index b697f76d91..9937c33429 100644 --- a/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java @@ -8,6 +8,7 @@ import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; @@ -41,9 +42,12 @@ public class ModelFluidDebug FluidRegistry.registerFluid(TestFluid.instance); FluidRegistry.registerFluid(TestGas.instance); FluidRegistry.registerFluid(milkFluid); - GameRegistry.registerBlock(TestFluidBlock.instance, TestFluidBlock.name); - GameRegistry.registerBlock(TestGasBlock.instance, TestGasBlock.name); - GameRegistry.registerBlock(MilkFluidBlock.instance, MilkFluidBlock.name); + GameRegistry.register(TestFluidBlock.instance); + GameRegistry.register(new ItemBlock(TestFluidBlock.instance).setRegistryName(TestFluidBlock.instance.getRegistryName())); + GameRegistry.register(TestGasBlock.instance); + GameRegistry.register(new ItemBlock(TestGasBlock.instance).setRegistryName(TestGasBlock.instance.getRegistryName())); + GameRegistry.register(MilkFluidBlock.instance); + GameRegistry.register(new ItemBlock(MilkFluidBlock.instance).setRegistryName(MilkFluidBlock.instance.getRegistryName())); } } @@ -157,6 +161,7 @@ public class ModelFluidDebug super(TestFluid.instance, Material.water); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); + setRegistryName(new ResourceLocation(MODID, name)); } } @@ -170,6 +175,7 @@ public class ModelFluidDebug super(milkFluid, Material.water); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); + setRegistryName(new ResourceLocation(MODID, name)); } } @@ -183,6 +189,7 @@ public class ModelFluidDebug super(TestGas.instance, Material.lava); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); + setRegistryName(new ResourceLocation(MODID, name)); } } } diff --git a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java index 809f70b2a2..430072227a 100644 --- a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java @@ -24,6 +24,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -63,14 +64,20 @@ public class ModelLoaderRegistryDebug @EventHandler public void preInit(FMLPreInitializationEvent event) { - GameRegistry.registerBlock(CustomModelBlock.instance, CustomModelBlock.name); - GameRegistry.registerBlock(OBJTesseractBlock.instance, OBJTesseractBlock.name); - GameRegistry.registerBlock(OBJVertexColoring1.instance, OBJVertexColoring1.name); - //GameRegistry.registerBlock(OBJDirectionEye.instance, OBJDirectionEye.name); - GameRegistry.registerBlock(OBJVertexColoring2.instance, OBJVertexColoring2.name); - GameRegistry.registerBlock(OBJDirectionBlock.instance, OBJDirectionBlock.name); - GameRegistry.registerBlock(OBJCustomDataBlock.instance, OBJCustomDataBlock.name); - //GameRegistry.registerBlock(OBJDynamicEye.instance, OBJDynamicEye.name); + List blocks = Lists.newArrayList(); + blocks.add(CustomModelBlock.instance); + blocks.add(OBJTesseractBlock.instance); + blocks.add(OBJVertexColoring1.instance); + //blocks.add(OBJDirectionEye.instance); + blocks.add(OBJVertexColoring2.instance); + blocks.add(OBJDirectionBlock.instance); + blocks.add(OBJCustomDataBlock.instance); + //blocks.add(OBJDynamicEye.instance); + for(Block block : blocks) + { + GameRegistry.register(block); + GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName())); + } GameRegistry.registerTileEntity(OBJTesseractTileEntity.class, OBJTesseractBlock.name); GameRegistry.registerTileEntity(OBJVertexColoring2TileEntity.class, OBJVertexColoring2.name); //GameRegistry.registerTileEntity(OBJDynamicEyeTileEntity.class, OBJDynamicEye.name); @@ -121,6 +128,7 @@ public class ModelLoaderRegistryDebug this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); + setRegistryName(new ResourceLocation(MODID, name)); } @Override @@ -220,6 +228,7 @@ public class ModelLoaderRegistryDebug super(Material.iron); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); + setRegistryName(new ResourceLocation(MODID, name)); } @Override @@ -365,6 +374,7 @@ public class ModelLoaderRegistryDebug super(Material.iron); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(name); + setRegistryName(new ResourceLocation(MODID, name)); } @Override @@ -397,6 +407,7 @@ public class ModelLoaderRegistryDebug setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(name); + setRegistryName(new ResourceLocation(MODID, name)); } @Override @@ -479,6 +490,7 @@ public class ModelLoaderRegistryDebug super(Material.iron); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(name); + setRegistryName(new ResourceLocation(MODID, name)); } @Override @@ -582,6 +594,7 @@ public class ModelLoaderRegistryDebug this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); + setRegistryName(new ResourceLocation(MODID, name)); } @Override @@ -669,6 +682,7 @@ public class ModelLoaderRegistryDebug this.setDefaultState(this.blockState.getBaseState().withProperty(NORTH, false).withProperty(SOUTH, false).withProperty(WEST, false).withProperty(EAST, false)); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); + setRegistryName(new ResourceLocation(MODID, name)); } @Override @@ -724,6 +738,7 @@ public class ModelLoaderRegistryDebug super(Material.iron); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); + setRegistryName(new ResourceLocation(MODID, name)); } @Override diff --git a/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java b/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java index 42906bfd5a..468d37c5f8 100644 --- a/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java +++ b/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java @@ -6,7 +6,9 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; @@ -20,7 +22,8 @@ public class MultiLayerModelDebug public static final String MODID = "forgedebugmultilayermodel"; public static final String VERSION = "0.0"; - public static String blockName = "test_layer_block"; + private static String blockName = "test_layer_block"; + private static final ResourceLocation blockId = new ResourceLocation(MODID, blockName); @SidedProxy public static CommonProxy proxy; @@ -29,11 +32,12 @@ public class MultiLayerModelDebug { public void preInit(FMLPreInitializationEvent event) { - GameRegistry.registerBlock(new Block(Material.wood) + GameRegistry.register(new Block(Material.wood) { { setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + "." + blockName); + setRegistryName(blockId); } @Override @@ -47,7 +51,8 @@ public class MultiLayerModelDebug { return layer == BlockRenderLayer.SOLID || layer == BlockRenderLayer.TRANSLUCENT; } - }, blockName); + }); + GameRegistry.register(new ItemBlock(Block.blockRegistry.getObject(blockId)).setRegistryName(blockId)); } } @@ -59,7 +64,7 @@ public class MultiLayerModelDebug public void preInit(FMLPreInitializationEvent event) { super.preInit(event); - ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GameRegistry.findBlock(MODID, blockName)), 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + blockName, "inventory")); + ModelLoader.setCustomModelResourceLocation(Item.itemRegistry.getObject(blockId), 0, new ModelResourceLocation(blockId, "inventory")); } } diff --git a/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java b/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java index b4f728a440..fe1cf7f39c 100644 --- a/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java +++ b/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java @@ -47,7 +47,7 @@ public class NoBedSleepingTest { public void preInit(FMLPreInitializationEvent event) { - GameRegistry.registerItem(ItemSleepingPill.instance, ItemSleepingPill.name); + GameRegistry.register(ItemSleepingPill.instance); CapabilityManager.INSTANCE.register(IExtraSleeping.class, new Storage(), DefaultImpl.class); MinecraftForge.EVENT_BUS.register(new EventHandler()); } @@ -154,6 +154,7 @@ public class NoBedSleepingTest { setCreativeTab(CreativeTabs.tabMisc); setUnlocalizedName(MODID + ":" + name); + setRegistryName(new ResourceLocation(MODID, name)); } @Override From 9baabf924963a53a95e7b9b7094420f3653a5e12 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sun, 3 Apr 2016 11:01:09 +0300 Subject: [PATCH 189/243] Revert "Add key binding modifiers and contexts.", until it's fixed. This reverts commit 34c3af7e853d578c8e17e1f0cdf886251fad74ae. --- .../net/minecraft/client/Minecraft.java.patch | 10 +- .../client/gui/GuiControls.java.patch | 49 ------ .../client/gui/GuiKeyBindingList.java.patch | 53 ------ .../client/settings/GameSettings.java.patch | 62 +------ .../client/settings/KeyBinding.java.patch | 155 ------------------ .../client/settings/IKeyConflictContext.java | 20 --- .../client/settings/KeyBindingMap.java | 74 --------- .../client/settings/KeyConflictContext.java | 59 ------- .../client/settings/KeyModifier.java | 124 -------------- .../resources/assets/forge/lang/en_US.lang | 4 - 10 files changed, 2 insertions(+), 608 deletions(-) delete mode 100644 patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch delete mode 100644 src/main/java/net/minecraftforge/client/settings/IKeyConflictContext.java delete mode 100644 src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java delete mode 100644 src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java delete mode 100644 src/main/java/net/minecraftforge/client/settings/KeyModifier.java diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 3d1788e0ea..7ceb60ead1 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -474,15 +474,7 @@ } public boolean func_70002_Q() -@@ -3066,6 +2958,7 @@ - this.field_71456_v.func_146158_b().func_146227_a(ScreenShotHelper.func_148260_a(this.field_71412_D, this.field_71443_c, this.field_71440_d, this.field_147124_at)); - } - } -+ else if (this.field_71462_r instanceof GuiControls) ((GuiControls)this.field_71462_r).field_146491_f = null; - } - } - } -@@ -3192,4 +3085,10 @@ +@@ -3192,4 +3084,10 @@ { return this.field_184127_aH; } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch deleted file mode 100644 index ee31589c94..0000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiControls.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiControls.java -@@ -66,6 +66,7 @@ - for (KeyBinding keybinding : this.field_146297_k.field_71474_y.field_74324_K) - { - keybinding.func_151462_b(keybinding.func_151469_h()); -+ keybinding.setKeyModifier(keybinding.getKeyModifierDefault()); - } - - KeyBinding.func_74508_b(); -@@ -81,6 +82,7 @@ - { - if (this.field_146491_f != null) - { -+ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.getActiveModifier()); - this.field_146497_i.func_151440_a(this.field_146491_f, -100 + p_73864_3_); - this.field_146491_f = null; - KeyBinding.func_74508_b(); -@@ -105,17 +107,21 @@ - { - if (p_73869_2_ == 1) - { -+ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.NONE); - this.field_146497_i.func_151440_a(this.field_146491_f, 0); - } - else if (p_73869_2_ != 0) - { -+ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(p_73869_2_) ? net.minecraftforge.client.settings.KeyModifier.NONE : net.minecraftforge.client.settings.KeyModifier.getActiveModifier()); - this.field_146497_i.func_151440_a(this.field_146491_f, p_73869_2_); - } - else if (p_73869_1_ > 0) - { -+ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(p_73869_2_) ? net.minecraftforge.client.settings.KeyModifier.NONE : net.minecraftforge.client.settings.KeyModifier.getActiveModifier()); - this.field_146497_i.func_151440_a(this.field_146491_f, p_73869_1_ + 256); - } - -+ if (!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(p_73869_2_)) - this.field_146491_f = null; - this.field_152177_g = Minecraft.func_71386_F(); - KeyBinding.func_74508_b(); -@@ -135,7 +141,7 @@ - - for (KeyBinding keybinding : this.field_146497_i.field_74324_K) - { -- if (keybinding.func_151463_i() != keybinding.func_151469_h()) -+ if (keybinding.func_151463_i() != keybinding.func_151469_h() || keybinding.getKeyModifier() != keybinding.getKeyModifierDefault()) - { - flag = false; - break; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch deleted file mode 100644 index b3c50b3cdd..0000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java -@@ -62,7 +62,7 @@ - - protected int func_148137_d() - { -- return super.func_148137_d() + 15; -+ return super.func_148137_d() + 35; - } - - public int func_148139_c() -@@ -113,7 +113,7 @@ - { - this.field_148282_b = p_i45029_2_; - this.field_148283_c = I18n.func_135052_a(p_i45029_2_.func_151464_g(), new Object[0]); -- this.field_148280_d = new GuiButton(0, 0, 0, 75, 20, I18n.func_135052_a(p_i45029_2_.func_151464_g(), new Object[0])); -+ this.field_148280_d = new GuiButton(0, 0, 0, 95, 20, I18n.func_135052_a(p_i45029_2_.func_151464_g(), new Object[0])); - this.field_148281_e = new GuiButton(0, 0, 0, 50, 20, I18n.func_135052_a("controls.reset", new Object[0])); - } - -@@ -121,20 +121,20 @@ - { - boolean flag = GuiKeyBindingList.this.field_148191_k.field_146491_f == this.field_148282_b; - GuiKeyBindingList.this.field_148189_l.field_71466_p.func_78276_b(this.field_148283_c, p_180790_2_ + 90 - GuiKeyBindingList.this.field_148188_n, p_180790_3_ + p_180790_5_ / 2 - GuiKeyBindingList.this.field_148189_l.field_71466_p.field_78288_b / 2, 16777215); -- this.field_148281_e.field_146128_h = p_180790_2_ + 190; -+ this.field_148281_e.field_146128_h = p_180790_2_ + 210; - this.field_148281_e.field_146129_i = p_180790_3_; -- this.field_148281_e.field_146124_l = this.field_148282_b.func_151463_i() != this.field_148282_b.func_151469_h(); -+ this.field_148281_e.field_146124_l = this.field_148282_b.func_151463_i() != this.field_148282_b.func_151469_h() || this.field_148282_b.getKeyModifier() != this.field_148282_b.getKeyModifierDefault(); - this.field_148281_e.func_146112_a(GuiKeyBindingList.this.field_148189_l, p_180790_6_, p_180790_7_); - this.field_148280_d.field_146128_h = p_180790_2_ + 105; - this.field_148280_d.field_146129_i = p_180790_3_; -- this.field_148280_d.field_146126_j = GameSettings.func_74298_c(this.field_148282_b.func_151463_i()); -+ this.field_148280_d.field_146126_j = this.field_148282_b.getKeyModifier().getLocalizedComboName(GameSettings.func_74298_c(this.field_148282_b.func_151463_i())); - boolean flag1 = false; - - if (this.field_148282_b.func_151463_i() != 0) - { - for (KeyBinding keybinding : GuiKeyBindingList.this.field_148189_l.field_71474_y.field_74324_K) - { -- if (keybinding != this.field_148282_b && keybinding.func_151463_i() == this.field_148282_b.func_151463_i()) -+ if (keybinding != this.field_148282_b && keybinding.conflicts(this.field_148282_b)) - { - flag1 = true; - break; -@@ -163,6 +163,7 @@ - } - else if (this.field_148281_e.func_146116_c(GuiKeyBindingList.this.field_148189_l, p_148278_2_, p_148278_3_)) - { -+ this.field_148282_b.setKeyModifier(this.field_148282_b.getKeyModifierDefault()); - GuiKeyBindingList.this.field_148189_l.field_71474_y.func_151440_a(this.field_148282_b, this.field_148282_b.func_151469_h()); - KeyBinding.func_74508_b(); - return true; diff --git a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch index a62941dc5e..5a85b1f679 100644 --- a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch +++ b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch @@ -1,30 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/settings/GameSettings.java +++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java -@@ -147,6 +147,7 @@ - - public GameSettings(Minecraft p_i46326_1_, File p_i46326_2_) - { -+ setForgeKeybindProperties(); - this.field_74324_K = (KeyBinding[])ArrayUtils.addAll(new KeyBinding[] {this.field_74312_F, this.field_74313_G, this.field_74351_w, this.field_74370_x, this.field_74368_y, this.field_74366_z, this.field_74314_A, this.field_74311_E, this.field_151444_V, this.field_74316_C, this.field_151445_Q, this.field_74310_D, this.field_74321_H, this.field_74322_I, this.field_74323_J, this.field_151447_Z, this.field_151457_aa, this.field_151458_ab, this.field_152395_am, this.field_178883_an, this.field_186718_X}, this.field_151456_ac); - this.field_74318_M = EnumDifficulty.NORMAL; - this.field_74332_R = ""; -@@ -171,6 +172,7 @@ - - public GameSettings() - { -+ setForgeKeybindProperties(); - this.field_74324_K = (KeyBinding[])ArrayUtils.addAll(new KeyBinding[] {this.field_74312_F, this.field_74313_G, this.field_74351_w, this.field_74370_x, this.field_74368_y, this.field_74366_z, this.field_74314_A, this.field_74311_E, this.field_151444_V, this.field_74316_C, this.field_151445_Q, this.field_74310_D, this.field_74321_H, this.field_74322_I, this.field_74323_J, this.field_151447_Z, this.field_151457_aa, this.field_151458_ab, this.field_152395_am, this.field_178883_an, this.field_186718_X}, this.field_151456_ac); - this.field_74318_M = EnumDifficulty.NORMAL; - this.field_74332_R = ""; -@@ -846,6 +848,7 @@ - if (astring[0].equals("key_" + keybinding.func_151464_g())) - { - keybinding.func_151462_b(Integer.parseInt(astring[1])); -+ if (astring.length == 3) keybinding.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.valueOf(astring[2])); - } - } - -@@ -887,6 +890,7 @@ +@@ -887,6 +887,7 @@ public void func_74303_b() { @@ -32,39 +8,3 @@ try { PrintWriter printwriter = new PrintWriter(new FileWriter(this.field_74354_ai)); -@@ -955,7 +959,8 @@ - - for (KeyBinding keybinding : this.field_74324_K) - { -- printwriter.println("key_" + keybinding.func_151464_g() + ":" + keybinding.func_151463_i()); -+ String keyString = "key_" + keybinding.func_151464_g() + ":" + keybinding.func_151463_i(); -+ printwriter.println(keybinding.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? keyString + ":" + keybinding.getKeyModifier() : keyString); - } - - for (SoundCategory soundcategory : SoundCategory.values()) -@@ -1184,4 +1189,25 @@ - return p_148264_1_; - } - } -+ -+ /******* Forge Start ***********/ -+ private void setForgeKeybindProperties() { -+ net.minecraftforge.client.settings.KeyConflictContext inGame = net.minecraftforge.client.settings.KeyConflictContext.IN_GAME; -+ field_74351_w.setKeyConflictContext(inGame); -+ field_74370_x.setKeyConflictContext(inGame); -+ field_74368_y.setKeyConflictContext(inGame); -+ field_74366_z.setKeyConflictContext(inGame); -+ field_74314_A.setKeyConflictContext(inGame); -+ field_74311_E.setKeyConflictContext(inGame); -+ field_151444_V.setKeyConflictContext(inGame); -+ field_74312_F.setKeyConflictContext(inGame); -+ field_74322_I.setKeyConflictContext(inGame); -+ field_74310_D.setKeyConflictContext(inGame); -+ field_74321_H.setKeyConflictContext(inGame); -+ field_74323_J.setKeyConflictContext(inGame); -+ field_151457_aa.setKeyConflictContext(inGame); -+ field_151458_ab.setKeyConflictContext(inGame); -+ field_186718_X.setKeyConflictContext(inGame); -+ } -+ /******* Forge End ***********/ - } diff --git a/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch b/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch deleted file mode 100644 index 4f61d2e0db..0000000000 --- a/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch +++ /dev/null @@ -1,155 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/settings/KeyBinding.java -+++ ../src-work/minecraft/net/minecraft/client/settings/KeyBinding.java -@@ -14,7 +14,7 @@ - public class KeyBinding implements Comparable - { - private static final List field_74516_a = Lists.newArrayList(); -- private static final IntHashMap field_74514_b = new IntHashMap(); -+ private static final net.minecraftforge.client.settings.KeyBindingMap field_74514_b = new net.minecraftforge.client.settings.KeyBindingMap(); - private static final Set field_151473_c = Sets.newHashSet(); - private final String field_74515_c; - private final int field_151472_e; -@@ -27,7 +27,7 @@ - { - if (p_74507_0_ != 0) - { -- KeyBinding keybinding = (KeyBinding)field_74514_b.func_76041_a(p_74507_0_); -+ KeyBinding keybinding = (KeyBinding)field_74514_b.lookup(p_74507_0_); - - if (keybinding != null) - { -@@ -40,7 +40,7 @@ - { - if (p_74510_0_ != 0) - { -- KeyBinding keybinding = (KeyBinding)field_74514_b.func_76041_a(p_74510_0_); -+ KeyBinding keybinding = (KeyBinding)field_74514_b.lookup(p_74510_0_); - - if (keybinding != null) - { -@@ -74,11 +74,11 @@ - - public static void func_74508_b() - { -- field_74514_b.func_76046_c(); -+ field_74514_b.clearMap(); - - for (KeyBinding keybinding : field_74516_a) - { -- field_74514_b.func_76038_a(keybinding.field_74512_d, keybinding); -+ field_74514_b.addKey(keybinding.field_74512_d, keybinding); - } - } - -@@ -94,7 +94,7 @@ - this.field_151472_e = p_i45001_2_; - this.field_151471_f = p_i45001_3_; - field_74516_a.add(this); -- field_74514_b.func_76038_a(p_i45001_2_, this); -+ field_74514_b.addKey(p_i45001_2_, this); - field_151473_c.add(p_i45001_3_); - } - -@@ -158,4 +158,102 @@ - - return i; - } -+ -+ /****************** Forge Start *****************************/ -+ private net.minecraftforge.client.settings.KeyModifier keyModifierDefault = net.minecraftforge.client.settings.KeyModifier.NONE; -+ private net.minecraftforge.client.settings.KeyModifier keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE; -+ private net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext = net.minecraftforge.client.settings.KeyConflictContext.UNIVERSAL; -+ private boolean allowsKeyModifiers = false; -+ -+ /** -+ * Convenience constructor for creating KeyBindings with keyConflictContext set. -+ */ -+ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, int keyCode, String category) -+ { -+ this(description, keyConflictContext, net.minecraftforge.client.settings.KeyModifier.NONE, keyCode, category); -+ } -+ -+ /** -+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set. -+ */ -+ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, int keyCode, String category) -+ { -+ this.field_74515_c = description; -+ this.field_74512_d = keyCode; -+ this.field_151472_e = keyCode; -+ this.field_151471_f = category; -+ this.keyConflictContext = keyConflictContext; -+ this.keyModifier = keyModifier; -+ this.keyModifierDefault = keyModifier; -+ if (keyModifier != net.minecraftforge.client.settings.KeyModifier.NONE) -+ setAllowsKeyModifiers(); -+ field_74516_a.add(this); -+ field_74514_b.addKey(keyCode, this); -+ field_151473_c.add(category); -+ } -+ -+ /** -+ * Call this method to let Forge know that your KeyBinding and code can handle players setting modifiers. -+ * Handling modifiers is made easy by using {@link KeyBinding#isActiveAndMatches(int)} or {@link KeyBinding#isPressed()} -+ * Vanilla code does not handle modifiers, so vanilla keyBinds do not have this set. -+ */ -+ public void setAllowsKeyModifiers() -+ { -+ this.allowsKeyModifiers = true; -+ } -+ -+ /** -+ * Checks that the key conflict context and modifier are active, and that the keyCode matches this binding. -+ */ -+ public boolean isActiveAndMatches(int keyCode) -+ { -+ return keyCode == this.func_151463_i() && getKeyConflictContext().isActive() && getKeyModifier().isActive(); -+ } -+ -+ public void setKeyConflictContext(net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext) -+ { -+ this.keyConflictContext = keyConflictContext; -+ } -+ -+ public net.minecraftforge.client.settings.IKeyConflictContext getKeyConflictContext() -+ { -+ return keyConflictContext; -+ } -+ -+ public net.minecraftforge.client.settings.KeyModifier getKeyModifierDefault() -+ { -+ return keyModifierDefault; -+ } -+ -+ public net.minecraftforge.client.settings.KeyModifier getKeyModifier() -+ { -+ if (allowsKeyModifiers) -+ { -+ return keyModifier; -+ } -+ else -+ { -+ return net.minecraftforge.client.settings.KeyModifier.NONE; -+ } -+ } -+ -+ public void setKeyModifier(net.minecraftforge.client.settings.KeyModifier keyModifier) -+ { -+ field_74514_b.removeKey(this); -+ this.keyModifier = keyModifier; -+ field_74514_b.addKey(field_74512_d, this); -+ } -+ -+ public boolean conflicts(KeyBinding other) -+ { -+ if (getKeyConflictContext().conflicts(other.getKeyConflictContext()) || other.getKeyConflictContext().conflicts(getKeyConflictContext())) -+ { -+ if (!allowsKeyModifiers || !other.allowsKeyModifiers || getKeyModifier() == other.getKeyModifier()) -+ { -+ return func_151463_i() == other.func_151463_i(); -+ } -+ } -+ return false; -+ } -+ /****************** Forge End *****************************/ - } diff --git a/src/main/java/net/minecraftforge/client/settings/IKeyConflictContext.java b/src/main/java/net/minecraftforge/client/settings/IKeyConflictContext.java deleted file mode 100644 index 00297211aa..0000000000 --- a/src/main/java/net/minecraftforge/client/settings/IKeyConflictContext.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.minecraftforge.client.settings; - -import net.minecraft.client.settings.KeyBinding; - -/** - * Defines the context that a {@link KeyBinding} is used. - * Key conflicts occur when a {@link KeyBinding} has the same {@link IKeyConflictContext} and has conflicting modifiers and keyCodes. - */ -public interface IKeyConflictContext { - /** - * @return true if conditions are met to activate {@link KeyBinding}s with this context - */ - boolean isActive(); - - /** - * @return true if the other context can have {@link KeyBinding} conflicts with this one. - * This will be called on both contexts to check for conflicts. - */ - boolean conflicts(IKeyConflictContext other); -} diff --git a/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java b/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java deleted file mode 100644 index 729893e38a..0000000000 --- a/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java +++ /dev/null @@ -1,74 +0,0 @@ -package net.minecraftforge.client.settings; - -import net.minecraft.client.settings.KeyBinding; -import net.minecraft.util.IntHashMap; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.EnumMap; - -public class KeyBindingMap -{ - private static final EnumMap>> map = new java.util.EnumMap>>(KeyModifier.class); - static - { - for (KeyModifier modifier : KeyModifier.values()) - { - map.put(modifier, new IntHashMap>()); - } - } - - public KeyBinding lookup(int keyCode) - { - KeyModifier activeModifier = KeyModifier.getActiveModifier(); - Collection bindings = map.get(activeModifier).lookup(keyCode); - if (bindings != null) - { - for (KeyBinding binding : bindings) - { - if (binding.isActiveAndMatches(keyCode)) - { - return binding; - } - } - } - return null; - } - - public void addKey(int keyCode, KeyBinding keyBinding) - { - KeyModifier keyModifier = keyBinding.getKeyModifier(); - IntHashMap> bindingsMap = map.get(keyModifier); - Collection bindingsForKey = bindingsMap.lookup(keyCode); - if (bindingsForKey == null) - { - bindingsForKey = new ArrayList(); - bindingsMap.addKey(keyCode, bindingsForKey); - } - bindingsForKey.add(keyBinding); - } - - public void removeKey(KeyBinding keyBinding) - { - KeyModifier keyModifier = keyBinding.getKeyModifier(); - int keyCode = keyBinding.getKeyCode(); - IntHashMap> bindingsMap = map.get(keyModifier); - Collection bindingsForKey = bindingsMap.lookup(keyCode); - if (bindingsForKey != null) - { - bindingsForKey.remove(keyBinding); - if (bindingsForKey.isEmpty()) - { - bindingsMap.removeObject(keyCode); - } - } - } - - public void clearMap() - { - for (IntHashMap> bindings : map.values()) - { - bindings.clearMap(); - } - } -} diff --git a/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java b/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java deleted file mode 100644 index 964dadd0c6..0000000000 --- a/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java +++ /dev/null @@ -1,59 +0,0 @@ -package net.minecraftforge.client.settings; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; - -public enum KeyConflictContext implements IKeyConflictContext -{ - /** - * Universal key bindings are used in every context and will conflict with any other context. - * Key Bindings are universal by default. - */ - UNIVERSAL { - @Override - public boolean isActive() - { - return true; - } - - @Override - public boolean conflicts(IKeyConflictContext other) - { - return true; - } - }, - - /** - * Gui key bindings are only used when a {@link GuiScreen} is open. - */ - GUI { - @Override - public boolean isActive() - { - return Minecraft.getMinecraft().currentScreen != null; - } - - @Override - public boolean conflicts(IKeyConflictContext other) - { - return this == other; - } - }, - - /** - * In-game key bindings are only used when a {@link GuiScreen} is not open. - */ - IN_GAME { - @Override - public boolean isActive() - { - return !GUI.isActive(); - } - - @Override - public boolean conflicts(IKeyConflictContext other) - { - return this == other; - } - } -} diff --git a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java deleted file mode 100644 index 6eb699fe33..0000000000 --- a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java +++ /dev/null @@ -1,124 +0,0 @@ -package net.minecraftforge.client.settings; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.resources.I18n; -import org.lwjgl.input.Keyboard; - -public enum KeyModifier { - CONTROL { - @Override - protected boolean matches(int keyCode) - { - if (Minecraft.isRunningOnMac) - { - return keyCode == Keyboard.KEY_LMETA || keyCode == Keyboard.KEY_RMETA; - } - else - { - return keyCode == Keyboard.KEY_LCONTROL || keyCode == Keyboard.KEY_RCONTROL; - } - } - - @Override - public boolean isActive() - { - return GuiScreen.isCtrlKeyDown(); - } - - @Override - public String getLocalizedComboName(String keyName) - { - return I18n.format("forge.controlsgui.control", keyName); - } - }, - SHIFT { - @Override - protected boolean matches(int keyCode) - { - return keyCode == Keyboard.KEY_LSHIFT || keyCode == Keyboard.KEY_RSHIFT; - } - - @Override - public boolean isActive() - { - return GuiScreen.isShiftKeyDown(); - } - - @Override - public String getLocalizedComboName(String keyName) - { - return I18n.format("forge.controlsgui.shift", keyName); - } - }, - ALT { - @Override - protected boolean matches(int keyCode) - { - return keyCode == Keyboard.KEY_LMENU || keyCode == Keyboard.KEY_RMENU; - } - - @Override - public boolean isActive() - { - return GuiScreen.isAltKeyDown(); - } - - @Override - public String getLocalizedComboName(String keyName) - { - return I18n.format("forge.controlsgui.alt", keyName); - } - }, - NONE { - @Override - protected boolean matches(int keyCode) - { - return true; - } - - @Override - public boolean isActive() - { - return !SHIFT.isActive() && !CONTROL.isActive() && !ALT.isActive(); - } - - @Override - public String getLocalizedComboName(String keyName) - { - return keyName; - } - }; - - public static final KeyModifier[] MODIFIER_VALUES = {SHIFT, CONTROL, ALT}; - - public static KeyModifier getActiveModifier() - { - for (KeyModifier keyModifier : MODIFIER_VALUES) - { - if (keyModifier.isActive()) - { - return keyModifier; - } - } - return NONE; - } - - public static boolean isKeyCodeModifier(int keyCode) - { - for (KeyModifier keyModifier : MODIFIER_VALUES) - { - if (keyModifier.matches(keyCode)) - { - return true; - } - } - return false; - } - - protected abstract boolean matches(int keyCode); - - public abstract boolean isActive(); - - public abstract String getLocalizedComboName(String keyName); -} diff --git a/src/main/resources/assets/forge/lang/en_US.lang b/src/main/resources/assets/forge/lang/en_US.lang index 4155a94a00..507a84a68f 100644 --- a/src/main/resources/assets/forge/lang/en_US.lang +++ b/src/main/resources/assets/forge/lang/en_US.lang @@ -143,10 +143,6 @@ fml.configgui.tooltip.undoChanges=Undo Changes fml.configgui.tooltip.default=[default: %s] fml.configgui.tooltip.defaultNumeric=[range: %s ~ %s, default: %s] -forge.controlsgui.shift=SHIFT + %s -forge.controlsgui.control=CTRL + %s -forge.controlsgui.alt=ALT + %s - fml.menu.mods=Mods fml.menu.mods.normal=Normal fml.menu.mods.search=Search: From 21d39f6558e60f96ec0d476952d9635b04fd3662 Mon Sep 17 00:00:00 2001 From: mezz Date: Sun, 3 Apr 2016 01:40:38 -0700 Subject: [PATCH 190/243] Re-Add key binding modifiers and contexts. --- .../net/minecraft/client/Minecraft.java.patch | 10 +- .../client/gui/GuiControls.java.patch | 49 ++++++ .../client/gui/GuiKeyBindingList.java.patch | 53 ++++++ .../client/settings/GameSettings.java.patch | 62 ++++++- .../client/settings/KeyBinding.java.patch | 162 ++++++++++++++++++ .../client/settings/IKeyConflictContext.java | 20 +++ .../client/settings/KeyBindingMap.java | 89 ++++++++++ .../client/settings/KeyConflictContext.java | 59 +++++++ .../client/settings/KeyModifier.java | 124 ++++++++++++++ .../resources/assets/forge/lang/en_US.lang | 4 + 10 files changed, 630 insertions(+), 2 deletions(-) create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch create mode 100644 patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch create mode 100644 src/main/java/net/minecraftforge/client/settings/IKeyConflictContext.java create mode 100644 src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java create mode 100644 src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java create mode 100644 src/main/java/net/minecraftforge/client/settings/KeyModifier.java diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 7ceb60ead1..3d1788e0ea 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -474,7 +474,15 @@ } public boolean func_70002_Q() -@@ -3192,4 +3084,10 @@ +@@ -3066,6 +2958,7 @@ + this.field_71456_v.func_146158_b().func_146227_a(ScreenShotHelper.func_148260_a(this.field_71412_D, this.field_71443_c, this.field_71440_d, this.field_147124_at)); + } + } ++ else if (this.field_71462_r instanceof GuiControls) ((GuiControls)this.field_71462_r).field_146491_f = null; + } + } + } +@@ -3192,4 +3085,10 @@ { return this.field_184127_aH; } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch new file mode 100644 index 0000000000..ee31589c94 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch @@ -0,0 +1,49 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiControls.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiControls.java +@@ -66,6 +66,7 @@ + for (KeyBinding keybinding : this.field_146297_k.field_71474_y.field_74324_K) + { + keybinding.func_151462_b(keybinding.func_151469_h()); ++ keybinding.setKeyModifier(keybinding.getKeyModifierDefault()); + } + + KeyBinding.func_74508_b(); +@@ -81,6 +82,7 @@ + { + if (this.field_146491_f != null) + { ++ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.getActiveModifier()); + this.field_146497_i.func_151440_a(this.field_146491_f, -100 + p_73864_3_); + this.field_146491_f = null; + KeyBinding.func_74508_b(); +@@ -105,17 +107,21 @@ + { + if (p_73869_2_ == 1) + { ++ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.NONE); + this.field_146497_i.func_151440_a(this.field_146491_f, 0); + } + else if (p_73869_2_ != 0) + { ++ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(p_73869_2_) ? net.minecraftforge.client.settings.KeyModifier.NONE : net.minecraftforge.client.settings.KeyModifier.getActiveModifier()); + this.field_146497_i.func_151440_a(this.field_146491_f, p_73869_2_); + } + else if (p_73869_1_ > 0) + { ++ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(p_73869_2_) ? net.minecraftforge.client.settings.KeyModifier.NONE : net.minecraftforge.client.settings.KeyModifier.getActiveModifier()); + this.field_146497_i.func_151440_a(this.field_146491_f, p_73869_1_ + 256); + } + ++ if (!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(p_73869_2_)) + this.field_146491_f = null; + this.field_152177_g = Minecraft.func_71386_F(); + KeyBinding.func_74508_b(); +@@ -135,7 +141,7 @@ + + for (KeyBinding keybinding : this.field_146497_i.field_74324_K) + { +- if (keybinding.func_151463_i() != keybinding.func_151469_h()) ++ if (keybinding.func_151463_i() != keybinding.func_151469_h() || keybinding.getKeyModifier() != keybinding.getKeyModifierDefault()) + { + flag = false; + break; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch new file mode 100644 index 0000000000..b3c50b3cdd --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch @@ -0,0 +1,53 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java +@@ -62,7 +62,7 @@ + + protected int func_148137_d() + { +- return super.func_148137_d() + 15; ++ return super.func_148137_d() + 35; + } + + public int func_148139_c() +@@ -113,7 +113,7 @@ + { + this.field_148282_b = p_i45029_2_; + this.field_148283_c = I18n.func_135052_a(p_i45029_2_.func_151464_g(), new Object[0]); +- this.field_148280_d = new GuiButton(0, 0, 0, 75, 20, I18n.func_135052_a(p_i45029_2_.func_151464_g(), new Object[0])); ++ this.field_148280_d = new GuiButton(0, 0, 0, 95, 20, I18n.func_135052_a(p_i45029_2_.func_151464_g(), new Object[0])); + this.field_148281_e = new GuiButton(0, 0, 0, 50, 20, I18n.func_135052_a("controls.reset", new Object[0])); + } + +@@ -121,20 +121,20 @@ + { + boolean flag = GuiKeyBindingList.this.field_148191_k.field_146491_f == this.field_148282_b; + GuiKeyBindingList.this.field_148189_l.field_71466_p.func_78276_b(this.field_148283_c, p_180790_2_ + 90 - GuiKeyBindingList.this.field_148188_n, p_180790_3_ + p_180790_5_ / 2 - GuiKeyBindingList.this.field_148189_l.field_71466_p.field_78288_b / 2, 16777215); +- this.field_148281_e.field_146128_h = p_180790_2_ + 190; ++ this.field_148281_e.field_146128_h = p_180790_2_ + 210; + this.field_148281_e.field_146129_i = p_180790_3_; +- this.field_148281_e.field_146124_l = this.field_148282_b.func_151463_i() != this.field_148282_b.func_151469_h(); ++ this.field_148281_e.field_146124_l = this.field_148282_b.func_151463_i() != this.field_148282_b.func_151469_h() || this.field_148282_b.getKeyModifier() != this.field_148282_b.getKeyModifierDefault(); + this.field_148281_e.func_146112_a(GuiKeyBindingList.this.field_148189_l, p_180790_6_, p_180790_7_); + this.field_148280_d.field_146128_h = p_180790_2_ + 105; + this.field_148280_d.field_146129_i = p_180790_3_; +- this.field_148280_d.field_146126_j = GameSettings.func_74298_c(this.field_148282_b.func_151463_i()); ++ this.field_148280_d.field_146126_j = this.field_148282_b.getKeyModifier().getLocalizedComboName(GameSettings.func_74298_c(this.field_148282_b.func_151463_i())); + boolean flag1 = false; + + if (this.field_148282_b.func_151463_i() != 0) + { + for (KeyBinding keybinding : GuiKeyBindingList.this.field_148189_l.field_71474_y.field_74324_K) + { +- if (keybinding != this.field_148282_b && keybinding.func_151463_i() == this.field_148282_b.func_151463_i()) ++ if (keybinding != this.field_148282_b && keybinding.conflicts(this.field_148282_b)) + { + flag1 = true; + break; +@@ -163,6 +163,7 @@ + } + else if (this.field_148281_e.func_146116_c(GuiKeyBindingList.this.field_148189_l, p_148278_2_, p_148278_3_)) + { ++ this.field_148282_b.setKeyModifier(this.field_148282_b.getKeyModifierDefault()); + GuiKeyBindingList.this.field_148189_l.field_71474_y.func_151440_a(this.field_148282_b, this.field_148282_b.func_151469_h()); + KeyBinding.func_74508_b(); + return true; diff --git a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch index 5a85b1f679..a62941dc5e 100644 --- a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch +++ b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch @@ -1,6 +1,30 @@ --- ../src-base/minecraft/net/minecraft/client/settings/GameSettings.java +++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java -@@ -887,6 +887,7 @@ +@@ -147,6 +147,7 @@ + + public GameSettings(Minecraft p_i46326_1_, File p_i46326_2_) + { ++ setForgeKeybindProperties(); + this.field_74324_K = (KeyBinding[])ArrayUtils.addAll(new KeyBinding[] {this.field_74312_F, this.field_74313_G, this.field_74351_w, this.field_74370_x, this.field_74368_y, this.field_74366_z, this.field_74314_A, this.field_74311_E, this.field_151444_V, this.field_74316_C, this.field_151445_Q, this.field_74310_D, this.field_74321_H, this.field_74322_I, this.field_74323_J, this.field_151447_Z, this.field_151457_aa, this.field_151458_ab, this.field_152395_am, this.field_178883_an, this.field_186718_X}, this.field_151456_ac); + this.field_74318_M = EnumDifficulty.NORMAL; + this.field_74332_R = ""; +@@ -171,6 +172,7 @@ + + public GameSettings() + { ++ setForgeKeybindProperties(); + this.field_74324_K = (KeyBinding[])ArrayUtils.addAll(new KeyBinding[] {this.field_74312_F, this.field_74313_G, this.field_74351_w, this.field_74370_x, this.field_74368_y, this.field_74366_z, this.field_74314_A, this.field_74311_E, this.field_151444_V, this.field_74316_C, this.field_151445_Q, this.field_74310_D, this.field_74321_H, this.field_74322_I, this.field_74323_J, this.field_151447_Z, this.field_151457_aa, this.field_151458_ab, this.field_152395_am, this.field_178883_an, this.field_186718_X}, this.field_151456_ac); + this.field_74318_M = EnumDifficulty.NORMAL; + this.field_74332_R = ""; +@@ -846,6 +848,7 @@ + if (astring[0].equals("key_" + keybinding.func_151464_g())) + { + keybinding.func_151462_b(Integer.parseInt(astring[1])); ++ if (astring.length == 3) keybinding.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.valueOf(astring[2])); + } + } + +@@ -887,6 +890,7 @@ public void func_74303_b() { @@ -8,3 +32,39 @@ try { PrintWriter printwriter = new PrintWriter(new FileWriter(this.field_74354_ai)); +@@ -955,7 +959,8 @@ + + for (KeyBinding keybinding : this.field_74324_K) + { +- printwriter.println("key_" + keybinding.func_151464_g() + ":" + keybinding.func_151463_i()); ++ String keyString = "key_" + keybinding.func_151464_g() + ":" + keybinding.func_151463_i(); ++ printwriter.println(keybinding.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? keyString + ":" + keybinding.getKeyModifier() : keyString); + } + + for (SoundCategory soundcategory : SoundCategory.values()) +@@ -1184,4 +1189,25 @@ + return p_148264_1_; + } + } ++ ++ /******* Forge Start ***********/ ++ private void setForgeKeybindProperties() { ++ net.minecraftforge.client.settings.KeyConflictContext inGame = net.minecraftforge.client.settings.KeyConflictContext.IN_GAME; ++ field_74351_w.setKeyConflictContext(inGame); ++ field_74370_x.setKeyConflictContext(inGame); ++ field_74368_y.setKeyConflictContext(inGame); ++ field_74366_z.setKeyConflictContext(inGame); ++ field_74314_A.setKeyConflictContext(inGame); ++ field_74311_E.setKeyConflictContext(inGame); ++ field_151444_V.setKeyConflictContext(inGame); ++ field_74312_F.setKeyConflictContext(inGame); ++ field_74322_I.setKeyConflictContext(inGame); ++ field_74310_D.setKeyConflictContext(inGame); ++ field_74321_H.setKeyConflictContext(inGame); ++ field_74323_J.setKeyConflictContext(inGame); ++ field_151457_aa.setKeyConflictContext(inGame); ++ field_151458_ab.setKeyConflictContext(inGame); ++ field_186718_X.setKeyConflictContext(inGame); ++ } ++ /******* Forge End ***********/ + } diff --git a/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch b/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch new file mode 100644 index 0000000000..41a80a227d --- /dev/null +++ b/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch @@ -0,0 +1,162 @@ +--- ../src-base/minecraft/net/minecraft/client/settings/KeyBinding.java ++++ ../src-work/minecraft/net/minecraft/client/settings/KeyBinding.java +@@ -14,7 +14,7 @@ + public class KeyBinding implements Comparable + { + private static final List field_74516_a = Lists.newArrayList(); +- private static final IntHashMap field_74514_b = new IntHashMap(); ++ private static final net.minecraftforge.client.settings.KeyBindingMap field_74514_b = new net.minecraftforge.client.settings.KeyBindingMap(); + private static final Set field_151473_c = Sets.newHashSet(); + private final String field_74515_c; + private final int field_151472_e; +@@ -27,7 +27,7 @@ + { + if (p_74507_0_ != 0) + { +- KeyBinding keybinding = (KeyBinding)field_74514_b.func_76041_a(p_74507_0_); ++ KeyBinding keybinding = field_74514_b.lookupActive(p_74507_0_); + + if (keybinding != null) + { +@@ -40,7 +40,7 @@ + { + if (p_74510_0_ != 0) + { +- KeyBinding keybinding = (KeyBinding)field_74514_b.func_76041_a(p_74510_0_); ++ for (KeyBinding keybinding : field_74514_b.lookupAll(p_74510_0_)) + + if (keybinding != null) + { +@@ -74,11 +74,11 @@ + + public static void func_74508_b() + { +- field_74514_b.func_76046_c(); ++ field_74514_b.clearMap(); + + for (KeyBinding keybinding : field_74516_a) + { +- field_74514_b.func_76038_a(keybinding.field_74512_d, keybinding); ++ field_74514_b.addKey(keybinding.field_74512_d, keybinding); + } + } + +@@ -94,13 +94,13 @@ + this.field_151472_e = p_i45001_2_; + this.field_151471_f = p_i45001_3_; + field_74516_a.add(this); +- field_74514_b.func_76038_a(p_i45001_2_, this); ++ field_74514_b.addKey(p_i45001_2_, this); + field_151473_c.add(p_i45001_3_); + } + + public boolean func_151470_d() + { +- return this.field_74513_e; ++ return this.field_74513_e && getKeyConflictContext().isActive() && (!allowsKeyModifiers || getKeyModifier().isActive()); + } + + public String func_151466_e() +@@ -158,4 +158,102 @@ + + return i; + } ++ ++ /****************** Forge Start *****************************/ ++ private net.minecraftforge.client.settings.KeyModifier keyModifierDefault = net.minecraftforge.client.settings.KeyModifier.NONE; ++ private net.minecraftforge.client.settings.KeyModifier keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE; ++ private net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext = net.minecraftforge.client.settings.KeyConflictContext.UNIVERSAL; ++ private boolean allowsKeyModifiers = false; ++ ++ /** ++ * Convenience constructor for creating KeyBindings with keyConflictContext set. ++ */ ++ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, int keyCode, String category) ++ { ++ this(description, keyConflictContext, net.minecraftforge.client.settings.KeyModifier.NONE, keyCode, category); ++ } ++ ++ /** ++ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set. ++ */ ++ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, int keyCode, String category) ++ { ++ this.field_74515_c = description; ++ this.field_74512_d = keyCode; ++ this.field_151472_e = keyCode; ++ this.field_151471_f = category; ++ this.keyConflictContext = keyConflictContext; ++ this.keyModifier = keyModifier; ++ this.keyModifierDefault = keyModifier; ++ if (keyModifier != net.minecraftforge.client.settings.KeyModifier.NONE) ++ setAllowsKeyModifiers(); ++ field_74516_a.add(this); ++ field_74514_b.addKey(keyCode, this); ++ field_151473_c.add(category); ++ } ++ ++ /** ++ * Call this method to let Forge know that your KeyBinding and code can handle players setting modifiers. ++ * Handling modifiers is made easy by using {@link KeyBinding#isActiveAndMatches(int)} or {@link KeyBinding#isPressed()} ++ * Vanilla code does not handle modifiers, so vanilla keyBinds do not have this set. ++ */ ++ public void setAllowsKeyModifiers() ++ { ++ this.allowsKeyModifiers = true; ++ } ++ ++ /** ++ * Checks that the key conflict context and modifier are active, and that the keyCode matches this binding. ++ */ ++ public boolean isActiveAndMatches(int keyCode) ++ { ++ return keyCode == this.func_151463_i() && getKeyConflictContext().isActive() && (!allowsKeyModifiers || getKeyModifier().isActive()); ++ } ++ ++ public void setKeyConflictContext(net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext) ++ { ++ this.keyConflictContext = keyConflictContext; ++ } ++ ++ public net.minecraftforge.client.settings.IKeyConflictContext getKeyConflictContext() ++ { ++ return keyConflictContext; ++ } ++ ++ public net.minecraftforge.client.settings.KeyModifier getKeyModifierDefault() ++ { ++ return keyModifierDefault; ++ } ++ ++ public net.minecraftforge.client.settings.KeyModifier getKeyModifier() ++ { ++ if (allowsKeyModifiers) ++ { ++ return keyModifier; ++ } ++ else ++ { ++ return net.minecraftforge.client.settings.KeyModifier.NONE; ++ } ++ } ++ ++ public void setKeyModifier(net.minecraftforge.client.settings.KeyModifier keyModifier) ++ { ++ field_74514_b.removeKey(this); ++ this.keyModifier = keyModifier; ++ field_74514_b.addKey(field_74512_d, this); ++ } ++ ++ public boolean conflicts(KeyBinding other) ++ { ++ if (getKeyConflictContext().conflicts(other.getKeyConflictContext()) || other.getKeyConflictContext().conflicts(getKeyConflictContext())) ++ { ++ if (!allowsKeyModifiers || !other.allowsKeyModifiers || getKeyModifier() == other.getKeyModifier()) ++ { ++ return func_151463_i() == other.func_151463_i(); ++ } ++ } ++ return false; ++ } ++ /****************** Forge End *****************************/ + } diff --git a/src/main/java/net/minecraftforge/client/settings/IKeyConflictContext.java b/src/main/java/net/minecraftforge/client/settings/IKeyConflictContext.java new file mode 100644 index 0000000000..00297211aa --- /dev/null +++ b/src/main/java/net/minecraftforge/client/settings/IKeyConflictContext.java @@ -0,0 +1,20 @@ +package net.minecraftforge.client.settings; + +import net.minecraft.client.settings.KeyBinding; + +/** + * Defines the context that a {@link KeyBinding} is used. + * Key conflicts occur when a {@link KeyBinding} has the same {@link IKeyConflictContext} and has conflicting modifiers and keyCodes. + */ +public interface IKeyConflictContext { + /** + * @return true if conditions are met to activate {@link KeyBinding}s with this context + */ + boolean isActive(); + + /** + * @return true if the other context can have {@link KeyBinding} conflicts with this one. + * This will be called on both contexts to check for conflicts. + */ + boolean conflicts(IKeyConflictContext other); +} diff --git a/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java b/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java new file mode 100644 index 0000000000..e1c5f4ed68 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java @@ -0,0 +1,89 @@ +package net.minecraftforge.client.settings; + +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.util.IntHashMap; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.EnumMap; +import java.util.List; + +public class KeyBindingMap +{ + private static final EnumMap>> map = new java.util.EnumMap>>(KeyModifier.class); + static + { + for (KeyModifier modifier : KeyModifier.values()) + { + map.put(modifier, new IntHashMap>()); + } + } + + public KeyBinding lookupActive(int keyCode) + { + KeyModifier activeModifier = KeyModifier.isKeyCodeModifier(keyCode) ? KeyModifier.NONE : KeyModifier.getActiveModifier(); + Collection bindings = map.get(activeModifier).lookup(keyCode); + if (bindings != null) + { + for (KeyBinding binding : bindings) + { + if (binding.isActiveAndMatches(keyCode)) + { + return binding; + } + } + } + return null; + } + + public List lookupAll(int keyCode) + { + List matchingBindings = new ArrayList(); + for (IntHashMap> bindingsMap : map.values()) + { + Collection bindings = bindingsMap.lookup(keyCode); + if (bindings != null) + { + matchingBindings.addAll(bindings); + } + } + return matchingBindings; + } + + public void addKey(int keyCode, KeyBinding keyBinding) + { + KeyModifier keyModifier = keyBinding.getKeyModifier(); + IntHashMap> bindingsMap = map.get(keyModifier); + Collection bindingsForKey = bindingsMap.lookup(keyCode); + if (bindingsForKey == null) + { + bindingsForKey = new ArrayList(); + bindingsMap.addKey(keyCode, bindingsForKey); + } + bindingsForKey.add(keyBinding); + } + + public void removeKey(KeyBinding keyBinding) + { + KeyModifier keyModifier = keyBinding.getKeyModifier(); + int keyCode = keyBinding.getKeyCode(); + IntHashMap> bindingsMap = map.get(keyModifier); + Collection bindingsForKey = bindingsMap.lookup(keyCode); + if (bindingsForKey != null) + { + bindingsForKey.remove(keyBinding); + if (bindingsForKey.isEmpty()) + { + bindingsMap.removeObject(keyCode); + } + } + } + + public void clearMap() + { + for (IntHashMap> bindings : map.values()) + { + bindings.clearMap(); + } + } +} diff --git a/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java b/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java new file mode 100644 index 0000000000..964dadd0c6 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java @@ -0,0 +1,59 @@ +package net.minecraftforge.client.settings; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; + +public enum KeyConflictContext implements IKeyConflictContext +{ + /** + * Universal key bindings are used in every context and will conflict with any other context. + * Key Bindings are universal by default. + */ + UNIVERSAL { + @Override + public boolean isActive() + { + return true; + } + + @Override + public boolean conflicts(IKeyConflictContext other) + { + return true; + } + }, + + /** + * Gui key bindings are only used when a {@link GuiScreen} is open. + */ + GUI { + @Override + public boolean isActive() + { + return Minecraft.getMinecraft().currentScreen != null; + } + + @Override + public boolean conflicts(IKeyConflictContext other) + { + return this == other; + } + }, + + /** + * In-game key bindings are only used when a {@link GuiScreen} is not open. + */ + IN_GAME { + @Override + public boolean isActive() + { + return !GUI.isActive(); + } + + @Override + public boolean conflicts(IKeyConflictContext other) + { + return this == other; + } + } +} diff --git a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java new file mode 100644 index 0000000000..6eb699fe33 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java @@ -0,0 +1,124 @@ +package net.minecraftforge.client.settings; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; +import org.lwjgl.input.Keyboard; + +public enum KeyModifier { + CONTROL { + @Override + protected boolean matches(int keyCode) + { + if (Minecraft.isRunningOnMac) + { + return keyCode == Keyboard.KEY_LMETA || keyCode == Keyboard.KEY_RMETA; + } + else + { + return keyCode == Keyboard.KEY_LCONTROL || keyCode == Keyboard.KEY_RCONTROL; + } + } + + @Override + public boolean isActive() + { + return GuiScreen.isCtrlKeyDown(); + } + + @Override + public String getLocalizedComboName(String keyName) + { + return I18n.format("forge.controlsgui.control", keyName); + } + }, + SHIFT { + @Override + protected boolean matches(int keyCode) + { + return keyCode == Keyboard.KEY_LSHIFT || keyCode == Keyboard.KEY_RSHIFT; + } + + @Override + public boolean isActive() + { + return GuiScreen.isShiftKeyDown(); + } + + @Override + public String getLocalizedComboName(String keyName) + { + return I18n.format("forge.controlsgui.shift", keyName); + } + }, + ALT { + @Override + protected boolean matches(int keyCode) + { + return keyCode == Keyboard.KEY_LMENU || keyCode == Keyboard.KEY_RMENU; + } + + @Override + public boolean isActive() + { + return GuiScreen.isAltKeyDown(); + } + + @Override + public String getLocalizedComboName(String keyName) + { + return I18n.format("forge.controlsgui.alt", keyName); + } + }, + NONE { + @Override + protected boolean matches(int keyCode) + { + return true; + } + + @Override + public boolean isActive() + { + return !SHIFT.isActive() && !CONTROL.isActive() && !ALT.isActive(); + } + + @Override + public String getLocalizedComboName(String keyName) + { + return keyName; + } + }; + + public static final KeyModifier[] MODIFIER_VALUES = {SHIFT, CONTROL, ALT}; + + public static KeyModifier getActiveModifier() + { + for (KeyModifier keyModifier : MODIFIER_VALUES) + { + if (keyModifier.isActive()) + { + return keyModifier; + } + } + return NONE; + } + + public static boolean isKeyCodeModifier(int keyCode) + { + for (KeyModifier keyModifier : MODIFIER_VALUES) + { + if (keyModifier.matches(keyCode)) + { + return true; + } + } + return false; + } + + protected abstract boolean matches(int keyCode); + + public abstract boolean isActive(); + + public abstract String getLocalizedComboName(String keyName); +} diff --git a/src/main/resources/assets/forge/lang/en_US.lang b/src/main/resources/assets/forge/lang/en_US.lang index 507a84a68f..4155a94a00 100644 --- a/src/main/resources/assets/forge/lang/en_US.lang +++ b/src/main/resources/assets/forge/lang/en_US.lang @@ -143,6 +143,10 @@ fml.configgui.tooltip.undoChanges=Undo Changes fml.configgui.tooltip.default=[default: %s] fml.configgui.tooltip.defaultNumeric=[range: %s ~ %s, default: %s] +forge.controlsgui.shift=SHIFT + %s +forge.controlsgui.control=CTRL + %s +forge.controlsgui.alt=ALT + %s + fml.menu.mods=Mods fml.menu.mods.normal=Normal fml.menu.mods.search=Search: From bc2b5ad51750c86e64a978a7db6702e0cda09450 Mon Sep 17 00:00:00 2001 From: mezz Date: Sun, 3 Apr 2016 13:15:18 -0700 Subject: [PATCH 191/243] Fix inability to attack while holding modifier keys --- .../client/settings/KeyBinding.java.patch | 6 +++--- .../client/settings/KeyBindingMap.java | 12 +++++++++++- .../client/settings/KeyModifier.java | 19 +++++++++++++++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch b/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch index 41a80a227d..f80019f4be 100644 --- a/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch +++ b/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch @@ -53,7 +53,7 @@ public boolean func_151470_d() { - return this.field_74513_e; -+ return this.field_74513_e && getKeyConflictContext().isActive() && (!allowsKeyModifiers || getKeyModifier().isActive()); ++ return this.field_74513_e && getKeyConflictContext().isActive() && getKeyModifier().isActive(); } public String func_151466_e() @@ -110,7 +110,7 @@ + */ + public boolean isActiveAndMatches(int keyCode) + { -+ return keyCode == this.func_151463_i() && getKeyConflictContext().isActive() && (!allowsKeyModifiers || getKeyModifier().isActive()); ++ return keyCode == this.func_151463_i() && getKeyConflictContext().isActive() && getKeyModifier().isActive(); + } + + public void setKeyConflictContext(net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext) @@ -136,7 +136,7 @@ + } + else + { -+ return net.minecraftforge.client.settings.KeyModifier.NONE; ++ return net.minecraftforge.client.settings.KeyModifier.NOT_SUPPORTED; + } + } + diff --git a/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java b/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java index e1c5f4ed68..4524544a0a 100644 --- a/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java +++ b/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java @@ -22,7 +22,17 @@ public class KeyBindingMap public KeyBinding lookupActive(int keyCode) { KeyModifier activeModifier = KeyModifier.isKeyCodeModifier(keyCode) ? KeyModifier.NONE : KeyModifier.getActiveModifier(); - Collection bindings = map.get(activeModifier).lookup(keyCode); + KeyBinding binding = getBinding(keyCode, activeModifier); + if (binding != null) + { + return binding; + } + return getBinding(keyCode, KeyModifier.NOT_SUPPORTED); + } + + private KeyBinding getBinding(int keyCode, KeyModifier keyModifier) + { + Collection bindings = map.get(keyModifier).lookup(keyCode); if (bindings != null) { for (KeyBinding binding : bindings) diff --git a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java index 6eb699fe33..54c0c8860a 100644 --- a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java +++ b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java @@ -83,6 +83,25 @@ public enum KeyModifier { return !SHIFT.isActive() && !CONTROL.isActive() && !ALT.isActive(); } + @Override + public String getLocalizedComboName(String keyName) + { + return keyName; + } + }, + NOT_SUPPORTED { + @Override + protected boolean matches(int keyCode) + { + return true; + } + + @Override + public boolean isActive() + { + return true; + } + @Override public String getLocalizedComboName(String keyName) { From 9c3def9cb077304107515346ab9b6520e3125d93 Mon Sep 17 00:00:00 2001 From: McJty Date: Mon, 4 Apr 2016 06:26:46 +0200 Subject: [PATCH 192/243] Added DimensionManager.createProviderFor() to WorldClient constructor similar to what is done in WorldServer to make sure the correct provider is created client-side too. --- .../minecraft/client/multiplayer/WorldClient.java.patch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch index e15a04d455..8d7f15464f 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch @@ -1,6 +1,12 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java -@@ -63,12 +63,13 @@ +@@ -58,17 +58,18 @@ + + public WorldClient(NetHandlerPlayClient p_i45063_1_, WorldSettings p_i45063_2_, int p_i45063_3_, EnumDifficulty p_i45063_4_, Profiler p_i45063_5_) + { +- super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), DimensionType.func_186069_a(p_i45063_3_).func_186070_d(), p_i45063_5_, true); ++ super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), net.minecraftforge.common.DimensionManager.createProviderFor(p_i45063_3_), p_i45063_5_, true); + this.field_184158_M = this.field_73012_v.nextInt(12000); this.field_184157_a = Sets.newHashSet(); this.field_73035_a = p_i45063_1_; this.func_72912_H().func_176144_a(p_i45063_4_); From dbe9053d50b125f1a6f08348f81ca9890e34bbd9 Mon Sep 17 00:00:00 2001 From: AEnterprise Date: Mon, 4 Apr 2016 11:37:40 +0200 Subject: [PATCH 193/243] onBlockHarvested is no longer called twice --- .../management/PlayerInteractionManager.java.patch | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch index 8f01382c92..d7f9cbd1ec 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch @@ -97,7 +97,7 @@ { float f = iblockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180785_1_) * (float)(i + 1); -@@ -234,13 +259,18 @@ +@@ -234,13 +259,17 @@ private boolean func_180235_c(BlockPos p_180235_1_) { @@ -110,7 +110,6 @@ + private boolean removeBlock(BlockPos pos, boolean canHarvest) + { + IBlockState iblockstate = this.field_73092_a.func_180495_p(pos); -+ iblockstate.func_177230_c().func_176208_a(this.field_73092_a, pos, iblockstate, this.field_73090_b); + boolean flag = iblockstate.func_177230_c().removedByPlayer(iblockstate, field_73092_a, pos, field_73090_b, canHarvest); + if (flag) @@ -120,7 +119,7 @@ } return flag; -@@ -248,7 +278,8 @@ +@@ -248,7 +277,8 @@ public boolean func_180237_b(BlockPos p_180237_1_) { @@ -130,7 +129,7 @@ { return false; } -@@ -264,41 +295,22 @@ +@@ -264,41 +294,22 @@ } else { @@ -177,7 +176,7 @@ if (itemstack1 != null) { -@@ -310,12 +322,18 @@ +@@ -310,12 +321,18 @@ } } @@ -196,7 +195,7 @@ return flag1; } } -@@ -359,6 +377,7 @@ +@@ -359,6 +376,7 @@ if (itemstack.field_77994_a == 0) { p_187250_1_.func_184611_a(p_187250_4_, (ItemStack)null); @@ -204,7 +203,7 @@ } if (!p_187250_1_.func_184587_cr()) -@@ -445,4 +464,13 @@ +@@ -445,4 +463,13 @@ { this.field_73092_a = p_73080_1_; } From 879b7b5a61de36b4ef0229dca40040e88f490e1a Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Mon, 4 Apr 2016 16:01:49 +0300 Subject: [PATCH 194/243] Added the ability to change the printed model error count; Added printing of actual exceptions causing missing variants related to blockstate loading, closes #2689. --- .../minecraftforge/client/model/ModelLoader.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index aea9998c95..69964a1676 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -108,6 +108,7 @@ public final class ModelLoader extends ModelBakery } private final boolean enableVerboseMissingInfo = (Boolean)Launch.blackboard.get("fml.deobfuscatedEnvironment") || Boolean.parseBoolean(System.getProperty("forge.verboseMissingModelLogging", "false")); + private final int verboseMissingInfoCount = Integer.parseInt(System.getProperty("forge.verboseMissingModelLoggingCount", "5")); public ModelLoader(IResourceManager manager, TextureMap map, BlockModelShapes shapes) { @@ -901,6 +902,7 @@ public final class ModelLoader extends ModelBakery { IBakedModel missingModel = modelRegistry.getObject(MODEL_MISSING); Map modelErrors = Maps.newHashMap(); + Set printedBlockStateErrors = Sets.newHashSet(); Multimap reverseBlockMap = null; Multimap reverseItemMap = null; if(enableVerboseMissingInfo) @@ -934,7 +936,7 @@ public final class ModelLoader extends ModelBakery Integer errorCountBox = modelErrors.get(domain); int errorCount = errorCountBox == null ? 0 : errorCountBox; errorCount++; - if(errorCount < 5) + if(errorCount < verboseMissingInfoCount) { String errorMsg = "Exception loading model for variant " + entry.getKey(); if(enableVerboseMissingInfo) @@ -966,6 +968,12 @@ public final class ModelLoader extends ModelBakery } } FMLLog.getLogger().error(errorMsg, entry.getValue()); + ResourceLocation blockstateLocation = new ResourceLocation(location.getResourceDomain(), location.getResourcePath()); + if(loadingExceptions.containsKey(blockstateLocation) && !printedBlockStateErrors.contains(blockstateLocation)) + { + FMLLog.getLogger().error("Exception loading blockstate for the variant " + location + ": ", loadingExceptions.get(blockstateLocation)); + printedBlockStateErrors.add(blockstateLocation); + } } modelErrors.put(domain, errorCount); } @@ -984,7 +992,7 @@ public final class ModelLoader extends ModelBakery Integer errorCountBox = modelErrors.get(domain); int errorCount = errorCountBox == null ? 0 : errorCountBox; errorCount++; - if(errorCount < 5) + if(errorCount < verboseMissingInfoCount) { FMLLog.severe("Model definition for location %s not found", missing); } @@ -997,9 +1005,9 @@ public final class ModelLoader extends ModelBakery } for(Map.Entry e : modelErrors.entrySet()) { - if(e.getValue() >= 5) + if(e.getValue() >= verboseMissingInfoCount) { - FMLLog.severe("Suppressed additional %s model loading errors for domain %s", e.getValue(), e.getKey()); + FMLLog.severe("Suppressed additional %s model loading errors for domain %s", e.getValue() - verboseMissingInfoCount, e.getKey()); } } isLoading = false; From 2ae47c09033ddaeeaf62f40914f4656cce86a305 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Mon, 4 Apr 2016 18:07:06 +0300 Subject: [PATCH 195/243] Made both exceptions occuring during item model loading print in the log; closes #2696. --- .../client/model/ModelLoader.java | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 69964a1676..dc5326bd29 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -295,7 +295,7 @@ public final class ModelLoader extends ModelBakery { model = ModelLoaderRegistry.getModel(file); } - catch(Exception e) + catch(Exception normalException) { // try blockstate json if the item model is missing FMLLog.fine("Item json isn't found for '" + memory + "', trying to load the variant from the blockstate json"); @@ -303,9 +303,9 @@ public final class ModelLoader extends ModelBakery { model = ModelLoaderRegistry.getModel(memory); } - catch (Exception ex) + catch (Exception blockstateException) { - exception = new Exception("Could not load item model either from the normal location " + file + " or from the blockstate", ex); + exception = new ItemLoadingException("Could not load item model either from the normal location " + file + " or from the blockstate", normalException, blockstateException); } } stateModels.put(memory, model); @@ -571,7 +571,7 @@ public final class ModelLoader extends ModelBakery } } return super.getQuads(state, side, rand); - }; + } @Override public ItemOverrideList getOverrides() @@ -895,6 +895,19 @@ public final class ModelLoader extends ModelBakery } } + private static class ItemLoadingException extends ModelLoaderRegistry.LoaderException + { + private final Exception normalException; + private final Exception blockstateException; + + public ItemLoadingException(String message, Exception normalException, Exception blockstateException) + { + super(message); + this.normalException = normalException; + this.blockstateException = blockstateException; + } + } + /** * Internal, do not use. */ @@ -967,7 +980,16 @@ public final class ModelLoader extends ModelBakery } } } - FMLLog.getLogger().error(errorMsg, entry.getValue()); + if(entry.getValue() instanceof ItemLoadingException) + { + ItemLoadingException ex = (ItemLoadingException)entry.getValue(); + FMLLog.getLogger().error(errorMsg + ", normal location exception: ", ex.normalException); + FMLLog.getLogger().error(errorMsg + ", blockstate location exception: ", ex.blockstateException); + } + else + { + FMLLog.getLogger().error(errorMsg, entry.getValue()); + } ResourceLocation blockstateLocation = new ResourceLocation(location.getResourceDomain(), location.getResourcePath()); if(loadingExceptions.containsKey(blockstateLocation) && !printedBlockStateErrors.contains(blockstateLocation)) { From 6342bfea3e1363424e65369f585c8aadace90346 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 4 Apr 2016 15:22:17 -0700 Subject: [PATCH 196/243] Fix issue caused by setting spawnRadius to 0. Closes #2624 --- .../minecraft/net/minecraft/world/WorldProvider.java.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch index f67afd1b35..e5de49716f 100644 --- a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -185,11 +185,11 @@ + int spawnFuzz = this.field_76579_a instanceof WorldServer ? field_76577_b.getSpawnFuzz((WorldServer)this.field_76579_a, this.field_76579_a.func_73046_m()) : 1; + int border = MathHelper.func_76128_c(field_76579_a.func_175723_af().func_177729_b(ret.func_177958_n(), ret.func_177952_p())); + if (border < spawnFuzz) spawnFuzz = border; -+ if (spawnFuzz < 1) spawnFuzz = 1; -+ int spawnFuzzHalf = spawnFuzz / 2; + -+ if (!func_177495_o() && !isAdventure) ++ if (!func_177495_o() && !isAdventure && spawnFuzz != 0) + { ++ if (spawnFuzz < 2) spawnFuzz = 2; ++ int spawnFuzzHalf = spawnFuzz / 2; + ret = field_76579_a.func_175672_r(ret.func_177982_a(field_76579_a.field_73012_v.nextInt(spawnFuzzHalf) - spawnFuzz, 0, field_76579_a.field_73012_v.nextInt(spawnFuzzHalf) - spawnFuzz)); + } + From 9f1505dd5358a23f95ecd346f9444f0dbcd1061f Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 4 Apr 2016 15:33:45 -0700 Subject: [PATCH 197/243] Fixed EntityJoinWorldEvent not being fired for some entitites on Server Worlds. Closes #2685 --- .../minecraft/net/minecraft/world/WorldServer.java.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch index 26182ee574..2349e325ab 100644 --- a/patches/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServer.java.patch @@ -212,6 +212,15 @@ } public boolean func_72838_d(Entity p_72838_1_) +@@ -1058,7 +1097,7 @@ + { + for (Entity entity : Lists.newArrayList(p_175650_1_)) + { +- if (this.func_184165_i(entity)) ++ if (this.func_184165_i(entity) && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entity, this))) + { + this.field_72996_f.add(entity); + this.func_72923_a(entity); @@ -1161,6 +1200,7 @@ public Explosion func_72885_a(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) { From ce4bb8fe93a720988ae81606d5adb50938375c2a Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 4 Apr 2016 15:44:03 -0700 Subject: [PATCH 198/243] Fix improper logic in ItemHandlerHelper.giveItemToPlayer causing some items to not be added. Closes #2705 --- src/main/java/net/minecraftforge/items/ItemHandlerHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java b/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java index b2caf4717f..9c1c320847 100644 --- a/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java +++ b/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java @@ -142,7 +142,7 @@ public class ItemHandlerHelper World world = player.worldObj; // try adding it into the inventory - ItemStack remainder = null; + ItemStack remainder = stack; // insert into preferred slot first if(preferredSlot >= 0) { @@ -151,7 +151,7 @@ public class ItemHandlerHelper // then into the inventory in general if(remainder != null) { - remainder = insertItemStacked(inventory, stack, false); + remainder = insertItemStacked(inventory, remainder, false); } // play sound if something got picked up From 8f49ea7c5fef0c27f55a166fa03f5174ca3485dc Mon Sep 17 00:00:00 2001 From: mezz Date: Mon, 4 Apr 2016 16:52:16 -0700 Subject: [PATCH 199/243] Add modifier support to vanilla keybindings. Add Orange conflict color for modifier/key conflicts (like Ctrl and Ctrl-Z conflicting) Related to #2692 --- .../net/minecraft/client/Minecraft.java.patch | 22 +++++- .../client/gui/GuiControls.java.patch | 23 +++--- .../client/gui/GuiKeyBindingList.java.patch | 26 +++++-- .../client/gui/GuiScreenDemo.java.patch | 16 ++++ .../client/gui/GuiSpectator.java.patch | 11 +++ .../achievement/GuiAchievements.java.patch | 9 ++- .../gui/inventory/GuiContainer.java.patch | 59 ++++++++++++++ .../network/NetHandlerPlayClient.java.patch | 28 +++++++ .../client/settings/GameSettings.java.patch | 2 +- .../client/settings/KeyBinding.java.patch | 78 +++++++++++++------ .../client/settings/KeyBindingMap.java | 9 +-- .../client/settings/KeyModifier.java | 47 ++++------- 12 files changed, 249 insertions(+), 81 deletions(-) create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiScreenDemo.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiSpectator.java.patch diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 3d1788e0ea..91a4491116 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -21,6 +21,15 @@ this.field_152350_aA = new SkinManager(this.field_71446_o, new File(this.field_110446_Y, "skins"), this.field_152355_az); this.field_71469_aa = new AnvilSaveConverter(new File(this.field_71412_D, "saves"), this.field_184131_U); this.field_147127_av = new SoundHandler(this.field_110451_am, this.field_71474_y); +@@ -460,7 +459,7 @@ + { + try + { +- return String.format(p_74535_1_, new Object[] {GameSettings.func_74298_c(Minecraft.this.field_71474_y.field_151445_Q.func_151463_i())}); ++ return String.format(p_74535_1_, new Object[] {Minecraft.this.field_71474_y.field_151445_Q.getDisplayName()}); + } + catch (Exception exception) + { @@ -469,6 +468,8 @@ } }); @@ -474,7 +483,18 @@ } public boolean func_70002_Q() -@@ -3066,6 +2958,7 @@ +@@ -3057,15 +2949,16 @@ + { + if (Keyboard.getEventKeyState()) + { +- if (i == this.field_71474_y.field_152395_am.func_151463_i()) ++ if (this.field_71474_y.field_152395_am.isActiveAndMatches(i)) + { + this.func_71352_k(); + } +- else if (i == this.field_71474_y.field_151447_Z.func_151463_i()) ++ else if (this.field_71474_y.field_151447_Z.isActiveAndMatches(i)) + { this.field_71456_v.func_146158_b().func_146227_a(ScreenShotHelper.func_148260_a(this.field_71412_D, this.field_71443_c, this.field_71440_d, this.field_147124_at)); } } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch index ee31589c94..5a9cdd75b6 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch @@ -1,36 +1,37 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiControls.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiControls.java -@@ -66,6 +66,7 @@ +@@ -65,7 +65,7 @@ + { for (KeyBinding keybinding : this.field_146297_k.field_71474_y.field_74324_K) { - keybinding.func_151462_b(keybinding.func_151469_h()); -+ keybinding.setKeyModifier(keybinding.getKeyModifierDefault()); +- keybinding.func_151462_b(keybinding.func_151469_h()); ++ keybinding.setToDefault(); } KeyBinding.func_74508_b(); -@@ -81,6 +82,7 @@ +@@ -81,6 +81,7 @@ { if (this.field_146491_f != null) { -+ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.getActiveModifier()); ++ this.field_146491_f.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), -100 + p_73864_3_); this.field_146497_i.func_151440_a(this.field_146491_f, -100 + p_73864_3_); this.field_146491_f = null; KeyBinding.func_74508_b(); -@@ -105,17 +107,21 @@ +@@ -105,17 +106,21 @@ { if (p_73869_2_ == 1) { -+ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.NONE); ++ this.field_146491_f.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, 0); this.field_146497_i.func_151440_a(this.field_146491_f, 0); } else if (p_73869_2_ != 0) { -+ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(p_73869_2_) ? net.minecraftforge.client.settings.KeyModifier.NONE : net.minecraftforge.client.settings.KeyModifier.getActiveModifier()); ++ this.field_146491_f.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), p_73869_2_); this.field_146497_i.func_151440_a(this.field_146491_f, p_73869_2_); } else if (p_73869_1_ > 0) { -+ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(p_73869_2_) ? net.minecraftforge.client.settings.KeyModifier.NONE : net.minecraftforge.client.settings.KeyModifier.getActiveModifier()); ++ this.field_146491_f.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), p_73869_1_ + 256); this.field_146497_i.func_151440_a(this.field_146491_f, p_73869_1_ + 256); } @@ -38,12 +39,12 @@ this.field_146491_f = null; this.field_152177_g = Minecraft.func_71386_F(); KeyBinding.func_74508_b(); -@@ -135,7 +141,7 @@ +@@ -135,7 +140,7 @@ for (KeyBinding keybinding : this.field_146497_i.field_74324_K) { - if (keybinding.func_151463_i() != keybinding.func_151469_h()) -+ if (keybinding.func_151463_i() != keybinding.func_151469_h() || keybinding.getKeyModifier() != keybinding.getKeyModifierDefault()) ++ if (!keybinding.isSetToDefaultValue()) { flag = false; break; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch index b3c50b3cdd..2471d1bf9b 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch @@ -18,7 +18,7 @@ this.field_148281_e = new GuiButton(0, 0, 0, 50, 20, I18n.func_135052_a("controls.reset", new Object[0])); } -@@ -121,20 +121,20 @@ +@@ -121,23 +121,24 @@ { boolean flag = GuiKeyBindingList.this.field_148191_k.field_146491_f == this.field_148282_b; GuiKeyBindingList.this.field_148189_l.field_71466_p.func_78276_b(this.field_148283_c, p_180790_2_ + 90 - GuiKeyBindingList.this.field_148188_n, p_180790_3_ + p_180790_5_ / 2 - GuiKeyBindingList.this.field_148189_l.field_71466_p.field_78288_b / 2, 16777215); @@ -26,13 +26,14 @@ + this.field_148281_e.field_146128_h = p_180790_2_ + 210; this.field_148281_e.field_146129_i = p_180790_3_; - this.field_148281_e.field_146124_l = this.field_148282_b.func_151463_i() != this.field_148282_b.func_151469_h(); -+ this.field_148281_e.field_146124_l = this.field_148282_b.func_151463_i() != this.field_148282_b.func_151469_h() || this.field_148282_b.getKeyModifier() != this.field_148282_b.getKeyModifierDefault(); ++ this.field_148281_e.field_146124_l = !this.field_148282_b.isSetToDefaultValue(); this.field_148281_e.func_146112_a(GuiKeyBindingList.this.field_148189_l, p_180790_6_, p_180790_7_); this.field_148280_d.field_146128_h = p_180790_2_ + 105; this.field_148280_d.field_146129_i = p_180790_3_; - this.field_148280_d.field_146126_j = GameSettings.func_74298_c(this.field_148282_b.func_151463_i()); -+ this.field_148280_d.field_146126_j = this.field_148282_b.getKeyModifier().getLocalizedComboName(GameSettings.func_74298_c(this.field_148282_b.func_151463_i())); ++ this.field_148280_d.field_146126_j = this.field_148282_b.getDisplayName(); boolean flag1 = false; ++ boolean keyCodeModifierConflict = true; // less severe form of conflict, like SHIFT conflicting with SHIFT+G if (this.field_148282_b.func_151463_i() != 0) { @@ -42,12 +43,25 @@ + if (keybinding != this.field_148282_b && keybinding.conflicts(this.field_148282_b)) { flag1 = true; - break; -@@ -163,6 +163,7 @@ +- break; ++ keyCodeModifierConflict &= keybinding.hasKeyCodeModifierConflict(this.field_148282_b); + } + } + } +@@ -148,7 +149,7 @@ + } + else if (flag1) + { +- this.field_148280_d.field_146126_j = TextFormatting.RED + this.field_148280_d.field_146126_j; ++ this.field_148280_d.field_146126_j = (keyCodeModifierConflict ? TextFormatting.GOLD : TextFormatting.RED) + this.field_148280_d.field_146126_j; + } + + this.field_148280_d.func_146112_a(GuiKeyBindingList.this.field_148189_l, p_180790_6_, p_180790_7_); +@@ -163,6 +164,7 @@ } else if (this.field_148281_e.func_146116_c(GuiKeyBindingList.this.field_148189_l, p_148278_2_, p_148278_3_)) { -+ this.field_148282_b.setKeyModifier(this.field_148282_b.getKeyModifierDefault()); ++ this.field_148282_b.setToDefault(); GuiKeyBindingList.this.field_148189_l.field_71474_y.func_151440_a(this.field_148282_b, this.field_148282_b.func_151469_h()); KeyBinding.func_74508_b(); return true; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiScreenDemo.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiScreenDemo.java.patch new file mode 100644 index 0000000000..bc1953025b --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiScreenDemo.java.patch @@ -0,0 +1,16 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiScreenDemo.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreenDemo.java +@@ -73,10 +73,10 @@ + this.field_146289_q.func_78276_b(I18n.func_135052_a("demo.help.title", new Object[0]), i, j, 2039583); + j = j + 12; + GameSettings gamesettings = this.field_146297_k.field_71474_y; +- this.field_146289_q.func_78276_b(I18n.func_135052_a("demo.help.movementShort", new Object[] {GameSettings.func_74298_c(gamesettings.field_74351_w.func_151463_i()), GameSettings.func_74298_c(gamesettings.field_74370_x.func_151463_i()), GameSettings.func_74298_c(gamesettings.field_74368_y.func_151463_i()), GameSettings.func_74298_c(gamesettings.field_74366_z.func_151463_i())}), i, j, 5197647); ++ this.field_146289_q.func_78276_b(I18n.func_135052_a("demo.help.movementShort", new Object[] {gamesettings.field_74351_w.getDisplayName(), gamesettings.field_74370_x.getDisplayName(), gamesettings.field_74368_y.getDisplayName(), gamesettings.field_74366_z.getDisplayName()}), i, j, 5197647); + this.field_146289_q.func_78276_b(I18n.func_135052_a("demo.help.movementMouse", new Object[0]), i, j + 12, 5197647); +- this.field_146289_q.func_78276_b(I18n.func_135052_a("demo.help.jump", new Object[] {GameSettings.func_74298_c(gamesettings.field_74314_A.func_151463_i())}), i, j + 24, 5197647); +- this.field_146289_q.func_78276_b(I18n.func_135052_a("demo.help.inventory", new Object[] {GameSettings.func_74298_c(gamesettings.field_151445_Q.func_151463_i())}), i, j + 36, 5197647); ++ this.field_146289_q.func_78276_b(I18n.func_135052_a("demo.help.jump", new Object[] {gamesettings.field_74314_A.getDisplayName()}), i, j + 24, 5197647); ++ this.field_146289_q.func_78276_b(I18n.func_135052_a("demo.help.inventory", new Object[] {gamesettings.field_151445_Q.getDisplayName()}), i, j + 36, 5197647); + this.field_146289_q.func_78279_b(I18n.func_135052_a("demo.help.fullWrapped", new Object[0]), i, j + 68, 218, 2039583); + super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_); + } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSpectator.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSpectator.java.patch new file mode 100644 index 0000000000..75838aea9a --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiSpectator.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiSpectator.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiSpectator.java +@@ -109,7 +109,7 @@ + GlStateManager.func_179131_c(f, f, f, p_175266_4_); + p_175266_5_.func_178663_a(f, i); + GlStateManager.func_179121_F(); +- String s = String.valueOf((Object)GameSettings.func_74298_c(this.field_175268_g.field_71474_y.field_151456_ac[p_175266_1_].func_151463_i())); ++ String s = String.valueOf(this.field_175268_g.field_71474_y.field_151456_ac[p_175266_1_].getDisplayName()); + + if (i > 3 && p_175266_5_.func_178662_A_()) + { diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch index bba2f8a700..0155153ef3 100644 --- a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch @@ -34,7 +34,7 @@ } protected void func_146284_a(GuiButton p_146284_1_) throws IOException -@@ -74,6 +87,16 @@ +@@ -74,12 +87,22 @@ { this.field_146297_k.func_147108_a(this.field_146562_a); } @@ -51,6 +51,13 @@ } } + protected void func_73869_a(char p_73869_1_, int p_73869_2_) throws IOException + { +- if (p_73869_2_ == this.field_146297_k.field_71474_y.field_151445_Q.func_151463_i()) ++ if (this.field_146297_k.field_71474_y.field_151445_Q.isActiveAndMatches(p_73869_2_)) + { + this.field_146297_k.func_147108_a((GuiScreen)null); + this.field_146297_k.func_71381_h(); @@ -257,7 +280,9 @@ GlStateManager.func_179143_c(518); GlStateManager.func_179094_E(); diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch index 1b2794a76b..145e92ea6b 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch @@ -30,6 +30,15 @@ this.func_175175_a(i, j, textureatlassprite, 16, 16); GlStateManager.func_179145_e(); flag1 = true; +@@ -316,7 +318,7 @@ + protected void func_73864_a(int p_73864_1_, int p_73864_2_, int p_73864_3_) throws IOException + { + super.func_73864_a(p_73864_1_, p_73864_2_, p_73864_3_); +- boolean flag = p_73864_3_ == this.field_146297_k.field_71474_y.field_74322_I.func_151463_i() + 100; ++ boolean flag = this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(p_73864_3_ + 100); + Slot slot = this.func_146975_c(p_73864_1_, p_73864_2_); + long i = Minecraft.func_71386_F(); + this.field_146993_M = this.field_146998_K == slot && i - this.field_146997_J < 250L && this.field_146992_L == p_73864_3_; @@ -327,6 +329,7 @@ int j = this.field_147003_i; int k = this.field_147009_r; @@ -38,6 +47,24 @@ int l = -1; if (slot != null) +@@ -364,7 +367,7 @@ + { + if (this.field_146297_k.field_71439_g.field_71071_by.func_70445_o() == null) + { +- if (p_73864_3_ == this.field_146297_k.field_71474_y.field_74322_I.func_151463_i() + 100) ++ if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(p_73864_3_ + 100)) + { + this.func_184098_a(slot, l, p_73864_3_, ClickType.CLONE); + } +@@ -402,7 +405,7 @@ + { + this.field_146987_F = 1; + } +- else if (p_73864_3_ == this.field_146297_k.field_71474_y.field_74322_I.func_151463_i() + 100) ++ else if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(p_73864_3_ + 100)) + { + this.field_146987_F = 2; + } @@ -464,10 +467,12 @@ protected void func_146286_b(int p_146286_1_, int p_146286_2_, int p_146286_3_) @@ -51,6 +78,38 @@ int k = -1; if (slot != null) +@@ -627,7 +632,7 @@ + + protected void func_73869_a(char p_73869_1_, int p_73869_2_) throws IOException + { +- if (p_73869_2_ == 1 || p_73869_2_ == this.field_146297_k.field_71474_y.field_151445_Q.func_151463_i()) ++ if (p_73869_2_ == 1 || this.field_146297_k.field_71474_y.field_151445_Q.isActiveAndMatches(p_73869_2_)) + { + this.field_146297_k.field_71439_g.func_71053_j(); + } +@@ -636,11 +641,11 @@ + + if (this.field_147006_u != null && this.field_147006_u.func_75216_d()) + { +- if (p_73869_2_ == this.field_146297_k.field_71474_y.field_74322_I.func_151463_i()) ++ if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(p_73869_2_)) + { + this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, 0, ClickType.CLONE); + } +- else if (p_73869_2_ == this.field_146297_k.field_71474_y.field_74316_C.func_151463_i()) ++ else if (this.field_146297_k.field_71474_y.field_74316_C.isActiveAndMatches(p_73869_2_)) + { + this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, func_146271_m() ? 1 : 0, ClickType.THROW); + } +@@ -653,7 +658,7 @@ + { + for (int i = 0; i < 9; ++i) + { +- if (p_146983_1_ == this.field_146297_k.field_71474_y.field_151456_ac[i].func_151463_i()) ++ if (this.field_146297_k.field_71474_y.field_151456_ac[i].isActiveAndMatches(p_146983_1_)) + { + this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, i, ClickType.SWAP); + return true; @@ -686,4 +691,16 @@ this.field_146297_k.field_71439_g.func_71053_j(); } diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch index 54911d8387..61b8bd175b 100644 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch @@ -40,6 +40,15 @@ EntityTracker.func_187254_a(entitylivingbase, d0, d1, d2); entitylivingbase.field_70761_aq = entitylivingbase.field_70759_as = (float)(p_147281_1_.func_149032_n() * 360) / 256.0F; Entity[] aentity = entitylivingbase.func_70021_al(); +@@ -919,7 +926,7 @@ + + if (entity1 == this.field_147299_f.field_71439_g && !flag) + { +- this.field_147299_f.field_71456_v.func_110326_a(I18n.func_135052_a("mount.onboard", new Object[] {GameSettings.func_74298_c(this.field_147299_f.field_71474_y.field_74311_E.func_151463_i())}), false); ++ this.field_147299_f.field_71456_v.func_110326_a(I18n.func_135052_a("mount.onboard", new Object[] {this.field_147299_f.field_71474_y.field_74311_E.getDisplayName()}), false); + } + } + } @@ -1179,6 +1186,10 @@ { tileentity.func_145839_a(p_147273_1_.func_148857_g()); @@ -51,6 +60,25 @@ if (flag && this.field_147299_f.field_71462_r instanceof GuiCommandBlock) { +@@ -1276,15 +1287,15 @@ + } + else if (f == 101.0F) + { +- this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.movement", new Object[] {GameSettings.func_74298_c(gamesettings.field_74351_w.func_151463_i()), GameSettings.func_74298_c(gamesettings.field_74370_x.func_151463_i()), GameSettings.func_74298_c(gamesettings.field_74368_y.func_151463_i()), GameSettings.func_74298_c(gamesettings.field_74366_z.func_151463_i())})); ++ this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.movement", new Object[] {gamesettings.field_74351_w.getDisplayName(), gamesettings.field_74370_x.getDisplayName(), gamesettings.field_74368_y.getDisplayName(), gamesettings.field_74366_z.getDisplayName()})); + } + else if (f == 102.0F) + { +- this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.jump", new Object[] {GameSettings.func_74298_c(gamesettings.field_74314_A.func_151463_i())})); ++ this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.jump", new Object[] {gamesettings.field_74314_A.getDisplayName()})); + } + else if (f == 103.0F) + { +- this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.inventory", new Object[] {GameSettings.func_74298_c(gamesettings.field_151445_Q.func_151463_i())})); ++ this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.inventory", new Object[] {gamesettings.field_151445_Q.getDisplayName()})); + } + } + else if (i == 6) @@ -1378,7 +1389,7 @@ if (entity instanceof EntityLivingBase) diff --git a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch index a62941dc5e..3ed2135db6 100644 --- a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch +++ b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch @@ -20,7 +20,7 @@ if (astring[0].equals("key_" + keybinding.func_151464_g())) { keybinding.func_151462_b(Integer.parseInt(astring[1])); -+ if (astring.length == 3) keybinding.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.valueOf(astring[2])); ++ if (astring.length == 3) keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueOf(astring[2]), Integer.parseInt(astring[1])); } } diff --git a/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch b/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch index f80019f4be..d238490901 100644 --- a/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch +++ b/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch @@ -57,7 +57,7 @@ } public String func_151466_e() -@@ -158,4 +158,102 @@ +@@ -158,4 +158,130 @@ return i; } @@ -66,7 +66,6 @@ + private net.minecraftforge.client.settings.KeyModifier keyModifierDefault = net.minecraftforge.client.settings.KeyModifier.NONE; + private net.minecraftforge.client.settings.KeyModifier keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE; + private net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext = net.minecraftforge.client.settings.KeyConflictContext.UNIVERSAL; -+ private boolean allowsKeyModifiers = false; + + /** + * Convenience constructor for creating KeyBindings with keyConflictContext set. @@ -88,24 +87,16 @@ + this.keyConflictContext = keyConflictContext; + this.keyModifier = keyModifier; + this.keyModifierDefault = keyModifier; -+ if (keyModifier != net.minecraftforge.client.settings.KeyModifier.NONE) -+ setAllowsKeyModifiers(); ++ if (this.keyModifier.matches(keyCode)) ++ { ++ this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE; ++ } + field_74516_a.add(this); + field_74514_b.addKey(keyCode, this); + field_151473_c.add(category); + } + + /** -+ * Call this method to let Forge know that your KeyBinding and code can handle players setting modifiers. -+ * Handling modifiers is made easy by using {@link KeyBinding#isActiveAndMatches(int)} or {@link KeyBinding#isPressed()} -+ * Vanilla code does not handle modifiers, so vanilla keyBinds do not have this set. -+ */ -+ public void setAllowsKeyModifiers() -+ { -+ this.allowsKeyModifiers = true; -+ } -+ -+ /** + * Checks that the key conflict context and modifier are active, and that the keyCode matches this binding. + */ + public boolean isActiveAndMatches(int keyCode) @@ -130,33 +121,70 @@ + + public net.minecraftforge.client.settings.KeyModifier getKeyModifier() + { -+ if (allowsKeyModifiers) -+ { -+ return keyModifier; -+ } -+ else -+ { -+ return net.minecraftforge.client.settings.KeyModifier.NOT_SUPPORTED; -+ } ++ return keyModifier; + } + -+ public void setKeyModifier(net.minecraftforge.client.settings.KeyModifier keyModifier) ++ public void setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier keyModifier, int keyCode) + { ++ this.field_74512_d = keyCode; ++ if (keyModifier.matches(keyCode)) ++ { ++ keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE; ++ } + field_74514_b.removeKey(this); + this.keyModifier = keyModifier; -+ field_74514_b.addKey(field_74512_d, this); ++ field_74514_b.addKey(keyCode, this); + } + ++ public void setToDefault() ++ { ++ setKeyModifierAndCode(getKeyModifierDefault(), func_151469_h()); ++ } ++ ++ public boolean isSetToDefaultValue() ++ { ++ return func_151463_i() == func_151469_h() && getKeyModifier() == getKeyModifierDefault(); ++ } ++ ++ /** ++ * Returns true when the other keyBinding conflicts with this one ++ */ + public boolean conflicts(KeyBinding other) + { + if (getKeyConflictContext().conflicts(other.getKeyConflictContext()) || other.getKeyConflictContext().conflicts(getKeyConflictContext())) + { -+ if (!allowsKeyModifiers || !other.allowsKeyModifiers || getKeyModifier() == other.getKeyModifier()) ++ net.minecraftforge.client.settings.KeyModifier keyModifier = getKeyModifier(); ++ net.minecraftforge.client.settings.KeyModifier otherKeyModifier = other.getKeyModifier(); ++ if (keyModifier.matches(other.func_151463_i()) || otherKeyModifier.matches(func_151463_i())) ++ { ++ return true; ++ } ++ else if (keyModifier == otherKeyModifier || keyModifier == net.minecraftforge.client.settings.KeyModifier.NONE || otherKeyModifier == net.minecraftforge.client.settings.KeyModifier.NONE) + { + return func_151463_i() == other.func_151463_i(); + } + } + return false; + } ++ ++ /** ++ * Returns true when one of the bindings' key codes conflicts with the other's modifier. ++ */ ++ public boolean hasKeyCodeModifierConflict(KeyBinding other) ++ { ++ if (getKeyConflictContext().conflicts(other.getKeyConflictContext()) || other.getKeyConflictContext().conflicts(getKeyConflictContext())) ++ { ++ if (getKeyModifier().matches(other.func_151463_i()) || other.getKeyModifier().matches(func_151463_i())) ++ { ++ return true; ++ } ++ } ++ return false; ++ } ++ ++ public String getDisplayName() ++ { ++ return getKeyModifier().getLocalizedComboName(func_151463_i()); ++ } + /****************** Forge End *****************************/ } diff --git a/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java b/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java index 4524544a0a..b50af087a2 100644 --- a/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java +++ b/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java @@ -21,13 +21,12 @@ public class KeyBindingMap public KeyBinding lookupActive(int keyCode) { - KeyModifier activeModifier = KeyModifier.isKeyCodeModifier(keyCode) ? KeyModifier.NONE : KeyModifier.getActiveModifier(); - KeyBinding binding = getBinding(keyCode, activeModifier); - if (binding != null) + KeyModifier activeModifier = KeyModifier.getActiveModifier(); + if (activeModifier.matches(keyCode)) { - return binding; + activeModifier = KeyModifier.NONE; } - return getBinding(keyCode, KeyModifier.NOT_SUPPORTED); + return getBinding(keyCode, activeModifier); } private KeyBinding getBinding(int keyCode, KeyModifier keyModifier) diff --git a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java index 54c0c8860a..9838251dac 100644 --- a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java +++ b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java @@ -3,12 +3,13 @@ package net.minecraftforge.client.settings; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; import org.lwjgl.input.Keyboard; public enum KeyModifier { CONTROL { @Override - protected boolean matches(int keyCode) + public boolean matches(int keyCode) { if (Minecraft.isRunningOnMac) { @@ -27,14 +28,15 @@ public enum KeyModifier { } @Override - public String getLocalizedComboName(String keyName) + public String getLocalizedComboName(int keyCode) { + String keyName = GameSettings.getKeyDisplayString(keyCode); return I18n.format("forge.controlsgui.control", keyName); } }, SHIFT { @Override - protected boolean matches(int keyCode) + public boolean matches(int keyCode) { return keyCode == Keyboard.KEY_LSHIFT || keyCode == Keyboard.KEY_RSHIFT; } @@ -46,14 +48,15 @@ public enum KeyModifier { } @Override - public String getLocalizedComboName(String keyName) + public String getLocalizedComboName(int keyCode) { + String keyName = GameSettings.getKeyDisplayString(keyCode); return I18n.format("forge.controlsgui.shift", keyName); } }, ALT { @Override - protected boolean matches(int keyCode) + public boolean matches(int keyCode) { return keyCode == Keyboard.KEY_LMENU || keyCode == Keyboard.KEY_RMENU; } @@ -65,35 +68,17 @@ public enum KeyModifier { } @Override - public String getLocalizedComboName(String keyName) + public String getLocalizedComboName(int keyCode) { + String keyName = GameSettings.getKeyDisplayString(keyCode); return I18n.format("forge.controlsgui.alt", keyName); } }, NONE { @Override - protected boolean matches(int keyCode) + public boolean matches(int keyCode) { - return true; - } - - @Override - public boolean isActive() - { - return !SHIFT.isActive() && !CONTROL.isActive() && !ALT.isActive(); - } - - @Override - public String getLocalizedComboName(String keyName) - { - return keyName; - } - }, - NOT_SUPPORTED { - @Override - protected boolean matches(int keyCode) - { - return true; + return false; } @Override @@ -103,9 +88,9 @@ public enum KeyModifier { } @Override - public String getLocalizedComboName(String keyName) + public String getLocalizedComboName(int keyCode) { - return keyName; + return GameSettings.getKeyDisplayString(keyCode); } }; @@ -135,9 +120,9 @@ public enum KeyModifier { return false; } - protected abstract boolean matches(int keyCode); + public abstract boolean matches(int keyCode); public abstract boolean isActive(); - public abstract String getLocalizedComboName(String keyName); + public abstract String getLocalizedComboName(int keyCode); } From e8ea52558bbb9926d0a8694f132b5a572a360d1c Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Mon, 4 Apr 2016 19:58:46 -0500 Subject: [PATCH 200/243] Player Interact Event --- .../net/minecraft/client/Minecraft.java.patch | 18 + .../multiplayer/PlayerControllerMP.java.patch | 72 +++- .../entity/player/EntityPlayer.java.patch | 2 +- .../network/NetHandlerPlayServer.java.patch | 19 +- .../PlayerInteractionManager.java.patch | 87 +++- .../minecraft/client/Minecraft.java.patch.rej | 33 -- .../ItemInWorldManager.java.patch.rej | 71 ---- .../net/minecraftforge/common/ForgeHooks.java | 41 ++ .../event/ForgeEventFactory.java | 21 - .../entity/player/EntityInteractEvent.java | 41 -- .../entity/player/PlayerInteractEvent.java | 384 ++++++++++++++---- .../test/PlayerInteractEventLocalTest.java | 29 -- .../test/PlayerInteractEventTest.java | 154 +++++++ .../test/TestCapabilityMod.java | 7 +- 14 files changed, 685 insertions(+), 294 deletions(-) delete mode 100644 rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch.rej delete mode 100644 src/main/java/net/minecraftforge/event/entity/player/EntityInteractEvent.java delete mode 100644 src/test/java/net/minecraftforge/test/PlayerInteractEventLocalTest.java create mode 100644 src/test/java/net/minecraftforge/test/PlayerInteractEventTest.java diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 3d1788e0ea..8b505b450c 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -175,6 +175,24 @@ { this.field_71442_b.func_180511_b(blockpos, this.field_71476_x.field_178784_b); break; +@@ -1473,7 +1491,7 @@ + switch (this.field_71476_x.field_72313_a) + { + case ENTITY: +- ++ if(!net.minecraftforge.common.ForgeHooks.onInteractEntityAt(field_71439_g, field_71476_x.field_72308_g, field_71476_x, field_71439_g.func_184586_b(enumhand), enumhand)) + if (this.field_71442_b.func_187102_a(this.field_71439_g, this.field_71476_x.field_72308_g, this.field_71476_x, this.field_71439_g.func_184586_b(enumhand), enumhand) == EnumActionResult.SUCCESS) + { + return; +@@ -1516,7 +1534,7 @@ + } + + ItemStack itemstack1 = this.field_71439_g.func_184586_b(enumhand); +- ++ if (itemstack1 == null) net.minecraftforge.common.ForgeHooks.onEmptyClick(this.field_71439_g, enumhand); + if (itemstack1 != null && this.field_71442_b.func_187101_a(this.field_71439_g, this.field_71441_e, itemstack1, enumhand) == EnumActionResult.SUCCESS) + { + this.field_71460_t.field_78516_c.func_187460_a(enumhand); @@ -1623,6 +1641,8 @@ --this.field_71467_ac; } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index e28a1fd5c5..b9fcfafa15 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -50,8 +50,39 @@ return flag; } } -@@ -373,11 +379,18 @@ +@@ -217,14 +223,17 @@ + } + + this.field_78774_b.func_147297_a(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_)); ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180511_1_, p_180511_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(this.field_78776_a.field_71439_g, func_78757_d() + 1)); ++ + IBlockState iblockstate = this.field_78776_a.field_71441_e.func_180495_p(p_180511_1_); + boolean flag = iblockstate.func_185904_a() != Material.field_151579_a; + + if (flag && this.field_78770_f == 0.0F) + { ++ if (event.getUseBlock() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + iblockstate.func_177230_c().func_180649_a(this.field_78776_a.field_71441_e, p_180511_1_, this.field_78776_a.field_71439_g); + } +- ++ if (event.getUseItem() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true; + if (flag && iblockstate.func_185903_a(this.field_78776_a.field_71439_g, this.field_78776_a.field_71439_g.field_70170_p, p_180511_1_) >= 1.0F) + { + this.func_187103_a(p_180511_1_); +@@ -371,13 +380,32 @@ + } + else { ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks ++ .onRightClickBlock(p_187099_1_, p_187099_7_, p_187099_3_, p_187099_4_, p_187099_5_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(p_187099_1_, func_78757_d() + 1)); ++ if (event.isCanceled()) ++ { ++ // Give the server a chance to fire event as well. That way server event is not dependant on client event. ++ this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItem(p_187099_4_, p_187099_5_, p_187099_7_, f, f1, f2)); ++ return EnumActionResult.PASS; ++ } ++ EnumActionResult result = EnumActionResult.PASS; ++ if (this.field_78779_k != WorldSettings.GameType.SPECTATOR) { + net.minecraft.item.Item item = p_187099_3_ == null ? null : p_187099_3_.func_77973_b(); @@ -64,25 +95,54 @@ + bypass = bypass && (s == null || s.func_77973_b().doesSneakBypassUse(s, p_187099_2_, p_187099_4_, p_187099_1_)); - if ((!p_187099_1_.func_70093_af() || p_187099_1_.func_184614_ca() == null && p_187099_1_.func_184592_cb() == null) && iblockstate.func_177230_c().func_180639_a(p_187099_2_, p_187099_4_, iblockstate, p_187099_1_, p_187099_7_, p_187099_3_, p_187099_5_, f, f1, f2)) -+ if (!p_187099_1_.func_70093_af() || bypass) ++ if (!p_187099_1_.func_70093_af() || bypass || event.getUseBlock() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) { - flag = true; ++ if(event.getUseBlock() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + flag = iblockstate.func_177230_c().func_180639_a(p_187099_2_, p_187099_4_, iblockstate, p_187099_1_, p_187099_7_, p_187099_3_, p_187099_5_, f, f1, f2); ++ if(flag) result = EnumActionResult.SUCCESS; } if (!flag && p_187099_3_ != null && p_187099_3_.func_77973_b() instanceof ItemBlock) -@@ -418,7 +431,9 @@ +@@ -393,7 +421,7 @@ + + this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItem(p_187099_4_, p_187099_5_, p_187099_7_, f, f1, f2)); + +- if (!flag && this.field_78779_k != WorldSettings.GameType.SPECTATOR) ++ if (!flag && this.field_78779_k != WorldSettings.GameType.SPECTATOR || event.getUseItem() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) + { + if (p_187099_3_ == null) + { +@@ -411,14 +439,19 @@ + { + int i = p_187099_3_.func_77960_j(); + int j = p_187099_3_.field_77994_a; ++ if (event.getUseItem() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) { + EnumActionResult enumactionresult = p_187099_3_.func_179546_a(p_187099_1_, p_187099_2_, p_187099_4_, p_187099_7_, p_187099_5_, f, f1, f2); + p_187099_3_.func_77964_b(i); + p_187099_3_.field_77994_a = j; + return enumactionresult; ++ } else return result; } else { - return p_187099_3_.func_179546_a(p_187099_1_, p_187099_2_, p_187099_4_, p_187099_7_, p_187099_5_, f, f1, f2); -+ EnumActionResult ret = p_187099_3_.func_179546_a(p_187099_1_, p_187099_2_, p_187099_4_, p_187099_7_, p_187099_5_, f, f1, f2); ++ if (event.getUseItem() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ result = p_187099_3_.func_179546_a(p_187099_1_, p_187099_2_, p_187099_4_, p_187099_7_, p_187099_5_, f, f1, f2); + if (p_187099_3_.field_77994_a <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187099_1_, p_187099_3_, p_187099_7_); -+ return ret; ++ return result; } } else -@@ -453,9 +468,10 @@ +@@ -445,6 +478,7 @@ + } + else + { ++ if (net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187101_1_, p_187101_4_, p_187101_3_)) return net.minecraft.util.EnumActionResult.PASS; + int i = p_187101_3_.field_77994_a; + ActionResult actionresult = p_187101_3_.func_77957_a(p_187101_2_, p_187101_1_, p_187101_4_); + ItemStack itemstack = (ItemStack)actionresult.func_188398_b(); +@@ -453,9 +487,10 @@ { p_187101_1_.func_184611_a(p_187101_4_, itemstack); diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index 68bdc3287c..8da477eb31 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -218,7 +218,7 @@ } else { -+ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, p_184822_1_, p_184822_2_, p_184822_3_)) return EnumActionResult.PASS; ++ if (net.minecraftforge.common.ForgeHooks.onInteractEntity(this, p_184822_1_, p_184822_2_, p_184822_3_)) return EnumActionResult.PASS; ItemStack itemstack = p_184822_2_ != null ? p_184822_2_.func_77946_l() : null; if (!p_184822_1_.func_184230_a(this, p_184822_2_, p_184822_3_)) diff --git a/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch index 657125557f..df2660338f 100644 --- a/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch +++ b/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -31,14 +31,7 @@ itemstack = null; } } -@@ -703,12 +709,14 @@ - - if (itemstack != null) - { -+ //TODO: Hook interact event here... we don't know the type of itneration tho... - this.field_147369_b.field_71134_c.func_187250_a(this.field_147369_b, worldserver, itemstack, enumhand); - itemstack = this.field_147369_b.func_184586_b(enumhand); - +@@ -709,6 +715,7 @@ if (itemstack != null && itemstack.field_77994_a == 0) { this.field_147369_b.func_184611_a(enumhand, (ItemStack)null); @@ -46,7 +39,7 @@ itemstack = null; } } -@@ -888,7 +896,9 @@ +@@ -888,7 +895,9 @@ } else { @@ -57,6 +50,14 @@ this.field_147367_d.func_184103_al().func_148544_a(itextcomponent, false); } +@@ -1018,6 +1027,7 @@ + { + EnumHand enumhand1 = p_147340_1_.func_186994_b(); + ItemStack itemstack1 = this.field_147369_b.func_184586_b(enumhand1); ++ if(net.minecraftforge.common.ForgeHooks.onInteractEntityAt(field_147369_b, entity, p_147340_1_.func_179712_b(), itemstack1, enumhand1)) return; + entity.func_184199_a(this.field_147369_b, p_147340_1_.func_179712_b(), itemstack1, enumhand1); + } + else if (p_147340_1_.func_149565_c() == CPacketUseEntity.Action.ATTACK) @@ -1057,7 +1067,7 @@ return; } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch index d7f9cbd1ec..623e191d2f 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch @@ -36,22 +36,23 @@ int l = (int)(f1 * 10.0F); if (l != this.field_73094_o) -@@ -138,6 +140,14 @@ +@@ -138,6 +140,15 @@ public void func_180784_a(BlockPos p_180784_1_, EnumFacing p_180784_2_) { -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_73090_b, -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, field_73092_a, p_180784_1_, p_180784_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(field_73090_b, getBlockReachDistance() + 1)); ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(field_73090_b, p_180784_1_, p_180784_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(field_73090_b, getBlockReachDistance() + 1)); + if (event.isCanceled()) + { ++ // Restore block and te data + field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(field_73092_a, p_180784_1_)); ++ field_73092_a.func_184138_a(p_180784_1_, field_73092_a.func_180495_p(p_180784_1_), field_73092_a.func_180495_p(p_180784_1_), 3); + return; + } + if (this.func_73083_d()) { if (!this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_)) -@@ -173,17 +183,32 @@ +@@ -173,17 +184,36 @@ } } @@ -70,7 +71,9 @@ + } + else + { ++ // Restore block and te data + field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(field_73092_a, p_180784_1_)); ++ field_73092_a.func_184138_a(p_180784_1_, field_73092_a.func_180495_p(p_180784_1_), field_73092_a.func_180495_p(p_180784_1_), 3); + } f = iblockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180784_1_); } @@ -78,7 +81,9 @@ + { + if (f >= 1.0F) + { ++ // Restore block and te data + field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(field_73092_a, p_180784_1_)); ++ field_73092_a.func_184138_a(p_180784_1_, field_73092_a.func_180495_p(p_180784_1_), field_73092_a.func_180495_p(p_180784_1_), 3); + } + return; + } @@ -88,7 +93,7 @@ { this.func_180237_b(p_180784_1_); } -@@ -205,7 +230,7 @@ +@@ -205,7 +235,7 @@ int i = this.field_73100_i - this.field_73089_e; IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180785_1_); @@ -97,7 +102,7 @@ { float f = iblockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180785_1_) * (float)(i + 1); -@@ -234,13 +259,17 @@ +@@ -234,13 +264,17 @@ private boolean func_180235_c(BlockPos p_180235_1_) { @@ -119,7 +124,7 @@ } return flag; -@@ -248,7 +277,8 @@ +@@ -248,7 +282,8 @@ public boolean func_180237_b(BlockPos p_180237_1_) { @@ -129,7 +134,7 @@ { return false; } -@@ -264,41 +294,22 @@ +@@ -264,41 +299,22 @@ } else { @@ -176,7 +181,7 @@ if (itemstack1 != null) { -@@ -310,12 +321,18 @@ +@@ -310,12 +326,18 @@ } } @@ -195,7 +200,15 @@ return flag1; } } -@@ -359,6 +376,7 @@ +@@ -333,6 +355,7 @@ + } + else + { ++ if (net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187250_1_, p_187250_4_, p_187250_3_)) return net.minecraft.util.EnumActionResult.PASS; + int i = p_187250_3_.field_77994_a; + int j = p_187250_3_.func_77960_j(); + ActionResult actionresult = p_187250_3_.func_77957_a(p_187250_2_, p_187250_1_, p_187250_4_); +@@ -359,6 +382,7 @@ if (itemstack.field_77994_a == 0) { p_187250_1_.func_184611_a(p_187250_4_, (ItemStack)null); @@ -203,7 +216,59 @@ } if (!p_187250_1_.func_184587_cr()) -@@ -445,4 +463,13 @@ +@@ -403,13 +427,26 @@ + } + else + { +- if (!p_187251_1_.func_70093_af() || p_187251_1_.func_184614_ca() == null && p_187251_1_.func_184592_cb() == null) ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks ++ .onRightClickBlock(p_187251_1_, p_187251_4_, p_187251_3_, p_187251_5_, p_187251_6_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(field_73090_b, getBlockReachDistance() + 1)); ++ if (event.isCanceled()) return EnumActionResult.PASS; ++ ++ net.minecraft.item.Item item = p_187251_3_ == null ? null : p_187251_3_.func_77973_b(); ++ EnumActionResult ret = item == null ? EnumActionResult.PASS : item.onItemUseFirst(p_187251_3_, p_187251_1_, p_187251_2_, p_187251_5_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_, p_187251_4_); ++ if (ret != EnumActionResult.PASS) return ret; ++ ++ boolean bypass = true; ++ for (ItemStack s : new ItemStack[]{p_187251_1_.func_184614_ca(), p_187251_1_.func_184592_cb()}) //TODO: Expand to more hands? player.inv.getHands()? ++ bypass = bypass && (s == null || s.func_77973_b().doesSneakBypassUse(s, p_187251_2_, p_187251_5_, p_187251_1_)); ++ EnumActionResult result = EnumActionResult.PASS; ++ ++ if (!p_187251_1_.func_70093_af() || bypass || event.getUseBlock() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) + { + IBlockState iblockstate = p_187251_2_.func_180495_p(p_187251_5_); +- ++ if(event.getUseBlock() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + if (iblockstate.func_177230_c().func_180639_a(p_187251_2_, p_187251_5_, iblockstate, p_187251_1_, p_187251_4_, p_187251_3_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_)) + { +- return EnumActionResult.SUCCESS; ++ result = EnumActionResult.SUCCESS; + } + } + +@@ -429,14 +466,21 @@ + { + int j = p_187251_3_.func_77960_j(); + int i = p_187251_3_.field_77994_a; ++ if (result != EnumActionResult.SUCCESS && event.getUseItem() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY ++ || result == EnumActionResult.SUCCESS && event.getUseItem() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) { + EnumActionResult enumactionresult = p_187251_3_.func_179546_a(p_187251_1_, p_187251_2_, p_187251_5_, p_187251_4_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_); + p_187251_3_.func_77964_b(j); + p_187251_3_.field_77994_a = i; + return enumactionresult; ++ } else return result; ++ + } + else + { ++ if (result != EnumActionResult.SUCCESS && event.getUseItem() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY ++ || result == EnumActionResult.SUCCESS && event.getUseItem() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) + return p_187251_3_.func_179546_a(p_187251_1_, p_187251_2_, p_187251_5_, p_187251_4_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_); ++ else return result; + } + } + } +@@ -445,4 +489,13 @@ { this.field_73092_a = p_73080_1_; } diff --git a/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej b/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej deleted file mode 100644 index af5d4ff9b9..0000000000 --- a/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej +++ /dev/null @@ -1,33 +0,0 @@ -++++ REJECTED PATCH 11 - case BLOCK: - BlockPos blockpos = this.objectMouseOver.getBlockPos(); - -- if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air) -+ if (!this.theWorld.isAirBlock(blockpos)) - { - int i = itemstack != null ? itemstack.stackSize : 0; - -+ -+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.theWorld, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec).isCanceled(); -+ if (result) { //Forge: Kept separate to simplify patch - if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec)) - { - flag = false; - this.thePlayer.swingItem(); - } -+ } - - if (itemstack == null) - { -++++ END PATCH -++++ REJECTED PATCH 12 - { - ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); - -- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) -+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, theWorld, null, null, null).isCanceled(); -+ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) - { - this.entityRenderer.itemRenderer.resetEquippedProgress2(); - } -++++ END PATCH \ No newline at end of file diff --git a/rejects/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch.rej b/rejects/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch.rej deleted file mode 100644 index a9f9605b4b..0000000000 --- a/rejects/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch.rej +++ /dev/null @@ -1,71 +0,0 @@ -++++ REJECTED PATCH 11 - } - else - { -- if (!player.isSneaking() || player.getHeldItem() == null) -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(player, -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, worldIn, pos, side, new net.minecraft.util.Vec3(offsetX, offsetY, offsetZ)); -+ if (event.isCanceled()) - { -- IBlockState iblockstate = worldIn.getBlockState(pos); -- -- if (iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, offsetX, offsetY, offsetZ)) -- { -- return true; -- } -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); -+ return false; - } - -- if (stack == null) -+ if (stack != null && stack.getItem().onItemUseFirst(stack, player, worldIn, pos, side, offsetX, offsetY, offsetZ)) - { -- return false; -+ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); -+ return true; - } -- else if (this.isCreative()) -+ -+ IBlockState iblockstate = worldIn.getBlockState(pos); -+ boolean isAir = worldIn.isAirBlock(pos); -+ boolean useBlock = !player.isSneaking() || player.getHeldItem() == null; -+ if (!useBlock) useBlock = player.getHeldItem().getItem().doesSneakBypassUse(worldIn, pos, player); -+ boolean result = false; -+ -+ if (useBlock) - { -- int j = stack.getMetadata(); -- int i = stack.stackSize; -- boolean flag = stack.onItemUse(player, worldIn, pos, side, offsetX, offsetY, offsetZ); -- stack.setItemDamage(j); -- stack.stackSize = i; -- return flag; -+ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ result = iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, offsetX, offsetY, offsetZ); -+ } -+ else -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); -+ result = event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW; -+ } - } -- else -+ if (stack != null && !result && event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) - { -- return stack.onItemUse(player, worldIn, pos, side, offsetX, offsetY, offsetZ); -+ int meta = stack.getMetadata(); -+ int size = stack.stackSize; -+ result = stack.onItemUse(player, worldIn, pos, side, offsetX, offsetY, offsetZ); -+ if (isCreative()) -+ { -+ stack.setItemDamage(meta); -+ stack.stackSize = size; -+ } -+ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); - } -+ return result; - } - } - -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index a58281933e..b1f17fcca6 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -86,6 +86,7 @@ import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent; import net.minecraftforge.event.entity.player.AnvilRepairEvent; import net.minecraftforge.event.entity.player.AttackEntityEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerOpenContainerEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.NoteBlockEvent; @@ -934,4 +935,44 @@ public class ForgeHooks RayTraceResult git = rayTraceEyes(entity, length); return git == null ? null : git.hitVec; } + + public static boolean onInteractEntityAt(EntityPlayer player, Entity entity, RayTraceResult ray, ItemStack stack, EnumHand hand) + { + Vec3d vec3d = new Vec3d(ray.hitVec.xCoord - entity.posX, ray.hitVec.yCoord - entity.posY, ray.hitVec.zCoord - entity.posZ); + return onInteractEntityAt(player, entity, vec3d, stack, hand); + } + + public static boolean onInteractEntityAt(EntityPlayer player, Entity entity, Vec3d vec3d, ItemStack stack, EnumHand hand) + { + return MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.EntityInteractSpecific(player, hand, stack, entity, vec3d)); + } + + public static boolean onInteractEntity(EntityPlayer player, Entity entity, ItemStack item, EnumHand hand) + { + return MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.EntityInteract(player, hand, item, entity)); + } + + public static boolean onItemRightClick(EntityPlayer player, EnumHand hand, ItemStack stack) + { + return MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.RightClickItem(player, hand, stack)); + } + + public static PlayerInteractEvent.LeftClickBlock onLeftClickBlock(EntityPlayer player, BlockPos pos, EnumFacing face, Vec3d hitVec) + { + PlayerInteractEvent.LeftClickBlock evt = new PlayerInteractEvent.LeftClickBlock(player, pos, face, hitVec); + MinecraftForge.EVENT_BUS.post(evt); + return evt; + } + + public static PlayerInteractEvent.RightClickBlock onRightClickBlock(EntityPlayer player, EnumHand hand, ItemStack stack, BlockPos pos, EnumFacing face, Vec3d hitVec) + { + PlayerInteractEvent.RightClickBlock evt = new PlayerInteractEvent.RightClickBlock(player, hand, stack, pos, face, hitVec); + MinecraftForge.EVENT_BUS.post(evt); + return evt; + } + + public static void onEmptyClick(EntityPlayer player, EnumHand hand) + { + MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.RightClickEmpty(player, hand)); + } } diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index b356576e0e..9bbdfceb50 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -61,7 +61,6 @@ import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent; import net.minecraftforge.event.entity.player.ArrowLooseEvent; import net.minecraftforge.event.entity.player.ArrowNockEvent; import net.minecraftforge.event.entity.player.BonemealEvent; -import net.minecraftforge.event.entity.player.EntityInteractEvent; import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import net.minecraftforge.event.entity.player.FillBucketEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; @@ -69,8 +68,6 @@ import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; import net.minecraftforge.event.entity.player.PlayerDropsEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; import net.minecraftforge.event.entity.player.PlayerSetSpawnEvent; import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; @@ -128,19 +125,6 @@ public class ForgeEventFactory return (MinecraftForge.EVENT_BUS.post(event) ? -1 : event.getNewSpeed()); } - @Deprecated - public static PlayerInteractEvent onPlayerInteract(EntityPlayer player, Action action, World world, BlockPos pos, EnumFacing face) - { - return onPlayerInteract(player, action, world, pos, face, null); - } - - public static PlayerInteractEvent onPlayerInteract(EntityPlayer player, Action action, World world, BlockPos pos, EnumFacing face, Vec3d localPos) - { - PlayerInteractEvent event = new PlayerInteractEvent(player, action, pos, face, world, localPos); - MinecraftForge.EVENT_BUS.post(event); - return event; - } - public static void onPlayerDestroyItem(EntityPlayer player, ItemStack stack, EnumHand hand) { MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, stack, hand)); @@ -369,11 +353,6 @@ public class ForgeEventFactory } } - public static boolean canInteractWith(EntityPlayer player, Entity entity, ItemStack item, EnumHand hand) - { - return !MinecraftForge.EVENT_BUS.post(new EntityInteractEvent(player, entity, item, hand)); - } - public static boolean canMountEntity(Entity entityMounting, Entity entityBeingMounted, boolean isMounting) { boolean isCanceled = MinecraftForge.EVENT_BUS.post(new EntityMountEvent(entityMounting, entityBeingMounted, entityMounting.worldObj, isMounting)); diff --git a/src/main/java/net/minecraftforge/event/entity/player/EntityInteractEvent.java b/src/main/java/net/minecraftforge/event/entity/player/EntityInteractEvent.java deleted file mode 100644 index ce817b0034..0000000000 --- a/src/main/java/net/minecraftforge/event/entity/player/EntityInteractEvent.java +++ /dev/null @@ -1,41 +0,0 @@ -package net.minecraftforge.event.entity.player; - -import net.minecraftforge.fml.common.eventhandler.Cancelable; -import net.minecraftforge.fml.common.eventhandler.Event.HasResult; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumHand; - -/** - * EntityInteractEvent is fired when a player interacts with an Entity.
- * This event is fired whenever a player interacts with an Entity in - * EntityPlayer#interactWith(Entity).
- *
- * {@link #target} contains the Entity the player interacted with.
- *
- * This event is {@link Cancelable}.
- * If this event is canceled, the player does not interact with the Entity.
- *
- * This event does not have a result. {@link HasResult}
- *
- * This event is fired on the {@link MinecraftForge#EVENT_BUS}. - **/ -@Cancelable -public class EntityInteractEvent extends PlayerEvent -{ - private final Entity target; - private final ItemStack item; - private final EnumHand hand; - public EntityInteractEvent(EntityPlayer player, Entity target, ItemStack item, EnumHand hand) - { - super(player); - this.target = target; - this.item = item; - this.hand = hand; - } - - public Entity getTarget() { return this.target; } - public ItemStack getItem() { return this.item; } - public EnumHand getHand() { return this.hand; } -} diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java index 1f48512897..90325e3eea 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java @@ -1,88 +1,336 @@ package net.minecraftforge.event.entity.player; +import com.google.common.base.Preconditions; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +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.math.Vec3d; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.relauncher.Side; + +import javax.annotation.Nullable; + import static net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT; import static net.minecraftforge.fml.common.eventhandler.Event.Result.DENY; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -import net.minecraftforge.fml.common.eventhandler.Cancelable; /** * PlayerInteractEvent is fired when a player interacts in some way. - *
- * This event is fired whenever a player interacts in - * Minecraft#func_147121_ag(), - * NetHandlerPlayServer#processPlayerBlockPlacement(C08PacketPlayerBlockPlacement), - * ItemInWorldManager#activateBlockOrUseItem(EntityPlayer, World, ItemStack, int, int, int, int, float, float, float), - * ItemInWorldManager#onBlockClicked(int, int, int, int).
- *
- * This event is fired via the {@link ForgeEventFactory#onPlayerInteract(EntityPlayer, Action, BlockPos, EnumFacing)}. - *
- * {@link #action} contains the Action the player performed during this interaction.
- * {@link #pos} contains the coordinate of where this event occurred.
- * {@link #face} contains the face of the block that was interacted with. May be null if unknown.
- * {@link #world} contains the world in which this event is occurring.
- *
- * This event is {@link Cancelable}.
- * If this event is canceled, the player does not interact.
- *
- * This event does not have a result. {@link HasResult}
- *
- * This event is fired on the {@link MinecraftForge#EVENT_BUS}. + * All subclasses are fired on {@link MinecraftForge#EVENT_BUS}. + * See the individual documentation on each subevent for more details. **/ -@Cancelable public class PlayerInteractEvent extends PlayerEvent { - public static enum Action - { - RIGHT_CLICK_AIR, - RIGHT_CLICK_BLOCK, - LEFT_CLICK_BLOCK - } - - private final Action action; - private final World world; + private final EnumHand hand; + private final ItemStack stack; private final BlockPos pos; - private final EnumFacing face; // Can be null if unknown - private final Vec3d localPos; // Can be null if unknown + private final EnumFacing face; - private Result useBlock = DEFAULT; - private Result useItem = DEFAULT; - - @Deprecated - public PlayerInteractEvent(EntityPlayer player, Action action, BlockPos pos, EnumFacing face, World world) + private PlayerInteractEvent(EntityPlayer player, EnumHand hand, ItemStack stack, BlockPos pos, EnumFacing face) { - this(player, action, pos, face, world, null); - } - - public PlayerInteractEvent(EntityPlayer player, Action action, BlockPos pos, EnumFacing face, World world, Vec3d localPos) - { - super(player); - this.action = action; - this.pos = pos; + super(Preconditions.checkNotNull(player, "Null player in PlayerInteractEvent!")); + this.hand = Preconditions.checkNotNull(hand, "Null hand in PlayerInteractEvent!"); + this.stack = stack; + this.pos = Preconditions.checkNotNull(pos, "Null position in PlayerInteractEvent!"); this.face = face; - if (face == null) setUseBlock(DENY); - this.world = world; - this.localPos = localPos; } - @Override - public void setCanceled(boolean cancel) + /** + * This event is fired on both sides whenever a player right clicks an entity. + * + * "Interact at" is an interact where the local vector (which part of the entity you clicked) is known. + * The state of this event affects whether {@link Entity#applyPlayerInteraction} is called. + * If {@link Entity#applyPlayerInteraction} returns {@link net.minecraft.util.EnumActionResult#SUCCESS}, then processing ends. + * Otherwise processing will continue to {@link EntityInteract} + * + * Canceling the event clientside will cause processing to continue to {@link EntityInteract}, + * while canceling serverside will simply do no further processing. + */ + @Cancelable + public static class EntityInteractSpecific extends PlayerInteractEvent { - super.setCanceled(cancel); - setUseBlock((cancel ? DENY : getUseBlock() == DENY ? DEFAULT : getUseBlock())); - setUseItem((cancel ? DENY : getUseItem() == DENY ? DEFAULT : getUseItem())); + private final Vec3d localPos; + private final Entity target; + + public EntityInteractSpecific(EntityPlayer player, EnumHand hand, ItemStack stack, Entity target, Vec3d localPos) + { + super(player, hand, stack, new BlockPos(target), null); + this.localPos = localPos; + this.target = target; + } + + /** + * Returns the local interaction position. This is a 3D vector, where (0, 0, 0) is centered exactly at the + * center of the entity's bounding box at their feet. This means the X and Z values will be in the range + * [-width / 2, width / 2] while Y values will be in the range [0, height] + * @return The local position + */ + public Vec3d getLocalPos() + { + return localPos; + } + + public Entity getTarget() + { + return target; + } + } + + /** + * This event is fired on both sides when the player right clicks an entity. + * It is responsible for all general entity interactions. + * + * This event is fired completely independently of the above {@link EntityInteractSpecific}, except for the case + * where the above call to {@link Entity#applyPlayerInteraction} returns {@link net.minecraft.util.EnumActionResult#SUCCESS}. + * In that case, general entity interactions, and hence this event, will not be called. See the above javadoc for more details. + * + * This event's state affects whether {@link Entity#processInitialInteract} and {@link net.minecraft.item.Item#itemInteractionForEntity} are called. + * + * Canceling the event clientside will cause processing to continue to {@link RightClickItem}, + * while canceling serverside will simply do no further processing. + */ + @Cancelable + public static class EntityInteract extends PlayerInteractEvent + { + private final Entity target; + + public EntityInteract(EntityPlayer player, EnumHand hand, ItemStack stack, Entity target) + { + super(player, hand, stack, new BlockPos(target), null); + this.target = target; + } + + public Entity getTarget() + { + return target; + } + } + + /** + * This event is fired on both sides whenever the player right clicks while targeting a block. + * This event controls which of {@link net.minecraft.block.Block#onBlockActivated} and/or {@link net.minecraft.item.Item#onItemUse} + * will be called after {@link net.minecraft.item.Item#onItemUseFirst} is called. + * Canceling the event will cause none of the above three to be called. + * There are various results to this event, see the getters below. + * Note that handling things differently on the client vs server may cause desynchronizations! + */ + @Cancelable + public static class RightClickBlock extends PlayerInteractEvent + { + private Result useBlock = DEFAULT; + private Result useItem = DEFAULT; + private final Vec3d hitVec; + + public RightClickBlock(EntityPlayer player, EnumHand hand, ItemStack stack, + BlockPos pos, EnumFacing face, Vec3d hitVec) { + super(player, hand, stack, pos, face); + this.hitVec = hitVec; + } + + /** + * @return The hit vector of this click + */ + public Vec3d getHitVec() + { + return hitVec; + } + + /** + * @return If {@link net.minecraft.block.Block#onBlockActivated} should be called + */ + public Result getUseBlock() + { + return useBlock; + } + + /** + * @return If {@link net.minecraft.item.Item#onItemUse} should be called + */ + public Result getUseItem() + { + return useItem; + } + + /** + * DENY: Block will never be used. + * DEFAULT: Default behaviour (sneak will not use block, unless all items return true in {@link net.minecraft.item.Item#doesSneakBypassUse}). + * ALLOW: Block will always be used, regardless of sneaking and doesSneakBypassUse. + */ + public void setUseBlock(Result triggerBlock) + { + this.useBlock = triggerBlock; + } + + /** + * DENY: The item will never be used. + * DEFAULT: The item will be used if the block fails. + * ALLOW: The item will always be used. + */ + public void setUseItem(Result triggerItem) + { + this.useItem = triggerItem; + } + + @Override + public void setCanceled(boolean canceled) + { + super.setCanceled(canceled); + useBlock = DENY; + useItem = DENY; + } + } + + /** + * This event is fired on both sides before the player triggers {@link net.minecraft.item.Item#onItemRightClick}. + * Note that this is NOT fired if the player is targeting a block. For that case, see {@link RightClickBlock}. + * Canceling the event clientside causes processing to continue to the other hands, + * while canceling serverside will simply do no further processing. + */ + @Cancelable + public static class RightClickItem extends PlayerInteractEvent + { + public RightClickItem(EntityPlayer player, EnumHand hand, ItemStack stack) + { + super(player, hand, stack, new BlockPos(player), null); + } + } + + /** + * This event is fired on the client side when the player right clicks empty space with an empty hand. + * The server is not aware of when the client right clicks empty space with an empty hand, you will need to tell the server yourself. + * This event cannot be canceled. + */ + public static class RightClickEmpty extends PlayerInteractEvent + { + public RightClickEmpty(EntityPlayer player, EnumHand hand) + { + super(player, hand, null, new BlockPos(player), null); + } + } + + /** + * This event is fired when a player left clicks while targeting a block. + * This event controls which of {@link net.minecraft.block.Block#onBlockClicked} and/or the item harvesting methods will be called + * Canceling the event will cause none of the above noted methods to be called. + * There are various results to this event, see the getters below. + * Note that if the event is canceled and the player holds down left mouse, the event will continue to fire. + * This is due to how vanilla calls the left click handler methods. + */ + @Cancelable + public static class LeftClickBlock extends PlayerInteractEvent + { + private Result useBlock = DEFAULT; + private Result useItem = DEFAULT; + private final Vec3d hitVec; + + public LeftClickBlock(EntityPlayer player, BlockPos pos, EnumFacing face, Vec3d hitVec) + { + super(player, EnumHand.MAIN_HAND, player.getHeldItem(EnumHand.MAIN_HAND), pos, face); + this.hitVec = hitVec; + } + + /** + * @return The local hit vector of this click + */ + public Vec3d getHitVec() + { + return hitVec; + } + + /** + * @return If {@link net.minecraft.block.Block#onBlockClicked} should be called + */ + public Result getUseBlock() + { + return useBlock; + } + + /** + * @return If the block should be attempted to be mined with the current item + */ + public Result getUseItem() + { + return useItem; + } + + public void setUseBlock(Result triggerBlock) + { + this.useBlock = triggerBlock; + } + + public void setUseItem(Result triggerItem) + { + this.useItem = triggerItem; + } + + @Override + public void setCanceled(boolean canceled) + { + super.setCanceled(canceled); + useBlock = DENY; + useItem = DENY; + } + } + + /** + * @return The hand involved in this interaction. Will never be null. + */ + public EnumHand getHand() + { + return hand; + } + + /** + * @return The itemstack involved in this interaction, or null if the hand was empty. + */ + @Nullable + public ItemStack getItemStack() + { + return stack; + } + + /** + * If the interaction was on an entity, will be a BlockPos centered on the entity. + * If the interaction was on a block, will be the position of that block. + * Otherwise, will be a BlockPos centered on the player. + * Will never be null. + * @return The position involved in this interaction. + */ + public BlockPos getPos() + { + return pos; + } + + /** + * @return The face involved in this interaction. For all non-block interactions, this will return null. + */ + @Nullable + public EnumFacing getFace() + { + return face; + } + + /** + * @return Convenience method to get the world of this interaction. + */ + public World getWorld() + { + return getEntityPlayer().getEntityWorld(); + } + + /** + * @return The effective, i.e. logical, side of this interaction. This will be {@link Side#CLIENT} on the client thread, and {@link Side#SERVER} on the server thread. + */ + public Side getSide() + { + return getWorld().isRemote ? Side.CLIENT : Side.SERVER; } - public Action getAction() { return action; } - public World getWorld() { return world; } - public BlockPos getPos() { return pos; } - public EnumFacing getFace() { return face; } - public Vec3d getLocalPos() { return localPos; } - public Result getUseBlock() { return useBlock; } - public void setUseBlock(Result useBlock) { this.useBlock = useBlock; } - public Result getUseItem() { return useItem; } - public void setUseItem(Result useItem) { this.useItem = useItem; } } diff --git a/src/test/java/net/minecraftforge/test/PlayerInteractEventLocalTest.java b/src/test/java/net/minecraftforge/test/PlayerInteractEventLocalTest.java deleted file mode 100644 index 16da5af0b1..0000000000 --- a/src/test/java/net/minecraftforge/test/PlayerInteractEventLocalTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.minecraftforge.test; - -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -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.eventhandler.SubscribeEvent; - -@Mod(modid="PlayerInteractEventLocalTest", name="PlayerInteractEventLocalTest", version="0.0.0") -public class PlayerInteractEventLocalTest -{ - - public static final boolean ENABLE = false; - - @EventHandler - public void init(FMLInitializationEvent event) - { - MinecraftForge.EVENT_BUS.register(this); - } - - @SubscribeEvent - public void onPlayerInteract(PlayerInteractEvent event) - { - if(ENABLE && event.getLocalPos() != null) { - System.out.println(event.getLocalPos().toString()); - } - } -} diff --git a/src/test/java/net/minecraftforge/test/PlayerInteractEventTest.java b/src/test/java/net/minecraftforge/test/PlayerInteractEventTest.java new file mode 100644 index 0000000000..97739dd877 --- /dev/null +++ b/src/test/java/net/minecraftforge/test/PlayerInteractEventTest.java @@ -0,0 +1,154 @@ +package net.minecraftforge.test; + +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.init.Items; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.tileentity.TileEntityDropper; +import net.minecraft.util.EnumHand; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +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.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.apache.logging.log4j.Logger; + +@Mod(modid="PlayerInteractEventTest", name="PlayerInteractEventTest", version="0.0.0") +public class PlayerInteractEventTest +{ + // NOTE: Test with both this ON and OFF - ensure none of the test behaviours show when this is off! + private static final boolean ENABLE = false; + private Logger logger; + + @EventHandler + public void preinit(FMLPreInitializationEvent event) + { + logger = event.getModLog(); + MinecraftForge.EVENT_BUS.register(this); + } + + @SubscribeEvent(receiveCanceled = true) // this triggers after the subclasses below, and we'd like to log them all + public void global(PlayerInteractEvent evt) + { + if (!ENABLE) return; + logger.info("{} | {}", evt.getClass().getSimpleName(), evt.getSide().name()); + logger.info("{} | stack: {}", evt.getHand(), evt.getItemStack()); + logger.info("{} | face: {}", evt.getPos(), evt.getFace()); + } + + @SubscribeEvent + public void leftClickBlock(PlayerInteractEvent.LeftClickBlock evt) + { + if (!ENABLE) return; + logger.info("HIT VEC: {}", evt.getHitVec()); + + if (evt.getItemStack() != null) + { + if (evt.getItemStack().getItem() == Items.golden_pickaxe) + evt.setCanceled(true); // Redstone should not activate and pick should not be able to dig anything + if (evt.getItemStack().getItem() == Items.diamond_pickaxe) + evt.setUseBlock(Event.Result.DENY); // Redstone should not activate, pick should still dig + if (evt.getItemStack().getItem() == Items.iron_pickaxe) + evt.setUseItem(Event.Result.DENY); // Pick should not dig, Redstone should still activate + } + + // When item use denied, the event will keep firing as long as the left click button is held. + // This is due to how vanilla calls the left click handling methods to let people not lift their button when mining multiple blocks. + // Note that when item use is denied, the cool down for the item does not occur. This is good! + } + + @SubscribeEvent + public void rightClickBlock(PlayerInteractEvent.RightClickBlock evt) + { + if (!ENABLE) return; + logger.info("HIT VEC: {}", evt.getHitVec()); + + // Shift right clicking dropper with an item in hand should still open the dropper contrary to normal mechanics + // The item in hand is used as well (not specifying anything would not use the item) + TileEntity te = evt.getWorld().getTileEntity(evt.getPos()); + if (te instanceof TileEntityDropper) + { + evt.setUseBlock(Event.Result.ALLOW); + evt.setUseItem(Event.Result.ALLOW); + } + + // Same as above, except the item should no longer be used + if (te instanceof TileEntityChest) + { + evt.setUseBlock(Event.Result.ALLOW); + evt.setUseItem(Event.Result.DENY); // could be left out as well + } + + // Case: Flint and steel in main hand on top of a TE will light a fire, not open the TE. + // Note that if you do this on a chest, the f+s will fail, but then your off hand will open the chest + // If you dual wield flints and steels and right click a chest nothing should happen + if (evt.getItemStack() != null && evt.getItemStack().getItem() == Items.flint_and_steel) + evt.setUseBlock(Event.Result.DENY); + + // Case: Painting in main hand + // Opening a TE will also place a painting on the TE if possible + if (evt.getHand() == EnumHand.MAIN_HAND && evt.getItemStack() != null && evt.getItemStack().getItem() == Items.painting) { + evt.setUseItem(Event.Result.ALLOW); + } + + // Spawn egg in main hand, block in offhand -> block should be placed + // Sword in main hand, spawn egg in offhand -> nothing should happen + if (evt.getItemStack() != null && evt.getItemStack().getItem() == Items.spawn_egg) { + evt.setCanceled(true); + } + + + } + + @SubscribeEvent + public void rightClickItem(PlayerInteractEvent.RightClickItem evt) + { + if (!ENABLE) return; + + // Use survival mode + // Case: Ender pearl in main hand, bow in offhand with arrows in inv -> Bow should trigger + // Case: Sword in main hand, ender pearl in offhand -> Nothing should happen + + if (evt.getItemStack() != null && evt.getItemStack().getItem() == Items.ender_pearl) + evt.setCanceled(true); + } + + @SubscribeEvent + public void interactSpecific(PlayerInteractEvent.EntityInteractSpecific evt) + { + if (!ENABLE) return; + logger.info("LOCAL POS: {}", evt.getLocalPos()); + + if (evt.getItemStack() != null + && evt.getTarget() instanceof EntityArmorStand + && evt.getItemStack().getItem() == Items.iron_helmet) + evt.setCanceled(true); // Should not be able to place iron helmet onto armor stand (you will put it on instead) + + if (evt.getWorld().isRemote + && evt.getTarget() instanceof EntitySkeleton + && evt.getLocalPos().yCoord > evt.getTarget().height / 2.0) + { + // If we right click the upper half of a skeleton it becomes wither skeleton. Otherwise nothing happens. + ((EntitySkeleton) evt.getTarget()).setSkeletonType(1); + evt.setCanceled(true); + } + } + + @SubscribeEvent + public void interactNormal(PlayerInteractEvent.EntityInteract evt) + { + if (!ENABLE) return; + + if (evt.getItemStack() != null && (evt.getTarget() instanceof EntityHorse || evt.getTarget() instanceof EntityCreeper)) + // Should not be able to feed wild horses with golden apple (you will start eating it in survival) + // Should not be able to ignite creeper with F+S + // Applies to both hands + evt.setCanceled(true); + } +} diff --git a/src/test/java/net/minecraftforge/test/TestCapabilityMod.java b/src/test/java/net/minecraftforge/test/TestCapabilityMod.java index d6babd4b35..44a6d22245 100644 --- a/src/test/java/net/minecraftforge/test/TestCapabilityMod.java +++ b/src/test/java/net/minecraftforge/test/TestCapabilityMod.java @@ -42,11 +42,10 @@ public class TestCapabilityMod } @SubscribeEvent - public void onInteract(PlayerInteractEvent event) + public void onInteract(PlayerInteractEvent.LeftClickBlock event) { - if (event.getAction() != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) return; - if (event.getEntityPlayer().inventory.getCurrentItem() == null) return; - if (event.getEntityPlayer().inventory.getCurrentItem().getItem() != Items.stick) return; + if (event.getItemStack() == null) return; + if (event.getItemStack().getItem() != Items.stick) return; // This is just a example of how to interact with the TE, note the strong type binding that getCapability has TileEntity te = event.getWorld().getTileEntity(event.getPos()); From 68023ce40bd4c6bb9befc0862c99c2ea95122dec Mon Sep 17 00:00:00 2001 From: Zaggy1024 Date: Mon, 4 Apr 2016 22:18:34 -0500 Subject: [PATCH 201/243] Fixed using PlaySoundEvent to replace a sound with a PositionedSound causing an NPE due to the Sound field not being set by a call to ISound.createAccessor(SoundHandler). --- .../client/audio/SoundManager.java.patch | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch index c5d7b20efa..462f42c8c2 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -16,16 +16,16 @@ } private synchronized void func_148608_i() -@@ -350,6 +352,9 @@ - } - else - { -+ p_148611_1_ = net.minecraftforge.client.ForgeHooksClient.playSound(this, p_148611_1_); -+ if (p_148611_1_ == null) return; +@@ -338,6 +340,9 @@ + { + if (this.field_148617_f) + { ++ p_148611_1_ = net.minecraftforge.client.ForgeHooksClient.playSound(this, p_148611_1_); ++ if (p_148611_1_ == null) return; + - if (!this.field_188777_o.isEmpty()) - { - for (ISoundEventListener isoundeventlistener : this.field_188777_o) + SoundEventAccessor soundeventaccessor = p_148611_1_.func_184366_a(this.field_148622_c); + ResourceLocation resourcelocation = p_148611_1_.func_147650_b(); + @@ -400,10 +405,12 @@ if (sound.func_188723_h()) { From d44c9082fa54323a062cfdb2a72b9fed9ba28e1b Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 5 Apr 2016 10:41:42 +0300 Subject: [PATCH 202/243] Fixed mod languages not being loaded on the server. --- .../fml/server/FMLServerHandler.java | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java b/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java index b80bf1e342..0a798eb546 100644 --- a/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java +++ b/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java @@ -12,18 +12,21 @@ */ package net.minecraftforge.fml.server; -import java.io.File; +import java.io.*; import java.util.Iterator; import java.util.List; import java.util.Set; +import java.util.zip.ZipFile; import net.minecraft.command.ServerCommand; +import net.minecraft.launchwrapper.Launch; import net.minecraft.network.INetHandler; import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.NetworkManager; import net.minecraft.server.MinecraftServer; import net.minecraft.server.dedicated.DedicatedServer; import net.minecraft.util.IThreadListener; +import net.minecraft.util.text.translation.LanguageMap; import net.minecraft.world.storage.SaveFormatOld; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLLog; @@ -37,6 +40,7 @@ import net.minecraftforge.fml.common.network.FMLNetworkEvent; import net.minecraftforge.fml.relauncher.Side; import com.google.common.collect.ImmutableList; +import org.apache.commons.io.IOUtils; /** * Handles primary communication from hooked code into the system @@ -218,7 +222,42 @@ public class FMLServerHandler implements IFMLSidedHandler @Override public void addModAsResource(ModContainer container) { - // NOOP + String langFile = "assets/" + container.getModId().toLowerCase() + "/lang/en_US.lang"; + File source = container.getSource(); + InputStream stream = null; + ZipFile zip = null; + try + { + if (source.isDirectory() && (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment")) + { + stream = new FileInputStream(new File(source.toURI().resolve(langFile).getPath())); + } + else + { + try + { + zip = new ZipFile(source); + stream = zip.getInputStream(zip.getEntry(langFile)); + } + finally + { + if(zip != null) zip.close(); + } + } + LanguageMap.inject(stream); + } + catch (IOException e) + { + // hush + } + catch(Exception e) + { + FMLLog.getLogger().error(e); + } + finally + { + IOUtils.closeQuietly(stream); + } } @Override From ab2b07f1498196a411d4b8a3be6a921dba00e092 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 5 Apr 2016 11:46:05 +0300 Subject: [PATCH 203/243] Fixed some test mods not being marked as client-only. --- src/test/java/net/minecraftforge/test/ClientCommandTest.java | 2 +- src/test/java/net/minecraftforge/test/FOVModifierTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/net/minecraftforge/test/ClientCommandTest.java b/src/test/java/net/minecraftforge/test/ClientCommandTest.java index e302f47488..86a9d8ab20 100644 --- a/src/test/java/net/minecraftforge/test/ClientCommandTest.java +++ b/src/test/java/net/minecraftforge/test/ClientCommandTest.java @@ -15,7 +15,7 @@ import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.registry.GameData; -@Mod(modid="clientcommandtest", name="Client Command Test", version="0.0.0") +@Mod(modid="clientcommandtest", name="Client Command Test", version="0.0.0", clientSideOnly = true) public class ClientCommandTest { @EventHandler public void init(FMLInitializationEvent event) diff --git a/src/test/java/net/minecraftforge/test/FOVModifierTest.java b/src/test/java/net/minecraftforge/test/FOVModifierTest.java index 2bd053877f..efcb082f0c 100644 --- a/src/test/java/net/minecraftforge/test/FOVModifierTest.java +++ b/src/test/java/net/minecraftforge/test/FOVModifierTest.java @@ -9,7 +9,7 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; /** Simple mod to test fov modifier. */ -@Mod(modid="fovmodifiertest", name="FOV Modifier Test", version="0.0.0") +@Mod(modid="fovmodifiertest", name="FOV Modifier Test", version="0.0.0", clientSideOnly = true) public class FOVModifierTest { @EventHandler From 63a6a2e50b80dcf8fdb992c3d982c394bd0d30f7 Mon Sep 17 00:00:00 2001 From: iTitus Date: Tue, 5 Apr 2016 10:49:51 +0200 Subject: [PATCH 204/243] Fix dynbucket item transformation. --- .../resources/assets/forge/models/item/bucket.json | 14 +------------- .../assets/forge/models/item/bucket_milk.json | 14 +------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/src/main/resources/assets/forge/models/item/bucket.json b/src/main/resources/assets/forge/models/item/bucket.json index 7a32f750ab..4a8c26d791 100644 --- a/src/main/resources/assets/forge/models/item/bucket.json +++ b/src/main/resources/assets/forge/models/item/bucket.json @@ -1,18 +1,6 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "forge:items/bucket_base" - }, - "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/forge/models/item/bucket_milk.json b/src/main/resources/assets/forge/models/item/bucket_milk.json index 2d1fe26eb9..b62a1226e4 100644 --- a/src/main/resources/assets/forge/models/item/bucket_milk.json +++ b/src/main/resources/assets/forge/models/item/bucket_milk.json @@ -1,20 +1,8 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "forge:items/bucket_base", "layer1": "forge:items/bucket_fluid", # doubles as milk "layer2": "forge:items/bucket_cover" - }, - "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 ] - } } } From bf16d0066bf4a3c6ce4a4b9e37ba9e337c73c5ed Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 5 Apr 2016 18:53:19 +0300 Subject: [PATCH 205/243] Fixed zip being closed too early in the server language loading. --- .../fml/server/FMLServerHandler.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java b/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java index 0a798eb546..56df1ff8a4 100644 --- a/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java +++ b/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java @@ -13,9 +13,11 @@ package net.minecraftforge.fml.server; import java.io.*; +import java.util.Enumeration; import java.util.Iterator; import java.util.List; import java.util.Set; +import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import net.minecraft.command.ServerCommand; @@ -234,15 +236,10 @@ public class FMLServerHandler implements IFMLSidedHandler } else { - try - { - zip = new ZipFile(source); - stream = zip.getInputStream(zip.getEntry(langFile)); - } - finally - { - if(zip != null) zip.close(); - } + zip = new ZipFile(source); + ZipEntry entry = zip.getEntry(langFile); + if(entry == null) throw new FileNotFoundException(); + stream = zip.getInputStream(entry); } LanguageMap.inject(stream); } @@ -257,6 +254,14 @@ public class FMLServerHandler implements IFMLSidedHandler finally { IOUtils.closeQuietly(stream); + try + { + zip.close(); + } + catch (IOException e) + { + // shush + } } } From cb7685a3b0448f389d9ad2069c2cbe2f14eaa069 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 5 Apr 2016 18:55:42 +0300 Subject: [PATCH 206/243] Fixed forge fluid having a collision box. --- .../java/net/minecraftforge/fluids/BlockFluidBase.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java b/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java index 5c8c3a0651..fcde08de64 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java @@ -12,6 +12,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.item.Item; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.BlockRenderLayer; @@ -640,4 +641,10 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock if (remaining > 1) remaining = 1.0f; return remaining * (density > 0 ? 1 : -1); } + + @Override + public AxisAlignedBB getSelectedBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) + { + return null; + } } From 8d50c9e9884b814bf9600921cb2a9172801b440a Mon Sep 17 00:00:00 2001 From: Katrina Swales Date: Wed, 6 Apr 2016 01:43:23 +0100 Subject: [PATCH 207/243] Corrected CapabilityItemHandler.readNBT ignoring anything in slot 0 in 1.9 --- .../java/net/minecraftforge/items/CapabilityItemHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/items/CapabilityItemHandler.java b/src/main/java/net/minecraftforge/items/CapabilityItemHandler.java index 217759aaef..66772a7ee1 100644 --- a/src/main/java/net/minecraftforge/items/CapabilityItemHandler.java +++ b/src/main/java/net/minecraftforge/items/CapabilityItemHandler.java @@ -51,7 +51,7 @@ public class CapabilityItemHandler NBTTagCompound itemTags = tagList.getCompoundTagAt(i); int j = itemTags.getInteger("Slot"); - if (j > 0 && j < instance.getSlots()) + if (j >= 0 && j < instance.getSlots()) { itemHandlerModifiable.setStackInSlot(j, ItemStack.loadItemStackFromNBT(itemTags)); } From 7587ca7c71b03a08dd6f95dbf10270e85aef4c0d Mon Sep 17 00:00:00 2001 From: mezz Date: Tue, 5 Apr 2016 18:25:25 -0700 Subject: [PATCH 208/243] Fix #2717 Pick block hotkey not working in inventories --- .../client/gui/inventory/GuiContainer.java.patch | 15 ++++++++++++--- .../client/settings/GameSettings.java.patch | 3 +-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch index 145e92ea6b..f557789781 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch @@ -35,7 +35,7 @@ { super.func_73864_a(p_73864_1_, p_73864_2_, p_73864_3_); - boolean flag = p_73864_3_ == this.field_146297_k.field_71474_y.field_74322_I.func_151463_i() + 100; -+ boolean flag = this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(p_73864_3_ + 100); ++ boolean flag = this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(p_73864_3_ - 100); Slot slot = this.func_146975_c(p_73864_1_, p_73864_2_); long i = Minecraft.func_71386_F(); this.field_146993_M = this.field_146998_K == slot && i - this.field_146997_J < 250L && this.field_146992_L == p_73864_3_; @@ -52,7 +52,7 @@ if (this.field_146297_k.field_71439_g.field_71071_by.func_70445_o() == null) { - if (p_73864_3_ == this.field_146297_k.field_71474_y.field_74322_I.func_151463_i() + 100) -+ if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(p_73864_3_ + 100)) ++ if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(p_73864_3_ - 100)) { this.func_184098_a(slot, l, p_73864_3_, ClickType.CLONE); } @@ -61,7 +61,7 @@ this.field_146987_F = 1; } - else if (p_73864_3_ == this.field_146297_k.field_71474_y.field_74322_I.func_151463_i() + 100) -+ else if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(p_73864_3_ + 100)) ++ else if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(p_73864_3_ - 100)) { this.field_146987_F = 2; } @@ -78,6 +78,15 @@ int k = -1; if (slot != null) +@@ -575,7 +580,7 @@ + } + else if (this.field_146297_k.field_71439_g.field_71071_by.func_70445_o() != null) + { +- if (p_146286_3_ == this.field_146297_k.field_71474_y.field_74322_I.func_151463_i() + 100) ++ if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(p_146286_3_ - 100)) + { + this.func_184098_a(slot, k, p_146286_3_, ClickType.CLONE); + } @@ -627,7 +632,7 @@ protected void func_73869_a(char p_73869_1_, int p_73869_2_) throws IOException diff --git a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch index 3ed2135db6..a5386e6b13 100644 --- a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch +++ b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch @@ -42,7 +42,7 @@ } for (SoundCategory soundcategory : SoundCategory.values()) -@@ -1184,4 +1189,25 @@ +@@ -1184,4 +1189,24 @@ return p_148264_1_; } } @@ -58,7 +58,6 @@ + field_74311_E.setKeyConflictContext(inGame); + field_151444_V.setKeyConflictContext(inGame); + field_74312_F.setKeyConflictContext(inGame); -+ field_74322_I.setKeyConflictContext(inGame); + field_74310_D.setKeyConflictContext(inGame); + field_74321_H.setKeyConflictContext(inGame); + field_74323_J.setKeyConflictContext(inGame); From e68908e9d55227879763fb55c2a86df01f61d9fb Mon Sep 17 00:00:00 2001 From: mezz Date: Tue, 5 Apr 2016 23:01:06 -0700 Subject: [PATCH 209/243] Fix some plain keybinds not working when a modifier is active --- .../minecraftforge/client/settings/KeyBindingMap.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java b/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java index b50af087a2..bdf84bea2c 100644 --- a/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java +++ b/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java @@ -22,11 +22,15 @@ public class KeyBindingMap public KeyBinding lookupActive(int keyCode) { KeyModifier activeModifier = KeyModifier.getActiveModifier(); - if (activeModifier.matches(keyCode)) + if (!activeModifier.matches(keyCode)) { - activeModifier = KeyModifier.NONE; + KeyBinding binding = getBinding(keyCode, activeModifier); + if (binding != null) + { + return binding; + } } - return getBinding(keyCode, activeModifier); + return getBinding(keyCode, KeyModifier.NONE); } private KeyBinding getBinding(int keyCode, KeyModifier keyModifier) From fb0bdd1276ad286cc5ec5c0ae2f01c931fea3076 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 6 Apr 2016 01:44:08 -0700 Subject: [PATCH 210/243] Enhance some error logging related to OBJLoader issues, and RegistryEntries. --- .../net/minecraftforge/client/model/obj/OBJLoader.java | 8 +++++++- .../fml/common/registry/IForgeRegistryEntry.java | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java b/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java index b398fbaeea..aa1c8792d7 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java @@ -27,6 +27,7 @@ public enum OBJLoader implements ICustomModelLoader { private IResourceManager manager; private final Set enabledDomains = new HashSet(); private final Map cache = new HashMap(); + private final Map errors = new HashMap(); public void addDomain(String domain) { @@ -38,6 +39,7 @@ public enum OBJLoader implements ICustomModelLoader { { this.manager = resourceManager; cache.clear(); + errors.clear(); } public boolean accepts(ResourceLocation modelLocation) @@ -69,13 +71,17 @@ public enum OBJLoader implements ICustomModelLoader { { model = parser.parse(); } + catch (Exception e) + { + errors.put(modelLocation, e); + } finally { cache.put(modelLocation, model); } } OBJModel model = cache.get(file); - if (model == null) throw new ModelLoaderRegistry.LoaderException("Error loading model previously: " + file); + if (model == null) throw new ModelLoaderRegistry.LoaderException("Error loading model previously: " + file, errors.get(modelLocation)); return model; } } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistryEntry.java b/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistryEntry.java index fd3e332350..b0f3a445ac 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistryEntry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/IForgeRegistryEntry.java @@ -60,7 +60,7 @@ public interface IForgeRegistryEntry String prefix = mc == null || (mc instanceof InjectedModContainer && ((InjectedModContainer)mc).wrappedContainer instanceof FMLContainer) ? "minecraft" : mc.getModId().toLowerCase(); if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) { - FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name); + FMLLog.bigWarning("Dangerous alternative prefix `%s` for name `%s`, expected `%s` invalid registry invocation/invalid name?", oldPrefix, name, prefix); prefix = oldPrefix; } this.registryName = new ResourceLocation(prefix, name); From 07a2b67b7ffcee77a2043eb4c2287c8f9fb944a5 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 6 Apr 2016 01:45:43 -0700 Subject: [PATCH 211/243] Cleanup OBJLoader parse function and fix issues related to JVM differences. Also fix support for sopme of the spec that was partially respected. --- .../client/model/obj/OBJModel.java | 275 ++++++++---------- 1 file changed, 114 insertions(+), 161 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index 4aba8091c3..88844c6454 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -45,6 +45,7 @@ import net.minecraftforge.common.property.IUnlistedProperty; import net.minecraftforge.fml.common.FMLLog; import org.apache.commons.lang3.tuple.Pair; +import org.apache.logging.log4j.core.helpers.Strings; import com.google.common.base.Charsets; import com.google.common.base.Function; @@ -201,212 +202,164 @@ public class OBJModel implements IRetexturableModel, IModelCustomData return this.groupList; } + private float[] parseFloats(String[] data) // Helper converting strings to floats + { + float[] ret = new float[data.length]; + for (int i = 0; i < data.length; i++) + ret[i] = Float.parseFloat(data[i]); + return ret; + } + + //Partial reading of the OBJ format. Documentation taken from http://paulbourke.net/dataformats/obj/ public OBJModel parse() throws IOException { String currentLine = ""; Material material = new Material(); material.setName(Material.DEFAULT_NAME); int usemtlCounter = 0; - -// float[] minUVBounds = new float[] {0.0f, 0.0f}; -// float[] maxUVBounds = new float[] {1.0f, 1.0f}; + int lineNum = 0; for (;;) { + lineNum++; currentLine = objReader.readLine(); if (currentLine == null) break; currentLine.trim(); if (currentLine.isEmpty() || currentLine.startsWith("#")) continue; - String[] fields = WHITE_SPACE.split(currentLine, 2); - String key = fields[0]; - String data = fields[1]; - String[] splitData = WHITE_SPACE.split(data); - - if (key.equalsIgnoreCase("mtllib")) - this.materialLibrary.parseMaterials(manager, data, objFrom); - else if (key.equalsIgnoreCase("usemtl")) + try { - material = this.materialLibrary.materials.get(data); - usemtlCounter++; - } - else if (key.equalsIgnoreCase("v")) - { - float[] floatSplitData = new float[splitData.length]; - for (int i = 0; i < splitData.length; i++) - floatSplitData[i] = Float.parseFloat(splitData[i]); - Vector4f pos = new Vector4f(floatSplitData[0], floatSplitData[1], floatSplitData[2], floatSplitData.length == 4 ? floatSplitData[3] : 1); - Vertex vertex = new Vertex(pos, material); - this.vertices.add(vertex); - } - else if (key.equalsIgnoreCase("vn")) - { - float[] floatSplitData = new float[splitData.length]; - for (int i = 0; i < splitData.length; i++) - floatSplitData[i] = Float.parseFloat(splitData[i]); - Normal normal = new Normal(floatSplitData); - this.normals.add(normal); - } - else if (key.equalsIgnoreCase("vt")) - { - float[] floatSplitData = new float[splitData.length]; - for (int i = 0; i < splitData.length; i++) - floatSplitData[i] = Float.parseFloat(splitData[i]); - TextureCoordinate texCoord = new TextureCoordinate(new Vector3f(floatSplitData[0], floatSplitData[1], floatSplitData.length == 3 ? floatSplitData[2] : 1)); - if (texCoord.u < 0.0f || texCoord.u > 1.0f || texCoord.v < 0.0f || texCoord.v > 1.0f) - throw new UVsOutOfBoundsException(this.objFrom); -// this.UVsOutOfBounds = (texCoord.u < 0.0f || texCoord.u > 1.0f || texCoord.v < 0.0f || texCoord.v > 1.0f); + String[] fields = WHITE_SPACE.split(currentLine, 2); + String key = fields[0]; + String data = fields[1]; + String[] splitData = WHITE_SPACE.split(data); -// if (texCoord.u < 0.0f || texCoord.u > 1.0f || texCoord.v < 0.0f || texCoord.v > 1.0f) -// { -// this.UVsOutOfBounds = true; -// texCoord.u -= Math.floor(texCoord.u); -// texCoord.v -= Math.floor(texCoord.v); -// } - -// minUVBounds[0] = floatSplitData[0] < minUVBounds[0] ? floatSplitData[0] : minUVBounds[0]; -// minUVBounds[1] = floatSplitData[1] < minUVBounds[1] ? floatSplitData[1] : minUVBounds[1]; -// maxUVBounds[0] = floatSplitData[0] > maxUVBounds[0] ? floatSplitData[0] : maxUVBounds[0]; -// maxUVBounds[1] = floatSplitData[1] > maxUVBounds[1] ? floatSplitData[1] : maxUVBounds[1]; -// FMLLog.info("u: [%f, %f] v: [%f, %f]", minUVBounds[]); - this.texCoords.add(texCoord); - } - else if (key.equalsIgnoreCase("f")) - { - String[][] splitSlash = new String[splitData.length][]; - if (splitData.length > 4) FMLLog.warning("OBJModel.Parser: found a face ('f') with more than 4 vertices, only the first 4 of these vertices will be rendered!"); - - int vert = 0; - int texCoord = 0; - int norm = 0; - - List v = Lists.newArrayListWithCapacity(splitData.length); -// List t = Lists.newArrayListWithCapacity(splitData.length); -// List n = Lists.newArrayListWithCapacity(splitData.length); - - for (int i = 0; i < splitData.length; i++) + if (key.equalsIgnoreCase("mtllib")) { - if (splitData[i].contains("//")) + this.materialLibrary.parseMaterials(manager, data, objFrom); + } + else if (key.equalsIgnoreCase("usemtl")) + { + material = this.materialLibrary.materials.get(data); + usemtlCounter++; + } + else if (key.equalsIgnoreCase("v")) // Vertices: x y z [w] - w Defaults to 1.0 + { + float[] coords = parseFloats(splitData); + Vector4f pos = new Vector4f(coords[0], coords[1], coords[2], coords.length == 4 ? coords[3] : 1.0F); + this.vertices.add(new Vertex(pos, material)); + } + else if (key.equalsIgnoreCase("vn")) // Vertex normals: x y z + { + this.normals.add(new Normal(parseFloats(splitData))); + } + else if (key.equalsIgnoreCase("vt")) // Vertex Textures: u [v] [w] - v/w Defaults to 0 + { + float[] coords = parseFloats(splitData); + TextureCoordinate texCoord = new TextureCoordinate(coords[0], + coords.length >= 2 ? coords[1] : 0.0F, + coords.length >= 3 ? coords[2] : 0.0F); + if (texCoord.u < 0.0f || texCoord.u > 1.0f || texCoord.v < 0.0f || texCoord.v > 1.0f) + throw new UVsOutOfBoundsException(this.objFrom); + this.texCoords.add(texCoord); + } + else if (key.equalsIgnoreCase("f")) // Face Elements: f v1[/vt1][/vn1] ... + { + if (splitData.length > 4) + FMLLog.warning("OBJModel.Parser: found a face ('f') with more than 4 vertices, only the first 4 of these vertices will be rendered!"); + + List v = Lists.newArrayListWithCapacity(splitData.length); + + for (int i = 0; i < splitData.length; i++) { - splitSlash[i] = splitData[i].split("//"); + String[] pts = splitData[i].split("/"); + + int vert = Integer.parseInt(pts[0]); + Integer texture = pts.length < 2 || Strings.isEmpty(pts[1]) ? null : Integer.parseInt(pts[1]); + Integer normal = pts.length < 3 || Strings.isEmpty(pts[2]) ? null : Integer.parseInt(pts[2]); - vert = Integer.parseInt(splitSlash[i][0]); vert = vert < 0 ? this.vertices.size() - 1 : vert - 1; - norm = Integer.parseInt(splitSlash[i][1]); - norm = norm < 0 ? this.normals.size() - 1 : norm - 1; - Vertex newV = new Vertex(new Vector4f(this.vertices.get(vert).getPos()), this.vertices.get(vert).getMaterial()); - newV.setNormal(this.normals.get(norm)); + + if (texture != null) + newV.setTextureCoordinate(this.texCoords.get(texture < 0 ? this.texCoords.size() - 1 : texture - 1)); + if (normal != null) + newV.setNormal(this.normals.get(normal < 0 ? this.normals.size() - 1 : normal - 1)); v.add(newV); -// n.add(this.normals.get(norm)); } - else if (splitData[i].contains("/")) - { - splitSlash[i] = splitData[i].split("/"); - vert = Integer.parseInt(splitSlash[i][0]); - vert = vert < 0 ? this.vertices.size() - 1 : vert - 1; - texCoord = Integer.parseInt(splitSlash[i][1]); - texCoord = texCoord < 0 ? this.texCoords.size() - 1 : texCoord - 1; - if (splitSlash[i].length > 2) + Vertex[] va = v.toArray(new Vertex[v.size()]); + + Face face = new Face(va, material.name); + if (usemtlCounter < this.vertices.size()) + { + for (Vertex ver : face.getVertices()) { - norm = Integer.parseInt(splitSlash[i][2]); - norm = norm < 0 ? this.normals.size() - 1 : norm - 1; + ver.setMaterial(material); } - - Vertex newV = new Vertex(new Vector4f(this.vertices.get(vert).getPos()), this.vertices.get(vert).getMaterial()); - newV.setTextureCoordinate(this.texCoords.get(texCoord)); - newV.setNormal(splitSlash[i].length > 2 ? this.normals.get(norm) : null); - - v.add(newV); -// t.add(this.texCoords.get(texCoord)); -// if (splitSlash[i].length > 2) n.add(this.normals.get(norm)); } - else - { - splitSlash[i] = splitData[i].split(""); - vert = Integer.parseInt(splitSlash[i][0]); - vert = vert < 0 ? this.vertices.size() - 1 : vert - 1; - - Vertex newV = new Vertex(new Vector4f(this.vertices.get(vert).getPos()), this.vertices.get(vert).getMaterial()); - v.add(newV); - } - } - - Vertex[] va = new Vertex[v.size()]; - v.toArray(va); -// TextureCoordinate[] ta = new TextureCoordinate[t.size()]; -// t.toArray(ta); -// Normal[] na = new Normal[n.size()]; -// n.toArray(na); - Face face = new Face(va, material.name); - if (usemtlCounter < this.vertices.size()) - { - for (Vertex ver : face.getVertices()) + if (groupList.isEmpty()) { - ver.setMaterial(material); - } - } - - if (groupList.isEmpty()) - { - if (this.materialLibrary.getGroups().containsKey(Group.DEFAULT_NAME)) - { - this.materialLibrary.getGroups().get(Group.DEFAULT_NAME).addFace(face); - } - else - { - Group def = new Group(Group.DEFAULT_NAME, null); - def.addFace(face); - this.materialLibrary.getGroups().put(Group.DEFAULT_NAME, def); - } - } - else - { - for (String s : groupList) - { - if (this.materialLibrary.getGroups().containsKey(s)) + if (this.materialLibrary.getGroups().containsKey(Group.DEFAULT_NAME)) { - this.materialLibrary.getGroups().get(s).addFace(face); + this.materialLibrary.getGroups().get(Group.DEFAULT_NAME).addFace(face); } else { - Group e = new Group(s, null); - e.addFace(face); - this.materialLibrary.getGroups().put(s, e); + Group def = new Group(Group.DEFAULT_NAME, null); + def.addFace(face); + this.materialLibrary.getGroups().put(Group.DEFAULT_NAME, def); + } + } + else + { + for (String s : groupList) + { + if (this.materialLibrary.getGroups().containsKey(s)) + { + this.materialLibrary.getGroups().get(s).addFace(face); + } + else + { + Group e = new Group(s, null); + e.addFace(face); + this.materialLibrary.getGroups().put(s, e); + } } } } - } - else if (key.equalsIgnoreCase("g") || key.equalsIgnoreCase("o")) - { - groupList.clear(); - if (key.equalsIgnoreCase("g")) + else if (key.equalsIgnoreCase("g") || key.equalsIgnoreCase("o")) { - String[] splitSpace = data.split(" "); - for (String s : splitSpace) - groupList.add(s); + groupList.clear(); + if (key.equalsIgnoreCase("g")) + { + String[] splitSpace = data.split(" "); + for (String s : splitSpace) + groupList.add(s); + } + else + { + groupList.add(data); + } } else { - groupList.add(data); + if (!unknownObjectCommands.contains(key)) + { + unknownObjectCommands.add(key); + FMLLog.info("OBJLoader.Parser: command '%s' (model: '%s') is not currently supported, skipping. Line: %d '%s'", key, objFrom, lineNum, currentLine); + } } } - else + catch (RuntimeException e) { - if (!unknownObjectCommands.contains(key)) - { - unknownObjectCommands.add(key); - FMLLog.info("OBJLoader.Parser: command '%s' (model: '%s') is not currently supported, skipping", key, objFrom); - } + throw new RuntimeException(String.format("OBJLoader.Parser: Exception parsing line #%d: `%s`", lineNum, currentLine), e); } } - OBJModel model = new OBJModel(this.materialLibrary, this.objFrom); -// model.getMatLib().setUVBounds(minUVBounds[0], maxUVBounds[0], minUVBounds[1], maxUVBounds[1]); - return model; + return new OBJModel(this.materialLibrary, this.objFrom); } } @@ -825,8 +778,8 @@ public class OBJModel implements IRetexturableModel, IModelCustomData { return this.materialName; } - - public boolean isTriangles() + + public boolean isTriangles() { return isTri; } From 7973984227a158cf325cd4d8be177800297e1d92 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 6 Apr 2016 02:11:27 -0700 Subject: [PATCH 212/243] Fixed NPE in dedicated server languages. And fixed logger for main FML event bus. --- .../fml/common/LoadController.java | 19 +++++++++++++------ .../fml/server/FMLServerHandler.java | 3 ++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/LoadController.java b/src/main/java/net/minecraftforge/fml/common/LoadController.java index ec990c52e2..8f2f160553 100644 --- a/src/main/java/net/minecraftforge/fml/common/LoadController.java +++ b/src/main/java/net/minecraftforge/fml/common/LoadController.java @@ -63,7 +63,14 @@ public class LoadController public LoadController(Loader loader) { this.loader = loader; - this.masterChannel = new EventBus("FMLMainChannel"); + this.masterChannel = new EventBus(new SubscriberExceptionHandler() + { + @Override + public void handleException(Throwable exception, SubscriberExceptionContext context) + { + FMLLog.log("FMLMainChannel", Level.ERROR, exception, "Could not dispatch event: %s to %s", context.getEvent(), context.getSubscriberMethod()); + } + }); this.masterChannel.register(this); state = LoaderState.NOINIT; @@ -159,8 +166,8 @@ public class LoadController else { FMLLog.severe("The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base class" + - "ForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside of" + - "ForgeModLoader, especially Optifine, to see if there are fixes available."); + "ForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside of" + + "ForgeModLoader, especially Optifine, to see if there are fixes available."); throw new RuntimeException("The ForgeModLoader state engine is invalid"); } if (toThrow != null && toThrow instanceof RuntimeException) @@ -327,9 +334,9 @@ public class LoadController return this.state == state; } - boolean hasReachedState(LoaderState state) { - return this.state.ordinal()>=state.ordinal() && this.state!=LoaderState.ERRORED; - } + boolean hasReachedState(LoaderState state) { + return this.state.ordinal()>=state.ordinal() && this.state!=LoaderState.ERRORED; + } void forceState(LoaderState newState) { diff --git a/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java b/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java index 56df1ff8a4..f9e7db1d65 100644 --- a/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java +++ b/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java @@ -256,7 +256,8 @@ public class FMLServerHandler implements IFMLSidedHandler IOUtils.closeQuietly(stream); try { - zip.close(); + if (zip != null) + zip.close(); } catch (IOException e) { From db043708305498283e12f300dc2448e97722b19d Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 6 Apr 2016 16:13:51 +0300 Subject: [PATCH 213/243] Made forge fluids use smooth lighting. --- src/main/java/net/minecraftforge/client/model/ModelFluid.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index dc39944064..b3039a6073 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -324,7 +324,7 @@ public final class ModelFluid implements IModelCustomData public boolean isAmbientOcclusion() { - return false; + return true; } public boolean isGui3d() From 72edc41a7c0548a8a8f1b9fb4767497d48c8aebc Mon Sep 17 00:00:00 2001 From: kashike Date: Wed, 6 Apr 2016 09:26:14 -0700 Subject: [PATCH 214/243] Remove @SideOnly(Side.CLIENT) from BossInfo/BossInfoServer methods These methods can also be used by the server (see BossInfoServer, it sends packets to the client but the methods are @SideOnly(Side.CLIENT)) --- .../net/minecraft/world/BossInfo.java.patch | 35 +++++++++++++++++++ .../minecraft/world/BossInfoServer.java.patch | 35 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 patches/minecraft/net/minecraft/world/BossInfo.java.patch create mode 100644 patches/minecraft/net/minecraft/world/BossInfoServer.java.patch diff --git a/patches/minecraft/net/minecraft/world/BossInfo.java.patch b/patches/minecraft/net/minecraft/world/BossInfo.java.patch new file mode 100644 index 0000000000..c5bb266f34 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/BossInfo.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/world/BossInfo.java ++++ ../src-work/minecraft/net/minecraft/world/BossInfo.java +@@ -2,8 +2,6 @@ + + import java.util.UUID; + import net.minecraft.util.text.ITextComponent; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + + public abstract class BossInfo + { +@@ -35,7 +33,6 @@ + return this.field_186749_a; + } + +- @SideOnly(Side.CLIENT) + public void func_186739_a(ITextComponent p_186739_1_) + { + this.field_186749_a = p_186739_1_; +@@ -56,7 +53,6 @@ + return this.field_186751_c; + } + +- @SideOnly(Side.CLIENT) + public void func_186745_a(BossInfo.Color p_186745_1_) + { + this.field_186751_c = p_186745_1_; +@@ -67,7 +63,6 @@ + return this.field_186752_d; + } + +- @SideOnly(Side.CLIENT) + public void func_186746_a(BossInfo.Overlay p_186746_1_) + { + this.field_186752_d = p_186746_1_; diff --git a/patches/minecraft/net/minecraft/world/BossInfoServer.java.patch b/patches/minecraft/net/minecraft/world/BossInfoServer.java.patch new file mode 100644 index 0000000000..a10f0ab75e --- /dev/null +++ b/patches/minecraft/net/minecraft/world/BossInfoServer.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/world/BossInfoServer.java ++++ ../src-work/minecraft/net/minecraft/world/BossInfoServer.java +@@ -9,8 +9,6 @@ + import net.minecraft.network.play.server.SPacketUpdateEntityNBT; + import net.minecraft.util.math.MathHelper; + import net.minecraft.util.text.ITextComponent; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + + public class BossInfoServer extends BossInfo + { +@@ -34,7 +32,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + public void func_186745_a(BossInfo.Color p_186745_1_) + { + if (p_186745_1_ != this.field_186751_c) +@@ -44,7 +41,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + public void func_186746_a(BossInfo.Overlay p_186746_1_) + { + if (p_186746_1_ != this.field_186752_d) +@@ -87,7 +83,6 @@ + return this; + } + +- @SideOnly(Side.CLIENT) + public void func_186739_a(ITextComponent p_186739_1_) + { + if (!Objects.equal(p_186739_1_, this.field_186749_a)) From 8fefac110e532943eb79eb66febd9c8b80c9bc81 Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 7 Apr 2016 12:29:00 -0700 Subject: [PATCH 215/243] Fix potential desync between Forge's Villager profession and vanilla's int based system. --- .../entity/passive/EntityVillager.java.patch | 19 +++++++++++---- .../fml/common/registry/VillagerRegistry.java | 23 +++++++++++++++++++ 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch index 9cd5cb3c59..54cc5b167f 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -55,7 +55,15 @@ this.field_70956_bz = p_70037_1_.func_74762_e("Riches"); this.field_175563_bv = p_70037_1_.func_74762_e("Career"); this.field_175562_bw = p_70037_1_.func_74762_e("CareerLevel"); -@@ -334,6 +346,26 @@ +@@ -327,6 +339,7 @@ + public void func_70938_b(int p_70938_1_) + { + this.field_70180_af.func_187227_b(field_184752_bw, Integer.valueOf(p_70938_1_)); ++ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, p_70938_1_); + } + + public int func_70946_n() +@@ -334,6 +347,27 @@ return Math.max(((Integer)this.field_70180_af.func_187225_a(field_184752_bw)).intValue() % 5, 0); } @@ -64,6 +72,7 @@ + { + this.field_70180_af.func_187227_b(PROFESSION_STR, prof.getRegistryName().toString()); + this.prof = prof; ++ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, prof); + } + + public net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession getProfessionForge() @@ -82,7 +91,7 @@ public boolean func_70941_o() { return this.field_70952_f; -@@ -533,15 +565,13 @@ +@@ -533,15 +567,13 @@ private void func_175554_cu() { @@ -99,7 +108,7 @@ this.field_175562_bw = 1; } -@@ -552,7 +582,7 @@ +@@ -552,7 +584,7 @@ int i = this.field_175563_bv - 1; int j = this.field_175562_bw - 1; @@ -108,7 +117,7 @@ if (j >= 0 && j < aentityvillager$itradelist1.length) { -@@ -647,9 +677,14 @@ +@@ -647,9 +679,14 @@ } } @@ -124,7 +133,7 @@ textcomponenttranslation.func_150256_b().func_150209_a(this.func_174823_aP()); textcomponenttranslation.func_150256_b().func_179989_a(this.func_110124_au().toString()); -@@ -708,7 +743,7 @@ +@@ -708,7 +745,7 @@ public IEntityLivingData func_180482_a(DifficultyInstance p_180482_1_, IEntityLivingData p_180482_2_) { p_180482_2_ = super.func_180482_a(p_180482_1_, p_180482_2_); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java index f0cfb52a3a..0c02d63b25 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java @@ -277,6 +277,29 @@ public class VillagerRegistry entity.setProfession(rand.nextInt(entries.size())); } + public static void onSetProfession(EntityVillager entity, VillagerProfession prof) + { + int network = INSTANCE.professions.getId(prof); + if (network == -1 || prof != INSTANCE.professions.getObjectById(network)) + { + throw new RuntimeException("Attempted to set villager profession to unregistered profession: " + network + " " + prof); + } + + if (network != entity.getProfession()) + entity.setProfession(network); + } + public static void onSetProfession(EntityVillager entity, int network) + { + VillagerProfession prof = INSTANCE.professions.getObjectById(network); + if (prof == null || INSTANCE.professions.getId(prof) != network) + { + throw new RuntimeException("Attempted to set villager profession to unregistered profession: " + network + " " + prof); + } + + if (prof != entity.getProfessionForge()) + entity.setProfession(prof); + } + //TODO: Figure out a good generic system for this. Put on hold for Patches. private static class VanillaTrades From 2a4067a53910c6895c780936d456cbd0067f74aa Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 7 Apr 2016 13:12:10 -0700 Subject: [PATCH 216/243] Fix being kicked from server when climbing ladders. --- patches/minecraft/net/minecraft/world/World.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index cae7214a06..5e1530d23e 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -500,7 +500,7 @@ IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos.func_185343_d(k1, l1, i2)); - if (iblockstate.func_185904_a() != Material.field_151579_a) -+ if (iblockstate.func_177230_c().isAir(iblockstate, this, new BlockPos(k1, l1, i2))) ++ if (!iblockstate.func_177230_c().isAir(iblockstate, this, new BlockPos(k1, l1, i2))) { blockpos$pooledmutableblockpos.func_185344_t(); return true; From 03584ec41141dcdedc04d3b6570d2ed22895987c Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 8 Apr 2016 01:39:55 +0300 Subject: [PATCH 217/243] Fix ForgeChunkManager world unloading check (#2736) --- src/main/java/net/minecraftforge/common/ForgeChunkManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java index c402b1eaa4..3f34aad5e7 100644 --- a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java +++ b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java @@ -598,7 +598,7 @@ public class ForgeChunkManager forcedChunks.remove(world); dormantChunkCache.remove(world); // integrated server is shutting down - if (FMLCommonHandler.instance().getMinecraftServerInstance().isServerRunning()) + if (!FMLCommonHandler.instance().getMinecraftServerInstance().isServerRunning()) { playerTickets.clear(); tickets.clear(); From a018e14939c6a06b6fcc07159cee0737edf26f5f Mon Sep 17 00:00:00 2001 From: mezz Date: Fri, 8 Apr 2016 20:18:17 -0700 Subject: [PATCH 218/243] Add cancelable event for Potions shifting the gui position (#2667) Add cancelable event for Potions shifting the gui position --- .../renderer/InventoryEffectRenderer.java.patch | 8 +++++--- .../client/event/GuiScreenEvent.java | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch index faade1145e..81041e73d5 100644 --- a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java -@@ -28,7 +28,12 @@ +@@ -28,8 +28,14 @@ protected void func_175378_g() { @@ -12,9 +12,11 @@ + } + if (!this.field_146297_k.field_71439_g.func_70651_bq().isEmpty() && hasVisibleEffect) { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.PotionShiftEvent(this))) this.field_147003_i = (this.field_146294_l - this.field_146999_f) / 2; else this.field_147003_i = 160 + (this.field_146294_l - this.field_146999_f - 200) / 2; this.field_147045_u = true; -@@ -71,6 +76,7 @@ + } +@@ -71,6 +77,7 @@ for (PotionEffect potioneffect : Ordering.natural().sortedCopy(collection)) { Potion potion = potioneffect.func_188419_a(); @@ -22,7 +24,7 @@ GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); this.field_146297_k.func_110434_K().func_110577_a(field_147001_a); this.func_73729_b(i, j, 0, 166, 140, 32); -@@ -81,6 +87,8 @@ +@@ -81,6 +88,8 @@ this.func_73729_b(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18); } diff --git a/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java b/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java index 2809ffa5f8..1017218a29 100644 --- a/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java +++ b/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java @@ -189,6 +189,20 @@ public class GuiScreenEvent extends Event return mouseY; } } + + /** + * This event fires in {@code InventoryEffectRenderer.updateActivePotionEffects()} + * when potion effects are active and the gui wants to move over. + * Cancel this event to prevent the Gui from being moved. + */ + @Cancelable + public static class PotionShiftEvent extends GuiScreenEvent + { + public PotionShiftEvent(GuiScreen gui) + { + super(gui); + } + } public static class ActionPerformedEvent extends GuiScreenEvent { From 2a3774def3a503e5dda76d3838a4aa4b410d1e41 Mon Sep 17 00:00:00 2001 From: Matthew Prenger Date: Sat, 9 Apr 2016 18:03:46 -0500 Subject: [PATCH 219/243] Don't use import static with net.minecraft classes. Using the latest MCP snapshots this causes an import conflict. (#2742) --- .../common/BiomeDictionary.java | 83 ++++++++++--------- .../net/minecraftforge/common/ForgeHooks.java | 15 ++-- 2 files changed, 47 insertions(+), 51 deletions(-) diff --git a/src/main/java/net/minecraftforge/common/BiomeDictionary.java b/src/main/java/net/minecraftforge/common/BiomeDictionary.java index 786aa1584d..3b535e9e72 100644 --- a/src/main/java/net/minecraftforge/common/BiomeDictionary.java +++ b/src/main/java/net/minecraftforge/common/BiomeDictionary.java @@ -3,12 +3,13 @@ package net.minecraftforge.common; import java.util.*; import net.minecraftforge.fml.common.FMLLog; + +import net.minecraft.init.Biomes; import net.minecraft.init.Blocks; import net.minecraft.util.ResourceLocation; import net.minecraft.world.biome.*; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.event.terraingen.DeferredBiomeDecorator; -import static net.minecraft.init.Biomes.*; import static net.minecraftforge.common.BiomeDictionary.Type.*; public class BiomeDictionary @@ -435,45 +436,45 @@ public class BiomeDictionary private static void registerVanillaBiomes() { - registerBiomeType(ocean, OCEAN ); - registerBiomeType(plains, PLAINS ); - registerBiomeType(desert, HOT, DRY, SANDY ); - registerBiomeType(extremeHills, MOUNTAIN, HILLS ); - registerBiomeType(forest, FOREST ); - registerBiomeType(taiga, COLD, CONIFEROUS, FOREST ); - registerBiomeType(taigaHills, COLD, CONIFEROUS, FOREST, HILLS ); - registerBiomeType(swampland, WET, SWAMP ); - registerBiomeType(river, RIVER ); - registerBiomeType(frozenOcean, COLD, OCEAN, SNOWY ); - registerBiomeType(frozenRiver, COLD, RIVER, SNOWY ); - registerBiomeType(icePlains, COLD, SNOWY, WASTELAND ); - registerBiomeType(iceMountains, COLD, SNOWY, MOUNTAIN ); - registerBiomeType(beach, BEACH ); - registerBiomeType(desertHills, HOT, DRY, SANDY, HILLS ); - registerBiomeType(jungle, HOT, WET, DENSE, JUNGLE ); - registerBiomeType(jungleHills, HOT, WET, DENSE, JUNGLE, HILLS); - registerBiomeType(forestHills, FOREST, HILLS ); - registerBiomeType(sky, COLD, DRY, END ); - registerBiomeType(hell, HOT, DRY, NETHER ); - registerBiomeType(mushroomIsland, MUSHROOM ); - registerBiomeType(extremeHillsEdge, MOUNTAIN ); - registerBiomeType(mushroomIslandShore, MUSHROOM, BEACH ); - registerBiomeType(jungleEdge, HOT, WET, JUNGLE, FOREST ); - registerBiomeType(deepOcean, OCEAN ); - registerBiomeType(stoneBeach, BEACH ); - registerBiomeType(coldBeach, COLD, BEACH, SNOWY ); - registerBiomeType(birchForest, FOREST ); - registerBiomeType(birchForestHills, FOREST, HILLS ); - registerBiomeType(roofedForest, SPOOKY, DENSE, FOREST ); - registerBiomeType(coldTaiga, COLD, CONIFEROUS, FOREST, SNOWY ); - registerBiomeType(coldTaigaHills, COLD, CONIFEROUS, FOREST, SNOWY, HILLS); - registerBiomeType(megaTaiga, COLD, CONIFEROUS, FOREST ); - registerBiomeType(megaTaigaHills, COLD, CONIFEROUS, FOREST, HILLS ); - registerBiomeType(extremeHillsPlus, MOUNTAIN, FOREST, SPARSE ); - registerBiomeType(savanna, HOT, SAVANNA, PLAINS, SPARSE ); - registerBiomeType(savannaPlateau, HOT, SAVANNA, PLAINS, SPARSE ); - registerBiomeType(mesa, MESA, SANDY ); - registerBiomeType(mesaPlateau_F, MESA, SPARSE, SANDY ); - registerBiomeType(mesaPlateau, MESA, SANDY ); + registerBiomeType(Biomes.ocean, OCEAN ); + registerBiomeType(Biomes.plains, PLAINS ); + registerBiomeType(Biomes.desert, HOT, DRY, SANDY ); + registerBiomeType(Biomes.extremeHills, MOUNTAIN, HILLS ); + registerBiomeType(Biomes.forest, FOREST ); + registerBiomeType(Biomes.taiga, COLD, CONIFEROUS, FOREST ); + registerBiomeType(Biomes.taigaHills, COLD, CONIFEROUS, FOREST, HILLS ); + registerBiomeType(Biomes.swampland, WET, SWAMP ); + registerBiomeType(Biomes.river, RIVER ); + registerBiomeType(Biomes.frozenOcean, COLD, OCEAN, SNOWY ); + registerBiomeType(Biomes.frozenRiver, COLD, RIVER, SNOWY ); + registerBiomeType(Biomes.icePlains, COLD, SNOWY, WASTELAND ); + registerBiomeType(Biomes.iceMountains, COLD, SNOWY, MOUNTAIN ); + registerBiomeType(Biomes.beach, BEACH ); + registerBiomeType(Biomes.desertHills, HOT, DRY, SANDY, HILLS ); + registerBiomeType(Biomes.jungle, HOT, WET, DENSE, JUNGLE ); + registerBiomeType(Biomes.jungleHills, HOT, WET, DENSE, JUNGLE, HILLS); + registerBiomeType(Biomes.forestHills, FOREST, HILLS ); + registerBiomeType(Biomes.sky, COLD, DRY, END ); + registerBiomeType(Biomes.hell, HOT, DRY, NETHER ); + registerBiomeType(Biomes.mushroomIsland, MUSHROOM ); + registerBiomeType(Biomes.extremeHillsEdge, MOUNTAIN ); + registerBiomeType(Biomes.mushroomIslandShore, MUSHROOM, BEACH ); + registerBiomeType(Biomes.jungleEdge, HOT, WET, JUNGLE, FOREST ); + registerBiomeType(Biomes.deepOcean, OCEAN ); + registerBiomeType(Biomes.stoneBeach, BEACH ); + registerBiomeType(Biomes.coldBeach, COLD, BEACH, SNOWY ); + registerBiomeType(Biomes.birchForest, FOREST ); + registerBiomeType(Biomes.birchForestHills, FOREST, HILLS ); + registerBiomeType(Biomes.roofedForest, SPOOKY, DENSE, FOREST ); + registerBiomeType(Biomes.coldTaiga, COLD, CONIFEROUS, FOREST, SNOWY ); + registerBiomeType(Biomes.coldTaigaHills, COLD, CONIFEROUS, FOREST, SNOWY, HILLS); + registerBiomeType(Biomes.megaTaiga, COLD, CONIFEROUS, FOREST ); + registerBiomeType(Biomes.megaTaigaHills, COLD, CONIFEROUS, FOREST, HILLS ); + registerBiomeType(Biomes.extremeHillsPlus, MOUNTAIN, FOREST, SPARSE ); + registerBiomeType(Biomes.savanna, HOT, SAVANNA, PLAINS, SPARSE ); + registerBiomeType(Biomes.savannaPlateau, HOT, SAVANNA, PLAINS, SPARSE ); + registerBiomeType(Biomes.mesa, MESA, SANDY ); + registerBiomeType(Biomes.mesaPlateau_F, MESA, SPARSE, SANDY ); + registerBiomeType(Biomes.mesaPlateau, MESA, SANDY ); } } diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index b1f17fcca6..8d60ecf1fc 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -1,14 +1,5 @@ package net.minecraftforge.common; -import static net.minecraft.init.Blocks.diamond_block; -import static net.minecraft.init.Blocks.diamond_ore; -import static net.minecraft.init.Blocks.emerald_block; -import static net.minecraft.init.Blocks.emerald_ore; -import static net.minecraft.init.Blocks.gold_block; -import static net.minecraft.init.Blocks.gold_ore; -import static net.minecraft.init.Blocks.lit_redstone_ore; -import static net.minecraft.init.Blocks.redstone_ore; - import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; @@ -217,7 +208,11 @@ public class ForgeHooks } Blocks.obsidian.setHarvestLevel("pickaxe", 3); - for (Block block : new Block[]{emerald_ore, emerald_block, diamond_ore, diamond_block, gold_ore, gold_block, redstone_ore, lit_redstone_ore}) + Block[] oreBlocks = new Block[] { + Blocks.emerald_ore, Blocks.emerald_block, Blocks.diamond_ore, Blocks.diamond_block, + Blocks.gold_ore, Blocks.gold_block, Blocks.redstone_ore, Blocks.lit_redstone_ore + }; + for (Block block : oreBlocks) { block.setHarvestLevel("pickaxe", 2); } From 68cd48287b4dbc03aa4bd70e2a26f694f0af6c9a Mon Sep 17 00:00:00 2001 From: Kina Date: Sun, 10 Apr 2016 08:09:06 +0900 Subject: [PATCH 220/243] make WorldSavedData implement NBTSerializable (#2745) --- .../minecraft/world/WorldSavedData.java.patch | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 patches/minecraft/net/minecraft/world/WorldSavedData.java.patch diff --git a/patches/minecraft/net/minecraft/world/WorldSavedData.java.patch b/patches/minecraft/net/minecraft/world/WorldSavedData.java.patch new file mode 100644 index 0000000000..6e33e0f03f --- /dev/null +++ b/patches/minecraft/net/minecraft/world/WorldSavedData.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldSavedData.java ++++ ../src-work/minecraft/net/minecraft/world/WorldSavedData.java +@@ -2,7 +2,7 @@ + + import net.minecraft.nbt.NBTTagCompound; + +-public abstract class WorldSavedData ++public abstract class WorldSavedData implements net.minecraftforge.common.util.INBTSerializable + { + public final String field_76190_i; + private boolean field_76189_a; +@@ -30,4 +30,16 @@ + { + return this.field_76189_a; + } ++ ++ public void deserializeNBT(NBTTagCompound nbt) ++ { ++ this.func_76184_a(nbt); ++ } ++ ++ public NBTTagCompound serializeNBT() ++ { ++ NBTTagCompound ret = new NBTTagCompound(); ++ this.func_76187_b(ret); ++ return ret; ++ } + } From c560af69a5474acfbee768064a238d46f01d15f2 Mon Sep 17 00:00:00 2001 From: mezz Date: Sat, 9 Apr 2016 17:02:03 -0700 Subject: [PATCH 221/243] Fix log spam from invalid key modifiers (#2746) --- .../client/settings/GameSettings.java.patch | 2 +- .../client/settings/KeyModifier.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch index a5386e6b13..affbeca4f3 100644 --- a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch +++ b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch @@ -20,7 +20,7 @@ if (astring[0].equals("key_" + keybinding.func_151464_g())) { keybinding.func_151462_b(Integer.parseInt(astring[1])); -+ if (astring.length == 3) keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueOf(astring[2]), Integer.parseInt(astring[1])); ++ if (astring.length == 3) keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(astring[2]), Integer.parseInt(astring[1])); } } diff --git a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java index 9838251dac..b5ff9a875a 100644 --- a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java +++ b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java @@ -120,6 +120,22 @@ public enum KeyModifier { return false; } + public static KeyModifier valueFromString(String stringValue) + { + try + { + return valueOf(stringValue); + } + catch (NullPointerException ignored) + { + return NONE; + } + catch (IllegalArgumentException ignored) + { + return NONE; + } + } + public abstract boolean matches(int keyCode); public abstract boolean isActive(); From 205f5c13c844540000ed41fbc85057cb8de5ab53 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sat, 9 Apr 2016 22:33:39 -0700 Subject: [PATCH 222/243] Expose a central place to access all of Vanilla and Forge's registries using the new registry API. --- .../fml/common/FMLContainer.java | 6 ++- .../fml/common/registry/ForgeRegistries.java | 40 +++++++++++++++++++ .../fml/common/registry/GameRegistry.java | 13 ++++++ .../registry/PersistentRegistryManager.java | 5 +++ 4 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 src/main/java/net/minecraftforge/fml/common/registry/ForgeRegistries.java diff --git a/src/main/java/net/minecraftforge/fml/common/FMLContainer.java b/src/main/java/net/minecraftforge/fml/common/FMLContainer.java index d92e7fc267..397266bff3 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLContainer.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLContainer.java @@ -35,6 +35,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.network.NetworkCheckHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; +import net.minecraftforge.fml.common.registry.ForgeRegistries; import net.minecraftforge.fml.common.registry.PersistentRegistryManager; import net.minecraftforge.fml.common.registry.VillagerRegistry; import net.minecraftforge.fml.relauncher.Side; @@ -84,8 +85,9 @@ public final class FMLContainer extends DummyModContainer implements WorldAccess @Subscribe public void modPreinitialization(FMLPreInitializationEvent evt) { - // Initialize the villager registry - VillagerRegistry.instance(); + // Initialize all Forge/Vanilla registries {invoke the static init) + if (ForgeRegistries.ITEMS == null) + throw new RuntimeException("Something horrible went wrong in init, ForgeRegistres didn't create..."); } @NetworkCheckHandler diff --git a/src/main/java/net/minecraftforge/fml/common/registry/ForgeRegistries.java b/src/main/java/net/minecraftforge/fml/common/registry/ForgeRegistries.java new file mode 100644 index 0000000000..74917b1c9a --- /dev/null +++ b/src/main/java/net/minecraftforge/fml/common/registry/ForgeRegistries.java @@ -0,0 +1,40 @@ +package net.minecraftforge.fml.common.registry; + +import net.minecraft.block.Block; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.item.Item; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionType; +import net.minecraft.util.SoundEvent; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession; + +/** + * A class that exposes static references to all vanilla and Forge registries. + * Created to have a central place to access the registries directly if modders need. + * It is still advised that if you are registering things to go through {@link GameRegistry.register} but queries and iterations can use this. + */ +public class ForgeRegistries +{ + static { init(); } // This must be above the fields so we guarantee it's run before findRegistry is called. Yay static inializers + + public static final IForgeRegistry BLOCKS = GameRegistry.findRegistry(Block.class); + public static final IForgeRegistry ITEMS = GameRegistry.findRegistry(Item.class); + public static final IForgeRegistry POTIONS = GameRegistry.findRegistry(Potion.class); + public static final IForgeRegistry BIOMES = GameRegistry.findRegistry(BiomeGenBase.class); + public static final IForgeRegistry SOUND_EVENTS = GameRegistry.findRegistry(SoundEvent.class); + public static final IForgeRegistry POTION_TYPES = GameRegistry.findRegistry(PotionType.class); + public static final IForgeRegistry ENCHANTMENTS = GameRegistry.findRegistry(Enchantment.class); + public static final IForgeRegistry VILLAGER_PROFESSIONS = GameRegistry.findRegistry(VillagerProfession.class); + + + /** + * This function is just to make sure static inializers in other classes have run and setup their registries before we query them. + */ + private static void init() + { + GameData.getMain(); + VillagerRegistry.instance(); + } + +} diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java index ab0d43eb26..232e6053ef 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java @@ -184,6 +184,19 @@ public class GameRegistry return block; } + /** + * Retrieves the registry associated with this super class type. + * If the return is non-null it is HIGHLY recommended that modders cache this + * value as the return will never change for a given type in a single run of Minecraft once set. + * + * @param registryType The base class of items in this registry. + * @return The registry, Null if none is registered. + */ + public static > IForgeRegistry findRegistry(Class registryType) + { + return PersistentRegistryManager.findRegistryByType(registryType); + } + /** * Add a forced persistent substitution alias for the block or item to another block or item. This will have * the effect of using the substituted block or item instead of the original, where ever it is diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index 03e2257edd..0001b425f1 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -152,6 +152,11 @@ public class PersistentRegistryManager return registry; } + static > IForgeRegistry findRegistryByType(Class registryType) + { + return PersistentRegistry.ACTIVE.getRegistry(registryType); + } + public static List injectSnapshot(GameDataSnapshot snapshot, boolean injectFrozenData, boolean isLocalWorld) { From fa21f2b44cf9fee71b1d96ecbd655ab476f3dda1 Mon Sep 17 00:00:00 2001 From: iTitus Date: Wed, 13 Apr 2016 20:53:25 +0200 Subject: [PATCH 223/243] Fix forge:default-block transformation. (#2760) The first-person left-hand rotation was a little bit of. --- .../java/net/minecraftforge/client/model/ForgeBlockStateV1.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java index 7acae47952..8e8149b5f5 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java @@ -510,7 +510,7 @@ public class ForgeBlockStateV1 extends Marker builder.put(TransformType.THIRD_PERSON_RIGHT_HAND, thirdperson); builder.put(TransformType.THIRD_PERSON_LEFT_HAND, leftify(thirdperson)); builder.put(TransformType.FIRST_PERSON_RIGHT_HAND, get(0, 0, 0, 0, 45, 0, 0.4f)); - builder.put(TransformType.FIRST_PERSON_LEFT_HAND, get(0, 0, 0, 0, 255, 0, 0.4f)); + builder.put(TransformType.FIRST_PERSON_LEFT_HAND, get(0, 0, 0, 0, 225, 0, 0.4f)); ret.state = Optional.of(new SimpleModelState(builder.build())); } // item/generated From 35999f9a20b049387d80a1386c52b8748cf59cb6 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Fri, 15 Apr 2016 00:34:46 -0500 Subject: [PATCH 224/243] Boss bar render event (#2701) Allow control over increment height --- .../client/gui/GuiBossOverlay.java.patch | 22 +++++++ .../client/ForgeHooksClient.java | 18 ++++++ .../client/event/RenderGameOverlayEvent.java | 61 ++++++++++++++++++- 3 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiBossOverlay.java.patch diff --git a/patches/minecraft/net/minecraft/client/gui/GuiBossOverlay.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiBossOverlay.java.patch new file mode 100644 index 0000000000..2acdca22ce --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiBossOverlay.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiBossOverlay.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiBossOverlay.java +@@ -35,13 +35,18 @@ + for (BossInfoLerping bossinfolerping : this.field_184060_g.values()) + { + int k = i / 2 - 91; ++ net.minecraftforge.client.event.RenderGameOverlayEvent.BossInfo event = ++ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPre(scaledresolution, bossinfolerping, k, j, 10 + this.field_184059_f.field_71466_p.field_78288_b); ++ if (!event.isCanceled()) { + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + this.field_184059_f.func_110434_K().func_110577_a(field_184058_a); + this.func_184052_a(k, j, bossinfolerping); + String s = bossinfolerping.func_186744_e().func_150254_d(); + this.field_184059_f.field_71466_p.func_175063_a(s, (float)(i / 2 - this.field_184059_f.field_71466_p.func_78256_a(s) / 2), (float)(j - 9), 16777215); +- j += 10 + this.field_184059_f.field_71466_p.field_78288_b; ++ } ++ j += event.getIncrement(); + ++ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPost(scaledresolution); + if (j >= scaledresolution.func_78328_b() / 3) + { + break; diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 892d49b59b..9f628dd504 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -1,5 +1,6 @@ package net.minecraftforge.client; +import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.BOSSINFO; import static net.minecraftforge.common.ForgeVersion.Status.BETA; import static net.minecraftforge.common.ForgeVersion.Status.BETA_OUTDATED; import static org.lwjgl.opengl.GL11.*; @@ -22,6 +23,7 @@ import net.minecraft.client.audio.SoundManager; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.renderer.GlStateManager; @@ -61,6 +63,7 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.registry.IRegistry; import net.minecraft.util.text.TextFormatting; +import net.minecraft.world.BossInfoLerping; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -70,12 +73,14 @@ import net.minecraftforge.client.event.FOVUpdateEvent; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.event.MouseEvent; +import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderHandEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent; import net.minecraftforge.client.model.IPerspectiveAwareModel; import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.client.model.animation.Animation; import net.minecraftforge.common.ForgeModContainer; import net.minecraftforge.common.ForgeVersion; import net.minecraftforge.common.ForgeVersion.Status; @@ -652,4 +657,17 @@ public class ForgeHooksClient int angle = MathHelper.normalizeAngle(-(int)Math.round(Math.toDegrees(Math.atan2(rv.y, rv.x)) / 90) * 90, 360); return new BlockFaceUV(new float[]{ uMin, vMin, uMax, vMax }, angle); } + + public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(ScaledResolution res, BossInfoLerping bossInfo, int x, int y, int increment) + { + RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res), + BOSSINFO, bossInfo, x, y, increment); + MinecraftForge.EVENT_BUS.post(evt); + return evt; + } + + public static void bossBarRenderPost(ScaledResolution res) + { + MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res), BOSSINFO)); + } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java b/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java index a9187ff057..8dd6ad19c6 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java @@ -2,6 +2,7 @@ package net.minecraftforge.client.event; import java.util.ArrayList; +import net.minecraft.world.BossInfoLerping; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; @@ -31,7 +32,8 @@ public class RenderGameOverlayEvent extends Event HELMET, PORTAL, CROSSHAIRS, - BOSSHEALTH, + BOSSHEALTH, // All boss bars + BOSSINFO, // Individual boss bar ARMOR, HEALTH, FOOD, @@ -83,6 +85,63 @@ public class RenderGameOverlayEvent extends Event @Override public boolean isCancelable(){ return false; } } + public static class BossInfo extends Pre + { + private final BossInfoLerping bossInfo; + private final int x; + private final int y; + private int increment; + public BossInfo(RenderGameOverlayEvent parent, ElementType type, BossInfoLerping bossInfo, int x, int y, int increment) + { + super(parent, type); + this.bossInfo = bossInfo; + this.x = x; + this.y = y; + this.increment = increment; + } + + /** + * @return The {@link BossInfoLerping} currently being rendered + */ + public BossInfoLerping getBossInfo() + { + return bossInfo; + } + + /** + * @return The current x position we are rendering at + */ + public int getX() + { + return x; + } + + /** + * @return The current y position we are rendering at + */ + public int getY() + { + return y; + } + + /** + * @return How much to move down before rendering the next bar + */ + public int getIncrement() + { + return increment; + } + + /** + * Sets the amount to move down before rendering the next bar + * @param increment The increment to set + */ + public void setIncrement(int increment) + { + this.increment = increment; + } + } + public static class Text extends Pre { private final ArrayList left; From d090c2834b239c0fe4c1c14d6d76460d4e119e2c Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 27 Apr 2016 18:37:54 -0700 Subject: [PATCH 225/243] Fix NPE on shield break. Closes #2786 --- .../net/minecraft/entity/EntityLivingBase.java.patch | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 5c2909d5b2..1715d44ced 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -232,9 +232,12 @@ public abstract EnumHandSide func_184591_cq(); public boolean func_184587_cr() -@@ -2371,6 +2437,14 @@ +@@ -2369,8 +2435,16 @@ + { + ItemStack itemstack = this.func_184586_b(this.func_184600_cs()); - if (itemstack == this.field_184627_bm) +- if (itemstack == this.field_184627_bm) ++ if (itemstack == this.field_184627_bm && itemstack != null) { + field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn); + if (field_184628_bn <= 0) From e8098133ea57a43a5db457da9fdf7c958e4537ad Mon Sep 17 00:00:00 2001 From: cpw Date: Thu, 28 Apr 2016 15:15:50 -0400 Subject: [PATCH 226/243] Add the new license text. Not yet applicable to forge. --- LICENSE-new.txt | 476 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 476 insertions(+) create mode 100644 LICENSE-new.txt diff --git a/LICENSE-new.txt b/LICENSE-new.txt new file mode 100644 index 0000000000..458dd50593 --- /dev/null +++ b/LICENSE-new.txt @@ -0,0 +1,476 @@ +Minecraft Forge is licensed under the terms of the LGPL 2.1 found +here http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt and copied +below. + +A note on authorship: +All source artifacts are property of their original author, with +the exclusion of the contents of the patches directory and others +copied from it from time to time. Authorship of the contents of +the patches directory is retained by the Minecraft Forge project. +This is because the patches are partially machine generated +artifacts, and are changed heavily due to the way forge works. +Individual attribution within them is impossible. + +Consent: +All contributions to Forge must consent to the release of any +patch content to the Forge project. + + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS From c519812ea14d2a851973ae685836d0c121ea9d68 Mon Sep 17 00:00:00 2001 From: cpw Date: Thu, 28 Apr 2016 15:22:24 -0400 Subject: [PATCH 227/243] Update LICENSE-new.txt Clarification on infectivity --- LICENSE-new.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/LICENSE-new.txt b/LICENSE-new.txt index 458dd50593..63a079b5db 100644 --- a/LICENSE-new.txt +++ b/LICENSE-new.txt @@ -15,6 +15,12 @@ Consent: All contributions to Forge must consent to the release of any patch content to the Forge project. +A note on infectivity: +The LGPL is chosen specifically so that projects may depend on Forge +features without being infected with its license. That is the +purpose of the LGPL. Mods and others using or distributing this +are specifically not bound by it's license for their code. + GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 From d9e0a653e035c071bcd1fe9c255c6d97474bc752 Mon Sep 17 00:00:00 2001 From: cpw Date: Thu, 28 Apr 2016 15:23:03 -0400 Subject: [PATCH 228/243] Update LICENSE-new.txt Words --- LICENSE-new.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE-new.txt b/LICENSE-new.txt index 63a079b5db..71b1e12262 100644 --- a/LICENSE-new.txt +++ b/LICENSE-new.txt @@ -19,7 +19,7 @@ A note on infectivity: The LGPL is chosen specifically so that projects may depend on Forge features without being infected with its license. That is the purpose of the LGPL. Mods and others using or distributing this -are specifically not bound by it's license for their code. +are specifically not bound by Forge's license for the Mod code. GNU LESSER GENERAL PUBLIC LICENSE From 84bfeddc1ce811d392f0294f28bb36c039c64bf7 Mon Sep 17 00:00:00 2001 From: cpw Date: Thu, 28 Apr 2016 15:24:34 -0400 Subject: [PATCH 229/243] Update LICENSE-new.txt Better words --- LICENSE-new.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/LICENSE-new.txt b/LICENSE-new.txt index 71b1e12262..be2c9e66dc 100644 --- a/LICENSE-new.txt +++ b/LICENSE-new.txt @@ -18,8 +18,9 @@ patch content to the Forge project. A note on infectivity: The LGPL is chosen specifically so that projects may depend on Forge features without being infected with its license. That is the -purpose of the LGPL. Mods and others using or distributing this -are specifically not bound by Forge's license for the Mod code. +purpose of the LGPL. Mods and others using this code via ordinary +Java mechanics for referencing libraries are specifically not bound +by Forge's license for the Mod code. GNU LESSER GENERAL PUBLIC LICENSE From 9c9107c4347ef7538debe4aafec4a3dddd9daa64 Mon Sep 17 00:00:00 2001 From: mezz Date: Fri, 29 Apr 2016 12:04:48 -0700 Subject: [PATCH 230/243] Close #2780 add CMD localization for Mac key bindings (#2792) --- .../java/net/minecraftforge/client/settings/KeyModifier.java | 3 ++- src/main/resources/assets/forge/lang/en_US.lang | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java index b5ff9a875a..c2183bd22a 100644 --- a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java +++ b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java @@ -31,7 +31,8 @@ public enum KeyModifier { public String getLocalizedComboName(int keyCode) { String keyName = GameSettings.getKeyDisplayString(keyCode); - return I18n.format("forge.controlsgui.control", keyName); + String localizationFormatKey = Minecraft.isRunningOnMac ? "forge.controlsgui.control.mac" : "forge.controlsgui.control"; + return I18n.format(localizationFormatKey, keyName); } }, SHIFT { diff --git a/src/main/resources/assets/forge/lang/en_US.lang b/src/main/resources/assets/forge/lang/en_US.lang index 4155a94a00..7c35d8e56d 100644 --- a/src/main/resources/assets/forge/lang/en_US.lang +++ b/src/main/resources/assets/forge/lang/en_US.lang @@ -145,6 +145,7 @@ fml.configgui.tooltip.defaultNumeric=[range: %s ~ %s, default: %s] forge.controlsgui.shift=SHIFT + %s forge.controlsgui.control=CTRL + %s +forge.controlsgui.control.mac=CMD + %s forge.controlsgui.alt=ALT + %s fml.menu.mods=Mods From 8fdd76bae1382368ac1e0bd1076db227a5f9c670 Mon Sep 17 00:00:00 2001 From: boni Date: Mon, 2 May 2016 21:19:54 +0200 Subject: [PATCH 231/243] Fix SidedInvWrapper accessing wrong slots for setStackInSlot. (#2797) Fix DoubleChestItemHandler not implementing IItemHandlerModifiable --- .../items/VanillaDoubleChestItemHandler.java | 18 +++++++++++++++++- .../items/wrapper/SidedInvWrapper.java | 5 ++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/items/VanillaDoubleChestItemHandler.java b/src/main/java/net/minecraftforge/items/VanillaDoubleChestItemHandler.java index 90232a6757..05839f6f3a 100644 --- a/src/main/java/net/minecraftforge/items/VanillaDoubleChestItemHandler.java +++ b/src/main/java/net/minecraftforge/items/VanillaDoubleChestItemHandler.java @@ -12,7 +12,7 @@ import java.lang.ref.WeakReference; import com.google.common.base.Objects; -public class VanillaDoubleChestItemHandler extends WeakReference implements IItemHandler +public class VanillaDoubleChestItemHandler extends WeakReference implements IItemHandlerModifiable { // Dummy cache value to signify that we have checked and definitely found no adjacent chests public static final VanillaDoubleChestItemHandler NO_ADJACENT_CHESTS_INSTANCE = new VanillaDoubleChestItemHandler(null, null, false); @@ -91,6 +91,22 @@ public class VanillaDoubleChestItemHandler extends WeakReference Date: Mon, 2 May 2016 14:13:33 -0700 Subject: [PATCH 232/243] Fix sluggish scrolling on GuiScrollList's and fix small rendering issue with scroll bar on certian screen sizes. --- .../minecraftforge/fml/client/GuiModList.java | 13 +++++++ .../fml/client/GuiScrollingList.java | 34 +++++++++++-------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/client/GuiModList.java b/src/main/java/net/minecraftforge/fml/client/GuiModList.java index 6d1e279a05..6ca185b66e 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiModList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiModList.java @@ -56,6 +56,7 @@ import net.minecraftforge.fml.common.versioning.ComparableVersion; import static net.minecraft.util.text.TextFormatting.*; import org.apache.logging.log4j.Level; +import org.lwjgl.input.Mouse; import com.google.common.base.Strings; @@ -312,6 +313,18 @@ public class GuiModList extends GuiScreen search.drawTextBox(); } + @Override + public void handleMouseInput() throws IOException + { + int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth; + int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; + + super.handleMouseInput(); + if (this.modInfo != null) + this.modInfo.handleMouseInput(mouseX, mouseY); + this.modList.handleMouseInput(mouseX, mouseY); + } + Minecraft getMinecraftInstance() { return mc; diff --git a/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java b/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java index eb210724a4..a2d4eb67a5 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java @@ -12,6 +12,7 @@ package net.minecraftforge.fml.client; +import java.io.IOException; import java.util.List; import net.minecraft.client.Minecraft; @@ -71,6 +72,7 @@ public abstract class GuiScrollingList this.screenHeight = screenHeight; } + @Deprecated // Unused, remove in 1.9.3? public void func_27258_a(boolean p_27258_1_) { this.highlightSelected = p_27258_1_; @@ -120,6 +122,7 @@ public abstract class GuiScrollingList */ protected void drawScreen(int mouseX, int mouseY) { func_27257_b(mouseX, mouseY); } + @Deprecated // Unused, Remove in 1.9.3? public int func_27256_c(int x, int y) { int left = this.left + 1; @@ -175,6 +178,21 @@ public abstract class GuiScrollingList } } + + public void handleMouseInput(int mouseX, int mouseY) throws IOException + { + boolean isHovering = mouseX >= this.left && mouseX <= this.left + this.listWidth && + mouseY >= this.top && mouseY <= this.bottom; + if (!isHovering) + return; + + int scroll = Mouse.getEventDWheel(); + if (scroll != 0) + { + this.scrollDistance += (float)((-1 * scroll / 120.0F) * this.slotHeight / 2); + } + } + public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.mouseX = mouseX; @@ -246,18 +264,6 @@ public abstract class GuiScrollingList } else { - while (isHovering && Mouse.next()) - { - int scroll = Mouse.getEventDWheel(); - if (scroll != 0) - { - if (scroll > 0) scroll = -1; - else if (scroll < 0) scroll = 1; - - this.scrollDistance += (float)(scroll * this.slotHeight / 2); - } - } - this.initialMouseClickY = -1.0F; } @@ -330,10 +336,10 @@ public abstract class GuiScrollingList GlStateManager.disableDepth(); - int extraHeight = this.getContentHeight() - viewHeight - border; + int extraHeight = (this.getContentHeight() + border) - viewHeight; if (extraHeight > 0) { - int height = viewHeight * viewHeight / this.getContentHeight(); + int height = (viewHeight * viewHeight) / this.getContentHeight(); if (height < 32) height = 32; From d9bdaef4683d20b0ccf2e785e89ff59122300fb3 Mon Sep 17 00:00:00 2001 From: bloodmc Date: Mon, 2 May 2016 17:21:37 -0400 Subject: [PATCH 233/243] Only run block physics for TileEntities while capturing block placement. (#2803) Currently, all blocks placed by players that are not TE's run physics twice. Blocks that contain a TileEntity are not affected due to a check in 'ForgeHooks.onPlaceItemIntoWorld'. In order to fix the problem, 'Chunk.setBlockState' will now verify if blocks are being captured before running onBlockAdded and if so, only run physics if the block has a tileentity. This check also prevents blocks such as TNT's from running its physics (explosion) when event is cancelled. --- .../minecraft/world/chunk/Chunk.java.patch | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index 71b1adeee5..e12fe8fab1 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -64,12 +64,14 @@ if (j1 > 0) { -@@ -595,28 +600,18 @@ +@@ -595,28 +600,19 @@ } } - if (block1 instanceof ITileEntityProvider) -- { ++ // If capturing blocks, only run block physics for TE's. Non-TE's are handled in ForgeHooks.onPlaceItemIntoWorld ++ if (!this.field_76637_e.field_72995_K && block1 != block && (!this.field_76637_e.captureBlockSnapshots || block.hasTileEntity(p_177436_2_))) + { - TileEntity tileentity = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); - - if (tileentity != null) @@ -78,8 +80,8 @@ - } - } - - if (!this.field_76637_e.field_72995_K && block1 != block) - { +- if (!this.field_76637_e.field_72995_K && block1 != block) +- { block.func_176213_c(this.field_76637_e, p_177436_1_, p_177436_2_); } @@ -95,7 +97,7 @@ this.field_76637_e.func_175690_a(p_177436_1_, tileentity1); } -@@ -719,6 +714,7 @@ +@@ -719,6 +715,7 @@ k = this.field_76645_j.length - 1; } @@ -103,7 +105,7 @@ p_76612_1_.field_70175_ag = true; p_76612_1_.field_70176_ah = this.field_76635_g; p_76612_1_.field_70162_ai = k; -@@ -758,13 +754,19 @@ +@@ -758,13 +755,19 @@ { IBlockState iblockstate = this.func_177435_g(p_177422_1_); Block block = iblockstate.func_177230_c(); @@ -124,7 +126,7 @@ if (tileentity == null) { if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) -@@ -774,14 +776,9 @@ +@@ -774,14 +777,9 @@ } else if (p_177424_2_ == Chunk.EnumCreateEntityType.QUEUED) { @@ -140,7 +142,7 @@ return tileentity; } -@@ -801,7 +798,7 @@ +@@ -801,7 +799,7 @@ p_177426_2_.func_145834_a(this.field_76637_e); p_177426_2_.func_174878_a(p_177426_1_); @@ -149,7 +151,7 @@ { if (this.field_150816_i.containsKey(p_177426_1_)) { -@@ -810,6 +807,7 @@ +@@ -810,6 +808,7 @@ p_177426_2_.func_145829_t(); this.field_150816_i.put(p_177426_1_, p_177426_2_); @@ -157,7 +159,7 @@ } } -@@ -838,8 +836,9 @@ +@@ -838,8 +837,9 @@ entity.func_110123_P(); } @@ -168,7 +170,7 @@ } public void func_76623_d() -@@ -855,6 +854,7 @@ +@@ -855,6 +855,7 @@ { this.field_76637_e.func_175681_c(this.field_76645_j[i]); } @@ -176,7 +178,7 @@ } public void func_76630_e() -@@ -864,8 +864,8 @@ +@@ -864,8 +865,8 @@ public void func_177414_a(Entity p_177414_1_, AxisAlignedBB p_177414_2_, List p_177414_3_, Predicate p_177414_4_) { @@ -187,7 +189,7 @@ i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1); j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1); -@@ -904,8 +904,8 @@ +@@ -904,8 +905,8 @@ public void func_177430_a(Class p_177430_1_, AxisAlignedBB p_177430_2_, List p_177430_3_, Predicate p_177430_4_) { @@ -198,7 +200,7 @@ i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1); j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1); -@@ -994,6 +994,7 @@ +@@ -994,6 +995,7 @@ { this.func_150809_p(); p_186034_1_.func_185931_b(this.field_76635_g, this.field_76647_h); @@ -206,7 +208,7 @@ this.func_76630_e(); } } -@@ -1050,7 +1051,7 @@ +@@ -1050,7 +1052,7 @@ { BlockPos blockpos = (BlockPos)this.field_177447_w.poll(); @@ -215,7 +217,7 @@ { TileEntity tileentity = this.func_177422_i(blockpos); this.field_76637_e.func_175690_a(blockpos, tileentity); -@@ -1114,6 +1115,13 @@ +@@ -1114,6 +1116,13 @@ @SideOnly(Side.CLIENT) public void func_186033_a(PacketBuffer p_186033_1_, int p_186033_2_, boolean p_186033_3_) { @@ -229,7 +231,7 @@ boolean flag = !this.field_76637_e.field_73011_w.func_177495_o(); for (int i = 0; i < this.field_76652_q.length; ++i) -@@ -1162,10 +1170,16 @@ +@@ -1162,10 +1171,16 @@ this.field_76646_k = true; this.func_76590_a(); @@ -246,7 +248,7 @@ } public BiomeGenBase func_177411_a(BlockPos p_177411_1_, BiomeProvider p_177411_2_) -@@ -1233,13 +1247,13 @@ +@@ -1233,13 +1248,13 @@ BlockPos blockpos1 = blockpos.func_177982_a(k, (j << 4) + i1, l); boolean flag = i1 == 0 || i1 == 15 || k == 0 || k == 15 || l == 0 || l == 15; @@ -262,7 +264,7 @@ { this.field_76637_e.func_175664_x(blockpos2); } -@@ -1370,7 +1384,7 @@ +@@ -1370,7 +1385,7 @@ { blockpos$mutableblockpos.func_181079_c(blockpos$mutableblockpos.func_177958_n(), l, blockpos$mutableblockpos.func_177952_p()); @@ -271,7 +273,7 @@ { this.field_76637_e.func_175664_x(blockpos$mutableblockpos); } -@@ -1481,4 +1495,20 @@ +@@ -1481,4 +1496,20 @@ QUEUED, CHECK; } From 9f28c903650e25655c7a70889ebec50d2b462e61 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Mon, 2 May 2016 16:44:14 -0500 Subject: [PATCH 234/243] Add Potion.renderHUDEffect (#2798) --- .../minecraft/client/gui/GuiIngame.java.patch | 23 +++++++++++++++ .../net/minecraft/potion/Potion.java.patch | 26 ++++++++++++++++- .../debug/PotionRegistryDebug.java | 28 +++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch index fea4f60669..9d96734bcd 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch @@ -10,3 +10,26 @@ { return; } +@@ -418,7 +419,10 @@ + { + Potion potion = potioneffect.func_188419_a(); + +- if (potion.func_76400_d() && potioneffect.func_188418_e()) ++ if (!potion.shouldRenderHUD(potioneffect)) continue; ++ // Rebind in case previous renderHUDEffect changed texture ++ this.field_73839_d.func_110434_K().func_110577_a(GuiContainer.field_147001_a); ++ if (potioneffect.func_188418_e()) + { + int k = p_184048_1_.func_78326_a(); + int l = 1; +@@ -455,7 +459,10 @@ + } + + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, f); ++ // FORGE - Move status icon check down from above so renderHUDEffect will still be called without a status icon ++ if (potion.func_76400_d()) + this.func_73729_b(k + 3, l + 3, i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18); ++ potion.renderHUDEffect(k, l, potioneffect, field_73839_d, f); + } + } + } diff --git a/patches/minecraft/net/minecraft/potion/Potion.java.patch b/patches/minecraft/net/minecraft/potion/Potion.java.patch index 9385f031ca..438c3e5d6e 100644 --- a/patches/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches/minecraft/net/minecraft/potion/Potion.java.patch @@ -20,7 +20,7 @@ public boolean func_76398_f() { return this.field_76418_K; -@@ -266,7 +265,37 @@ +@@ -266,7 +265,61 @@ return p_111183_2_.func_111164_d() * (double)(p_111183_1_ + 1); } @@ -44,6 +44,16 @@ + } + + /** ++ * If the Potion effect should be displayed in the player's ingame HUD ++ * @param effect the active PotionEffect ++ * @return true to display it (default), false to hide it. ++ */ ++ public boolean shouldRenderHUD(PotionEffect effect) ++ { ++ return true; ++ } ++ ++ /** + * Called to draw the this Potion onto the player's inventory when it's active. + * This can be used to e.g. render Potion icons from your own texture. + * @param x the x coordinate @@ -54,6 +64,20 @@ @SideOnly(Side.CLIENT) + public void renderInventoryEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc) { } + ++ /** ++ * Called to draw the this Potion onto the player's ingame HUD when it's active. ++ * This can be used to e.g. render Potion icons from your own texture. ++ * @param x the x coordinate ++ * @param y the y coordinate ++ * @param effect the active PotionEffect ++ * @param mc the Minecraft instance, for convenience ++ * @param alpha the alpha value, blinks when the potion is about to run out ++ */ ++ @SideOnly(Side.CLIENT) ++ public void renderHUDEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc, float alpha) { } ++ ++ /* ======================================== FORGE END =====================================*/ ++ + @SideOnly(Side.CLIENT) public boolean func_188408_i() { diff --git a/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java b/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java index da9cfb182f..6bfb4e5930 100644 --- a/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java +++ b/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java @@ -84,5 +84,33 @@ public class PotionRegistryDebug { buf.pos((double) x, (double) y, 0.0D).tex(sprite.getMinU(), sprite.getMinV()).endVertex(); tessellator.draw(); } + + @Override + public void renderHUDEffect(int x, int y, PotionEffect effect, Minecraft mc, float alpha) { + Potion potion = effect.getPotion(); + + mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite("minecraft:blocks/tnt_side"); + + x += 3; + y += 3; + + int width = 18; + int height = width; + + float r = (float)(potion.getLiquidColor() >> 24 & 255) / 255.0F; + float g = (float)(potion.getLiquidColor() >> 16 & 255) / 255.0F; + float b = (float)(potion.getLiquidColor() >> 8 & 255) / 255.0F; + + Tessellator tessellator = Tessellator.getInstance(); + VertexBuffer buf = tessellator.getBuffer(); + buf.begin(7, DefaultVertexFormats.POSITION_TEX); + GlStateManager.color(r, g, b, alpha); + buf.pos((double) x, (double)(y + height), 0.0D).tex(sprite.getMinU(), sprite.getMaxV()).endVertex(); + buf.pos((double)(x + width), (double)(y + height), 0.0D).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex(); + buf.pos((double)(x + width), (double) y, 0.0D).tex(sprite.getMaxU(), sprite.getMinV()).endVertex(); + buf.pos((double) x, (double) y, 0.0D).tex(sprite.getMinU(), sprite.getMinV()).endVertex(); + tessellator.draw(); + } } } From 5a20950902696c4b9c7895b8b1145cbc2d331883 Mon Sep 17 00:00:00 2001 From: bloodmc Date: Mon, 2 May 2016 18:21:59 -0400 Subject: [PATCH 235/243] Call markDirty when restoring blocks with TileEntities. (#2809) This change makes sure the updated tileentity is saved properly within the chunk. --- src/main/java/net/minecraftforge/common/util/BlockSnapshot.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java index dd6bbe2e01..6df3e7d310 100644 --- a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java +++ b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java @@ -178,6 +178,7 @@ public class BlockSnapshot implements Serializable if (te != null) { te.readFromNBT(getNbt()); + te.markDirty(); } } @@ -213,6 +214,7 @@ public class BlockSnapshot implements Serializable if (te != null) { te.readFromNBT(getNbt()); + te.markDirty(); } } From 980845b61bc13cede5b5437b06afe8fab14e67b6 Mon Sep 17 00:00:00 2001 From: AlexIIL Date: Tue, 3 May 2016 07:07:49 +0100 Subject: [PATCH 236/243] Fix TextureMap failing when registering a sprite's resource location twice (#2785) --- .../client/renderer/texture/TextureMap.java.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index f7fad50b17..4622bff373 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -145,6 +145,15 @@ try { iresource = p_184397_1_.func_110536_a(resourcelocation); +@@ -291,7 +336,7 @@ + } + else + { +- TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.field_110574_e.get(p_174942_1_); ++ TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.field_110574_e.get(p_174942_1_.toString()); + + if (textureatlassprite == null) + { @@ -317,4 +362,37 @@ { return this.field_94249_f; From 330812dfa8c417cd5d750097fb93543d3d89f627 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 3 May 2016 09:53:55 +0300 Subject: [PATCH 237/243] Fixed custom fluid sufraces not rendering from the bottom. Closes #2800. --- .../client/model/ModelFluid.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index b3039a6073..1b56a62604 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -209,18 +209,25 @@ public final class ModelFluid implements IModelCustomData float s = MathHelper.sin(flow) * scale; EnumFacing side = gas ? EnumFacing.DOWN : EnumFacing.UP; - UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); - builder.setQuadOrientation(side); - builder.setTexture(topSprite); - for(int i = gas ? 3 : 0; i != (gas ? -1 : 4); i+= (gas ? -1 : 1)) + UnpackedBakedQuad.Builder builder; + ImmutableList.Builder topFaceBuilder = ImmutableList.builder(); + for(int k = 0; k < 2; k++) { - putVertex( - builder, side, - x[i], y[i], z[i], - topSprite.getInterpolatedU(8 + c * (x[i] * 2 - 1) + s * (z[i] * 2 - 1)), - topSprite.getInterpolatedV(8 + c * (x[(i + 1) % 4] * 2 - 1) + s * (z[(i + 1) % 4] * 2 - 1))); + builder = new UnpackedBakedQuad.Builder(format); + builder.setQuadOrientation(side); + builder.setTexture(topSprite); + for (int i = gas ? 3 : 0; i != (gas ? -1 : 4); i += (gas ? -1 : 1)) + { + int l = (k * 3) + (1 - 2 * k) * i; + putVertex( + builder, side, + x[l], y[l], z[l], + topSprite.getInterpolatedU(8 + c * (x[l] * 2 - 1) + s * (z[l] * 2 - 1)), + topSprite.getInterpolatedV(8 + c * (x[(l + 1) % 4] * 2 - 1) + s * (z[(l + 1) % 4] * 2 - 1))); + } + topFaceBuilder.add(builder.build()); } - faceQuads.put(side, ImmutableList.of(builder.build())); + faceQuads.put(side, topFaceBuilder.build()); // bottom From f3fdf4303a21e428a1c90dc894607af8f5374f50 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 3 May 2016 10:28:06 +0300 Subject: [PATCH 238/243] Make ChunkRenderDispatcher.countRenderBuilders configurable. Closes #2775. --- .../chunk/ChunkRenderDispatcher.java.patch | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch new file mode 100644 index 0000000000..4881014860 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java +@@ -43,9 +43,15 @@ + + public ChunkRenderDispatcher() + { ++ this(-1); ++ } ++ ++ public ChunkRenderDispatcher(int countRenderBuilders) ++ { + int i = Math.max(1, (int)((double)Runtime.getRuntime().maxMemory() * 0.3D) / 10485760); + int j = Math.max(1, MathHelper.func_76125_a(Runtime.getRuntime().availableProcessors(), 1, i / 5)); +- this.field_188249_c = MathHelper.func_76125_a(j * 10, 1, i); ++ if(countRenderBuilders < 0) countRenderBuilders = MathHelper.func_76125_a(j * 10, 1, i); ++ this.field_188249_c = countRenderBuilders; + + if (j > 1) + { From 4538062e7064af7d9876100e632919c0bdf6dd13 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 3 May 2016 11:03:30 +0300 Subject: [PATCH 239/243] Fixed cooldown overlay sometimes rendering opaque. Closes #2772. --- .../client/renderer/RenderItem.java.patch | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderItem.java.patch index fefb800f5e..e4a020fc9f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderItem.java.patch @@ -63,8 +63,13 @@ this.func_180454_a(p_184390_1_, p_184390_4_); GlStateManager.func_179118_c(); GlStateManager.func_179101_C(); -@@ -426,10 +411,11 @@ +@@ -424,12 +409,16 @@ + p_180453_1_.func_175063_a(s, (float)(p_180453_3_ + 19 - 2 - p_180453_1_.func_78256_a(s)), (float)(p_180453_4_ + 6 + 3), 16777215); + GlStateManager.func_179145_e(); GlStateManager.func_179126_j(); ++ // Fixes opaque cooldown overlay a bit lower ++ // TODO: check if enabled blending still screws things up down the line. ++ GlStateManager.func_179147_l(); } - if (p_180453_2_.func_77951_h()) @@ -78,16 +83,7 @@ GlStateManager.func_179140_f(); GlStateManager.func_179097_i(); GlStateManager.func_179090_x(); -@@ -440,7 +426,7 @@ - this.func_181565_a(vertexbuffer, p_180453_3_ + 2, p_180453_4_ + 13, 13, 2, 0, 0, 0, 255); - this.func_181565_a(vertexbuffer, p_180453_3_ + 2, p_180453_4_ + 13, 12, 1, (255 - i) / 4, 64, 0, 255); - this.func_181565_a(vertexbuffer, p_180453_3_ + 2, p_180453_4_ + 13, j, 1, 255 - i, i, 0, 255); -- GlStateManager.func_179147_l(); -+ //GlStateManager.enableBlend(); // Forge: Disable Blend because it screws with a lot of things down the line. - GlStateManager.func_179141_d(); - GlStateManager.func_179098_w(); - GlStateManager.func_179145_e(); -@@ -1053,6 +1039,7 @@ +@@ -1053,6 +1042,7 @@ this.func_175029_a(Blocks.field_185779_df, TileEntityStructure.Mode.LOAD.func_185110_a(), "structure_block"); this.func_175029_a(Blocks.field_185779_df, TileEntityStructure.Mode.CORNER.func_185110_a(), "structure_block"); this.func_175029_a(Blocks.field_185779_df, TileEntityStructure.Mode.DATA.func_185110_a(), "structure_block"); From e98cd386e033d1ea68a96d2d763593b0a4ca26b0 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 3 May 2016 11:39:14 +0300 Subject: [PATCH 240/243] Fixed villager profession not being set correctly on the client, and fixed custom village texture rendering. Closes #2766. --- .../renderer/entity/RenderVillager.java.patch | 26 ++++++++++++++----- .../entity/passive/EntityVillager.java.patch | 22 ++++++++++++---- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch index 81ae5201a0..4b0720edfa 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch @@ -1,11 +1,25 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java -@@ -44,7 +44,7 @@ - case 4: - return field_110906_m; - default: +@@ -31,21 +31,7 @@ + + protected ResourceLocation func_110775_a(EntityVillager p_110775_1_) + { +- switch (p_110775_1_.func_70946_n()) +- { +- case 0: +- return field_110904_g; +- case 1: +- return field_110908_h; +- case 2: +- return field_110907_k; +- case 3: +- return field_110905_l; +- case 4: +- return field_110906_m; +- default: - return field_110903_f; -+ return p_110775_1_.getProfessionForge().getSkin(); - } +- } ++ return p_110775_1_.getProfessionForge().getSkin(); } + protected void func_77041_b(EntityVillager p_77041_1_, float p_77041_2_) diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch index 54cc5b167f..f6a41feba6 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -63,7 +63,7 @@ } public int func_70946_n() -@@ -334,6 +347,27 @@ +@@ -334,6 +347,39 @@ return Math.max(((Integer)this.field_70180_af.func_187225_a(field_184752_bw)).intValue() % 5, 0); } @@ -87,11 +87,23 @@ + } + return this.prof; + } ++ ++ @Override ++ public void func_184206_a(DataParameter key) ++ { ++ super.func_184206_a(key); ++ if(key == PROFESSION_STR) ++ { ++ String p = this.field_70180_af.func_187225_a(PROFESSION_STR); ++ net.minecraft.util.ResourceLocation res = new net.minecraft.util.ResourceLocation(p == null ? "minecraft:farmer" : p); ++ this.prof = net.minecraftforge.fml.common.registry.VillagerRegistry.instance().getRegistry().getValue(res); ++ } ++ } + public boolean func_70941_o() { return this.field_70952_f; -@@ -533,15 +567,13 @@ +@@ -533,15 +579,13 @@ private void func_175554_cu() { @@ -108,7 +120,7 @@ this.field_175562_bw = 1; } -@@ -552,7 +584,7 @@ +@@ -552,7 +596,7 @@ int i = this.field_175563_bv - 1; int j = this.field_175562_bw - 1; @@ -117,7 +129,7 @@ if (j >= 0 && j < aentityvillager$itradelist1.length) { -@@ -647,9 +679,14 @@ +@@ -647,9 +691,14 @@ } } @@ -133,7 +145,7 @@ textcomponenttranslation.func_150256_b().func_150209_a(this.func_174823_aP()); textcomponenttranslation.func_150256_b().func_179989_a(this.func_110124_au().toString()); -@@ -708,7 +745,7 @@ +@@ -708,7 +757,7 @@ public IEntityLivingData func_180482_a(DifficultyInstance p_180482_1_, IEntityLivingData p_180482_2_) { p_180482_2_ = super.func_180482_a(p_180482_1_, p_180482_2_); From 4d27393c91c503fd30fae9a6e0b28c35285c31ba Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 3 May 2016 16:13:17 -0700 Subject: [PATCH 241/243] Fix withers breaking bedrock. Closes #2813 --- .../minecraft/net/minecraft/entity/boss/EntityWither.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch index a3c0f02035..dcbec8406c 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch @@ -5,7 +5,7 @@ Block block = iblockstate.func_177230_c(); - if (iblockstate.func_185904_a() != Material.field_151579_a && func_181033_a(block)) -+ if (!block.isAir(iblockstate, this.field_70170_p, blockpos)) ++ if (!block.isAir(iblockstate, this.field_70170_p, blockpos) && block.canEntityDestroy(iblockstate, field_70170_p, blockpos, this)) { flag = this.field_70170_p.func_175655_b(blockpos, true) || flag; } From d8249b7886ebcc37e53cfae9ae8f52ab79a0ee3d Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 3 May 2016 18:26:52 -0700 Subject: [PATCH 242/243] Add a java version detection and nag system for users on Java 7 or below. Added detection of mods that rely on Java 8 and a graceful error screen. The nag screen will be shown once a day. It can be disabled by editing the forge.cfg. However it is HIGHLY recomended that user update to Java 8. --- .../client/gui/GuiMainMenu.java.patch | 23 ++- .../client/ForgeHooksClient.java | 37 ++++- .../common/ForgeModContainer.java | 14 ++ .../common/config/Property.java | 58 +++++++- .../fml/client/FMLClientHandler.java | 29 +++- .../fml/client/GuiJava8Error.java | 140 ++++++++++++++++++ .../fml/common/DummyModContainer.java | 13 ++ .../fml/common/FMLModContainer.java | 13 ++ .../fml/common/InjectedModContainer.java | 12 ++ .../fml/common/Java8VersionException.java | 43 ++++++ .../net/minecraftforge/fml/common/Loader.java | 28 ++++ .../fml/common/ModContainer.java | 4 + .../fml/common/discovery/ASMDataTable.java | 1 + .../fml/common/discovery/JarDiscoverer.java | 1 + .../resources/assets/forge/lang/en_US.lang | 18 ++- 15 files changed, 416 insertions(+), 18 deletions(-) create mode 100644 src/main/java/net/minecraftforge/fml/client/GuiJava8Error.java create mode 100644 src/main/java/net/minecraftforge/fml/common/Java8VersionException.java diff --git a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch index 4ffa6d84a8..22dec2e57b 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch @@ -38,7 +38,16 @@ if (p_146284_1_.field_146127_k == 11) { this.field_146297_k.func_71371_a("Demo_World", "Demo_World", DemoWorldServer.field_73071_a); -@@ -512,7 +521,16 @@ +@@ -493,6 +502,8 @@ + this.func_73729_b(j + 155, k + 0, 0, 45, 155, 44); + } + ++ this.field_73975_c = net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.field_146289_q, this.field_146294_l, this.field_146295_m, this.field_73975_c); ++ + GlStateManager.func_179094_E(); + GlStateManager.func_179109_b((float)(this.field_146294_l / 2 + 90), 70.0F, 0.0F); + GlStateManager.func_179114_b(-20.0F, 0.0F, 0.0F, 1.0F); +@@ -512,7 +523,15 @@ s = s + ("release".equalsIgnoreCase(this.field_146297_k.func_184123_d()) ? "" : "/" + this.field_146297_k.func_184123_d()); } @@ -52,11 +61,10 @@ + this.func_73731_b(this.field_146289_q, brd, 2, this.field_146295_m - ( 10 + brdline * (this.field_146289_q.field_78288_b + 1)), 16777215); + } + } -+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.field_146289_q, this.field_146294_l, this.field_146295_m); String s1 = "Copyright Mojang AB. Do not distribute!"; this.func_73731_b(this.field_146289_q, s1, this.field_146294_l - this.field_146289_q.func_78256_a(s1) - 2, this.field_146295_m - 10, -1); -@@ -529,6 +547,7 @@ +@@ -529,6 +548,7 @@ { this.field_183503_M.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_); } @@ -64,3 +72,12 @@ } protected void func_73864_a(int p_73864_1_, int p_73864_2_, int p_73864_3_) throws IOException +@@ -549,6 +569,8 @@ + { + this.field_183503_M.func_73864_a(p_73864_1_, p_73864_2_, p_73864_3_); + } ++ ++ net.minecraftforge.client.ForgeHooksClient.mainMenuMouseClick(p_73864_1_, p_73864_2_, p_73864_3_, this.field_146289_q, this.field_146294_l); + } + + public void func_146281_b() diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 9f628dd504..a0b60506a1 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -8,6 +8,7 @@ import static org.lwjgl.opengl.GL20.*; import java.nio.ByteBuffer; import java.nio.FloatBuffer; +import java.util.Collections; import java.util.Map; import javax.vecmath.Matrix3f; @@ -89,8 +90,12 @@ import net.minecraftforge.common.model.IModelPart; import net.minecraftforge.common.model.ITransformation; import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.fml.client.FMLClientHandler; +import net.minecraftforge.fml.client.GuiJava8Error; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.Java8VersionException; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModContainer; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.BufferUtils; @@ -266,7 +271,8 @@ public class ForgeHooksClient //RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance); } - public static void renderMainMenu(GuiMainMenu gui, FontRenderer font, int width, int height) + private static int updatescrollcounter = 0; + public static String renderMainMenu(GuiMainMenu gui, FontRenderer font, int width, int height, String splashText) { Status status = ForgeVersion.getStatus(); if (status == BETA || status == BETA_OUTDATED) @@ -278,6 +284,17 @@ public class ForgeHooksClient gui.drawString(font, line, (width - font.getStringWidth(line)) / 2, 4 + (1 * (font.FONT_HEIGHT + 1)), -1); } + if (!Loader.instance().java8) + { + String line = I18n.format("fml.messages.java8warning.1", TextFormatting.RED, TextFormatting.RESET); + gui.drawString(font, line, (width - font.getStringWidth(line)) / 2, 4 + (8 * (font.FONT_HEIGHT + 1)), -1); + line = I18n.format("fml.messages.java8warning.2"); + gui.drawString(font, line, (width - font.getStringWidth(line)) / 2, 4 + (9 * (font.FONT_HEIGHT + 1)), -1); + splashText = updatescrollcounter < 50 ? "UPDATE!" : "JAVA!"; + updatescrollcounter+=1; + updatescrollcounter%=100; + } + String line = null; switch(status) { @@ -294,6 +311,24 @@ public class ForgeHooksClient // if we have a line, render it in the bottom right, above Mojang's copyright line gui.drawString(font, line, width - font.getStringWidth(line) - 2, height - (2 * (font.FONT_HEIGHT + 1)), -1); } + + return splashText; + } + + public static void mainMenuMouseClick(int mouseX, int mouseY, int mouseButton, FontRenderer font, int width) + { + if (!Loader.instance().java8) + { + if (mouseY >= (4 + (8 * 10)) && mouseY < (4 + (10 * 10))) + { + int w = font.getStringWidth(I18n.format("fml.messages.java8warning.1", TextFormatting.RED, TextFormatting.RESET)); + w = Math.max(w, font.getStringWidth(I18n.format("fml.messages.java8warning.2"))); + if (mouseX >= ((width - w) / 2) && mouseX <= ((width + w) / 2)) + { + FMLClientHandler.instance().showGuiScreen(new GuiJava8Error(new Java8VersionException(Collections.emptyList()))); + } + } + } } public static ISound playSound(SoundManager manager, ISound sound) diff --git a/src/main/java/net/minecraftforge/common/ForgeModContainer.java b/src/main/java/net/minecraftforge/common/ForgeModContainer.java index d4a61a4ad5..b18562cdf4 100644 --- a/src/main/java/net/minecraftforge/common/ForgeModContainer.java +++ b/src/main/java/net/minecraftforge/common/ForgeModContainer.java @@ -14,6 +14,7 @@ import java.net.URL; import java.security.cert.Certificate; import java.util.ArrayList; import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.Map; @@ -74,6 +75,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC public static boolean defaultHasSpawnFuzz = true; public static boolean forgeLightPipelineEnabled = true; public static boolean replaceVanillaBucketModel = true; + public static long java8Reminder = 0; private static Configuration config; private static ForgeModContainer INSTANCE; @@ -259,6 +261,11 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC replaceVanillaBucketModel = prop.getBoolean(Boolean.FALSE); propOrder.add(prop.getName()); + prop = config.get(Configuration.CATEGORY_CLIENT, "java8Reminder", java8Reminder, + "The timestamp of the last reminder to update to Java 8 in number of milliseconds since January 1, 1970, 00:00:00 GMT. Nag will show only once every 24 hours. To disable it set this to some really high number."); + java8Reminder = prop.getLong(java8Reminder); + propOrder.add(prop.getName()); + config.setCategoryPropertyOrder(CATEGORY_CLIENT, propOrder); if (config.hasChanged()) @@ -267,6 +274,13 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC } } + public static void updateNag() + { + Property prop = config.get(Configuration.CATEGORY_CLIENT, "java8Reminder", java8Reminder); + prop.set((new Date()).getTime()); + config.save(); + } + /** * By subscribing to the OnConfigChangedEvent we are able to execute code when our config screens are closed. * This implementation uses the optional configID string to handle multiple Configurations using one event handler. diff --git a/src/main/java/net/minecraftforge/common/config/Property.java b/src/main/java/net/minecraftforge/common/config/Property.java index db85afed2b..d42bbad48a 100644 --- a/src/main/java/net/minecraftforge/common/config/Property.java +++ b/src/main/java/net/minecraftforge/common/config/Property.java @@ -680,14 +680,7 @@ public class Property */ public int getInt() { - try - { - return Integer.parseInt(value); - } - catch (NumberFormatException e) - { - return Integer.parseInt(defaultValue); - } + return getInt(Integer.parseInt(defaultValue)); } /** @@ -727,6 +720,54 @@ public class Property } } + /** + * Returns the value in this property as a long, + * if the value is not a valid long, it will return the initially provided default. + * + * @return The value + */ + public long getLong() + { + return getLong(Long.parseLong(defaultValue)); + } + + /** + * Returns the value in this property as a long, + * if the value is not a valid long, it will return the + * provided default. + * + * @param _default The default to provide if the current value is not a validlong + * @return The value + */ + public long getLong(long _default) + { + try + { + return Long.parseLong(value); + } + catch (NumberFormatException e) + { + return _default; + } + } + + /** + * Checks if the current value stored in this property can be converted to a long. + * @return True if the type of the Property is an Long + */ + public boolean isLongValue() + { + try + { + Long.parseLong(value); + return true; + } + catch (NumberFormatException e) + { + return false; + } + } + /** * Returns the value in this property as a boolean, * if the value is not a valid boolean, it will return the @@ -1148,6 +1189,7 @@ public class Property this.setValues(values); } public void set(int value){ set(Integer.toString(value)); } + public void set(long value){ set(Long.toString(value)); } public void set(boolean value){ set(Boolean.toString(value)); } public void set(double value){ set(Double.toString(value)); } } diff --git a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java index 19e8d0b062..87019d1575 100644 --- a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java +++ b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java @@ -19,6 +19,7 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -69,6 +70,7 @@ import net.minecraft.util.StringUtils; import net.minecraft.world.WorldSettings; import net.minecraft.world.storage.SaveFormatComparator; import net.minecraft.world.storage.SaveFormatOld; +import net.minecraftforge.common.ForgeModContainer; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.DummyModContainer; import net.minecraftforge.fml.common.DuplicateModsFoundException; @@ -76,6 +78,7 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLContainerHolder; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.IFMLSidedHandler; +import net.minecraftforge.fml.common.Java8VersionException; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.LoaderException; import net.minecraftforge.fml.common.MetadataCollection; @@ -158,6 +161,8 @@ public class FMLClientHandler implements IFMLSidedHandler private boolean loading = true; + private Java8VersionException j8onlymods; + private WrongMinecraftVersionException wrongMC; private CustomModLoadingErrorDisplayException customError; @@ -212,6 +217,10 @@ public class FMLClientHandler implements IFMLSidedHandler { dupesFound = dupes; } + catch (Java8VersionException j8mods) + { + j8onlymods = j8mods; + } catch (MissingModsException missing) { modsMissing = missing; @@ -297,7 +306,7 @@ public class FMLClientHandler implements IFMLSidedHandler */ public void finishMinecraftLoading() { - if (modsMissing != null || wrongMC != null || customError!=null || dupesFound!=null || modSorting!=null) + if (modsMissing != null || wrongMC != null || customError!=null || dupesFound!=null || modSorting!=null || j8onlymods!=null) { SplashProgress.finish(); return; @@ -344,6 +353,8 @@ public class FMLClientHandler implements IFMLSidedHandler } loading = false; client.gameSettings.loadOptions(); //Reload options to load any mod added keybindings. + Loader.instance().loadingComplete(); + SplashProgress.finish(); } public void extendModList() @@ -383,6 +394,10 @@ public class FMLClientHandler implements IFMLSidedHandler { showGuiScreen(new GuiWrongMinecraft(wrongMC)); } + else if (j8onlymods != null) + { + showGuiScreen(new GuiJava8Error(j8onlymods)); + } else if (modsMissing != null) { showGuiScreen(new GuiModsMissing(modsMissing)); @@ -401,10 +416,16 @@ public class FMLClientHandler implements IFMLSidedHandler } else { - Loader.instance().loadingComplete(); - SplashProgress.finish(); + logMissingTextureErrors(); + if (!Loader.instance().java8) + { + if ((new Date()).getTime() >= ForgeModContainer.java8Reminder + (1000 * 60 * 60 * 24)) + { + showGuiScreen(new GuiJava8Error(new Java8VersionException(Collections.emptyList()))); + ForgeModContainer.updateNag(); + } + } } - logMissingTextureErrors(); } /** * Get the server instance diff --git a/src/main/java/net/minecraftforge/fml/client/GuiJava8Error.java b/src/main/java/net/minecraftforge/fml/client/GuiJava8Error.java new file mode 100644 index 0000000000..af3071d4fc --- /dev/null +++ b/src/main/java/net/minecraftforge/fml/client/GuiJava8Error.java @@ -0,0 +1,140 @@ +/* + * Forge Mod Loader + * Copyright (c) 2012-2013 cpw. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v2.1 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * + * Contributors: + * cpw - implementation + */ + +package net.minecraftforge.fml.client; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiErrorScreen; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.text.TextFormatting; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.Java8VersionException; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModContainer; +import org.apache.logging.log4j.Level; + +import com.google.common.collect.Lists; + +import java.awt.*; +import java.io.IOException; +import java.net.URI; +import java.util.List; + +public class GuiJava8Error extends GuiErrorScreen +{ + private Java8VersionException java8VersionException; + public GuiJava8Error(Java8VersionException java8VersionException) + { + super(null,null); + this.java8VersionException = java8VersionException; + } + + @Override + public void initGui() + { + this.buttonList.clear(); + this.buttonList.add(new GuiButton(1, 50, this.height - 38, this.width/2 -55, 20, I18n.format("fml.button.visitjavadownloads"))); + if (java8VersionException.getMods().isEmpty()) + { + this.buttonList.add(new GuiButton(3, this.width / 2 + 5, this.height - 38, this.width / 2 - 55, 20, I18n.format("fml.button.continue"))); + } + else + { + this.buttonList.add(new GuiButton(2, this.width / 2 + 5, this.height - 38, this.width / 2 - 55, 20, I18n.format("menu.quit"))); + } + } + + @Override + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.id == 1) + { + try + { + Desktop.getDesktop().browse(new URI("http://www.oracle.com/technetwork/java/javase/downloads/index.html")); + } + catch (Exception e) + { + FMLLog.log(Level.ERROR, e, "Problem launching browser"); + } + } + else if (button.id == 2) + { + FMLCommonHandler.instance().exitJava(1,true); + } + else if (button.id == 3) + { + FMLClientHandler.instance().showGuiScreen(null); + } + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + int offset = 25; + if (!java8VersionException.getMods().isEmpty()) + { + this.drawCenteredString(this.fontRendererObj, I18n.format("fml.messages.java8problem", TextFormatting.RED, TextFormatting.BOLD, TextFormatting.RESET), this.width / 2, offset, 0xFFFFFF); + } + else + { + this.drawCenteredString(this.fontRendererObj, I18n.format("fml.messages.java8recommended", TextFormatting.RED, TextFormatting.BOLD, TextFormatting.RESET), this.width / 2, offset, 0xFFFFFF); + } + offset+=15; + this.drawCenteredString(this.fontRendererObj, I18n.format("fml.messages.javaversion", System.getProperty("java.version").split("\\.")[1], System.getProperty("java.version")), this.width / 2, offset, 0xFFFFFF); + offset += 10; + if (!java8VersionException.getMods().isEmpty()) + { + this.drawCenteredString(this.fontRendererObj, I18n.format("fml.messages.upgradejavaorremove", TextFormatting.RED,TextFormatting.BOLD, TextFormatting.RESET), this.width / 2, offset, 0xFFFFFF); + offset += 15; + this.drawCenteredString(this.fontRendererObj, I18n.format("fml.messages.modslistedbelow", I18n.format("fml.messages.requirejava8")), this.width / 2, offset, 0xFFFFFF); + offset += 10; + this.drawCenteredString(this.fontRendererObj, I18n.format("fml.messages.countbadandgood", java8VersionException.getMods().size(), Loader.instance().getActiveModList().size()), this.width / 2, offset, 0xFFFFFF); + offset += 5; + for (ModContainer mc : java8VersionException.getMods()) + { + offset += 10; + this.drawCenteredString(this.fontRendererObj, String.format("%s (%s)", mc.getName(), mc.getModId()), this.width / 2, offset, 0xEEEEEE); + } + } + else + { + String text = I18n.format("fml.messages.upgradejava", TextFormatting.RED,TextFormatting.BOLD, TextFormatting.RESET).replaceAll("\\\\n", "\n"); + List lines = Lists.newArrayList(); + for (String line : text.split("\n")) + { + lines.addAll(this.fontRendererObj.listFormattedStringToWidth(line, this.width - this.fontRendererObj.FONT_HEIGHT * 4)); + } + + int maxWidth = 0; + for (String line : lines) + { + maxWidth = Math.max(maxWidth, this.fontRendererObj.getStringWidth(line)); + } + + for (String line : lines) + { + this.drawString(this.fontRendererObj, line, (this.width - maxWidth) / 2, offset, 0xFFFFFF); + offset += this.fontRendererObj.FONT_HEIGHT + 2; + } + + offset += 15; + } + // super.super + for (int i = 0; i < this.buttonList.size(); ++i) + { + ((GuiButton)this.buttonList.get(i)).drawButton(this.mc, mouseX, mouseY); + } + } +} diff --git a/src/main/java/net/minecraftforge/fml/common/DummyModContainer.java b/src/main/java/net/minecraftforge/fml/common/DummyModContainer.java index d9e11b3af0..d73d347c0b 100644 --- a/src/main/java/net/minecraftforge/fml/common/DummyModContainer.java +++ b/src/main/java/net/minecraftforge/fml/common/DummyModContainer.java @@ -32,6 +32,7 @@ public class DummyModContainer implements ModContainer private ModMetadata md; private ArtifactVersion processedVersion; private String label; + private int classVersion; public DummyModContainer(ModMetadata md) { @@ -213,4 +214,16 @@ public class DummyModContainer implements ModContainer { return null; } + + @Override + public void setClassVersion(int classVersion) + { + this.classVersion = classVersion; + } + + @Override + public int getClassVersion() + { + return this.classVersion; + } } diff --git a/src/main/java/net/minecraftforge/fml/common/FMLModContainer.java b/src/main/java/net/minecraftforge/fml/common/FMLModContainer.java index 8452fdc8b0..8cc40bfe9f 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLModContainer.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLModContainer.java @@ -90,6 +90,7 @@ public class FMLModContainer implements ModContainer private Map customModProperties; private ModCandidate candidate; private URL updateJSONUrl; + private int classVersion; public FMLModContainer(String className, ModCandidate container, Map modDescriptor) { @@ -699,4 +700,16 @@ public class FMLModContainer implements ModContainer { return updateJSONUrl; } + + @Override + public void setClassVersion(int classVersion) + { + this.classVersion = classVersion; + } + + @Override + public int getClassVersion() + { + return this.classVersion; + } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/fml/common/InjectedModContainer.java b/src/main/java/net/minecraftforge/fml/common/InjectedModContainer.java index 783c28b2d1..94c67cf78c 100644 --- a/src/main/java/net/minecraftforge/fml/common/InjectedModContainer.java +++ b/src/main/java/net/minecraftforge/fml/common/InjectedModContainer.java @@ -214,4 +214,16 @@ public class InjectedModContainer implements ModContainer { return wrappedContainer.getUpdateUrl(); } + + @Override + public void setClassVersion(int classVersion) + { + wrappedContainer.setClassVersion(classVersion); + } + + @Override + public int getClassVersion() + { + return wrappedContainer.getClassVersion(); + } } diff --git a/src/main/java/net/minecraftforge/fml/common/Java8VersionException.java b/src/main/java/net/minecraftforge/fml/common/Java8VersionException.java new file mode 100644 index 0000000000..c9200f6c85 --- /dev/null +++ b/src/main/java/net/minecraftforge/fml/common/Java8VersionException.java @@ -0,0 +1,43 @@ +/* + * Forge Mod Loader + * Copyright (c) 2012-2013 cpw. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v2.1 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * + * Contributors: + * cpw - implementation + */ + +package net.minecraftforge.fml.common; + +import java.util.List; + +public class Java8VersionException extends EnhancedRuntimeException +{ + private static final long serialVersionUID = 1L; + private final List mods; + + public Java8VersionException(List mods) + { + super("Mods require Java 8"); + this.mods = mods; + } + + @Override + protected void printStackTrace(WrappedPrintStream stream) + { + stream.println("Mods requiring Java 8:"); + for (ModContainer mc : mods) + { + stream.println(String.format("\t%s : %s", mc.getName(), mc.getModId())); + } + stream.println(""); + } + + public List getMods() + { + return mods; + } +} diff --git a/src/main/java/net/minecraftforge/fml/common/Loader.java b/src/main/java/net/minecraftforge/fml/common/Loader.java index 4bca3c0933..f4b514205d 100644 --- a/src/main/java/net/minecraftforge/fml/common/Loader.java +++ b/src/main/java/net/minecraftforge/fml/common/Loader.java @@ -161,6 +161,7 @@ public class Loader private File forcedModFile; private ModDiscoverer discoverer; private ProgressBar progressBar; + public final boolean java8; public static Loader instance() { @@ -187,6 +188,14 @@ public class Loader private Loader() { + String[] ver = System.getProperty("java.version").split("\\."); + int major = Integer.parseInt(ver[1]); + java8 = major > 7; + if (!java8) + { + FMLLog.severe("The game is not running with Java 8. Forge recommends Java 8 for maximum compatibility with mods"); + } + modClassLoader = new ModClassLoader(getClass().getClassLoader()); if (!mccversion.equals(MC_VERSION)) { @@ -489,6 +498,7 @@ public class Loader ModAPIManager.INSTANCE.manageAPI(modClassLoader, discoverer); disableRequestedMods(); modController.distributeStateMessage(FMLLoadEvent.class); + checkJavaCompatibility(); sortModList(); ModAPIManager.INSTANCE.cleanupAPIContainers(modController.getActiveModList()); ModAPIManager.INSTANCE.cleanupAPIContainers(mods); @@ -543,6 +553,24 @@ public class Loader modController.transition(LoaderState.PREINITIALIZATION, false); } + + private void checkJavaCompatibility() + { + if (java8) return; + List j8mods = Lists.newArrayList(); + for (ModContainer mc : getActiveModList()) + { + if (mc.getClassVersion() >= 52) + { + j8mods.add(mc); + } + } + if (!j8mods.isEmpty()) + { + throw new Java8VersionException(j8mods); + } + } + public void preinitializeMods() { if (!modController.isInState(LoaderState.PREINITIALIZATION)) diff --git a/src/main/java/net/minecraftforge/fml/common/ModContainer.java b/src/main/java/net/minecraftforge/fml/common/ModContainer.java index 883f8b95c0..cd82ff05c9 100644 --- a/src/main/java/net/minecraftforge/fml/common/ModContainer.java +++ b/src/main/java/net/minecraftforge/fml/common/ModContainer.java @@ -152,4 +152,8 @@ public interface ModContainer boolean shouldLoadInEnvironment(); URL getUpdateUrl(); + + void setClassVersion(int classVersion); + + int getClassVersion(); } diff --git a/src/main/java/net/minecraftforge/fml/common/discovery/ASMDataTable.java b/src/main/java/net/minecraftforge/fml/common/discovery/ASMDataTable.java index 6eb8dec441..0fd5d7d253 100644 --- a/src/main/java/net/minecraftforge/fml/common/discovery/ASMDataTable.java +++ b/src/main/java/net/minecraftforge/fml/common/discovery/ASMDataTable.java @@ -35,6 +35,7 @@ public class ASMDataTable private String annotationName; private String className; private String objectName; + private int classVersion; private Map annotationInfo; public ASMData(ModCandidate candidate, String annotationName, String className, String objectName, Map info) { diff --git a/src/main/java/net/minecraftforge/fml/common/discovery/JarDiscoverer.java b/src/main/java/net/minecraftforge/fml/common/discovery/JarDiscoverer.java index 226ddd6a1d..77346da50a 100644 --- a/src/main/java/net/minecraftforge/fml/common/discovery/JarDiscoverer.java +++ b/src/main/java/net/minecraftforge/fml/common/discovery/JarDiscoverer.java @@ -83,6 +83,7 @@ public class JarDiscoverer implements ITypeDiscoverer table.addContainer(container); foundMods.add(container); container.bindMetadata(mc); + container.setClassVersion(modParser.getClassVersion()); } } } diff --git a/src/main/resources/assets/forge/lang/en_US.lang b/src/main/resources/assets/forge/lang/en_US.lang index 7c35d8e56d..cbdf6681ab 100644 --- a/src/main/resources/assets/forge/lang/en_US.lang +++ b/src/main/resources/assets/forge/lang/en_US.lang @@ -1,5 +1,5 @@ commands.forge.usage=Use /forge . Subcommands are tps, track -commands.forge.usage.tracking=Use /forge track . Valid types are te (Tile Entities). Duration is < 60. +commands.forge.usage.tracking=Use /forge track . Valid types are te (Tile Entities). Duration is < 60. commands.forge.tps.summary=%s : Mean tick time: %d ms. Mean TPS: %d commands.forge.tracking.te.enabled=Tile Entity tracking enabled for %d seconds. @@ -153,4 +153,18 @@ fml.menu.mods.normal=Normal fml.menu.mods.search=Search: fml.menu.modoptions=Mod Options... -item.forge.bucketFilled.name=%s Bucket \ No newline at end of file +item.forge.bucketFilled.name=%s Bucket + +fml.messages.java8problem=%s%sJava Update Required%s +fml.messages.java8recommended=%s%sJava Update Recommended%s +fml.messages.modslistedbelow=The mods listed below %s +fml.messages.requirejava8=require Java 8 +fml.messages.java8warning.1=%sJAVA VERSION WARNING%s UPDATE JAVA! +fml.messages.java8warning.2=You need to update Java +fml.messages.javaversion=Your Java version is Java %s (version string %s) +fml.messages.upgradejavaorremove=%s%sUpdate Java%s or remove these mods to play +fml.messages.upgradejava=\n\nPros of updating to Java 8\n- Better Performance\n- Better Security\n- Better Compatibility with newer mods +fml.messages.countbadandgood=%s of %s mods have this problem + +fml.button.visitjavadownloads=Oracle Java SE Downloads +fml.button.continue=Continue \ No newline at end of file From 3177d55579ae20f142c8b8deba2b27d5426c7666 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 3 May 2016 19:54:04 -0700 Subject: [PATCH 243/243] Remove usage of AsynchronousExecutor library in favor or a simpler implementation. --- .../common/chunkio/ChunkIOExecutor.java | 124 +++++- .../common/chunkio/ChunkIOProvider.java | 125 ++++-- .../common/chunkio/QueuedChunk.java | 1 - .../common/util/AsynchronousExecutor.java | 360 ------------------ src/main/resources/lgpl-3.0.txt | 165 -------- 5 files changed, 198 insertions(+), 577 deletions(-) delete mode 100644 src/main/java/net/minecraftforge/common/util/AsynchronousExecutor.java delete mode 100644 src/main/resources/lgpl-3.0.txt diff --git a/src/main/java/net/minecraftforge/common/chunkio/ChunkIOExecutor.java b/src/main/java/net/minecraftforge/common/chunkio/ChunkIOExecutor.java index e4cda1d766..3b8fccbf27 100644 --- a/src/main/java/net/minecraftforge/common/chunkio/ChunkIOExecutor.java +++ b/src/main/java/net/minecraftforge/common/chunkio/ChunkIOExecutor.java @@ -1,32 +1,130 @@ package net.minecraftforge.common.chunkio; -import net.minecraftforge.common.util.AsynchronousExecutor; +import java.util.Iterator; +import java.util.Map; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; -public class ChunkIOExecutor { +import com.google.common.collect.Maps; + +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.storage.AnvilChunkLoader; +import net.minecraft.world.gen.ChunkProviderServer; +import net.minecraftforge.fml.common.FMLLog; + +public class ChunkIOExecutor +{ static final int BASE_THREADS = 1; static final int PLAYERS_PER_THREAD = 50; - private static final AsynchronousExecutor instance = new AsynchronousExecutor(new ChunkIOProvider(), BASE_THREADS); + private static final Map tasks = Maps.newConcurrentMap(); + private static final ThreadPoolExecutor pool = new ThreadPoolExecutor(BASE_THREADS, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, + new LinkedBlockingQueue(), + new ThreadFactory() + { + private AtomicInteger count = new AtomicInteger(1); + @Override + public Thread newThread(Runnable r) + { + Thread thread = new Thread(r, "Chunk I/O Executor Thread-" + count.getAndIncrement()); + thread.setDaemon(true); + return thread; + } + } + ); - public static net.minecraft.world.chunk.Chunk syncChunkLoad(net.minecraft.world.World world, net.minecraft.world.chunk.storage.AnvilChunkLoader loader, net.minecraft.world.gen.ChunkProviderServer provider, int x, int z) { - return instance.getSkipQueue(new QueuedChunk(x, z, loader, world, provider)); + //Load the chunk completely in this thread. Dequeue as needed... + public static Chunk syncChunkLoad(World world, AnvilChunkLoader loader, ChunkProviderServer provider, int x, int z) + { + QueuedChunk key = new QueuedChunk(x, z, loader, world, provider); + ChunkIOProvider task = tasks.get(key); + if (task != null) + { + if (!pool.remove(task) && !task.runFinished()) // If it wasn't in the pool, and run hasn't finished, then wait for the async thread. + { + synchronized(task) + { + try + { + task.wait(); + } + catch (InterruptedException e) + { + e.printStackTrace(); // Something happened? Log it? + } + } + } + } + else + { + task = new ChunkIOProvider(key); + task.run(); + } + task.syncCallback(); + return task.getChunk(); } - public static void queueChunkLoad(net.minecraft.world.World world, net.minecraft.world.chunk.storage.AnvilChunkLoader loader, net.minecraft.world.gen.ChunkProviderServer provider, int x, int z, Runnable runnable) { - instance.add(new QueuedChunk(x, z, loader, world, provider), runnable); + //Queue the chunk to be loaded, and call the runnable when finished + public static void queueChunkLoad(World world, AnvilChunkLoader loader, ChunkProviderServer provider, int x, int z, Runnable runnable) + { + QueuedChunk key = new QueuedChunk(x, z, loader, world, provider); + ChunkIOProvider task = tasks.get(key); + if (task == null) + { + task = new ChunkIOProvider(key); + task.addCallback(runnable); // Add before calling execute for thread safety + tasks.put(key, task); + pool.execute(task); + } + else + { + task.addCallback(runnable); + } } // Abuses the fact that hashCode and equals for QueuedChunk only use world and coords - public static void dropQueuedChunkLoad(net.minecraft.world.World world, int x, int z, Runnable runnable) { - instance.drop(new QueuedChunk(x, z, null, world, null), runnable); + // Remove the chunk from the queue if it's in the list. + public static void dropQueuedChunkLoad(World world, int x, int z, Runnable runnable) + { + QueuedChunk key = new QueuedChunk(x, z, null, world, null); + ChunkIOProvider task = tasks.get(key); + if (task == null) + { + FMLLog.warning("Attempted to dequeue chunk that wasn't queued? %d @ (%d, %d)", world.provider.getDimension(), x, z); + return; + } + + task.removeCallback(runnable); + + if (!task.hasCallback()) + { + tasks.remove(key); + pool.remove(task); + } } - public static void adjustPoolSize(int players) { + public static void adjustPoolSize(int players) + { int size = Math.max(BASE_THREADS, (int) Math.ceil(players / PLAYERS_PER_THREAD)); - instance.setActiveThreads(size); + pool.setCorePoolSize(size); } - public static void tick() { - instance.finishActive(); + public static void tick() + { + Iterator itr = tasks.values().iterator(); + while (itr.hasNext()) + { + ChunkIOProvider task = itr.next(); + if (task.runFinished() && task.hasCallback()) + { + task.syncCallback(); + } + itr.remove(); + } } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/common/chunkio/ChunkIOProvider.java b/src/main/java/net/minecraftforge/common/chunkio/ChunkIOProvider.java index 4b38198227..b76a7cfd67 100644 --- a/src/main/java/net/minecraftforge/common/chunkio/ChunkIOProvider.java +++ b/src/main/java/net/minecraftforge/common/chunkio/ChunkIOProvider.java @@ -1,64 +1,113 @@ package net.minecraftforge.common.chunkio; - import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.storage.AnvilChunkLoader; +import net.minecraft.world.gen.ChunkProviderServer; +import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.util.AsynchronousExecutor; import net.minecraftforge.event.world.ChunkDataEvent; import java.io.IOException; -import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.ConcurrentLinkedQueue; -class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider { - private final AtomicInteger threadNumber = new AtomicInteger(1); +class ChunkIOProvider implements Runnable +{ + private QueuedChunk chunkInfo; + private Chunk chunk; + private NBTTagCompound nbt; + private ConcurrentLinkedQueue callbacks = new ConcurrentLinkedQueue(); + private boolean ran = false; - // async stuff - public net.minecraft.world.chunk.Chunk callStage1(QueuedChunk queuedChunk) throws RuntimeException { - net.minecraft.world.chunk.storage.AnvilChunkLoader loader = queuedChunk.loader; - Object[] data = null; - try { - data = loader.loadChunk__Async(queuedChunk.world, queuedChunk.x, queuedChunk.z); - } catch (IOException e) { - e.printStackTrace(); + ChunkIOProvider(QueuedChunk chunk) + { + this.chunkInfo = chunk; + } + + public void addCallback(Runnable callback) + { + this.callbacks.add(callback); + } + public void removeCallback(Runnable callback) + { + this.callbacks.remove(callback); + } + + @Override + public void run() // async stuff + { + synchronized(this) + { + AnvilChunkLoader loader = chunkInfo.loader; + Object[] data = null; + try + { + data = loader.loadChunk__Async(chunkInfo.world, chunkInfo.x, chunkInfo.z); + } + catch (IOException e) + { + e.printStackTrace(); + } + + if (data != null) + { + this.nbt = (NBTTagCompound)data[1]; + this.chunk = (Chunk)data[0]; + } + + this.ran = true; + this.notifyAll(); } - - if (data != null) { - queuedChunk.compound = (net.minecraft.nbt.NBTTagCompound) data[1]; - return (net.minecraft.world.chunk.Chunk) data[0]; - } - - return null; } // sync stuff - public void callStage2(QueuedChunk queuedChunk, net.minecraft.world.chunk.Chunk chunk) throws RuntimeException { - if(chunk == null) { + public void syncCallback() + { + ChunkProviderServer provider = this.chunkInfo.provider; + if (chunk == null) + { // If the chunk loading failed just do it synchronously (may generate) - queuedChunk.provider.originalLoadChunk(queuedChunk.x, queuedChunk.z); + provider.originalLoadChunk(this.chunkInfo.x, this.chunkInfo.z); return; } - queuedChunk.loader.loadEntities(queuedChunk.world, queuedChunk.compound.getCompoundTag("Level"), chunk); - MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(chunk, queuedChunk.compound)); // Don't call ChunkDataEvent.Load async - chunk.setLastSaveTime(queuedChunk.provider.worldObj.getTotalWorldTime()); - queuedChunk.provider.id2ChunkMap.add(ChunkCoordIntPair.chunkXZ2Int(queuedChunk.x, queuedChunk.z), chunk); - queuedChunk.provider.loadedChunks.add(chunk); - chunk.onChunkLoad(); + // Load Entities + this.chunkInfo.loader.loadEntities(this.chunkInfo.world, this.nbt.getCompoundTag("Level"), this.chunk); - if (queuedChunk.provider.chunkGenerator != null) { - queuedChunk.provider.chunkGenerator.recreateStructures(chunk, queuedChunk.x, queuedChunk.z); + MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(this.chunk, this.nbt)); // Don't call ChunkDataEvent.Load async + + this.chunk.setLastSaveTime(provider.worldObj.getTotalWorldTime()); + provider.id2ChunkMap.add(ChunkCoordIntPair.chunkXZ2Int(this.chunkInfo.x, this.chunkInfo.z), this.chunk); + provider.loadedChunks.add(this.chunk); + this.chunk.onChunkLoad(); + + if (provider.chunkGenerator != null) + { + provider.chunkGenerator.recreateStructures(this.chunk, this.chunkInfo.x, this.chunkInfo.z); } - chunk.populateChunk(queuedChunk.provider, queuedChunk.provider.chunkGenerator); + this.chunk.populateChunk(provider, provider.chunkGenerator); + + for (Runnable r : this.callbacks) + { + r.run(); + } + + this.callbacks.clear(); } - public void callStage3(QueuedChunk queuedChunk, net.minecraft.world.chunk.Chunk chunk, Runnable runnable) throws RuntimeException { - runnable.run(); + public Chunk getChunk() + { + return this.chunk; } - public Thread newThread(Runnable runnable) { - Thread thread = new Thread(runnable, "Chunk I/O Executor Thread-" + threadNumber.getAndIncrement()); - thread.setDaemon(true); - return thread; + public boolean runFinished() + { + return this.ran; + } + + public boolean hasCallback() + { + return this.callbacks.size() > 0; } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/common/chunkio/QueuedChunk.java b/src/main/java/net/minecraftforge/common/chunkio/QueuedChunk.java index 039d75c636..d813242e64 100644 --- a/src/main/java/net/minecraftforge/common/chunkio/QueuedChunk.java +++ b/src/main/java/net/minecraftforge/common/chunkio/QueuedChunk.java @@ -7,7 +7,6 @@ class QueuedChunk { final net.minecraft.world.chunk.storage.AnvilChunkLoader loader; final net.minecraft.world.World world; final net.minecraft.world.gen.ChunkProviderServer provider; - net.minecraft.nbt.NBTTagCompound compound; public QueuedChunk(int x, int z, net.minecraft.world.chunk.storage.AnvilChunkLoader loader, net.minecraft.world.World world, net.minecraft.world.gen.ChunkProviderServer provider) { this.x = x; diff --git a/src/main/java/net/minecraftforge/common/util/AsynchronousExecutor.java b/src/main/java/net/minecraftforge/common/util/AsynchronousExecutor.java deleted file mode 100644 index 9457c55765..0000000000 --- a/src/main/java/net/minecraftforge/common/util/AsynchronousExecutor.java +++ /dev/null @@ -1,360 +0,0 @@ -package net.minecraftforge.common.util; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; - -import net.minecraftforge.fml.common.FMLLog; - - -/** - * Executes tasks using a multi-stage process executor. Synchronous executions are via {@link AsynchronousExecutor#finishActive()} or the {@link AsynchronousExecutor#get(Object)} methods. - *

  • Stage 1 creates the object from a parameter, and is usually called asynchronously. - *
  • Stage 2 takes the parameter and object from stage 1 and does any synchronous processing to prepare it. - *
  • Stage 3 takes the parameter and object from stage 1, as well as a callback that was registered, and performs any synchronous calculations. - * - * @param

    The type of parameter you provide to make the object that will be created. It should implement {@link Object#hashCode()} and {@link Object#equals(Object)} if you want to get the value early. - * @param The type of object you provide. This is created in stage 1, and passed to stage 2, 3, and returned if get() is called. - * @param The type of callback you provide. You may register many of these to be passed to the provider in stage 3, one at a time. - * @param A type of exception you may throw and expect to be handled by the main thread - * @author Wesley Wolfe (c) 2012, 2014 - */ -public final class AsynchronousExecutor { - - public static interface CallBackProvider extends ThreadFactory { - - /** - * Normally an asynchronous call, but can be synchronous - * - * @param parameter parameter object provided - * @return the created object - */ - T callStage1(P parameter) throws E; - - /** - * Synchronous call - * - * @param parameter parameter object provided - * @param object the previously created object - */ - void callStage2(P parameter, T object) throws E; - - /** - * Synchronous call, called multiple times, once per registered callback - * - * @param parameter parameter object provided - * @param object the previously created object - * @param callback the current callback to execute - */ - void callStage3(P parameter, T object, C callback) throws E; - } - - private static class StateHolder { - - protected static final int PENDING = 0x0; - protected static final int STAGE_1_ASYNC = PENDING + 1; - protected static final int STAGE_1_SYNC = STAGE_1_ASYNC + 1; - protected static final int STAGE_1_COMPLETE = STAGE_1_SYNC + 1; - protected static final int FINISHED = STAGE_1_COMPLETE + 1; - - protected volatile int state = PENDING; - - protected static final AtomicIntegerFieldUpdater STATE = AtomicIntegerFieldUpdater.newUpdater(StateHolder.class, "state"); - } - - private class Task extends StateHolder implements Runnable { - - private final P parameter; - private T object; - private final List callbacks = new LinkedList(); - private E t = null; - - private Task(final P parameter) { - this.parameter = parameter; - } - - public void run() { - if (initAsync()) { - finished.add(this); - } - } - - private boolean initAsync() { - if (STATE.compareAndSet(this, PENDING, STAGE_1_ASYNC)) { - boolean ret = true; - - try { - init(); - } finally { - if (STATE.compareAndSet(this, STAGE_1_ASYNC, STAGE_1_COMPLETE)) { - // No one is/will be waiting - } else { - // We know that the sync thread will be waiting - synchronized (this) { - if (state != STAGE_1_SYNC) { - // They beat us to the synchronized block - this.notifyAll(); - } else { - // We beat them to the synchronized block - } - state = STAGE_1_COMPLETE; // They're already synchronized, atomic locks are not needed - } - // We want to return false, because we know a synchronous task already handled the finish() - ret = false; // Don't return inside finally; VERY bad practice. - } - } - - return ret; - } else { - return false; - } - } - - private void initSync() { - if (STATE.compareAndSet(this, PENDING, STAGE_1_COMPLETE)) { - // If we succeed that variable switch, good as done - init(); - } else if (STATE.compareAndSet(this, STAGE_1_ASYNC, STAGE_1_SYNC)) { - // Async thread is running, but this shouldn't be likely; we need to sync to wait on them because of it. - synchronized (this) { - if (STATE.compareAndSet(this, STAGE_1_SYNC, PENDING)) { // They might NOT synchronized yet, atomic lock IS needed - // We are the first into the lock - while (state != STAGE_1_COMPLETE) { - try { - this.wait(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new RuntimeException("Unable to handle interruption on " + parameter, e); - } - } - } else { - // They beat us to the synchronized block - } - } - } else { - // Async thread is not pending, the more likely situation for a task not pending - } - } - - @SuppressWarnings("unchecked") - private void init() { - try { - object = provider.callStage1(parameter); - } catch (final Throwable t) { - this.t = (E) t; - } - } - - @SuppressWarnings("unchecked") - private T get() throws E { - initSync(); - if (callbacks.isEmpty()) { - // 'this' is a placeholder to prevent callbacks from being empty during finish call - // See get method below - callbacks.add((C) this); - } - finish(); - return object; - } - - private void finish() throws E { - switch (state) { - default: - case PENDING: - case STAGE_1_ASYNC: - case STAGE_1_SYNC: - throw new IllegalStateException("Attempting to finish unprepared(" + state + ") task(" + parameter + ")"); - case STAGE_1_COMPLETE: - try { - if (t != null) { - throw t; - } - if (callbacks.isEmpty()) { - return; - } - - final CallBackProvider provider = AsynchronousExecutor.this.provider; - final P parameter = this.parameter; - final T object = this.object; - - provider.callStage2(parameter, object); - for (C callback : callbacks) { - if (callback == this) { - // 'this' is a placeholder to prevent callbacks from being empty on a get() call - // See get method above - continue; - } - provider.callStage3(parameter, object, callback); - } - } finally { - tasks.remove(parameter); - state = FINISHED; - } - case FINISHED: - } - } - - private boolean drop() { - if (STATE.compareAndSet(this, PENDING, FINISHED)) { - // If we succeed that variable switch, good as forgotten - tasks.remove(parameter); - return true; - } else { - // We need the async thread to finish normally to properly dispose of the task - return false; - } - } - } - - private final CallBackProvider provider; - private final Queue finished = new ConcurrentLinkedQueue(); - private final Map tasks = new HashMap(); - private final ThreadPoolExecutor pool; - - /** - * Uses a thread pool to pass executions to the provider. - * @see AsynchronousExecutor - */ - public AsynchronousExecutor(final CallBackProvider provider, final int coreSize) { - if (provider == null) { - throw new IllegalArgumentException("Provider cannot be null"); - } - this.provider = provider; - - // We have an unbound queue size so do not need a max thread size - pool = new ThreadPoolExecutor(coreSize, Integer.MAX_VALUE, 60l, TimeUnit.SECONDS, new LinkedBlockingQueue(), provider); - } - - /** - * Adds a callback to the parameter provided, adding parameter to the queue if needed. - *

    - * This should always be synchronous. - */ - public void add(P parameter, C callback) { - Task task = tasks.get(parameter); - if (task == null) { - tasks.put(parameter, task = new Task(parameter)); - pool.execute(task); - } - task.callbacks.add(callback); - } - - /** - * This removes a particular callback from the specified parameter. - *

    - * If no callbacks remain for a given parameter, then the {@link CallBackProvider CallBackProvider's} stages may be omitted from execution. - * Stage 3 will have no callbacks, stage 2 will be skipped unless a {@link #get(Object)} is used, and stage 1 will be avoided on a best-effort basis. - *

    - * Subsequent calls to {@link #getSkipQueue(Object)} will always work. - *

    - * Subsequent calls to {@link #get(Object)} might work. - *

    - * This should always be synchronous - * @return true if no further execution for the parameter is possible, such that, no exceptions will be thrown in {@link #finishActive()} for the parameter, and {@link #get(Object)} will throw an {@link IllegalStateException}, false otherwise - * @throws IllegalStateException if parameter is not in the queue anymore - * @throws IllegalStateException if the callback was not specified for given parameter - */ - public boolean drop(P parameter, C callback) throws IllegalStateException { - final Task task = tasks.get(parameter); - if (task == null) { - // Print debug info for QueuedChunk and avoid crash - //throw new IllegalStateException("Unknown " + parameter); - FMLLog.info("Unknown %s", parameter); - FMLLog.info("This should not happen. Please report this error to Forge."); - return false; - } - if (!task.callbacks.remove(callback)) { - throw new IllegalStateException("Unknown " + callback + " for " + parameter); - } - if (task.callbacks.isEmpty()) { - return task.drop(); - } - return false; - } - - /** - * This method attempts to skip the waiting period for said parameter. - *

    - * This should always be synchronous. - * @throws IllegalStateException if the parameter is not in the queue anymore, or sometimes if called from asynchronous thread - */ - public T get(P parameter) throws E, IllegalStateException { - final Task task = tasks.get(parameter); - if (task == null) { - throw new IllegalStateException("Unknown " + parameter); - } - return task.get(); - } - - /** - * Processes a parameter as if it was in the queue, without ever passing to another thread. - */ - public T getSkipQueue(P parameter) throws E { - return skipQueue(parameter); - } - - /** - * Processes a parameter as if it was in the queue, without ever passing to another thread. - */ - public T getSkipQueue(P parameter, C callback) throws E { - final T object = skipQueue(parameter); - provider.callStage3(parameter, object, callback); - return object; - } - - /** - * Processes a parameter as if it was in the queue, without ever passing to another thread. - */ - public T getSkipQueue(P parameter, C... callbacks) throws E { - final CallBackProvider provider = this.provider; - final T object = skipQueue(parameter); - for (C callback : callbacks) { - provider.callStage3(parameter, object, callback); - } - return object; - } - - /** - * Processes a parameter as if it was in the queue, without ever passing to another thread. - */ - public T getSkipQueue(P parameter, Iterable callbacks) throws E { - final CallBackProvider provider = this.provider; - final T object = skipQueue(parameter); - for (C callback : callbacks) { - provider.callStage3(parameter, object, callback); - } - return object; - } - - private T skipQueue(P parameter) throws E { - Task task = tasks.get(parameter); - if (task != null) { - return task.get(); - } - T object = provider.callStage1(parameter); - provider.callStage2(parameter, object); - return object; - } - - /** - * This is the 'heartbeat' that should be called synchronously to finish any pending tasks - */ - public void finishActive() throws E { - final Queue finished = this.finished; - while (!finished.isEmpty()) { - finished.poll().finish(); - } - } - - public void setActiveThreads(final int coreSize) { - pool.setCorePoolSize(coreSize); - } -} \ No newline at end of file diff --git a/src/main/resources/lgpl-3.0.txt b/src/main/resources/lgpl-3.0.txt deleted file mode 100644 index 02bbb60bc4..0000000000 --- a/src/main/resources/lgpl-3.0.txt +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. \ No newline at end of file